From 781f3c962586eba4bcf03bd4a33c7e1f2aeced50 Mon Sep 17 00:00:00 2001 From: hflllll Date: Sat, 24 May 2025 14:55:46 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=9C=80=E5=90=8E=E7=9A=84=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=8D=B7BUG'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/model/order.js | 22 +++++ components/order/OrderItem.vue | 2 +- mixins/order.js | 144 ++++++++++++++++++---------- pages/index/cart.vue | 82 ++++++++-------- pages/index/order.vue | 13 +-- pages_order/components/order/placeOrder.vue | 56 +++++++---- pages_order/mine/coupon.vue | 7 +- pages_order/mine/unbindTeam.vue | 31 +++++- pages_order/order/cartOrder.vue | 106 +++++++++++--------- pages_order/order/newOrderDetail.vue | 16 +++- 10 files changed, 307 insertions(+), 172 deletions(-) diff --git a/api/model/order.js b/api/model/order.js index 579550b..7b81393 100644 --- a/api/model/order.js +++ b/api/model/order.js @@ -14,6 +14,28 @@ const api = { method: 'GET', limit: 500 }, + + // 优惠券-领取优惠券 + fetchCoupon: { + url: '/teambuy/coupon/fetchCoupon', + method: 'POST', + limit: 500 + }, + + // 优惠券-查看可领取的优惠券 + queryFetchCouponList: { + url: '/teambuy/coupon/queryFetchCouponList', + method: 'GET', + limit: 500 + }, + + // 优惠券-使用优惠券 + // useCoupon: { + // url: '/teambuy/coupon/useCoupon', + // method: 'POST', + // limit: 500 + // }, + // 订单- 查询团餐订单列表 - 详情 queryLeaderOrderList: { url: '/teambuy/order/queryLeaderOrderList', diff --git a/components/order/OrderItem.vue b/components/order/OrderItem.vue index d41da98..4027d10 100644 --- a/components/order/OrderItem.vue +++ b/components/order/OrderItem.vue @@ -25,7 +25,7 @@ 下单时间:{{ order.createTime }} 合计: - ¥{{ order.priceAll }} + ¥{{ order.pricePay }} diff --git a/mixins/order.js b/mixins/order.js index b1650dd..5306c24 100644 --- a/mixins/order.js +++ b/mixins/order.js @@ -8,63 +8,107 @@ export default { computed: { }, methods: { - // 立即支付 - toPayOrder(item){ - let api = '' - - // if([0, 1].includes(item.shopState)){ - // api = 'createOrderTwo' - // }else{ - api = 'createSumOrderAgain' - // } - - this.$api(api, { - orderId : item.id, - addressId : item.addressId + // 支付接口 + handlePay(orderParams) { + uni.showLoading({ + title: '支付处理中...' + }) + if (!orderParams.userCouponId) { + // 没有优惠卷 则不传 + delete orderParams.userCouponId + } + this.$api('createOrder', { + ...orderParams }, res => { - if(res.code == 200){ - uni.requestPaymentWxPay(res) - .then(res => { + uni.hideLoading() + if (res.code === 200) { + if (this.payMethod == '0') { + uni.requestPaymentWxPay(res) + .then(n => { + setTimeout(uni.redirectTo, 700, { + url: '/pages/index/order?tabIndex=1' + }) + }) + .catch(err => { + uni.showToast({ + title: '支付失败', + icon: 'error' + }) + setTimeout(uni.redirectTo, 700, { + url: '/pages/index/order?tabIndex=0' + }) + }) + } else { uni.showToast({ - title: '支付成功', - icon: 'none' + title: '下单成功', + icon: 'success' }) - this.getData() - }).catch(n => { - this.getData() - }) - } - }) - }, - // 确认收货 - confirmOrder(item){ - uni.showModal({ - title: '您收到货了吗?', - success : e => { - if(e.confirm){ - this.$api('confirmOrder', { - orderId : item.id, - }, res => { - this.getData() - }) - } - } - }) - }, - // 取消订单 - cancelOrder(item){ - uni.showModal({ - title: '确认取消订单吗?', - success : e => { - if(e.confirm){ - this.$api('cancelOrder', { - orderId : item.id, - }, res => { - this.getData() + setTimeout(uni.redirectTo, 700, { + url: '/pages/index/order?tabIndex=1' }) } } }) }, + + + // 立即支付 + // toPayOrder(item){ + // let api = '' + + // // if([0, 1].includes(item.shopState)){ + // // api = 'createOrderTwo' + // // }else{ + // api = 'createSumOrderAgain' + // // } + + // this.$api(api, { + // orderId : item.id, + // addressId : item.addressId + // }, res => { + // if(res.code == 200){ + // uni.requestPaymentWxPay(res) + // .then(res => { + // uni.showToast({ + // title: '支付成功', + // icon: 'none' + // }) + // this.getData() + // }).catch(n => { + // this.getData() + // }) + // } + // }) + // }, + // 确认收货 + // confirmOrder(item){ + // uni.showModal({ + // title: '您收到货了吗?', + // success : e => { + // if(e.confirm){ + // this.$api('confirmOrder', { + // orderId : item.id, + // }, res => { + // this.getData() + // }) + // } + // } + // }) + // }, + // // 取消订单 + // cancelOrder(item){ + // uni.showModal({ + // title: '确认取消订单吗?', + // success : e => { + // if(e.confirm){ + // this.$api('cancelOrder', { + // orderId : item.id, + // }, res => { + // this.getData() + // }) + // } + // } + // }) + // }, } } \ No newline at end of file diff --git a/pages/index/cart.vue b/pages/index/cart.vue index d5c4cf2..d50f870 100644 --- a/pages/index/cart.vue +++ b/pages/index/cart.vue @@ -1,7 +1,12 @@ diff --git a/pages_order/mine/coupon.vue b/pages_order/mine/coupon.vue index f0b5a21..0c64763 100644 --- a/pages_order/mine/coupon.vue +++ b/pages_order/mine/coupon.vue @@ -4,7 +4,7 @@ - + @@ -78,6 +78,7 @@ export default { // 切换标签页 changeTab(item) { this.currentTab = item.index + this.getCoupon() }, // 使用优惠券 @@ -86,6 +87,7 @@ export default { uni.showModal({ title: '提示', content: `确定使用面值${coupon.discount}元的优惠券吗?`, + confirmColor: '#019245', success: (res) => { // 模拟使用优惠券 uni.showLoading({ @@ -115,7 +117,8 @@ export default { getCoupon() { this.$api('queryCouponList', { pageNo: 1, - pageSize: 10000 + pageSize: 10000, + status: this.currentTab }, res => { if (res.code === 200){ this.allCoupons = res.result.records diff --git a/pages_order/mine/unbindTeam.vue b/pages_order/mine/unbindTeam.vue index af6b968..1b55b8c 100644 --- a/pages_order/mine/unbindTeam.vue +++ b/pages_order/mine/unbindTeam.vue @@ -23,7 +23,10 @@ {{ currentPickupPoint.phone }} - + + 解绑中... + + 解绑 @@ -107,8 +110,9 @@ export default { uni.showToast({ title: `${res.message}` }) + this.getLeaderList() } - this.getLeaderList() + }) } } @@ -133,6 +137,7 @@ export default { title: `${res.message}`, icon: 'success', }) + this.getLeaderList() } }) } @@ -142,15 +147,18 @@ export default { }, getLeaderList() { // this.currentPickupPoint = currentPickupPoint + // this.nearbyPickupPoints = [] + // this.currentPickupPoint = {} + this.isBind = true this.$api('queryLeaderList', {}, res => { if (res.code == 200) { this.nearbyPickupPoints = res.result.records } }) this.$api('queryMyLeader', {}, res => { - if (res.code == 200) { + if (res.code == 200 && res.result.bindStatus !== '2') { this.currentPickupPoint = res.result - } else if (res.code == 500 || !res.result) { + } else if (res.code == 500 || !res.result || res.result.bindStatus == '2') { this.isBind = false } }) @@ -241,6 +249,21 @@ export default { transform: translateY(-50%); } +// 隔一层会灰雾雾的效果 +.cancel-btn { + background-color: $uni-color-second; + color: #fff; + width: 120rpx; + height: 60rpx; + display: flex; + justify-content: center; + align-items: center; + border-radius: 10rpx; + align-self: center; + font-size: 24rpx; + opacity: 0.7; +} + .select-btn { background-color: $uni-color; color: #fff; diff --git a/pages_order/order/cartOrder.vue b/pages_order/order/cartOrder.vue index b6365ac..6564f6f 100644 --- a/pages_order/order/cartOrder.vue +++ b/pages_order/order/cartOrder.vue @@ -68,7 +68,7 @@ - {{ couponData.couponId_dictText || '点击选择优惠卷->' }} + {{ couponData.couponId_dictText || '请选择优惠卷' }} {{ couponData.discount ? ('-' + couponData.discount) : '' }} @@ -81,7 +81,7 @@ 备注 - @@ -94,11 +94,10 @@ 微信支付 - + - 账户余额(余额: ¥{{ userInfo.balance - }}) - + 账户余额(余额: ¥{{ (userInfo.balance || 0).toFixed(2) || 0 }}) + @@ -112,7 +111,7 @@ ¥{{ (pricePay || 0).toFixed(2) || 0 }} - 立即下单 + 立即下单 @@ -120,8 +119,10 @@