商品券相关优化更新
This commit is contained in:
@@ -68,6 +68,10 @@
|
||||
<u-loadmore :status="form.status" iconSize='24' fontSize='24' height='40' />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btnBox" v-if="type == 'confirm_order_coupon' || type == 'confirm_order_product'">
|
||||
<view class="btn" @click="cancelCoupon" >暂不使用券</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -133,7 +137,7 @@
|
||||
userId: uni.cache.get('userInfo').id,
|
||||
status: this.status
|
||||
}
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product' ) {
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product' || this.type == 'orderInfo_coupon' || this.type == 'orderInfo_product' ) {
|
||||
params.orderId = -1;
|
||||
}
|
||||
if ( this.shopId ) {
|
||||
@@ -163,7 +167,7 @@
|
||||
*/
|
||||
navigatorGo ( item ) {
|
||||
uni.cache.set('shopId',item.shopId)
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product') {
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product' || this.type == 'orderInfo_coupon' || this.type == 'orderInfo_product' ) {
|
||||
if ( item.type == 1 ) {
|
||||
if( this.payAmount < item.fullAmount) {
|
||||
uni.showToast({
|
||||
@@ -173,6 +177,20 @@
|
||||
return;
|
||||
}
|
||||
uni.$emit('couponItem', JSON.stringify(item))
|
||||
let selectCouponData = uni.cache.get('selectCouponData') || [];
|
||||
let couponList = selectCouponData.filter(v => v.type == 1);
|
||||
if ( couponList.length > 0) {
|
||||
couponList.map(items => {
|
||||
if ( item.type == 1 ) {
|
||||
for(var v in items){
|
||||
items[v] = item[v]
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
selectCouponData.push(item)
|
||||
}
|
||||
uni.cache.set('selectCouponData',selectCouponData)
|
||||
uni.navigateBack();
|
||||
} else {
|
||||
let productNum = 0;//商品购物车数量
|
||||
@@ -208,7 +226,45 @@
|
||||
})
|
||||
return;
|
||||
}
|
||||
let isNum = 0;
|
||||
let isProductItem;
|
||||
// 确认订单
|
||||
if ( this.type == 'confirm_order_product' ) {
|
||||
product.forEach(item => {
|
||||
for (let i = 0; i < item.number; i++){
|
||||
isNum++
|
||||
if ( isNum == productTicketNum+1 ) {
|
||||
isProductItem = item;
|
||||
}
|
||||
}
|
||||
})
|
||||
if ( this.payAmount < (isProductItem.memberPrice > 0 ? isProductItem.memberPrice : isProductItem.salePrice)) {
|
||||
uni.showToast({
|
||||
title: `当前金额不足商品抵扣`,
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 订单详情
|
||||
if ( this.type == 'orderInfo_product' ) {
|
||||
product.forEach(item => {
|
||||
for (let i = 0; i < item.num; i++){
|
||||
isNum++
|
||||
if ( isNum == productTicketNum+1 ) {
|
||||
isProductItem = item;
|
||||
}
|
||||
}
|
||||
})
|
||||
if ( this.payAmount < (isProductItem.memberPrice > 0 ? isProductItem.memberPrice : isProductItem.price)) {
|
||||
uni.showToast({
|
||||
title: `当前金额不足商品抵扣`,
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// let productNum = 0;
|
||||
@@ -226,6 +282,9 @@
|
||||
|
||||
// }
|
||||
uni.$emit('couponItem', JSON.stringify(item))
|
||||
let selectCouponData = uni.cache.get('selectCouponData') || [];
|
||||
selectCouponData.push(item)
|
||||
uni.cache.set('selectCouponData',selectCouponData)
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
@@ -237,6 +296,27 @@
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 取消使用优惠券/商品券
|
||||
*/
|
||||
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)
|
||||
}
|
||||
} 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)
|
||||
}
|
||||
}
|
||||
uni.navigateBack();
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -311,7 +391,7 @@
|
||||
height: 192rpx;
|
||||
background: #E3AD7F;
|
||||
border-radius: 18rpx 0rpx 0rpx 18rpx;
|
||||
|
||||
padding: 0 20rpx;
|
||||
|
||||
|
||||
// ::before {
|
||||
@@ -463,7 +543,25 @@
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.btnBox{
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: #fff;
|
||||
padding: 30rpx 30rpx 50rpx 30rpx;
|
||||
.btn{
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 36rpx;
|
||||
color: #FFFFFF;
|
||||
border-radius: 12rpx;
|
||||
background: #E3AD7F;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user