Commit 07e917d4 by 王志慧

套餐编辑数量限制

1 parent 3763c1bb
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<div class="footer-panel"> <div class="footer-panel">
<div> <div>
<el-button type="primary" @click="submitForm()" size="medium" :loading="sloading">提交</el-button> <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>
</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"> <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 { ...@@ -122,6 +122,7 @@ export default {
merchantId: 44184606, merchantId: 44184606,
merchantName: '', merchantName: '',
setmealContentRules: false, setmealContentRules: false,
isConfig: false,
//弹窗 //弹窗
//弹窗2(提示弹窗) //弹窗2(提示弹窗)
isTipDialogVisible: false, isTipDialogVisible: false,
...@@ -304,7 +305,7 @@ export default { ...@@ -304,7 +305,7 @@ export default {
}) })
}, },
submitForm(formName) { submitForm(formName) {
this.$refs.ruleForm.validate(valid => { this.$refs.ruleForm.validate(async valid => {
if (!valid) { if (!valid) {
if (this.choseItemList.length <= 0) { if (this.choseItemList.length <= 0) {
this.setmealContentRules = true this.setmealContentRules = true
...@@ -315,42 +316,46 @@ export default { ...@@ -315,42 +316,46 @@ export default {
this.setmealContentRules = true this.setmealContentRules = true
return return
} }
if (this.id) { if (this.id) {
//需要调config的接口???? //需要调config的接口????
// scrm.api.equity.package.service.config // scrm.api.equity.package.service.config
this.configFun()
//调修改的接口 //调修改的接口
let param = {} this.configFun().then(result => {
param.id = this.id if (!result) {
param.merchantId = this.merchantId let param = {}
param.merchantName = this.merchantName param.id = this.id
param.packageName = this.ruleForm.packageName param.merchantId = this.merchantId
param.packagePrice = this.ruleForm.packagePrice param.merchantName = this.merchantName
param.notes = this.ruleForm.notes param.packageName = this.ruleForm.packageName
param.switchStatus = this.ruleForm.switchStatus ? 1 : 0 param.packagePrice = this.ruleForm.packagePrice
let lists = this.choseItemList param.notes = this.ruleForm.notes
for (var k in lists) { param.switchStatus = this.ruleForm.switchStatus ? 1 : 0
param[`lists[${k}].serviceQuantity`] = lists[k].couponAmount let lists = this.choseItemList
param[`lists[${k}].serviceId`] = lists[k].id for (var k in lists) {
} param[`lists[${k}].serviceQuantity`] = lists[k].couponAmount
this.sloading = true param[`lists[${k}].serviceId`] = lists[k].id
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.sloading = true
.catch(err => { updateSetMeal(param)
this.sloading = false .then(res => {
}) this.sloading = false
.finally(() => { this.$message({
this.sloading = false 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 { } else {
//调创建的接口 //调创建的接口
let params = {} let params = {}
...@@ -388,15 +393,25 @@ export default { ...@@ -388,15 +393,25 @@ export default {
}) })
}, },
configFun() { configFun() {
let params = {} return new Promise(resolve => {
params.id = this.id let params = {}
let list = this.choseItemList params.id = this.id
for (var i in list) { let list = this.choseItemList
params[`list[${i}].serviceQuantity`] = list[i].couponAmount for (var i in list) {
params[`list[${i}].serviceId`] = list[i].id params[`list[${i}].serviceQuantity`] = list[i].couponAmount
} params[`list[${i}].serviceId`] = list[i].id
configSetMeal(params).then(res => { }
console.log('配置接口', res.data) 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!