Commit 64585f67 by wuwx

修改优惠券提交方法

1 parent 245eb274
...@@ -190,7 +190,6 @@ export default { ...@@ -190,7 +190,6 @@ 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,
...@@ -772,6 +771,7 @@ export default { ...@@ -772,6 +771,7 @@ export default {
handleConfirm() { handleConfirm() {
this.validateRules() this.validateRules()
this.loading = true
this.$refs.editFormRef.$refs[this.editChildRef].validate((valid, errorObj) => { this.$refs.editFormRef.$refs[this.editChildRef].validate((valid, errorObj) => {
var merchantval = true var merchantval = true
var merchantErrorObj = [] var merchantErrorObj = []
...@@ -808,8 +808,6 @@ export default { ...@@ -808,8 +808,6 @@ 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,
...@@ -820,7 +818,7 @@ export default { ...@@ -820,7 +818,7 @@ export default {
} }
}) })
.finally(() => { .finally(() => {
this.clickStatus = false this.loading = false
}) })
} }
}) })
......
...@@ -168,7 +168,6 @@ export default { ...@@ -168,7 +168,6 @@ 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: {
...@@ -545,6 +544,7 @@ export default { ...@@ -545,6 +544,7 @@ export default {
handleConfirm() { handleConfirm() {
this.validateRules() this.validateRules()
this.loading = true
this.$refs.editFormRef.$refs[this.editChildRef].validate((valid, errorObj) => { this.$refs.editFormRef.$refs[this.editChildRef].validate((valid, errorObj) => {
var merchantval = true var merchantval = true
var merchantErrorObj = [] var merchantErrorObj = []
...@@ -567,8 +567,6 @@ export default { ...@@ -567,8 +567,6 @@ 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,
...@@ -579,7 +577,7 @@ export default { ...@@ -579,7 +577,7 @@ export default {
} }
}) })
.finally(() => { .finally(() => {
this.clickStatus = false this.loading = false
}) })
} }
}) })
......
...@@ -127,7 +127,6 @@ export default { ...@@ -127,7 +127,6 @@ 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;
...@@ -436,6 +435,7 @@ export default { ...@@ -436,6 +435,7 @@ export default {
handleConfirm() { handleConfirm() {
this.validateRules() this.validateRules()
this.loading = true
this.$refs.editFormRef.$refs[this.editChildRef].validate((valid, errorObj) => { this.$refs.editFormRef.$refs[this.editChildRef].validate((valid, errorObj) => {
var merchantval = true var merchantval = true
var merchantErrorObj = [] var merchantErrorObj = []
...@@ -458,8 +458,6 @@ export default { ...@@ -458,8 +458,6 @@ 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,
...@@ -470,7 +468,7 @@ export default { ...@@ -470,7 +468,7 @@ export default {
} }
}) })
.finally(() => { .finally(() => {
this.clickStatus = false this.loading = false
}) })
} }
}) })
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="topMsg"> <div class="topMsg">
<p class="pageTitle">基本信息</p> <p class="pageTitle">基本信息</p>
</div> </div>
<div class="live-room container" style="padding-top: 20px;"> <div class="live-room container" style="padding-top: 20px;" v-loading="sloading">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm"> <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
<el-form-item size="small" label="服务名称" prop="couponName" style="width: 440px" id="couponName"> <el-form-item size="small" label="服务名称" prop="couponName" style="width: 440px" id="couponName">
<el-input size="small" :disabled="disabledContent" v-model.trim="ruleForm.couponName" maxlength="20" placeholder="请输入服务名称,如“精洗轿车”"></el-input> <el-input size="small" :disabled="disabledContent" v-model.trim="ruleForm.couponName" maxlength="20" placeholder="请输入服务名称,如“精洗轿车”"></el-input>
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
</div> </div>
<GLFooter> <GLFooter>
<el-button @click="goBack" size="medium">取消</el-button> <el-button @click="goBack" size="medium">取消</el-button>
<el-button type="primary" v-if="showSubmit" @click="submitForm('ruleForm')" size="medium" :loading="loading">提交</el-button> <el-button type="primary" v-if="showSubmit" @click="submitForm('ruleForm')" size="medium" :loading="sloading">提交</el-button>
</GLFooter> </GLFooter>
<!-- :hasScroll="false" :noBtnOk="true" :noCancel="true" :noClose="false" --> <!-- :hasScroll="false" :noBtnOk="true" :noCancel="true" :noClose="false" -->
<glsx-dialog title="" top="30vh" :hasScroll="false" width="547px" btnCloseLabel="取消" :noClose="false" :noCancel="true" btnSize="small" :isVisible="isDialogVisible" :showClose="false" @closeDialog="handleClose" @confirmDialog="handleConfirm"> <glsx-dialog title="" top="30vh" :hasScroll="false" width="547px" btnCloseLabel="取消" :noClose="false" :noCancel="true" btnSize="small" :isVisible="isDialogVisible" :showClose="false" @closeDialog="handleClose" @confirmDialog="handleConfirm">
...@@ -209,7 +209,6 @@ export default { ...@@ -209,7 +209,6 @@ export default {
}, 1000) }, 1000)
} }
return { return {
clickStatus: false,
isEdit: false, isEdit: false,
showSubmit: true, showSubmit: true,
disabledDescription: false, disabledDescription: false,
...@@ -403,8 +402,7 @@ export default { ...@@ -403,8 +402,7 @@ export default {
}, },
submitForm(formName) { submitForm(formName) {
if (this.clickStatus) return this.sloading = true
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 = []
...@@ -493,27 +491,20 @@ export default { ...@@ -493,27 +491,20 @@ export default {
params.discountType = 7 params.discountType = 7
params.merchantId = this.merchantId params.merchantId = this.merchantId
params.merchantName = this.merchantName params.merchantName = this.merchantName
this.sloading = true
createService(params) createService(params)
.then(res => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
this.sloading = false
this.$message.success('操作成功') this.$message.success('操作成功')
this.$router.push('/couponManage/index') this.$router.push('/couponManage/index')
} else { } else {
this.sloading = false
this.$message({ this.$message({
type: 'error', type: 'error',
message: res.message message: res.message
}) })
} }
}) })
.catch(err => {
this.sloading = false
})
.finally(() => { .finally(() => {
this.sloading = false this.sloading = false
this.clickStatus = false
}) })
}, },
//更新服务 //更新服务
...@@ -526,24 +517,18 @@ export default { ...@@ -526,24 +517,18 @@ export default {
param.couponId = this.$route.query.couponId param.couponId = this.$route.query.couponId
param.stock = this.ruleForm.stock param.stock = this.ruleForm.stock
param.useDescription = this.ruleForm.useDescription param.useDescription = this.ruleForm.useDescription
this.sloading = true
updateService(param) updateService(param)
.then(res => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
this.sloading = false
this.$message.success('编辑服务成功') this.$message.success('编辑服务成功')
this.$router.push('/couponManage/index') this.$router.push('/couponManage/index')
} else { } else {
this.sloading = false
this.$message({ this.$message({
type: 'error', type: 'error',
message: res.message message: res.message
}) })
} }
}) })
.catch(err => {
this.sloading = false
})
.finally(() => { .finally(() => {
this.sloading = false this.sloading = false
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!