Browse Source

【功能完善】积分商城:完善积分+价格显示样式

puhui999 10 months ago
parent
commit
d7a18f9c01

+ 2 - 39
pages/activity/point/list.vue

@@ -1,18 +1,6 @@
 <!-- 积分商城:商品列表  -->
 <template>
   <s-layout title="积分商城" navbar="normal" :leftWidth="0" :rightWidth="0">
-    <!-- 筛选 -->
-    <su-sticky bgColor="#fff">
-      <view class="ss-flex">
-        <view class="ss-flex-1">
-
-        </view>
-        <view class="list-icon" @tap="iconStatus = !iconStatus">
-          <text v-if="iconStatus" class="sicon-goods-list" />
-          <text v-else class="sicon-goods-card" />
-        </view>
-      </view>
-    </su-sticky>
     <scroll-view
       class="scroll-box"
       :style="{ height: pageHeight + 'rpx' }"
@@ -20,7 +8,7 @@
       :scroll-with-animation="false"
       :enable-back-to-top="true"
     >
-      <s-point-card ref="sPointCardRef" :property="sPointCardData" class="ss-p-x-20 ss-m-t-20"/>
+      <s-point-card ref="sPointCardRef" class="ss-p-x-20 ss-m-t-20"/>
       <s-empty
         v-if="activityTotal === 0"
         icon="/static/goods-empty.png"
@@ -40,7 +28,7 @@
 <script setup>
   import sheep from '@/sheep';
   import { onLoad, onReachBottom } from '@dcloudio/uni-app';
-  import { computed, reactive, ref } from 'vue';
+  import { reactive, ref } from 'vue';
   import PointApi from '@/sheep/api/promotion/point';
   import SLayout from '@/sheep/components/s-layout/s-layout.vue';
 
@@ -50,32 +38,7 @@
   const pageHeight =
     (safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sheep.$platform.navbar - 350;
 
-  const sPointCardData = ref({
-    'layoutType': 'twoCol',
-  });
-  // 布局类型
-  const LayoutTypeEnum = {
-    // 单列大图
-    ONE_COL_BIG_IMG: 'oneColBigImg',
-    // 双列
-    TWO_COL: 'twoCol',
-  };
   const sPointCardRef = ref();
-  // true - 单列布局;false - 双列布局
-  const iconStatus = computed({
-    get() {
-      return sPointCardData.value.layoutType === LayoutTypeEnum.ONE_COL_BIG_IMG;
-    },
-    set(newValue) {
-      newValue ? (sPointCardData.value.layoutType = LayoutTypeEnum.ONE_COL_BIG_IMG) :
-        (sPointCardData.value.layoutType = LayoutTypeEnum.TWO_COL);
-      // 只有双列布局时需要
-      if (sPointCardData.value.layoutType === LayoutTypeEnum.TWO_COL) {
-        // 分列
-        sPointCardRef.value.calculateGoodsColumn();
-      }
-    },
-  });
   // 查询活动列表
   const activityPageParams = reactive({
     pageNo: 1, // 页码

+ 3 - 4
pages/goods/point.vue

@@ -31,15 +31,14 @@
         <view class="title-card detail-card ss-p-y-40 ss-p-x-20">
           <view class="ss-flex ss-row-between ss-col-center ss-m-b-18">
             <view class="price-box ss-flex ss-col-bottom">
-              <view v-if="getShowPrice.price > 0" class="price-text"> ¥{{ getShowPrice.price }}</view>
-              <text v-if="getShowPrice.price > 0 && getShowPrice.point > 0">+</text>
               <image
                 :src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
                 class="point-img"
               ></image>
-              <view class="point-text ss-m-r-16">
+              <text class="point-text ss-m-r-16">
                 {{ getShowPrice.point }}
-              </view>
+                {{ !getShowPrice.price || getShowPrice.price === 0 ? '' : `+¥${getShowPrice.price}` }}
+              </text>
             </view>
             <view class="sales-text">
               {{ formatExchange(state.goodsInfo.sales_show_type, state.goodsInfo.sales) }}

+ 17 - 3
sheep/components/s-select-seckill-sku/s-select-seckill-sku.vue

@@ -19,8 +19,16 @@
           <view class="goods-title ss-line-2">{{ state.goodsInfo.name }}</view>
           <view class="header-right-bottom ss-flex ss-col-center ss-row-between">
             <!-- 价格 -->
-            <view v-if="state.goodsInfo.activity_type === PromotionActivityTypeEnum.POINT.type" class="price-text">
-              {{ getShowPriceText }}
+            <view v-if="state.goodsInfo.activity_type === PromotionActivityTypeEnum.POINT.type"
+                  class="price-text ss-flex">
+              <image
+                v-if="!isEmpty(state.selectedSku)"
+                :src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
+                class="point-img"
+              ></image>
+              <text class="point-text ss-m-r-16">
+                {{ getShowPriceText }}
+              </text>
             </view>
             <view v-else class="price-text">
               ¥{{ fen2yuan(state.selectedSku.price || state.goodsInfo.price) }}
@@ -124,7 +132,7 @@
     let priceText = `¥${fen2yuan(state.goodsInfo.price)}`;
     if (!isEmpty(state.selectedSku)) {
       const sku = state.selectedSku;
-      priceText = `${sku.point}积分${!sku.pointPrice ? '' : `+¥${fen2yuan(sku.pointPrice)}`}`;
+      priceText = `${sku.point}${!sku.pointPrice ? '' : `+¥${fen2yuan(sku.pointPrice)}`}`;
     }
     return priceText;
   });
@@ -320,6 +328,12 @@
     }
   }
 
+  .point-img {
+    width: 36rpx;
+    height: 36rpx;
+    margin: 0 4rpx;
+  }
+
   .ss-modal-box {
     border-radius: 30rpx 30rpx 0 0;
     max-height: 1000rpx;