Ver código fonte

【功能优化】商品结算页现在可展示优惠券是否可用以及是否可用的原因

Xiao_123 11 meses atrás
pai
commit
0e6f7bee53

+ 11 - 4
sheep/components/s-coupon-select/s-coupon-select.vue

@@ -16,9 +16,16 @@
         :scroll-with-animation="false"
         :enable-back-to-top="true"
       >
+        <!--可使用的优惠券区域-->
         <view class="subtitle ss-m-l-20">可使用优惠券</view>
         <view v-for="(item, index) in state.couponInfo" :key="index">
           <s-coupon-list :data="item" type="user" :disabled="false">
+            <template v-slot:reason>
+              <view class="ss-flex ss-m-t-24">
+                <view class="reason-title">可用原因:</view>
+                <view class="reason-desc">{{ item.description || '已达到使用门槛' }}</view>
+              </view>
+            </template>
             <template #default>
               <label class="ss-flex ss-col-center" @tap="radioChange(item.id)">
                 <radio
@@ -31,19 +38,19 @@
             </template>
           </s-coupon-list>
         </view>
-        <!-- TODO 芋艿:未来接口需要支持下
+        <!--不可使用的优惠券区域-->
         <view class="subtitle ss-m-t-40 ss-m-l-20">不可使用优惠券</view>
-        <view v-for="item in state.couponInfo.cannot_use" :key="item.id">
+        <view v-for="item in state.couponInfo.filter(coupon => !coupon.match)" :key="item.id">
           <s-coupon-list :data="item" type="user" :disabled="true">
             <template v-slot:reason>
               <view class="ss-flex ss-m-t-24">
                 <view class="reason-title"> 不可用原因:</view>
-                <view class="reason-desc">{{ item.cannot_use_msg }}</view>
+                <view class="reason-desc">{{ item.description || '未达到使用门槛' }}</view>
               </view>
             </template>
           </s-coupon-list>
         </view>
-      -->
+     
       </scroll-view>
     </view>
     <view class="modal-footer ss-flex">

+ 0 - 2
sheep/components/s-groupon-block/s-groupon-block.vue

@@ -128,8 +128,6 @@
 		activity.products.forEach((product) => {
 			spu.price = Math.min(spu.price, product.combinationPrice); // 设置 SPU 的最低价格
 		});
-		// 将活动总限购数量赋值给库存
-    spu.stock = activity.totalLimitCount
 		productList.value = [spu];
 	});
 </script>