|
|
|
@ -46,7 +46,8 @@ |
|
|
|
show: false, |
|
|
|
delShow: false, |
|
|
|
addressObj: {}, |
|
|
|
type:'', |
|
|
|
type:'', |
|
|
|
popleType:'', |
|
|
|
formData: { |
|
|
|
consigneeMobile: '', |
|
|
|
consigneeName: '', |
|
|
|
@ -106,9 +107,13 @@ |
|
|
|
this.$refs.form.setRules(this.rules) |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
let data = JSON.parse(option.data) |
|
|
|
|
|
|
|
this.type=option.type |
|
|
|
// if(option.data){ |
|
|
|
// let data = JSON.parse(option.data) |
|
|
|
// } |
|
|
|
this.popleType = option.popleType |
|
|
|
this.type=option.type |
|
|
|
console.log(option.popleType) |
|
|
|
console.log(option.type) |
|
|
|
if (option.type = "edit") { |
|
|
|
this.formData.address1 = data.province + data.city + data.area |
|
|
|
this.formData.address = data.address |
|
|
|
@ -189,48 +194,99 @@ |
|
|
|
// 触发提交表单 |
|
|
|
submit() { |
|
|
|
let that = this; |
|
|
|
this.$refs.form.validate().then(res => { |
|
|
|
if (that.type == 'edit') { |
|
|
|
|
|
|
|
res.id = that.userInfo.id |
|
|
|
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 { |
|
|
|
that.tui.request("/app/supplier/save", "post", Object.assign(that.addressObj, res), 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 = 'gysName' |
|
|
|
uni.navigateBack({ |
|
|
|
delta: 1 |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: "添加失败", |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.$refs.form.validate().then(res => { |
|
|
|
if(this.popleType == 'khName'){ |
|
|
|
that.tui.request("/app/customer/save", "post", { |
|
|
|
name:this.formData.consigneeName, |
|
|
|
phone:this.formData.consigneeMobile, |
|
|
|
address:this.formData.address, |
|
|
|
province:this.addressObj.province, |
|
|
|
city:this.addressObj.city, |
|
|
|
area:this.addressObj.area, |
|
|
|
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/supplier/save", "post", Object.assign(that.addressObj, res), 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 = 'gysName' |
|
|
|
uni.navigateBack({ |
|
|
|
delta: 1 |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: "添加失败", |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
// if (that.type == 'edit') { |
|
|
|
|
|
|
|
// res.id = that.userInfo.id |
|
|
|
// 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 { |
|
|
|
// that.tui.request("/app/supplier/save", "post", Object.assign(that.addressObj, res), 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 = 'gysName' |
|
|
|
// uni.navigateBack({ |
|
|
|
// delta: 1 |
|
|
|
// }) |
|
|
|
// } else { |
|
|
|
// uni.showToast({ |
|
|
|
// title: "添加失败", |
|
|
|
// icon: 'none' |
|
|
|
// }) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// } |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
console.log('表单错误信息:', err); |
|
|
|
|