Commit eb8a963c authored by 徐光星's avatar 徐光星

Merge branch 'feat/multiActivity' into 'master'

Feat/multi activity

See merge request !103
parents d3661513 0079a6b9
...@@ -109,5 +109,10 @@ export default { ...@@ -109,5 +109,10 @@ export default {
return http.post(`${config.opapiHost}/kdspOp/api/kdsp/app/app-config-push/listAll`, params, { return http.post(`${config.opapiHost}/kdspOp/api/kdsp/app/app-config-push/listAll`, params, {
accessToken: true accessToken: true
}); });
},
queryTerminalChannelNoForPrevire(params) {
return http.post(`${config.kdspHost}/api/kdsp/activity/activity-goods-special/queryTerminalChannelNo`, params, {
accessToken: true,
});
} }
}; };
\ No newline at end of file
...@@ -76,7 +76,7 @@ export default { ...@@ -76,7 +76,7 @@ export default {
'fetchTenantAuthData' 'fetchTenantAuthData'
]), ]),
select(name) { select(name) {
console.log('select', name); // console.log('select', name);
const current = this.page[name]; const current = this.page[name];
this.$router.push({ this.$router.push({
name: current.path, name: current.path,
...@@ -90,11 +90,11 @@ export default { ...@@ -90,11 +90,11 @@ export default {
}, },
created() { created() {
this.fetchTenantAuthData(); this.fetchTenantAuthData();
console.log('isDashboard', this.$route); // console.log('isDashboard', this.$route);
}, },
watch: { watch: {
$route(to, from) { $route(to, from) {
console.log(to, from); // console.log(to, from);
if (to.path !== from.path && to.path === '/list') { if (to.path !== from.path && to.path === '/list') {
this.activeName = 0; this.activeName = 0;
} }
...@@ -119,7 +119,7 @@ export default { ...@@ -119,7 +119,7 @@ export default {
return ['ivu-menu-dark', 'menu-item', this.isCollapsed ? 'collapsed-menu' : '']; return ['ivu-menu-dark', 'menu-item', this.isCollapsed ? 'collapsed-menu' : ''];
}, },
isDashboard() { isDashboard() {
console.log('isDashboard', this.$route); // console.log('isDashboard', this.$route);
return this.$route.name === 'detail'; return this.$route.name === 'detail';
} }
}, },
......
<template> <template>
<div class="seckillActivityContainer"> <div class="seckillActivityContainer">
<Select v-model="activityInfoId" filterable> <Button style="margin-bottom: 4px" @click="showRules" size="small">规则说明</Button>
<Option v-for="item in list" :value="item.id" :key="item.id">{{ `id ${item.id} - ${item.title}` }}</Option> <div>
</Select> <Button style="margin-bottom: 4px" type="primary" @click="openDialog">填写活动ID</Button>
</div>
<Modal
v-model="showModal"
title="填写活动"
:closable="false"
:mask-closable="false"
>
<Input v-model="cacheId" type="textarea" placeholder="请输入活动ID, 英文逗号分隔" :rows="3" />
<div slot="footer">
<Button @click="cancel">取消</Button>
<Button type="primary" @click="ok">确定</Button>
</div>
</Modal>
<!-- <Input v-model="activityInfoId" type="textarea" placeholder="请输入活动ID, 英文逗号分隔" :rows="3" /> -->
<!-- <Button type="primary" @click="save">保存</Button> --> <!-- <Button type="primary" @click="save">保存</Button> -->
</div> </div>
</template> </template>
...@@ -15,35 +30,109 @@ export default { ...@@ -15,35 +30,109 @@ export default {
default: '' default: ''
} }
}, },
watch: {
activityInfoId(val) {
this.$emit('input', val);
}
},
components: { components: {
}, },
data() { data() {
return { return {
showModal: false,
list: [], list: [],
activityInfoId: '' activityInfoId: '',
cacheId: '',
} }
}, },
created() { created() {
this.activityInfoId = this.value; this.activityInfoId = !this.value || this.value === '0' ? '' : this.value;
this.getActivityList(); this.cacheId = !this.value || this.value === '0' ? '' : this.value;
console.log(this.value) console.log(this.value, typeof this.value)
}, },
methods: { methods: {
async getActivityList() { openDialog() {
const res = await operationApi.getActivityList({ this.cacheId = this.activityInfoId;
templateType: 1, this.showModal = true;
crowdType: [1], },
userType:[] ok() {
}); this.queryTerminalChannelNoForPrevire(this.cacheId.trim())
for (let i = 0; i < res.length; i++) { },
res[i].id = res[i].id.toString(); cancel(){
this.showModal = false;
this.cacheId = '';
},
async queryTerminalChannelNoForPrevire(activityInfoIds) {
// 预览阶段对填入的活动ID进行过滤、校验、排重等操作
try {
if (!activityInfoIds) return;
let params = activityInfoIds.split(',')
params = Array.from(new Set(params));
params.map(item => {
item = item.trim();
})
this.cacheId = params.join(',')
const res = await operationApi.queryTerminalChannelNoForPrevire(params)
console.log('get activity base info = ', res)
if (res) {
// 判断活动类型是否符合当前组件
const invalidArr = res.filter(item => !item.activityTemplateType || (item.activityTemplateType && item.activityTemplateType != 1) )
if (invalidArr.length) {
let ids = '';
invalidArr.map(item => {
ids += `${item.id},`
})
this.$Notice.error({ title: '提示', desc: `以下活动id不符合当前活动类型: ${ids}`});
return;
}
// 判断填入的活动ID是否存在重复的渠道ID的情况
const normalKey = 'common';
const validArr = res.filter(item => item.activityTemplateType && item.activityTemplateType == 1);
const channel2Id = {};
validArr.map(item => {
if (item.kaChannelNo) {
if (channel2Id[item.kaChannelNo]) {
const arr = channel2Id[item.kaChannelNo];
arr.push(item.id);
channel2Id[item.kaChannelNo] = arr;
} else {
channel2Id[item.kaChannelNo] = [item.id]
}
} else {
if (channel2Id[normalKey]) {
const arr = channel2Id[normalKey];
arr.push(item.id);
channel2Id[normalKey] = arr;
} else {
channel2Id[normalKey] = [item.id]
}
}
return item;
})
// 变更为以kaChannel(通用渠道键为common)为键,活动ID集合为值的对象
console.log(channel2Id, 'channel2Id')
for (let i in channel2Id) {
if (channel2Id[i].length > 1) {
this.$Notice.error({ title: '提示', desc: `${i == 'common' ? '通用渠道' : '渠道' + i}存在重复的活动ID: ${channel2Id[i].join(',')}`});
return;
}
}
}
this.showModal = false;
this.activityInfoId = this.cacheId;
this.$emit('input', this.cacheId);
} catch(err) {
console.log(err);
this.showModal = false;
} }
this.list = res; },
showRules() {
this.$Modal.info({
title: '规则说明',
content: `
<p style="width: 100%;word-break: break-all;">1、秒杀活动ID手动填写,多个ID使用英文逗号分隔;</p>
<p style="width: 100%;word-break: break-all;">2、同一个H5渠道仅可以填入一个对应渠道的秒杀活动ID;</p>
<p style="width: 100%;word-break: break-all;">3、预览阶段,默认设置当前渠道为填入第一个且可用活动的所属渠道;</p>
`
})
} }
} }
} }
......
<template> <template>
<div class="snapUpActivityContainer"> <div class="snapUpActivityContainer">
<Select v-model="activityInfoId" filterable> <!-- <Select v-model="activityInfoId" filterable>
<Option v-for="item in list" :value="item.id" :key="item.id">{{ `id ${item.id} - ${item.title}` }}</Option> <Option v-for="item in list" :value="item.id" :key="item.id">{{ `id ${item.id} - ${item.title}` }}</Option>
</Select> </Select> -->
<!-- <Button type="primary" @click="save">保存</Button> --> <Button style="margin-bottom: 4px" @click="showRules" size="small">规则说明</Button>
<div>
<Button style="margin-bottom: 4px" type="primary" @click="openDialog">填写活动ID</Button>
</div>
<Modal
v-model="showModal"
title="填写活动"
:closable="false"
:mask-closable="false"
>
<Input v-model="cacheId" type="textarea" placeholder="请输入活动ID, 英文逗号分隔" :rows="3" />
<div slot="footer">
<Button @click="cancel">取消</Button>
<Button type="primary" @click="ok">确定</Button>
</div>
</Modal>
</div> </div>
</template> </template>
<script> <script>
...@@ -15,35 +31,109 @@ export default { ...@@ -15,35 +31,109 @@ export default {
default: '' default: ''
} }
}, },
watch: {
activityInfoId(val) {
this.$emit('input', val);
}
},
components: { components: {
}, },
data() { data() {
return { return {
showModal: false,
list: [], list: [],
activityInfoId: '' activityInfoId: '',
cacheId: '',
} }
}, },
created() { created() {
this.activityInfoId = this.value; this.activityInfoId = !this.value || this.value === '0' ? '' : this.value;
this.getActivityList(); this.cacheId = !this.value || this.value === '0' ? '' : this.value;
console.log(this.value) console.log(this.value, typeof this.value)
}, },
methods: { methods: {
async getActivityList() { openDialog() {
const res = await operationApi.getActivityList({ this.cacheId = this.activityInfoId;
templateType: 11, this.showModal = true;
crowdType: [1], },
userType:[] ok() {
}); this.queryTerminalChannelNoForPrevire(this.cacheId.trim())
for (let i = 0; i < res.length; i++) { },
res[i].id = res[i].id.toString(); cancel(){
this.showModal = false;
this.cacheId = '';
},
async queryTerminalChannelNoForPrevire(activityInfoIds) {
// 预览阶段对填入的活动ID进行过滤、校验、排重等操作
try {
if (!activityInfoIds) return;
let params = activityInfoIds.split(',')
params = Array.from(new Set(params));
params.map(item => {
item = item.trim();
})
this.cacheId = params.join(',')
const res = await operationApi.queryTerminalChannelNoForPrevire(params)
console.log('get activity base info = ', res)
if (res) {
// 判断活动类型是否符合当前组件
const invalidArr = res.filter(item => !item.activityTemplateType || (item.activityTemplateType && item.activityTemplateType != 11) )
if (invalidArr.length) {
let ids = '';
invalidArr.map(item => {
ids += `${item.id},`
})
this.$Notice.error({ title: '提示', desc: `以下活动id不符合当前活动类型: ${ids}`});
return;
}
// 判断填入的活动ID是否存在重复的渠道ID的情况
const normalKey = 'common';
const validArr = res.filter(item => item.activityTemplateType && item.activityTemplateType == 11);
const channel2Id = {};
validArr.map(item => {
if (item.kaChannelNo) {
if (channel2Id[item.kaChannelNo]) {
const arr = channel2Id[item.kaChannelNo];
arr.push(item.id);
channel2Id[item.kaChannelNo] = arr;
} else {
channel2Id[item.kaChannelNo] = [item.id]
}
} else {
if (channel2Id[normalKey]) {
const arr = channel2Id[normalKey];
arr.push(item.id);
channel2Id[normalKey] = arr;
} else {
channel2Id[normalKey] = [item.id]
}
}
return item;
})
// 变更为以kaChannel(通用渠道键为common)为键,活动ID集合为值的对象
console.log(channel2Id, 'channel2Id')
for (let i in channel2Id) {
if (channel2Id[i].length > 1) {
this.$Notice.error({ title: '提示', desc: `${i == 'common' ? '通用渠道' : '渠道' + i}存在重复的活动ID: ${channel2Id[i].join(',')}`});
return;
}
}
}
this.showModal = false;
this.activityInfoId = this.cacheId;
this.$emit('input', this.cacheId);
} catch(err) {
console.log(err);
this.showModal = false;
} }
this.list = res; },
showRules() {
this.$Modal.info({
title: '规则说明',
content: `
<p style="width: 100%;word-break: break-all;">1、抢购活动ID手动填写,多个ID使用英文逗号分隔;</p>
<p style="width: 100%;word-break: break-all;">2、同一个H5渠道仅可以填入一个对应渠道的抢购活动ID;</p>
<p style="width: 100%;word-break: break-all;">3、预览阶段,默认设置当前渠道为填入第一个且可用活动的所属渠道;</p>
`
})
} }
} }
} }
......
...@@ -73,7 +73,6 @@ export default class GoodsTabsMixin extends Vue { ...@@ -73,7 +73,6 @@ export default class GoodsTabsMixin extends Vue {
let ids: any = []; let ids: any = [];
const batchPickupIndexArr: any[] = []; // 记录一键领取索引值 const batchPickupIndexArr: any[] = []; // 记录一键领取索引值
elements.forEach((item, index) => { elements.forEach((item, index) => {
console.log(item);
if (item.name == 'cs-coupon' && item.props.couponsList && item.props.couponsList.length) { if (item.name == 'cs-coupon' && item.props.couponsList && item.props.couponsList.length) {
ids = ids.concat(item.props.couponsList); ids = ids.concat(item.props.couponsList);
} }
...@@ -102,7 +101,6 @@ export default class GoodsTabsMixin extends Vue { ...@@ -102,7 +101,6 @@ export default class GoodsTabsMixin extends Vue {
} }
} }
}); });
console.log('parseGoodsTabs', goodsTabs);
Object.keys(goodsTabs).forEach(key => { Object.keys(goodsTabs).forEach(key => {
goodsTabs[key].forEach((child, index) => { goodsTabs[key].forEach((child, index) => {
// console.log('parseGoodsTabs', { containerIndex: +key + 1 + index, data: child }); // console.log('parseGoodsTabs', { containerIndex: +key + 1 + index, data: child });
......
...@@ -2176,9 +2176,9 @@ ...@@ -2176,9 +2176,9 @@
} }
}, },
"@qg/citrus-ui": { "@qg/citrus-ui": {
"version": "0.3.64", "version": "0.3.65",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.3.64.tgz", "resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.3.65.tgz",
"integrity": "sha512-+jwT/+7St+ehknceeqE+gq7zybPRTfsFc3ozyHt3t1XnQR+U3SscgcGy3Z78DSvEgmZJ96mD9G/DJTIM6NGfqA==", "integrity": "sha512-UESBwLSObEr6cGJrlcnLeNrt+c2z/dOYAoy4TBIswtVdrbAU5KHRnSv4xV+960mHGSJdIfSgyvaVvXCbiwcHAw==",
"requires": { "requires": {
"@better-scroll/core": "^2.1.1", "@better-scroll/core": "^2.1.1",
"@qg/cherry-ui": "^2.23.9", "@qg/cherry-ui": "^2.23.9",
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"test": "cross-env NODE_ENV=production EGG_SERVER_ENV=sit egg-scripts start --port 80 --workers 1", "test": "cross-env NODE_ENV=production EGG_SERVER_ENV=sit egg-scripts start --port 80 --workers 1",
"stop": "egg-scripts stop", "stop": "egg-scripts stop",
"backend": "nohup egg-scripts start --port 7001 --workers 4", "backend": "nohup egg-scripts start --port 7001 --workers 4",
"dev": "cross-env NODE_ENV=test APOLLO_CLUSTER=k8s NAMESPACE=ds npm run apollo && egg-bin dev -r egg-ts-helper/register --port 7002", "dev": "cross-env NODE_ENV=test APOLLO_CLUSTER=k8s NAMESPACE=yxm2 npm run apollo && egg-bin dev -r egg-ts-helper/register --port 7002",
"debug": "egg-bin debug -r egg-ts-helper/register", "debug": "egg-bin debug -r egg-ts-helper/register",
"apollo": "node bin/apollo.js", "apollo": "node bin/apollo.js",
"build": "npm run tsc && cross-env NODE_ENV=production APOLLO_CLUSTER=3C npm run apollo && cross-env COS_ENV=production easy build --devtool", "build": "npm run tsc && cross-env NODE_ENV=production APOLLO_CLUSTER=3C npm run apollo && cross-env COS_ENV=production easy build --devtool",
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
"@hubcarl/json-typescript-mapper": "^2.0.0", "@hubcarl/json-typescript-mapper": "^2.0.0",
"@qg/apollo-nodejs": "^2.1.2", "@qg/apollo-nodejs": "^2.1.2",
"@qg/cherry-ui": "2.23.10", "@qg/cherry-ui": "2.23.10",
"@qg/citrus-ui": "0.3.64", "@qg/citrus-ui": "0.3.65",
"@riophae/vue-treeselect": "^0.4.0", "@riophae/vue-treeselect": "^0.4.0",
"@types/lodash": "^4.14.117", "@types/lodash": "^4.14.117",
"@types/node": "^10.12.0", "@types/node": "^10.12.0",
......
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