<template>
|
<view>
|
<view class="main">
|
<u-empty mode="data"
|
icon="http://cdn.uviewui.com/uview/empty/data.png"
|
text="暂无数据"
|
textSize="30"
|
iconSize="1000"
|
v-if="addressList.length===0"></u-empty>
|
<view class="information-block"
|
v-for="item in addressList"
|
:key="item.id">
|
<view class="detail-block">
|
<view class="address">
|
{{item.customerName}}
|
</view>
|
<view class="edit-icon"
|
@click="editAddress(item)">
|
<u-icon name="trash"
|
size="40"
|
color="#ababab"></u-icon>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view class="add-address">
|
<view class="address-block">
|
<u-button text="新建送货客户"
|
shape="circle"
|
type="primary"
|
@click="addAddress"></u-button>
|
</view>
|
</view>
|
<u-modal :show="deleteCustomerShow"
|
title="删除确认"
|
showCancelButton
|
:content="deleteCustomerName"
|
@confirm="deleteCustomerConfirm"
|
@cancel="deleteCustomerCancel">
|
</u-modal>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
addressList: [],
|
shipToId: "",
|
shipToName: '',
|
deleteCustomerShow: false
|
};
|
},
|
computed: {
|
deleteCustomerName() {
|
return `是否确认删除${this.shipToName}`
|
}
|
},
|
onShow() {
|
this.init()
|
},
|
methods: {
|
init() {
|
uni.showLoading({
|
title: "加载中"
|
})
|
this.$reqGet('getShipToList').then(res => {
|
uni.hideLoading()
|
if (res.code == 0) {
|
this.addressList = res.data
|
} else {
|
this.$u.toast('加载失败')
|
}
|
})
|
},
|
addAddress() {
|
uni.navigateTo({
|
url: '/pages/driver-page/drvier-my/addressMange/addressEdit/addressEdit'
|
})
|
},
|
editAddress(val) {
|
this.shipToName = val.customerName
|
this.shipToId = val.id
|
this.deleteCustomerShow = true
|
},
|
deleteCustomerConfirm() {
|
this.deleteCustomerShow = false
|
uni.showLoading({
|
title: "加载中"
|
})
|
this.$reqPost('deleteShipTo', { shipToId: this.shipToId }, 'params').then(res => {
|
uni.hideLoading()
|
if (res.code == 0) {
|
this.$u.toast('删除成功')
|
setTimeout(() => {
|
this.init()
|
}, 1500)
|
} else {
|
this.$u.toast('删除失败')
|
}
|
})
|
},
|
deleteCustomerCancel() {
|
this.deleteCustomerShow = false
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss"
|
scoped>
|
@mixin flex {
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
}
|
|
.main {
|
width: 98%;
|
height: calc(100vh - 60px);
|
margin: vww(8) auto;
|
display: flex;
|
align-items: center;
|
flex-direction: column;
|
overflow: scroll;
|
|
.information-block {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
|
.detail-block {
|
width: 690rpx;
|
height: 120rpx;
|
padding: vww(8);
|
background: #ffffff;
|
box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
|
border-radius: 20rpx;
|
display: flex;
|
justify-content: space-between;
|
margin-top: vww(14);
|
position: relative;
|
|
.address {
|
flex: 1;
|
}
|
|
.edit-icon {
|
width: vww(50);
|
height: 100%;
|
@include flex;
|
}
|
}
|
}
|
}
|
|
.add-address {
|
width: 100%;
|
height: vww(60);
|
position: fixed;
|
bottom: 0;
|
background-color: #ffffff;
|
box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
|
|
.address-block {
|
width: 88%;
|
margin: vww(8) auto;
|
}
|
}
|
</style>
|