Commit 8629b68f by caoyanzhi

update: 修复创建活动bug

parent 6c07598d
...@@ -118,6 +118,7 @@ import baseConfig from '@/components/active-config/base-config.vue'; ...@@ -118,6 +118,7 @@ import baseConfig from '@/components/active-config/base-config.vue';
<el-button <el-button
type="primary" type="primary"
@click="submitForm('baseForm')" @click="submitForm('baseForm')"
:loading="loading"
>下一步</el-button> >下一步</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -126,7 +127,6 @@ import baseConfig from '@/components/active-config/base-config.vue'; ...@@ -126,7 +127,6 @@ import baseConfig from '@/components/active-config/base-config.vue';
<script> <script>
import limitInput from '@/components/limit-input.vue'; import limitInput from '@/components/limit-input.vue';
import { getRequest, postRequest } from '@/api/api'; import { getRequest, postRequest } from '@/api/api';
import { _debounce } from '@/common/js/public';
// import showMsg from '@/common/js/showmsg'; // import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error'; import errMsg from '@/common/js/error';
import timeFormat from '@/common/js/timeFormat'; import timeFormat from '@/common/js/timeFormat';
...@@ -161,6 +161,7 @@ export default { ...@@ -161,6 +161,7 @@ export default {
} }
}; };
return { return {
loading: false,
activeInfoData: { activeInfoData: {
activityId: '', activityId: '',
parentGoalId: '', parentGoalId: '',
...@@ -279,7 +280,7 @@ export default { ...@@ -279,7 +280,7 @@ export default {
/** /**
* 下一步 * 下一步
*/ */
submitForm: _debounce(function(formName) { submitForm(formName) {
const that = this; const that = this;
that.$refs[formName].validate(valid => { that.$refs[formName].validate(valid => {
if (valid) { if (valid) {
...@@ -294,7 +295,7 @@ export default { ...@@ -294,7 +295,7 @@ export default {
return false; return false;
} }
}); });
},500), },
postSave() { postSave() {
const that = this; const that = this;
if (!that.activeInfoData.dateRange) { if (!that.activeInfoData.dateRange) {
...@@ -317,6 +318,7 @@ export default { ...@@ -317,6 +318,7 @@ export default {
cardCoupName: that.activeInfoData.cardCoupName, cardCoupName: that.activeInfoData.cardCoupName,
router: that.activeInfoData.router&&that.activeInfoData.router.length?JSON.stringify(that.activeInfoData.router):null router: that.activeInfoData.router&&that.activeInfoData.router.length?JSON.stringify(that.activeInfoData.router):null
}; };
this.loading = true;
postRequest('/sharing-core-web/edit-activity-base-info', para) postRequest('/sharing-core-web/edit-activity-base-info', para)
.then(res => { .then(res => {
let resData = res.data; let resData = res.data;
...@@ -333,6 +335,10 @@ export default { ...@@ -333,6 +335,10 @@ export default {
duration: 2500, duration: 2500,
message: error.message message: error.message
}); });
}).finally(() => {
setTimeout(() => {
this.loading = false;
}, 500)
}); });
}, },
/** /**
......
...@@ -65,6 +65,7 @@ import cardConfig from '@/components/active-config/card-config.vue'; ...@@ -65,6 +65,7 @@ import cardConfig from '@/components/active-config/card-config.vue';
<el-button <el-button
type="primary" type="primary"
@click="submitForm('cardForm')" @click="submitForm('cardForm')"
:loading="loading"
>下一步</el-button> >下一步</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -90,7 +91,6 @@ import limitInput from '@/components/limit-input.vue'; ...@@ -90,7 +91,6 @@ import limitInput from '@/components/limit-input.vue';
import singleUpload from '@/components/single-upload.vue'; import singleUpload from '@/components/single-upload.vue';
// import showMsg from '@/common/js/showmsg'; // import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error'; import errMsg from '@/common/js/error';
import { _debounce } from '@/common/js/public';
import { getRequest, postRequest } from '@/api/api'; import { getRequest, postRequest } from '@/api/api';
export default { export default {
name: 'card-config', name: 'card-config',
...@@ -101,6 +101,7 @@ export default { ...@@ -101,6 +101,7 @@ export default {
}, },
data() { data() {
return { return {
loading: false,
activeInfoData: { activeInfoData: {
appletTitle: '', appletTitle: '',
playBillUrl: '', playBillUrl: '',
...@@ -132,7 +133,7 @@ export default { ...@@ -132,7 +133,7 @@ export default {
/** /**
* 下一步 * 下一步
*/ */
submitForm: _debounce(function(formName) { submitForm(formName) {
const that = this; const that = this;
that.$refs[formName].validate(valid => { that.$refs[formName].validate(valid => {
if (valid) { if (valid) {
...@@ -146,7 +147,7 @@ export default { ...@@ -146,7 +147,7 @@ export default {
return false; return false;
} }
}); });
},500), },
postSave() { postSave() {
const that = this; const that = this;
let para = { let para = {
...@@ -155,6 +156,7 @@ export default { ...@@ -155,6 +156,7 @@ export default {
appletTitle: that.activeInfoData.appletTitle, appletTitle: that.activeInfoData.appletTitle,
fileName: !!that.activeInfoData.fileName? that.activeInfoData.fileName: '' fileName: !!that.activeInfoData.fileName? that.activeInfoData.fileName: ''
}; };
this.loading = true;
postRequest('/sharing-core-web/edit-activity-applet', para) postRequest('/sharing-core-web/edit-activity-applet', para)
.then(res => { .then(res => {
let resData = res.data; let resData = res.data;
...@@ -170,6 +172,10 @@ export default { ...@@ -170,6 +172,10 @@ export default {
duration: 2500, duration: 2500,
message: error.message message: error.message
}); });
}).finally(() => {
setTimeout(() => {
this.loading = false;
}, 500)
}); });
}, },
/** /**
......
...@@ -123,6 +123,7 @@ import centerConfig from '@/components/active-config/center-config.vue'; ...@@ -123,6 +123,7 @@ import centerConfig from '@/components/active-config/center-config.vue';
<el-button <el-button
type="primary" type="primary"
@click="submitForm('centerForm')" @click="submitForm('centerForm')"
:loading="loading"
>下一步</el-button> >下一步</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -173,9 +174,6 @@ import appTemplate from '@/components/active-config/app-template.vue'; ...@@ -173,9 +174,6 @@ import appTemplate from '@/components/active-config/app-template.vue';
// import showMsg from '@/common/js/showmsg'; // import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error'; import errMsg from '@/common/js/error';
import { import {
_debounce
} from '@/common/js/public';
import {
getRequest, getRequest,
postRequest postRequest
} from '@/api/api'; } from '@/api/api';
...@@ -197,6 +195,7 @@ export default { ...@@ -197,6 +195,7 @@ export default {
} }
}; };
return { return {
loading: false,
activeInfoData: { activeInfoData: {
headUrl: '', headUrl: '',
shareBackColor: '#2F54EB', shareBackColor: '#2F54EB',
...@@ -312,7 +311,7 @@ export default { ...@@ -312,7 +311,7 @@ export default {
/** /**
* 下一步 * 下一步
*/ */
submitForm: _debounce(function(formName) { submitForm(formName) {
const that = this; const that = this;
that.$refs[formName].validate(valid => { that.$refs[formName].validate(valid => {
if (valid) { if (valid) {
...@@ -326,7 +325,7 @@ export default { ...@@ -326,7 +325,7 @@ export default {
return false; return false;
} }
}); });
}, 500), },
postSave() { postSave() {
const that = this; const that = this;
let para = { let para = {
...@@ -339,6 +338,7 @@ export default { ...@@ -339,6 +338,7 @@ export default {
activityIntroduceDetail: that.activeInfoData.activityIntroduceMode == 2 ? JSON.stringify(that.activeInfoData.activityIntroduceDetail) : that.activeInfoData.activityIntroduceDetail, activityIntroduceDetail: that.activeInfoData.activityIntroduceMode == 2 ? JSON.stringify(that.activeInfoData.activityIntroduceDetail) : that.activeInfoData.activityIntroduceDetail,
activityIntroduceId: that.activeInfoData.activityIntroduceId activityIntroduceId: that.activeInfoData.activityIntroduceId
}; };
this.loading = true;
postRequest('/sharing-core-web/edit-activity-center', para) postRequest('/sharing-core-web/edit-activity-center', para)
.then(res => { .then(res => {
let resData = res.data; let resData = res.data;
...@@ -354,6 +354,10 @@ export default { ...@@ -354,6 +354,10 @@ export default {
duration: 2500, duration: 2500,
message: error.message message: error.message
}); });
}).finally(() => {
setTimeout(() => {
this.loading = false;
}, 500)
}); });
}, },
/** /**
......
...@@ -155,6 +155,7 @@ import posterConfig from '@/components/active-config/poster-config.vue'; ...@@ -155,6 +155,7 @@ import posterConfig from '@/components/active-config/poster-config.vue';
<el-button <el-button
type="primary" type="primary"
@click="submitForm('posterForm')" @click="submitForm('posterForm')"
:loading="loading"
>下一步</el-button> >下一步</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -194,7 +195,6 @@ import postUpload from '@/components/post-upload.vue'; ...@@ -194,7 +195,6 @@ import postUpload from '@/components/post-upload.vue';
import VueQrcode from '@chenfengyuan/vue-qrcode'; import VueQrcode from '@chenfengyuan/vue-qrcode';
// import showMsg from '@/common/js/showmsg'; // import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error'; import errMsg from '@/common/js/error';
import { _debounce } from '@/common/js/public';
import { getRequest, postRequest } from '@/api/api'; import { getRequest, postRequest } from '@/api/api';
export default { export default {
name: 'poster-config', name: 'poster-config',
...@@ -206,6 +206,7 @@ export default { ...@@ -206,6 +206,7 @@ export default {
}, },
data() { data() {
return { return {
loading: false,
activeInfoData: { activeInfoData: {
playBillUrl: '', playBillUrl: '',
templateType: '1', templateType: '1',
...@@ -269,7 +270,7 @@ export default { ...@@ -269,7 +270,7 @@ export default {
/** /**
* 下一步 * 下一步
*/ */
submitForm: _debounce(function(formName) { submitForm(formName) {
const that = this; const that = this;
that.$refs[formName].validate(valid => { that.$refs[formName].validate(valid => {
...@@ -284,7 +285,7 @@ export default { ...@@ -284,7 +285,7 @@ export default {
return false; return false;
} }
}); });
},500), },
postSave() { postSave() {
const that = this; const that = this;
let para = { let para = {
...@@ -295,6 +296,7 @@ export default { ...@@ -295,6 +296,7 @@ export default {
qrcodeFrontColor: that.activeInfoData.qrcodeFrontColor, qrcodeFrontColor: that.activeInfoData.qrcodeFrontColor,
qrcodePadding: that.activeInfoData.qrcodePadding qrcodePadding: that.activeInfoData.qrcodePadding
}; };
this.loading = true;
postRequest('/sharing-core-web/edit-activity-share', para) postRequest('/sharing-core-web/edit-activity-share', para)
.then(res => { .then(res => {
let resData = res.data; let resData = res.data;
...@@ -310,6 +312,10 @@ export default { ...@@ -310,6 +312,10 @@ export default {
duration: 2500, duration: 2500,
message: error.message message: error.message
}); });
}).finally(() => {
setTimeout(() => {
this.loading = false;
}, 500)
}); });
}, },
/** /**
......
...@@ -322,6 +322,7 @@ import rewardConfig from '@/components/active-config/reward-config.vue'; ...@@ -322,6 +322,7 @@ import rewardConfig from '@/components/active-config/reward-config.vue';
v-if="!$route.query.hasOwnProperty('editFlag')" v-if="!$route.query.hasOwnProperty('editFlag')"
type="primary" type="primary"
@click="submitForm('rewardForm')" @click="submitForm('rewardForm')"
:loading="loading"
> {{$route.query.hasOwnProperty('activityId') ?'确认编辑':'确认新建'}}</el-button> > {{$route.query.hasOwnProperty('activityId') ?'确认编辑':'确认新建'}}</el-button>
<el-button <el-button
v-if="$route.query.hasOwnProperty('editFlag')" v-if="$route.query.hasOwnProperty('editFlag')"
...@@ -340,7 +341,6 @@ import entryAward from '@/components/active-config/configs/entry-award.vue'; ...@@ -340,7 +341,6 @@ import entryAward from '@/components/active-config/configs/entry-award.vue';
import competitionAward from '@/components/active-config/configs/competition-award.vue'; import competitionAward from '@/components/active-config/configs/competition-award.vue';
import inviteeReward from '@/components/active-config/configs/invitee-reward.vue'; import inviteeReward from '@/components/active-config/configs/invitee-reward.vue';
import fraudControl from '@/components/active-config/configs/fraud-control.vue'; import fraudControl from '@/components/active-config/configs/fraud-control.vue';
import { _debounce } from '@/common/js/public';
import showMsg from '@/common/js/showmsg'; import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error'; import errMsg from '@/common/js/error';
...@@ -358,6 +358,7 @@ export default { ...@@ -358,6 +358,7 @@ export default {
}, },
data() { data() {
return { return {
loading: false,
basePath: [], basePath: [],
stepObj: { stepObj: {
'服务号关注': 1 ,// 1服务号关注,2活动营销页访问奖励,3会员认证奖励,4游戏参与奖励,5卡券领取奖励6,消费奖励 '服务号关注': 1 ,// 1服务号关注,2活动营销页访问奖励,3会员认证奖励,4游戏参与奖励,5卡券领取奖励6,消费奖励
...@@ -1390,7 +1391,7 @@ export default { ...@@ -1390,7 +1391,7 @@ export default {
/** /**
* 下一步 * 下一步
*/ */
submitForm: _debounce(function(formName) { submitForm(formName) {
const that = this; const that = this;
that.$refs[formName].validate(valid => { that.$refs[formName].validate(valid => {
if (valid) { if (valid) {
...@@ -1399,6 +1400,7 @@ export default { ...@@ -1399,6 +1400,7 @@ export default {
that.$router.push(`/shareIndex`); that.$router.push(`/shareIndex`);
return false return false
} }
this.loading = true;
if (that.activeInfoData.awardMode == 1) { if (that.activeInfoData.awardMode == 1) {
that.singleCheck(); // 判断单次 that.singleCheck(); // 判断单次
} else { } else {
...@@ -1408,37 +1410,43 @@ export default { ...@@ -1408,37 +1410,43 @@ export default {
return false; return false;
} }
}); });
}, 500), },
async singleCheck() { async singleCheck() {
const that = this; const that = this;
const flag = that.basePath.map(ele => ele.transName).includes('消费') ? await that.$refs.singleConsume.submitForm() : true; const flag = that.basePath.map(ele => ele.transName).includes('消费') ? await that.$refs.singleConsume.submitForm() : true;
if (flag.hasOwnProperty('flag')&& !flag.flag) { if (flag.hasOwnProperty('flag')&& !flag.flag) {
showMsg.showmsg(flag.msg, 'warning'); showMsg.showmsg(flag.msg, 'warning');
this.loading = false;
return false; return false;
} }
const spot = that.activeInfoData.instantAwardFlag == 1 ? await that.$refs.singleSpot.submitForm() : true; const spot = that.activeInfoData.instantAwardFlag == 1 ? await that.$refs.singleSpot.submitForm() : true;
if (spot.hasOwnProperty('flag')&& !spot.flag) { if (spot.hasOwnProperty('flag')&& !spot.flag) {
showMsg.showmsg(spot.msg, 'warning'); showMsg.showmsg(spot.msg, 'warning');
this.loading = false;
return false; return false;
} }
const entry = that.activeInfoData.passAwardFlag == 1 ? await that.$refs.singleEntry.submitForm() : true; const entry = that.activeInfoData.passAwardFlag == 1 ? await that.$refs.singleEntry.submitForm() : true;
if (entry.hasOwnProperty('flag')&& !entry.flag) { if (entry.hasOwnProperty('flag')&& !entry.flag) {
showMsg.showmsg(entry.msg, 'warning'); showMsg.showmsg(entry.msg, 'warning');
this.loading = false;
return false; return false;
} }
const competition = that.activeInfoData.competitionAwardFlag == 1 ? await that.$refs.singleCompetition.submitForm() : true; const competition = that.activeInfoData.competitionAwardFlag == 1 ? await that.$refs.singleCompetition.submitForm() : true;
if (competition.hasOwnProperty('flag')&& !competition.flag) { if (competition.hasOwnProperty('flag')&& !competition.flag) {
showMsg.showmsg(competition.msg, 'warning'); showMsg.showmsg(competition.msg, 'warning');
this.loading = false;
return false; return false;
} }
const invitee = await that.$refs.singleInvitee.submitForm(); const invitee = await that.$refs.singleInvitee.submitForm();
if (invitee.hasOwnProperty('flag')&& !invitee.flag) { if (invitee.hasOwnProperty('flag')&& !invitee.flag) {
showMsg.showmsg(invitee.msg, 'warning'); showMsg.showmsg(invitee.msg, 'warning');
this.loading = false;
return false; return false;
} }
const freeze = that.basePath.map(ele => ele.transName).includes('消费') ? await that.$refs.singleFreeze.submitForm() : true; const freeze = that.basePath.map(ele => ele.transName).includes('消费') ? await that.$refs.singleFreeze.submitForm() : true;
if (freeze.hasOwnProperty('flag')&& !freeze.flag) { if (freeze.hasOwnProperty('flag')&& !freeze.flag) {
showMsg.showmsg(freeze.msg, 'warning'); showMsg.showmsg(freeze.msg, 'warning');
this.loading = false;
return false; return false;
} }
// console.log('单次数据', that.activeInfoData); // console.log('单次数据', that.activeInfoData);
...@@ -1626,6 +1634,7 @@ export default { ...@@ -1626,6 +1634,7 @@ export default {
} }
if (flag.hasOwnProperty('flag')&& !flag.flag) { if (flag.hasOwnProperty('flag')&& !flag.flag) {
showMsg.showmsg(flag.msg, 'warning'); showMsg.showmsg(flag.msg, 'warning');
this.loading = false;
return false; return false;
} }
let spot = true; let spot = true;
...@@ -1640,6 +1649,7 @@ export default { ...@@ -1640,6 +1649,7 @@ export default {
} }
if (spot.hasOwnProperty('flag')&& !spot.flag) { if (spot.hasOwnProperty('flag')&& !spot.flag) {
showMsg.showmsg(spot.msg, 'warning'); showMsg.showmsg(spot.msg, 'warning');
this.loading = false;
return false; return false;
} }
let entry = true; let entry = true;
...@@ -1653,6 +1663,7 @@ export default { ...@@ -1653,6 +1663,7 @@ export default {
} }
if (entry.hasOwnProperty('flag')&& !entry.flag) { if (entry.hasOwnProperty('flag')&& !entry.flag) {
showMsg.showmsg(entry.msg, 'warning'); showMsg.showmsg(entry.msg, 'warning');
this.loading = false;
return false; return false;
} }
let competition = true; let competition = true;
...@@ -1666,6 +1677,7 @@ export default { ...@@ -1666,6 +1677,7 @@ export default {
} }
if (competition.hasOwnProperty('flag')&& !competition.flag) { if (competition.hasOwnProperty('flag')&& !competition.flag) {
showMsg.showmsg(competition.msg, 'warning'); showMsg.showmsg(competition.msg, 'warning');
this.loading = false;
return false; return false;
} }
let invitee = true; let invitee = true;
...@@ -1679,6 +1691,7 @@ export default { ...@@ -1679,6 +1691,7 @@ export default {
} }
if (invitee.hasOwnProperty('flag')&& !invitee.flag) { if (invitee.hasOwnProperty('flag')&& !invitee.flag) {
showMsg.showmsg(invitee.msg, 'warning'); showMsg.showmsg(invitee.msg, 'warning');
this.loading = false;
return false; return false;
} }
let freeze = true; let freeze = true;
...@@ -1692,6 +1705,7 @@ export default { ...@@ -1692,6 +1705,7 @@ export default {
} }
if (freeze.hasOwnProperty('flag')&& !freeze.flag) { if (freeze.hasOwnProperty('flag')&& !freeze.flag) {
showMsg.showmsg(freeze.msg, 'warning'); showMsg.showmsg(freeze.msg, 'warning');
this.loading = false;
return false; return false;
} }
// true--->1; false--->0 // true--->1; false--->0
...@@ -1759,6 +1773,10 @@ export default { ...@@ -1759,6 +1773,10 @@ export default {
duration: 2500, duration: 2500,
message: error.message message: error.message
}); });
}).finally(() => {
setTimeout(() => {
this.loading = false;
}, 500)
}); });
}, },
/** /**
......
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