110 lines
3.3 KiB
Vue
110 lines
3.3 KiB
Vue
<template>
|
|
<view class="content">
|
|
<view class="rowlist ">
|
|
<label v-for="(item,index) in list" :key="index" v-if="list.length>0">
|
|
<view class="li" >
|
|
<view class="" >
|
|
<view class="name fsz28 flex " style="justify-content: space-between;">
|
|
<view class="flex"><view class="tishi" @click="xuanze(item)" v-if="item.is_def === 1">默认</view>
|
|
<view @click="xuanze(item)">{{item.name}}</view></view>
|
|
<view class="" @click="editaddress(item.id)"><uni-icons type="compose" size="26" color="#828282"></uni-icons></view>
|
|
</view>
|
|
<view class="idcard" @click="xuanze(item)"> {{item.address}},{{item.room_number}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</label>
|
|
<view class="zanwuimg" v-if="list.length == 0" >
|
|
<image src="/static/img/null.png" mode="widthFix" ></image>
|
|
<view>暂无数据</view>
|
|
</view>
|
|
</view>
|
|
<view class="btn">
|
|
<view class="fsz28" @click="addaddress()">
|
|
新增地址
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
list: [] ,
|
|
type: ''
|
|
}
|
|
},
|
|
onLoad (e) {
|
|
if(e.type){
|
|
this.type = e.type;
|
|
}
|
|
},
|
|
onShow () {
|
|
this.userAddressList();
|
|
},
|
|
methods: {
|
|
userAddressList () {
|
|
this.$api.useraddress({}, res => {
|
|
if (res.code ==1) {
|
|
this.list = res.data.list.data
|
|
}
|
|
})
|
|
},
|
|
delAddress (id) {
|
|
uni.showModal({
|
|
title:'提示',
|
|
content: '确认删除此收货地址?',
|
|
success:(ret)=>{
|
|
if(ret.confirm){
|
|
let data = {
|
|
id: id
|
|
}
|
|
this.$api.removeAddress(data, res => {
|
|
if (res.code ==1) {
|
|
uni.showToast({ title: res.msg , icon: 'success' })
|
|
setTimeout(function() {
|
|
this.userAddressList();
|
|
},2000);
|
|
} else {
|
|
uni.showToast({ title: res.msg , icon: 'none' }) ;
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
editaddress (id) {
|
|
uni.navigateTo({url:'/pages/address/detail?address_id=' + id});
|
|
},
|
|
addaddress() {
|
|
uni.navigateTo({url:'/pages/address/detail'});
|
|
},
|
|
xuanze(data) {
|
|
if(this.type == 'order'){
|
|
uni.setStorageSync('user_address', data );
|
|
uni.navigateBack({
|
|
delta: 1
|
|
});
|
|
}
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
|
|
<style>
|
|
page{background: #ffffff;}
|
|
.rowlist{border-radius: 10rpx;padding: 30rpx;box-sizing: border-box;margin-bottom: 180rpx;}
|
|
.rowlist .li{padding: 24rpx 0;box-sizing: border-box;border-bottom: 1px solid #ddd;display: flex;align-items: center;}
|
|
.rowlist .li .idcard{font-size: 12px;margin-top: 10px;display: flex;justify-content: space-between;align-items: center;color: #828282;}
|
|
.rowlist .li .name{font-size: 14px;}
|
|
.btn{width: 100%;position: fixed;bottom: 0;height: 180rpx;left:0%;background: #ffffff;justify-content:center;display: flex;padding: 0 30rpx;box-sizing: border-box;}
|
|
.tishi{display: inline-block; font-size: 25rpx; padding: 5rpx 10rpx;background-color: #f75444;
|
|
color: #fff;margin-right: 10px;line-height: 22px;
|
|
}
|
|
.btn>view{flex:0 0 90%;height: 94rpx;background: #00a65c;;text-align: center;line-height: 94rpx;color:#fff;border-radius: 50rpx;margin-top: 40rpx;}
|
|
|
|
.rowlist .li>view{flex:0 0 95%;}
|
|
</style> |