Commit 6d2312b6 by crushh

update: 察看

parent 21f34e5b
......@@ -678,4 +678,23 @@ img::after {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.subTitle {
width: 100%;
height: 40px;
display: flex;
box-sizing: border-box;
align-items: center;
margin-bottom: 5px;
.line {
width: 2px;
height: 14px;
background: #2f54eb;
margin-right: 8px;
}
.text {
font-size: 14px;
color: #303133;
width: 100%;
}
}
\ No newline at end of file
......@@ -278,7 +278,7 @@ export const cmhDetail = [
{
path: '/game/cmh/info/:id',
name: '查看拆盲盒',
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/info.vue'),
component: () => import(/* webpackChunkName: "game" */ '../../views/game/cmh/form.vue'),
meta: {
type: 'info'
}
......
......@@ -168,7 +168,6 @@ export default {
show: false,
linkData: {}
},
isEdit: this.$route.meta.type === 'edit',
isAdd: this.$route.meta.type === 'add',
isCopy: this.$route.meta.type === 'copy'
};
......@@ -206,7 +205,6 @@ export default {
templateArr(val) {
this.templateData = val;
const data = val[0];
if (this.isAdd) {
this.baseForm.templateId = data.templateId;
this.handleTemplateArr(data.gameTemplateMaterialList);
......@@ -226,6 +224,9 @@ export default {
}
});
this.selectLink.linkData = this.baseForm.mpUrlView ? JSON.parse(this.baseForm.mpUrlView) : {};
if (this.isCopy) {
this.baseForm.gameTime = [];
}
this.$emit('change', this.baseForm);
}
},
......
......@@ -26,7 +26,7 @@
<img :src="computedImg" />
</div>
</div>
<div class="rightForm">
<div class="rightForm" v-show="!isInfo">
<dm-steps :active="active" simple>
<dm-step title="1.基础配置"></dm-step>
<dm-step title="2.奖项配置"></dm-step>
......@@ -38,6 +38,7 @@
<ruleConfig :gameStatus="gameStatus" :gameTime="gameTime" :shareCard="shareCard" :shareReport="shareReport" :echoData="ruleForm" v-show="active == 2" @nextStep="data => submit(3, data)" @prevStep="step => (active = step)" :btnLoading="btnLoading" />
</div>
</div>
<info :data="echoData" v-show="isInfo" />
</div>
<links :show.sync="linkShow" :obj="linksObj" gameTypeName="幸运盲盒" :isNew="true" :showFooter="true">
<el-button @click="editRenew">重新编辑</el-button>
......@@ -54,7 +55,7 @@ import prizeConfig from './prize-config.vue';
import ruleConfig from './rule-config.vue';
import { getGameTemplateByType, initActivity, getGameDetail, cardView } from '@/service/api/gameApi.js';
import gameTemplate from './gameTemplate';
import info from './info.vue';
import links from '../common/links';
export default {
data() {
......@@ -78,13 +79,15 @@ export default {
isEdit: this.$route.meta.type === 'edit',
isAdd: this.$route.meta.type === 'add',
isCopy: this.$route.meta.type === 'copy',
isInfo: this.$route.meta.type === 'info',
baseForm: {},
prizeForm: {},
ruleForm: {},
gameId: '',
gameStatus: 0,
invalidCard: {},
gameTime: []
gameTime: [],
echoData: {}
};
},
computed: {
......@@ -106,12 +109,12 @@ export default {
gameTemplate,
prizeConfig,
ruleConfig,
links
links,
info
},
mounted() {
this.getGameTemplateByType();
},
watch: {
templateId(val) {
const data = this.templateData.filter(item => item.templateId == val)[0];
......@@ -125,7 +128,8 @@ export default {
getGameDetail(id) {
getGameDetail({ gameId: id }).then(async res => {
const { result } = res;
const {
this.echoData = JSON.parse(JSON.stringify(result));
let {
gameRuleInfo, // 游戏规则信息
gameRuleConditionList, // 游戏规则-参与门槛
gamePrizeList, //游戏奖品信息
......@@ -168,9 +172,21 @@ export default {
const { result } = await cardView({ ids: cardIdArr.join(',') });
this.invalidCard = result; // 1删除 2失效
}
this.ruleForm = { ruleId, filterJson, gameRuleConditionList, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc, memberWeightView, creatorId, filterJsonView };
this.prizeForm = { winChance, prizeNoticeStock, gamePrizeList, prizeNoticeFlag };
if (this.isCopy) {
let invalidCard = [];
gamePrizeList.forEach(item => {
if (item.prizeType == 2 && this.invalidCard[item.prizeRelationId].invalid != 0) {
invalidCard.push(item.prizeRelationId);
}
});
if (invalidCard.length) {
gamePrizeList = gamePrizeList.filter(item => item.prizeType != 2 || !invalidCard.includes(item.prizeRelationId));
this.$message.info('已过滤被删除奖项');
}
}
this.baseForm = { adsFlag, backMusicFlag, bulletFlag, templateId, gameTime: [startDate, endDate], gameName, gameRule, gameExt };
this.prizeForm = { winChance, prizeNoticeStock, gamePrizeList, prizeNoticeFlag };
this.ruleForm = { ruleId, filterJson, gameRuleConditionList, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc, memberWeightView, creatorId, filterJsonView };
});
},
handleBaseConfigChange(data) {
......@@ -224,17 +240,8 @@ export default {
console.log(data);
this.submitData = { ...this.submitData, ...data };
},
async submit(step, data) {
this.submitData = { ...this.submitData, ...data };
console.log(this.submitData);
this.submitData = JSON.parse(JSON.stringify(this.submitData));
const { ruleId, winChance, filterJson, filterJsonView, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, gameRuleConditionList, gameName, gamePrizeList, prizeNoticeStock, prizeNoticeFlag, adsFlag, bulletFlag, backMusicFlag, templateId, gameRule, gameTime, gameExt } = this.submitData;
const gameRuleInfo = { ruleId, winChance, filterJson, filterJsonView, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc: gameName };
gameRuleConditionList.forEach(item => {
delete item.index;
item.conditionJson = JSON.stringify(item.conditionJson);
});
async handleGamePrizeList() {
const { gamePrizeList } = this.submitData;
let cardIdArr = [];
gamePrizeList.forEach(item => {
if (item.prizeType == 2) {
......@@ -260,6 +267,38 @@ export default {
}
});
}
this.submitData = Object.assign({ gamePrizeList }, this.submitData);
},
submit(step, data) {
this.submitData = { ...this.submitData, ...data };
console.log(this.submitData);
this.submitData = JSON.parse(JSON.stringify(this.submitData));
this.handleGamePrizeList();
const { ruleId, winChance, filterJson, filterJsonView, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, gameRuleConditionList, gameName, gamePrizeList, prizeNoticeStock, prizeNoticeFlag, adsFlag, bulletFlag, backMusicFlag, templateId, gameRule, gameTime, gameExt } = this.submitData;
const gameRuleInfo = { ruleId, winChance, filterJson, filterJsonView, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc: gameName };
gameRuleConditionList.forEach(item => {
item.conditionJson = JSON.stringify(item.conditionJson);
});
if (this.isCopy) {
Object.values(gameExt).forEach(item => {
delete item.gameExtId;
delete item.gameId;
});
gamePrizeList.forEach(item => {
delete item.prizeId;
delete item.gameId;
});
gameRuleConditionList.forEach(item => {
if (this.isCopy) {
delete item.conditionId;
delete item.gameId;
}
});
delete gameRuleInfo.ruleId;
delete gameRuleInfo.gameId;
}
this.$confirm('确认发布游戏?', {
type: 'warning'
}).then(() => {
......@@ -304,6 +343,7 @@ export default {
},
editRenew() {
window.location.href = window.location.origin + `/marketing/#/game/cmh/edit/${this.gameId}`;
window.location.reload();
// this.$router.push(`/game/cmh/edit/${this.gameId}`);
}
}
......
......@@ -44,7 +44,7 @@
</div>
</div>
<img class="ad-image" :src="adImg" mode="widthFix" v-id="adImg" />
<img class="ad-image" :src="adImg" mode="widthFix" v-if="adImg" />
<!-- <div class="share-box" @click="clickShareBtn">
<div class="icon">
<div class="iconfont icon-yaoqing"></div>
......
......@@ -129,7 +129,7 @@
</el-table>
<el-button @click="addPrize" class="mb10" size="small" style="border-style: dashed;" v-show="this.prizeForm.gamePrizeList.length < prizeMax"> <i class="iconfont icon-Plus" /> 添加奖项({{ this.prizeForm.gamePrizeList.length }}/{{ prizeMax }}) </el-button>
<el-form-item label="库存提醒" prop="winChance">
<el-form-item label="库存提醒">
<el-switch v-model="prizeForm.prizeNoticeFlag" :active-value="1" :inactive-value="0" />
</el-form-item>
<el-form-item label="库存低于" v-show="prizeForm.prizeNoticeFlag == 1">
......@@ -251,7 +251,11 @@ export default {
if (item.prizeImageUrl) {
item.prizeImageUrl = { imgUrl: item.prizeImageUrl, code: item.prizeImageUrl };
}
item.prizeStockOriginal = item.prizeStock;
if (this.isEdit) {
item.prizeStockOriginal = item.prizeStock;
} else {
item.prizeStock = '';
}
});
this.calculateRate();
this.prizeForm.gamePrizeList = this.prizeForm.gamePrizeList.splice(0);
......
......@@ -224,6 +224,7 @@ export default {
subscribeMsg: { validator: subscribeMsgVal }
},
isAdd: this.$route.meta.type === 'add',
isEdit: this.$route.meta.type === 'edit',
gameDays: 0
};
},
......@@ -267,13 +268,15 @@ export default {
}
});
}
if (memberType == 1) {
this.selectedGroupIds = filterJson;
} else {
this.ruleForm.hasSearchData = filterJson;
if (this.isEdit) {
if (memberType == 1) {
this.selectedGroupIds = filterJson;
} else {
this.ruleForm.hasSearchData = filterJson;
}
this.ruleForm.memberType = memberType;
}
this.ruleForm = Object.assign(this.ruleForm, { ruleId, memberDesc, memberType, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc, memberWeightView, creatorId, filterJsonView });
this.ruleForm = Object.assign(this.ruleForm, { ruleId, memberDesc, playConditionFlag, playTimes, shareFlag, shareImageUrl, shareRuleDesc, memberWeightView, creatorId, filterJsonView });
console.log(this.ruleForm);
},
gameTime(val) {
......@@ -430,25 +433,7 @@ export default {
padding: 16px 20px;
box-sizing: border-box;
}
.subTitle {
width: 100%;
height: 40px;
display: flex;
box-sizing: border-box;
align-items: center;
margin-bottom: 5px;
.line {
width: 2px;
height: 14px;
background: #2f54eb;
margin-right: 8px;
}
.text {
font-size: 14px;
color: #303133;
width: 100%;
}
}
.downloadBtn {
display: flex;
margin-top: 8px;
......
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