Commit ddfcc34e by wuwx

修复网络慢,多次点击创建优惠券按钮生成多个优惠券

1 parent 6077a389
...@@ -190,6 +190,7 @@ export default { ...@@ -190,6 +190,7 @@ export default {
title: '创建', title: '创建',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
loading: false, loading: false,
clickStatus: false,
routeInfo: { routeInfo: {
// 1-新增;2-编辑;3-查看 // 1-新增;2-编辑;3-查看
addOrEdit: 1, addOrEdit: 1,
...@@ -807,6 +808,8 @@ export default { ...@@ -807,6 +808,8 @@ export default {
method = 'createCouponApi' //后台创建优惠券 method = 'createCouponApi' //后台创建优惠券
} }
console.log(params) console.log(params)
if (this.clickStatus) return
this.clickStatus = true
this.$apis.couponManage[method](params).then(res => { this.$apis.couponManage[method](params).then(res => {
this.$message({ this.$message({
message: res.code == '0' ? '操作成功' : res.message, message: res.code == '0' ? '操作成功' : res.message,
......
...@@ -168,6 +168,7 @@ export default { ...@@ -168,6 +168,7 @@ export default {
format: 'yyyy-MM-dd HH:mm:ss', // 日期显示格式 format: 'yyyy-MM-dd HH:mm:ss', // 日期显示格式
showSubmit: true, showSubmit: true,
userDisable: false, userDisable: false,
clickStatus: false,
size: 'small', size: 'small',
title: '创建', title: '创建',
titleObj: { titleObj: {
...@@ -566,6 +567,8 @@ export default { ...@@ -566,6 +567,8 @@ export default {
} else { } else {
method = 'createCouponApi' //后台创建优惠券 method = 'createCouponApi' //后台创建优惠券
} }
if (this.clickStatus) return
this.clickStatus = true
this.$apis.couponManage[method](params).then(res => { this.$apis.couponManage[method](params).then(res => {
this.$message({ this.$message({
message: res.code == '0' ? '操作成功' : res.message, message: res.code == '0' ? '操作成功' : res.message,
......
...@@ -127,6 +127,7 @@ export default { ...@@ -127,6 +127,7 @@ export default {
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
loading: false, loading: false,
editStatus: false, editStatus: false,
clickStatus: false,
// pickerOptions: { // pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期 // disabledDate(v) {//禁用当前之前的日期
// return v.getTime() < new Date().getTime() - 86400000; // return v.getTime() < new Date().getTime() - 86400000;
...@@ -457,6 +458,8 @@ export default { ...@@ -457,6 +458,8 @@ export default {
} else { } else {
method = 'createCouponApi' //后台创建优惠券 method = 'createCouponApi' //后台创建优惠券
} }
if (this.clickStatus) return
this.clickStatus = true
this.$apis.couponManage[method](params).then(res => { this.$apis.couponManage[method](params).then(res => {
this.$message({ this.$message({
message: res.code == '0' ? '操作成功' : res.message, message: res.code == '0' ? '操作成功' : res.message,
......
...@@ -209,6 +209,7 @@ export default { ...@@ -209,6 +209,7 @@ export default {
}, 1000) }, 1000)
} }
return { return {
clickStatus: false,
isEdit: false, isEdit: false,
showSubmit: true, showSubmit: true,
disabledDescription: false, disabledDescription: false,
...@@ -402,6 +403,8 @@ export default { ...@@ -402,6 +403,8 @@ export default {
}, },
submitForm(formName) { submitForm(formName) {
if (this.clickStatus) return
this.clickStatus = true
this.$refs[formName].validate((valid, errorObj) => { this.$refs[formName].validate((valid, errorObj) => {
var merchantval = true var merchantval = true
var merchantErrorObj = [] var merchantErrorObj = []
......
...@@ -115,7 +115,7 @@ export default { ...@@ -115,7 +115,7 @@ export default {
} }
</script> </script>
<style lang="scss" scope> <style lang="scss" scoped>
.img-bg { .img-bg {
position: relative; position: relative;
width: 290px; width: 290px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!