From 8400e1423fc4df94fe3520948a47829c29185d16 Mon Sep 17 00:00:00 2001 From: yujk <990961482@qq.com> Date: Thu, 2 Jun 2022 10:35:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/bank/add/add.js | 45 ++++++++++++------------- pages/bankDraft/add/add.js | 65 +++++++++++++++++++++--------------- pages/fixedAssets/add/add.js | 6 ++-- pages/project/add/add.js | 46 ++++++++++++------------- 4 files changed, 86 insertions(+), 76 deletions(-) diff --git a/pages/bank/add/add.js b/pages/bank/add/add.js index 07475f3..0d92cb3 100644 --- a/pages/bank/add/add.js +++ b/pages/bank/add/add.js @@ -68,7 +68,6 @@ Page({ if(r.data.length>0){ that.setData({ bankTypeOptions:r.data, - 'form.bankType':r.data[0].dictValue }) } } @@ -164,16 +163,17 @@ Page({ if(that.data.form.id==""||that.data.form.id==null){ UTIL.httpRequest(API.URL_GET_DEPOSITADD, that.data.form, { success: (res) => { - wx.showToast({ - title: "提交成功!", - duration: 2000, - icon:"success" - }) - setTimeout(function(){ - wx.navigateBack({ - delta:1 - }) - },2000) + this.setData({'status':0}) + if(res.code == 200){ + UTIL.showToastNoneIcon('新增成功'); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon('新增失败'); + } }, fail: function (response) { if (typeof fail === FUNCTION_TEXT) { @@ -184,23 +184,23 @@ Page({ this.setData({'status':0}) }, complete: function (response) { - this.setData({'status':0}) wx.hideNavigationBarLoading(); } }) }else{ UTIL.httpRequest(API.URL_POST_DEPOSITUPDATE, that.data.form, { success: (res) => { - wx.showToast({ - title: "修改成功!", - duration: 2000, - icon:"success" - }) - setTimeout(function(){ - wx.navigateBack({ - delta:1 - }) - },2000) + this.setData({'status':0}) + if(res.code == 200){ + UTIL.showToastNoneIcon('修改成功'); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon('修改失败'); + } }, fail: function (response) { if (typeof fail === FUNCTION_TEXT) { @@ -211,7 +211,6 @@ Page({ this.setData({'status':0}) }, complete: function (response) { - this.setData({'status':0}) wx.hideNavigationBarLoading(); } }) diff --git a/pages/bankDraft/add/add.js b/pages/bankDraft/add/add.js index 2edeb3e..efc3957 100644 --- a/pages/bankDraft/add/add.js +++ b/pages/bankDraft/add/add.js @@ -27,6 +27,9 @@ Page({ showBtn:true, showStartTime:false, showEndTime:false, + status:0, + orderTypeindex:0, + orderStatusindex:0 }, /** @@ -144,12 +147,19 @@ Page({ [even.currentTarget.dataset.name]:false }) }, - onConfirmOrderType(event) { + onConfirmorderType (e) { + let obj = e.detail.value; this.setData({ - [event.currentTarget.dataset.name]: false, - [event.currentTarget.dataset.value]: event.detail.value.dictValue, - [event.currentTarget.dataset.value+'Text']: event.detail.value.dictLabel, - }); + 'form.orderType':this.data.orderTypeOptions[obj].dictValue, + 'orderTypeindex':obj + }) + }, + onConfirmorderStatus (e) { + let obj = e.detail.value; + this.setData({ + 'form.orderStatus':this.data.orderStatusOptions[obj].dictValue, + 'orderStatusindex':obj + }) }, goSubmit(){ if(this.data.form.orderNum===''||this.data.form.orderNum==null){ //汇票号码 @@ -179,37 +189,40 @@ Page({ }else if(this.data.form.orderStatus === ''||this.data.form.orderStatus==null){//联行号 UTIL.showToastNoneIcon('汇票状态不能为空!'); return false; - }else{ + }else if(this.data.status=='0'){ + this.setData({'status':'1'}) var that = this; that.data.form.method = 'POST'; if(that.data.form.id==""||that.data.form.id==null){ UTIL.httpRequest(API.URL_POST_MONEYORDERADD, that.data.form , { success: (res) => { - wx.showToast({ - title: '新增成功', - icon: 'success', - duration: 2000, - complete(){ - setTimeout(function(){ - that.back(); - },2000) - } - }) + this.setData({'status':0}) + if(res.code == 200){ + UTIL.showToastNoneIcon('新增成功'); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon('新增失败'); + } } }) }else{ UTIL.httpRequest(API.URL_POST_MONEYORDERUPDATE, that.data.form , { success: (res) => { - wx.showToast({ - title: '修改成功', - icon: 'success', - duration: 2000, - complete(){ - setTimeout(function(){ - that.back(); - },2000) - } - }) + this.setData({'status':0}) + if(res.code == 200){ + UTIL.showToastNoneIcon('修改成功'); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon('修改失败'); + } } }) } diff --git a/pages/fixedAssets/add/add.js b/pages/fixedAssets/add/add.js index a7b5569..2856bcb 100644 --- a/pages/fixedAssets/add/add.js +++ b/pages/fixedAssets/add/add.js @@ -211,6 +211,7 @@ Page({ data.method = "POST"; UTIL.httpRequest(API.URL_POST_PERMANENTUPDATE,data,{ success: (res) => { + this.setData({'status':'0'}) if(res.code == 200){ UTIL.showToastNoneIcon('修改成功'); setTimeout(function(){ @@ -220,7 +221,6 @@ Page({ },2000) }else{ UTIL.showToastNoneIcon('修改失败'); - that.setData({'status':'0'}) } }, fail: function (response) { @@ -232,7 +232,6 @@ Page({ that.setData({'status':0}) }, complete: function (response) { - that.setData({'status':0}) wx.hideNavigationBarLoading(); } }) @@ -241,6 +240,7 @@ Page({ data.method = "POST"; UTIL.httpRequest(API.URL_POST_PERMANENTADD,data,{ success: (res) => { + that.setData({'status':'0'}) if(res.code == 200){ UTIL.showToastNoneIcon(res.msg); setTimeout(function(){ @@ -250,7 +250,6 @@ Page({ },2000) }else{ UTIL.showToastNoneIcon(res.msg); - that.setData({'status':'0'}) } }, fail: function (response) { @@ -262,7 +261,6 @@ Page({ that.setData({'status':0}) }, complete: function (response) { - that.setData({'status':0}) wx.hideNavigationBarLoading(); } }) diff --git a/pages/project/add/add.js b/pages/project/add/add.js index 27c9c1e..b0c14f3 100644 --- a/pages/project/add/add.js +++ b/pages/project/add/add.js @@ -145,16 +145,17 @@ Page({ if(that.data.form.id==""||that.data.form.id==null){ UTIL.httpRequest(API.URL_GET_PROJECTADD, data, { success: (res) => { - wx.showToast({ - title: "新增成功!", - duration: 2000, - icon:"success" - }) - setTimeout(function(){ - wx.navigateBack({ - delta:1 - }) - },2000) + this.setData({'status':0}) + if(res.code == 200){ + UTIL.showToastNoneIcon('新增成功'); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon('新增失败'); + } }, fail: function (response) { if (typeof fail === FUNCTION_TEXT) { @@ -162,26 +163,26 @@ Page({ } else { showToastNoneIcon(API.MSG_FAIL_HTTP); } - this.setData({'status':0}) + that.setData({'status':0}) }, complete: function (response) { - this.setData({'status':0}) wx.hideNavigationBarLoading(); } }) }else{ UTIL.httpRequest(API.URL_POST_PROJECTUPDATE, data, { success: (res) => { - wx.showToast({ - title: "修改成功!", - duration: 2000, - icon:"success" - }) - setTimeout(function(){ - wx.navigateBack({ - delta:1 - }) - },2000) + this.setData({'status':0}) + if(res.code == 200){ + UTIL.showToastNoneIcon('修改成功'); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon('修改失败'); + } }, fail: function (response) { if (typeof fail === FUNCTION_TEXT) { @@ -192,7 +193,6 @@ Page({ this.setData({'status':0}) }, complete: function (response) { - this.setData({'status':0}) wx.hideNavigationBarLoading(); } })