Commit 5ea8bbde by caoyanzhi

fix: 修复虚拟礼品第一次保存失败第二次无法保存bug

parent 22c96393
......@@ -266,9 +266,9 @@ export default {
this.refreshCouponList();
let callbackId = this.$route.query.callbackId;
if(callbackId) {
// 有callbackId参数时,认为入口是福利选择器组件
// 操作完成后需要修改localStorage中的welfareCreateCallback,以触发福利选择器内部数据更新
let obj = JSON.parse(localStorage.getItem('welfareCreateCallback') || '{}');
obj[callbackId] = false;
localStorage.setItem('welfareCreateCallback', JSON.stringify(obj));
obj[callbackId] = true;
localStorage.setItem('welfareCreateCallback', JSON.stringify(obj));
}
......@@ -339,6 +339,8 @@ export default {
this.$store.commit('updateShowCornerCanUseApp', true);
let callbackId = this.$route.query.callbackId;
if(callbackId) {
// 有callbackId参数时,认为入口是福利选择器组件
// 操作完成后需要修改localStorage中的welfareCreateCallback,以触发福利选择器内部数据更新
let obj = JSON.parse(localStorage.getItem('welfareCreateCallback') || '{}');
obj[callbackId] = true;
localStorage.setItem('welfareCreateCallback', JSON.stringify(obj));
......
......@@ -862,6 +862,8 @@ export default {
this.$store.commit('updateShowCornerCanUseApp', true);
let callbackId = this.$route.query.callbackId;
if(callbackId) {
// 有callbackId参数时,认为入口是福利选择器组件
// 操作完成后需要修改localStorage中的welfareCreateCallback,以触发福利选择器内部数据更新
let obj = JSON.parse(localStorage.getItem('welfareCreateCallback') || '{}');
obj[callbackId] = true;
localStorage.setItem('welfareCreateCallback', JSON.stringify(obj));
......
......@@ -1402,18 +1402,16 @@ export default {
}).finally(() => this.$emit('updateLoading', false));
}else{
giftSave(params).then(res =>{
if (res.code === '0000') {
this.$store.commit('updateShowCornerCanUseApp', true);
this.$router.push({ path: '/gift-manage/real-gift' });
} else {
this.$message.error(res.message);
}
let callbackId = this.$route.query.callbackId;
if(callbackId) {
// 有callbackId参数时,认为入口是福利选择器组件
// 操作完成后需要修改localStorage中的welfareCreateCallback,以触发福利选择器内部数据更新
let obj = JSON.parse(localStorage.getItem('welfareCreateCallback') || '{}');
obj[callbackId] = true;
localStorage.setItem('welfareCreateCallback', JSON.stringify(obj));
}
this.$store.commit('updateShowCornerCanUseApp', true);
this.$router.push({ path: '/gift-manage/real-gift' });
}).finally(() => this.$emit('updateLoading', false));
}
}).catch(err=>{
......
......@@ -556,7 +556,6 @@ export default {
},
// 保存
submitForm(goodsForm) {
console.log(goodsForm);
if(this.btnLoading) return;
if (this.image.length === 0) {
this.$message.error('请上传主图');
......@@ -572,7 +571,6 @@ export default {
PublicMethods.jumpToFormError(); // eslint-disable-line
return;
}else{
// this.btnLoading = true;
this.$emit('updateLoading');
let params = {
giftId: this.giftId,
......@@ -601,37 +599,31 @@ export default {
template: this.goodsForm.template,
// template: this.template,
};
this.btnLoading = true;
this.$refs.accg.save().then(res=>{
this.btnLoading = true;
if (this.isEdit) {
// params.giftId = this.giftId;
giftUpdate(params).then(res =>{
if (res.code === '0000') {
this.$router.push({ path: '/gift-manage/virtual-gift' });
this.btnLoading = false;
} else {
this.btnLoading = false;
this.$message.error(res.message);
}
}).finally(() => this.$emit('updateLoading'));
this.$router.push({ path: '/gift-manage/virtual-gift' });
}).finally(() => {
this.btnLoading = false;
this.$emit('updateLoading');
});
}else{
// params.giftId = '';
giftSave(params).then(res =>{
if (res.code === '0000') {
this.$store.commit('updateShowCornerCanUseApp', true);
this.$router.push({ path: '/gift-manage/virtual-gift' });
this.btnLoading = false;
} else {
this.btnLoading = false;
this.$message.error(res.message);
let callbackId = this.$route.query.callbackId;
if(callbackId) {
let obj = JSON.parse(localStorage.getItem('welfareCreateCallback') || '{}');
obj[callbackId] = true;
localStorage.setItem('welfareCreateCallback', JSON.stringify(obj));
}
let callbackId = this.$route.query.callbackId;
if(callbackId) {
// 有callbackId参数时,认为入口是福利选择器组件
// 操作完成后需要修改localStorage中的welfareCreateCallback,以触发福利选择器内部数据更新
let obj = JSON.parse(localStorage.getItem('welfareCreateCallback') || '{}');
obj[callbackId] = true;
localStorage.setItem('welfareCreateCallback', JSON.stringify(obj));
}
}).finally(() => this.$emit('updateLoading'));
this.$store.commit('updateShowCornerCanUseApp', true);
this.$router.push({ path: '/gift-manage/virtual-gift' });
}).finally(() => {
this.$emit('updateLoading');
this.btnLoading = false;
});
}
}).catch(err=>{
this.$message.error(err.message);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment