Просмотр исходного кода

feat(hb): 打通红包发放与使用流程

- 默认限制特价及活动商品使用,并统一发放页标题和继续发放入口
- 客户选择改用姓名或拼音检索,提升发放对象定位效率
- 商城红包支持跳转所属店铺并按适用范围筛选商品
shizhongqi 21 часов назад
Родитель
Сommit
6fe1041d70

+ 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 || ''),

+ 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()

+ 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 })
+		},
 		/**
 		 * 初始化红包列表,保留原有分页状态。
 		 */