2.0.0修改更新
This commit is contained in:
@@ -98,6 +98,8 @@
|
|||||||
type: "",
|
type: "",
|
||||||
payAmount: 0,
|
payAmount: 0,
|
||||||
shopId: null,
|
shopId: null,
|
||||||
|
orderId: null,
|
||||||
|
couopnInfo: null,
|
||||||
shoppingCart: [],
|
shoppingCart: [],
|
||||||
productList: [],
|
productList: [],
|
||||||
|
|
||||||
@@ -108,6 +110,8 @@
|
|||||||
if (options.type) { this.type = options.type }
|
if (options.type) { this.type = options.type }
|
||||||
if (options.payAmount) { this.payAmount = options.payAmount }
|
if (options.payAmount) { this.payAmount = options.payAmount }
|
||||||
if (options.shopId) { this.shopId = options.shopId }
|
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.shoppingCart) { this.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart)) }
|
||||||
if (options.productList) { this.productList = JSON.parse(decodeURIComponent(options.productList)) }
|
if (options.productList) { this.productList = JSON.parse(decodeURIComponent(options.productList)) }
|
||||||
},
|
},
|
||||||
@@ -316,21 +320,46 @@
|
|||||||
/**
|
/**
|
||||||
* 取消使用优惠券/商品券
|
* 取消使用优惠券/商品券
|
||||||
*/
|
*/
|
||||||
cancelCoupon () {
|
async cancelCoupon () {
|
||||||
let selectCouponData = uni.cache.get('selectCouponData')
|
let selectCouponData = uni.cache.get('selectCouponData')
|
||||||
if ( this.type == 'confirm_order_coupon' || this.type == 'orderInfo_coupon' ) {
|
if ( this.type == 'confirm_order_coupon' || this.type == 'orderInfo_coupon' ) {
|
||||||
let couponList = selectCouponData.filter(v => v.type == 1);
|
let couponList = selectCouponData.filter(v => v.type == 1);
|
||||||
let productList = selectCouponData.filter(v => v.type == 2);
|
let productList = selectCouponData.filter(v => v.type == 2);
|
||||||
if ( couponList.length > 0 ) {
|
if ( couponList.length > 0 ) {
|
||||||
uni.cache.set('selectCouponData',productList)
|
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' ) {
|
} else if ( this.type == 'confirm_order_product' || this.type == 'orderInfo_product' ) {
|
||||||
let couponList = selectCouponData.filter(v => v.type == 1);
|
let couponList = selectCouponData.filter(v => v.type == 1);
|
||||||
let productList = selectCouponData.filter(v => v.type == 2);
|
let productList = selectCouponData.filter(v => v.type == 2);
|
||||||
if ( productList.length > 0 ) {
|
if ( productList.length > 0 ) {
|
||||||
uni.cache.set('selectCouponData',couponList)
|
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();
|
uni.navigateBack();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -462,6 +462,7 @@
|
|||||||
},
|
},
|
||||||
goUrl(item){
|
goUrl(item){
|
||||||
if ( this.listinfo.status == 'unpaid' || this.listinfo.status == 'paying') {
|
if ( this.listinfo.status == 'unpaid' || this.listinfo.status == 'paying') {
|
||||||
|
let couopnInfo;
|
||||||
switch (item.type){
|
switch (item.type){
|
||||||
case 'coupon':
|
case 'coupon':
|
||||||
let payAmount = this.listinfo.payAmount;
|
let payAmount = this.listinfo.payAmount;
|
||||||
@@ -469,10 +470,19 @@
|
|||||||
if ( couponList.length > 0 ) {
|
if ( couponList.length > 0 ) {
|
||||||
payAmount = payAmount + couponList.discountAmount;
|
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', {
|
uni.pro.navigateTo('/pages/user/coupon', {
|
||||||
type: "orderInfo_coupon",
|
type: "orderInfo_coupon",
|
||||||
shopId: this.listinfo.shopId,
|
shopId: this.listinfo.shopId,
|
||||||
|
orderId: this.listinfo.orderInfo.id,
|
||||||
|
couopnInfo: JSON.stringify(couopnInfo),
|
||||||
payAmount: payAmount,
|
payAmount: payAmount,
|
||||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||||
productList: JSON.stringify(couponList)
|
productList: JSON.stringify(couponList)
|
||||||
@@ -480,9 +490,19 @@
|
|||||||
break;
|
break;
|
||||||
case 'product':
|
case 'product':
|
||||||
let productList = this.userCouponInfos.filter(v => v.type == 2);
|
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', {
|
uni.pro.navigateTo('/pages/user/coupon', {
|
||||||
type: "orderInfo_product",
|
type: "orderInfo_product",
|
||||||
shopId: this.listinfo.shopId,
|
shopId: this.listinfo.shopId,
|
||||||
|
orderId: this.listinfo.orderInfo.id,
|
||||||
|
couopnInfo: JSON.stringify(couopnInfo),
|
||||||
payAmount: this.listinfo.payAmount,
|
payAmount: this.listinfo.payAmount,
|
||||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||||
productList: JSON.stringify(productList)
|
productList: JSON.stringify(productList)
|
||||||
|
|||||||
@@ -303,7 +303,6 @@
|
|||||||
orderId: this.listinfo.orderId,
|
orderId: this.listinfo.orderId,
|
||||||
userCouponInfos: this.couopnInfo.userCouponInfos,
|
userCouponInfos: this.couopnInfo.userCouponInfos,
|
||||||
}
|
}
|
||||||
console.log( this.couopnInfo )
|
|
||||||
if ( this.couopnInfo.isPointsChecked && this.couopnInfo.calcUsablePointsData.pointsNum && this.couopnInfo.calcUsablePointsData.pointsNum > 0) {
|
if ( this.couopnInfo.isPointsChecked && this.couopnInfo.calcUsablePointsData.pointsNum && this.couopnInfo.calcUsablePointsData.pointsNum > 0) {
|
||||||
params.pointsNum = this.couopnInfo.calcUsablePointsData.pointsNum;
|
params.pointsNum = this.couopnInfo.calcUsablePointsData.pointsNum;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user