diff --git a/pages/billing/addUser.vue b/pages/billing/addUser.vue
index 1702e7e..e0355f0 100644
--- a/pages/billing/addUser.vue
+++ b/pages/billing/addUser.vue
@@ -104,7 +104,8 @@
},
onLoad(option) {
this.popleType = option.popleType
- this.type=option.type
+ this.type=option.type
+ let data = JSON.parse(option.data)
if (option.type = "edit") {
this.formData.address1 = data.province + data.city + data.area
this.formData.address = data.address
@@ -112,8 +113,8 @@
this.formData.city = data.city
this.formData.province = data.province
this.formData.id = data.id
- this.formData.consigneeMobile = data.consigneeMobile
- this.formData.consigneeName = data.consigneeName
+ this.formData.consigneeMobile = data.consigneeMobile || data.phone
+ this.formData.consigneeName = data.consigneeName || data.name
}
},
methods: {
@@ -121,23 +122,43 @@
this.delShow = true;
},
delItemModal() {
- this.delShow = false;
- this.tui.request("/app/supplier/delByIds", "post", {
- ids: this.formData.id,
- }, false, true).then((res) => {
- if (res.code == 200) {
- uni.showToast({
- title: "删除成功",
- icon: 'none'
- })
- uni.navigateBack()
- } else {
- uni.showToast({
- title: "删除失败",
- icon: 'none'
- })
- }
- })
+ 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", {
+ ids: this.formData.id,
+ }, false, true).then((res) => {
+ if (res.code == 200) {
+ uni.showToast({
+ title: "删除成功",
+ icon: 'none'
+ })
+ uni.navigateBack()
+ } else {
+ uni.showToast({
+ title: "删除失败",
+ icon: 'none'
+ })
+ }
+ })
+ }
+
},
nameBlur() {
this.formData.username = this.formData.phone;
@@ -166,57 +187,106 @@
let that = this;
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'
- })
- }
- })
+ if(that.type=='edit'){
+ that.tui.request("/app/customer/edit", "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,
+ 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
+ }, 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'){
+ 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 => {
})
}
diff --git a/pages/index/addHangOrder.vue b/pages/index/addHangOrder.vue
index 051565c..3c6be40 100644
--- a/pages/index/addHangOrder.vue
+++ b/pages/index/addHangOrder.vue
@@ -153,11 +153,13 @@
-
-
-
-
+
+
+
+
+
+