فهرست منبع

feat:权益卡,优惠券显示不可用时间

zhanghui 3 ماه پیش
والد
کامیت
858f28c681

+ 47 - 0
orderPages/myCoupon/module/mescrollUni-item.vue

@@ -62,6 +62,17 @@
 					</view>
 					<view v-if="showRemarkId == item.id" class="remark"  style="text-indent:unset">
             <view  class="remarkText">
+
+              <view v-if="item.unavailableWeeklyTimes || item.unavailableTimeRanges">
+                不可用日期:
+                <view v-if="item.unavailableWeeklyTimes">{{ parseWeeklyTimes(item.unavailableWeeklyTimes) }}</view>
+                <view v-if="item.unavailableTimeRanges">{{ parseTimeRanges(item.unavailableTimeRanges) }}</view>
+              </view>
+              <view v-if="item.delayEffectiveDays > 0">
+                生效时间:
+                <text>购买后{{item.delayEffectiveDays}}天生效</text>
+              </view>
+
               <view>
                 可用门店:<text>{{item.useStoreDesc}}</text>
               </view>
@@ -140,6 +151,42 @@ export default {
 
 	},
 
+  computed: {
+    // 解析 unavailableWeeklyTimes,将 "3,4,5" 转换为 ["星期二", "星期三", "星期四"]
+    parseWeeklyTimes() {
+      return function(times) {
+        if (!times) return '';
+        const arr = times.split(',');
+        const weekMap = {
+          '1': '星期日',
+          '2': '星期一',
+          '3': '星期二',
+          '4': '星期三',
+          '5': '星期四',
+          '6': '星期五',
+          '7': '星期六'
+        };
+        return arr.map(item => weekMap[item]).join('、');
+      };
+    },
+    // 解析 unavailableTimeRanges,将 JSON 字符串转换为可读格式
+    parseTimeRanges() {
+      return function(ranges) {
+        if (!ranges) return '';
+        try {
+          const arr = JSON.parse(ranges);
+          return arr.map(item => {
+            const begin = item.beginTime.split(' ')[0];
+            const end = item.endTime.split(' ')[0];
+            return `${begin} - ${end}`;
+          }).join(';');
+        } catch (e) {
+          return '';
+        }
+      };
+    }
+  },
+
 	created() {
 	},
 

+ 0 - 2
orderPages/receiveCoupons/index.rpx.scss

@@ -30,7 +30,6 @@
   width: 686rpx;
   height: 188rpx;
   margin-top: 24rpx;
-  margin-bottom: 24rpx;
   background-image: url('/static/coupon/u210.png');
   background-repeat: no-repeat;
   background-size: cover;
@@ -132,6 +131,5 @@
   background: #FFFFFF;
   border-radius: 20rpx;
   padding: 20rpx;
-  text-indent: 2em;
   color: #999999;
 }

+ 49 - 1
orderPages/receiveCoupons/index.vue

@@ -52,7 +52,18 @@
             </view>
           </view>
         </view>
-        <view v-if="showRemarkId == item.id" class="remark" style="text-indent:unset">
+        <view v-if="showRemarkId == item.id" class="remark">
+
+          <view v-if="item.unavailableWeeklyTimes || item.unavailableTimeRanges">
+            不可用日期:
+            <view v-if="item.unavailableWeeklyTimes">{{ parseWeeklyTimes(item.unavailableWeeklyTimes) }}</view>
+            <view v-if="item.unavailableTimeRanges">{{ parseTimeRanges(item.unavailableTimeRanges) }}</view>
+          </view>
+          <view v-if="item.delayEffectiveDays > 0">
+            生效时间:
+            <text>购买后{{item.delayEffectiveDays}}天生效</text>
+          </view>
+
           <view>
             可用门店:
             <text>{{ item.useStoreDesc }}</text>
@@ -79,6 +90,43 @@ export default {
       showRemarkId: '',
     };
   },
+
+  computed: {
+    // 解析 unavailableWeeklyTimes,将 "3,4,5" 转换为 ["星期二", "星期三", "星期四"]
+    parseWeeklyTimes() {
+      return function(times) {
+        if (!times) return '';
+        const arr = times.split(',');
+        const weekMap = {
+          '1': '星期日',
+          '2': '星期一',
+          '3': '星期二',
+          '4': '星期三',
+          '5': '星期四',
+          '6': '星期五',
+          '7': '星期六'
+        };
+        return arr.map(item => weekMap[item]).join('、');
+      };
+    },
+    // 解析 unavailableTimeRanges,将 JSON 字符串转换为可读格式
+    parseTimeRanges() {
+      return function(ranges) {
+        if (!ranges) return '';
+        try {
+          const arr = JSON.parse(ranges);
+          return arr.map(item => {
+            const begin = item.beginTime.split(' ')[0];
+            const end = item.endTime.split(' ')[0];
+            return `${begin} - ${end}`;
+          }).join(';');
+        } catch (e) {
+          return '';
+        }
+      };
+    }
+  },
+
   onLoad(option) {
     this.getUserDiscountsList()
   },

+ 46 - 1
storePages/myRights/index.vue

@@ -49,7 +49,15 @@
         </view>
 
         <view v-if="showRemarkId == item.id" class="remark" style="text-indent:unset">
-
+          <view v-if="item.unavailableWeeklyTimes || item.unavailableTimeRanges">
+            不可用日期:
+            <view v-if="item.unavailableWeeklyTimes">{{ parseWeeklyTimes(item.unavailableWeeklyTimes) }}</view>
+            <view v-if="item.unavailableTimeRanges">{{ parseTimeRanges(item.unavailableTimeRanges) }}</view>
+          </view>
+          <view v-if="item.delayEffectiveDays > 0">
+            生效时间:
+            <text>购买后{{item.delayEffectiveDays}}天生效</text>
+          </view>
           <view v-if="item.description !=null">
             使用说明:
             <text>{{ item.description }}</text>
@@ -78,6 +86,43 @@
 				equityList:[],
 			};
 		},
+
+    computed: {
+      // 解析 unavailableWeeklyTimes,将 "3,4,5" 转换为 ["星期二", "星期三", "星期四"]
+      parseWeeklyTimes() {
+        return function(times) {
+          if (!times) return '';
+          const arr = times.split(',');
+          const weekMap = {
+            '1': '星期日',
+            '2': '星期一',
+            '3': '星期二',
+            '4': '星期三',
+            '5': '星期四',
+            '6': '星期五',
+            '7': '星期六'
+          };
+          return arr.map(item => weekMap[item]).join('、');
+        };
+      },
+      // 解析 unavailableTimeRanges,将 JSON 字符串转换为可读格式
+      parseTimeRanges() {
+        return function(ranges) {
+          if (!ranges) return '';
+          try {
+            const arr = JSON.parse(ranges);
+            return arr.map(item => {
+              const begin = item.beginTime.split(' ')[0];
+              const end = item.endTime.split(' ')[0];
+              return `${begin} - ${end}`;
+            }).join(';');
+          } catch (e) {
+            return '';
+          }
+        };
+      }
+    },
+
 		onLoad(option) {
 			let sysInfo = uni.getSystemInfoSync()
 			this.windowHeight =sysInfo.windowHeight - 3 +'px'//除标题栏栏外的屏幕可用高度

+ 75 - 19
storePages/rights/index.vue

@@ -22,33 +22,51 @@
               <!--				</view>-->
             </view>
 
-            <view class="h-center-content flex-col justify-around">
+            <view class="flex-col">
               <view class="h-value">
                 <text>{{ item.title }}</text>
               </view>
-              <view class="title">
-                适用项目:{{ item.serviceProjectName || '' }}
-              </view>
-              <view class="title">
-                适用门店:{{ item.useStoreDesc || '' }}
-              </view>
-              <view class="title">
-                有效天数:{{ item.effectiveDays }}
-              </view>
-              <view class="title flex-row" @click.stop="showRemark(item)">
-                <text>使用规则</text>
-                <u-icon v-if="item.id == showRemarkId" name="arrow-down-fill" color="" size="12"></u-icon>
-                <u-icon v-else name="play-right-fill" color="" size="12"></u-icon>
-              </view>
-            </view>
 
-            <view class="h-right-content flex-col justify-center ">
-              <view class="btn" @click="payRights(item)">
-                <text>购买</text>
+              <view class="flex-row">
+                <view class="h-center-content flex-col justify-around">
+
+                  <view class="title">
+                    适用项目:{{ item.serviceProjectName || '' }}
+                  </view>
+                  <view class="title">
+                    适用门店:{{ item.useStoreDesc || '' }}
+                  </view>
+                  <view class="title">
+                    有效天数:{{ item.effectiveDays }}
+                  </view>
+                  <view class="title flex-row" @click.stop="showRemark(item)">
+                    <text>使用规则</text>
+                    <u-icon v-if="item.id == showRemarkId" name="arrow-down-fill" color="" size="12"></u-icon>
+                    <u-icon v-else name="play-right-fill" color="" size="12"></u-icon>
+                  </view>
+                </view>
+
+                <view class="h-right-content flex-col justify-center ">
+                  <view class="btn" @click="payRights(item)">
+                    <text>购买</text>
+                  </view>
+                </view>
               </view>
+
             </view>
+
+
           </view>
           <view v-if="showRemarkId == item.id" class="remark" style="text-indent:unset">
+            <view v-if="item.unavailableWeeklyTimes || item.unavailableTimeRanges">
+              不可用日期:
+              <view v-if="item.unavailableWeeklyTimes">{{ parseWeeklyTimes(item.unavailableWeeklyTimes) }}</view>
+              <view v-if="item.unavailableTimeRanges">{{ parseTimeRanges(item.unavailableTimeRanges) }}</view>
+            </view>
+            <view v-if="item.delayEffectiveDays > 0">
+              生效时间:
+              <text>购买后{{item.delayEffectiveDays}}天生效</text>
+            </view>
             <view v-if="item.description !=null">
               使用说明:
               <text>{{ item.description }}</text>
@@ -151,6 +169,44 @@ export default {
       showRemarkId: '',
     };
   },
+  computed: {
+    // 解析 unavailableWeeklyTimes,将 "3,4,5" 转换为 ["星期二", "星期三", "星期四"]
+    parseWeeklyTimes() {
+      return function(times) {
+        if (!times) return '';
+        const arr = times.split(',');
+        const weekMap = {
+          '1': '星期日',
+          '2': '星期一',
+          '3': '星期二',
+          '4': '星期三',
+          '5': '星期四',
+          '6': '星期五',
+          '7': '星期六'
+        };
+        return arr.map(item => weekMap[item]).join('、');
+      };
+    },
+    // 解析 unavailableTimeRanges,将 JSON 字符串转换为可读格式
+    parseTimeRanges() {
+      return function(ranges) {
+        if (!ranges) return '';
+        try {
+          const arr = JSON.parse(ranges);
+          return arr.map(item => {
+            const begin = item.beginTime.split(' ')[0];
+            const end = item.endTime.split(' ')[0];
+            return `${begin} - ${end}`;
+          }).join(';');
+        } catch (e) {
+          return '';
+        }
+      };
+    }
+  },
+
+  //unavailableTimeRanges: "[{"beginTime":"2026-02-04 00:00:00","endTime":"2026-02-08 23:59:59"}]"
+  // unavailableWeeklyTimes: "3,4,5"
   onLoad(option) {
     let sysInfo = uni.getSystemInfoSync()
     this.windowHeight = sysInfo.windowHeight - 50 + 'px'//除标题栏栏外的屏幕可用高度