瀏覽代碼

【Add】优惠券增加排除范围

liuxiangxin 5 月之前
父節點
當前提交
009de23e03
共有 3 個文件被更改,包括 465 次插入362 次删除
  1. 13 0
      pages/car/order.vue
  2. 1 0
      pages/coupon/index.vue
  3. 451 362
      pages/product/index.vue

+ 13 - 0
pages/car/order.vue

@@ -176,6 +176,19 @@
 										if( isScope ){
 											totalPrice = this.$decimal.add(totalPrice,this.$decimal.mul(this.cartList[j].price,this.cartList[j].buy_num));
 										}
+									// 如果排除商品
+									}else if( this.couponList[i].type_id == 3 ){
+										// 判断商品是不是在排除范围
+										var isExclude = false;
+										// 循环排除范围
+										for (let k in this.couponList[i].product_exclude) {
+											// 如果存在排除范围
+											if( this.couponList[i].product_exclude[k].product_id == this.cartList[j].product_id) isExclude = true;
+										}
+										// 不在排除内的做计算
+										if( !isExclude ){
+											totalPrice = this.$decimal.add(totalPrice,this.$decimal.mul(this.cartList[j].price,this.cartList[j].buy_num));
+										}
 									// 店铺券
 									}else{
 										// 折扣券以及满减券的话,计算价格

+ 1 - 0
pages/coupon/index.vue

@@ -32,6 +32,7 @@
 						<view class="product_scope">
 							<text class="" v-if="item.type_id == 1">限定商品可用</text>
 							<text class="" v-if="item.type_id == 2">全场可用</text>
+							<text class="" v-if="item.type_id == 3">部分商品不可用</text>
 						</view>
 						<view class="coupon_info">
 							<view class="coupon_exp">{{item.exp_time}} 到期</view>

文件差異過大導致無法顯示
+ 451 - 362
pages/product/index.vue


部分文件因文件數量過多而無法顯示