Kaynağa Gözat

优惠说明

lifanagju_citu 6 ay önce
ebeveyn
işleme
9969e268a3
1 değiştirilmiş dosya ile 21 ekleme ve 4 silme
  1. 21 4
      pages/goods/index.vue

+ 21 - 4
pages/goods/index.vue

@@ -93,7 +93,11 @@
                 {{ formatSales('exact', state.goodsInfo.salesCount) }}
               </view>
             </view>
-            <view class="discounts-box ss-flex ss-row-between ss-m-b-28">
+            <!-- 优惠说明 -->
+            <view v-if="checkContent(state.goodsInfo?.activeIntroduction)" class="richtext ss-m-b-28">
+              <mp-html :content="state.goodsInfo.activeIntroduction" />
+            </view>
+            <view class="discounts-box ss-flex ss-row-between ss-m-b-8">
               <!-- 查看优惠劵的描述 -->
               <view
                 class="tag ss-m-r-10"
@@ -108,7 +112,7 @@
                 }}
               </view>
               <!-- 查看满减送的描述 -->
-              <div class="tag-content">
+              <view class="tag-content">
                 <view class="tag-box ss-flex">
                   <!-- 最多打印 3 条,所以需要扣除优惠劵已打印的 -->
                   <view
@@ -122,7 +126,7 @@
                     <text>{{ item }}</text>
                   </view>
                 </view>
-              </div>
+              </view>
               <!-- 领取优惠劵的按钮 -->
               <view
                 class="get-coupon-box ss-flex ss-col-center ss-m-l-20"
@@ -135,7 +139,8 @@
             </view>
             <view class="title-text ss-line-2 ss-m-b-6">{{ state.goodsInfo.name }}</view>
             <view class="subtitle-text ss-line-1">{{ state.goodsInfo.introduction }}</view>
-          </view>
+            </view>
+            
 
           <!-- 功能卡片 -->
           <view class="detail-cell-card detail-card ss-flex-col">
@@ -262,6 +267,12 @@
     state.selectedSku = e;
     state.settlementSku = e;
   }
+
+  const checkContent = (content) => {
+    if (!content) return false
+    const text = content.replace(/<[^>]*>/g, '').trim();
+    return text.length > 0
+  }
   
   // 点击加入购物车,虚拟商品不能加入购物车
   function handleJoinShoppingCart () {
@@ -677,4 +688,10 @@
     display: flex;
     justify-content: flex-end;
   }
+  .richtext {
+    color: #fff;
+    background-color: #fb0037;
+    border-radius: 10px;
+    padding: 10px;
+  }
 </style>