|
|
@ -105,6 +105,7 @@ |
|
|
onLoad(option) { |
|
|
onLoad(option) { |
|
|
this.popleType = option.popleType |
|
|
this.popleType = option.popleType |
|
|
this.type=option.type |
|
|
this.type=option.type |
|
|
|
|
|
let data = JSON.parse(option.data) |
|
|
if (option.type = "edit") { |
|
|
if (option.type = "edit") { |
|
|
this.formData.address1 = data.province + data.city + data.area |
|
|
this.formData.address1 = data.province + data.city + data.area |
|
|
this.formData.address = data.address |
|
|
this.formData.address = data.address |
|
|
@ -112,8 +113,8 @@ |
|
|
this.formData.city = data.city |
|
|
this.formData.city = data.city |
|
|
this.formData.province = data.province |
|
|
this.formData.province = data.province |
|
|
this.formData.id = data.id |
|
|
this.formData.id = data.id |
|
|
this.formData.consigneeMobile = data.consigneeMobile |
|
|
this.formData.consigneeMobile = data.consigneeMobile || data.phone |
|
|
this.formData.consigneeName = data.consigneeName |
|
|
this.formData.consigneeName = data.consigneeName || data.name |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
@ -122,6 +123,24 @@ |
|
|
}, |
|
|
}, |
|
|
delItemModal() { |
|
|
delItemModal() { |
|
|
this.delShow = false; |
|
|
this.delShow = false; |
|
|
|
|
|
if(this.popleType=="khName"){ |
|
|
|
|
|
this.tui.request("/app/customer/delById", "post", { |
|
|
|
|
|
id: this.formData.id, |
|
|
|
|
|
}, false, true).then((res) => { |
|
|
|
|
|
if (res.code == 200) { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: "删除成功", |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
uni.navigateBack() |
|
|
|
|
|
} else { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: "删除失败", |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}else{ |
|
|
this.tui.request("/app/supplier/delByIds", "post", { |
|
|
this.tui.request("/app/supplier/delByIds", "post", { |
|
|
ids: this.formData.id, |
|
|
ids: this.formData.id, |
|
|
}, false, true).then((res) => { |
|
|
}, false, true).then((res) => { |
|
|
@ -138,6 +157,8 @@ |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
nameBlur() { |
|
|
nameBlur() { |
|
|
this.formData.username = this.formData.phone; |
|
|
this.formData.username = this.formData.phone; |
|
|
@ -166,13 +187,43 @@ |
|
|
let that = this; |
|
|
let that = this; |
|
|
this.$refs.form.validate().then(res => { |
|
|
this.$refs.form.validate().then(res => { |
|
|
if(this.popleType == 'khName'){ |
|
|
if(this.popleType == 'khName'){ |
|
|
that.tui.request("/app/customer/save", "post", { |
|
|
if(that.type=='edit'){ |
|
|
|
|
|
that.tui.request("/app/customer/edit", "post", { |
|
|
name:this.formData.consigneeName, |
|
|
name:this.formData.consigneeName, |
|
|
phone:this.formData.consigneeMobile, |
|
|
phone:this.formData.consigneeMobile, |
|
|
address:this.formData.address, |
|
|
address:this.formData.address, |
|
|
province:this.addressObj.province, |
|
|
province:this.addressObj.province, |
|
|
city:this.addressObj.city, |
|
|
city:this.addressObj.city, |
|
|
area:this.addressObj.area, |
|
|
area:this.addressObj.area, |
|
|
|
|
|
id:this.formData.id, |
|
|
|
|
|
userName:this.formData.consigneeMobile |
|
|
|
|
|
}, false,true).then((res) => { |
|
|
|
|
|
if (res.code == 200) { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: "添加成功", |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。 |
|
|
|
|
|
let prevPage = pages[pages.length - 2]; //上一页页面实例 |
|
|
|
|
|
prevPage.$vm.popleType = 'khName' |
|
|
|
|
|
uni.navigateBack({ |
|
|
|
|
|
delta: 1 |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: "添加失败", |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}else{ |
|
|
|
|
|
that.tui.request("/app/customer/save", "post", { |
|
|
|
|
|
name:this.formData.consigneeName, |
|
|
|
|
|
phone:this.formData.consigneeMobile, |
|
|
|
|
|
address:this.formData.address, |
|
|
|
|
|
province:this.formData.province, |
|
|
|
|
|
city:this.formData.city, |
|
|
|
|
|
area:this.formData.area, |
|
|
userName:this.formData.consigneeMobile |
|
|
userName:this.formData.consigneeMobile |
|
|
}, false,true).then((res) => { |
|
|
}, false,true).then((res) => { |
|
|
if (res.code == 200) { |
|
|
if (res.code == 200) { |
|
|
@ -193,6 +244,25 @@ |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
if(that.type=='edit'){ |
|
|
|
|
|
that.tui.request("/app/supplier/edit", "post", this.formData, false, |
|
|
|
|
|
true).then((res) => { |
|
|
|
|
|
if (res.code == 200) { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: "修改成功", |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
uni.navigateBack() |
|
|
|
|
|
} else { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: "修改失败", |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
}else{ |
|
|
}else{ |
|
|
that.tui.request("/app/supplier/save", "post", Object.assign(that.addressObj, res), false, |
|
|
that.tui.request("/app/supplier/save", "post", Object.assign(that.addressObj, res), false, |
|
|
true).then((res) => { |
|
|
true).then((res) => { |
|
|
@ -216,7 +286,7 @@ |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|