Commit e0298cc2 by zhangxw

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

…stem into SAAS+V5.8.3-zxw
2 parents a8749133 f26b630b
Showing 59 changed files with 3910 additions and 408 deletions
{
"mcpServers": {
"codegraph": {
"type": "stdio",
"command": "codegraph",
"args": [
"serve",
"--mcp"
]
}
}
}
import request from "./request";
import RequestMethods from "./request.methods";
/** 查询客户画像 */
export function queryCustomerPortrait(data = {}) {
data.method = "dj.api.customer.profile";
data.id = data.id ?? data.customerId;
return request(data, RequestMethods.POST);
}
/** 查询客户群关联 */
export function queryCustomerGroups(data = {}) {
data.method = "dj.api.customer.groupAssoc";
data.id = data.id ?? data.customerId;
return request(data, RequestMethods.POST);
}
......@@ -100,4 +100,22 @@ export function findMerchantStaffList(data) {
export function linkMerchant(data) {
data.method = `dj.staff.api.recruitment.demand.link.merchant`;
return request(data);
}
// 试岗计划审批(通过/驳回)
export function trialOnboardingApproval(data) {
data.method = `dj.staff.api.recruitment.trial.onboarding.approval`;
return request(data);
}
// 试岗门店列表
export function getTrialOnboardingStoreList(data) {
data.method = `dj.staff.api.recruitment.demand.store.list`;
return request(data);
}
// 招聘需求业务场景列表
export function getRecruitmentDemandSubSceneList(data) {
data.method = `dj.staff.api.recruitment.demand.sub.scene.list`;
return request(data);
}
\ No newline at end of file
import request from "./request";
import RequestMethods from "./request.methods";
const METHOD_PREFIX = "dj.api.strategy.tag.";
/** 查询标签类别树 */
export function queryTagCategoryTree(data = {}) {
data.method = `${METHOD_PREFIX}category.tree`;
return request(data, RequestMethods.POST);
}
/** 查询可新增子级的分类列表 */
export function queryTagCategoryLeafList(data = {}) {
data.method = `${METHOD_PREFIX}category.leaf.list`;
return request(data, RequestMethods.POST);
}
/** 创建标签类别 */
export function createTagCategory(data = {}) {
data.method = `${METHOD_PREFIX}category.create`;
return request(data, RequestMethods.POST);
}
/** 编辑标签类别 */
export function updateTagCategory(data = {}) {
data.method = `${METHOD_PREFIX}category.update`;
return request(data, RequestMethods.POST);
}
/** 分页查询标签维度列表 */
export function queryTagDimension(data = {}) {
data.method = `${METHOD_PREFIX}dimension.query`;
return request(data, RequestMethods.POST);
}
/** 获取新增维度时可选的分类列表 */
export function queryTagDimensionCategoryOptions(data = {}) {
data.method = `${METHOD_PREFIX}dimension.category.options`;
return request(data, RequestMethods.POST);
}
/**
* 查询标签维度详情
* @param {Object} data categoryId — 参数名沿用后端,实际传维度 ID
*/
export function queryTagDimensionDetail(data = {}) {
data.method = `${METHOD_PREFIX}dimension.detail`;
return request(data, RequestMethods.POST);
}
/** 创建标签维度 */
export function createTagDimension(data = {}) {
data.method = `${METHOD_PREFIX}dimension.create`;
return request(data, RequestMethods.POST);
}
/** 编辑标签维度 */
export function updateTagDimension(data = {}) {
data.method = `${METHOD_PREFIX}dimension.update`;
return request(data, RequestMethods.POST);
}
/** 分页查询枚举值列表 */
export function pageTagEnum(data = {}) {
data.method = `${METHOD_PREFIX}enum.page`;
return request(data, RequestMethods.POST);
}
/** 创建标签枚举值 */
export function createTagEnum(data = {}) {
data.method = `${METHOD_PREFIX}enum.create`;
return request(data, RequestMethods.POST);
}
/** 编辑标签枚举值 */
export function updateTagEnum(data = {}) {
data.method = `${METHOD_PREFIX}enum.update`;
return request(data, RequestMethods.POST);
}
......@@ -2083,6 +2083,16 @@ export const trialStatusOpt = [
confValue: "无试岗",
},
];
export const approvalStatusOpt=[
{
confId: 0,
confValue: "待审批",
},
{
confId: 1,
confValue: "已审批",
},
]
export const connectionFlagOptMap = {
true: "#2CCA74",
false: "#EB4E4E",
......
<template>
<el-dialog ref="elDialog"
v-bind="$attrs"
:visible.sync="innerVisible"
:width="computedWidth"
:fullscreen="innerFullscreen"
:custom-class="dialogCustomClass"
:show-close="false"
v-on="$listeners"
@open="handleOpen">
<!-- Title slot wrapper for fullscreen support -->
<template #title>
<div class="venus-dialog-header-inner">
<slot name="title">
<span class="el-dialog__title">{{ $attrs.title }}</span>
</slot>
<div class="venus-dialog-actions">
<!-- Fullscreen toggle button -->
<button v-if="allowFullscreen"
type="button"
class="venus-dialog-action-btn"
@click="toggleFullscreen">
<i :class="innerFullscreen ? 'el-icon-crop' : 'el-icon-full-screen'"></i>
</button>
<!-- Custom Close button -->
<button v-if="showClose"
type="button"
class="venus-dialog-action-btn"
@click="handleClose">
<i class="el-icon-close"></i>
</button>
</div>
<el-dialog ref="elDialog"
v-bind="$attrs"
:custom-class="dialogCustomClass"
:fullscreen="innerFullscreen"
:show-close="false"
:visible.sync="innerVisible"
:width="computedWidth"
v-on="$listeners"
@open="handleOpen">
<!-- Title slot wrapper for fullscreen support -->
<template #title>
<div class="venus-dialog-header-inner">
<slot name="title">
<span class="el-dialog__title">{{ $attrs.title }}</span>
</slot>
<div class="venus-dialog-actions">
<!-- Fullscreen toggle button -->
<button v-if="allowFullscreen"
class="venus-dialog-action-btn"
type="button"
@click="toggleFullscreen">
<i :class="innerFullscreen ? 'el-icon-crop' : 'el-icon-full-screen'"></i>
</button>
<!-- Custom Close button -->
<button v-if="showClose"
class="venus-dialog-action-btn"
type="button"
@click="handleClose">
<i class="el-icon-close"></i>
</button>
</div>
</div>
</template>
<!-- Default slot for dialog body -->
<slot></slot>
<!-- Footer slot -->
<template #footer>
<transition name="footer-slide">
<div v-if="showFooter" class="venus-dialog-footer-wrapper">
<slot name="footer">
<div class="venus-dialog-footer">
<VenusButton v-if="showCancel"
size="small"
@click="handleCancel">
{{ cancelText }}
</VenusButton>
<VenusButton size="small"
type="primary"
:loading="confirmLoading"
@click="handleConfirm">
{{ confirmText }}
</VenusButton>
</div>
</template>
<!-- Default slot for dialog body -->
<slot></slot>
<!-- Footer slot -->
<template #footer>
<transition name="footer-slide">
<div v-if="showFooter" class="venus-dialog-footer-wrapper">
<slot name="footer">
<div class="venus-dialog-footer">
<VenusButton v-if="showCancel"
size="small"
@click="handleCancel">
{{ cancelText }}
</VenusButton>
<VenusButton size="small"
type="primary"
:loading="confirmLoading"
@click="handleConfirm">
{{ confirmText }}
</VenusButton>
</div>
</slot>
</div>
</transition>
</template>
</el-dialog>
</slot>
</div>
</transition>
</template>
</el-dialog>
</template>
<script>
......
/**
* @param {Array} arr 原数组
* @param {number} fromIndex 原下标
* @param {number} toIndex 目标下标
* @returns {Array} 新数组,不修改原数组
*/
export function moveItem(arr, fromIndex, toIndex) {
if (fromIndex === toIndex)
return [...arr];
// 先拷贝一份新数组
const newArr = [...arr];
// 取出并删除原位置元素
const item = newArr.splice(fromIndex, 1)[0];
// 插入到目标位置
newArr.splice(toIndex, 0, item);
return newArr;
}
......@@ -10,3 +10,17 @@ export function readFileAsDataURL(file) {
};
});
}
const IMAGE_EXTENSIONS = ["jpg", "jpeg", "png", "gif", "webp", "bmp", "svg", "ico"];
/**
* 根据文件后缀判断是否为图片
* @param {string} fileName - 文件名
* @returns {boolean}
*/
export function isImageFile(fileName) {
if (!fileName || typeof fileName !== "string")
return false;
const ext = fileName.split(".").pop()?.toLowerCase();
return IMAGE_EXTENSIONS.includes(ext);
}
const _import = require("@/libs/util.import." + process.env.NODE_ENV)
export const routerName = {
902: {
path: "/flowManage",
name: "flowManage",
meta: {
title: "流量管理",
authId: "902",
parentId: "1",
cache: false
}
},
90201: {
path: "/customerList",
name: "customerList",
meta: {
title: "客户列表",
authId: "90201",
parentId: "902",
cache: false
},
auth: [
{
authId: "9020101",
parentId: "90201",
label: "导出",
category: "Button",
type: "primary",
handle: "handleExport"
}
],
component: _import("customer/customerList")
},
90202: {
path: "/recordList",
name: "recordList",
meta: {
title: "预录信息",
authId: "90202",
parentId: "902",
cache: false
},
auth: [
{
authId: "9020201",
parentId: "90202",
label: "预录客户",
icon: "plus",
category: "Button",
type: "primary",
handle: "handleAdd",
addRoutePath: [
{
authId: "901",
name: "预录客户",
parentId: "90202"
}
]
},
{
authId: "9020202",
parentId: "90202",
label: "一键导入",
category: "Button",
type: "primary",
handle: "handleImport"
},
{
authId: "9020203",
parentId: "90202",
label: "编辑",
handle: "handleEdit",
addRoutePath: [
{
authId: "901",
name: "预录客户",
parentId: "90202"
}
]
}
],
component: _import("customer/recordList")
},
90203: {
path: "/invitation",
name: "invitation",
meta: {
title: "邀约管理",
authId: "90203",
parentId: "902",
cache: false
},
auth: [
{
authId: "9020301",
parentId: "90203",
label: "再次电联",
handle: "handleMoreCall"
// ruleObj: {
// attr: 'status',
// rule: {
// 0: '上架',
// 1: '下架'
// }
// }
},
{
authId: "9020302",
parentId: "90203",
label: "取消预约",
handle: "handleCancel"
},
{
authId: "9020303",
parentId: "90203",
label: "更新备注",
handle: "handleUpdateRemark"
},
{
authId: "9020304",
parentId: "90203",
label: "修改时间",
handle: "handleChangeTime"
},
{
authId: "9020305",
parentId: "90203",
label: "电联一下",
handle: "handleCall"
},
{
authId: "9020306",
parentId: "90203",
label: "预约时间",
handle: "handleAppoint"
},
{
authId: "9020307",
parentId: "90203",
label: "更新备注",
handle: "handleUpdateRemark"
}
],
component: _import("customer/invitation")
},
901: {
path: "/editCustomer",
name: "editCustomer",
meta: {
title: "预录客户",
authId: "901",
parentId: "90202",
cache: false,
sideHidden: false,
activePath: "/recordList"
},
component: _import("customer/editCustomer")
}
}
// { routerName }
const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = {
902: {
path: "/flowManage",
name: "flowManage",
meta: {
title: "流量管理",
authId: "902",
parentId: "1",
cache: false,
},
},
90201: {
path: "/customerList",
name: "customerList",
meta: {
title: "客户列表",
authId: "90201",
parentId: "902",
cache: false,
},
auth: [
{
authId: "9020101",
parentId: "90201",
label: "导出",
category: "Button",
type: "primary",
handle: "handleExport",
},
{
authId: "9020102",
parentId: "90201",
label: "客户画像",
handle: "handleViewPortrait",
addRoutePath: [
{
authId: "90205",
name: "客户画像",
parentId: "90201",
},
],
},
{
authId: "9020103",
parentId: "90201",
label: "群关联",
handle: "handleViewGroups",
addRoutePath: [
{
authId: "90206",
name: "群关联",
parentId: "90201",
},
],
},
{
authId: "9020104",
parentId: "90201",
label: "订单信息",
handle: "handleViewOrders",
// addRoutePath: [
// {
// authId: "90401",
// name: "订单列表",
// parentId: "904",
// },
// ],
},
],
component: _import("customer/customerList"),
},
90202: {
path: "/recordList",
name: "recordList",
meta: {
title: "预录信息",
authId: "90202",
parentId: "902",
cache: false,
},
auth: [
{
authId: "9020201",
parentId: "90202",
label: "预录客户",
icon: "plus",
category: "Button",
type: "primary",
handle: "handleAdd",
addRoutePath: [
{
authId: "901",
name: "预录客户",
parentId: "90202",
},
],
},
{
authId: "9020202",
parentId: "90202",
label: "一键导入",
category: "Button",
type: "primary",
handle: "handleImport",
},
{
authId: "9020203",
parentId: "90202",
label: "编辑",
handle: "handleEdit",
addRoutePath: [
{
authId: "901",
name: "预录客户",
parentId: "90202",
},
],
},
],
component: _import("customer/recordList"),
},
90203: {
path: "/invitation",
name: "invitation",
meta: {
title: "邀约管理",
authId: "90203",
parentId: "902",
cache: false,
},
auth: [
{
authId: "9020301",
parentId: "90203",
label: "再次电联",
handle: "handleMoreCall",
// ruleObj: {
// attr: 'status',
// rule: {
// 0: '上架',
// 1: '下架'
// }
// }
},
{
authId: "9020302",
parentId: "90203",
label: "取消预约",
handle: "handleCancel",
},
{
authId: "9020303",
parentId: "90203",
label: "更新备注",
handle: "handleUpdateRemark",
},
{
authId: "9020304",
parentId: "90203",
label: "修改时间",
handle: "handleChangeTime",
},
{
authId: "9020305",
parentId: "90203",
label: "电联一下",
handle: "handleCall",
},
{
authId: "9020306",
parentId: "90203",
label: "预约时间",
handle: "handleAppoint",
},
{
authId: "9020307",
parentId: "90203",
label: "更新备注",
handle: "handleUpdateRemark",
},
],
component: _import("customer/invitation"),
},
90205: {
path: "/customerPortrait",
name: "customerPortrait",
meta: {
title: "客户画像",
authId: "90205",
parentId: "90201",
cache: false,
sideHidden: true,
activePath: "/customerList",
},
component: _import("customer/portrait/index"),
},
90206: {
path: "/customerGroupRel",
name: "customerGroupRel",
meta: {
title: "群关联",
authId: "90206",
parentId: "90201",
cache: false,
sideHidden: true,
activePath: "/customerList",
},
component: _import("customer/groupRel/index"),
},
901: {
path: "/editCustomer",
name: "editCustomer",
meta: {
title: "预录客户",
authId: "901",
parentId: "90202",
cache: false,
sideHidden: false,
activePath: "/recordList",
},
component: _import("customer/editCustomer"),
},
};
// { routerName }
......@@ -148,7 +148,7 @@ export const routerName = {
label: "新增策略",
category: "Button",
type: "primary",
handle: "handleAppend",
handle: "handleModify",
addRoutePath: [
{
authId: "9221010",
......
const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = {
923: {
path: "/tagManagement",
name: "tagManagementGroup",
meta: {
title: "标签管理",
authId: "923",
parentId: "1",
cache: false,
},
},
92301: {
path: "/tagManagementList",
name: "tagManagement",
meta: {
title: "标签管理",
authId: "92301",
parentId: "923",
cache: false,
},
addRoutePath: [
{
authId: "92302",
name: "维护枚举值",
parentId: "92301",
},
],
auth: [
{
authId: "9230101",
parentId: "92301",
label: "新增子分类",
category: "Button",
type: "primary",
handle: "handleAddCategory",
},
{
authId: "9230102",
parentId: "92301",
label: "新增标签维度",
category: "Button",
type: "primary",
handle: "handleAddDimension",
},
{
authId: "9230103",
parentId: "92301",
label: "编辑",
handle: "handleEditCategory",
},
{
authId: "9230104",
parentId: "92301",
label: "新增枚举",
handle: "handleAddEnum",
},
{
authId: "9230105",
parentId: "92301",
label: "编辑",
handle: "handleEditDimension",
},
{
authId: "9230106",
parentId: "92301",
label: "编辑枚举",
handle: "handleEditEnum",
},
{
authId: "9230108",
parentId: "92301",
label: "维护枚举值",
handle: "handleMaintainEnum",
addRoutePath: [
{
authId: "92302",
name: "维护枚举值",
parentId: "92301",
},
],
},
],
component: _import("tagCustomerManagement/tagManagement/index"),
},
92302: {
path: "/tagEnumMaintain",
name: "tagEnumMaintain",
meta: {
title: "维护枚举值",
authId: "92302",
parentId: "92301",
cache: false,
sideHidden: true,
activePath: "/tagManagementList",
},
auth: [
{
authId: "9230104",
parentId: "92302",
label: "新增枚举值",
category: "Button",
type: "primary",
handle: "handleAddEnum",
},
{
authId: "9230106",
parentId: "92302",
label: "编辑枚举",
handle: "handleEditEnum",
},
],
component: _import("tagCustomerManagement/tagManagement/enumMaintain/index"),
},
};
<template>
<section class="detail-card">
<h3 class="detail-card__title">
基础信息
</h3>
<el-row :gutter="16">
<el-col
v-for="item in fieldList"
:key="item.prop"
class="detail-row"
:span="item.span || 8"
>
<span class="detail-label">{{ item.label }}:</span>
<span class="detail-value">{{ displayInfo[item.prop] || "-" }}</span>
</el-col>
</el-row>
</section>
</template>
<script>
import { CUSTOMER_STATUS_LIST, mapBasicInfoFromRow } from "../utils/customerSnapshot";
export default {
name: "CustomerBasicInfoCard",
props: {
customerRow: {
type: Object,
default: () => ({}),
},
basicInfo: {
type: Object,
default: () => ({}),
},
statusList: {
type: Array,
default: () => CUSTOMER_STATUS_LIST,
},
},
computed: {
displayInfo() {
const fromRow = mapBasicInfoFromRow(this.customerRow, this.statusList);
if (this.basicInfo && Object.keys(this.basicInfo).length) {
return {
...fromRow,
...this.basicInfo,
// 客户分类、客户状态仅来自列表行数据,详情接口不返回
customerCategory: fromRow.customerCategory,
customerStatus: fromRow.customerStatus,
};
}
return fromRow;
},
fieldList() {
return [
{ label: "客户姓名", prop: "customerName" },
{ label: "手机号", prop: "mobile" },
{ label: "客户分类", prop: "customerCategory" },
{ label: "品牌车型", prop: "carModel" },
{ label: "客户状态", prop: "customerStatus" },
{ label: "服务时间", prop: "serviceTime" },
{ label: "备注", prop: "remark", span: 24 },
{ label: "流量来源", prop: "trafficSource" },
{ label: "推荐人", prop: "referrer" },
{ label: "园区店", prop: "parkStore" },
{ label: "转化专员", prop: "conversionStaff" },
{ label: "群关联信息", prop: "groupRelInfo" },
{ label: "创建方式", prop: "createMethod" },
{ label: "创建时间", prop: "createTime" },
{ label: "交车时间", prop: "deliveryTime" },
];
},
},
};
</script>
<style lang="scss" scoped>
.detail-card {
background: #fff;
border-radius: 4px;
padding: 16px 20px 8px;
margin-bottom: 12px;
&__title {
margin: 0 0 16px;
padding-left: 10px;
border-left: 3px solid #409eff;
font-size: 14px;
font-weight: 600;
color: #303133;
line-height: 20px;
}
}
.detail-row {
margin-bottom: 14px;
font-size: 14px;
line-height: 22px;
}
.detail-label {
color: #606266;
}
.detail-value {
color: #303133;
word-break: break-all;
}
</style>
<template>
<d2-container v-loading="pageLoading" class="customer-group-rel-page">
<div class="page-content">
<CustomerBasicInfoCard
:customer-row="customerRow"
:basic-info="groupData.basicInfo"
/>
<section class="detail-card">
<h3 class="detail-card__title">
群关联
</h3>
<div
v-for="item in groupFieldList"
:key="item.prop"
class="field-row"
>
<span class="field-label">{{ item.label }}:</span>
<span class="field-value">{{ displayGroupInfo[item.prop] || "-" }}</span>
</div>
</section>
<div class="footer-actions">
<el-button type="primary" size="medium" @click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
</template>
<script>
import { queryCustomerGroups } from "@api/customerDetail";
import CustomerBasicInfoCard from "../components/CustomerBasicInfoCard.vue";
import { loadCustomerSnapshot, mapGroupAssocResponse, resolveCustomerRowFromRoute } from "../utils/customerSnapshot";
export default {
name: "CustomerGroupRel",
components: { CustomerBasicInfoCard },
data() {
return {
pageLoading: false,
customerId: "",
customerRow: {},
groupData: {
basicInfo: {},
groupRelStatus: "",
groupName: "",
groupMemberCustomer: "",
},
};
},
computed: {
groupFieldList() {
return [
{ label: "群关联状态", prop: "groupRelStatus" },
{ label: "群名称", prop: "groupName" },
{ label: "群成员-客户", prop: "groupMemberCustomer" },
];
},
displayGroupInfo() {
return {
groupRelStatus: this.groupData.groupRelStatus || "未关联",
groupName: this.groupData.groupName || "",
groupMemberCustomer: this.groupData.groupMemberCustomer || "",
};
},
},
created() {
this.customerId = this.$route.query.customerId;
if (!this.customerId) {
this.$message.warning("缺少客户参数");
this.$router.back();
return;
}
this.customerRow = resolveCustomerRowFromRoute(
this.$route,
loadCustomerSnapshot()
);
this.loadGroupInfo();
},
methods: {
async loadGroupInfo() {
this.pageLoading = true;
try {
const res = await queryCustomerGroups({
id: this.customerId,
});
this.applyGroupData(mapGroupAssocResponse(res || {}, this.customerRow));
} catch (err) {
this.$message.error(err.message || "加载群关联失败");
this.applyGroupData(mapGroupAssocResponse({}, this.customerRow));
} finally {
this.pageLoading = false;
}
},
applyGroupData(res) {
this.groupData = {
basicInfo: res.basicInfo || {},
groupRelStatus: res.groupRelStatus || "未关联",
groupName: res.groupName || "",
groupMemberCustomer: res.groupMemberCustomer || "",
};
},
handleBack() {
this.$router.push({ name: "customerList" });
},
},
};
</script>
<style lang="scss" scoped>
.customer-group-rel-page {
::v-deep .d2-container-full__body {
padding: 0 !important;
background: #f0f2f5;
}
.page-content {
width: 100%;
box-sizing: border-box;
padding: 12px 20px 32px;
}
.detail-card {
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 16px 20px;
margin-bottom: 12px;
&__title {
margin: 0 0 16px;
padding-left: 10px;
border-left: 3px solid #409eff;
font-size: 14px;
font-weight: 600;
color: #303133;
line-height: 20px;
}
}
.field-row {
display: flex;
align-items: flex-start;
margin-bottom: 14px;
font-size: 14px;
line-height: 22px;
&:last-child {
margin-bottom: 0;
}
}
.field-label {
flex-shrink: 0;
min-width: 110px;
color: #606266;
}
.field-value {
flex: 1;
color: #303133;
word-break: break-all;
}
.footer-actions {
margin-top: 8px;
padding: 16px 0 8px;
text-align: center;
}
}
</style>
<template>
<d2-container v-loading="pageLoading" class="customer-portrait-page">
<div class="page-content">
<CustomerBasicInfoCard
:customer-row="customerRow"
:basic-info="portraitData.basicInfo"
/>
<section class="detail-card">
<h3 class="detail-card__title">
消费力标签({{ consumptionScore }}分)
</h3>
<template v-if="consumptionDimensions.length">
<div
v-for="(dimension, index) in consumptionDimensions"
:key="`consumption-${index}`"
class="field-row"
>
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag
v-for="(tag, tagIndex) in dimension.tags"
:key="`consumption-tag-${index}-${tagIndex}`"
size="small"
class="tag-item"
>
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
产品标签({{ productScore }}分)
</h3>
<template v-if="productDimensions.length">
<div
v-for="(dimension, index) in productDimensions"
:key="`product-${index}`"
class="field-row"
>
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag
v-for="(tag, tagIndex) in dimension.tags"
:key="`product-tag-${index}-${tagIndex}`"
size="small"
class="tag-item"
>
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
行为标签({{ behaviorScore }}分)
</h3>
<el-table
:data="behaviorTagList"
border
size="small"
class="behavior-table"
>
<el-table-column
label="序号"
type="index"
width="60"
align="center"
/>
<el-table-column
label="标签维度"
prop="dimensionName"
min-width="200"
align="center"
/>
<el-table-column
label="枚举值"
min-width="120"
align="center"
>
<template slot-scope="scope">
<el-tag
v-if="scope.row.enumName"
size="small"
class="tag-item"
>
{{ scope.row.enumName }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column
label="依据"
prop="basis"
min-width="320"
align="left"
>
<template slot-scope="scope">
<span class="basis-text">{{ scope.row.basis || "-" }}</span>
</template>
</el-table-column>
</el-table>
</section>
<div class="footer-actions">
<el-button type="primary" size="medium" @click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
</template>
<script>
import { queryCustomerPortrait } from "@api/customerDetail";
import CustomerBasicInfoCard from "../components/CustomerBasicInfoCard.vue";
import {
loadCustomerSnapshot,
mapProfileResponse,
resolveCustomerRowFromRoute,
} from "../utils/customerSnapshot";
export default {
name: "CustomerPortrait",
components: { CustomerBasicInfoCard },
data() {
return {
pageLoading: false,
customerId: "",
customerRow: {},
portraitData: {
basicInfo: {},
consumptionScore: 0,
consumptionDimensions: [],
productScore: 0,
productDimensions: [],
behaviorScore: 0,
behaviorTagList: [],
},
};
},
computed: {
consumptionScore() {
return this.portraitData.consumptionScore || 0;
},
productScore() {
return this.portraitData.productScore || 0;
},
behaviorScore() {
return this.portraitData.behaviorScore || 0;
},
consumptionDimensions() {
return this.portraitData.consumptionDimensions || [];
},
productDimensions() {
return this.portraitData.productDimensions || [];
},
behaviorTagList() {
return this.portraitData.behaviorTagList || [];
},
},
created() {
this.customerId = this.$route.query.customerId;
if (!this.customerId) {
this.$message.warning("缺少客户参数");
this.$router.back();
return;
}
this.customerRow = resolveCustomerRowFromRoute(
this.$route,
loadCustomerSnapshot()
);
this.loadPortrait();
},
methods: {
async loadPortrait() {
this.pageLoading = true;
try {
const res = await queryCustomerPortrait({
id: this.customerId,
});
this.applyPortraitData(
mapProfileResponse(res || {}, this.customerRow)
);
} catch (err) {
this.$message.error(err.message || "加载客户画像失败");
this.applyPortraitData(
mapProfileResponse({}, this.customerRow)
);
} finally {
this.pageLoading = false;
}
},
applyPortraitData(res) {
this.portraitData = {
basicInfo: res.basicInfo || {},
consumptionScore: res.consumptionScore || 0,
consumptionDimensions: res.consumptionDimensions || [],
productScore: res.productScore || 0,
productDimensions: res.productDimensions || [],
behaviorScore: res.behaviorScore || 0,
behaviorTagList: res.behaviorTagList || [],
};
},
handleBack() {
this.$router.push({ name: "customerList" });
},
},
};
</script>
<style lang="scss" scoped>
.customer-portrait-page {
::v-deep .d2-container-full__body {
padding: 0 !important;
background: #f0f2f5;
}
.page-content {
width: 100%;
box-sizing: border-box;
padding: 12px 20px 32px;
}
.detail-card {
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 16px 20px;
margin-bottom: 12px;
&__title {
margin: 0 0 16px;
padding-left: 10px;
border-left: 3px solid #409eff;
font-size: 14px;
font-weight: 600;
color: #303133;
line-height: 20px;
}
}
.field-row {
display: flex;
align-items: flex-start;
margin-bottom: 12px;
font-size: 14px;
line-height: 22px;
&:last-child {
margin-bottom: 0;
}
}
.field-label {
flex-shrink: 0;
min-width: 90px;
color: #606266;
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
flex: 1;
}
.tag-item {
background: #ecf5ff;
border-color: #d9ecff;
color: #409eff;
&--plain {
background: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
}
}
.empty-text {
color: #909399;
}
.behavior-table {
width: 100%;
}
.basis-text {
display: inline-block;
word-break: break-all;
white-space: pre-wrap;
line-height: 20px;
color: #606266;
}
.footer-actions {
margin-top: 8px;
padding: 16px 0 8px;
text-align: center;
}
}
</style>
const SNAPSHOT_KEY = "customerDetailSnapshot";
export const CUSTOMER_STATUS_LIST = [
{ confId: 1, confLabel: "待跟进" },
{ confId: 2, confLabel: "已升级" },
{ confId: 3, confLabel: "战败" },
{ confId: 4, confLabel: "已退款" },
];
export function saveCustomerSnapshot(row) {
if (!row) {
return;
}
try {
sessionStorage.setItem(SNAPSHOT_KEY, JSON.stringify(row));
} catch (err) {
// ignore quota errors
}
}
export function loadCustomerSnapshot() {
try {
const raw = sessionStorage.getItem(SNAPSHOT_KEY);
return raw ? JSON.parse(raw) : {};
} catch (err) {
return {};
}
}
/** 合并列表行快照与路由参数,客户分类仅来自列表数据 */
export function resolveCustomerRowFromRoute(route = {}, snapshotRow = {}) {
const row = { ...snapshotRow };
if (route.query && route.query.customerClass) {
row.customerClass = route.query.customerClass;
}
if (route.query && route.query.customerStatus !== undefined && route.query.customerStatus !== "") {
row.customerStatus = route.query.customerStatus;
}
return row;
}
function formatDateValue(value) {
if (!value) {
return "";
}
return new Date(value).toLocaleDateString();
}
export function formatCarModel(row = {}) {
const carModel = (row.carModel || "").trim();
if (carModel) {
return carModel;
}
const parts = [row.carBrand, row.carSeriesName, row.carTypeName]
.map((item) => (item || "").trim())
.filter(Boolean);
return parts.length ? parts.join("-") : "";
}
export function formatCarModelForList(row = {}) {
const value = formatCarModel(row);
return value || "";
}
export function formatListPhone(row = {}) {
return row.customerPhone || row.mobile || row.phone || row.phoneNumber || "";
}
export function formatCustomerClass(row = {}) {
const customerClass = row.customerClass || row.customerCategory;
if (!customerClass) {
return "";
}
const normalized = String(customerClass).trim().toUpperCase();
if (normalized === "A" || normalized === "A类") {
return "A类";
}
if (normalized === "B" || normalized === "B类") {
return "B类";
}
if (normalized === "C" || normalized === "C类") {
return "C类";
}
return String(customerClass);
}
export function formatGroupStatus(row = {}) {
if (row.groupStatus === true || row.groupStatus === "已关联") {
return "已关联";
}
return "未关联";
}
export function formatDeliveryTime(row = {}) {
const time = row.deliveryDate
|| row.deliveryTime
|| row.buyTimeStr
|| (row.order && row.order.installUpgradeTime);
return formatDateValue(time);
}
export function formatRecorder(row = {}) {
return row.userName || row.advanceUserName || row.createdBy || "";
}
export function formatReferrer(row = {}) {
return row.referrerName
|| row.employeeName
|| (row.order && row.order.employeeName)
|| "";
}
export function formatCustomerStatus(row = {}, statusList = CUSTOMER_STATUS_LIST) {
const customerStatus = row.customerStatus;
if (customerStatus == null || customerStatus === "") {
return "-";
}
const matched = statusList.find((item) => Number(item.confId) === Number(customerStatus));
return matched ? matched.confLabel : "-";
}
export function formatServiceTime(row = {}) {
const time = row.order && row.order.installUpgradeTime;
if (!time) {
return "-";
}
return new Date(time).toLocaleDateString();
}
export function formatRemark(row = {}) {
if (!row.order) {
return "无";
}
if (row.order.upgradeFlag === "N") {
return row.order.customer
? (row.order.customer.refusalReason || "无")
: "无";
}
return row.order.remark || "无";
}
export function formatSource(row = {}) {
const source = row.order ? row.order.source : row.source;
if (source === 3) {
return "现场升级";
}
if (source === 5) {
return "核销抵扣";
}
return "系统录入";
}
export function formatCreateTime(row = {}) {
if (!row.createdDate) {
return "";
}
return formatDateValue(row.createdDate);
}
export function mapBasicInfoFromRow(row = {}, statusList = CUSTOMER_STATUS_LIST) {
const deliveryTime = formatDeliveryTime(row);
const referrer = formatReferrer(row);
const recorder = formatRecorder(row);
return {
customerName: row.customerName || "-",
mobile: formatListPhone(row) || "-",
customerCategory: formatCustomerClass(row) || "-",
carModel: formatCarModel(row) || "-",
customerStatus: formatCustomerStatus(row, statusList),
serviceTime: formatServiceTime(row),
remark: formatRemark(row),
trafficSource: row.merchantName || "-",
referrer: referrer || "-",
parkStore: row.yqMerchantName || "-",
conversionStaff: (row.order && row.order.sellerName) || "-",
groupRelInfo: formatGroupStatus(row),
createMethod: formatSource(row),
createTime: formatCreateTime(row) || "-",
deliveryTime: deliveryTime || "-",
recorder: recorder || "-",
};
}
function buildProfileCarModel(res = {}) {
const carModel = (res.carModel || "").trim();
if (carModel) {
return carModel;
}
const parts = [res.carBrand, res.carSeriesName]
.map((item) => (item || "").trim())
.filter(Boolean);
return parts.length ? parts.join("-") : "";
}
export function mapProfileResponse(res = {}, snapshotRow = {}) {
const snapshotBasic = mapBasicInfoFromRow(snapshotRow);
const deliveryTime = res.deliveryDate
? formatDateValue(res.deliveryDate)
: snapshotBasic.deliveryTime;
const basicInfo = {
...snapshotBasic,
customerName: res.customerName || snapshotBasic.customerName,
mobile: res.customerPhone || snapshotBasic.mobile,
carModel: buildProfileCarModel(res) || snapshotBasic.carModel,
trafficSource: res.merchantName || snapshotBasic.trafficSource,
deliveryTime: deliveryTime || "-",
// 客户分类、客户状态仅来自列表接口,详情接口不返回
customerCategory: snapshotBasic.customerCategory,
customerStatus: snapshotBasic.customerStatus,
};
const consumptionTag = res.consumptionTag || {};
// 接口字段名与 categoryName 语义对调:产品数据在 behaviorTag,行为数据在 productTag
const apiProductTag = res.behaviorTag || {};
const apiBehaviorTag = res.productTag || {};
const consumptionDimensions = (consumptionTag.dimensions || []).map((dimension) => ({
dimensionName: dimension.dimensionName || "-",
tags: (dimension.enumValues || []).map((item) => item.enumName).filter(Boolean),
}));
const productDimensions = (apiProductTag.dimensions || []).map((dimension) => ({
dimensionName: dimension.dimensionName || "-",
tags: (dimension.enumValues || []).map((item) => item.enumName).filter(Boolean),
}));
const behaviorTagList = [];
const behaviorCategory = apiBehaviorTag.categoryName || "行为标签";
(apiBehaviorTag.dealEnumValues || []).forEach((item) => {
behaviorTagList.push({
dimensionName: behaviorCategory,
enumName: item.enumName || "",
basis: item.scoreBasis || "",
});
});
(apiBehaviorTag.noDealEnumValues || []).forEach((item) => {
behaviorTagList.push({
dimensionName: behaviorCategory,
enumName: item.enumName || "",
basis: item.scoreBasis || "",
});
});
return {
basicInfo,
consumptionScore: consumptionTag.totalScore || 0,
consumptionDimensions,
productScore: apiProductTag.totalScore || 0,
productDimensions,
behaviorScore: apiBehaviorTag.totalScore || 0,
behaviorTagList,
};
}
export function mapGroupAssocResponse(res = {}, snapshotRow = {}) {
const snapshotBasic = mapBasicInfoFromRow(snapshotRow);
const groupRelStatus = res.groupStatus || "未关联";
const basicInfo = {
...snapshotBasic,
customerName: res.customerName || snapshotBasic.customerName,
mobile: res.customerPhone || snapshotBasic.mobile,
// 客户分类、客户状态仅来自列表接口,详情接口不返回
customerCategory: snapshotBasic.customerCategory,
customerStatus: snapshotBasic.customerStatus,
// 接口返回后同步基础信息中的群关联状态
groupRelInfo: groupRelStatus,
};
return {
basicInfo,
groupRelStatus,
groupName: res.qwGroupName || "",
groupMemberCustomer: res.wxName || "",
};
}
......@@ -101,6 +101,16 @@ import multipleMixin from "./multipleMixin";
export default {
name: "MultipleRecording",
mixins: [multipleMixin],
props: {
/**
* biz: 业务类型
* 1.延保 2.轻改 3.权益 4.二手车
*/
biz: {
type: Number,
default: 1,
},
},
data() {
return {
dialogConfig: {
......@@ -183,6 +193,14 @@ export default {
mounted() {
},
methods: {
beforeSearchFn() {
// 1.延保 2.轻改 3.权益 4.二手车 延保和权益都传1
return new Promise((resolve) => {
this.searchFormSearch = this.getParams();
this.searchFormSearch.businessType = this.biz == 3 ? 1 : this.biz;
resolve();
});
},
getParams() {
let params = this.deepClone(this.searchForm);
if (params.receptionDate) {
......
......@@ -149,6 +149,7 @@
@dialogClose="staffTag1Visible = false">
</MultipleStaff>
<MultipleRecording ref="recordingTagRef"
:biz="biz"
:choose-data="formData.recordingList"
:visible="recordingTagVisible"
@choose="formatMultipleList($event, 'recordingList')"
......
<!-- 关联门店弹窗 -->
<template>
<d2-dialog btn-ok-label="确定"
class="relateStore"
:is-visible.sync="relateStoreVisible"
:title="title"
width="70%"
@closeDialog="handleRelateStoreClose"
@confirmDialog="handleRelateStoreConfirm">
<slot />
<el-row class="tableCon">
<div class="tableBox left">
<el-table ref="seletingTable"
border
class="table"
:data="selectingData"
height="464px"
@select="handleChange"
@select-all="handleAll">
<el-table-column align="center"
type="selection"
width="55" />
<el-table-column align="center"
label="门店名称"
prop="merchantName">
</el-table-column>
<el-table-column align="center"
label="门店地址"
prop="merchantAddress">
</el-table-column>
<el-table-column align="center"
label="门店商户号"
prop="merchantId">
</el-table-column>
<el-table-column align="center"
label="服务对接"
prop="yqMerchantName">
</el-table-column>
<el-table-column align="center"
label="服务对接商户号"
prop="yqMerchantId">
</el-table-column>
</el-table>
<el-pagination background
:current-page.sync="currentPage"
layout="total, prev, pager, next"
:page-size="pageSize"
small
:total="total"
@current-change="handleCurrentChange" />
</div>
<el-table border
class="tableBox table"
:data="selectedData"
height="464px">
<el-table-column align="center"
label="门店名称"
prop="merchantName">
<template #default="scope">
<span>{{ scope.row.merchantName }}</span>
</template>
</el-table-column>
<el-table-column align="center"
label="门店商户号"
prop="merchantId">
<template #default="scope">
<span>{{ scope.row.merchantId }}</span>
</template>
</el-table-column>
<el-table-column align="center"
label="删除"
width="50px">
<template #default="scope">
<el-button class="el-icon-delete"
type="text"
@click="handleDelete(scope.row)" />
</template>
</el-table-column>
</el-table>
</el-row>
</d2-dialog>
<d2-dialog btn-ok-label="确定"
class="relateStore"
width="70%"
:is-visible.sync="relateStoreVisible"
:title="title"
@closeDialog="handleRelateStoreClose"
@confirmDialog="handleRelateStoreConfirm">
<slot />
<el-row class="tableCon">
<div class="tableBox left">
<el-table ref="seletingTable"
class="table"
height="464px"
border
:data="selectingData"
@select="handleChange"
@select-all="handleAll">
<el-table-column align="center"
type="selection"
width="55" />
<template v-for="(item, index) in tablecolumnList">
<el-table-column v-if="tableHeadItems.includes(item.label)"
:key="index"
align="center"
:label="item.label"
:prop="item.prop">
</el-table-column>
</template>
</el-table>
<el-pagination layout="total, prev, pager, next"
background
small
:current-page.sync="currentPage"
:page-size="pageSize"
:total="total"
@current-change="handleCurrentChange" />
</div>
<el-table class="tableBox table"
height="464px"
border
:data="selectedData">
<el-table-column align="center"
label="门店名称"
prop="merchantName">
<template #default="scope">
<span>{{ scope.row.merchantName }}</span>
</template>
</el-table-column>
<el-table-column align="center"
label="门店商户号"
prop="merchantId">
<template #default="scope">
<span>{{ scope.row.merchantId }}</span>
</template>
</el-table-column>
<el-table-column align="center"
label="删除"
width="50px">
<template #default="scope">
<el-button class="el-icon-delete"
type="text"
@click="handleDelete(scope.row)" />
</template>
</el-table-column>
</el-table>
</el-row>
</d2-dialog>
</template>
<script>
......@@ -114,11 +102,42 @@ export default {
default: false,
},
selectedSceneType: {
type: String
}
type: String,
},
page: {
type: String,
default: "",
},
tableHeadItems: {
type: Array,
default: () => {
return this.tablecolumnList.map(item => item.label);
},
},
},
data() {
return {
tablecolumnList: [{
label: "门店名称",
prop: "merchantName",
align: "center",
}, {
label: "门店地址",
prop: "merchantAddress",
align: "center",
}, {
label: "门店商户号",
prop: "merchantId",
align: "center",
}, {
label: "服务对接",
prop: "yqMerchantName",
align: "center",
}, {
label: "服务对接商户号",
prop: "yqMerchantId",
align: "center",
}],
selectedData: [],
selectingData: [],
// 分页
......@@ -147,7 +166,7 @@ export default {
currentPage: this.currentPage,
pageSize: this.pageSize,
baseSceneCode: this.selectedBaseSceneCode,
queryMerchantAddr: true
queryMerchantAddr: true,
}).then((res) => {
res?.list?.forEach((val) => {
// 账户中心门店返回商户号字段是merchantNo
......
......@@ -10,7 +10,7 @@ export function getList(data) {
}
// 查询策略详情
export function getDetail(data) {
export function getMarketingPushStrategyDetailApi(data) {
data.method = `${path}query`;
return request(data, "post");
}
......@@ -63,7 +63,7 @@ export function getMetaData(data) {
return request(data, "post");
}
export function getMetaOptions(data = {}) {
export function getMetaOptionsApi(data = {}) {
data.method = "dj.api.smartcarlife.sop.strategy.meta";
return request(data, RequestMethods.POST);
}
<template>
<div class="actions-item-wrapper">
<div class="title-wrapper">
<div class="title">
{{ title }}
</div>
<el-button class="del-button"
icon="el-icon-delete"
size="small"
type="danger"
plain
@click="handleRemoveActions">
删除动作
</el-button>
</div>
<el-form-item label="动作类型:"
:prop="`${propPrefix}.actionType`"
:rules="[{ required: true, message: '请选择动作类型', trigger: 'change' }]">
<el-select style="width:530px"
:value="item.actionType"
@change="handleActionTypeChange">
<el-option label="向客户群发送消息"
:value="1">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="目标群:"
:prop="`${propPrefix}.targetGroupType`"
:rules="[{ required: true, message: '请选择目标群', trigger: 'change' }]">
<el-radio-group :value="item.targetGroupType">
<el-radio :label="1">
目标客户所在群
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="消息内容:"
style="margin-bottom:0 "
:prop="`${propPrefix}.messageType`"
:rules="[
{ required: true, message: '请选择消息类型', trigger: 'change' },
{ validator: validateMessageType, trigger: 'blur' },
]">
<MessageType :item="item"
:message-variables="options.messageVariables"
@input="handleMessageTypeChange" />
</el-form-item>
</div>
</template>
<script>
import MessageType from "@/views/marketingManagement/marketingPushStrategy/components/messageType";
import { MessageTypeEnum } from "@/views/marketingManagement/marketingPushStrategy/constant";
export default {
name: "",
components: {
MessageType,
},
props: {
propPrefix: {
type: String,
default: "",
},
title: {
type: String,
default: "动作",
},
// options.triggers = [] 动作触发条件
// options.messageVariables = [] 消息变量选项
options: {
type: Object,
default: () => ({}),
},
item: {
type: Object,
required: true,
},
},
data() {
return {
tempSelect: undefined,
tempRadio: 1,
temp: {
messageType: 1,
},
};
},
computed: {
},
mounted() {
},
methods: {
validateMessageType(rule, value, callback) {
if (!String(this.item.messageType)) {
callback(new Error("请选择消息类型"));
}
if (this.item.messageType === MessageTypeEnum.VARIABLE_TEXT) {
if (!this.item.content) {
callback(new Error("请输入消息内容"));
}
}
if (this.item.messageType === MessageTypeEnum.VARIABLE_IMAGE) {
if (!this.item.medias) {
callback(new Error("请上传消息图片"));
}
if (!this.item.medias.length) {
callback(new Error("请上传消息图片"));
}
}
if (this.item.messageType === MessageTypeEnum.VARIABLE_VIDEO) {
if (!this.item.medias) {
callback(new Error("请上传消息视频"));
}
if (!this.item.medias.length) {
callback(new Error("请上传消息视频"));
}
}
if (this.item.messageType === MessageTypeEnum.VARIABLE_WEBPAGE) {
if (!this.item.pageTitle || !this.item.pageDesc || !this.item.bgColor) {
callback(new Error("请编辑网页内容"));
}
if (!this.item.materialJson) {
callback(new Error("网页内容的素材不可为空"));
}
if (!this.item.materialJson.length) {
callback(new Error("网页内容的素材不可为空"));
}
if (!String(this.item.intervalPx)) {
callback(new Error("请编辑网页内容"));
}
}
callback();
},
handleActionTypeChange(e) {
this.$emit("input", { ...this.item, actionType: e });
},
handleMessageTypeChange(e) {
this.$emit("input", e);
},
handleRemoveActions() {
this.$emit("remove");
},
},
};
</script>
<style scoped lang="scss">
.actions-item-wrapper {
border-radius: 8px;
border: 1px solid #e5e5e5;
padding: 16px 16px;
> .title-wrapper {
font-style: Bold;
font-size: 14px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
> .title {
line-height: 16px;
}
.del-button {
border-style: dashed;
background: white;
transition: background-color 200ms;
&:hover {
background: #fef0f0;
color: #f56c6c;
}
}
}
}
</style>
<template>
<div class="branch-group-wrapper">
<BranchItem v-for="(branch, index) in list"
:key="branch._key"
:branch="branch"
:options="{
messageVariables,
triggers,
conditionVariables,
}"
:prop-prefix="`${propPrefix}[${index}]`"
:title="`分支${index + 1}`"
@appendAction="handleAppendAction(index)"
@input="handleBranchChange($event, index)"
@removeAction="handleRemoveAction($event, index)"
@removeBranch="handleRemoveBranch(index)"
@update:conditionGroups="handleBranchConditionChange($event, index)" />
<el-button class="append-btn"
block
@click="handleAppendBranch">
<i class="el-icon-plus "></i>
添加分支
</el-button>
</div>
</template>
<script>
import BranchItem from "@/views/marketingManagement/marketingPushStrategy/components/branchItem/index.vue";
import { getDefaultAction, getDefaultBranch } from "@/views/marketingManagement/marketingPushStrategy/constant";
export default {
name: "",
components: {
BranchItem,
},
model: {
prop: "list",
event: "input",
},
props: {
propPrefix: {
type: String,
default: "",
},
list: {
type: Array,
default: () => ([]),
},
messageVariables: {
type: Array,
default: () => ([]),
},
conditionVariables: {
type: Array,
default: () => ([]),
},
triggers: {
type: Array,
default: () => ([]),
},
},
data() {
return {
};
},
computed: {
},
mounted() {
},
methods: {
handleBranchConditionChange({ conditionGroups }, branchIndex) {
const newList = JSON.parse(JSON.stringify(this.list));
newList[branchIndex].conditionGroups = conditionGroups;
this.$emit("input", newList);
},
handleRemoveAction(actionIndex, branchIndex) {
const newList = JSON.parse(JSON.stringify(this.list));
newList[branchIndex].actions.splice(actionIndex, 1);
this.$emit("input", newList);
},
handleAppendBranch() {
const newList = JSON.parse(JSON.stringify(this.list));
console.log(newList.length);
newList.push(getDefaultBranch(newList.length));
this.$emit("input", newList);
},
handleRemoveBranch(branchIndex) {
const newList = JSON.parse(JSON.stringify(this.list));
newList.splice(branchIndex, 1);
this.$emit("input", newList);
},
handleAppendAction(branchIndex) {
const newList = JSON.parse(JSON.stringify(this.list));
newList[branchIndex].actions.push(getDefaultAction());
this.$emit("input", newList);
},
handleBranchChange({ actionIndex, actionItem }, branchIndex) {
const newList = JSON.parse(JSON.stringify(this.list));
newList[branchIndex].actions[actionIndex] = actionItem;
this.$emit("input", newList);
},
},
};
</script>
<style scoped lang="scss">
.branch-group-wrapper {
.branch-item-wrapper {
margin-top: 20px;
&:first-child {
margin-top: 0;
}
}
.append-btn {
width: 100%;
margin-top: 20px;
}
}
</style>
<template>
<div class="branch-item-wrapper">
<div class="title-wrapper">
<span class="title">{{ title }}</span>
<el-button class="del-button"
icon="el-icon-delete"
size="small"
type="danger"
plain
@click="handleRemoveBranch">
删除分支
</el-button>
</div>
<div class="container-wrapper">
<el-form-item label="满足条件时执行:"
label-width="150px"
required
:prop="`${propPrefix}.conditionGroups`"
:rules="[{ required: true, message: '请选择条件组', trigger: 'change', type: 'array', min: 1 }]">
<ConditionPanel :condition-variables-options="options.conditionVariables"
:list="branch.conditionGroups"
@change="handleBranchConditionChange"
@input="handleBranchConditionInput" />
</el-form-item>
<div class="tips">
按顺序执行以下动作
</div>
<div class="actions-list-wrapper">
<Actions v-for="(action, index) in branch.actions"
:key="action._key"
:item="action"
:options="options"
:prop-prefix="`${propPrefix}.actions[${index}]`"
:title="`动作${index + 1}`"
@input="handleActionChange($event, index)"
@remove="handleRemoveActions(index)" />
<div class="actions-list-foot-wrapper">
<el-button @click="handleAppendAction">
添加动作
</el-button>
</div>
</div>
</div>
</div>
</template>
<script>
import Actions from "@/views/marketingManagement/marketingPushStrategy/components/actionsItem/index.vue";
import ConditionPanel from "@/views/marketingManagement/marketingPushStrategy/components/conditionPanel/index.vue";
export default {
name: "",
components: {
Actions,
ConditionPanel,
},
inject: ["elForm"],
props: {
propPrefix: {
type: String,
default: "",
},
title: {
type: String,
default: "条件组",
},
// options.triggers 动作触发条件
// options.messageVariables 消息变量选项
// options.conditionVariables 条件变量选项
options: {
type: Object,
default: () => ({}),
},
branch: {
type: Object,
required: true,
},
},
data() {
return {
conditionList: [],
};
},
computed: {
},
mounted() {
},
methods: {
handleBranchConditionChange() {
this.elForm?.validateField(`${this.propPrefix}.conditionGroups`);
},
handleRemoveBranch() {
this.$emit("removeBranch");
},
handleAppendAction() {
this.$emit("appendAction");
},
handleRemoveActions(actionIndex) {
this.$emit("removeAction", actionIndex);
},
handleActionChange(e, actionIndex) {
this.$emit("input", { actionItem: e, actionIndex });
},
handleBranchConditionInput(e) {
this.$emit("update:conditionGroups", { conditionGroups: e });
},
},
};
</script>
<style scoped lang="scss">
.branch-item-wrapper {
border-radius: 8px;
overflow: hidden;
border: 1px solid #0000001a;
> .title-wrapper {
padding: 10px 16px;
font-style: Bold;
font-size: 14px;
display: flex;
align-items: center;
justify-content: space-between;
background-color: #f5f6fa;
> .title {
line-height: 16px;
}
.del-button {
border-style: dashed;
background: white;
transition: background-color 200ms;
&:hover {
background: #fef0f0;
color: #f56c6c;
}
}
}
> .container-wrapper {
padding: 20px;
> .tips {
font-weight: 700;
font-style: Bold;
font-size: 14px;
color: #333;
line-height: 16px;
}
.actions-list-wrapper {
margin-top: 20px;
.actions-item-wrapper {
margin-top: 20px;
&:first-child {
margin-top: 0;
}
}
}
.actions-list-foot-wrapper {
margin-top: 20px;
}
}
}
</style>
<template>
<div class="condition-container-wrapper">
<el-form-item label-width="0">
<el-form-item label-width="0"
:prop="`${propPrefix}.variableCode`"
:rules="[
{ required: true, message: '请选择变量', trigger: 'change' },
]">
<el-select placeholder="请选择变量"
style="width:212px"
:value="item.variableCode"
......@@ -12,8 +16,12 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label-width="0">
<el-select placeholder="请选择"
<el-form-item label-width="0"
:prop="`${propPrefix}.operator`"
:rules="[
{ required: true, message: '请选择操作符', trigger: 'change' },
]">
<el-select placeholder="请选择操作符"
style="width:160px"
:disabled="!item.variableCode"
:value="item.operator"
......@@ -26,19 +34,25 @@
</el-select>
</el-form-item>
<el-form-item label-width="0">
<el-radio-group :value="item.valueSource" @input="handleValueSource">
<el-radio-button :label="0">
<el-form-item label-width="0" :prop="`${propPrefix}.valueSource`">
<el-radio-group style="width:98px"
:value="item.valueSource"
@input="handleValueSource">
<el-radio-button :label="enums.conditionVariableSourceTypeEnum.VARIABLE">
变量
</el-radio-button>
<el-radio-button :label="1">
<el-radio-button :label="enums.conditionVariableSourceTypeEnum.VALUE">
值
</el-radio-button>
</el-radio-group>
</el-form-item>
<template v-if="item.valueSource === 0">
<el-form-item label-width="0">
<template v-if="item.valueSource === enums.conditionVariableSourceTypeEnum.VARIABLE">
<el-form-item label-width="0"
:prop="`${propPrefix}.variableRefCode`"
:rules="[
{ required: true, message: '请选择变量', trigger: 'change' },
]">
<el-select placeholder="请选择"
style="width:212px"
:disabled="!item.variableCode"
......@@ -52,45 +66,71 @@
</el-select>
</el-form-item>
</template>
<template v-if="item.valueSource === 1">
<template v-if="item.valueSource === enums.conditionVariableSourceTypeEnum.VALUE">
<!-- 默认 -->
<el-form-item v-if="![1, 2, 3, 4].includes(getCurrentVariable.variableType)" label-width="0">
<el-form-item v-if="![
enums.conditionVariableTypeEnum.TEXT,
enums.conditionVariableTypeEnum.NUMBER,
enums.conditionVariableTypeEnum.DATE,
enums.conditionVariableTypeEnum.ENUM,
].includes(getCurrentVariable.variableType)"
label-width="0">
<el-input placeholder="请先选择变量"
style="width:212px"
disabled>
</el-input>
</el-form-item>
<!-- 文字类型 -->
<el-form-item v-if="getCurrentVariable.variableType === 1" label-width="0">
<el-form-item v-if="getCurrentVariable.variableType === enums.conditionVariableTypeEnum.TEXT"
label-width="0"
:prop="`${propPrefix}.textValue`"
:rules="[
{ required: true, message: '请输入文字值', trigger: 'change' },
]">
<el-input style="width:212px"
:value="item.valueText"
:value="item.textValue"
@input="handleTextInput">
</el-input>
</el-form-item>
<!-- 数字类型 -->
<el-form-item v-if="getCurrentVariable.variableType === 2" label-width="0">
<el-form-item v-if="getCurrentVariable.variableType === enums.conditionVariableTypeEnum.NUMBER"
label-width="0"
:prop="`${propPrefix}.numberValue`"
:rules="[
{ required: true, message: '请输入数值', trigger: 'change' },
]">
<el-input-number placeholder="请输入数值"
style="width:212px;"
:controls="false"
:value="item.valueNumber"
:value="item.numberValue"
@change="handleNumberChange">
</el-input-number>
</el-form-item>
<!-- 日期类型 -->
<el-form-item v-if="getCurrentVariable.variableType === 3" label-width="0">
<el-date-picker placeholder="选择日期"
<el-form-item v-if="getCurrentVariable.variableType === enums.conditionVariableTypeEnum.DATE"
label-width="0"
:prop="`${propPrefix}.dateValue`"
:rules="[
{ required: true, message: '请选择日期', trigger: 'change' },
]">
<el-date-picker placeholder="请选择日期"
style="width:212px"
type="date"
value-format="yyyy-MM-DD"
:value="item.valueDate"
:value="item.dateValue"
@input="handleDateChange">
</el-date-picker>
</el-form-item>
<!-- 枚举类型 -->
<el-form-item v-if="getCurrentVariable.variableType === 4" label-width="0">
<el-select placeholder="请先选择变量"
<el-form-item v-if="getCurrentVariable.variableType === enums.conditionVariableTypeEnum.ENUM"
label-width="0"
:prop="`${propPrefix}.enumValue`"
:rules="[
{ required: true, message: '请选择枚举值', trigger: 'change' },
]">
<el-select placeholder="请先选择枚举值"
style="width:212px"
:value="item.valueEnumCode"
:value="item.enumValue"
@change="handleEnumChange">
<el-option v-for="opt in getVariableEnumOptions"
:key="opt.enumCode"
......@@ -113,6 +153,8 @@
</template>
<script>
import { ConditionVariableSourceTypeEnum, ConditionVariableTypeEnum } from "@/views/marketingManagement/marketingPushStrategy/constant/index.js";
export default {
name: "",
model: {
......@@ -120,6 +162,10 @@ export default {
event: "input",
},
props: {
propPrefix: {
type: String,
default: "",
},
options: {
type: Object,
default: () => ({
......@@ -133,6 +179,10 @@ export default {
},
data() {
return {
enums: {
conditionVariableSourceTypeEnum: ConditionVariableSourceTypeEnum,
conditionVariableTypeEnum: ConditionVariableTypeEnum,
},
};
},
......@@ -173,38 +223,51 @@ export default {
},
handleVariableChange(val) {
// 只要切换一个, 子级全清
// variableType
const variable = this.options.conditionVariables.find(item => item.variableCode === val);
this.$emit("input", {
...this.item,
variableCode: val,
variableType: variable?.variableType,
operator: undefined,
valueSource: 0,
variableRefCode: undefined,
valueText: undefined,
valueNumber: undefined,
valueDate: undefined,
valueEnumCode: undefined,
textValue: undefined,
numberValue: undefined,
enumValue: undefined,
dateValue: undefined,
});
},
handleOperatorChange(val) {
this.updateItem("operator", val);
},
handleValueSource(val) {
this.updateItem("valueSource", val);
// 切换, 清子级
// variableType
this.$emit("input", {
...this.item,
valueSource: val,
variableRefCode: undefined,
textValue: undefined,
numberValue: undefined,
enumValue: undefined,
dateValue: undefined,
});
},
handleVariableRefCodeChange(val) {
this.updateItem("variableRefCode", val);
},
handleTextInput(val) {
this.updateItem("valueText", val);
this.updateItem("textValue", val);
},
handleNumberChange(val) {
this.updateItem("valueNumber", val);
this.updateItem("numberValue", val);
},
handleDateChange(val) {
this.updateItem("valueDate", val);
this.updateItem("dateValue", val);
},
handleEnumChange(val) {
this.updateItem("valueEnumCode", val);
this.updateItem("enumValue", val);
},
},
};
......@@ -214,9 +277,14 @@ export default {
.condition-container-wrapper {
display: flex;
align-items: center;
flex: 1 0 0;
overflow: hidden;
> .el-form-item {
flex: 0 0 auto;
flex-shrink: 0;
flex-basis: 0;
margin-right: 8px;
::v-deep .el-input-number {
.el-input__inner {
text-align: left;
......@@ -224,10 +292,6 @@ export default {
}
}
> .el-form-item + .el-form-item {
margin-left: 8px;
}
.del-button {
transition: color 200ms;
......
<template>
<div class="">
<el-form class="condition-form-wrapper" size="small">
<div class="condition-group-wrapper">
<el-form ref="ConditionFormRef"
class="condition-form-wrapper"
size="small"
:hide-required-asterisk="false"
:model="formModel">
<template v-for="(item, index) in list">
<div :key="item._key" class="condition-item">
<el-divider v-if="index !== 0">
<el-divider v-if="index !== 0" class="divider-wrapper">
<div class="divider-content">
或
</div>
</el-divider>
<ConditionItem :conditions="list[index].conditions"
:options="options"
:prop-prefix="`list[${index}]`"
:title="`条件组${index + 1}`"
@appendCondition="handleAppendCondition(index)"
@input="handleUpdate(index, $event)"
@removeCondition="handleRemoveCondition($event, index)"
@removeConditionGroup="handleRemoveConditionGroup(index)" />
</div>
</template>
<div class="footer-wrapper">
<el-button class="append-button" @click="handleAppendConditionGroup">
<el-button class="append-button"
icon="el-icon-plus"
@click="handleAppendConditionGroup">
添加条件组
</el-button>
</div>
</el-form>
</div>
</template>
......@@ -38,43 +43,61 @@ export default {
components: {
ConditionItem,
},
model: {
prop: "list",
event: "input",
},
props: {
list: {
type: Array,
default: () => [getDefaultConditionGroup()],
},
// options.conditionVariables
options: {
type: Object,
default: () => ({}),
},
},
data() {
return {
list: [
getDefaultConditionGroup(),
],
};
},
computed: {
formModel() {
return { list: this.list };
},
},
mounted() {
console.log("123");
this.$refs.ConditionFormRef?.resetFields();
},
methods: {
handleUpdate(groupIndex, { conditionItem, conditionIndex }) {
this.$set(this.list[groupIndex].conditions, conditionIndex, conditionItem);
const newList = this.list.map(group => ({
...group,
conditions: [...group.conditions],
}));
newList[groupIndex].conditions[conditionIndex] = conditionItem;
this.$emit("input", newList);
},
handleAppendConditionGroup() {
this.list.push(getDefaultConditionGroup());
this.$emit("input", [...this.list, getDefaultConditionGroup()]);
},
handleRemoveConditionGroup(groupIndex) {
this.list.splice(groupIndex, 1);
this.$emit("input", this.list.filter((_, i) => i !== groupIndex));
},
handleAppendCondition(groupIndex) {
this.list[groupIndex].conditions.push(getDefaultCondition());
const newList = this.list.map(group => ({
...group,
conditions: [...group.conditions],
}));
newList[groupIndex].conditions.push(getDefaultCondition());
this.$emit("input", newList);
},
handleRemoveCondition({ conditionIndex }, groupIndex) {
this.list[groupIndex].conditions.splice(conditionIndex, 1);
const newList = this.list.map(group => ({
...group,
conditions: [...group.conditions],
}));
newList[groupIndex].conditions.splice(conditionIndex, 1);
this.$emit("input", newList);
},
},
......@@ -82,9 +105,13 @@ export default {
</script>
<style scoped lang="scss">
.condition-group-wrapper {
width: 100%;
overflow: hidden;
}
.condition-form-wrapper {
::v-deep .el-form-item {
margin-bottom: 0px;
margin-bottom: 14px;
&.action-form-item {
margin-bottom: 0;
}
......@@ -93,6 +120,12 @@ export default {
text-align: center;
.append-button {
border-style: dashed;
width: 100%;
line-height: 40px;
padding-top: 0;
padding-bottom: 0;
border-radius: 4px;
margin-top: 20px;
}
}
......@@ -102,10 +135,20 @@ export default {
margin-top: 0;
}
}
.divider-content {
border-radius: 4px;
padding: 2px 6px;
border: 1px solid rgb(217, 217, 217);
.divider-wrapper {
background-color: #e5e5e5;
margin: 26px 0;
::v-deep .el-divider__text {
padding: 0 8px;
}
.divider-content {
border-radius: 20px;
padding: 0px 16px;
font-size: 14px;
line-height: 24px;
background-color: #f5f7fa;
color: #2a58ad;
}
}
}
</style>
......@@ -16,15 +16,18 @@
<div v-for="(item, index) in conditions"
:key="item._key"
class="condition-item">
<div v-if="index !== 0" class="divider-content">
且
</div>
<el-divider v-if="index !== 0" class="divider-wrapper">
<div class="divider-content">
且
</div>
</el-divider>
<div class="condition-row">
<div class="title">
条件{{ index + 1 }}
</div>
<ConditionContainer :item="conditions[index]"
:options="options"
:prop-prefix="`${propPrefix}.conditions[${index}]`"
@input="handleUpdateCondition($event, index)"
@remove="handleRemoveCondition(index)">
</ConditionContainer>
......@@ -63,6 +66,10 @@ export default {
type: Object,
default: () => ({}),
},
propPrefix: {
type: String,
default: "",
},
conditions: {
type: Array,
required: true,
......@@ -99,14 +106,20 @@ export default {
.condition-container-list {
padding-top: 8px;
.condition-item {
width: 100%;
overflow: hidden;
.condition-row {
display: flex;
align-items: center;
margin-bottom: 12px;
width: 100%;
overflow: hidden;
> .title {
font-weight: 400;
font-size: 14px;
margin-right: 8px;
white-space: nowrap;
width: 4em;
margin-bottom: 14px;
}
}
}
......@@ -142,13 +155,20 @@ export default {
}
}
}
.divider-content {
display: inline-block;
border-radius: 4px;
padding: 2px 6px;
border: 1px solid rgb(217, 217, 217);
font-size: 12px;
margin-bottom: 12px;
.divider-wrapper {
background-color: #e5e5e5;
margin: 10px 0 24px;
::v-deep .el-divider__text {
padding: 0 8px;
}
.divider-content {
border-radius: 20px;
border: 1px solid #e5e5e5;
padding: 0px 8px;
font-size: 14px;
line-height: 24px;
color: #999;
}
}
}
</style>
<template>
<div class="condition-panel-wrapper">
<template v-if="list.length <= 0 ">
<el-button icon="el-icon-plus"
plain
@click="handleShowConditionGroup">
设置条件规则
</el-button>
</template>
<div v-else class="text-panel">
<ConditionTextPanel :condition-list="list" :condition-variables="conditionVariablesOptions" />
<div class="action-wrapper">
<el-button type="text" @click="handleShowConditionGroup">
重新编辑
</el-button>
<el-button class="red-btn"
type="text"
@click="handleClearCondition">
清除
</el-button>
</div>
</div>
<el-drawer custom-class="step2-condition-group-drawer"
size="880px"
title="设置条件规则"
append-to-body
:visible.sync="dialog.step2ConditionGroup.show"
:wrapper-closable="false">
<div class="drawer-content">
<ConditionGroup v-if="dialog.step2ConditionGroup.show"
ref="ConditionGroupRef"
v-model="dialog.step2ConditionGroup.conditionCache"
:options="{ conditionVariables: conditionVariablesOptions }" />
</div>
<div class="footer-wrapper">
<el-button size="small" @click="handleCloseConditionGroup">
取消
</el-button>
<el-button size="small"
type="primary"
@click="handleConfirmConditionGroup">
确认
</el-button>
</div>
</el-drawer>
</div>
</template>
<script>
import { cloneDeep } from "lodash-es";
import { getDefaultConditionGroup } from "@/views/marketingManagement/marketingPushStrategy/components/conditionGroup/constant.js";
import ConditionGroup from "@/views/marketingManagement/marketingPushStrategy/components/conditionGroup/index.vue";
import ConditionTextPanel from "@/views/marketingManagement/marketingPushStrategy/components/conditionTextyPanel/index.vue";
export default {
name: "ConditionPanel",
components: {
ConditionGroup,
ConditionTextPanel,
},
model: {
prop: "list",
event: "input",
},
props: {
conditionVariablesOptions: {
type: Array,
default: () => ([]),
},
list: {
type: Array,
default: () => ([]),
},
},
data() {
return {
dialog: {
step2ConditionGroup: {
show: false,
conditionCache: {},
},
},
};
},
computed: {
},
mounted() {
},
methods: {
handleClearCondition() {
this.$emit("input", []);
this.$emit("change", []);
},
handleShowConditionGroup() {
this.dialog.step2ConditionGroup.show = true;
this.dialog.step2ConditionGroup.conditionCache = cloneDeep(this.list);
if (this.dialog.step2ConditionGroup.conditionCache.length === 0) {
this.dialog.step2ConditionGroup.conditionCache.push(getDefaultConditionGroup());
}
},
handleCloseConditionGroup() {
this.dialog.step2ConditionGroup.show = false;
this.dialog.step2ConditionGroup.conditionCache = [];
},
async handleConfirmConditionGroup() {
const ConditionGroupRef = this.$refs.ConditionGroupRef;
if (!ConditionGroupRef) {
return;
}
const ConditionFormRef = ConditionGroupRef.$refs.ConditionFormRef;
if (!ConditionFormRef) {
return;
}
await ConditionFormRef.validate();
// 校验不通过不会往下执行
const condition = cloneDeep(this.dialog.step2ConditionGroup.conditionCache);
this.$emit("input", condition);
this.$emit("change", condition);
this.handleCloseConditionGroup();
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-drawer__header {
font-weight: 600;
font-size: 16px;
line-height: 22px;
padding: 20px;
margin-bottom: 0;
border-bottom: 1px solid #e5e5e5;
color: #333;
}
::v-deep .el-drawer__body {
overflow: hidden;
flex-shrink: 0;
flex-basis: 0;
display: flex;
flex-direction: column;
justify-content: space-between;
.drawer-content {
padding: 20px;
width: 100%;
flex: 1 0 0;
overflow-y: auto;
overflow-x: hidden;
position: relative;
box-sizing: border-box;
.condition-group-wrapper {
width: 100%;
overflow: hidden;
}
&::after {
content: "";
display: block;
height: 1px;
}
}
> .footer-wrapper {
width: 100%;
display: flex;
justify-content: flex-end;
padding: 20px;
border-top: 1px solid #e5e5e5;
}
}
.condition-panel-wrapper {
display: inline-block;
max-width: 400px;
overflow-x: auto;
}
.text-panel {
> .action-wrapper {
text-align: right;
.red-btn {
color: #eb4e4e;
transition: color 200ms;
&:hover {
color: #f05a5a;
}
&:active {
color: #c54242;
}
}
}
}
</style>
<template>
<div class="condition-text-panel-wrapper">
<div v-for="(conditionGroup, conditionGroupIndex) in list"
:key="conditionGroup.id || conditionGroup._key"
class="condition-group-text-wrapper">
<div v-for="(condition, conditionIndex) in conditionGroup.conditions"
:key="condition.id || condition._key"
class="condition-item-text-wrapper"
style="margin-left:14px">
<div>
<span>
{{ condition.variableName }}
</span>
<span>
{{ condition.operatorName }}
</span>
<span>
{{ condition.valueLabel }}
</span>
</div>
<div v-if="conditionGroup.conditions.length > 1 && conditionIndex !== conditionGroup.conditions.length - 1"
style="margin-top:4px;margin-bottom:4px;padding-left:8px;color:#999999 ">
且
</div>
</div>
<div v-if="list.length > 1 && conditionGroupIndex !== list.length - 1"
style="margin-left:4px;margin-top:8px;margin-bottom:8px;color:#F59619">
或
</div>
</div>
</div>
</template>
<script>
import { cloneDeep, isArray } from "lodash-es";
import { ConditionVariableSourceTypeEnum, ConditionVariableTypeEnum } from "@/views/marketingManagement/marketingPushStrategy/constant/index.js";
export default {
name: "",
props: {
conditionList: {
type: Array,
default: () => ([]),
},
conditionVariables: {
type: Array,
default: () => ([]),
},
},
data() {
return {
list: [],
};
},
computed: {
},
watch: {
conditionList: {
handler(newVal, oldVal) {
if (!isArray(this.conditionList)) {
return;
}
const list = cloneDeep(this.conditionList);
for (const group of list) {
for (const condition of group.conditions) {
const option = this.conditionVariables.find(item => item.variableCode === condition.variableCode);
console.log("option", option);
const operator = option.operators.find(item => item.code === condition.operator);
if (option) {
condition.variableName = option.variableName;
condition.operatorName = operator.name;
if (condition.valueSource === ConditionVariableSourceTypeEnum.VARIABLE) {
const variableOption = option.sopConditionVariableDTOList.find(item => item.variableCode === condition.variableRefCode);
condition.valueLabel = variableOption?.variableName || "-";
} else {
condition.valueLabel = condition.numberValue ?? (condition.textValue || condition.dateValue || condition.enumValue);
}
}
}
}
this.list = list;
},
immediate: true,
deep: true,
},
},
mounted() {
},
methods: {
},
};
</script>
<style scoped lang="scss">
.red-btn {
color: #eb4e4e;
}
.condition-text-panel-wrapper {
background-color: #f5f7fa;
padding: 16px;
border-radius: 8px;
.condition-group-text-wrapper {
font-size: 12px;
line-height: 14px;
}
}
</style>
<template>
<div class="">
<div>
<el-radio-group :value="item.messageType" @input="handleMessageTypeChange">
<el-radio :label="MessageTypeEnum.VARIABLE_TEXT">
文本
</el-radio>
<el-radio :label="MessageTypeEnum.VARIABLE_IMAGE">
图片
</el-radio>
<el-radio :label="MessageTypeEnum.VARIABLE_VIDEO">
视频
</el-radio>
<el-radio :label="MessageTypeEnum.VARIABLE_WEBPAGE">
网页
</el-radio>
</el-radio-group>
</div>
<div style="margin-top:14px">
<div v-if="item.messageType === MessageTypeEnum.VARIABLE_TEXT" class="type-item">
<VariableTextarea style="width:580px"
:value="item.content"
:variable-list="messageVariables"
@input="handleContentChange" />
</div>
<div v-if="item.messageType === MessageTypeEnum.VARIABLE_IMAGE" class="type-item">
<VenusOssUpload :key="item.messageType"
v-model="fileList"
type="image"
@change="(urls, _currentUrl, _currentName, names, sizes) => handleMediasChange(urls, names, sizes, 1)" />
</div>
<div v-if="item.messageType === MessageTypeEnum.VARIABLE_VIDEO" class="type-item">
<VenusOssUpload :key="item.messageType"
v-model="fileList"
type="video"
:file-size="50"
@change="(urls, _currentUrl, _currentName, names, sizes) => handleMediasChange(urls, names, sizes, 2)" />
</div>
<div v-if="item.messageType === MessageTypeEnum.VARIABLE_WEBPAGE" class="type-item">
<el-button size="mini"
plain
@click="handleShowPageConfig">
编辑
</el-button>
</div>
</div>
<VenusDialog v-model="dialog.page.show"
title="编辑网页内容"
width="1060px"
:close-on-click-modal="false"
@close="handleClosePageConfig"
@confirm="handleConfirmPageConfig">
<PageConfig v-if="dialog.page.show"
ref="PageConfig"
v-model="itemCache" />
</VenusDialog>
</div>
</template>
<script>
import { cloneDeep, last } from "lodash-es";
import VenusDialog from "@/components/venusDialog";
import VenusOssUpload from "@/components/venusOssUpload";
import { MessageTypeEnum } from "@/views/marketingManagement/marketingPushStrategy/constant";
import PageConfig from "../pageConfig/index.vue";
import VariableTextarea from "../variableTextarea";
export default {
name: "",
components: {
VariableTextarea,
VenusOssUpload,
VenusDialog,
PageConfig,
},
model: {
prop: "item",
event: "input",
},
props: {
item: {
type: Object,
required: true,
},
messageVariables: {
type: Array,
default: () => ([]),
},
},
data() {
return {
fileList: [],
itemCache: undefined,
MessageTypeEnum,
dialog: {
page: {
show: false,
},
},
};
},
computed: {
},
watch: {
"item.medias": {
immediate: true,
handler(newVal) {
if (MessageTypeEnum.VARIABLE_IMAGE === this.item.messageType) {
this.fileList = (newVal || []).filter(item => item.mediaType === 1).map(item => item.mediaUrl);
}
if (MessageTypeEnum.VARIABLE_VIDEO === this.item.messageType) {
this.fileList = (newVal || []).filter(item => item.mediaType === 2).map(item => item.mediaUrl);
}
},
},
},
mounted() {
},
methods: {
handleShowPageConfig() {
this.dialog.page.show = true;
this.itemCache = cloneDeep(this.item);
},
handleClosePageConfig() {
this.dialog.page.show = false;
this.itemCache = {};
},
async handleConfirmPageConfig() {
const PageConfigRef = this.$refs.PageConfig;
if (!PageConfigRef) {
return;
}
const pageConfigFormRef = PageConfigRef.$refs.PageConfigFromRef;
if (!pageConfigFormRef) {
return;
}
await pageConfigFormRef.validate();
this.$emit("input", this.itemCache);
await this.$nextTick();
this.handleClosePageConfig();
},
handleMediasChange(urls, names, sizes, mediaType) {
this.$emit("input", { ...this.item, medias: urls.map((item, index) => ({
mediaType,
mediaName: names[index],
mediaUrl: item,
sortNo: index,
})) });
},
handleMessageTypeChange(e) {
this.fileList = [];
this.$emit("input", {
...this.item,
messageType: e,
content: "",
medias: [],
pageTitle: "",
pageDesc: "",
bgColor: "#ffffff",
materialJson: [],
intervalPx: 0,
});
},
handleContentChange(e) {
this.$emit("input", { ...this.item, content: e });
},
handlePageConfigChange(e) {
this.$emit("input", e);
},
},
};
</script>
<style scoped lang="scss">
</style>
const EMPTY_TEXT = "-";
function getValue(value) {
if (value === 0)
return 0;
return value || EMPTY_TEXT;
}
function flattenConditions(conditionGroups) {
if (!Array.isArray(conditionGroups))
return [];
return conditionGroups.reduce((list, group) => {
const conditions = Array.isArray(group.conditions) ? group.conditions : [];
return list.concat(conditions.map(item => item.conditionDesc).filter(Boolean));
}, []);
}
function parseMaterials(materialJson) {
if (!materialJson)
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 [];
}
}
export function getBasicRows(info = {}) {
const basicInfo = info.basicInfo || {};
return [
{ label: "策略名称", value: getValue(basicInfo.strategyName) },
{ label: "适用场景", value: getValue(basicInfo.bizTypeName) },
{ label: "适用门店", value: getValue(basicInfo.storeDescription || basicInfo.storeScopeDesc) },
{ label: "营销阶段", value: getValue(basicInfo.marketingStageName) },
];
}
export function getCustomerRows(info = {}) {
const customerInfo = info.customerInfo || {};
return [
{ label: "所属门店", value: getValue(customerInfo.storeName) },
{ label: "客户名称", value: getValue(customerInfo.customerName) },
{ label: "客户手机号", value: getValue(customerInfo.customerPhone) },
];
}
export function getTriggerRows(info = {}) {
const triggerInfo = info.triggerInfo || {};
const rows = [
{ label: "触发类型", value: getValue(triggerInfo.triggerTypeName) },
{ label: "实际触发时间", value: getValue(triggerInfo.triggerTimeDesc) },
];
const conditionText = flattenConditions(triggerInfo.step2ConditionGroups).join(";");
if (conditionText) {
rows.push({ label: "同时满足以下条件", value: conditionText });
}
rows.push({ label: "动作执行确认", value: getValue(triggerInfo.actionConfirmDesc) });
return rows;
}
export function getBranchBlocks(info = {}) {
const branches = Array.isArray(info.branches) ? info.branches : [];
return branches.map((branch, branchIndex) => {
const conditionText = flattenConditions(branch.conditionGroups).join(";") || "默认分支";
const actions = Array.isArray(branch.actions) ? branch.actions : [];
return {
name: branch.branchName || `分支${branchIndex + 1}`,
conditionText,
actions: actions.map((action, actionIndex) => {
const actionTitle = action.actionTypeName === "发送消息" ? "向客户群发送消息" : getValue(action.actionTypeName);
const rows = [
{ label: "动作", value: getValue(action.actionTypeName) },
{ label: "消息类型", value: getValue(action.messageTypeName) },
{ label: "消息内容", value: getValue(action.content) },
];
if (action.bgColor) {
rows.push({ label: "背景颜色", value: action.bgColor });
}
if (action.intervalPx || action.intervalPx === 0) {
rows.push({ label: "素材间距", value: `${action.intervalPx}px` });
}
return {
name: `动作${actionIndex + 1}`,
title: actionTitle,
rows,
materials: parseMaterials(action.materialJson),
};
}),
};
});
}
<!-- 策略详情弹窗 -->
<template>
<div>
<d2-dialog btn-ok-label="确定"
class="detail"
width="70%"
:is-visible.sync="detailVisible"
:title="title"
@closeDialog="handleDetailClose"
@confirmDialog="handleDetailConfirm">
<div class="strategy-detail-dialog">
<template v-if="hasDetail">
<div class="detail-section">
<div class="detail-section-title">
<span>基础信息</span>
</div>
<div class="detail-section-body">
<p v-for="item in basicRows"
:key="item.label">
<span class="detail-label">{{ item.label }}:</span>{{ item.value }}
</p>
</div>
</div>
<div class="detail-section">
<div class="detail-section-title">
<span>目标客户</span>
</div>
<div class="detail-section-body">
<p v-for="item in customerRows"
:key="item.label">
<span class="detail-label">{{ item.label }}:</span>{{ item.value }}
</p>
</div>
</div>
<div class="detail-section">
<div class="detail-section-title">
<span>触发条件</span>
</div>
<div class="detail-section-body">
<p v-for="item in triggerRows"
:key="item.label">
<span class="detail-label">{{ item.label }}:</span>{{ item.value }}
</p>
</div>
</div>
<div class="detail-section">
<div class="detail-section-title">
<span>执行动作</span>
</div>
<div class="detail-section-body">
<template v-if="branchBlocks.length">
<div v-for="(branch, branchIndex) in branchBlocks"
:key="branch.name"
class="branch-block">
<p>
<span class="detail-label">[分支 {{ branchIndex + 1 }}] 触发条件:</span>{{ branch.conditionText }}
</p>
<div v-for="action in branch.actions"
:key="action.name"
class="action-block">
<p>
<span class="detail-label">{{ action.name }}:</span>{{ action.title }}
</p>
<p v-for="row in action.rows"
:key="row.label">
<span class="detail-label">{{ row.label }}:</span>{{ row.value }}
</p>
<p v-if="action.materials.length">
<span class="detail-label">素材内容:</span>
<span v-for="(material, index) in action.materials"
:key="material.url"
class="material-text">
{{ material.typeName }}:{{ material.url }}<span v-if="index < action.materials.length - 1">;</span>
</span>
</p>
</div>
</div>
</template>
<p v-else>
暂无执行动作
</p>
</div>
</div>
</template>
<el-empty v-else
description="暂无详情数据" />
</div>
</d2-dialog>
</div>
</template>
<script>
import {
getBasicRows,
getBranchBlocks,
getCustomerRows,
getTriggerRows,
} from "./detailFormat";
export default {
name: "DetailDialog",
props: {
title: {
type: String,
default: "查看策略详情",
},
detailVisible: {
type: Boolean,
default: false,
},
detailInfo: {
type: Object,
default: () => ({}),
},
},
data() {
return {
info: {},
};
},
computed: {
hasDetail() {
return Object.keys(this.info).length > 0;
},
basicRows() {
return getBasicRows(this.info);
},
customerRows() {
return getCustomerRows(this.info);
},
triggerRows() {
return getTriggerRows(this.info);
},
branchBlocks() {
return getBranchBlocks(this.info);
},
},
watch: {
detailInfo: {
immediate: true,
deep: true,
handler() {
this.initInfo();
},
},
},
methods: {
initInfo() {
const snapshotInfo = this.detailInfo && this.detailInfo.snapshotInfo;
if (!snapshotInfo) {
this.info = {};
return;
}
this.info = JSON.parse(snapshotInfo);
console.log(this.info, "info---");
},
handleDetailConfirm() {
this.$emit("handleDetailConfirm");
},
handleDetailClose() {
this.$emit("handleDetailClose");
},
},
};
</script>
<style lang="scss">
.strategy-detail-dialog {
max-height: 620px;
overflow-y: auto;
padding-right: 6px;
color: #303133;
font-size: 13px;
.detail-section {
margin-bottom: 18px;
&:last-child {
margin-bottom: 0;
}
}
.detail-section-title {
display: flex;
align-items: center;
margin-bottom: 12px;
font-weight: 700;
color: #303133;
span {
padding-right: 12px;
background: #fff;
white-space: nowrap;
}
&::after {
content: "";
flex: 1;
height: 1px;
background: #ebeef5;
}
}
.detail-section-body {
padding: 14px 16px;
border-radius: 4px;
background: #f5f7fa;
line-height: 24px;
p {
margin: 0 0 6px;
word-break: break-all;
&:last-child {
margin-bottom: 0;
}
}
}
.detail-label {
font-weight: 700;
color: #303133;
}
.branch-block {
margin-top: 18px;
&:first-child {
margin-top: 0;
}
}
.action-block {
margin-top: 8px;
}
.material-text {
display: inline;
}
}
</style>
<!-- 关联门店弹窗 -->
<template>
<div>
<d2-dialog btn-ok-label="确定"
class="record"
width="70%"
:is-visible.sync="recordVisible"
:title="title"
@closeDialog="handleRecordClose"
@confirmDialog="handleRecordConfirm">
<d2-table ref="recordTable"
:before-search-fn="beforeSearchFn"
:get-list-api="getListApi"
:search-form="searchFormSearch"
:table-params="tableParams">
<el-button slot="auth-button"
slot-scope="scope"
type="text"
@click="handleDetail(scope.scope)">
查看策略详情
</el-button>
</d2-table>
</d2-dialog>
<RecordDetailDialog v-if="dialog.detailVisible"
:detail-info="dialog.detailInfo"
:detail-visible="dialog.detailVisible"
@handleDetailClose="handleDetailClose"
@handleDetailConfirm="handleDetailClose">
</RecordDetailDialog>
</div>
</template>
<script>
import { Util } from "@/common/util";
import { recordsStrategy } from "@/views/marketingManagement/marketingPushStrategy/api/index";
import recordDetailDialog from "@/views/marketingManagement/marketingPushStrategy/components/recordDetailDialog/index";
export default {
name: "RecordDialog",
components: {
RecordDetailDialog: recordDetailDialog,
},
props: {
title: {
type: String,
default: "查看执行记录",
},
recordVisible: {
type: Boolean,
default: false,
},
strategyId: {
type: String,
default: "",
},
},
data() {
return {
searchFormSearch: {},
getListApi: recordsStrategy,
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list",
tableOption: true,
tableColumns: [{
label: "执行时间",
prop: "executeTime",
formatter: (cellValue) => {
return Util.dateFormate(cellValue.executeTime, "YYYY-MM-DD HH:mm:ss");
},
}, {
label: "执行结果",
prop: "executeResult",
formatter: (cellValue) => {
const obj = {
1: "成功",
2: "失败",
};
return obj[cellValue.executeResult];
},
}, {
label: "描述",
prop: "errorMessage",
}],
},
dialog: {
detailVisible: false,
detailInfo: {},
},
};
},
mounted() {},
methods: {
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch.strategyId = this.strategyId;
this.searchFormSearch.pageNo = this.$refs.recordTable.page.currentPage || 1;
resolve();
});
},
handleDetailClose() {
this.dialog.detailVisible = !this.dialog.detailVisible;
},
handleDetail(row) {
console.log(row, "row---");
this.handleDetailClose();
this.dialog.detailInfo = row;
},
handleRecordConfirm() {
this.$emit("handleRecordConfirm");
},
handleRecordClose() {
this.$emit("handleRecordClose");
},
},
};
</script>
<style lang="scss">
</style>
<template>
<RelateStoreDialog v-if="relateStoreVisible"
ref="formRelateStore"
page="marketingPushStrategy"
title="选择门店"
:relate-store-visible="relateStoreVisible"
:store-api="getMerchantList"
:store-search-form="storeSearchForm"
:store-selected="storeSelected"
:table-head-items="tableHeadItems"
@handleRelateStoreClose="handleRelateStoreClose"
@handleRelateStoreConfirm="handleRelateStoreConfirm">
<template #default>
<el-row>
<el-form ref="relate"
:inline="true"
:model="storeSearchForm">
<el-form-item label="门店名称:">
<el-input v-model.trim="storeSearchForm.merchantName"
placeholder="门店名称"
clearable
@keydown.native="handleStoreInput" />
</el-form-item>
<el-form-item label="门店商户号:">
<el-input v-model.trim="storeSearchForm.merchantId"
placeholder="门店商户号"
clearable
@keydown.native="handleStoreInput" />
</el-form-item>
<el-button type="primary" @click="handleSearchStore">
搜索
</el-button>
</el-form>
</el-row>
</template>
</RelateStoreDialog>
</template>
<script>
import { getMerchantList } from "@/api/merchant";
import relateStoreDialog from "@/views/goods/grounding/components/relateStoreDialog.vue";
export default {
components: {
RelateStoreDialog: relateStoreDialog,
},
props: {
relateStoreVisible: {
type: Boolean,
default: false,
},
storeSelected: {
type: Array,
default: () => [],
},
},
data() {
return {
getMerchantList,
storeSearchForm: {
merchantName: "",
merchantId: "",
yqMerchantName: "",
yqMerchantId: "",
},
tableHeadItems: ["门店名称", "门店地址", "门店商户号"],
};
},
mounted() { },
methods: {
handleStoreInput(e) {
e.keyCode === 13 && this.handleSearchStore();
},
// 门店搜索
handleSearchStore() {
this.$refs.formRelateStore.handleCurrentChange(1);
},
handleRelateStoreConfirm(selectedData) {
if (!selectedData.length) {
this.$message({
message: "请选择门店",
type: "warning",
showClose: true,
});
return true;
}
// this.formData.merchantGoodsRefList = selectedData;
// // 清空产品信息
// this.clearUpgradeGoods();
// this.relateStoreVisible = false;
this.$emit("handleRelateStoreConfirm", selectedData);
},
handleRelateStoreClose() {
this.$emit("handleRelateStoreClose");
},
},
};
</script>
<style scoped>
</style>
......@@ -11,6 +11,7 @@
<div class="foot-wrapper">
<el-dropdown placement="bottom-start"
style="width:100%"
trigger="click"
@command="handleCommand">
<div class="dropdown-wrapper">
<i class="el-icon-plus "></i>
......@@ -21,7 +22,7 @@
<el-dropdown-menu slot="dropdown"
class="marketing-dropdown-menu"
style="max-height: 400px; overflow: auto;">
<el-dropdown-item v-for="variable in variableList.concat(variableList)"
<el-dropdown-item v-for="variable in variableList"
:key="variable.code"
:command="variable.name">
{{ variable.name }}
......@@ -69,7 +70,6 @@ export default {
const textarea = this.$refs.textareaRef.$el.querySelector("textarea");
const text = this.value || "";
const insertion = `{{${command}}}`;
if (textarea) {
// 在光标位置插入
const start = textarea.selectionStart;
......@@ -82,7 +82,6 @@ export default {
textarea.focus();
});
} else {
// fallback: 追加到末尾
this.$emit("input", text + insertion);
}
},
......
import { nanoid } from "nanoid";
export const actionConfirmOptions = [
{ value: 0, label: "自动执行" },
{ value: 1, label: "需驻店人员确认" },
];
export const MessageTypeEnum = {
VARIABLE_TEXT: 1,
VARIABLE_IMAGE: 2,
VARIABLE_VIDEO: 3,
VARIABLE_WEBPAGE: 4,
};
// 条件的 变量 是 变量 还是值
export const ConditionVariableSourceTypeEnum = {
VARIABLE: 0,
VALUE: 1,
};
export const ConditionVariableTypeEnum = {
TEXT: 1,
NUMBER: 2,
DATE: 3,
ENUM: 4,
};
export const intervalPxOptions = [
{ value: 0, label: "无间隔" },
{ value: 4, label: "4px" },
{ value: 8, label: "8px" },
{ value: 16, label: "16px" },
];
// index: branch 的index
export function getDefaultBranch() {
return {
_key: nanoid(),
conditionGroups: [],
actions: [
getDefaultAction(),
],
};
}
export function getDefaultAction() {
return {
_key: nanoid(),
actionType: undefined,
targetGroupType: 1,
messageType: MessageTypeEnum.VARIABLE_TEXT,
content: "",
medias: [],
pageTitle: undefined,
pageDesc: undefined,
bgColor: undefined,
materialJson: [],
intervalPx: undefined,
};
}
export const bizTypeOpt = [
{ confId: 1, confLabel: "轻改" },
];
export const storeTypeOpt = [
{ confId: 1, confLabel: "指定门店" },
{ confId: 0, confLabel: "不限门店" },
];
export const relativeDateTypeOpt = [
{ code: 0, name: "提前" },
{ code: 1, name: "当天" },
{ code: 2, name: "推后" },
];
// 生成小时选项 00-23
export const hourOptions = Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0"));
// 生成分钟选项 00-59
export const minuteOptions = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0"));
/**
* 将文本中的 {{ code }} 替换为数组中对应 item 的 {{ name }}
* @param {string} text - 包含 {{ code }} 占位符的文本
* @param {Array<{code: string, name: string}>} arr - 映射数组
* @returns {string} 替换后的文本
*/
export function replaceCodeWithName(text, arr) {
return text.replace(/\{\{\s*(\S+?)\s*\}\}/g, (match, code) => {
const item = arr.find(item => item.code === code);
return item ? `{{ ${item.name} }}` : match;
});
}
/**
* 将文本中的 {{ name }} 替换为数组中对应 item 的 {{ code }}
* @param {string} text - 包含 {{ name }} 占位符的文本
* @param {Array<{code: string, name: string}>} arr - 映射数组
* @returns {string} 替换后的文本
*/
export function replaceNameWithCode(text, arr) {
let result = text;
arr.forEach((item) => {
result = result.replace(
new RegExp(`\\{\\{\\s*${escapeRegExp(item.name)}\\s*\\}\\}`, "g"),
`{{ ${item.code} }}`,
);
});
return result;
}
function escapeRegExp(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
import { bizTypeOpt, storeTypeOpt } from "@/views/marketingManagement/marketingPushStrategy/constant";
import { actionConfirmOptions } from "@/views/marketingManagement/marketingPushStrategy/constant/index";
export function getModifySchema() {
return [
{
addHtml: "_label3",
},
{
label: "动作执行确认",
name: "actionConfirmType",
type: "radio",
optionList: actionConfirmOptions,
optionId: "value",
optionLabel: "label",
},
{
labelWidth: "0px",
addHtml: "_branchList",
},
];
}
export const rules = {
strategyName: [
{ required: true, message: "请输入策略名称", trigger: "change" },
],
bizType: [
{ required: true, message: "请选择适用场景", trigger: "change" },
],
storeScopeType: [
{ required: true, message: "请选择适用门店", trigger: "change" },
],
storeIds: [
{
required: true,
validator(rule, value, callback, source) {
if (source.storeScopeType == 0 || (Array.isArray(value) && value.length)) {
callback();
return;
}
callback(new Error("请选择指定门店"));
},
trigger: "change",
},
],
marketingStage: [
{ required: true, message: "请选择营销阶段", trigger: "change" },
],
triggerType: [
{ required: true, message: "请选择触发类型", trigger: "change" },
],
dateVariableType: [
{ required: true, message: "请选择日期时间变量", trigger: "change" },
],
relativeDateType: [
{ required: true, message: "请选择实际触发时间", trigger: "change" },
],
step2ConditionGroups: [
{ required: true, message: "请添加条件", trigger: "change" },
],
};
export function getFormSchema(that, stageOptions) {
return [
{
label: "策略名称",
name: "strategyName",
type: "input",
maxlength: 40,
},
{
label: "适用场景",
name: "bizType",
type: "radio",
optionList: bizTypeOpt,
optionId: "confId",
optionLabel: "confLabel",
},
{
label: "适用门店",
name: "storeScopeType",
type: "radio",
optionList: storeTypeOpt,
optionId: "confId",
optionLabel: "confLabel",
},
{
label: "选择指定门店",
name: "storeIds",
addHtml: "storeIds",
isHide: ({ formModel }) => {
return formModel.storeScopeType === 0;
},
},
{
label: "营销阶段",
name: "marketingStage",
type: "select",
optionList: stageOptions,
optionId: "stageCode",
optionLabel: "stageName",
optionsName: "stages",
suffixSlot: "stageSlot",
changeAttr: (val, schemaItem) => {
const list = schemaItem.optionList.find(item => item.stageCode === val)?.triggerMetaDates || [];
that.setTriggerMetaDateOptions(list);
},
},
];
}
function isDateTimeTrigger(triggerType) {
return triggerType === "DATE_TIME";
}
export function getSpecFormSchema(that, triggers, triggerMetaDates) {
return [
{
label: "触发类型",
name: "triggerType",
type: "select",
optionList: triggers,
optionId: "code",
optionLabel: "name",
},
{
label: "日期时间变量",
name: "dateVariableType",
type: "select",
optionList: triggerMetaDates,
optionId: "code",
optionLabel: "name",
isHide: ({ formModel }) => {
return !isDateTimeTrigger(formModel.triggerType);
},
},
{
label: "实际触发时间",
name: "relativeDateType",
addHtml: "actualTriggerTime",
isHide: ({ formModel }) => {
return !isDateTimeTrigger(formModel.triggerType);
},
},
{
label: "同时满足以下条件",
name: "step2ConditionGroups",
addHtml: "step2ConditionGroups",
rules: [
{ required: true, message: "请添加条件", trigger: "change", type: "array" },
],
isHide: ({ formModel }) => {
return !isDateTimeTrigger(formModel.triggerType);
},
},
];
}
<template>
<div class="wrapper">
<div style="margin-left:30px;padding">
<glsx-combi-form label-width="150px"
:form-data="formSchema"
:form-obj="form"
:form-rules="formRules"
:inline="false">
<template #_branchList>
<el-form label-width="150px" size="small">
<BranchItem v-for="(branch, index) in form.branches"
:key="branch._key"
:branch="branch"
:options="{
messageVariables: options.messageVariables,
triggers: options.triggers,
}"
:title="`分支${index + 1}`"
@appendAction="handleAppendAction(index)"
@input="handleBranchChange($event, index)"
@removeAction="handleRemoveAction($event, index)"
@removeBranch="handleRemoveBranch(index)" />
<el-button block @click="handleAppendBranch">
<i class="el-icon-plus "></i>
添加分支
</el-button>
</el-form>
</template>
</glsx-combi-form>
</div>
<!-- <div class="step3-wrapper">
<div class="title-wrapper">
③ 就执行以下动作
</div>
</div>
<glsx-combi-form default-width="400px"
label-width="150px"
:form-data="formSchema"
:form-obj="form"
:form-rules="formRules">
<template #_label4>
<div>默认执行第一条满足条件规则的分支</div>
</template>
</glsx-combi-form> -->
<!-- <div style="width:800px">
<ConditionGroup style="width:880px;margin:0 0 0 30px;padding-top:30px;"
:options="{
conditionVariables: getStep2ConditionOptions,
}" />
</div> -->
</div>
</template>
<script>
import { nanoid } from "nanoid";
import { getMetaOptions } from "@/views/marketingManagement/marketingPushStrategy/api/index.js";
import BranchItem from "@/views/marketingManagement/marketingPushStrategy/components/branchItem/index.vue";
import ConditionGroup from "@/views/marketingManagement/marketingPushStrategy/components/conditionGroup/index.vue";
import VariableTextarea from "@/views/marketingManagement/marketingPushStrategy/components/variableTextarea/index.vue";
import { getDefaultAction, getDefaultBranch, MessageTypeEnum } from "@/views/marketingManagement/marketingPushStrategy/constant";
import { replaceCodeWithName } from "@/views/marketingManagement/marketingPushStrategy/utils/index.js";
import { getModifySchema } from "./modify.data";
export default {
name: "",
components: {
BranchItem,
ConditionGroup,
VariableTextarea,
},
props: {
},
data() {
return {
test: "123",
form: {
actionConfirmType: 0,
branches: [getDefaultBranch()],
},
formSchema: [],
formRules: {},
options: {
conditionVariables: [],
step2ConditionVariables: [],
stages: [],
triggers: [],
messageVariables: [],
},
};
},
computed: {
getStep2ConditionOptions() {
return this.options.step2ConditionVariables;
},
},
async mounted() {
this.formSchema = await getModifySchema();
await this.getData();
},
methods: {
handleSubmit() {
console.log(this.form);
},
handleRemoveAction(actionIndex, branchIndex) {
this.form.branches[branchIndex].actions.splice(actionIndex, 1);
},
handleAppendBranch() {
this.form.branches.push(getDefaultBranch());
},
handleRemoveBranch(branchIndex) {
this.form.branches.splice(branchIndex, 1);
},
handleAppendAction(branchIndex) {
this.form.branches[branchIndex].actions.push(getDefaultAction());
},
handleBranchChange({ actionIndex, actionItem }, branchIndex) {
this.$set(this.form.branches[branchIndex].actions, actionIndex, actionItem);
},
async getData() {
const data = await getMetaOptions();
Object.assign(this.options, data);
},
},
};
</script>
<style scoped lang="scss">
.wrapper {
background-color: white;
height: 100%;
margin: 0 20px 20px;
::v-deep .branch-item-wrapper {
margin-top: 12px;
&:first-child {
margin-top: 0;
}
}
}
</style>
......@@ -28,7 +28,7 @@
:data="{ operate: 'create' }"
:show-btn-ids="['9221001']" />
</d2-table-header>
<d2-table ref="tmplTable"
<d2-table ref="marketTable"
:before-search-fn="beforeSearchFn"
:get-list-api="getListApi"
:search-form="searchFormSearch"
......@@ -36,9 +36,10 @@
<div slot="status" slot-scope="scope">
<el-switch v-model="scope.scope.status"
active-color="#2A58AD"
active-value="1"
inactive-color="#CCCCCC"
inactive-value="0">
:active-value="1"
:inactive-value="0"
@change="handleChangeStatus(scope.scope)">
</el-switch>
</div>
<auth-button slot="auth-button"
......@@ -47,16 +48,28 @@
</d2-table>
</div>
</d2-container>
<RecordDialog v-if="dialog.recordVisible"
:record-visible="dialog.recordVisible"
:strategy-id="dialog.strategyId"
@handleRecordClose="handleRecordClose"
@handleRecordConfirm="handleRecordClose">
</RecordDialog>
</div>
</template>
<script>
import { getTmplList } from "@api/accountManage";
import { deepClone, Util } from "@/common/util";
import { deleteStrategy, getList } from "@/views/marketingManagement/marketingPushStrategy/api/index";
import reportTrackFunMixin from "@/mixins/reportTrackFunMixin";
import { deleteStrategy, getList, statusStrategy } from "@/views/marketingManagement/marketingPushStrategy/api/index";
import recordDialog from "@/views/marketingManagement/marketingPushStrategy/components/recordDialog/index";
export default {
name: "MarketingPush",
components: {
RecordDialog: recordDialog,
},
mixins: [reportTrackFunMixin], // 导入混入
data() {
return {
userInfo: this.$store.state.d2admin.user.info,
......@@ -80,10 +93,10 @@ export default {
optionList: [],
optionId: "confId",
optionLabel: "confLabel",
optionsName: "",
optionsName: "statusList",
},
],
getListApi: getTmplList,
getListApi: getList,
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list",
......@@ -93,13 +106,13 @@ export default {
prop: "strategyName",
}, {
label: "最近修改时间",
prop: "createTime",
prop: "updatedDate",
formatter: (cellValue) => {
return Util.dateFormate(cellValue.createTime, "YYYY-MM-DD HH:mm:ss");
return Util.dateFormate(cellValue.updatedDate, "YYYY-MM-DD HH:mm");
},
}, {
label: "最近修改人",
prop: "createdBy",
prop: "updatedBy",
}, {
label: "状态",
prop: "status",
......@@ -107,12 +120,25 @@ export default {
addHtml: "status",
}],
},
// 弹窗
dialog: {
recordVisible: false,
strategyId: "",
},
baseData: {
statusList: [{
confId: 1,
confLabel: "启用",
}, {
confId: 0,
confLabel: "停用",
}],
},
};
},
mounted() {
// this.getOptionsList("showFormData");
this.setReportTrackData(0, "sop_strategy_web_menu_entry", {});
this.getOptionsList("showFormData");
},
methods: {
......@@ -124,6 +150,7 @@ export default {
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm);
this.searchFormSearch.pageNo = this.$refs.marketTable.page.currentPage || 1;
resolve();
});
},
......@@ -155,36 +182,56 @@ export default {
},
handleSearch() {
this.$refs.tmplTable.refreshTable(false, true);
this.$refs.marketTable.refreshTable(false, true);
},
handleReset() {
this.searchForm = {
strategyName: "",
status: "",
};
this.$refs.tmplTable.refreshTable(false, true);
this.$refs.marketTable.refreshTable(false, true);
},
// 执行记录
handleRecord(row) {
this.handleRecordClose();
this.dialog.strategyId = (row?.id + "") || "";
},
handleRecordClose() {
this.dialog.recordVisible = !this.dialog.recordVisible;
},
// 新增 / 修改
handleModify(row = {}) {
const editType = row?.id ? "edit" : "add";
this.$router.push({
path: "/marketing-push-strategy/modify",
query: {
editType,
id: row?.id || "",
strategyId: row?.id || "",
},
});
},
handleChangeStatus(row) {
const params = {
strategyId: row.id,
status: row.status,
};
statusStrategy(params).then((res) => {
this.$message.success("操作成功");
this.handleReset();
});
},
handleDelete(row) {
this.$confirm(`确定要删除策略${row.strategyName}吗?`, "删除策略", {
this.$confirm(`确定要删除策略"${row.strategyName}"吗?`, "删除策略", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
const params = { id: row.id };
const params = { strategyId: row.id };
deleteStrategy(params).then((res) => {
this.$message.success("删除成功");
this.$message.success("操作成功");
this.handleReset();
});
}).catch(() => { });
......
......@@ -462,6 +462,11 @@ export default {
type: [Number, String],
default: undefined,
},
/** 客户列表跳转带入的姓名/手机号筛选 */
customerFilter: {
type: Object,
default: null,
},
},
components: {
ChooseRuleDialog: chooseRuleDialog,
......@@ -529,6 +534,14 @@ export default {
keyFn: this.keyDowmGetList,
},
{
label: "手机号",
name: "customerPhone",
type: "input",
isClear: true,
maxlength: 11,
keyFn: this.keyDowmGetList,
},
{
label: "订单编号",
name: "orderCode",
type: "input",
......@@ -764,6 +777,7 @@ export default {
status: "",
upgradeFinishFlag: "",
customerName: "",
customerPhone: "",
yqMerchantIds: "",
merchantId: "",
orderTime: "",
......@@ -979,6 +993,18 @@ export default {
},
},
watch: {
customerFilter: {
handler(val) {
if (!val || (!val.customerName && !val.customerPhone)) {
return;
}
this.searchForm.customerName = val.customerName || "";
this.searchForm.customerPhone = val.customerPhone || "";
this.page.pageNum = 1;
this.handleSearch();
},
immediate: true,
},
updateRefesh(val) {
// console.log('val', val)
if (val == true) {
......@@ -1060,8 +1086,12 @@ export default {
this.signRefundFlag = true; // 是否有标记退款权限
}
this.getBaseData();
this.getList();
this.getOrderCount();
const hasCustomerFilter = this.customerFilter
&& (this.customerFilter.customerName || this.customerFilter.customerPhone);
if (!hasCustomerFilter) {
this.getList();
this.getOrderCount();
}
this.getProvinceList();
// 获取全部类目
getAllCategory({ pageSize: 9999, currentPage: 1 }).then((res) => {
......@@ -1145,6 +1175,7 @@ export default {
status: "",
upgradeFinishFlag: "",
customerName: "",
customerPhone: "",
yqMerchantIds: "",
merchantId: "",
orderTime: "",
......
......@@ -220,6 +220,13 @@ export default {
if (this.tabName === "carDamage" && this.carDamageRightsNavPreset) {
base.rightsNavPreset = this.carDamageRightsNavPreset
}
const { customerName, customerPhone } = this.$route.query
if (customerName || customerPhone) {
base.customerFilter = {
customerName: customerName || "",
customerPhone: customerPhone || "",
}
}
return base
}
},
......
......@@ -109,6 +109,7 @@ export default {
salesVolume: "",
brand: [],
merchantAddress: "",
merchantAddressDetail: "",
provinceCityCode: "",
province: "",
......@@ -145,12 +146,21 @@ export default {
isHide: true,
},
{
label: "门店地址",
label: "所属省市",
name: "merchantAddress",
addHtml: "merchantAddressHtml",
isHide: true,
},
{
label: "详细地址",
name: "merchantAddressDetail",
type: "input",
isClear: true,
maxlength: 60,
showLimit: true,
isHide: true,
},
{
label: "业务类型",
name: "businessType",
type: "select",
......@@ -278,7 +288,24 @@ export default {
validator: (rule, value, callback) => {
if (this.addForm.bySystemMerchant) {
if (!this.addForm.provinceCode || !this.addForm.provinceCityCode) {
callback(new Error("请选择门店地址"));
callback(new Error("请选择省市"));
} else {
callback();
}
} else {
callback();
}
},
trigger: ["change", "blur"],
},
],
merchantAddressDetail: [
{
required: true,
validator: (rule, value, callback) => {
if (this.addForm.bySystemMerchant) {
if (!value || !value.trim()) {
callback(new Error("请输入详细地址"));
} else {
callback();
}
......@@ -460,7 +487,7 @@ export default {
})
},
handleIsNewMerchantChange(val) {
const fieldsToToggle = ["salesVolume", "brand", "merchantAddress"];
const fieldsToToggle = ["salesVolume", "brand", "merchantAddress", "merchantAddressDetail"];
fieldsToToggle.forEach((name) => {
const index = this.editFormData.findIndex(k => k.name === name);
if (index > -1) {
......@@ -478,6 +505,7 @@ export default {
this.addForm.cityCode = "";
this.addForm.cityName = "";
this.addForm.merchantAddress = "";
this.addForm.merchantAddressDetail = "";
if (this.$refs.provinceCityRef) {
this.$refs.provinceCityRef.init("", "", "");
}
......@@ -538,6 +566,7 @@ export default {
params.salesVolume = this.addForm.salesVolume;
params.brand = brands.join("/");
params.merchantAddress = this.addForm.merchantAddress;
params.merchantAddressDetail = this.addForm.merchantAddressDetail;
params.province = this.addForm.province;
params.provinceCityCode = this.addForm.provinceCityCode;
}
......
......@@ -54,12 +54,18 @@ export default {
hasTooltip: true,
},
{
title: "门店地址",
title: "所属省市",
key: "merchantAddress",
style: contentStyle,
hasTooltip: true,
},
{
title: "详细地址",
key: "merchantAddressDetail",
style: contentStyle,
hasTooltip: true,
},
{
title: "业务类型",
key: "businessTypeName",
},
......
......@@ -15,9 +15,12 @@
<trialOnboard
ref="trialOnboard"
:trialOnboardings="detailInfo.trialOnboardings"
:demand-id="id"
:businessType="detailInfo.businessType"
@handleAddConfirm="handleTrialConfirm"
@handleWorking="handleWorking"
@handleViewResult="handleViewResult"
@handleViewResult="handleViewResult"
@handleApprovalSuccess="handleApprovalSuccess"
:isBtn="isBtn"
></trialOnboard>
<!-- 入职计划 -->
......@@ -241,6 +244,10 @@ export default {
this.detailInfo.trialOnboardings.splice(index, 1)
}
}
},
handleApprovalSuccess({ index, data }) {
if (!data || this.detailInfo.trialOnboardings[index] === undefined) return
this.$set(this.detailInfo.trialOnboardings, index, data)
}
}
}
......
......@@ -177,7 +177,7 @@ import {
} from "@api/recruitment";
import { mapActions, mapState } from "vuex";
import { changeTypeOpt, connectionFlagOpt, connectionFlagOptMap, inviteStatusOpt, inviteStatusOptMap, trialStatusOpt } from "@/common/constants.js";
import { changeTypeOpt, connectionFlagOpt, connectionFlagOptMap, inviteStatusOpt, inviteStatusOptMap, trialStatusOpt,approvalStatusOpt } from "@/common/constants.js";
import { deepClone, Util } from "@/common/util";
import reportTrackPageMixin from "@/mixins/reportTrackPageMixin";
......@@ -347,12 +347,19 @@ export default {
prop: "technicalSupervisorName",
width: 160,
},
{
label: "所属省市",
prop: "provinceCity",
width: 160,
},
{
label: "详细地址",
prop: "merchantAddressDetail",
width: 160,
},
{
label: "主营品牌",
prop: "brand",
width: 160,
......@@ -408,6 +415,18 @@ export default {
addHtml: "statusHtml",
},
{
label: "审批状态",
prop: "approvalStatus",
width: 120,
formatter: (cellValue) => {
const approvalStatusMap = {
0: "待审批",
2: "已审批",
};
return approvalStatusMap[cellValue.approvalStatus] || "-";
},
},
{
label: "试岗状态",
prop: "trialStatus",
width: 120,
......@@ -448,6 +467,7 @@ export default {
technicalSupervisorName: "",
brand: "",
connectionFlag: "",
approvalStatus:""
},
showFormData: [
{
......@@ -566,6 +586,16 @@ export default {
optionLabel: "confValue",
optionsName: "trialStatusOpt",
},
{
label: "审批状态",
name: "approvalStatus",
type: "select",
isClear: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "approvalStatusOpt",
},
],
baseData: {
......@@ -585,6 +615,7 @@ export default {
changeTypeOpt: deepClone(changeTypeOpt),
receiverOpt: [],
relateMerchantOpt: [],
approvalStatusOpt:deepClone(approvalStatusOpt)
},
isRejectDialogConfig: {
title: "驳回",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!