|
|
@ -79,6 +79,7 @@ |
|
|
|
<script> |
|
|
|
import { reactive, getCurrentInstance, toRefs, onMounted } from 'vue' |
|
|
|
import { areaList } from '@vant/area-data' |
|
|
|
import { Toast } from 'vant' |
|
|
|
export default { |
|
|
|
name: 'AddAddress', |
|
|
|
setup() { |
|
|
@ -97,7 +98,6 @@ export default { |
|
|
|
onMounted(() => { |
|
|
|
data.addressType = proxy.$route.query.type |
|
|
|
data.currentAddress = JSON.parse(proxy.$route.query.currentAddress) |
|
|
|
console.log(data.currentAddress) |
|
|
|
if(data.currentAddress){ |
|
|
|
data.name = data.currentAddress.name |
|
|
|
data.phone = data.currentAddress.phone |
|
|
@ -122,7 +122,7 @@ export default { |
|
|
|
}else{ |
|
|
|
param.id = data.currentAddress.id |
|
|
|
} |
|
|
|
console.log(param) |
|
|
|
param.isDefault = param.isDefault === false ? 0 : 1 |
|
|
|
proxy.$http |
|
|
|
.post(proxy.$API.EDITMYADDRESS, |
|
|
|
param, |
|
|
@ -133,8 +133,16 @@ export default { |
|
|
|
} |
|
|
|
) |
|
|
|
.then(res => { |
|
|
|
data.detailBook = res.data.book |
|
|
|
data.showDetial = true |
|
|
|
if(res.errCode === 0){ |
|
|
|
if(data.addressType==='add'){ |
|
|
|
Toast('新增地址成功') |
|
|
|
}else{ |
|
|
|
Toast('编辑地址成功') |
|
|
|
} |
|
|
|
setTimeout(()=>{ |
|
|
|
proxy.$router.push({ path: '/myAddress'}) |
|
|
|
},1000) |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((res) => { |
|
|
|
console.log(res) |
|
|
|