fix: 优化提交订单页面js警告,充值订单跳转bug以及其他bug。refactor: 重构地址选择
This commit is contained in:
@ -12,18 +12,13 @@ const {push} = useRouter()
|
||||
export const useMainStore = defineStore('main', {
|
||||
state: () => ({
|
||||
user: null,
|
||||
address: [],
|
||||
areaList: [],
|
||||
selectAddress: null,
|
||||
moreLoading: true,
|
||||
cartId: null,
|
||||
integralName: '积分'
|
||||
}),
|
||||
getters: {
|
||||
defaultAddress(state) {
|
||||
return state.address?.filter(item => item.isDefault)?.[0]
|
||||
},
|
||||
},
|
||||
getters: {},
|
||||
actions: {
|
||||
setAccessToken(user) {
|
||||
cookie.set('accessToken', user)
|
||||
@ -37,25 +32,7 @@ export const useMainStore = defineStore('main', {
|
||||
this.user = res
|
||||
return res
|
||||
},
|
||||
restAddress() {
|
||||
this.address = []
|
||||
this.moreLoading = true
|
||||
},
|
||||
clearSelectAddress() {
|
||||
this.selectAddress = null
|
||||
},
|
||||
async getAddressList(page) {
|
||||
let res = await getAddressList({page: page})
|
||||
if (res.length) {
|
||||
this.address = this.address.concat(res)
|
||||
} else {
|
||||
this.moreLoading = false
|
||||
}
|
||||
// console.log('--> % getUserInfo % res:\n', res)
|
||||
},
|
||||
async getAddressCityList() {
|
||||
this.areaList = await getAddressCityList()
|
||||
},
|
||||
|
||||
init() {
|
||||
let accessToken = cookie.get('accessToken')
|
||||
if (accessToken) {
|
||||
|
Reference in New Issue
Block a user