2.0.0修改更新
This commit is contained in:
@@ -98,6 +98,8 @@
|
||||
type: "",
|
||||
payAmount: 0,
|
||||
shopId: null,
|
||||
orderId: null,
|
||||
couopnInfo: null,
|
||||
shoppingCart: [],
|
||||
productList: [],
|
||||
|
||||
@@ -108,6 +110,8 @@
|
||||
if (options.type) { this.type = options.type }
|
||||
if (options.payAmount) { this.payAmount = options.payAmount }
|
||||
if (options.shopId) { this.shopId = options.shopId }
|
||||
if (options.orderId) { this.orderId = options.orderId }
|
||||
if (options.couopnInfo) { this.couopnInfo = JSON.parse(decodeURIComponent(options.couopnInfo)) }
|
||||
if (options.shoppingCart) { this.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart)) }
|
||||
if (options.productList) { this.productList = JSON.parse(decodeURIComponent(options.productList)) }
|
||||
},
|
||||
@@ -316,21 +320,46 @@
|
||||
/**
|
||||
* 取消使用优惠券/商品券
|
||||
*/
|
||||
cancelCoupon () {
|
||||
async cancelCoupon () {
|
||||
let selectCouponData = uni.cache.get('selectCouponData')
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'orderInfo_coupon' ) {
|
||||
let couponList = selectCouponData.filter(v => v.type == 1);
|
||||
let productList = selectCouponData.filter(v => v.type == 2);
|
||||
if ( couponList.length > 0 ) {
|
||||
uni.cache.set('selectCouponData',productList)
|
||||
if ( this.couopnInfo ) {
|
||||
let params = {
|
||||
shopId: this.shopId,
|
||||
orderId: this.orderId,
|
||||
}
|
||||
if ( this.couopnInfo.userCouponInfos.filter(v => v.type == 2).length > 0 ) {
|
||||
params.userCouponInfos = this.couopnInfo.userCouponInfos.filter(v => v.type == 2)
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
} else if ( this.type == 'confirm_order_product' || this.type == 'orderInfo_product' ) {
|
||||
let couponList = selectCouponData.filter(v => v.type == 1);
|
||||
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.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)
|
||||
}
|
||||
}
|
||||
|
||||
uni.navigateBack();
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user