Commit 327b3cb4 by crushh

update: 活动

parent 34c36b5f
......@@ -23,7 +23,7 @@ i {
font-size:14px;
}
p {
color: $primary-font-color;
// color: $primary-font-color;
}
a {
color: #2f54eb;
......
......@@ -21,14 +21,8 @@
<div class="member-group">
<div class="left">
<el-tabs v-model="activeName">
<el-tab-pane label="我的客户分组" name="0" v-if="!onlyFixedType">
<dm-table ref="table0" name="0" :creatorId="creatorId" :effectiveStatus="effectiveStatus" :key="visiable" :realTimeType="realTimeType" :activeName="activeName" :selected="selectedArray" @handleSelectionChange="handleSelectionChange" @deleteRow="deleteRow" />
</el-tab-pane>
<el-tab-pane label="固化分组" name="1">
<dm-table ref="table1" name="1" :creatorId="creatorId" :effectiveStatus="effectiveStatus" :key="visiable" :realTimeType="realTimeType" :activeName="activeName" :selected="selectedArray" @handleSelectionChange="handleSelectionChange" @deleteRow="deleteRow" />
</el-tab-pane>
<el-tab-pane label="金字塔会员分层" name="2" v-if="!onlyFixedType">
<dm-table ref="table2" name="2" :creatorId="creatorId" :effectiveStatus="effectiveStatus" :key="visiable" :realTimeType="realTimeType" :activeName="activeName" :selected="selectedArray" @handleSelectionChange="handleSelectionChange" @deleteRow="deleteRow" />
<el-tab-pane :label="item.label" v-for="item in options" :name="item.name" :key="item.name">
<dm-table :ref="`table${item.name}`" :name="item.name" :creatorId="creatorId" :key="visiable" :realTimeType="realTimeType" :activeName="activeName" :selected="selectedArray" @handleSelectionChange="handleSelectionChange" @deleteRow="deleteRow" />
</el-tab-pane>
</el-tabs>
</div>
......@@ -85,10 +79,10 @@ export default {
type: Number,
default: 5
},
onlyFixedType: {
// 仅展示固化分组
type: Boolean,
default: false
showTabs: {
// 展示哪些tab
type: Array,
default: () => [1, 2, 3]
},
realTimeType: {
// 实时与非实时分组的可选
......@@ -106,10 +100,38 @@ export default {
},
data() {
return {
activeName: '0', //0 我的客户分组 1固化分组 2金字塔会员分层
activeName: 0, //0 我的客户分组 1固化分组 2金字塔会员分层
baseUrl,
echoFlag: false,
selected: {}
selected: {},
optionsVal: [
{
name: 0,
label: '我的客户分组'
},
{
name: 1,
label: '固化分组'
},
{
name: 2,
label: '金字塔会员分层'
}
],
options: [
{
name: 0,
label: '我的客户分组'
},
{
name: 1,
label: '固化分组'
},
{
name: 2,
label: '金字塔会员分层'
}
]
};
},
mounted() {
......@@ -118,9 +140,6 @@ export default {
this.$refs[`table${this.activeName}`] && this.$refs[`table${this.activeName}`].getGroupList();
}
});
if (this.onlyFixedType) {
this.activeName = '1';
}
},
computed: {
selectedArray() {
......@@ -145,6 +164,14 @@ export default {
if (val && this.selectedIds) {
this.getDefaultSelected(this.selectedIds);
}
},
showTabs(val) {
console.log(val);
let arr = this.optionsVal;
if (val && val.length) {
arr = this.optionsVal.filter(item => val.includes(item.name));
}
this.options = arr;
}
},
methods: {
......@@ -207,9 +234,11 @@ export default {
this.selected = obj;
},
deleteRow(row) {
console.log(this.activeName);
console.log(this.$refs);
delete this.selected[row.memberTagGroupId];
this.selected = Object.assign({}, this.selected);
this.$refs[`table${this.activeName}`].$refs.table.toggleRowSelection(row, false);
this.$refs[`table${this.activeName}`][0].$refs.table.toggleRowSelection(row, false);
}
}
};
......
......@@ -7,7 +7,7 @@
| projectName | 项目名称 | String | 'memberTag' | 否 |
| creatorId |创建人id | String | '' | 是 |
| maxLimit | 最大可选择分组个数 | Number | 5 | 否 |
| onlyFixedType | 仅展示固化分组 | Boolean | false | 否 |
| showTabs | 展示那些tab 1:我的客户分组,2:固化分组,3:金字塔会员分层 | Array | [1,2,3] | 否 |
| onlyRead | 是否只读 | Boolean | false | 否 |
| realTimeType | 实时与非实时分组的可选 [0:可选非实时分组 1:可选实时分组 ]| Array | [] | 否 |
......
......@@ -70,8 +70,8 @@ export default {
type: Number
},
name: {
type: String,
default: '0'
type: [String, Number],
default: 0
}
},
data() {
......@@ -171,16 +171,10 @@ export default {
.get(url)
.then(res => {
if (res.data.errorCode == 1) {
// if (this.activeName == '2') {
// this.tableData = res.data.result.result.map(item => item.itemList);
// console.log(this.tableData);
// this.tableData = this.tableData.flat();
// console.log(this.tableData);
// } else {
// this.tableData = res.data.result.result;
// }
res.data.result.result.forEach(item => (item.activeName = this.activeName));
this.tableData = res.data.result.result;
this.totalCount = res.data.result.totalCount;
console.log(this.tableData);
return;
}
this.$message.error({
......
......@@ -124,7 +124,6 @@ export default {
}
},
hideId(val) {
console.log(val);
if (val && val.length) {
this.conditionTypeList.filter(item => val.includes(item.esScreeningWidgetChainId)).forEach(item => (item.disable = true));
} else {
......
......@@ -70,3 +70,6 @@ export const getMemberCrowd = params => requests('/api-plug/query-member-crowd-n
// 活动转化数据
export const getPlanStatistics = params => requests('/api-marketing/statistics/plan-statistics', params, true, false, 'get');
//ai营销单价
export const getAiCalcSingle = params => requests(PREFIX + '/ai-calc-single', params, true, false, 'get');
......@@ -5,7 +5,6 @@
<div class="section">
<el-form-item label="活动场景">
{{ form.scene | sceneFilter }}
<el-button type="text" @click="openTutorial" v-if="form.scene == 3">操作教程</el-button>
</el-form-item>
<el-form-item label="活动名称" prop="activityName">
......@@ -39,7 +38,7 @@
</div>
</el-form-item>
<el-form-item>
<gic-new-member-group v-show="form.memberType == 1" :visiable.sync="groupVisible" :selectedIds="selectedGroupIds" @change="confirmGroupDialog" />
<gic-new-member-group v-show="form.memberType == 1" :visiable.sync="groupVisible" :showTabs="showTabs" :selectedIds="selectedGroupIds" @change="confirmGroupDialog" />
</el-form-item>
<el-form-item label="消费条件" v-if="form.scene == 4 && form.memberType == 0">
......@@ -61,15 +60,15 @@
</el-form-item>
<el-form-item label="消费条件" v-if="form.scene == 4 && form.memberType == 1">
<div class="consumeLine">
<el-checkbox v-model="form.consume_days_flag1" @change="getMemberCount" :true-label="1" :false-label="0">最近消费间隔</el-checkbox>
<el-checkbox v-model="form.consume_days_flag1" @change="getMemberCount" :true-label="1" :false-label="0" :disabled="disabledCheck">最近消费间隔</el-checkbox>
<el-input-number v-model="form.consume_days1" @change="handleChangeNum(form.consume_days_flag1)" controls-position="right" :max="730" :precision="0" :min="30" size="small" style="margin:0 10px;" />
</div>
<div class="consumeLine">
<el-checkbox v-model="form.consume_times_flag1" @change="getMemberCount" :true-label="1" :false-label="0">有效消费次数</el-checkbox>
<el-checkbox v-model="form.consume_times_flag1" @change="getMemberCount" :true-label="1" :false-label="0" :disabled="disabledCheck">有效消费次数</el-checkbox>
<el-input-number v-model="form.consume_times1" @change="handleChangeNum(form.consume_times_flag1)" controls-position="right" :max="100" :precision="0" :min="1" size="small" style="margin:0 10px;" />
</div>
<div class="consumeLine">
<el-checkbox v-model="form.consume_amount_flag1" @change="getMemberCount" :true-label="1" :false-label="0">累计消费金额</el-checkbox>
<el-checkbox v-model="form.consume_amount_flag1" @change="getMemberCount" :true-label="1" :false-label="0" :disabled="disabledCheck">累计消费金额</el-checkbox>
<el-input-number v-model="form.consume_amount1" @change="handleChangeNum(form.consume_amount1)" controls-position="right" :max="100000" :precision="0" :min="1" size="small" style="margin:0 10px;" />
</div>
</el-form-item>
......@@ -254,7 +253,7 @@
</div>
</div>
<dm-form-bottom>
<el-button type="primary" @click="submit" :loading="btnLoading">保 存</el-button>
<el-button type="primary" @click="handleSubmit" :loading="btnLoading">保 存</el-button>
<el-button @click="$router.go(-1)">返 回</el-button>
</dm-form-bottom>
</el-form>
......@@ -276,7 +275,7 @@
<script>
import filterAvater from '@/mixins/filterAvater.js';
import { templateList, aiDictList, initActivity, getActivityDetail, getMemberCount } from '@/service/api/aiApi.js';
import { templateList, aiDictList, initActivity, getActivityDetail, getMemberCount, getAiCalcSingle, rechargeCenter } from '@/service/api/aiApi.js';
import birthSense from '@/views/ai/task/components/birthActiveTime.vue';
import holidaySense from '@/views/ai/task/components/holidayActiveTime.vue';
import LibMessage from '@/views/ecm/marketing-event/components/lib-message.vue';
......@@ -418,11 +417,15 @@ export default {
timesOptions: [1, 2, 3, 4, 5], //重播次数下拉
loading: false,
currentIndex: 0,
selectedGroup: [], //被选中的客户分组
selectedGroupIds: '', // 被选中的客户分组id
memberCrowdWidgetId: null, // 被选的规则id
filterFrontShow: [], // 筛选器回显数据
hideIdVal: ['0f1c75e854ed4b05bd6baa2a757c1701'],
btnLoading: false
btnLoading: false,
isWhite: false, //是白名单
unitPrice: '', // 单价
money: '' //账户余额
};
},
computed: {
......@@ -433,8 +436,20 @@ export default {
return [];
}
},
showTabs() {
if (this.form.consume_days_flag1 || this.form.consume_times_flag1 || this.form.consume_amount_flag1) {
return [0, 1]; // 隐藏 金字塔分层
} else {
return [0, 1, 2];
}
},
disabledCheck() {
return this.filterFrontShow.find(item => this.hideIdVal.includes(item.esScreeningWidgetChainId));
if (this.form.memberType == 0) {
return this.filterFrontShow.find(item => this.hideIdVal.includes(item.esScreeningWidgetChainId));
} else {
console.log(this.selectedGroup);
return this.selectedGroup.find(item => item.activeName == 2);
}
},
selectedTag() {
let arr = [];
......@@ -466,6 +481,7 @@ export default {
this.form.smsFlag = 1;
this.form.analyseFlag = 0;
}
this.getAiCalcSingle();
},
components: {
birthSense,
......@@ -581,7 +597,7 @@ export default {
this.loading = false;
}
},
async submit() {
async handleSubmit() {
const activeTimeData = await this.$refs[`activeTime${[1, 2].includes(this.form.scene) ? this.form.scene : ''}`].submit();
console.log(activeTimeData);
if (!activeTimeData) return;
......@@ -600,7 +616,6 @@ export default {
this.$refs.form.validate(async (val, obj) => {
console.log(val, obj);
if (val) {
this.btnLoading = true;
const { activityName, scene, analyseFlag, analyseDays, analyseAmount, planName, memberType, aiTemplateId, labelFlag, smsFlag, recallFlag, activityId, planId, aiEventId, eventId, planMemberCount } = this.form;
let sceneJson = {};
if (scene == 1) {
......@@ -680,21 +695,39 @@ export default {
delete data.activityPlanList[0].activityEventList[0].planId;
delete data.activityPlanList[0].activityEventList[0].aiEventId;
}
try {
const { result } = await initActivity(data);
if (result) {
this.$message.success('保存成功');
this.$route.meta.refresh = true;
this.$router.go(-1);
}
} finally {
this.btnLoading = false;
const { result } = await rechargeCenter();
this.money = result.account.balance;
if (this.isWhite || planMemberCount * this.unitPrice < this.money) {
this.$confirm(`本次外呼费用预计需要消费 ${planMemberCount * this.unitPrice} 元,是否继续创建?`, '提示').then(() => {
this.submit();
});
} else {
this.$confirm(`本次外呼费用预计需要消费 ${planMemberCount * this.unitPrice}元,当前账户余额不足,请充值`, '提示', {
confirmButtonText: '去充值',
cancelButtonText: '取消',
type: 'info'
}).then(() => {
window.open(`${window.location.origin}/marketing/#/recharge/do`, '_blank');
});
}
} else {
this.scrollToError(this);
}
});
},
async submit(data) {
try {
this.btnLoading = true;
const { result } = await initActivity(data);
if (result) {
this.$message.success('保存成功');
this.$route.meta.refresh = true;
this.$router.go(-1);
}
} finally {
this.btnLoading = false;
}
},
async getMemberCount() {
const activeTimeData = await this.$refs[`activeTime${[1, 2].includes(this.form.scene) ? this.form.scene : ''}`].submit();
if (!activeTimeData) return;
......@@ -742,6 +775,13 @@ export default {
const { result } = await getMemberCount(data);
this.form.planMemberCount = result == -1 ? 0 : result;
},
async getAiCalcSingle() {
const { result } = await getAiCalcSingle();
if (!result) return;
this.isWhite = result.white;
this.unitPrice = (result.unit / 1000).toFixed(2);
},
handleChangeNum: _debounce(function(val) {
val && this.getMemberCount();
}, 600),
......@@ -766,6 +806,7 @@ export default {
},
/**客户分组 */
confirmGroupDialog(arr, idStr) {
this.selectedGroup = arr;
this.selectedGroupIds = idStr;
this.$refs.form.clearValidate('memberType');
this.getMemberCount();
......
......@@ -36,13 +36,13 @@
</el-form>
</div>
<el-table :data="tableData" style="width:100%" v-loading="loading">
<el-table-column prop="activityName" label="活动名称" show-overflow-tooltip />
<el-table-column prop="scene" label="活动场景" show-overflow-tooltip>
<el-table-column prop="activityName" label="活动名称" show-overflow-tooltip width="200px" />
<el-table-column prop="scene" label="活动场景" show-overflow-tooltip width="120px">
<template slot-scope="{ row }">
{{ row.scene | sceneFilter }}
</template>
</el-table-column>
<el-table-column prop="aiTemplateName" label="话术名称" show-overflow-tooltip />
<el-table-column prop="aiTemplateName" label="话术名称" show-overflow-tooltip width="180px" />
<el-table-column prop="seatSum" label="坐席数" show-overflow-tooltip />
<el-table-column prop="smsFlag" label="挂机短信" show-overflow-tooltip>
<template slot-scope="{ row }">
......@@ -457,7 +457,7 @@ export default {
.cardList {
display: flex;
.card {
width: 224px;
width: 20%;
height: 140px;
background: #f0f3fd;
border-radius: 4px;
......
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