3
0
Fork 0

feat(specialArea): 会员专区列表根据会员身份请求接口

This commit is contained in:
woody 2025-08-22 15:51:27 +08:00
parent adfd288f59
commit 9f376b78dc
4 changed files with 28 additions and 39 deletions

View File

@ -103,14 +103,17 @@ export default {
...mapGetters(['isZeroLevel']),
},
created() {
const userInfo = uni.getStorageSync('userInfo') || this.userInfo
const userInfo = Object.keys(this.userInfo).length
? this.userInfo
: uni.getStorageSync('userInfo')
if (userInfo.memberSign == MEMBER_SIGN.ZERO_LEVEL) {
this.upgrade.name = '会员专区'
} else {
this.getAreaListById(REISSUE_AREA.id, this.rescissionList)
this.getAreaListById(REGIEST_AREA.id, this.registList)
this.getAreaListById(REPURCHASE_AREA.id, this.repurchaseList)
}
this.getAreaListById(UPGRADE_AREA.id, this.upgradeList)
this.getAreaListById(REISSUE_AREA.id, this.rescissionList)
this.getAreaListById(REGIEST_AREA.id, this.registList)
this.getAreaListById(REPURCHASE_AREA.id, this.repurchaseList)
},
methods: {
getAreaListById(areaId, list) {

View File

@ -28,7 +28,7 @@
</swiper>
</view>
</view>
<view style="padding-bottom: 140rpx">
<view v-if="specialAreaVisble" style="padding-bottom: 140rpx">
<special-area-wrapper :userInfo="userInfo" size="small" />
</view>
<cl-tabbar :current="0"></cl-tabbar>
@ -77,7 +77,6 @@
import * as api from '@/config/login.js'
import * as apis from '@/config/index.js'
import * as ban from '@/config/balance.js'
import { getAreaGoods } from '@/config/special-area'
import clTabbar from '@/components/cl-tabbar.vue'
import noticePopup from '@/components/noticePopup.vue'
import znNewsPopup from '@/components/znNewsPopup.vue'
@ -128,6 +127,9 @@ export default {
},
computed: {
...mapGetters(['priceSymbol', 'priceSymbolVisible', 'isZeroLevel']),
specialAreaVisble() {
return this.userInfo && Object.keys(this.userInfo).length
},
},
onLoad() {
// this.getLanguage();
@ -136,24 +138,7 @@ export default {
onShow() {
this.$store.dispatch('getCarLength')
this.getBanners()
if (
uni.getStorageSync('showInfo') == undefined ||
uni.getStorageSync('showInfo') == 0
) {
}
this.getAreaGoods(
this.userInfo.memberSign == MEMBER_SIGN.ZERO_LEVEL
? REPURCHASE_AREA.id
: REGIEST_AREA.id
)
},
// onPullDownRefresh() {
// let that = this
// setTimeout(() => {
// that.getGoodsInfo()
// uni.stopPullDownRefresh() //
// }, 1000)
// },
methods: {
formatCurrency,
formatSales(value) {
@ -194,17 +179,6 @@ export default {
}
})
},
getAreaGoods(areaId) {
getAreaGoods({
pageNum: 1,
pageSize: 3,
specialArea: areaId,
}).then(res => {
if (res.code == 200) {
this.goodsList = res.data || []
}
})
},
confirmHandle() {
this.promptFlag = false
if (this.jumpPage == 1) {

View File

@ -6,7 +6,7 @@
-->
<template>
<view class="content">
<special-area-wrapper :userInfo="userInfo" />
<special-area-wrapper v-if="specialAreaVisble" :userInfo="userInfo" />
<cl-tabbar :current="1"></cl-tabbar>
</view>
@ -23,11 +23,19 @@ export default {
data() {
return {
userInfo: uni.getStorageSync('User'),
userInfo: null,
}
},
onLoad() {},
onLoad() {
this.$store.dispatch('GetInfo').then(user => {
this.userInfo = user || null
})
},
computed: {
specialAreaVisble() {
return this.userInfo && Object.keys(this.userInfo).length
},
},
methods: {},
}
</script>

View File

@ -28,12 +28,16 @@ const actions = {
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
if (state.user) {
resolve(state.user)
return
}
getInfo()
.then(res => {
if (res) {
commit('SET_USER', res.data)
uni.setStorageSync('User', res.data)
resolve(res)
resolve(res.data)
}
})
.catch(error => {