|
@@ -271,14 +271,21 @@ export default {
|
|
|
}).then(res => {
|
|
|
let list = res.data;
|
|
|
let loadend = list.length < that.limit;
|
|
|
- that.addressList = that.$util.SplitArray(list, that.addressList);
|
|
|
+ that.addressList = that.$util.SplitArray(list, that.addressList);// 判断是否选择地址
|
|
|
+ if(this.type && that.addressList.length == 0){
|
|
|
+ this.$store.commit('SETSELECTADDR', {});
|
|
|
+ }
|
|
|
+ if(this.type && that.addressList.length == 1){
|
|
|
+ that.addressList[0].defaultState = 2
|
|
|
+ this.$store.commit('SETSELECTADDR', that.addressList[0]);
|
|
|
+ }
|
|
|
if (that.type && that.selectAddr.id != undefined) {
|
|
|
//找出已经的地址
|
|
|
that.addressList.forEach((value,index) => {
|
|
|
if(that.selectAddr.id == value.id) {
|
|
|
- that.addressList[index].defaultState = '2'
|
|
|
+ that.addressList[index].defaultState = 2
|
|
|
}else{
|
|
|
- that.addressList[index].defaultState = '1'
|
|
|
+ that.addressList[index].defaultState = 1
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -350,12 +357,16 @@ export default {
|
|
|
if (address == undefined) return that.$util.Tips({
|
|
|
title: that.$t(`您删除的地址不存在!`)
|
|
|
});
|
|
|
+ that.$set(that, 'addressList', that.addressList);
|
|
|
postUserAddressRemove({ ids: address.id }).then(res => {
|
|
|
that.$util.Tips({
|
|
|
title: that.$t(`删除成功`),
|
|
|
icon: 'success'
|
|
|
}, function () {
|
|
|
that.addressList.splice(index, 1);
|
|
|
+ if(that.type && address.id == that.selectAddr.id){
|
|
|
+ that.$store.commit('SETSELECTADDR', {});
|
|
|
+ }
|
|
|
that.$set(that, 'addressList', that.addressList);
|
|
|
});
|
|
|
}).catch(err => {
|