Files
guangan-mp/pages/user/address.vue
2025-06-16 10:09:19 +08:00

64 lines
1.2 KiB
Vue

<template>
<view class="px-2">
<i-loading v-if="loading"></i-loading>
<i-address-list :resdata="list" @click="toShow" @delete="doDelete" />
<button @click="addAddress" class="fixed-bottom">添加地址</button>
</view>
</template>
<script>
import { TaAjax } from '../../common/ajax'
export default {
data() {
return {
order_no: '',
loading: false,
list:[]
}
},
onLoad(e) {
this.order_no = e.order_no
},
onShow() {
this.loadData()
},
methods: {
loadData() {
this.loading = true
TaAjax.get('/points_mall/api.auth.address/list').then((resp) => {
const data = resp.data;
this.list = data
}).finally(() => {
this.loading = false
})
},
addAddress(e) {
uni.navigateTo({
url:'/pages/user/address_edit'
})
},
toShow(item){
if (this.order_no) {
uni.redirectTo({
url: '/pages/points-mall/buy?order_no=' + this.order_no + '&address_id=' + item.id
})
} else {
uni.navigateBack()
}
},
doDelete(item) {
TaAjax.post('/points_mall/api.auth.address/delete', {
id: item.id,
}).then((resp) => {
this.loadData()
})
},
}
}
</script>
<style>
</style>