Commit a83fae81 by 陈婉清

Merge branch 'SAAS+V5.8.3-cwq' into 'SAAS+V5.8.3'

Saas+v5.8.3 cwq

See merge request !793
2 parents 4335fbeb 0c41abd2
......@@ -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");
});
});
......@@ -364,6 +364,8 @@ describe("marketingPushStrategy 集成测试", () => {
mockGetMarketingPushStrategyDetailApi.mockResolvedValue({
marketingStage: "AFTER_DELIVERY",
relativeDateType: 0,
triggerHour: 9,
triggerMinute: 5,
storeIds: [{ merchantId: "m-1", merchantName: "门店1" }],
branches: [
{
......@@ -381,6 +383,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([
......
......@@ -158,7 +158,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 { getDefaultBranch, hourOptions, MessageTypeEnum, minuteOptions, relativeDateTypeOpt } from "@/views/marketingManagement/marketingPushStrategy/constant";
import { formatTriggerTimeValue, 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!