deming/pageE/more/EditAddress.vue

91 lines
1.8 KiB
Vue
Raw Normal View History

2020-06-02 15:35:19 +08:00
<template>
<view class="edit-address">
2020-06-23 17:21:01 +08:00
<AddressActive :info="address"></AddressActive>
2020-06-04 08:21:34 +08:00
<u-popup v-model="popupShow" mode="center" border-radius="10">
<view class="popup-tips">确定要删除该地址吗</view>
<view class="popup-btn">
<view class="cancel" @click="popupShow=false">取消</view>
<view class="determine" @click="delAddress">确定</view>
</view>
</u-popup>
2020-06-23 17:21:01 +08:00
<u-toast ref="uToast" />
2020-06-02 15:35:19 +08:00
</view>
</template>
<script>
2020-06-03 09:14:04 +08:00
import AddressActive from '@/components/mine/address-active/index'
2020-06-02 15:35:19 +08:00
export default {
data() {
return {
2020-06-23 17:21:01 +08:00
address: {},
2020-06-04 08:21:34 +08:00
popupShow: false
2020-06-02 15:35:19 +08:00
}
},
2020-06-03 09:14:04 +08:00
components: {
AddressActive
},
2020-06-23 17:21:01 +08:00
onLoad(option) {
// console.log(JSON.parse(option.item));
this.address = JSON.parse(option.item);
},
2020-06-04 08:21:34 +08:00
onNavigationBarButtonTap() {
this.popupShow = true
},
methods: {
delAddress() {
2020-06-23 17:21:01 +08:00
this.deleteAddress().then(() => {
this.popupShow = false
})
},
async deleteAddress() {
this.$u.api.deleteAddress({
address_id: this.address.address_id
}).then((res)=>{
if(res.errCode == 0) {
2020-07-03 17:44:58 +08:00
uni.redirectTo({
2020-06-23 17:21:01 +08:00
url: '/pageE/more/Address'
2020-07-03 17:44:58 +08:00
});
// this.$refs.uToast.show({
// title: res.message,
// type: 'success',
// url: '/pageE/more/Address'
// })
2020-06-23 17:21:01 +08:00
} else {
this.$refs.uToast.show({
title: res.message,
type: 'warning'
})
}
})
},
2020-06-04 08:21:34 +08:00
},
2020-06-02 15:35:19 +08:00
}
</script>
<style lang="scss" scoped>
.edit-address {
2020-06-04 08:21:34 +08:00
min-height: calc(100vh - var(--window-top));
.popup-tips {
width: 420rpx;
text-align: center;
line-height: 104rpx;
font-size: 28rpx;
color: rgba(102,102,102,1);
}
.popup-btn {
width: 420rpx;
display: flex;
border-top: 2rpx solid #ECECEC;
> view {
flex: 1;
height: 98rpx;
text-align: center;
line-height: 98rpx;
&:first-child {
border-right: 2rpx solid #ECECEC;
}
}
.determine {
color: #FF780F;
}
}
2020-06-02 15:35:19 +08:00
}
</style>