|
|
@ -27,7 +27,7 @@ |
|
|
|
@confirm="confirm2(item.id)" |
|
|
|
@confirm="confirm2(item.id)" |
|
|
|
@cancel="cancel" |
|
|
|
@cancel="cancel" |
|
|
|
v-if="!item.sort==0" |
|
|
|
v-if="!item.sort==0" |
|
|
|
><span class="btn">将其设置为默认地址</span></a-popconfirm> |
|
|
|
><span class="btn">将其设置为默认地址</span></a-popconfirm> |
|
|
|
<!-- <span class="btn" v-if="!item.flag" @click="handleDefault(item.id)">将其设置为默认地址</span>--> |
|
|
|
<!-- <span class="btn" v-if="!item.flag" @click="handleDefault(item.id)">将其设置为默认地址</span>--> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -108,6 +108,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
import { httpAction, getAction } from '@/api/manage' |
|
|
|
import { httpAction, getAction } from '@/api/manage' |
|
|
|
import { deleteAction } from '@/api/manage' |
|
|
|
import { deleteAction } from '@/api/manage' |
|
|
|
|
|
|
|
import {mapGetters} from 'vuex' |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: "addrView", |
|
|
|
name: "addrView", |
|
|
@ -178,7 +179,9 @@ |
|
|
|
url: { |
|
|
|
url: { |
|
|
|
getaddress: "/getuserpersion/getaddress", |
|
|
|
getaddress: "/getuserpersion/getaddress", |
|
|
|
deleteadd: "/getuserpersion/deleteadd", |
|
|
|
deleteadd: "/getuserpersion/deleteadd", |
|
|
|
sdqx: "/getuserpersion/sdqx" |
|
|
|
sdqx: "/getuserpersion/sdqx", |
|
|
|
|
|
|
|
addadressress: "/getuserpersion/addadressress", |
|
|
|
|
|
|
|
updateadressress: "/getuserpersion/updateadressress" |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -188,6 +191,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
...mapGetters(["nickname", "avatar","userInfo"]), |
|
|
|
reload() { |
|
|
|
reload() { |
|
|
|
this.isReload = false |
|
|
|
this.isReload = false |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
@ -198,8 +202,6 @@ |
|
|
|
getAction(this.url.getaddress).then((res) => { |
|
|
|
getAction(this.url.getaddress).then((res) => { |
|
|
|
if(res.success) { |
|
|
|
if(res.success) { |
|
|
|
this.addrList1= res.result; |
|
|
|
this.addrList1= res.result; |
|
|
|
console.log("===================") |
|
|
|
|
|
|
|
console.log(res.result) |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -238,20 +240,61 @@ |
|
|
|
if(this.form.flag){//修改为默认地址 |
|
|
|
if(this.form.flag){//修改为默认地址 |
|
|
|
this.changeDefault() |
|
|
|
this.changeDefault() |
|
|
|
this.addrList.unshift(this.form) |
|
|
|
this.addrList.unshift(this.form) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//开始向后台传送数据包 |
|
|
|
|
|
|
|
getAction(this.url.addadressress,{form : JSON.stringify(this.form)}).then((res) => { |
|
|
|
|
|
|
|
if(res.success) { |
|
|
|
|
|
|
|
this.$router.go(0) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{//不修改为默认地址 |
|
|
|
}else{//不修改为默认地址 |
|
|
|
this.addrList.push(this.form) |
|
|
|
this.addrList.push(this.form) |
|
|
|
|
|
|
|
console.log(this.userInfo()) |
|
|
|
|
|
|
|
//开始向后台传送数据包 |
|
|
|
|
|
|
|
getAction(this.url.addadressress,{form : JSON.stringify(this.form)}).then((res) => { |
|
|
|
|
|
|
|
if(res.success) { |
|
|
|
|
|
|
|
this.$router.go(0) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}else if(this.flag == 'edit'){//如果是修改地址 |
|
|
|
}else if(this.flag == 'edit'){ |
|
|
|
|
|
|
|
//如果是修改地址 |
|
|
|
//查找当前索引 |
|
|
|
//查找当前索引 |
|
|
|
let itemIndex3 = this.addrList.findIndex(item =>item.id == this.form.id) |
|
|
|
let itemIndex3 = this.addrList.findIndex(item =>item.id == this.form.id) |
|
|
|
if(this.form.flag){//如果需要修改为默认地址 |
|
|
|
if(this.form.flag){//如果需要修改为默认地址 |
|
|
|
this.changeDefault() |
|
|
|
this.changeDefault() |
|
|
|
this.form.flag = true |
|
|
|
this.form.flag = true |
|
|
|
this.addrList[itemIndex3] = this.form |
|
|
|
this.addrList[itemIndex3] = this.form |
|
|
|
console.log("this.addrList2") |
|
|
|
/* console.log("this.addrList2") |
|
|
|
console.log(this.addrList) |
|
|
|
console.log(this.addrList)*/ |
|
|
|
|
|
|
|
console.log(this.form) |
|
|
|
|
|
|
|
getAction(this.url.updateadressress,{form : JSON.stringify(this.form)}).then((res) => { |
|
|
|
|
|
|
|
if(res.success) { |
|
|
|
|
|
|
|
this.$router.go(0) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
this.addrList[itemIndex3] = this.form |
|
|
|
this.addrList[itemIndex3] = this.form |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getAction(this.url.updateadressress,{form : JSON.stringify(this.form)}).then((res) => { |
|
|
|
|
|
|
|
if(res.success) { |
|
|
|
|
|
|
|
this.$router.go(0) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(this.form) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//清空表单 |
|
|
|
//清空表单 |
|
|
@ -285,7 +328,7 @@ |
|
|
|
console.log(id) |
|
|
|
console.log(id) |
|
|
|
deleteAction(this.url.deleteadd,{id,id}).then((res) => { |
|
|
|
deleteAction(this.url.deleteadd,{id,id}).then((res) => { |
|
|
|
if(res.success) { |
|
|
|
if(res.success) { |
|
|
|
this.loadData(1); |
|
|
|
this.$router.go(0) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|