3
0
Fork 0
web-store-retail-h5/components/area-product-list/special-area-wrapper.vue

128 lines
3.1 KiB
Vue
Raw Normal View History

2025-06-09 17:22:32 +08:00
<template>
<view class="goods-sort">
<!-- 注册 -->
<view
key="regist"
v-if="registList.length > 0 && !isZeroLevel"
class="goods-flexs"
>
2025-06-09 17:22:32 +08:00
<view class="goods-view">
<area-product-list
:list="registList"
:title="regist.name"
2025-06-10 09:21:43 +08:00
@product-click="redirectList"
2025-06-09 17:22:32 +08:00
></area-product-list>
</view>
</view>
<!-- 升级 -->
<view key="upgrade" v-if="upgradeList.length > 0" class="goods-flexs">
2025-06-09 17:22:32 +08:00
<view class="goods-view">
<area-product-list
:list="upgradeList"
:title="upgrade.name"
2025-06-10 09:21:43 +08:00
@product-click="redirectList"
2025-06-09 17:22:32 +08:00
></area-product-list>
</view>
</view>
<!-- 复购 -->
<view key="repurchase" v-if="repurchaseList.length > 0" class="goods-flexs">
2025-06-09 17:22:32 +08:00
<view class="goods-view">
<area-product-list
:list="repurchaseList"
:title="repurchase.name"
2025-06-10 09:21:43 +08:00
@product-click="redirectList"
2025-06-09 17:22:32 +08:00
></area-product-list>
</view>
</view>
<!-- 重消 -->
<view
key="rescission"
v-if="!isZeroLevel && rescissionList.length > 0"
class="goods-flexs"
>
2025-06-09 17:22:32 +08:00
<view class="goods-view">
<area-product-list
:list="rescissionList"
:title="rescission.name"
2025-06-10 09:21:43 +08:00
@product-click="redirectList"
2025-06-09 17:22:32 +08:00
></area-product-list>
</view>
</view>
</view>
</template>
<script>
import {
REGIEST_AREA,
UPGRADE_AREA,
REPURCHASE_AREA,
REISSUE_AREA,
} from '@/util/specialAreaMap'
import { MEMBER_SIGN } from '@/util/common'
import areaProductList from '@/components/area-product-list/index.vue'
import { getAreaGoods } from '@/config/special-area'
import { mapGetters } from 'vuex'
export default {
name: 'SpecialAreaWrapper',
components: {
'area-product-list': areaProductList,
},
data() {
return {
registList: [],
upgradeList: [],
repurchaseList: [],
rescissionList: [],
regist: REGIEST_AREA,
upgrade: UPGRADE_AREA,
repurchase: REPURCHASE_AREA,
rescission: REISSUE_AREA,
}
},
computed: {
...mapGetters(['isZeroLevel']),
},
created() {
if (!this.isZeroLevel) {
this.getAreaListById(REISSUE_AREA.id, this.rescissionList)
this.getAreaListById(REGIEST_AREA.id, this.registList)
2025-06-09 17:22:32 +08:00
}
this.getAreaListById(UPGRADE_AREA.id, this.upgradeList)
this.getAreaListById(REPURCHASE_AREA.id, this.repurchaseList)
2025-06-09 17:22:32 +08:00
},
methods: {
getAreaListById(areaId, list) {
const params = {
pageNum: 1,
pageSize: 3,
}
getAreaGoods({
pageNum: 1,
pageSize: 3,
specialArea: areaId,
}).then(res => {
if (res.code == 200) {
list.splice(0, list.length, ...(res.data || []).slice(0, 3))
}
})
},
2025-06-10 09:21:43 +08:00
redirectList(item) {
uni.navigateTo({
url: `/pages/specialArea/list?specialArea=${item.specialArea}&id=${item.pkId}`,
})
},
2025-06-09 17:22:32 +08:00
},
}
</script>
<style lang="scss" scoped>
.goods-sort {
padding-top: 20rpx;
.goods-flexs {
padding: 0 20rpx;
position: relative;
}
}
</style>