|
|
@ -2,7 +2,7 @@
|
|
|
|
* @Author: ch
|
|
|
|
* @Author: ch
|
|
|
|
* @Date: 2022-03-22 13:54:15
|
|
|
|
* @Date: 2022-03-22 13:54:15
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditTime: 2022-04-18 18:36:28
|
|
|
|
* @LastEditTime: 2022-04-20 15:32:04
|
|
|
|
* @Description: file content
|
|
|
|
* @Description: file content
|
|
|
|
-->
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
@ -26,7 +26,8 @@
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<UiButton class="addAddress" type="solid" size="max" @click="$Router.push(`/addressCreate?first=${!addresList.length}`)">新增地址</UiButton>
|
|
|
|
<UiButton class="addAddress" type="solid" size="max"
|
|
|
|
|
|
|
|
@click="$Router.push(`/addressCreate?first=${!addresList.length}`)">新增地址</UiButton>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
@ -44,7 +45,8 @@ export default {
|
|
|
|
type : query.type,
|
|
|
|
type : query.type,
|
|
|
|
id : query.id,
|
|
|
|
id : query.id,
|
|
|
|
// 来源,选择地址时触发全局事件时的标记 submitOrder 提交订单
|
|
|
|
// 来源,选择地址时触发全局事件时的标记 submitOrder 提交订单
|
|
|
|
source : query.source
|
|
|
|
source : query.source,
|
|
|
|
|
|
|
|
status : query.status
|
|
|
|
},
|
|
|
|
},
|
|
|
|
addresList : [],
|
|
|
|
addresList : [],
|
|
|
|
isLoading : true
|
|
|
|
isLoading : true
|
|
|
@ -53,13 +55,10 @@ export default {
|
|
|
|
computed:{
|
|
|
|
computed:{
|
|
|
|
selectedId (){
|
|
|
|
selectedId (){
|
|
|
|
const defaultAddress = this.addresList.find(i => i.isDefault);
|
|
|
|
const defaultAddress = this.addresList.find(i => i.isDefault);
|
|
|
|
return this.query.id || defaultAddress.id;
|
|
|
|
return Number(this.query.id) || defaultAddress.id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
onShow(options) {
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
|
|
|
this.getAddressList();
|
|
|
|
this.getAddressList();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
@ -73,6 +72,16 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.addresList = result;
|
|
|
|
this.addresList = result;
|
|
|
|
this.$store.commit('SET_ADDRESS', result);
|
|
|
|
this.$store.commit('SET_ADDRESS', result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果是提交订单且是创建地址则直接选中默认或第一个地址,并返回
|
|
|
|
|
|
|
|
if(this.query.source=== 'submitOrder' && this.query.status === 'created'){
|
|
|
|
|
|
|
|
if(result.length){
|
|
|
|
|
|
|
|
uni.$emit('changeAddress',result.find(i => i.isDefault) || result[0], this.query.source);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
uni.$emit('changeAddress',{}, this.query.source);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 选择地址
|
|
|
|
* 选择地址
|
|
|
|