Commit 68569930 by Jaxon

Merge branch 'SAAS+V5.8.3-cwq' of http://192.168.3.233:8090/saas_plus/dj-car-lif…

…e-system into feature/marketing-sop-push-strategy
2 parents c65a3a9b 347348c7
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
tableHeadItems: { tableHeadItems: {
type: Array, type: Array,
default: () => { default: () => {
return this.tablecolumnList.map(item => item.label); return ["门店名称", "门店地址", "门店商户号", "服务对接", "服务对接商户号"];
}, },
}, },
}, },
......
...@@ -15,26 +15,69 @@ function flattenConditions(conditionGroups) { ...@@ -15,26 +15,69 @@ function flattenConditions(conditionGroups) {
}, []); }, []);
} }
function parseMaterials(materialJson) { function parseList(value) {
if (!materialJson) if (!value)
return [];
try {
const list = JSON.parse(materialJson);
if (!Array.isArray(list))
return [];
const typeMap = {
image: "图片",
video: "视频",
};
return list
.filter(item => item && item.url)
.map(item => ({
typeName: typeMap[item.type] || item.type || "素材",
url: item.url,
}));
} catch (e) {
return []; return [];
return String(value)
.split(",")
.map(item => item.trim())
.filter(Boolean);
}
function normalizeMediaIds(mediaIds, type) {
return parseList(mediaIds)
.map((item) => {
return {
type,
url: item,
name: "",
};
})
.filter(item => item.url)
.slice(0, 9);
}
function getActionTitle(action) {
return action.actionTypeName === "发送消息" ? "向客户群发送消息" : getValue(action.actionTypeName);
}
function getActionRows(action) {
const rows = [
{ label: "目标群", value: "目标客户所在群" },
{ label: "消息类型", value: getValue(action.messageTypeName) },
];
if (Number(action.messageType) === 1) {
rows.push({ label: "消息内容", value: getValue(action.content) });
}
return rows;
}
function getActionMediaList(action) {
if (Number(action.messageType) === 2) {
return normalizeMediaIds(action.mediaIds, "image");
}
if (Number(action.messageType) === 3) {
return normalizeMediaIds(action.mediaIds, "video");
} }
return [];
}
function getActionLink(action) {
if (Number(action.messageType) !== 4)
return null;
return {
label: "消息内容",
value: getValue(action.jumpUrl),
};
}
function maskPhone(phone) {
if (!phone)
return "-";
const str = String(phone);
return str.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
} }
export function getBasicRows(info = {}) { export function getBasicRows(info = {}) {
...@@ -52,21 +95,19 @@ export function getCustomerRows(info = {}) { ...@@ -52,21 +95,19 @@ export function getCustomerRows(info = {}) {
return [ return [
{ label: "所属门店", value: getValue(customerInfo.storeName) }, { label: "所属门店", value: getValue(customerInfo.storeName) },
{ label: "客户名称", value: getValue(customerInfo.customerName) }, { label: "客户名称", value: getValue(customerInfo.customerName) },
{ label: "客户手机号", value: getValue(customerInfo.customerPhone) }, { label: "客户手机号", value: maskPhone(customerInfo.customerPhone) },
]; ];
} }
export function getTriggerRows(info = {}) { export function getTriggerRows(info = {}) {
const triggerInfo = info.triggerInfo || {}; const triggerInfo = info.triggerInfo || {};
const conditionText = flattenConditions(triggerInfo.step2ConditionGroups).join(";");
const rows = [ const rows = [
{ label: "触发类型", value: getValue(triggerInfo.triggerTypeName) }, { label: "触发类型", value: getValue(triggerInfo.triggerTypeName) },
{ label: "日期时间变量", value: "客户新车交付日期" },
{ label: "实际触发时间", value: getValue(triggerInfo.triggerTimeDesc) }, { label: "实际触发时间", value: getValue(triggerInfo.triggerTimeDesc) },
{ label: "同时满足以下条件", value: conditionText },
]; ];
const conditionText = flattenConditions(triggerInfo.step2ConditionGroups).join(";");
if (conditionText) {
rows.push({ label: "同时满足以下条件", value: conditionText });
}
rows.push({ label: "动作执行确认", value: getValue(triggerInfo.actionConfirmDesc) });
return rows; return rows;
} }
...@@ -78,27 +119,13 @@ export function getBranchBlocks(info = {}) { ...@@ -78,27 +119,13 @@ export function getBranchBlocks(info = {}) {
return { return {
name: branch.branchName || `分支${branchIndex + 1}`, name: branch.branchName || `分支${branchIndex + 1}`,
conditionText, conditionText,
actions: actions.map((action, actionIndex) => { actions: actions.map((action, actionIndex) => ({
const actionTitle = action.actionTypeName === "发送消息" ? "向客户群发送消息" : getValue(action.actionTypeName); name: `动作${actionIndex + 1}`,
// messageType:1-文本-content,2-图片-medals,3-视频-medals,4-网页-jumpUrl title: getActionTitle(action),
const attrObj = { rows: getActionRows(action),
1: "content", mediaList: getActionMediaList(action),
2: "mediaIds", link: getActionLink(action),
3: "mediaIds", })),
4: "jumpUrl",
};
const rows = [
{ label: "目标群", value: "目标客户所在群" },
{ label: "消息类型", value: getValue(action.messageTypeName) },
{ label: "消息内容", value: getValue(action[attrObj[action.messageType]]) },
];
return {
name: `动作${actionIndex + 1}`,
title: actionTitle,
rows,
materials: parseMaterials(action.materialJson),
};
}),
}; };
}); });
} }
<!-- 策略详情弹窗 --> <!-- 策略详情弹窗 -->
<template> <template>
<div> <div>
<d2-dialog btn-ok-label="确定" <d2-dialog btn-ok-label="关闭"
class="detail" class="detail"
width="70%" width="70%"
:is-visible.sync="detailVisible" :is-visible.sync="detailVisible"
:no-cancel="true"
:title="title" :title="title"
@closeDialog="handleDetailClose" @closeDialog="handleDetailClose"
@confirmDialog="handleDetailConfirm"> @confirmDialog="handleDetailConfirm">
...@@ -51,7 +52,7 @@ ...@@ -51,7 +52,7 @@
<span>执行动作</span> <span>执行动作</span>
</div> </div>
<div class="detail-section-body"> <div class="detail-section-body">
<div>动作执行确认:{{ info.triggerInfo.actionConfirmDesc }}</div> <div>动作执行确认:{{ info.triggerInfo && info.triggerInfo.actionConfirmDesc }}</div>
<div>默认执行第一条满足条件规则的分支</div> <div>默认执行第一条满足条件规则的分支</div>
<template v-if="branchBlocks.length"> <template v-if="branchBlocks.length">
<div v-for="(branch, branchIndex) in branchBlocks" <div v-for="(branch, branchIndex) in branchBlocks"
...@@ -70,6 +71,42 @@ ...@@ -70,6 +71,42 @@
:key="row.label"> :key="row.label">
<span class="detail-label">{{ row.label }}:</span>{{ row.value }} <span class="detail-label">{{ row.label }}:</span>{{ row.value }}
</p> </p>
<div v-if="action.mediaList.length"
class="message-media-wrapper">
<span class="detail-label">消息内容:</span>
<div class="message-media-list">
<div v-for="media in action.mediaList"
:key="media.url"
class="message-media-item">
<el-image v-if="media.type === 'image'"
class="message-image"
fit="cover"
:preview-src-list="getImagePreviewList(action.mediaList)"
:src="media.url">
</el-image>
<video v-else
class="message-video"
controls
:src="media.url"
@play="handleVideoPlay">
</video>
<div v-if="media.name"
class="media-name"
:title="media.name">
{{ media.name }}
</div>
</div>
</div>
</div>
<p v-if="action.link">
<span class="detail-label">{{ action.link.label }}:</span>
<a class="detail-link"
rel="noopener noreferrer"
target="_blank"
:href="action.link.value">
{{ action.link.value }}
</a>
</p>
</div> </div>
</div> </div>
</template> </template>
...@@ -144,6 +181,15 @@ export default { ...@@ -144,6 +181,15 @@ export default {
}, },
methods: { methods: {
pauseOtherVideos(videos, currentVideo) {
if (!videos || !videos.length)
return;
videos.forEach((video) => {
if (video && video !== currentVideo && !video.paused) {
video.pause();
}
});
},
initInfo() { initInfo() {
const snapshotInfo = this.detailInfo && this.detailInfo.snapshotInfo; const snapshotInfo = this.detailInfo && this.detailInfo.snapshotInfo;
if (!snapshotInfo) { if (!snapshotInfo) {
...@@ -151,7 +197,17 @@ export default { ...@@ -151,7 +197,17 @@ export default {
return; return;
} }
this.info = JSON.parse(snapshotInfo); this.info = JSON.parse(snapshotInfo);
console.log(this.info); console.log(this.info, "this.info");
},
getImagePreviewList(mediaList) {
return mediaList
.filter(item => item.type === "image")
.map(item => item.url);
},
handleVideoPlay(event) {
const wrapper = this.$el && this.$el.querySelector(".strategy-detail-dialog");
const videos = wrapper ? wrapper.querySelectorAll("video") : [];
this.pauseOtherVideos(Array.prototype.slice.call(videos), event.target);
}, },
handleDetailConfirm() { handleDetailConfirm() {
this.$emit("handleDetailConfirm"); this.$emit("handleDetailConfirm");
...@@ -170,7 +226,9 @@ export default { ...@@ -170,7 +226,9 @@ export default {
padding-right: 6px; padding-right: 6px;
color: #303133; color: #303133;
font-size: 13px; font-size: 13px;
[class^="el-icon-"] {
color: #ffffff;
}
.detail-section { .detail-section {
margin-bottom: 18px; margin-bottom: 18px;
...@@ -234,11 +292,54 @@ export default { ...@@ -234,11 +292,54 @@ export default {
} }
.action-block:last-child { .action-block:last-child {
margin-bottom: 0px; margin-bottom: 0;
}
.message-media-wrapper {
display: flex;
align-items: flex-start;
margin-top: 4px;
}
.message-media-list {
display: flex;
flex-wrap: wrap;
gap: 10px;
flex: 1;
}
.message-media-item {
width: 180px;
} }
.material-text { .message-image,
display: inline; .message-video {
width: 180px;
height: 120px;
border-radius: 4px;
background: #fff;
border: 1px solid #ebeef5;
object-fit: contain;
display: block;
}
.media-name {
margin-top: 4px;
color: #606266;
font-size: 12px;
line-height: 18px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.detail-link {
color: #409eff;
text-decoration: none;
&:hover {
text-decoration: underline;
}
} }
} }
</style> </style>
<!-- 关联门店弹窗 --> <!-- 关联门店弹窗 -->
<template> <template>
<div> <div>
<d2-dialog btn-ok-label="确定" <d2-dialog btn-ok-label="关闭"
class="record" class="record"
width="70%" width="70%"
:is-visible.sync="recordVisible" :is-visible.sync="recordVisible"
:no-cancel="true"
:title="title" :title="title"
@closeDialog="handleRecordClose" @closeDialog="handleRecordClose"
@confirmDialog="handleRecordConfirm"> @confirmDialog="handleRecordConfirm">
......
...@@ -151,6 +151,7 @@ ...@@ -151,6 +151,7 @@
<script> <script>
import { cloneDeep, isArray } from "lodash-es"; import { cloneDeep, isArray } from "lodash-es";
import reportTrackFunMixin from "@/mixins/reportTrackFunMixin";
import { createStrategy, getMarketingPushStrategyDetailApi, getMetaOptionsApi, updateStrategy } from "@/views/marketingManagement/marketingPushStrategy/api/index.js"; import { createStrategy, getMarketingPushStrategyDetailApi, getMetaOptionsApi, updateStrategy } from "@/views/marketingManagement/marketingPushStrategy/api/index.js";
import BranchGroup from "@/views/marketingManagement/marketingPushStrategy/components/branchGroup/index.vue"; import BranchGroup from "@/views/marketingManagement/marketingPushStrategy/components/branchGroup/index.vue";
import ConditionPanel from "@/views/marketingManagement/marketingPushStrategy/components/conditionPanel/index.vue"; import ConditionPanel from "@/views/marketingManagement/marketingPushStrategy/components/conditionPanel/index.vue";
...@@ -165,6 +166,7 @@ export default { ...@@ -165,6 +166,7 @@ export default {
BranchGroup, BranchGroup,
ConditionPanel, ConditionPanel,
}, },
mixins: [reportTrackFunMixin], // 导入混入
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
to.meta.title = to.query.editType === "edit" ? "修改策略" : "新增策略"; to.meta.title = to.query.editType === "edit" ? "修改策略" : "新增策略";
...@@ -356,6 +358,7 @@ export default { ...@@ -356,6 +358,7 @@ export default {
const params = this.dealParams(); const params = this.dealParams();
const api = this.$route.query.editType === "edit" ? updateStrategy : createStrategy; const api = this.$route.query.editType === "edit" ? updateStrategy : createStrategy;
api(params).then((res) => { api(params).then((res) => {
this.setReportTrackData(0, "sop_strategy_web_submit_change", {});
this.$message.success("操作成功"); this.$message.success("操作成功");
this.handleCancel(); this.handleCancel();
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!