地址的更改

This commit is contained in:
952108534@qq.com
2022-01-21 15:30:50 +08:00
parent e730b1210b
commit 7f9a290662
5 changed files with 176 additions and 72 deletions

View File

@@ -63,6 +63,9 @@ export default {
usermessage:null,
dialogInfo1:false,
userpeople:'',
provinceId:'',
cityId:'',
districtId:'',
list: [
{
id: 1,
@@ -121,11 +124,40 @@ export default {
});
return
}
else if(this.provinceId===''){
this.$message({
type: 'warning',
message: '请选择省区'
});
return
}
else if(this.cityId===''){
this.$message({
type: 'warning',
message: '请选择市区'
});
return
}
else if(this.districtId===''){
this.$message({
type: 'warning',
message: '请选择详细的区域'
});
return
}
else{
this.editaddress();
}
},
openclose(){
this.$router.push({
path: "/useraddress/openaddress",
// query: {
// id: userid,
// },
});
},
//添加
@@ -144,10 +176,20 @@ export default {
let data = await editaddress(useradd);
if(data){
console.log(data);
this.$message({
if(data){
this.$message({
type: 'warning',
message: '地址添加成功'
});
this.$router.push({
path: "/useraddress/openaddress",
// query: {
// id: userid,
// },
});
}
}
},

View File

@@ -57,6 +57,9 @@ export default {
recipientPhone:'',
recipient:'',
addressid:'',
provinceId:'',
cityId:'',
districtId:'',
defaultValues:[],
list: [
{
@@ -83,7 +86,35 @@ export default {
},
methods: {
onGetMenu(values){
let user;
console.log(values,+'111111');
console.log(typeof(values[2]));
const objToStr = JSON.stringify(values[2]);
console.log(objToStr);
console.log(typeof(objToStr));
if(objToStr.includes('-')){
console.log("===包含符号")
let user=values[2].id;
user=user.split('-');
this.provinceId=user[0];
this.cityId=user[1];
this.districtId=user[2];
}else{
this.provinceId=values[0].id;
this.cityId=values[1].id;
this.districtId=values[2].id;
console.log("---不包含符号");
}
// let user=values[2].id;
// user=user.split('-');
console.log(this.provinceId,this.cityId,this.districtId);
},
openclose(){
this.$router.push({
path: "/useraddress/openaddress",
});
},
handleClose1(){
this.dialogInfo1 = false
@@ -111,20 +142,41 @@ export default {
});
return
}
else if(this.provinceId===''){
this.$message({
type: 'warning',
message: '请填写省区'
});
return
}
else if(this.userpeople===''){
this.$message({
type: 'warning',
message: '请填写市区'
});
return
}
else if(this.userpeople===''){
this.$message({
type: '请填写街道',
message: '请输入姓名'
});
return
}
else{
this.editaddress();
this.edupdate();
}
},
//更改
async editaddress(item) {
async edupdate(item) {
let useradd={
memberId:this.userid,
id:this.id,
provinceId:'',//省份id,
cityId:'',//城市id,
districtId:'',//区域id,
provinceId:this.provinceId,//省份id,
cityId:this.cityId,//城市id,
districtId:this.districtId,//区域id,
detailAddress:this.detailAddress, //详细地址
recipient:this.recipient, //收件人姓名
recipientPhone:this.recipientPhone, //收件人电话
@@ -135,6 +187,10 @@ export default {
type: 'warning',
message: '地址修改成功'
});
this.$router.push({
path: "/useraddress/openaddress",
});
}
},
@@ -168,20 +224,20 @@ export default {
let provinceName=this.$route.query.provinceName;
let districtName=this.$route.query.districtName;
let cityName=this.$route.query.cityName
let provinceId=this.$route.query.provinceId;
let districtNameid=this.$route.query.districtId;
let cityId=this.$route.query.cityId;
this.provinceId=this.$route.query.provinceId;
this.districtId=this.$route.query.districtId;
this.cityId=this.$route.query.cityId;
this.defaultValues=[
{
id:provinceId,
id:this.provinceId,
name:provinceName
},
{
id:cityId,
id:this.cityId,
name:cityName
},
{
id:districtNameid,
id:this.districtId,
name:districtName
}
];

View File

@@ -46,8 +46,8 @@
</div>
<div class="usercontshow useredit">
<div class="usercontshow alledit" @click="onAdd()">
<div class="userdit" ref="marinaddress">
<div class="alledit" @click="onAdd()">
<img src="../../static/images/adddress.png" alt="">
<span>添加收货地址</span>
</div>
@@ -179,7 +179,7 @@ export default {
this.userid = this.usermessage.data.id;
console.log(this.userid);
this.editaddress(this.userid);
},
};
</script>