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) } }