From 9b6d1a9a97ba8ead560bcc6ba70abb946984cce8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 7 Sep 2024 12:06:10 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E5=95=86=E5=9F=8E=EF=BC=9A=E4=BB=B7=E6=A0=BC=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=97=B6=EF=BC=8C=E8=BF=94=E5=9B=9E=E5=8F=AF=E7=94=A8?= =?UTF-8?q?=20+=20=E4=B8=8D=E5=8F=AF=E7=94=A8=E7=9A=84=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=8A=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/confirm.vue | 61 ++++++++++--------- sheep/api/promotion/coupon.js | 17 ------ .../s-coupon-list/s-coupon-list.vue | 20 ++---- .../s-coupon-select/s-coupon-select.vue | 37 ++++++----- 4 files changed, 61 insertions(+), 74 deletions(-) diff --git a/pages/order/confirm.vue b/pages/order/confirm.vue index b18df4f7..6c49bb1e 100644 --- a/pages/order/confirm.vue +++ b/pages/order/confirm.vue @@ -52,25 +52,38 @@ class="score-img" /> - {{ state.pointStatus ? state.orderInfo.totalPoint - state.orderInfo.usePoint : (state.orderInfo.totalPoint || 0) }} + {{ + state.pointStatus + ? state.orderInfo.totalPoint - state.orderInfo.usePoint + : state.orderInfo.totalPoint || 0 + }} - + - + 运费 +¥{{ fen2yuan(state.orderInfo.price.deliveryPrice) }} - 免运费 + 免运费 - + 联系人 - + 联系电话 item.spuId), - state.orderPayload.items.map((item) => item.skuId), - state.orderPayload.items.map((item) => item.categoryId), - ); - if (code === 0) { - state.couponInfo = data; - } - } - onLoad(async (options) => { if (!options.data) { sheep.$helper.toast('参数不正确,请检查!'); @@ -334,13 +337,15 @@ } state.orderPayload = JSON.parse(options.data); await getOrderInfo(); - await getCoupons(); }); // 使用 watch 监听地址和配送方式的变化 watch(addressState, async (newAddress, oldAddress) => { // 如果收货地址或配送方式有变化,则重新计算价格 - if (newAddress.addressInfo.id !== oldAddress.addressInfo.id || newAddress.deliveryType !== oldAddress.deliveryType) { + if ( + newAddress.addressInfo.id !== oldAddress.addressInfo.id || + newAddress.deliveryType !== oldAddress.deliveryType + ) { await getOrderInfo(); } }); diff --git a/sheep/api/promotion/coupon.js b/sheep/api/promotion/coupon.js index c9dfa524..f0382ee0 100644 --- a/sheep/api/promotion/coupon.js +++ b/sheep/api/promotion/coupon.js @@ -79,23 +79,6 @@ const CouponApi = { }, }); }, - // 获得匹配指定商品的优惠劵列表 - getMatchCouponList: (price, spuIds, skuIds, categoryIds) => { - return request({ - url: '/promotion/coupon/match-list', - method: 'GET', - params: { - price, - spuIds: spuIds.join(','), - skuIds: skuIds.join(','), - categoryIds: categoryIds.join(','), - }, - custom: { - showError: false, - showLoading: false, // 避免影响 settlementOrder 结算的结果 - }, - }); - } }; export default CouponApi; diff --git a/sheep/components/s-coupon-list/s-coupon-list.vue b/sheep/components/s-coupon-list/s-coupon-list.vue index 411a4c0e..1c76e701 100644 --- a/sheep/components/s-coupon-list/s-coupon-list.vue +++ b/sheep/components/s-coupon-list/s-coupon-list.vue @@ -37,30 +37,22 @@ 有效期:领取后 {{ data.fixedEndTerm }} 天内可用 - + 有效期: {{ sheep.$helper.timeFormat(data.validStartTime, 'yyyy-mm-dd') }} 至 {{ sheep.$helper.timeFormat(data.validEndTime, 'yyyy-mm-dd') }} - + 满 {{ fen2yuan(data.usePrice) }} 可用 - {{ data.description }} @@ -76,12 +68,10 @@