Commit 30cc35b6 by Jaxon

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

…e-system into feature/marketing-sop-push-strategy
2 parents a37e104e 0c41abd2
......@@ -11,13 +11,16 @@
size="mini"
border
:data="storeList">
<el-table-column label="门店名称"
<el-table-column align="center"
label="门店名称"
min-width="150"
prop="merchantName" />
<el-table-column label="门店商户号"
<el-table-column align="center"
label="门店商户号"
prop="merchantId"
width="120" />
<el-table-column label="门店地址"
<el-table-column align="center"
label="门店地址"
min-width="200"
prop="merchantAddress"
show-overflow-tooltip />
......
......@@ -79,3 +79,10 @@ export const hourOptions = Array.from({ length: 24 }, (_, i) => String(i).padSta
// 生成分钟选项 00-59
export const minuteOptions = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0"));
export function formatTriggerTimeValue(value) {
if (value === undefined || value === null || value === "") {
return value;
}
return String(value).padStart(2, "0");
}
......@@ -11,6 +11,7 @@ const {
getDefaultBranch,
hourOptions,
minuteOptions,
formatTriggerTimeValue,
} = require("./index.js");
describe("marketingPushStrategy constant/index.js", () => {
......@@ -83,4 +84,11 @@ describe("marketingPushStrategy constant/index.js", () => {
expect(minuteOptions[0]).toBe("00");
expect(minuteOptions[59]).toBe("59");
});
it("formatTriggerTimeValue 应把 0-9 的时间值转成两位数", () => {
expect(formatTriggerTimeValue(0)).toBe("00");
expect(formatTriggerTimeValue(9)).toBe("09");
expect(formatTriggerTimeValue("5")).toBe("05");
expect(formatTriggerTimeValue("12")).toBe("12");
});
});
......@@ -471,6 +471,8 @@ describe("marketingPushStrategy 集成测试", () => {
mockGetMarketingPushStrategyDetailApi.mockResolvedValue({
marketingStage: "AFTER_DELIVERY",
relativeDateType: 0,
triggerHour: 9,
triggerMinute: 5,
storeIds: [{ merchantId: "m-1", merchantName: "门店1" }],
branches: [
{
......@@ -488,6 +490,8 @@ describe("marketingPushStrategy 集成测试", () => {
await ModifyPage.mounted.call(vm);
expect(mockGetMarketingPushStrategyDetailApi).toHaveBeenCalledWith({ strategyId: "66" });
expect(vm.form.triggerHour).toBe("09");
expect(vm.form.triggerMinute).toBe("05");
expect(vm.form.storeIds).toEqual([{ merchantId: "m-1", merchantName: "门店1" }]);
expect(vm.form.branches[0].actions[0].targetGroupType).toBe(1);
expect(vm.form.branches[0].actions[0].materialJson).toEqual([
......
......@@ -157,7 +157,7 @@ import { createStrategy, getMarketingPushStrategyDetailApi, getMetaOptionsApi, u
import BranchGroup from "@/views/marketingManagement/marketingPushStrategy/components/branchGroup/index.vue";
import ConditionPanel from "@/views/marketingManagement/marketingPushStrategy/components/conditionPanel/index.vue";
import SelectStoreDialog from "@/views/marketingManagement/marketingPushStrategy/components/selectStoreDialog/index.vue";
import { actionConfirmOptions, getDefaultBranch, hourOptions, MessageTypeEnum, minuteOptions, relativeDateTypeOpt } from "@/views/marketingManagement/marketingPushStrategy/constant";
import { formatTriggerTimeValue, actionConfirmOptions,getDefaultBranch, hourOptions, MessageTypeEnum, minuteOptions, relativeDateTypeOpt } from "@/views/marketingManagement/marketingPushStrategy/constant";
import { getFormSchema, getSpecFormSchema, rules } from "@/views/marketingManagement/marketingPushStrategy/views/modify/modify.data.js";
export default {
......@@ -271,6 +271,8 @@ export default {
...this.form,
...data,
relativeDateType: data.relativeDateType,
triggerHour: formatTriggerTimeValue(data.triggerHour),
triggerMinute: formatTriggerTimeValue(data.triggerMinute),
storeIds: isArray(data?.storeIds) ? data.storeIds : [],
};
this.setTriggerMetaDateOptions(this.getTriggerMetaDatesByStage(this.form.marketingStage));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!