Commit 59a4616e by 李长胜

服务和套餐加上loading

1 parent f0c8cae9
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
width: footerWidth + 'px' width: footerWidth + 'px'
}" }"
> >
<el-button type="primary" @click="submitForm('ruleForm')" size="medium">创建</el-button> <el-button type="primary" @click="submitForm('ruleForm')" size="medium" :loading="sloading">创建</el-button>
<el-button type="primary" @click="goBack" size="medium">取消</el-button> <el-button type="primary" @click="goBack" size="medium">取消</el-button>
</div> </div>
<!-- :hasScroll="false" :noBtnOk="true" :noCancel="true" :noClose="false" --> <!-- :hasScroll="false" :noBtnOk="true" :noCancel="true" :noClose="false" -->
...@@ -166,6 +166,7 @@ export default { ...@@ -166,6 +166,7 @@ export default {
}, 1000) }, 1000)
} }
return { return {
sloading:false,
isDialogVisible:false, isDialogVisible:false,
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate(time) {
...@@ -361,17 +362,24 @@ export default { ...@@ -361,17 +362,24 @@ 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).then(res => { createService(params).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.sloading=false
this.$message.success('创建服务成功') this.$message.success('创建服务成功')
this.$router.push('/memberCenter/service') this.$router.push('/memberCenter/service')
} 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(()=>{
this.sloading=false;
}) })
}, },
//更新服务 //更新服务
...@@ -383,17 +391,24 @@ export default { ...@@ -383,17 +391,24 @@ 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).then(res => { updateService(param).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.sloading=false;
this.$message.success('编辑服务成功') this.$message.success('编辑服务成功')
this.$router.push('/memberCenter/service') this.$router.push('/memberCenter/service')
} 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(()=>{
this.sloading=false;
}) })
}, },
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
width: footerWidth + 'px' width: footerWidth + 'px'
}" }"
> >
<el-button type="primary" @click="submitForm('ruleForm')" size="medium">创建</el-button> <el-button type="primary" @click="submitForm('ruleForm')" size="medium" :loading="sloading">创建</el-button>
<el-button type="primary" @click="goBack" size="medium">取消</el-button> <el-button type="primary" @click="goBack" size="medium">取消</el-button>
</div> </div>
<!-- :modalAppendToBody="false" --> <!-- :modalAppendToBody="false" -->
...@@ -146,6 +146,7 @@ export default { ...@@ -146,6 +146,7 @@ export default {
}, },
data() { data() {
return { return {
sloading:false,
ruleForm: { ruleForm: {
packageName: '', packageName: '',
packagePrice: '', packagePrice: '',
...@@ -343,7 +344,9 @@ export default { ...@@ -343,7 +344,9 @@ export default {
param[`lists[${k}].serviceQuantity`] = lists[k].serviceQuantity param[`lists[${k}].serviceQuantity`] = lists[k].serviceQuantity
param[`lists[${k}].serviceId`] = lists[k].serviceId param[`lists[${k}].serviceId`] = lists[k].serviceId
} }
this.sloading=true
updateSetMeal(param).then(res => { updateSetMeal(param).then(res => {
this.sloading=false
this.$message({ this.$message({
message: res.code == '0' ? '修改成功' : res.message, message: res.code == '0' ? '修改成功' : res.message,
type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
...@@ -351,6 +354,10 @@ export default { ...@@ -351,6 +354,10 @@ export default {
if (res.code == '0') { if (res.code == '0') {
this.$router.push("/memberCenter/setmeal") this.$router.push("/memberCenter/setmeal")
} }
}).catch(err=>{
this.sloading=false
}).finally(()=>{
this.sloading=false
}) })
} else { } else {
//调创建的接口 //调创建的接口
...@@ -367,7 +374,9 @@ export default { ...@@ -367,7 +374,9 @@ export default {
params[`list[${i}].serviceQuantity`] = list[i].serviceQuantity params[`list[${i}].serviceQuantity`] = list[i].serviceQuantity
params[`list[${i}].serviceId`] = list[i].serviceId params[`list[${i}].serviceId`] = list[i].serviceId
} }
this.sloading=true
createSetMeal(params).then(res => { createSetMeal(params).then(res => {
this.sloading=false
this.$message({ this.$message({
message: res.code == '0' ? '创建成功' : res.message, message: res.code == '0' ? '创建成功' : res.message,
type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
...@@ -375,6 +384,10 @@ export default { ...@@ -375,6 +384,10 @@ export default {
if (res.code == '0') { if (res.code == '0') {
this.$router.push("/memberCenter/setmeal") this.$router.push("/memberCenter/setmeal")
} }
}).catch(err=>{
this.sloading=false
}).finally(()=>{
this.sloading=false
}) })
} }
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!