diff --git a/canteen/App.vue b/canteen/App.vue index 50df948..e687a61 100644 --- a/canteen/App.vue +++ b/canteen/App.vue @@ -49,6 +49,13 @@ @import '@/common/styles/theme.css'; @import '@/common/styles/common.css'; + // 禁用的按钮 + .lf-btn-disabled{ + background-color: #cfd0d1 !important; + color: #FFFFFF !important; + border: none !important; + opacity: 1 !important; + } //底部按钮 .btn-bottom { position: fixed; diff --git a/canteen/pages/delivery/apply.vue b/canteen/pages/delivery/apply.vue index dd3d6b8..7d905e4 100644 --- a/canteen/pages/delivery/apply.vue +++ b/canteen/pages/delivery/apply.vue @@ -28,11 +28,11 @@ - + - - + + @@ -87,7 +87,8 @@ warehouse_list: {}, enter_type: '', // 1 编辑,2 复用 o_sn: '', - isStock: true + isStock: true, + button_click: false } }, onLoad(e){ @@ -196,7 +197,10 @@ }, // 保存,出库 save(_t){ + if(this.button_click) return; + this.button_click = true; if(this.contents.length <= 0) { + this.button_click = false; return this.$msg('您未选择物资') } let is_empty = false; @@ -263,6 +267,7 @@ showCancel: false, confirmColor: '#11D189' }) + this.button_click = false; return; } let state = ['待确认', '申请中'][_t]; // 传入状态 @@ -277,7 +282,9 @@ } this.$http(_api, _data).then(res => { this.$msg('操作成功').then(() => this.$toBack()); - }) + }).catch(err => this.button_click = false); + }else{ + this.button_click = false; } } } diff --git a/canteen/pages/delivery/detail.vue b/canteen/pages/delivery/detail.vue index c568355..e4b2efd 100644 --- a/canteen/pages/delivery/detail.vue +++ b/canteen/pages/delivery/detail.vue @@ -33,7 +33,7 @@ - + @@ -90,7 +90,8 @@ o_sn: '', order: {}, type: 4, - show_count: 0 + show_count: 0, + button_click: false } }, onLoad(options){ @@ -153,14 +154,17 @@ }, // 改变订单状态 orderStateChange(state){ + if(this.button_click) return; + this.button_click = true; this.$http(this.API.API_CANTEEN_WAREHOUSEUPDATE, { w_sn: this.o_sn, state: state }).then(res => { console.log("res", res); this.$msg('操作成功'); + this.button_click = false; this.getData(); - }) + }).catch(err => this.button_click = false); } } } diff --git a/canteen/pages/login/index.vue b/canteen/pages/login/index.vue index 2b92bf2..0b14da1 100644 --- a/canteen/pages/login/index.vue +++ b/canteen/pages/login/index.vue @@ -39,7 +39,7 @@ - + @@ -54,7 +54,8 @@ return { is_focus: false, user_key: '', - user_pw: '' + user_pw: '', + button_click: false } }, onLoad(options){ @@ -78,19 +79,22 @@ }, 0); // 给click事件留出时间 }, login(){ + if(this.button_click) return; if(!this.user_key){ this.$msg('账号不能为空'); }else if(!this.user_pw){ this.$msg('密码不能为空'); }else{ + this.button_click = true; this.$http(this.API.API_CANTEEN_LOGIN, { username: this.user_key, password: this.user_pw }).then(res => { console.log("login", res); uni.setStorageSync('canteen_token', res.data.token); + this.button_click = false; this.$url('/pages/index/index', {tyep: 'redirect'}); - }) + }).catch(err => this.button_click = false); } } } diff --git a/canteen/pages/purchase/detail.vue b/canteen/pages/purchase/detail.vue index f3f492f..f3d2cf1 100644 --- a/canteen/pages/purchase/detail.vue +++ b/canteen/pages/purchase/detail.vue @@ -65,13 +65,13 @@ - + - + - + @@ -174,7 +174,8 @@ voucher_count: 6, show_count: 0, canteen_voucher: [], // 食堂端凭证 - supplier_voucher: [] // 供应端凭证 + supplier_voucher: [], // 供应端凭证 + button_click: false } }, onLoad(options){ @@ -293,8 +294,11 @@ // 用户点击确定,将图片上传至oss,并将url发送给后端 submitImage(){ let that = this; + if(that.button_click) return; + that.button_click = true; let voucher_list = that.voucher_list; if(voucher_list.length <= 0){ + that.button_click = false; return that.$msg('您未上传图片哦'); }; that.is_show_voucher = false; @@ -323,11 +327,16 @@ uni.hideLoading(); that.voucher_list = []; that.$msg('凭证已上传成功!'); + that.button_click = false; that.getData(); - }).catch(err => uni.hideLoading()); + }).catch(err => { + uni.hideLoading(); + that.button_click = false; + }); }).catch(err => { uni.hideLoading(); + that.button_click = false; uni.showModal({ title: '', content: JSON.stringify(err), @@ -339,6 +348,8 @@ // 改变订单状态 orderStateChange(state){ let that = this; + if(that.button_click) return; + that.button_click = true; if(state == '已退单'){ uni.showModal({ title: '温馨提示', @@ -348,6 +359,8 @@ success: result => { if(result.confirm){ $change(); + }else{ + that.button_click = false; } } }) @@ -360,8 +373,9 @@ p_sn: that.p_sn, state: state }).then(res => { + that.button_click = false; that.$msg('操作成功').then(()=> that.getData()); - }) + }).catch(err => that.button_click = false) } } } diff --git a/canteen/pages/purchase/launch.vue b/canteen/pages/purchase/launch.vue index 230b8cb..f620f69 100644 --- a/canteen/pages/purchase/launch.vue +++ b/canteen/pages/purchase/launch.vue @@ -51,8 +51,8 @@ - - + + @@ -74,7 +74,8 @@ show_count: 0, // 页面显示次数 p_sn: '', // 订单号,如果有 type: 0 ,// 类型, 1编辑, 2复用 - first_time: true + first_time: true, + button_click: false } }, onLoad(options){ @@ -279,6 +280,8 @@ }, // 保存并发单 save(_t){ + if(this.button_click) return; + this.button_click = true; let material_list = this.render_material_list; let list = []; let is_empty = true; // 物资数据是否为空 @@ -311,14 +314,17 @@ let deadline = this.date; if(!deadline){ this.$msg('请选择收货时间'); + this.button_click = false; return; } if(is_empty){ this.$msg('您未选择物资'); + this.button_click = false; return; } if(!is_right){ this.$msg('采购数量需大于起购数量'); + this.button_click = false; return; } let _api = this.API.API_CANTEEN_PURCHASEAPPLY; @@ -333,7 +339,7 @@ } this.$http(_api, _data).then(res => { this.$msg('操作成功').then(()=>{this.$toBack()}); - }) + }).catch(err => this.button_click = false); }, // 页面跳转添加供应商 addSupplier(){ diff --git a/supplier/App.vue b/supplier/App.vue index 50df948..e687a61 100644 --- a/supplier/App.vue +++ b/supplier/App.vue @@ -49,6 +49,13 @@ @import '@/common/styles/theme.css'; @import '@/common/styles/common.css'; + // 禁用的按钮 + .lf-btn-disabled{ + background-color: #cfd0d1 !important; + color: #FFFFFF !important; + border: none !important; + opacity: 1 !important; + } //底部按钮 .btn-bottom { position: fixed; diff --git a/supplier/pages/gonghuo/detail.vue b/supplier/pages/gonghuo/detail.vue index 23f9ace..27b72a9 100644 --- a/supplier/pages/gonghuo/detail.vue +++ b/supplier/pages/gonghuo/detail.vue @@ -77,7 +77,7 @@ - + @@ -198,7 +198,8 @@ driver_name: '', driver_phone: '', canteen_voucher: [], // 食堂端凭证 - supplier_voucher: [] // 供应端凭证 + supplier_voucher: [], // 供应端凭证 + button_click: false } }, onLoad(options){ @@ -315,8 +316,13 @@ // 用户点击确定,将图片上传至oss,并将url发送给后端 submitImage(){ let that = this; + if(that.button_click){ + return; + } + that.button_click = true; let voucher_list = that.voucher_list; if(voucher_list.length <= 0){ + that.button_click = false; return that.$msg('您未上传图片哦'); }; that.is_show_voucher = false; @@ -345,11 +351,16 @@ uni.hideLoading(); that.voucher_list = []; that.$msg('凭证已上传成功!'); + that.button_click = false; that.getData(); - }).catch(err => uni.hideLoading()); + }).catch(err => { + uni.hideLoading(); + that.button_click = false; + }); }).catch(err => { uni.hideLoading(); + that.button_click = false; uni.showModal({ title: '', content: JSON.stringify(err), @@ -360,23 +371,31 @@ }, // 立即接单 orderTaking(){ + if(this.button_click) return; + this.button_click = true; this.$http(this.API.API_SUPPLIER_PURCHASEORDERACCEPT, { p_sn: this.p_sn }).then(res => { this.$msg('接单成功'); + this.button_click = false; this.getData(); - }); + }).catch(err => this.button_click = false) }, // 确认发货 confirmDeliver(){ + if(this.buttom_click) return; + this.buttom_click = true; let l_p_num = this.l_p_num; let driver_name = this.driver_name; let driver_phone = this.driver_phone; if(!l_p_num){ + this.buttom_click = false; return this.$msg('请输入车牌号') }else if(!driver_name){ + this.buttom_click = false; return this.$msg('请输入司机姓名') }else if(!driver_phone){ + this.buttom_click = false; return this.$msg('请输入司机电话') } this.is_show_receiving = false; @@ -387,8 +406,9 @@ car_license: l_p_num }).then(res => { this.$msg('确认发货成功'); + this.buttom_click = false; this.getData(); - }); + }).catch(err => this.buttom_click = false) } } } diff --git a/supplier/pages/login/index.vue b/supplier/pages/login/index.vue index 18681f7..2e3246f 100644 --- a/supplier/pages/login/index.vue +++ b/supplier/pages/login/index.vue @@ -39,7 +39,7 @@ - + @@ -54,7 +54,8 @@ return { is_focus: false, user_key: '', - user_pw: '' + user_pw: '', + button_click: false } }, methods: { @@ -75,19 +76,22 @@ }, 0); // 给click事件留出时间 }, login(){ + if(this.button_click) return; if(!this.user_key){ this.$msg('账号不能为空'); }else if(!this.user_pw){ this.$msg('密码不能为空'); }else{ + this.button_click = true; this.$http(this.API.API_SUPPLIER_LOGIN, { username: this.user_key, password: this.user_pw }).then(res => { console.log("login", res); uni.setStorageSync('supply_token', res.data.token); + this.buttom_click = false; this.$url('/pages/index/index', {tyep: 'redirect'}); - }) + }).catch(err => this.buttom_click = false); } } } diff --git a/supplier/pages/offer/index.vue b/supplier/pages/offer/index.vue index 8dc523e..388d19c 100644 --- a/supplier/pages/offer/index.vue +++ b/supplier/pages/offer/index.vue @@ -65,8 +65,8 @@ - - + + @@ -127,7 +127,8 @@ deadline_start: '', deadline_end: '', table_loading: true, - searchValue: '' // 搜索内容 + searchValue: '', // 搜索内容 + button_click: false } }, computed: { @@ -408,10 +409,15 @@ this.$msg('操作成功').then(result => { this.$toBack(); }) - }) + }).catch(err => this.button_click = false) }, // 保存 save(_t){ + // 拦截按钮重复点击 + if(this.button_click){ + return; + } + this.button_click = true; // 拦截是编辑的情况 if(this.type == 1){ this.editMaterial(_t); @@ -438,15 +444,19 @@ } }) if(canteen_ids.length <= 0){ + this.button_click = false; return this.$msg('您未选择关联食堂哦') } if(!this.deadline_start){ + this.button_click = false; return this.$msg('您未选择报价生效时间哦') } if(!this.deadline_end){ + this.button_click = false; return this.$msg('您未选择报价失效时间哦') } if(list.length <= 0){ + this.button_click = false; return this.$msg('请补充完整物资报价信息') } // 操作状态,是保存还是直接发起 @@ -461,7 +471,7 @@ this.$msg(res.data).then(result => { this.$toBack(); }) - }) + }).catch(err => this.button_click = false) } } } diff --git a/supplier/pages/order/detail.vue b/supplier/pages/order/detail.vue index e0efb0a..fc477de 100644 --- a/supplier/pages/order/detail.vue +++ b/supplier/pages/order/detail.vue @@ -39,11 +39,11 @@ - + - + @@ -96,7 +96,8 @@ }], contents: [], q_sn: '', // 订单号 - show_count: 0 + show_count: 0, + buttom_click: false } }, computed: { @@ -165,14 +166,17 @@ }, // 改变订单状态 orderStateChange(state){ + if(this.buttom_click) return; + this.buttom_click = true; this.$http(this.API.API_SUPPLIER_QUOTATIONUPDATE, { q_sn: this.q_sn, state: state }).then(res => { console.log("revokeOrder", res); this.$msg('操作成功'); + this.buttom_click = false; this.getDetail(); // 更新当前页面数据 - }) + }).catch(err => this.buttom_click = false) } } }