Przeglądaj źródła

Merge branch 'redesign‌-260706' of http://git.huaml.com/zhh/front-end into redesign‌-260706

ouyang 2 dni temu
rodzic
commit
7cb0fda6f8

+ 1 - 0
hdApp/src/admin/custom/selectCustom.vue

@@ -226,6 +226,7 @@
             type:this.tabIndex,
             page: this.list.page,
             name: this.seekVal,
+            searchStyle: 1, // 0:手机 1:其它(拼音或中文名字)
           }).then((res) => {
             this.completes(res);
             if (this.$util.isEmpty(res.data)){

+ 2 - 2
hdApp/src/admin/hb/autoSend/edit.vue

@@ -104,7 +104,7 @@ export default {
       }],
       scopeType: 1,
       scopeValue: '',
-      specialApplicable: 1,
+      specialApplicable: 0,
       extra: {
         recallDays: '',
         sendDay: 1,
@@ -147,7 +147,7 @@ export default {
         if (Array.isArray(rules) && rules.length) this.rules = rules
         this.scopeType = Number(data.scopeType) || 1
         this.scopeValue = data.scopeValue || ''
-        this.specialApplicable = data.specialApplicable === undefined ? 1 : (Number(data.specialApplicable) ? 1 : 0)
+        this.specialApplicable = data.specialApplicable === undefined ? 0 : (Number(data.specialApplicable) ? 1 : 0)
         const extra = this.parseJson(data.extra, {})
         this.extra = Object.assign({}, this.extra, {
           recallDays: extra.recallDays !== undefined ? extra.recallDays : (extra.unOrderDays || ''),

+ 2 - 74
hdApp/src/admin/hb/autoSend/list.vue

@@ -1,5 +1,5 @@
 <!--
-  自动发红包规则列表,供门店管理员查看四类自动红包的配置状态和摘要
+  自动发红包规则列表,供门店管理员查看四类自动红包的配置状态。
   固定展示全部业务类型,即使接口尚未生成规则也可直接进入配置。
 -->
 <template>
@@ -12,20 +12,6 @@
         </view>
         <text class="status" :class="item.statusClass">{{ item.statusName }}</text>
       </view>
-      <view class="summary-row">
-        <view class="summary-item">
-          <text class="summary-value">¥{{ ruleValue(item, 'hbAmount', '0.00') }}</text>
-          <text class="summary-label">红包金额</text>
-        </view>
-        <view class="summary-item">
-          <text class="summary-value">¥{{ ruleValue(item, 'miniCost', '0.00') }}</text>
-          <text class="summary-label">最低消费</text>
-        </view>
-      </view>
-      <view class="scope-row">
-        <text class="scope-label">适用范围</text>
-        <text class="scope-value">{{ item.scopeText || formatScope(item) }}</text>
-      </view>
       <button class="config-btn" @click="goEdit(item.type)">去配置</button>
     </view>
   </view>
@@ -105,28 +91,6 @@ export default {
       if (Number(status) === 0) return 'disabled'
       return 'unconfigured'
     },
-    /**
-     * 从卡片或第一条红包规则读取摘要字段。
-     */
-    ruleValue(item, field, fallback) {
-      if (item[field] !== undefined && item[field] !== '') return item[field]
-      let rules = item.rules || []
-      if (typeof rules === 'string') {
-        try {
-          rules = JSON.parse(rules)
-        } catch (error) {
-          rules = []
-        }
-      }
-      return rules[0] && rules[0][field] !== undefined ? rules[0][field] : fallback
-    },
-    /**
-     * 接口未返回摘要时,根据范围类型生成兜底文本。
-     */
-    formatScope(item) {
-      const names = { 1: '全部商品适用', 2: '指定花束分类', 3: '指定花束商品' }
-      return names[Number(item.scopeType) || 1]
-    },
     /**
      * 进入指定类型的自动红包配置页。
      */
@@ -183,44 +147,8 @@ export default {
   background: #f2f3f5;
   color: #86909c;
 }
-.summary-row {
-  display: flex;
-  margin-top: 28upx;
-  padding: 24upx 0;
-  border-top: 1upx solid #f4f4f4;
-  border-bottom: 1upx solid #f4f4f4;
-}
-.summary-item {
-  display: flex;
-  flex: 1;
-  flex-direction: column;
-  align-items: center;
-}
-.summary-value {
-  color: #f53f3f;
-  font-size: 34upx;
-  font-weight: bold;
-}
-.summary-label {
-  margin-top: 8upx;
-  color: #999;
-  font-size: 23upx;
-}
-.scope-row {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  padding: 22upx 0;
-}
-.scope-label {
-  color: #666;
-  font-size: 26upx;
-}
-.scope-value {
-  color: #333;
-  font-size: 26upx;
-}
 .config-btn {
+  margin-top: 28upx;
   height: 72upx;
   line-height: 72upx;
   border-radius: 36upx;

+ 3 - 2
hdApp/src/admin/hb/components/hbScopePicker.vue

@@ -67,7 +67,8 @@ export default {
     },
     specialApplicable: {
       type: [Number, String, Boolean],
-      default: 1
+      // 新建红包默认关闭:特价/活动商品不可用该红包,需管理员主动打开
+      default: 0
     }
   },
   data() {
@@ -80,7 +81,7 @@ export default {
       categoryList: [],
       localScopeType: 1,
       localScopeValue: '',
-      localSpecialApplicable: 1,
+      localSpecialApplicable: 0,
       selectedGoodsCount: 0
     }
   },

+ 1 - 1
hdApp/src/admin/hb/result.vue

@@ -30,7 +30,7 @@ export default {
 	methods: {
 		init(){},
 		continueSend() {
-			this.pageTo({url: '/admin/custom/selectCustom?style=5'})
+			this.pageTo({url: '/admin/hb/send'})
 		},
 		gotoPlace() {
 			uni.navigateBack({ delta: 1 })

+ 2 - 2
hdApp/src/admin/hb/send.vue

@@ -68,7 +68,7 @@ export default {
       customs: [],
       scopeType: 1,
       scopeValue: '',
-      specialApplicable: 1,
+      specialApplicable: 0,
       remark: '',
       submitting: false
     }
@@ -88,7 +88,7 @@ export default {
         name: options.customName || ''
       }]
     }
-    uni.setNavigationBarTitle({ title: hasCustomer ? '编辑手动发放' : '新建手动发放' })
+    uni.setNavigationBarTitle({ title: hasCustomer ? '编辑红包' : '发放红包' })
   },
   onShow() {
     this.readSelectedCustomers()

+ 11 - 9
hdApp/src/admin/hb/stat.vue

@@ -134,12 +134,13 @@
         <text>未使用</text>
         <text>已失效</text>
       </view>
-      <view v-for="item in typeStats" :key="item.getType" class="type-row" @click="goTypeList(item)">
-        <text class="type-name">{{ item.getTypeName || formatGetType(item.getType) }}</text>
-        <text>{{ typeTotal(item) }}</text>
-        <text class="used">{{ typeUsed(item) }}</text>
-        <text class="unused">{{ typeUnused(item) }}</text>
-        <text class="expired">{{ typeExpired(item) }}</text>
+      <!-- 按列下钻:发放→全部、已使用→已使用、未使用→待使用、已失效→已失效 -->
+      <view v-for="item in typeStats" :key="item.getType" class="type-row">
+        <text class="type-name" @click="goTypeStatusList(item, '')">{{ item.getTypeName || formatGetType(item.getType) }}</text>
+        <text @click="goTypeStatusList(item, '')">{{ typeTotal(item) }}</text>
+        <text class="used" @click="goTypeStatusList(item, '1')">{{ typeUsed(item) }}</text>
+        <text class="unused" @click="goTypeStatusList(item, '0')">{{ typeUnused(item) }}</text>
+        <text class="expired" @click="goTypeStatusList(item, '-1')">{{ typeExpired(item) }}</text>
       </view>
       <view v-if="!typeStats.length" class="empty-text">暂无统计数据</view>
     </view>
@@ -356,10 +357,11 @@ export default {
       uni.navigateTo({ url: `/admin/hb/list?${query}` })
     },
     /**
-     * 点击类型统计行时进入该类型的全部红包明细。
+     * 点击类型统计某一列,按对应使用状态进入该类型明细。
+     * 发放/类型名对应全部,已使用、未使用、已失效分别对应列表 tabs。
      */
-    goTypeList(item) {
-      this.goList('', item.getType)
+    goTypeStatusList(item, status) {
+      this.goList(status, item.getType)
     },
     /**
      * 兜底格式化红包类型名称,接口未返回名称时仍可展示。

+ 39 - 3
mallApp/src/pages/hb/list.vue

@@ -1,6 +1,7 @@
 <!--
   我的红包列表
-  供商城用户按状态查看红包,并补充展示商品适用范围及特价、活动商品限制。
+  供商城用户按状态查看红包,并补充展示商品适用范围及特价、活动商品限制;
+  未使用红包可点「去使用」进入所属店铺商品列表,并按适用范围筛选。
 -->
 <template>
 	<view class="app-content coupon-list">
@@ -40,9 +41,9 @@
 										<view class="date" v-else>有效期至:{{ item.endTime | formatTime('YYYY-MM-DD') }}</view>
 									</template>
 								</view>
-								<!-- 未使用 -->
+								<!-- 未使用:去使用跳转所属店铺商品列表 -->
 								<template v-if="item.status == 0">
-									<button class="button-com red big">待用</button>
+									<button class="button-com red big" @click.stop="goUse(item)">去使用</button>
 								</template>
 								<!-- 已使用 -->
 								<template v-else-if="item.status == 1">
@@ -77,6 +78,8 @@ import AppTabs from '@/components/plugin/tabs'
 import AppWrapperEmpty from '@/components/app-wrapper-empty'
 import { list } from '@/mixins'
 import { getList } from '@/api/hb'
+import { parseFilterIds, encodeFilterValue, stashGoodsListFilter } from '@/utils/goodsListFilter'
+
 export default {
 	name: 'tabs',
 	components: {
@@ -134,6 +137,39 @@ export default {
 			}
 			return Number(item.specialApplicable) === 1 ? '特价及活动商品适用' : '特价及活动商品不适用'
 		},
+		/**
+		 * 未使用红包「去使用」:进入所属店铺商品列表,并按适用范围筛选。
+		 * scopeType=2 指定分类 → filterType=3;scopeType=3 指定商品 → filterType=2;
+		 * 全部适用或不带有效 ID 时不传筛选,展示该店全部上架商品。
+		 * @param {Object} item 红包行(需含 shopId/hdId/scopeType/scopeValue/beginTime)
+		 */
+		goUse(item) {
+			if (!item || Number(item.status) !== 0) {
+				return
+			}
+			if (item.beginTime && item.beginTime * 1000 > Date.now()) {
+				this.$msg('红包尚未生效')
+				return
+			}
+			const account = Number(item.shopId) || 0
+			const hdId = Number(item.hdId) || 0
+			if (account <= 0 || hdId <= 0) {
+				this.$msg('无法进入该店铺')
+				return
+			}
+			const scopeType = Number(item.scopeType) || 1
+			const ids = parseFilterIds(item.scopeValue)
+			let url = `/pages/goods/list?account=${account}&hdId=${hdId}`
+			// 与首页金刚区/轮播一致:多 ID 用竖线并写入缓存,避免微信截断逗号
+			if (scopeType === 2 && ids.length) {
+				stashGoodsListFilter(3, ids)
+				url += `&filterType=3&filterValue=${encodeFilterValue(ids)}`
+			} else if (scopeType === 3 && ids.length) {
+				stashGoodsListFilter(2, ids)
+				url += `&filterType=2&filterValue=${encodeFilterValue(ids)}`
+			}
+			this.pageTo({ url })
+		},
 		/**
 		 * 初始化红包列表,保留原有分页状态。
 		 */