Commit 15e660a7 authored by 徐光星's avatar 徐光星

feat: 调整秒杀和抢购组件选择器逻辑

parent 91ca76b1
...@@ -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
<template> <template>
<div class="seckillActivityContainer"> <div class="seckillActivityContainer">
<Select v-model="activityInfoId" filterable> <Button style="margin-bottom: 4px" @click="showRules">规则说明</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,76 @@ export default { ...@@ -15,35 +30,76 @@ 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) {
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.$notify({ type: "warning", message: `非法的活动id: ${ids}` });
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">规则说明</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,76 @@ export default { ...@@ -15,35 +31,76 @@ 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) {
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.$notify({ type: "warning", message: `非法的活动id: ${ids}` });
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>
`
})
} }
} }
} }
......
...@@ -2176,9 +2176,9 @@ ...@@ -2176,9 +2176,9 @@
} }
}, },
"@qg/citrus-ui": { "@qg/citrus-ui": {
"version": "0.3.64", "version": "0.3.65-beta1",
"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-beta1.tgz",
"integrity": "sha512-+jwT/+7St+ehknceeqE+gq7zybPRTfsFc3ozyHt3t1XnQR+U3SscgcGy3Z78DSvEgmZJ96mD9G/DJTIM6NGfqA==", "integrity": "sha512-kFsShJnfX20XnPNEif5AYeA0gSNlf1TGg+r5a2/Is0UWvxy+UBg8/O1+eJKD+kBPmRRuC0dV/UTRhtkUT4gzsQ==",
"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-beta1",
"@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