You've already forked guangan-mp
1.0.0
This commit is contained in:
63
pages/user/address.vue
Normal file
63
pages/user/address.vue
Normal file
@ -0,0 +1,63 @@
|
||||
<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>
|
Reference in New Issue
Block a user