From e17d5ffcaa1de919e3b44a3d29b06387e99f1809 Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Mon, 25 Nov 2024 17:11:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user/coupon.vue | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pages/user/coupon.vue b/pages/user/coupon.vue index 9c8db2a..46f1ec0 100644 --- a/pages/user/coupon.vue +++ b/pages/user/coupon.vue @@ -327,7 +327,7 @@ let productList = selectCouponData.filter(v => v.type == 2); if ( couponList.length > 0 ) { uni.cache.set('selectCouponData',productList) - if ( this.couopnInfo ) { + if ( this.couopnInfo && this.orderId ) { let params = { shopId: this.shopId, orderId: this.orderId, @@ -346,17 +346,20 @@ let productList = selectCouponData.filter(v => v.type == 2); if ( productList.length > 0 ) { uni.cache.set('selectCouponData',couponList) - let params = { - shopId: this.shopId, - orderId: this.orderId, + + if ( this.couopnInfo && this.orderId ) { + let params = { + shopId: this.shopId, + orderId: this.orderId, + } + if ( this.couopnInfo.userCouponInfos.filter(v => v.type == 1).length > 0 ) { + params.userCouponInfos = this.couopnInfo.userCouponInfos.filter(v => v.type == 1) + } + if ( this.couopnInfo.isPointsChecked && this.couopnInfo.calcUsablePointsData.pointsNum && this.couopnInfo.calcUsablePointsData.pointsNum > 0) { + params.pointsNum = this.couopnInfo.calcUsablePointsData.pointsNum; + } + let res = await this.api.useCoupon(params) } - if ( this.couopnInfo.userCouponInfos.filter(v => v.type == 1).length > 0 ) { - params.userCouponInfos = this.couopnInfo.userCouponInfos.filter(v => v.type == 1) - } - if ( this.couopnInfo.isPointsChecked && this.couopnInfo.calcUsablePointsData.pointsNum && this.couopnInfo.calcUsablePointsData.pointsNum > 0) { - params.pointsNum = this.couopnInfo.calcUsablePointsData.pointsNum; - } - let res = await this.api.useCoupon(params) } }