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