Commit 07e917d4 by 王志慧

套餐编辑数量限制

1 parent 3763c1bb
......@@ -68,7 +68,7 @@
<div class="footer-panel">
<div>
<el-button type="primary" @click="submitForm()" size="medium" :loading="sloading">提交</el-button>
<el-button @click="goBack" size="medium">取消</el-button>
<el-button @click="goBack" size="medium">取消</el-button>
</div>
</div>
<glsx-dialog title="" top="30vh" :hasScroll="false" class="tipDialog" width="547px" btnCloseLabel="取消" :noClose="false" :noCancel="true" btnSize="small" :isVisible="isTipDialogVisible" :showClose="false" @closeDialog="handleTipClose" @confirmDialog="handleTipConfirm">
......@@ -122,6 +122,7 @@ export default {
merchantId: 44184606,
merchantName: '',
setmealContentRules: false,
isConfig: false,
//弹窗
//弹窗2(提示弹窗)
isTipDialogVisible: false,
......@@ -304,7 +305,7 @@ export default {
})
},
submitForm(formName) {
this.$refs.ruleForm.validate(valid => {
this.$refs.ruleForm.validate(async valid => {
if (!valid) {
if (this.choseItemList.length <= 0) {
this.setmealContentRules = true
......@@ -315,42 +316,46 @@ export default {
this.setmealContentRules = true
return
}
if (this.id) {
//需要调config的接口????
// scrm.api.equity.package.service.config
this.configFun()
//调修改的接口
let param = {}
param.id = this.id
param.merchantId = this.merchantId
param.merchantName = this.merchantName
param.packageName = this.ruleForm.packageName
param.packagePrice = this.ruleForm.packagePrice
param.notes = this.ruleForm.notes
param.switchStatus = this.ruleForm.switchStatus ? 1 : 0
let lists = this.choseItemList
for (var k in lists) {
param[`lists[${k}].serviceQuantity`] = lists[k].couponAmount
param[`lists[${k}].serviceId`] = lists[k].id
}
this.sloading = true
updateSetMeal(param)
.then(res => {
this.sloading = false
this.$message({
message: res.code == '0' ? '修改成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.$router.push('/memberCenter/setmeal')
this.configFun().then(result => {
if (!result) {
let param = {}
param.id = this.id
param.merchantId = this.merchantId
param.merchantName = this.merchantName
param.packageName = this.ruleForm.packageName
param.packagePrice = this.ruleForm.packagePrice
param.notes = this.ruleForm.notes
param.switchStatus = this.ruleForm.switchStatus ? 1 : 0
let lists = this.choseItemList
for (var k in lists) {
param[`lists[${k}].serviceQuantity`] = lists[k].couponAmount
param[`lists[${k}].serviceId`] = lists[k].id
}
})
.catch(err => {
this.sloading = false
})
.finally(() => {
this.sloading = false
})
this.sloading = true
updateSetMeal(param)
.then(res => {
this.sloading = false
this.$message({
message: res.code == '0' ? '修改成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.$router.push('/memberCenter/setmeal')
}
})
.catch(err => {
this.sloading = false
})
.finally(() => {
this.sloading = false
})
}
})
} else {
//调创建的接口
let params = {}
......@@ -388,15 +393,25 @@ export default {
})
},
configFun() {
let params = {}
params.id = this.id
let list = this.choseItemList
for (var i in list) {
params[`list[${i}].serviceQuantity`] = list[i].couponAmount
params[`list[${i}].serviceId`] = list[i].id
}
configSetMeal(params).then(res => {
console.log('配置接口', res.data)
return new Promise(resolve => {
let params = {}
params.id = this.id
let list = this.choseItemList
for (var i in list) {
params[`list[${i}].serviceQuantity`] = list[i].couponAmount
params[`list[${i}].serviceId`] = list[i].id
}
configSetMeal(params).then(res => {
if (res.code == -1) {
this.$message({
message: res.message,
type: 'error'
})
resolve(true)
} else {
resolve(false)
}
})
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!