diff --git a/src/pages/confirmOrder/confirmOrder.vue b/src/pages/confirmOrder/confirmOrder.vue
index 10402b1..2ef17d4 100644
--- a/src/pages/confirmOrder/confirmOrder.vue
+++ b/src/pages/confirmOrder/confirmOrder.vue
@@ -23,25 +23,34 @@
@tap="toaddAddress"
class="list order-user"
>
-
+
- 默认
-
- {{addressInfo.name}}
+ >
+ 默认
+
+ {{addressInfo.name}}
{{addressInfo.mobile}}
-
+
{{addressInfo.address}}\n{{addressInfo.add_detail}}
-
-
- 点击添加地址
-
+
+
+ 点击添加地址
+
{
- if (code === 1) {
- // console.log('code', code, data)
- this.showAddress = true
- this.addressInfo = data
- }
- })
+ store
+ .dispatch('address/details', {
+ add_id: addressId,
+ })
+ .then(({ code, data }) => {
+ if (code === 1) {
+ // console.log('code', code, data)
+ this.showAddress = true
+ this.addressInfo = data
+ }
+ })
}
},
onLoad({ pid, addressId, isCart, count, name }) {
- if (isCart == 'false') {
+ if (isCart == 'false') {
this.pid = pid
// store.dispatch('read/fetch', {
- // pid,
+ // pid,
// })
- }
+ }
this.count = count
this.name = name
this.isCart = isCart
@@ -307,36 +316,36 @@ export default {
if (code === 1) {
// console.log('code', code, data)
this.showAddress = true
- this.addressInfo = data
+ this.addressInfo = data
}
})
} else {
store.dispatch('address/default').then(({ code, data }) => {
- this.showAddress = true
- this.addressInfo = data
- console.log("this.addressInfo", this.addressInfo)
+ this.showAddress = true
+ this.addressInfo = data
+ console.log('this.addressInfo', this.addressInfo)
})
}
},
computed: {
- totalPrice() {
- if (this.isCart == 'true') {
- let total = 0
- this.$store.state.cart.checkedCartLst.map(item => {
- total += item.nowPrice * item.num
- })
- return total
- } else {
- return this.buyItem.real_price * this.count
- }
- },
- buyItem() {
- return this.$store.state.cart.buyItem
- },
- // checkedCartLst(){
- // console.log('checkedCartLst',this.$store.state.cart.checkedCartLst)
- // return this.$store.state.cart.checkedCartLst
- // },
+ totalPrice() {
+ if (this.isCart == 'true') {
+ let total = 0
+ this.$store.state.cart.checkedCartLst.map(item => {
+ total += item.nowPrice * item.num
+ })
+ return total
+ } else {
+ return this.buyItem.real_price * this.count
+ }
+ },
+ buyItem() {
+ return this.$store.state.cart.buyItem
+ },
+ // checkedCartLst(){
+ // console.log('checkedCartLst',this.$store.state.cart.checkedCartLst)
+ // return this.$store.state.cart.checkedCartLst
+ // },
goodInfo() {
// console.log('state', this.$store.state.read.goodInfo)
return this.$store.state.read.goodInfo
@@ -354,17 +363,17 @@ export default {
methods: {
counter(isadd, index) {
if (isadd) {
- if (this.isCart == 'true') {
- this.checkedCartLst[index].num++
- } else {
+ if (this.isCart == 'true') {
+ this.checkedCartLst[index].num++
+ } else {
this.count++
- }
+ }
} else {
- if (this.isCart == 'true') {
- this.checkedCartLst[index].num <= 1 ? (this.disabled = true) : this.checkedCartLst[index].num--
- } else {
- this.count <= 1 ? (this.disabled = true) : this.count--
- }
+ if (this.isCart == 'true') {
+ this.checkedCartLst[index].num <= 1 ? (this.disabled = true) : this.checkedCartLst[index].num--
+ } else {
+ this.count <= 1 ? (this.disabled = true) : this.count--
+ }
}
},
// 跳转添加地址页面
@@ -379,63 +388,63 @@ export default {
})
},
// 下单
- orderBuild() {
- if(!this.addressInfo){
- uni.showLoading({
- title: '请先添加地址',
- })
- return
- }
+ orderBuild() {
+ if (!this.addressInfo) {
+ uni.showLoading({
+ title: '请先添加地址',
+ })
+ return
+ }
uni.showLoading({
title: '支付中',
- })
- if (this.isCart === 'true') {
- const checkedGoods = []
- const sk_id_arr = []
- this.checkedCartLst.map(item => {
- checkedGoods.push(item.cart_id)
- sk_id_arr.push(item.sk_id)
- })
- store.dispatch('order/build', {
+ })
+ if (this.isCart === 'true') {
+ const checkedGoods = []
+ const sk_id_arr = []
+ this.checkedCartLst.map(item => {
+ checkedGoods.push(item.cart_id)
+ sk_id_arr.push(item.sk_id)
+ })
+ store.dispatch('order/build', {
uid: this.$store.state.user.userInfo.uid,
- address: JSON.stringify(this.addressInfo),
+ address: JSON.stringify(this.addressInfo),
checkedGoods: checkedGoods,
- sk_id_arr: sk_id_arr,
- totalPrice: this.totalPrice,
- }).then((res) => {
- this.pay(res)
- })
- }
- if (this.isCart === 'false') {
- const { sk_id_arr: skId, mp_id: mpId } = this.$store.state.order.param
- store.dispatch('order/buyNow', {
- pid: skId.pid,
- sk_id: skId.sk_id,
- number: this.count,
- mp_id: mpId,
- address: JSON.stringify(this.addressInfo),
- totalPrice: this.totalPrice,
- liuyan: this.note,
- dir: 1,
- }).then((res) => {
- this.pay(res)
- })
- }
+ sk_id_arr: sk_id_arr,
+ totalPrice: this.totalPrice * 100,
+ }).then((res) => {
+ this.pay(res)
+ })
+ }
+ if (this.isCart === 'false') {
+ const { sk_id_arr: skId, mp_id: mpId } = this.$store.state.order.param
+ store.dispatch('order/buyNow', {
+ pid: skId.pid,
+ sk_id: skId.sk_id,
+ number: this.count,
+ mp_id: mpId,
+ address: JSON.stringify(this.addressInfo),
+ totalPrice: this.totalPrice * 100,
+ liuyan: this.note,
+ dir: 1,
+ }).then((res) => {
+ this.pay(res)
+ })
+ }
},
// 支付
pay(res) {
console.log('pay', res)
- const { data, exKeyName: keyName } = res
+ const { data, exKeyName: keyName } = res
const uid = uni.getStorageSync('uid')
const timeStamp = new Date().getTime().toString()
- const nonceStr = 'asfafasfasfasfasf'
+ const nonceStr = 'asfafasfasfasfasf'
// 支付参数
const fieldSet = {
openid: this.$store.state.user.userInfo.openid,
uid: this.$store.state.user.userInfo.uid,
shopid: 0,
payCate: 2020,
- payMoney: this.totalPrice,
+ payMoney: this.totalPrice * 100,
payWoodId: `fcdj-${uid}-${keyName}`,
payWoodDesc: '在【非常戴镜】的微信付款凭证',
nonceStr,
@@ -443,13 +452,13 @@ export default {
app_uid: 2020,
timeStamp,
keyname: keyName,
- billInfo: JSON.stringify({
- address:this.addressInfo,
- list:data,
- keyname: keyName
- }),
- }
- console.log("fieldSet", fieldSet)
+ billInfo: JSON.stringify({
+ address: this.addressInfo,
+ list: data,
+ keyname: keyName,
+ }),
+ }
+ console.log('fieldSet', fieldSet)
// 请求后台支付接口
store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => {
if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') {
@@ -601,9 +610,9 @@ export default {
.price {
color: #ff6b4a;
font-size: 28rpx;
- text{
- margin-left: 10rpx;
- }
+ text {
+ margin-left: 10rpx;
+ }
}
.originCost {
text-decoration: line-through;
diff --git a/src/pages/myOrder/components/OrderCard.vue b/src/pages/myOrder/components/OrderCard.vue
index 85684eb..b3de3c3 100644
--- a/src/pages/myOrder/components/OrderCard.vue
+++ b/src/pages/myOrder/components/OrderCard.vue
@@ -41,12 +41,12 @@
{{orderInfo.p_name}}
{{orderInfo.p_name}}
- {{orderInfo.nowPrice}}
+ ¥{{orderInfo.nowPrice}}
X {{orderInfo.num}}
- 实付:{{order.total_fee}}
+ 实付:¥{{order.total_fee}}
{{orderInfo.p_name}}
{{orderInfo.p_name}}
- {{orderInfo.nowPrice}}
+ ¥{{orderInfo.nowPrice}}
X {{orderInfo.num}}
- 实付:{{order.total_fee}}
+ 实付:¥{{order.total_fee}}
{
- const keyname = res.order_info.keyname
- uni.showModal({
- title: '提示',
- content: '现在取消,订单不可恢复哦,确认取消吗?',
- success: function(res) {
- if (res.confirm) {
- store.dispatch('cancelOrder/cancel', {
- keyname: keyname,
- uid: uid,
- openid: openid,
- }).then((res) => {
- console.log(res)
- if (res.code == 1) {
- store.dispatch('myOrder/getList', {
- way: '',
- })
- } else {
- uni.showToast({
- title: '取消失败,服务器错误!',
- icon: 'none',
- })
- }
- })
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- },
- })
+ const { keyname } = this.order.order_info
+ console.log('keyname', keyname)
+
+ uni.showModal({
+ title: '提示',
+ content: '现在取消,订单不可恢复哦,确认取消吗?',
+ success: function(res) {
+ if (res.confirm) {
+ store.dispatch('cancelOrder/cancel', {
+ keyname: keyname,
+ }).then((res) => {
+ console.log(res)
+ if (res.code === 1) {
+ store.dispatch('myOrder/getList', {
+ way: '',
+ })
+ } else {
+ uni.showToast({
+ title: '取消失败,服务器错误!',
+ icon: 'none',
+ })
+ }
+ })
+ } else if (res.cancel) {
+ console.log('用户点击取消')
+ }
+ },
})
},
toDetail(pid) {
diff --git a/src/pages/myOrder/myOrder.vue b/src/pages/myOrder/myOrder.vue
index 248eed4..cd08275 100644
--- a/src/pages/myOrder/myOrder.vue
+++ b/src/pages/myOrder/myOrder.vue
@@ -27,7 +27,7 @@
@@ -35,57 +35,57 @@