martial-arts/pagesA/my-address/my-address.vue

75 lines
2.1 KiB
Vue
Raw Normal View History

2022-08-03 13:28:45 +00:00
<template>
<view>
<status-container titlet="我的地址" returnc="#FFFFFF">
<view slot="content" style="margin-top: -20rpx;" v-if="loading">
<view @tap="chooseAddress(item)" class="bacf pad-x30 pad-zy20" v-for="(item,index) in addressList" :key="index">
2022-08-04 08:01:19 +00:00
<view class="pad-sx30 pad-zy20 disjbac bbot">
<view class="fon22 col26">
<view class="" style="color: #676767;">{{item.province_str}}{{item.city_str}}{{item.county_str}}</view>
<view class="mar-sx10">{{item.address}}</view>
<view class="">{{item.name}} {{$toolAll.tools.hideMPhone(item.phone)}}</view>
2022-08-04 08:01:19 +00:00
</view>
<image class="flexs" @tap.stop="$toolAll.tools.goPage(`/pagesB/add-address/add-address?id=${item.id}`)" src="/static/tabbar/icon-edit.png" mode="aspectFill" style="width: 32rpx;height: 34rpx;"></image>
2022-08-04 08:01:19 +00:00
</view>
</view>
<view class="" v-if="!addressList.length">
<nothingPage content="地址列表空荡荡滴"></nothingPage>
</view>
2022-08-04 08:01:19 +00:00
<view class="disjcac pad-s50">
2022-08-04 10:05:43 +00:00
<view @tap="$toolAll.tools.goPage('/pagesB/add-address/add-address')" class="disjcac radius34" style="width: 396rpx;height: 72rpx;background-color: #f37717;color: #FFFFFF;">
2022-08-04 08:01:19 +00:00
<view class="icon icon-add04 fon28"></view>
2022-08-04 10:05:43 +00:00
<view class="fon26 mar-z10">新增收货地址</view>
2022-08-04 08:01:19 +00:00
</view>
</view>
2022-08-03 13:28:45 +00:00
</view>
</status-container>
2022-08-03 13:28:45 +00:00
</view>
</template>
<script>
import nothingPage from '@/components/nothing/nothing-page.vue';
2022-08-03 13:28:45 +00:00
export default {
components:{
nothingPage
2022-08-03 13:28:45 +00:00
},
data() {
return {
addressList:[],
loading:false,
ifChoose:0
2022-08-03 13:28:45 +00:00
}
},
onShow() {
// 调取获取地址列表
this.getAddress();
},
onLoad(op) {
if(op.ifChoose) this.ifChoose = op.ifChoose;
},
2022-08-03 13:28:45 +00:00
methods: {
// 选择地址
chooseAddress(item){
if(this.ifChoose){
uni.setStorageSync('addressInfo',item);
uni.navigateBack({delta:1})
}
},
// 获取地址列表
getAddress(){
this.$requst.get('/api/user/address').then(res=>{
this.loading = true;
if(res.code==0){
// 设置地址列表
this.addressList = res.data;
}
})
}
2022-08-03 13:28:45 +00:00
}
}
</script>
<style>
</style>