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();
|
||||
},
|
||||
}
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
},
|
||||
goUrl(item){
|
||||
if ( this.listinfo.status == 'unpaid' || this.listinfo.status == 'paying') {
|
||||
let couopnInfo;
|
||||
switch (item.type){
|
||||
case 'coupon':
|
||||
let payAmount = this.listinfo.payAmount;
|
||||
@@ -469,10 +470,19 @@
|
||||
if ( couponList.length > 0 ) {
|
||||
payAmount = payAmount + couponList.discountAmount;
|
||||
}
|
||||
|
||||
couopnInfo = {
|
||||
payAmount: this.listinfo.payAmount,
|
||||
userCouponInfos: this.userCouponInfos,
|
||||
freeDisabled: this.freeDisabled,
|
||||
freeCheck: this.freeCheck,
|
||||
calcUsablePointsData: this.calcUsablePointsData,
|
||||
isPointsChecked: this.isPointsChecked,
|
||||
}
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "orderInfo_coupon",
|
||||
shopId: this.listinfo.shopId,
|
||||
orderId: this.listinfo.orderInfo.id,
|
||||
couopnInfo: JSON.stringify(couopnInfo),
|
||||
payAmount: payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||
productList: JSON.stringify(couponList)
|
||||
@@ -480,9 +490,19 @@
|
||||
break;
|
||||
case 'product':
|
||||
let productList = this.userCouponInfos.filter(v => v.type == 2);
|
||||
couopnInfo = {
|
||||
payAmount: this.listinfo.payAmount,
|
||||
userCouponInfos: this.userCouponInfos,
|
||||
freeDisabled: this.freeDisabled,
|
||||
freeCheck: this.freeCheck,
|
||||
calcUsablePointsData: this.calcUsablePointsData,
|
||||
isPointsChecked: this.isPointsChecked,
|
||||
}
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "orderInfo_product",
|
||||
shopId: this.listinfo.shopId,
|
||||
orderId: this.listinfo.orderInfo.id,
|
||||
couopnInfo: JSON.stringify(couopnInfo),
|
||||
payAmount: this.listinfo.payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||
productList: JSON.stringify(productList)
|
||||
|
||||
@@ -303,7 +303,6 @@
|
||||
orderId: this.listinfo.orderId,
|
||||
userCouponInfos: this.couopnInfo.userCouponInfos,
|
||||
}
|
||||
console.log( this.couopnInfo )
|
||||
if ( this.couopnInfo.isPointsChecked && this.couopnInfo.calcUsablePointsData.pointsNum && this.couopnInfo.calcUsablePointsData.pointsNum > 0) {
|
||||
params.pointsNum = this.couopnInfo.calcUsablePointsData.pointsNum;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user