diff --git a/src/api/StoreSettingAPI.ts b/src/api/StoreSettingAPI.ts new file mode 100644 index 0000000..2417c53 --- /dev/null +++ b/src/api/StoreSettingAPI.ts @@ -0,0 +1,56 @@ +import { axios } from "timi-web-api"; + +/** 门店配置项。 */ +export type StoreSetting = { + bizType?: string; + bizId?: string; + code?: string; + description?: string; + value?: string; + valueType?: string; + valueArgs?: unknown; +}; + +/** 门店配置保存项。 */ +export type StoreSettingPayload = { + code: string; + value: string; +}; + +const BASE_URI = "/gao/store/setting"; + +/** 客户生日提醒开关。 */ +export const BIRTHDAY_REMINDER_ENABLED = "CUSTOMER_BIRTHDAY_REMINDER_ENABLED"; + +/** 客户生日提醒负责人。 */ +export const BIRTHDAY_REMINDER_RESPONSIBLE_USER_ID = "CUSTOMER_BIRTHDAY_REMINDER_RESPONSIBLE_USER_ID"; + +/** + * 门店配置接口 + * + * 门店由后端按登录用户所属门店决定,前端不传 storeId + */ +const StoreSettingAPI = { + /** + * 查询当前门店配置 + * + * @param codeList 配置代码列表,为空返回全部 + * @returns 配置代码与配置的映射 + */ + async map(codeList?: string[]): Promise> { + return await axios.post(`${BASE_URI}/map`, codeList ?? []); + }, + + /** + * 保存当前门店配置 + * + * 合并写入,未提交的配置项保留 + * + * @param settingList 配置列表 + */ + async update(settingList: StoreSettingPayload[]): Promise { + await axios.post(`${BASE_URI}/update`, settingList); + } +}; + +export default StoreSettingAPI; diff --git a/src/pages/followUpReminder/BirthdayReminderSetting.vue b/src/pages/followUpReminder/BirthdayReminderSetting.vue new file mode 100644 index 0000000..70249ab --- /dev/null +++ b/src/pages/followUpReminder/BirthdayReminderSetting.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/src/pages/followUpReminder/FollowUpReminderDetail.vue b/src/pages/followUpReminder/FollowUpReminderDetail.vue index d0e60aa..4d4e256 100644 --- a/src/pages/followUpReminder/FollowUpReminderDetail.vue +++ b/src/pages/followUpReminder/FollowUpReminderDetail.vue @@ -54,8 +54,8 @@ @@ -162,6 +162,8 @@ const isLoading = ref(false); const isCompleting = ref(false); const isDeleting = ref(false); const internalNotifyStatus = ref(); +// 站内通知在提醒时间之后才对接收人可见,未到时间时后端按未发送处理 +const isNotifyPending = computed(() => Boolean(detail.value?.remindAt && Time.now() < detail.value.remindAt)); let loadToken = 0; const canUpdate = computed(() => detail.value?.status === "PENDING" @@ -258,6 +260,10 @@ async function loadInternalNotifyStatus(item: FollowUpReminder, token: number): if (!item.internalNotifyDetailId || !userStore.hasPermissions(corePermissionCodes.notify.read)) { return; } + // 未到提醒时间时后端按未发送处理,直接跳过避免必然失败的请求 + if (item.remindAt && Time.now() < item.remindAt) { + return; + } try { const result = await NotifyAPI.internalDetail(item.internalNotifyDetailId); if (token === loadToken) { diff --git a/src/pages/followUpReminder/FollowUpReminderEdit.vue b/src/pages/followUpReminder/FollowUpReminderEdit.vue index 301e05d..863212a 100644 --- a/src/pages/followUpReminder/FollowUpReminderEdit.vue +++ b/src/pages/followUpReminder/FollowUpReminderEdit.vue @@ -166,8 +166,10 @@ const route = useRoute(); const props = withDefaults(defineProps<{ /** 内联到主从分栏时由列表页传入,优先于路由参数 */ reminderId?: string; + customerId?: string; }>(), { - reminderId: "" + reminderId: "", + customerId: "" }); /** 非空说明当前被内联在右栏里,退出走 close 而不是路由 */ @@ -177,8 +179,8 @@ const routeId = computed(() => props.reminderId || String(route.params.id || "") // 竖屏整页编辑转横屏:回到分栏,并用 view=edit 让列表页把右栏还原成编辑 useExpandToMaster({ path: "/management/customer-follow-up-reminders", - id: () => routeId.value, - query: { view: "edit" } + id: () => routeId.value || "__create__", + query: { view: "edit", ...(route.query.customerId ? { customerId: String(route.query.customerId) } : {}) } }); /** 退出编辑:分栏时交回列表页,整页时回路由 */ @@ -199,7 +201,7 @@ const routeNavBarTitle = computed(() => { return "编辑跟进提醒"; default: // 内联在右栏时路由仍是列表页,标题不能只看 route.name - return pane ? "编辑跟进提醒" : ""; + return pane ? (routeId.value ? "编辑跟进提醒" : "新增跟进提醒") : ""; } }); const router = useRouter(); @@ -510,7 +512,7 @@ async function loadForm(): Promise { await loadStoreScope(); if (!routeId.value) { formModel.notifyChannelList = ["INTERNAL"]; - const queryCustomerId = String(route.query.customerId || ""); + const queryCustomerId = String(props.customerId || route.query.customerId || ""); if (queryCustomerId) { await handleCustomerChange(queryCustomerId); } diff --git a/src/pages/followUpReminder/FollowUpReminderList.vue b/src/pages/followUpReminder/FollowUpReminderList.vue index 51b09d2..a447206 100644 --- a/src/pages/followUpReminder/FollowUpReminderList.vue +++ b/src/pages/followUpReminder/FollowUpReminderList.vue @@ -8,14 +8,7 @@ @left-click="$router.back()" > - - + - - - - - - - - + v-entrance-transition="{ step: 30 }" + :item="item" + :can-complete="canComplete" + :can-delete="canDelete" + @complete="item.status = 'COMPLETED'" + @delete="removeFromList(item)" + @detail="toDetail(item)" + /> + - - + + + - + + - - - - - - - + + + diff --git a/src/router/routes/followUpReminderRoutes.ts b/src/router/routes/followUpReminderRoutes.ts index 808453b..a015cd9 100644 --- a/src/router/routes/followUpReminderRoutes.ts +++ b/src/router/routes/followUpReminderRoutes.ts @@ -23,6 +23,17 @@ const followUpReminderRoutes: RouteRecordRaw[] = [ darkBodyBackground: "#10161f" } }, + { + path: "/management/customer-birthday-reminder-setting", + name: "CustomerBirthdayReminderSetting", + component: () => import("@/pages/followUpReminder/BirthdayReminderSetting.vue"), + meta: { + depth: 4, + tabBarVisible: false, + bodyBackground: "#F5F5F8", + darkBodyBackground: "#10161f" + } + }, { path: "/management/customer-follow-up-reminders/:id", name: "CustomerFollowUpReminderDetail", diff --git a/src/types/FollowUpReminder.ts b/src/types/FollowUpReminder.ts index a75df4a..f269377 100644 --- a/src/types/FollowUpReminder.ts +++ b/src/types/FollowUpReminder.ts @@ -4,9 +4,24 @@ import type { Customer } from "@/types/Customer"; /** 客户跟进提醒业务状态。 */ export type FollowUpReminderStatus = "PENDING" | "COMPLETED"; +/** 客户跟进提醒来源。 */ +export type FollowUpReminderSource = "MANUAL" | "SYSTEM"; + /** 客户跟进提醒通知方式。 */ export type FollowUpReminderNotifyChannel = "INTERNAL" | "SMS"; +/** 系统创建提醒的扩展信息快照。 */ +export type FollowUpReminderMetadata = { + /** 业务类型,BIRTHDAY 为客户生日提醒 */ + bizType?: string; + /** 生日对应的公历日期 */ + birthdaySolar?: string; + /** 生日对应的农历月日,仅农历生日有值 */ + birthdayLunar?: string; + /** true 为闰月,仅农历生日有值 */ + leapMonth?: boolean; +}; + /** 跟进提醒附件请求项。 */ export type FollowUpReminderAttachment = Partial & { name?: string; @@ -21,6 +36,10 @@ export type FollowUpReminder = { content?: string; remindAt?: number; status?: FollowUpReminderStatus; + source?: FollowUpReminderSource; + /** 系统创建的幂等键,手动创建为空 */ + sourceKey?: string; + metadata?: FollowUpReminderMetadata; internalNotifyEnabled?: boolean; smsNotifyEnabled?: boolean; internalNotifyDetailId?: string; diff --git a/src/utils/permission.ts b/src/utils/permission.ts index 4577a71..2f3a622 100644 --- a/src/utils/permission.ts +++ b/src/utils/permission.ts @@ -188,6 +188,10 @@ export const corePermissionCodes = { read: "CORE:NOTIFY:READ", delete: "CORE:NOTIFY:DELETE", cancel: "CORE:NOTIFY:CANCEL" + }, + setting: { + read: "CORE:SETTING:READ", + update: "CORE:SETTING:UPDATE" } } as const;