Fix:3256 【商城小程序】收货地址页面,给当前选择的地址增加一个标识,放在地址右下角

This commit is contained in:
linxi
2025-05-06 17:23:30 +08:00
parent 1ddc425606
commit e35ea1d5c2
2 changed files with 35 additions and 21 deletions
+33 -19
View File
@@ -93,16 +93,22 @@ export default {
loading: false,
loadend: false,
isWechat: isWeixin(),
pageKeyId: Object.freeze('userAddressIndex')
}
},
computed: {
// 当前地址id
currentId() {
const current = uni.getStorageSync('cartChooseAddress') || {}
return current.id || null
pageKeyId: Object.freeze('userAddressIndex'),
currentId: null
}
},
// computed: {
// // 当前地址id
// currentId: {
// set(val) {
// },
// get() {
// const current = uni.getStorageSync('cartChooseAddress') || {}
// return current.id || null
// }
// }
// },
mounted() {
this.AddressList()
},
@@ -126,8 +132,6 @@ export default {
},
methods: {
tapAddress(item) {
console.log(item);
// 来源订单创建页面
if (this.choosMode === 1) {
uni.setStorageSync('chooseAddress', item)
@@ -155,19 +159,29 @@ export default {
*
*/
AddressList() {
const that = this
// 阻止下次请求(false可以进行请求)
if (that.loading) return
if (this.loading) return
// 阻止结束当前请求(false可以进行请求)
if (that.loadend) return
that.loading = true
getAddressList({page: that.page, limit: that.limit}).then(res => {
that.loading = false
if (this.loadend) return
this.loading = true
getAddressList({page: this.page, limit: this.limit}).then(res => {
this.loading = false
// apply();js将一个数组插入另一个数组
that.addressList.push.apply(that.addressList, res.data)
this.addressList.push.apply(this.addressList, res.data)
// 判断所有数据是否加载完成
that.loadend = res.data.length < that.limit
that.page = that.page + 1
this.loadend = res.data.length < this.limit
this.page = this.page + 1
if (this.choosMode === 1) {
this.currentId = uni.getStorageSync('chooseAddress') ? uni.getStorageSync('chooseAddress').id : this.addressList.find(e => e.isDefault === 1) ? this.addressList.find(e => e.isDefault === 1).id : null
}
// 来源购物车
if (this.choosMode === 2) {
this.currentId = uni.getStorageSync('cartChooseAddress') ? uni.getStorageSync('cartChooseAddress').id : this.addressList.find(e => e.isDefault === 1) ? this.addressList.find(e => e.isDefault === 1).id : null
}
// 来源礼物
if (this.choosMode === 3) {
this.currentId = uni.getStorageSync('giftChooseAddress') ? uni.getStorageSync('giftChooseAddress').id : this.addressList.find(e => e.isDefault === 1) ? this.addressList.find(e => e.isDefault === 1).id : null
}
})
},
/**