Browse Source

[优化] 新增按钮防止重复点击

master
邓平艺 5 years ago
parent
commit
a6ea960513
  1. 7
      canteen/App.vue
  2. 17
      canteen/pages/delivery/apply.vue
  3. 10
      canteen/pages/delivery/detail.vue
  4. 10
      canteen/pages/login/index.vue
  5. 26
      canteen/pages/purchase/detail.vue
  6. 14
      canteen/pages/purchase/launch.vue
  7. 7
      supplier/App.vue
  8. 30
      supplier/pages/gonghuo/detail.vue
  9. 10
      supplier/pages/login/index.vue
  10. 20
      supplier/pages/offer/index.vue
  11. 12
      supplier/pages/order/detail.vue

7
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;

17
canteen/pages/delivery/apply.vue

@ -28,11 +28,11 @@
<view class="fixed-bottom lf-p-l-32 lf-p-r-32" style="justify-content: space-between;" v-if="enter_type == 1">
<view></view>
<!-- <button class="btn btn2" @click="editOrder()">立即申请</button> -->
<button class="btn btn2" @click="save(1)">立即申请</button>
<button class="btn btn2" :class="{'lf-btn-disabled': button_click}" @click="save(1)">立即申请</button>
</view>
<view class="fixed-bottom" v-else>
<button class="btn btn1" @click="save(0)">临时保存</button>
<button class="btn btn2" @click="save(1)">直接申请</button>
<button class="btn btn1" :class="{'lf-btn-disabled': button_click}" @click="save(0)">临时保存</button>
<button class="btn btn2" :class="{'lf-btn-disabled': button_click}" @click="save(1)">直接申请</button>
</view>
</view>
</template>
@ -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;
}
}
}

10
canteen/pages/delivery/detail.vue

@ -33,7 +33,7 @@
<view class="fixed-bottom">
<view v-if="type == '待确认'" class="lf-row-flex-end" style="justify-content: space-between;width: 100%;">
<button class="btn btn1" @click="$url('/pages/delivery/apply?o_sn='+ o_sn+'&enter_type=1')">编辑</button>
<button class="btn btn2" @click="orderStateChange('申请中')">立即申请</button>
<button class="btn btn2" :class="{'lf-btn-disabled': button_click}" @click="orderStateChange('申请中')">立即申请</button>
</view>
<view v-else-if="type == '已出库'" class="lf-row-between" style="justify-content: space-between;width: 100%;">
<button class="btn btn1" @click="$url('/pages/delivery/apply?o_sn='+ o_sn+'&enter_type=2')">复用出库单</button>
@ -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);
}
}
}

10
canteen/pages/login/index.vue

@ -39,7 +39,7 @@
</view>
<view>
<!-- 登录按钮 -->
<button class="button" @click="login">登录</button>
<button class="button" :class="{'lf-btn-disabled': button_click}" @click="login">登录</button>
</view>
</view>
<view :style="is_focus ? 'height: 540rpx' : 'height: 40rpx'"></view>
@ -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);
}
}
}

26
canteen/pages/purchase/detail.vue

@ -65,13 +65,13 @@
<view class="fixed-bottom" v-if="type && type != '备货中'">
<view v-if="type == '待发单'" class="lf-row-flex-end">
<button class="btn btn1" @click="$url('/pages/purchase/launch?p_sn='+ order.p_sn+'&enter_type=1')">编辑</button>
<button class="btn btn2" @click="orderStateChange('待接单')">立即发单</button>
<button class="btn btn2" :class="{'lf-btn-disabled': button_click}" @click="orderStateChange('待接单')">立即发单</button>
</view>
<view v-else-if="type == '待接单'" class="lf-row-flex-end">
<button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('已撤销')">撤销订单</button>
<button class="btn btn2" :class="{'lf-btn-disabled': button_click}" style="background-color: #FF0000;" @click="orderStateChange('已撤销')">撤销订单</button>
</view>
<view v-else-if="type == '已发货'" class="lf-row-flex-end">
<button class="btn btn1" @click="orderStateChange('已退单')">退单</button>
<button class="btn btn1" :class="{'lf-btn-disabled': button_click}" @click="orderStateChange('已退单')">退单</button>
<button class="btn btn1 lf-m-l-20" @click="is_show_voucher = true">上传凭证</button>
<button class="btn btn2" @click="$url('/pages/purchase/receipt?p_sn='+ order.p_sn)">清点物资</button>
</view>
@ -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 @@
// ossurl
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)
}
}
}

14
canteen/pages/purchase/launch.vue

@ -51,8 +51,8 @@
<!-- 操作按钮 -->
<view style="height: 140rpx;"></view>
<view class="fixed-bottom">
<button class="btn btn1" @click="save(0)">临时保存</button>
<button class="btn btn2" @click="save(1)">保存并发单</button>
<button class="btn btn1" :class="{'lf-btn-disabled': button_click}" @click="save(0)">临时保存</button>
<button class="btn btn2" :class="{'lf-btn-disabled': button_click}" @click="save(1)">保存并发单</button>
</view>
</view>
</template>
@ -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(){

7
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;

30
supplier/pages/gonghuo/detail.vue

@ -77,7 +77,7 @@
<!-- 操作按钮 -->
<view class="fixed-bottom">
<view v-if="type == '待接单'" class="lf-row-flex-end">
<button class="btn btn2" style="background-color: #1833F2;" @click="orderTaking">立即接单</button>
<button class="btn btn2" :class="{'lf-btn-disabled': button_click}" style="background-color: #1833F2;" @click="orderTaking">立即接单</button>
</view>
<view v-else-if="type == '备货中'" class="lf-row-flex-end">
<button class="btn btn1" @click="is_show_voucher = true">上传凭证</button>
@ -198,7 +198,8 @@
driver_name: '',
driver_phone: '',
canteen_voucher: [], //
supplier_voucher: [] //
supplier_voucher: [], //
button_click: false
}
},
onLoad(options){
@ -315,8 +316,13 @@
// ossurl
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)
}
}
}

10
supplier/pages/login/index.vue

@ -39,7 +39,7 @@
</view>
<view>
<!-- 登录按钮 -->
<button class="button" @click="login">登录</button>
<button class="button" :class="{'lf-btn-disabled': button_click}" @click="login">登录</button>
</view>
</view>
<view :style="is_focus ? 'height: 540rpx' : 'height: 40rpx'"></view>
@ -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);
}
}
}

20
supplier/pages/offer/index.vue

@ -65,8 +65,8 @@
<view style="height: 140rpx;"></view>
<!-- 操作按钮 -->
<view class="fixed-bottom">
<button class="btn btn1" @click="save(0)">临时保存</button>
<button class="btn btn2" @click="save(1)">直接报价</button>
<button class="btn btn1" :class="{'lf-btn-disabled': button_click}" @click="save(0)">临时保存</button>
<button class="btn btn2" :class="{'lf-btn-disabled': button_click}" @click="save(1)">直接报价</button>
</view>
</view>
</template>
@ -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)
}
}
}

12
supplier/pages/order/detail.vue

@ -39,11 +39,11 @@
<!-- 操作按钮 -->
<view class="fixed-bottom" v-if="$isRight(order) && type != 0">
<view v-if="type == 1" class="lf-row-flex-end">
<button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('待发起')">撤销订单</button>
<button class="btn btn2" :class="{'lf-btn-disabled': buttom_click}" style="background-color: #FF0000;" @click="orderStateChange('待发起')">撤销订单</button>
</view>
<view v-if="type == 2" class="lf-row-flex-end">
<button class="btn btn1" @click="$url('/pages/offer/index?type=1&code='+ order.q_sn)">编辑</button>
<button class="btn btn2" @click="orderStateChange('待审核')">发起报价</button>
<button class="btn btn2" :class="{'lf-btn-disabled': buttom_click}" @click="orderStateChange('待审核')">发起报价</button>
</view>
<view v-if="type == 3 || type == 4" class="lf-row-between">
<button class="btn btn1" @click="$url('/pages/offer/index?type=2&code='+ order.q_sn)">复用报价单</button>
@ -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)
}
}
}

Loading…
Cancel
Save