Merge pull request 'v1.4.0' (#11) from release/1.4.0 into master

Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
2026-11-17 04:13:53 +00:00
45 changed files with 1337 additions and 855 deletions
+17
View File
@@ -19,6 +19,23 @@ CI 规则(.gitea/workflows/release.yml):
需要更正请发补丁版本 需要更正请发补丁版本
--> -->
## v1.4.0
### 新增
- 自动生成客户生日跟进提醒。在启用功能,配置负责人且客户保存了出生日期时,系统将会在生日前 7 天生成跟进提醒
### 调整
- 现在产生库存流水、订单的产品 SKU 不再允许修改基础单位
- 平板横屏下左侧导航可点击回到根页面
### 修复
- APK 端无法显示更新日志
- APK 端没有完全全屏(仍然避让状态栏)
- 部分页面样式
## v1.3.2 ## v1.3.2
### 调整 ### 调整
+2 -2
View File
@@ -7,8 +7,8 @@ android {
applicationId "com.imyeyu.gao.customer" applicationId "com.imyeyu.gao.customer"
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1 versionCode 2
versionName "1.0.0" versionName "1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions { aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
@@ -1,15 +1,27 @@
package com.imyeyu.gao.customer; package com.imyeyu.gao.customer;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import androidx.activity.OnBackPressedCallback; import androidx.activity.OnBackPressedCallback;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsCompat;
import com.getcapacitor.BridgeActivity; import com.getcapacitor.BridgeActivity;
import java.util.Locale;
public class MainActivity extends BridgeActivity { public class MainActivity extends BridgeActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
applyEdgeToEdge();
getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) { getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
@Override @Override
public void handleOnBackPressed() { public void handleOnBackPressed() {
@@ -26,4 +38,67 @@ public class MainActivity extends BridgeActivity {
getBridge().getWebView().getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); getBridge().getWebView().getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
} }
} }
/**
* 让窗口真正 edge-to-edge,安全区由 Web 侧按 --tui-safe-* 补齐。
*
* 这里必须自己接管 insets:Capacitor 8 的 SystemBars 只认 WebView 内核版本
* (getWebViewMajorVersion() >= 140 才认为内核能自己处理安全区,见 SystemBars.java),
* 低内核机型上它会一边给 DecorView 加状态栏高度的 padding 把 WebView 缩回去,
* 一边又把真实的安全区注入成 CSS 变量,结果顶部被让了两次。
* 这个监听器在 Bridge 初始化之后注册,直接覆盖掉它:padding 归零、变量照旧注入。
*/
private void applyEdgeToEdge() {
Window window = getWindow();
WindowCompat.setDecorFitsSystemWindows(window, false);
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
window.setAttributes(attributes);
}
View decorView = window.getDecorView();
ViewCompat.setOnApplyWindowInsetsListener(decorView, (view, windowInsets) -> {
view.setPadding(0, 0, 0, 0);
Insets systemBars = windowInsets.getInsets(
WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout()
);
boolean keyboardVisible = windowInsets.isVisible(WindowInsetsCompat.Type.ime());
injectSafeArea(systemBars, keyboardVisible);
return windowInsets;
});
ViewCompat.requestApplyInsets(decorView);
}
/**
* 把系统栏尺寸折算成 CSS 像素后写进 html 的 CSS 变量。
*
* 键盘弹出时底部归零,否则 Web 侧的安全区会和键盘顶起来的区域叠加。
*/
private void injectSafeArea(Insets systemBars, boolean keyboardVisible) {
if (getBridge() == null || getBridge().getWebView() == null) {
return;
}
float density = getResources().getDisplayMetrics().density;
int top = Math.round(systemBars.top / density);
int right = Math.round(systemBars.right / density);
int bottom = Math.round((keyboardVisible ? 0 : systemBars.bottom) / density);
int left = Math.round(systemBars.left / density);
String script = String.format(
Locale.US,
"document.documentElement.style.setProperty('--safe-area-inset-top','%dpx');" +
"document.documentElement.style.setProperty('--safe-area-inset-right','%dpx');" +
"document.documentElement.style.setProperty('--safe-area-inset-bottom','%dpx');" +
"document.documentElement.style.setProperty('--safe-area-inset-left','%dpx');",
top,
right,
bottom,
left
);
getBridge().getWebView().evaluateJavascript(script, null);
}
} }
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "gao-customer-h5", "name": "gao-customer-h5",
"private": true, "private": true,
"version": "1.3.2", "version": "1.4.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --host", "dev": "vite --host",
@@ -30,7 +30,7 @@
"less": "^4.3.0", "less": "^4.3.0",
"pinia": "^3.0.2", "pinia": "^3.0.2",
"tdesign-mobile-vue": "^1.17.1", "tdesign-mobile-vue": "^1.17.1",
"timi-tdesign-mobile": "^1.2.0", "timi-tdesign-mobile": "^1.3.1",
"timi-ts": "^1.0.0", "timi-ts": "^1.0.0",
"timi-web": "^1.0.2", "timi-web": "^1.0.2",
"timi-web-api": "^1.0.2", "timi-web-api": "^1.0.2",
+5 -5
View File
@@ -47,8 +47,8 @@ importers:
specifier: ^1.17.1 specifier: ^1.17.1
version: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3)) version: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3))
timi-tdesign-mobile: timi-tdesign-mobile:
specifier: ^1.2.0 specifier: ^1.3.1
version: 1.2.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3)) version: 1.3.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3))
timi-ts: timi-ts:
specifier: ^1.0.0 specifier: ^1.0.0
version: 1.0.0 version: 1.0.0
@@ -2748,8 +2748,8 @@ packages:
through2@4.0.2: through2@4.0.2:
resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==} resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==}
timi-tdesign-mobile@1.2.0: timi-tdesign-mobile@1.3.1:
resolution: {integrity: sha512-FW9LyZlh+aSjaG3tEXBf3+YYmm+OruYVH+atQMFmlCT33q3e6Gt0rr6n6d4vLH5n0tzyidlAJ0hmrvKspKKDdw==} resolution: {integrity: sha512-6hz7MSqseCUyyJzRiyQjymMDfSZ3kJrFP6J5DxHpE1pJ8xeByCzKgELS4CnO4187mqPEx46TtF03qB9XS4Mpuw==}
engines: {node: '>=20.0.0'} engines: {node: '>=20.0.0'}
peerDependencies: peerDependencies:
vue: ^3.5.0 vue: ^3.5.0
@@ -5849,7 +5849,7 @@ snapshots:
dependencies: dependencies:
readable-stream: 3.6.2 readable-stream: 3.6.2
timi-tdesign-mobile@1.2.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3)): timi-tdesign-mobile@1.3.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3)):
dependencies: dependencies:
tdesign-mobile-vue: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3)) tdesign-mobile-vue: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3))
timi-web: 1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3)) timi-web: 1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
+1 -1
View File
@@ -3,7 +3,7 @@ $ErrorActionPreference = "Stop"
$env:VITE_API_BASE_URL = if ($env:ANDROID_API_BASE_URL) { $env:VITE_API_BASE_URL = if ($env:ANDROID_API_BASE_URL) {
$env:ANDROID_API_BASE_URL $env:ANDROID_API_BASE_URL
} else { } else {
"http://10.0.2.2:18091" "http://192.168.11.14:18091"
} }
Write-Host "Android 调试接口地址:$env:VITE_API_BASE_URL" Write-Host "Android 调试接口地址:$env:VITE_API_BASE_URL"
+23 -3
View File
@@ -3,21 +3,38 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Capacitor, SystemBars, SystemBarsStyle } from "@capacitor/core";
import { useGlobalUIStore } from "@/store/globalUI"; import { useGlobalUIStore } from "@/store/globalUI";
import { useSettingStore } from "@/store/settingStore"; import { useSettingStore } from "@/store/settingStore";
const globalUIStore = useGlobalUIStore(); const globalUIStore = useGlobalUIStore();
const settingStore = useSettingStore(); const settingStore = useSettingStore();
const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
const prefersDark = ref(darkMediaQuery.matches);
const resolvedThemeMode = computed(() => { const resolvedThemeMode = computed<"light" | "dark">(() => {
if (globalUIStore.themeMode === "system") { if (globalUIStore.themeMode === "system") {
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)"); return prefersDark.value ? "dark" : "light";
return mediaQuery.matches ? "dark" : "light";
} }
return globalUIStore.themeMode; return globalUIStore.themeMode;
}); });
async function syncSystemBars(themeMode: "light" | "dark"): Promise<void> {
if (!Capacitor.isNativePlatform()) {
return;
}
await SystemBars.setStyle({
// DARK 表示深色系统栏配浅色图标,所以深色主题要用它
style: themeMode === "dark" ? SystemBarsStyle.Dark : SystemBarsStyle.Light
});
}
function handleSystemThemeChange(event: MediaQueryListEvent): void {
prefersDark.value = event.matches;
}
async function unlockSoundOnUserGesture(): Promise<void> { async function unlockSoundOnUserGesture(): Promise<void> {
await settingStore.unlockSoundPlayers(); await settingStore.unlockSoundPlayers();
} }
@@ -28,6 +45,7 @@ watch(
const rootElement = document.documentElement; const rootElement = document.documentElement;
rootElement.classList.toggle("theme-dark", themeMode === "dark"); rootElement.classList.toggle("theme-dark", themeMode === "dark");
rootElement.dataset.theme = themeMode; rootElement.dataset.theme = themeMode;
void syncSystemBars(themeMode).catch(() => undefined);
}, },
{ immediate: true } { immediate: true }
); );
@@ -54,10 +72,12 @@ watch(
onMounted(() => { onMounted(() => {
settingStore.loadSoundPlayers(); settingStore.loadSoundPlayers();
darkMediaQuery.addEventListener("change", handleSystemThemeChange);
window.addEventListener("pointerdown", unlockSoundOnUserGesture, { once: true }); window.addEventListener("pointerdown", unlockSoundOnUserGesture, { once: true });
}); });
onUnmounted(() => { onUnmounted(() => {
darkMediaQuery.removeEventListener("change", handleSystemThemeChange);
window.removeEventListener("pointerdown", unlockSoundOnUserGesture); window.removeEventListener("pointerdown", unlockSoundOnUserGesture);
}); });
</script> </script>
+56
View File
@@ -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<Record<string, StoreSetting>> {
return await axios.post(`${BASE_URI}/map`, codeList ?? []);
},
/**
* 保存当前门店配置
*
* 合并写入,未提交的配置项保留
*
* @param settingList 配置列表
*/
async update(settingList: StoreSettingPayload[]): Promise<void> {
await axios.post(`${BASE_URI}/update`, settingList);
}
};
export default StoreSettingAPI;
+1 -1
View File
@@ -119,7 +119,7 @@ html.theme-dark body {
min-height: 0; min-height: 0;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem); padding-bottom: calc(var(--tui-safe-bottom, 0px) + 1rem);
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
.t-pull-down-refresh__track { .t-pull-down-refresh__track {
+1 -1
View File
@@ -361,7 +361,7 @@ onUnmounted(() => {
flex: 1; flex: 1;
overflow: auto; overflow: auto;
min-height: 0; min-height: 0;
padding-bottom: env(safe-area-inset-bottom, 0); padding-bottom: var(--tui-safe-bottom, 0px);
} }
} }
+2 -2
View File
@@ -313,7 +313,7 @@ function toDateValue(date: Date): number {
.day-record-panel, .day-record-panel,
.filter-popup { .filter-popup {
gap: .875rem; gap: .875rem;
padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom, 0)) 0; padding: 1rem 0 calc(1rem + var(--tui-safe-bottom, 0px)) 0;
display: flex; display: flex;
background: #f5f5f8; background: #f5f5f8;
border-radius: 1rem 1rem 0 0; border-radius: 1rem 1rem 0 0;
@@ -344,7 +344,7 @@ function toDateValue(date: Date): number {
} }
.filter-popup { .filter-popup {
padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0)) 1rem; padding: 1rem 1rem calc(1rem + var(--tui-safe-bottom, 0px)) 1rem;
.popup-head, .popup-head,
.popup-body { .popup-body {
@@ -311,7 +311,7 @@ function updateSelectedSkuIdList(value: string[]): void {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
overflow-y: auto; overflow-y: auto;
padding-bottom: env(safe-area-inset-bottom, 0); padding-bottom: var(--tui-safe-bottom, 0px);
.selector { .selector {
border-radius: 0; border-radius: 0;
+11 -2
View File
@@ -7,6 +7,7 @@
tab-bar-float tab-bar-float
:hide-nav="!tabBarStore.isShowing" :hide-nav="!tabBarStore.isShowing"
@change="onChangeTab" @change="onChangeTab"
@rail-click="onRailClick"
> >
<template #rail-extra> <template #rail-extra>
<t-button <t-button
@@ -174,11 +175,19 @@ function resolveVisibleTabValue(path: string): string {
function onChangeTab(value: string | number): void { function onChangeTab(value: string | number): void {
const path = String(value); const path = String(value);
if (resolveTabValue(route.path) === path) { if ((railVisible.value ? route.path : resolveTabValue(route.path)) === path) {
return; return;
} }
router.push(path); void router.push(path);
}
/** 再次点击已激活的侧栏导航时返回栏目根页面。 */
function onRailClick(value: string | number): void {
const path = String(value);
if (path === tabVal.value && route.path !== path) {
void router.push(path);
}
} }
// ---------- Tab 边距 ---------- // ---------- Tab 边距 ----------
@@ -275,7 +275,7 @@ watch(() => props.sessionKey, async () => {
.ai-conversation-list { .ai-conversation-list {
width: min(70vw, 24rem); width: min(70vw, 24rem);
height: 100vh; height: 100vh;
padding: calc(var(--tui-nav-height) + .5rem) 0 calc(1rem + env(safe-area-inset-bottom, 0px)); padding: calc(var(--tui-nav-height) + .5rem) 0 calc(1rem + var(--tui-safe-bottom, 0px));
display: flex; display: flex;
overflow: auto; overflow: auto;
position: relative; position: relative;
@@ -0,0 +1,169 @@
<template>
<div class="tui-page-layout tui-navbar birthday-reminder-setting">
<t-navbar
fixed
:z-index="20"
title="生日提醒设置"
left-arrow
@left-click="exit()"
>
<template #right>
<t-button
theme="primary"
variant="text"
size="small"
content="保存"
:loading="isSaving"
:disabled="isLoading"
@click="save"
/>
</template>
</t-navbar>
<main v-can="corePermissionCodes.setting.update" class="tui-page-content scroll column">
<t-cell-group theme="card">
<t-cell title="启用生日提醒" description="提前 7 天生成客户生日跟进提醒">
<template #rightIcon>
<t-switch v-model="formModel.enabled" :disabled="isLoading || isSaving" />
</template>
</t-cell>
<t-cell
title="跟进负责人"
:note="responsibleName"
arrow
@click="responsibleSelectorVisible = true"
/>
</t-cell-group>
<div class="tips red">
启用后每天 7:00 提前 7 天生成客户生日提醒,站内信与短信在生日当天 8:00 发给负责人。农历生日按农历月日计算。
</div>
</main>
<managed-user-selector
v-model="formModel.responsibleUserId"
v-model:visible="responsibleSelectorVisible"
title="选择生日提醒负责人"
:store-id="currentStoreStore.currentStoreId"
@change="handleResponsibleSelected"
/>
</div>
</template>
<script setup lang="ts">
import { useExpandToMaster, usePane } from "timi-tdesign-mobile";
import ManagedUserSelector from "@/pages/followUpReminder/component/ManagedUserSelector.vue";
import StoreSettingAPI, {
BIRTHDAY_REMINDER_ENABLED,
BIRTHDAY_REMINDER_RESPONSIBLE_USER_ID
} from "@/api/StoreSettingAPI";
import ManagedUserAPI from "@/api/ManagedUserAPI";
import { Message } from "@/utils/message";
import { getErrorMessage } from "@/utils/error";
import { corePermissionCodes } from "@/utils/permission";
import { useCurrentStoreStore } from "@/store/currentStoreStore";
import type { ManagedUser } from "@/types/ManagedUser";
defineOptions({
name: "BirthdayReminderSetting"
});
const router = useRouter();
const pane = usePane();
useExpandToMaster({
path: "/management/customer-follow-up-reminders",
id: () => "__birthday_setting__"
});
const currentStoreStore = useCurrentStoreStore();
const isLoading = ref(false);
const isSaving = ref(false);
const responsibleSelectorVisible = ref(false);
const responsibleName = ref("未选择");
const formModel = reactive({
enabled: false,
responsibleUserId: ""
});
function exit(): void {
if (pane) {
pane.close();
return;
}
router.back();
}
async function load(): Promise<void> {
isLoading.value = true;
try {
const settingMap = await StoreSettingAPI.map([
BIRTHDAY_REMINDER_ENABLED,
BIRTHDAY_REMINDER_RESPONSIBLE_USER_ID
]);
formModel.enabled = settingMap[BIRTHDAY_REMINDER_ENABLED]?.value === "true";
const responsibleUserId = settingMap[BIRTHDAY_REMINDER_RESPONSIBLE_USER_ID]?.value || "";
formModel.responsibleUserId = responsibleUserId;
responsibleName.value = responsibleUserId ? "加载中…" : "未选择";
if (responsibleUserId) {
await fillResponsibleName(responsibleUserId);
}
} catch (error) {
Message.error(getErrorMessage(error, "生日提醒设置加载失败"));
} finally {
isLoading.value = false;
}
}
async function fillResponsibleName(userId: string): Promise<void> {
try {
const storeId = currentStoreStore.currentStoreId || undefined;
const result = await ManagedUserAPI.list({
index: 0,
size: 1,
equalsExample: { userId, storeId }
}, { storeId });
const managedUser = result.list?.[0];
responsibleName.value = managedUser ? getManagedUserName(managedUser) : "负责人已不在本门店";
} catch {
responsibleName.value = "未知负责人";
}
}
function getManagedUserName(item: ManagedUser): string {
return item.user?.nick || item.user?.name || item.userId || "未命名负责人";
}
function handleResponsibleSelected(user: ManagedUser): void {
formModel.responsibleUserId = user.userId || "";
responsibleName.value = getManagedUserName(user);
}
async function save(): Promise<void> {
if (formModel.enabled && !formModel.responsibleUserId) {
Message.warning("启用生日提醒前请先选择跟进负责人");
return;
}
isSaving.value = true;
try {
await StoreSettingAPI.update([
{ code: BIRTHDAY_REMINDER_ENABLED, value: formModel.enabled ? "true" : "false" },
{ code: BIRTHDAY_REMINDER_RESPONSIBLE_USER_ID, value: formModel.responsibleUserId }
]);
Message.success("已保存");
exit();
} catch (error) {
Message.error(getErrorMessage(error, "保存失败"));
} finally {
isSaving.value = false;
}
}
onMounted(load);
</script>
<style scoped lang="less">
.birthday-reminder-setting {
.tips {
font-size: .875rem;
padding: 0 1rem 0 2rem;
}
}
</style>
@@ -54,8 +54,8 @@
<t-tag <t-tag
size="small" size="small"
variant="outline" variant="outline"
:theme="internalNotifyStatus ? getNotifyStatusTheme(internalNotifyStatus.status) : 'primary'" :theme="internalNotifyStatus ? getNotifyStatusTheme(internalNotifyStatus.status) : (isNotifyPending ? 'warning' : 'primary')"
:content="internalNotifyStatus ? getNotifyStatusText(internalNotifyStatus.status) : '已配置'" :content="internalNotifyStatus ? getNotifyStatusText(internalNotifyStatus.status) : (isNotifyPending ? '待发送' : '已配置')"
/> />
</template> </template>
</t-cell> </t-cell>
@@ -162,6 +162,8 @@ const isLoading = ref(false);
const isCompleting = ref(false); const isCompleting = ref(false);
const isDeleting = ref(false); const isDeleting = ref(false);
const internalNotifyStatus = ref<NotifyDetail>(); const internalNotifyStatus = ref<NotifyDetail>();
// 站内通知在提醒时间之后才对接收人可见,未到时间时后端按未发送处理
const isNotifyPending = computed(() => Boolean(detail.value?.remindAt && Time.now() < detail.value.remindAt));
let loadToken = 0; let loadToken = 0;
const canUpdate = computed(() => detail.value?.status === "PENDING" 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)) { if (!item.internalNotifyDetailId || !userStore.hasPermissions(corePermissionCodes.notify.read)) {
return; return;
} }
// 未到提醒时间时后端按未发送处理,直接跳过避免必然失败的请求
if (item.remindAt && Time.now() < item.remindAt) {
return;
}
try { try {
const result = await NotifyAPI.internalDetail(item.internalNotifyDetailId); const result = await NotifyAPI.internalDetail(item.internalNotifyDetailId);
if (token === loadToken) { if (token === loadToken) {
@@ -166,8 +166,10 @@ const route = useRoute();
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
/** 内联到主从分栏时由列表页传入,优先于路由参数 */ /** 内联到主从分栏时由列表页传入,优先于路由参数 */
reminderId?: string; reminderId?: string;
customerId?: string;
}>(), { }>(), {
reminderId: "" reminderId: "",
customerId: ""
}); });
/** 非空说明当前被内联在右栏里,退出走 close 而不是路由 */ /** 非空说明当前被内联在右栏里,退出走 close 而不是路由 */
@@ -177,8 +179,8 @@ const routeId = computed(() => props.reminderId || String(route.params.id || "")
// 竖屏整页编辑转横屏:回到分栏,并用 view=edit 让列表页把右栏还原成编辑 // 竖屏整页编辑转横屏:回到分栏,并用 view=edit 让列表页把右栏还原成编辑
useExpandToMaster({ useExpandToMaster({
path: "/management/customer-follow-up-reminders", path: "/management/customer-follow-up-reminders",
id: () => routeId.value, id: () => routeId.value || "__create__",
query: { view: "edit" } query: { view: "edit", ...(route.query.customerId ? { customerId: String(route.query.customerId) } : {}) }
}); });
/** 退出编辑:分栏时交回列表页,整页时回路由 */ /** 退出编辑:分栏时交回列表页,整页时回路由 */
@@ -199,7 +201,7 @@ const routeNavBarTitle = computed(() => {
return "编辑跟进提醒"; return "编辑跟进提醒";
default: default:
// 内联在右栏时路由仍是列表页,标题不能只看 route.name // 内联在右栏时路由仍是列表页,标题不能只看 route.name
return pane ? "编辑跟进提醒" : ""; return pane ? (routeId.value ? "编辑跟进提醒" : "新增跟进提醒") : "";
} }
}); });
const router = useRouter(); const router = useRouter();
@@ -510,7 +512,7 @@ async function loadForm(): Promise<void> {
await loadStoreScope(); await loadStoreScope();
if (!routeId.value) { if (!routeId.value) {
formModel.notifyChannelList = ["INTERNAL"]; formModel.notifyChannelList = ["INTERNAL"];
const queryCustomerId = String(route.query.customerId || ""); const queryCustomerId = String(props.customerId || route.query.customerId || "");
if (queryCustomerId) { if (queryCustomerId) {
await handleCustomerChange(queryCustomerId); await handleCustomerChange(queryCustomerId);
} }
@@ -8,14 +8,7 @@
@left-click="$router.back()" @left-click="$router.back()"
> >
<template #right> <template #right>
<t-button <navbar-actions :actions="actionList" />
v-if="canCreate"
theme="primary"
variant="text"
size="small"
content="新增"
@click="toCreate"
/>
</template> </template>
</t-navbar> </t-navbar>
<master-detail-page <master-detail-page
@@ -80,93 +73,30 @@
<t-cell v-if="dateFilterType !== 'all'" title="提醒时间" :note="dateFilterLabel" /> <t-cell v-if="dateFilterType !== 'all'" title="提醒时间" :note="dateFilterLabel" />
<t-cell v-if="selectedResponsibleId" title="负责人" :note="selectedResponsibleName" /> <t-cell v-if="selectedResponsibleId" title="负责人" :note="selectedResponsibleName" />
</t-cell-group> </t-cell-group>
<t-cell-group v-if="pageResult.list.length" class="items fix-last-cell-line empty-cell-title-margin" theme="card"> <div v-if="pageResult.list.length" class="items">
<t-swipe-cell <follow-up-reminder-list-cell
v-for="(item, index) in pageResult.list" v-for="(item, index) in pageResult.list"
:key="item.id || index" :key="item.id || index"
class="item" v-entrance-transition="{ step: 30 }"
> :item="item"
<t-cell :can-complete="canComplete"
v-entrance-transition="{ step: 30 }" :can-delete="canDelete"
class="cell" @complete="item.status = 'COMPLETED'"
arrow @delete="removeFromList(item)"
@click="toDetail(item)" @detail="toDetail(item)"
> />
<template #leftIcon> </div>
<t-image
v-if="getCustomerPhotoURL(item.customer, 64)"
:src="getCustomerPhotoURL(item.customer, 64)"
:alt="getCustomerName(item)"
fit="cover"
class="avatar"
/>
<div v-else class="avatar fallback" v-text="getCustomerName(item).slice(0, 1)" />
</template>
<template #title>
<div class="title">
<div class="name-channel">
<span class="text-bold" v-text="getCustomerName(item)" />
<t-tag
v-if="item.notifyChannelList?.includes('INTERNAL')"
size="small"
theme="primary"
variant="outline"
content="站内信"
/>
<t-tag
v-if="item.notifyChannelList?.includes('SMS')"
size="small"
theme="warning"
variant="outline"
content="短信"
/>
</div>
<t-tag size="small" :theme="getStatusTheme(item.status)" :content="getStatusText(item.status)" />
</div>
</template>
<template #description>
<div class="description">
<div class="content clip-text" v-text="getContentSummary(item.content)" />
<div class="time-responsible">
<span
class="remind-time"
:class="getReminderTimeClass(item)"
v-text="getReminderTimeText(item.remindAt)"
/>
<span v-text="`负责人:${getResponsibleName(item)}`" />
</div>
</div>
</template>
</t-cell>
<template #right>
<div class="swipe-actions">
<t-button
v-if="canComplete && item.status === 'PENDING'"
class="complete swipe-cell-button"
variant="text"
:loading="operatingId === item.id && operatingType === 'complete'"
@click.stop="confirmComplete(item)"
>完成</t-button>
<t-button
v-if="canDelete"
class="delete swipe-cell-button"
variant="text"
:loading="operatingId === item.id && operatingType === 'delete'"
@click.stop="confirmDelete(item)"
>删除</t-button>
</div>
</template>
</t-swipe-cell>
</t-cell-group>
<center-tips :content="isLoading ? '正在加载提醒' : pageResult.list.length ? (isNoMore ? '已经到底了' : '上拉加载更多') : '暂无跟进提醒'" /> <center-tips :content="isLoading ? '正在加载提醒' : pageResult.list.length ? (isNoMore ? '已经到底了' : '上拉加载更多') : '暂无跟进提醒'" />
</div> </div>
</t-pull-down-refresh> </t-pull-down-refresh>
</template> </template>
<template #detail> <template #detail>
<birthday-reminder-setting v-if="selectedId === birthdayPaneId" />
<follow-up-reminder-edit <follow-up-reminder-edit
v-if="editing" v-else-if="editing || selectedId === createPaneId"
:key="`edit-${selectedId}`" :key="`edit-${selectedId}`"
:reminder-id="selectedId" :reminder-id="selectedId === createPaneId ? '' : selectedId"
:customer-id="selectedCustomerId"
/> />
<follow-up-reminder-detail <follow-up-reminder-detail
v-else v-else
@@ -176,50 +106,50 @@
/> />
</template> </template>
</master-detail-page> </master-detail-page>
<customer-selector
<customer-selector v-model="selectedCustomerId"
v-model="selectedCustomerId" v-model:visible="customerSelectorVisible"
v-model:visible="customerSelectorVisible" :initial-keyword="customerSearchKeyword"
:initial-keyword="customerSearchKeyword" :store-id="currentStoreStore.currentStoreId"
:store-id="currentStoreStore.currentStoreId" :enable-scan="true"
:enable-scan="true" @change="handleCustomerSelected"
@change="handleCustomerSelected" />
<managed-user-selector
v-model="selectedResponsibleId"
v-model:visible="responsibleSelectorVisible"
:store-id="currentStoreStore.currentStoreId"
@change="handleResponsibleSelected"
/>
<t-popup v-model="startVisible" placement="bottom">
<t-date-time-picker
v-if="startVisible"
v-model="startDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="提醒开始时间"
@cancel="startVisible = false"
@confirm="confirmStart"
/> />
<managed-user-selector </t-popup>
v-model="selectedResponsibleId" <t-popup v-model="endVisible" placement="bottom">
v-model:visible="responsibleSelectorVisible" <t-date-time-picker
:store-id="currentStoreStore.currentStoreId" v-if="endVisible"
@change="handleResponsibleSelected" v-model="endDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="提醒结束时间"
@cancel="endVisible = false"
@confirm="confirmEnd"
/> />
<t-popup v-model="startVisible" placement="bottom"> </t-popup>
<t-date-time-picker
v-if="startVisible"
v-model="startDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="提醒开始时间"
@cancel="startVisible = false"
@confirm="confirmStart"
/>
</t-popup>
<t-popup v-model="endVisible" placement="bottom">
<t-date-time-picker
v-if="endVisible"
v-model="endDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="提醒结束时间"
@cancel="endVisible = false"
@confirm="confirmEnd"
/>
</t-popup>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile"; import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
import { DialogPlugin, type DropdownValue } from "tdesign-mobile-vue"; import { type DropdownValue } from "tdesign-mobile-vue";
import FollowUpReminderListCell from "@/pages/followUpReminder/component/FollowUpReminderListCell.vue";
import BirthdayReminderSetting from "@/pages/followUpReminder/BirthdayReminderSetting.vue";
import FollowUpReminderDetail from "@/pages/followUpReminder/FollowUpReminderDetail.vue"; import FollowUpReminderDetail from "@/pages/followUpReminder/FollowUpReminderDetail.vue";
import FollowUpReminderEdit from "@/pages/followUpReminder/FollowUpReminderEdit.vue"; import FollowUpReminderEdit from "@/pages/followUpReminder/FollowUpReminderEdit.vue";
import { Time } from "timi-web"; import { Time } from "timi-web";
@@ -229,13 +159,14 @@ import { getErrorMessage } from "@/utils/error";
import FollowUpReminderAPI from "@/api/FollowUpReminderAPI"; import FollowUpReminderAPI from "@/api/FollowUpReminderAPI";
import CustomerAPI from "@/api/CustomerAPI"; import CustomerAPI from "@/api/CustomerAPI";
import CustomerSelector from "@/components/CustomerSelector.vue"; import CustomerSelector from "@/components/CustomerSelector.vue";
import NavbarActions from "@/components/NavbarActions.vue";
import ManagedUserSelector from "@/pages/followUpReminder/component/ManagedUserSelector.vue"; import ManagedUserSelector from "@/pages/followUpReminder/component/ManagedUserSelector.vue";
import type { NavbarAction } from "@/types/NavbarAction.ts";
import { useCurrentStoreStore } from "@/store/currentStoreStore"; import { useCurrentStoreStore } from "@/store/currentStoreStore";
import type { ManagedUser } from "@/types/ManagedUser"; import type { ManagedUser } from "@/types/ManagedUser";
import type { FollowUpReminder, FollowUpReminderPage, FollowUpReminderStatus } from "@/types/FollowUpReminder"; import type { FollowUpReminder, FollowUpReminderPage, FollowUpReminderStatus } from "@/types/FollowUpReminder";
import { getCustomerPhotoURL } from "@/utils/customer";
import { parseDateTime } from "@/utils/date"; import { parseDateTime } from "@/utils/date";
import { gaoRoleCodes, permissionCodes } from "@/utils/permission"; import { corePermissionCodes, gaoRoleCodes, permissionCodes } from "@/utils/permission";
import type { Customer } from "@/types/Customer"; import type { Customer } from "@/types/Customer";
@@ -248,12 +179,21 @@ defineOptions({
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const createPaneId = "__create__";
const birthdayPaneId = "__birthday_setting__";
// 选中项、编辑态、切换方向、关闭逻辑、转屏、query 同步都在这里 // 选中项、编辑态、切换方向、关闭逻辑、转屏、query 同步都在这里
const { selectedId, editing, detailVersion, paneDirection, isWide, openDetail, openEdit } = const { selectedId, editing, detailVersion, paneDirection, isWide, openDetail, openEdit } =
useMasterDetailPane({ useMasterDetailPane({
path: "/management/customer-follow-up-reminders", path: "/management/customer-follow-up-reminders",
detail: id => `/management/customer-follow-up-reminders/${id}`, detail: id => id === birthdayPaneId
edit: id => `/management/customer-follow-up-reminders/${id}/edit` ? "/management/customer-birthday-reminder-setting"
: id === createPaneId
? `/management/customer-follow-up-reminders/create${selectedCustomerId.value ? `?customerId=${encodeURIComponent(selectedCustomerId.value)}` : ""}`
: `/management/customer-follow-up-reminders/${id}`,
edit: id => id === createPaneId
? `/management/customer-follow-up-reminders/create${selectedCustomerId.value ? `?customerId=${encodeURIComponent(selectedCustomerId.value)}` : ""}`
: `/management/customer-follow-up-reminders/${id}/edit`
}); });
const userStore = useUserStore(); const userStore = useUserStore();
const currentStoreStore = useCurrentStoreStore(); const currentStoreStore = useCurrentStoreStore();
@@ -262,6 +202,7 @@ const isGlobalManager = computed(() => userStore.hasRoles(gaoRoleCodes.globalMan
const canCreate = computed(() => userStore.hasPermissions(permissionCodes.customerFollowUpReminder.create)); const canCreate = computed(() => userStore.hasPermissions(permissionCodes.customerFollowUpReminder.create));
const canComplete = computed(() => userStore.hasPermissions(permissionCodes.customerFollowUpReminder.complete)); const canComplete = computed(() => userStore.hasPermissions(permissionCodes.customerFollowUpReminder.complete));
const canDelete = computed(() => userStore.hasPermissions(permissionCodes.customerFollowUpReminder.delete)); const canDelete = computed(() => userStore.hasPermissions(permissionCodes.customerFollowUpReminder.delete));
const canStoreSetting = computed(() => userStore.hasPermissions(corePermissionCodes.setting.update));
// ---------- 筛选 ---------- // ---------- 筛选 ----------
@@ -520,139 +461,71 @@ async function loadStoreScope(): Promise<void> {
// ---------- 展示 ---------- // ---------- 展示 ----------
function getCustomerName(item: FollowUpReminder): string {
return item.customer?.name || item.customer?.code || item.customerId || "未命名客户";
}
function getManagedUserName(item: ManagedUser): string { function getManagedUserName(item: ManagedUser): string {
return item.user?.nick || item.user?.name || item.userId || "未命名负责人"; return item.user?.nick || item.user?.name || item.userId || "未命名负责人";
} }
function getResponsibleName(item: FollowUpReminder): string {
return item.responsibleUser?.nick || item.responsibleUser?.name || item.responsibleUserId || "未命名负责人";
}
function getReminderTimeText(remindAt?: number): string {
return remindAt ? Time.toDateTime(remindAt) : "-";
}
function getReminderTimeClass(item: FollowUpReminder): "near" | "soon" | "later" | "normal" {
if (item.status === "COMPLETED" || !item.remindAt) {
return "normal";
}
const distance = item.remindAt - Time.now();
if (distance < 24 * 60 * 60 * 1000) {
return "near";
}
if (distance < 3 * 24 * 60 * 60 * 1000) {
return "soon";
}
return "later";
}
function getContentSummary(content?: string): string {
const text = content?.trim() || "未填写跟进内容";
return 60 < text.length ? `${text.slice(0, 60)}...` : text;
}
function getStatusText(status?: FollowUpReminderStatus): string {
return status === "COMPLETED" ? "已完成" : "待完成";
}
function getStatusTheme(status?: FollowUpReminderStatus): "success" | "warning" {
return status === "COMPLETED" ? "success" : "warning";
}
// ---------- 操作 ---------- // ---------- 操作 ----------
const operatingId = ref(""); function removeFromList(item: FollowUpReminder): void {
const operatingType = ref<"complete" | "delete">(); pageResult.list = pageResult.list.filter(current => current.id !== item.id);
pageResult.total = Math.max(0, pageResult.total - 1);
function confirmComplete(item: FollowUpReminder): void {
if (!item.id || !canComplete.value || item.status !== "PENDING" || operatingId.value) {
return;
}
const dialog = DialogPlugin.confirm({
title: "完成跟进提醒",
content: "完成后不能重新打开,确定完成此跟进提醒吗?",
cancelBtn: "取消",
confirmBtn: "完成",
onCancel() {
dialog.destroy();
},
onConfirm: async () => {
dialog.destroy();
await complete(item.id || "");
}
});
}
async function complete(id: string): Promise<void> {
operatingId.value = id;
operatingType.value = "complete";
try {
await FollowUpReminderAPI.complete(id);
const item = pageResult.list.find(current => current.id === id);
if (item) {
item.status = "COMPLETED";
}
Message.success("跟进提醒已完成");
} catch (error) {
Message.error(getErrorMessage(error, "跟进提醒完成失败"));
} finally {
operatingId.value = "";
operatingType.value = undefined;
}
}
function confirmDelete(item: FollowUpReminder): void {
if (!item.id || !canDelete.value || operatingId.value) {
return;
}
const dialog = DialogPlugin.confirm({
title: "删除跟进提醒",
content: "删除后列表中将不再显示,确定删除这条跟进提醒吗?",
cancelBtn: "取消",
confirmBtn: "删除",
onCancel() {
dialog.destroy();
},
onConfirm: async () => {
dialog.destroy();
await remove(item.id || "");
}
});
}
async function remove(id: string): Promise<void> {
operatingId.value = id;
operatingType.value = "delete";
try {
await FollowUpReminderAPI.remove(id);
pageResult.list = pageResult.list.filter(item => item.id !== id);
pageResult.total = Math.max(0, pageResult.total - 1);
Message.success("跟进提醒已删除");
} catch (error) {
Message.error(getErrorMessage(error, "跟进提醒删除失败"));
} finally {
operatingId.value = "";
operatingType.value = undefined;
}
} }
// ---------- 导航和生命周期 ---------- // ---------- 导航和生命周期 ----------
async function toCreate(): Promise<void> { async function toCreate(): Promise<void> {
if (isWide.value) {
openDetail(createPaneId);
return;
}
await router.push({ await router.push({
name: "CustomerFollowUpReminderCreate", name: "CustomerFollowUpReminderCreate",
query: selectedCustomerId.value ? { customerId: selectedCustomerId.value } : undefined query: selectedCustomerId.value ? { customerId: selectedCustomerId.value } : undefined
}); });
} }
async function toBirthdaySetting(): Promise<void> {
if (isWide.value) {
openDetail(birthdayPaneId);
return;
}
await router.push({ name: "CustomerBirthdayReminderSetting" });
}
const actionList = computed<NavbarAction[]>(() => {
const list: NavbarAction[] = [];
if (canCreate.value) {
list.push({
action: toCreate,
theme: "primary",
icon: "add",
key: "create",
text: "新增"
});
}
if (canStoreSetting.value) {
list.push({
action: toBirthdaySetting,
theme: "primary",
icon: "setting",
key: "birthday-setting",
text: "生日提醒设置"
});
}
return list;
});
async function toDetail(item: FollowUpReminder): Promise<void> { async function toDetail(item: FollowUpReminder): Promise<void> {
openDetail(item.id || ""); openDetail(item.id || "");
} }
watch([selectedId, detailVersion], async ([id, version], [previousId, previousVersion]) => {
if ((!id && previousId) || version !== previousVersion) {
await refresh();
}
});
onMounted(async () => { onMounted(async () => {
try { try {
@@ -714,107 +587,14 @@ watch(() => route.query.customerId, async value => {
} }
.items { .items {
gap: .5rem;
margin: 0 1rem;
display: flex;
flex-direction: column;
.item { }
.cell {
padding: 10px;
min-width: 0;
:deep(.t-cell__title),
:deep(.t-cell__title-text) {
min-width: 0;
overflow: hidden;
}
.avatar {
width: 3.5rem;
height: 3.5rem;
}
.title {
gap: .5rem;
width: 100%;
display: flex;
min-width: 0;
font-size: .875rem;
align-items: center;
justify-content: space-between;
.name-channel {
gap: .5rem;
display: flex;
min-width: 0;
overflow: hidden;
align-items: center;
> .text-bold {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.description {
font-size: .75rem;
width: 100%;
min-width: 0;
max-width: 100%;
overflow: hidden;
line-height: 1.25;
.remind-time {
font-weight: 600;
&.near {
color: var(--td-error-color);
}
&.soon {
color: var(--td-warning-color);
}
&.later {
color: var(--td-success-color);
}
}
.content {
color: var(--td-text-color-secondary);
width: 100%;
min-width: 0;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.time-responsible {
display: flex;
justify-content: space-between;
}
}
}
}
.swipe-actions {
--td-button-border-radius: 0;
.complete {
color: #fff;
background: var(--td-success-color);
}
.delete {
color: #fff;
background: var(--td-error-color);
}
}
} }
} }
}
:global(html.theme-dark) { :global(html.theme-dark) {
.follow-up-reminder-list { .follow-up-reminder-list {
@@ -823,17 +603,12 @@ watch(() => route.query.customerId, async value => {
} }
.summary, .summary {
.items .item,
.items .cell {
color: #e2e8f0; color: #e2e8f0;
background: rgba(30, 41, 59, .9); background: rgba(30, 41, 59, .9);
border-color: rgba(148, 163, 184, .16); border-color: rgba(148, 163, 184, .16);
} }
.description .content {
color: #94a3b8;
}
} }
} }
@@ -0,0 +1,295 @@
<template>
<div class="item">
<div class="header">
<t-image v-if="getCustomerPhotoURL(item.customer, 64)" :src="getCustomerPhotoURL(item.customer, 64)"
:alt="customerName" fit="cover" class="avatar" />
<div v-else class="avatar fallback" v-text="customerName.slice(0, 1)" />
<div class="main">
<div class="customer-status">
<strong class="customer clip-text" v-text="customerName" />
<div class="tags">
<t-tag
v-if="item.metadata?.bizType === 'BIRTHDAY'"
size="small"
theme="success"
variant="outline"
content="生日"
/>
<t-tag
v-if="item.source === 'SYSTEM'"
size="small"
theme="warning"
variant="outline"
content="系统"
/>
<t-tag
size="small"
variant="light-outline"
:theme="item.status === 'COMPLETED' ? 'success' : 'warning'"
:content="item.status === 'COMPLETED' ? '已完成' : '待完成'"
/>
</div>
</div>
<div class="record-line">
<span
class="time"
:class="timeClass"
v-text="item.remindAt ? Time.toDateTime(item.remindAt) : '-'"
/>
<div class="tags">
<t-tag
v-if="item.notifyChannelList?.includes('INTERNAL')"
size="small"
theme="primary"
variant="outline"
content="站内信"
/>
<t-tag
v-if="item.notifyChannelList?.includes('SMS')"
size="small"
theme="warning"
variant="outline"
content="短信"
/>
</div>
</div>
</div>
</div>
<t-divider />
<div class="content" v-text="item.content?.trim() || '未填写跟进内容'" />
<t-divider />
<div class="people-actions">
<div class="person"><span class="label">负责人</span><strong v-text="responsibleName" /></div>
<div class="actions">
<t-button
v-if="canDelete"
theme="danger"
variant="text"
size="extra-small"
content="删除"
:loading="operating === 'delete'"
:disabled="!!operating"
@click.stop="confirmDelete"
/>
<t-button
v-if="canComplete && item.status === 'PENDING'"
theme="primary"
variant="outline"
size="extra-small"
content="完成"
:loading="operating === 'complete'"
:disabled="!!operating"
@click.stop="confirmComplete"
/>
<t-button theme="primary" size="extra-small" content="详情" @click.stop="emit('detail')" />
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { Time } from "timi-web";
import { DialogPlugin } from "tdesign-mobile-vue";
import FollowUpReminderAPI from "@/api/FollowUpReminderAPI";
import { Message } from "@/utils/message";
import { getErrorMessage } from "@/utils/error";
import type { FollowUpReminder } from "@/types/FollowUpReminder";
import { getCustomerPhotoURL } from "@/utils/customer";
defineOptions({ name: "FollowUpReminderListCell" });
const props = defineProps<{
item: FollowUpReminder;
canComplete: boolean;
canDelete: boolean;
}>();
const emit = defineEmits<{ detail: []; complete: []; delete: [] }>();
const operating = ref<"complete" | "delete">();
const customerName = computed(() => props.item.customer?.name || props.item.customer?.code || props.item.customerId || "未命名客户");
const responsibleName = computed(() => props.item.responsibleUser?.nick || props.item.responsibleUser?.name || props.item.responsibleUserId || "未命名负责人");
const timeClass = computed(() => {
if (props.item.status === "COMPLETED" || !props.item.remindAt) return "normal";
const distance = props.item.remindAt - Time.now();
if (distance < 24 * 60 * 60 * 1000) return "near";
if (distance < 3 * 24 * 60 * 60 * 1000) return "soon";
return "later";
});
function confirmComplete(): void {
if (!props.item.id || !props.canComplete || props.item.status !== "PENDING" || operating.value) return;
const dialog = DialogPlugin.confirm({
title: "完成跟进提醒",
content: "完成后不能重新打开,确定完成此跟进提醒吗?",
cancelBtn: "取消",
confirmBtn: "完成",
onCancel() { dialog.destroy(); },
onConfirm: async () => {
dialog.destroy();
await operate("complete");
}
});
}
function confirmDelete(): void {
if (!props.item.id || !props.canDelete || operating.value) return;
const dialog = DialogPlugin.confirm({
title: "删除跟进提醒",
content: "删除后列表中将不再显示,确定删除这条跟进提醒吗?",
cancelBtn: "取消",
confirmBtn: "删除",
onCancel() { dialog.destroy(); },
onConfirm: async () => {
dialog.destroy();
await operate("delete");
}
});
}
async function operate(action: "complete" | "delete"): Promise<void> {
const id = props.item.id;
if (!id || operating.value) return;
operating.value = action;
try {
if (action === "complete") {
await FollowUpReminderAPI.complete(id);
Message.success("跟进提醒已完成");
emit("complete");
} else {
await FollowUpReminderAPI.remove(id);
Message.success("跟进提醒已删除");
emit("delete");
}
} catch (error) {
Message.error(getErrorMessage(error, action === "complete" ? "跟进提醒完成失败" : "跟进提醒删除失败"));
} finally {
operating.value = undefined;
}
}
</script>
<style scoped lang="less">
.item {
gap: .5rem;
padding: .625rem;
display: flex;
background: var(--td-bg-color-container);
flex-direction: column;
border-radius: 1rem;
.header {
gap: .5rem;
display: flex;
.avatar {
width: 3.5rem;
height: 3.5rem;
}
.main {
gap: .5rem;
flex: 1;
display: flex;
min-width: 0;
flex-direction: column;
}
.customer-status, .record-line {
gap: .5rem;
display: flex;
align-items: center;
justify-content: space-between;
}
.customer {
min-width: 0;
}
.tags {
gap: .5rem;
display: flex;
align-items: center;
}
.record-line {
.time {
font-size: .875rem;
&.near {
color: var(--td-error-color);
}
&.soon {
color: var(--td-warning-color);
}
&.later {
color: var(--td-success-color);
}
}
.tags {
flex-wrap: wrap;
justify-content: flex-end;
}
}
}
.content {
width: 100%;
min-width: 0;
overflow: hidden;
font-size: .75rem;
white-space: nowrap;
text-overflow: ellipsis;
}
.people-actions {
gap: .75rem;
display: flex;
align-items: center;
justify-content: space-between;
.person {
gap: .25rem;
display: flex;
min-width: 0;
font-size: .75rem;
align-items: baseline;
.label {
color: var(--td-text-color-secondary);
flex: 0 0 auto;
}
strong {
max-width: 10rem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.actions {
--td-button-border-radius: .5rem;
gap: .5rem;
display: flex;
justify-content: end;
}
}
}
:deep(.avatar .t-image__img) {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: inherit;
}
:global(html.theme-dark) .item .fallback {
background: #115e59;
}
</style>
+1 -1
View File
@@ -528,7 +528,7 @@ onMounted(async () => {
.package-config-edit { .package-config-edit {
gap: 1rem; gap: 1rem;
display: flex; display: flex;
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0)); padding: 0 0 calc(1rem + var(--tui-safe-bottom, 0px));
flex-direction: column; flex-direction: column;
.form { .form {
+1 -1
View File
@@ -280,7 +280,7 @@ onMounted(async () => {
.bottom-actions { .bottom-actions {
left: 1rem; left: 1rem;
right: 1rem; right: 1rem;
bottom: calc(.75rem + env(safe-area-inset-bottom, 0)); bottom: calc(.75rem + var(--tui-safe-bottom, 0px));
position: fixed; position: fixed;
.t-button { .t-button {
+1 -1
View File
@@ -554,7 +554,7 @@ onUnmounted(() => {
right: 1rem; right: 1rem;
gap: .75rem; gap: .75rem;
z-index: 20; z-index: 20;
bottom: calc(.75rem + env(safe-area-inset-bottom, 0)); bottom: calc(.75rem + var(--tui-safe-bottom, 0px));
display: flex; display: flex;
position: fixed; position: fixed;
+1 -1
View File
@@ -616,7 +616,7 @@ onMounted(async () => {
<style scoped lang="less"> <style scoped lang="less">
.point-rule-edit { .point-rule-edit {
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0)); padding: 0 0 calc(1rem + var(--tui-safe-bottom, 0px));
.form { .form {
gap: 1rem; gap: 1rem;
+32 -26
View File
@@ -202,7 +202,6 @@
<product-sku-unit-batch-editor <product-sku-unit-batch-editor
v-model="batchUnitEditorVisible" v-model="batchUnitEditorVisible"
v-model:unit-list="batchUnitList" v-model:unit-list="batchUnitList"
v-model:base-unit-migration-ratio-text="batchBaseUnitMigrationRatioText"
:product-type="form.productType" :product-type="form.productType"
:sku-count="form.skuList.length" :sku-count="form.skuList.length"
@apply="applyBatchUnitTemplate" @apply="applyBatchUnitTemplate"
@@ -348,7 +347,6 @@ const unitEditorVisible = ref(false);
const editingSku = ref<SkuForm>(); const editingSku = ref<SkuForm>();
const batchUnitEditorVisible = ref(false); const batchUnitEditorVisible = ref(false);
const batchUnitList = ref<UnitForm[]>([]); const batchUnitList = ref<UnitForm[]>([]);
const batchBaseUnitMigrationRatioText = ref("");
const removedSkuKeySet = new Set<string>(); const removedSkuKeySet = new Set<string>();
const removedSkuMap = new Map<string, SkuForm>(); const removedSkuMap = new Map<string, SkuForm>();
@@ -389,7 +387,6 @@ function createSku(sku?: Partial<ProductSku>): SkuForm {
minStockQuantityText: sku?.minStockQuantity === null || sku?.minStockQuantity === undefined ? "" : String(sku.minStockQuantity), minStockQuantityText: sku?.minStockQuantity === null || sku?.minStockQuantity === undefined ? "" : String(sku.minStockQuantity),
unitList: sourceUnitList.length ? sourceUnitList.map(unit => createUnit(unit)) : [createUnit({ isBase: true, baseQuantityPerUnit: "1" })], unitList: sourceUnitList.length ? sourceUnitList.map(unit => createUnit(unit)) : [createUnit({ isBase: true, baseQuantityPerUnit: "1" })],
originalBaseUnitId, originalBaseUnitId,
baseUnitMigrationRatioText: "",
photoItemList photoItemList
}; };
} }
@@ -473,7 +470,6 @@ function openBatchUnitEditor(): void {
return; return;
} }
batchUnitList.value = sourceSku.unitList.map(unit => ({ ...unit, id: undefined, skuId: undefined, clientKey: window.crypto.randomUUID() })); batchUnitList.value = sourceSku.unitList.map(unit => ({ ...unit, id: undefined, skuId: undefined, clientKey: window.crypto.randomUUID() }));
batchBaseUnitMigrationRatioText.value = "";
batchUnitEditorVisible.value = true; batchUnitEditorVisible.value = true;
} }
@@ -483,10 +479,15 @@ function closeBatchUnitEditor(): void {
function applyBatchUnitTemplate(): void { function applyBatchUnitTemplate(): void {
const templateList = batchUnitList.value; const templateList = batchUnitList.value;
for (const sku of form.skuList) {
const conflict = getBatchUnitConflict(sku, templateList);
if (conflict) {
Message.warning(conflict);
return;
}
}
form.skuList.forEach(sku => { form.skuList.forEach(sku => {
const oldUnitList = sku.unitList; const oldUnitMap = new Map(sku.unitList.filter(unit => !!unit.id).map(unit => [unit.name.trim(), unit]));
const oldUnitMap = new Map(oldUnitList.filter(unit => !!unit.id).map(unit => [unit.name.trim(), unit]));
const oldBaseUnit = oldUnitList.find(unit => unit.isBase);
sku.unitList = templateList.map((unit, unitIndex) => ({ sku.unitList = templateList.map((unit, unitIndex) => ({
...unit, ...unit,
id: oldUnitMap.get(unit.name.trim())?.id, id: oldUnitMap.get(unit.name.trim())?.id,
@@ -494,14 +495,31 @@ function applyBatchUnitTemplate(): void {
clientKey: window.crypto.randomUUID(), clientKey: window.crypto.randomUUID(),
sort: unitIndex sort: unitIndex
})); }));
const newBaseUnit = sku.unitList.find(unit => unit.isBase);
if (oldBaseUnit?.id && newBaseUnit && oldBaseUnit.id !== newBaseUnit.id) {
sku.baseUnitMigrationRatioText = batchBaseUnitMigrationRatioText.value;
}
}); });
Message.success(`已为 ${form.skuList.length} 个 SKU 统一配置销售单位`); Message.success(`已为 ${form.skuList.length} 个 SKU 统一配置销售单位`);
} }
/// 校验批量模板与已保存 SKU 的冲突,返回冲突提示;无冲突返回 undefined
function getBatchUnitConflict(sku: SkuForm, templateList: UnitForm[]): string | undefined {
if (sku.unitEditable === true) {
return undefined;
}
const skuLabel = sku.name || sku.specSummary || "默认 SKU";
const oldBaseUnit = sku.unitList.find(unit => unit.isBase);
const templateBaseUnit = templateList.find(unit => unit.isBase);
if (oldBaseUnit?.id && templateBaseUnit?.name.trim() !== oldBaseUnit.name.trim()) {
return `「${skuLabel}」的基础单位为 ${oldBaseUnit.name},该 SKU 已产生业务记录,不能更换基础单位`;
}
const oldUnitMap = new Map(sku.unitList.filter(unit => !!unit.id).map(unit => [unit.name.trim(), unit]));
for (const unit of templateList) {
const existing = oldUnitMap.get(unit.name.trim());
if (existing && Number(existing.baseQuantityPerUnit) !== Number(unit.baseQuantityPerUnit)) {
return `「${skuLabel}」的「${existing.name.trim()}」是已保存单位,换算数量不能修改`;
}
}
return undefined;
}
function removeSku(index: number): void { function removeSku(index: number): void {
const sku = form.skuList[index]; const sku = form.skuList[index];
if (!sku) { if (!sku) {
@@ -969,13 +987,8 @@ function validate(): boolean {
return false; return false;
} }
const selectedBaseUnit = sku.unitList.find(unit => unit.isBase); const selectedBaseUnit = sku.unitList.find(unit => unit.isBase);
const isBaseUnitChanged = !!sku.originalBaseUnitId && selectedBaseUnit?.id !== sku.originalBaseUnitId; if (sku.originalBaseUnitId && selectedBaseUnit?.id !== sku.originalBaseUnitId && sku.unitEditable !== true) {
if (isBaseUnitChanged && !/^\d+(?:\.\d{1,6})?$/.test(sku.baseUnitMigrationRatioText.trim())) { Message.warning("SKU 已产生业务记录,不能更换基础单位,如需调整请新建 SKU");
Message.warning("切换基础单位时,请填写有效的新旧基础单位换算比例,最多六位小数");
return false;
}
if (isBaseUnitChanged && !(0 < Number(sku.baseUnitMigrationRatioText))) {
Message.warning("新旧基础单位换算比例必须大于 0");
return false; return false;
} }
} }
@@ -1007,14 +1020,7 @@ function buildSkuPayload(sku: SkuForm, index: number): ProductSku {
allowPurchase: form.productType === "SERVICE" ? false : !!unit.allowPurchase, allowPurchase: form.productType === "SERVICE" ? false : !!unit.allowPurchase,
allowSale: !!unit.allowSale, allowSale: !!unit.allowSale,
sort: unitIndex sort: unitIndex
})), }))
baseUnitMigrationRequest: sku.id && sku.originalBaseUnitId && sku.unitList.find(unit => unit.isBase)?.id !== sku.originalBaseUnitId
? {
targetUnitId: sku.unitList.find(unit => unit.isBase)?.id,
targetUnitName: sku.unitList.find(unit => unit.isBase)?.name.trim(),
oldToNewBaseRatio: sku.baseUnitMigrationRatioText.trim()
}
: undefined
}; };
} }
@@ -468,7 +468,7 @@ watch(resolveId, async (id, previousId) => {
} }
.revoke-popup { .revoke-popup {
padding: .5rem 1rem calc(1rem + env(safe-area-inset-bottom, 0)); padding: .5rem 1rem calc(1rem + var(--tui-safe-bottom, 0px));
.tip { .tip {
margin: 0 0 .75rem; margin: 0 0 .75rem;
@@ -179,7 +179,7 @@ function setSkuStatus(value: boolean | string | number): void {
} }
.sku-popup { .sku-popup {
padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom, 0px)); padding: 1rem 0 calc(1rem + var(--tui-safe-bottom, 0px));
max-height: 100%; max-height: 100%;
overflow-y: auto; overflow-y: auto;
@@ -14,9 +14,6 @@
<div class="editor-context"> <div class="editor-context">
<strong>批量配置销售单位</strong> <strong>批量配置销售单位</strong>
<span v-text="`以下单位将应用到全部 ${props.skuCount} 个 SKU 明细`" /> <span v-text="`以下单位将应用到全部 ${props.skuCount} 个 SKU 明细`" />
<t-form-item label="基础单位换算比例" help="切换已有 SKU 的基础单位时填写:1 个旧基础单位等于多少个新基础单位;最多六位小数">
<t-input v-model.trim="baseUnitMigrationRatioText" type="number" align="right" borderless placeholder="无需切换时留空" />
</t-form-item>
</div> </div>
<div class="unit-list"> <div class="unit-list">
@@ -29,7 +26,7 @@
<t-form-item label="单位名称" required-mark> <t-form-item label="单位名称" required-mark>
<t-input v-model.trim="unit.name" borderless maxlength="32" placeholder="如 件、盒、箱" /> <t-input v-model.trim="unit.name" borderless maxlength="32" placeholder="如 件、盒、箱" />
</t-form-item> </t-form-item>
<t-form-item label="基础单位" content-align="right"> <t-form-item label="基础单位" content-align="right" help="已产生业务记录的 SKU 沿用原基础单位">
<t-switch v-model="unit.isBase" size="small" :disabled="unitList.length === 1" @change="setBaseUnit(unitIndex)" /> <t-switch v-model="unit.isBase" size="small" :disabled="unitList.length === 1" @change="setBaseUnit(unitIndex)" />
</t-form-item> </t-form-item>
<t-form-item label="换算数量" help="1 个当前单位对应的基础单位数量" required-mark> <t-form-item label="换算数量" help="1 个当前单位对应的基础单位数量" required-mark>
@@ -74,7 +71,6 @@ const props = defineProps<{
}>(); }>();
const unitList = defineModel<ProductSkuUnitForm[]>("unitList", { required: true }); const unitList = defineModel<ProductSkuUnitForm[]>("unitList", { required: true });
const baseUnitMigrationRatioText = defineModel<string>("baseUnitMigrationRatioText", { default: "" });
const emit = defineEmits<{ const emit = defineEmits<{
"update:modelValue": [value: boolean]; "update:modelValue": [value: boolean];
apply: []; apply: [];
@@ -145,7 +141,7 @@ function setBaseUnit(index: number): void {
.batch-editor { .batch-editor {
max-height: 100%; max-height: 100%;
overflow-y: auto; overflow-y: auto;
padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom, 0px)); padding: 1rem 0 calc(1rem + var(--tui-safe-bottom, 0px));
.editor-context { .editor-context {
gap: .25rem; gap: .25rem;
@@ -35,14 +35,11 @@
<t-form-item label="单位名称" required-mark> <t-form-item label="单位名称" required-mark>
<t-input v-model.trim="unit.name" borderless maxlength="32" placeholder="如 件、盒、箱" /> <t-input v-model.trim="unit.name" borderless maxlength="32" placeholder="如 件、盒、箱" />
</t-form-item> </t-form-item>
<t-form-item label="基础单位" content-align="right"> <t-form-item label="基础单位" content-align="right" :help="canChangeBaseUnit ? undefined : 'SKU 已产生业务记录,基础单位不可更换'">
<t-switch v-model="unit.isBase" size="small" :disabled="sku.unitList.length === 1" @change="setBaseUnit(unitIndex)" /> <t-switch v-model="unit.isBase" size="small" :disabled="!canChangeBaseUnit || sku.unitList.length === 1" @change="setBaseUnit(unitIndex)" />
</t-form-item> </t-form-item>
<t-form-item v-if="isBaseUnitMigrationRequired" label="新旧基础单位比例" help="填写 1 个旧基础单位等于多少个新基础单位;最多六位小数" required-mark> <t-form-item label="换算数量" :help="isUnitConversionLocked(unit) ? '已保存单位的换算关系不可修改' : '1 个当前单位对应的基础单位数量'" required-mark>
<t-input v-model.trim="sku.baseUnitMigrationRatioText" type="number" align="right" borderless placeholder="例如 30" /> <t-input v-model.trim="unit.baseQuantityPerUnit" type="number" align="right" borderless :disabled="isUnitConversionLocked(unit)" placeholder="1" />
</t-form-item>
<t-form-item label="换算数量" help="1 个当前单位对应的基础单位数量" required-mark>
<t-input v-model.trim="unit.baseQuantityPerUnit" type="number" align="right" borderless :disabled="unit.isBase" placeholder="1" />
</t-form-item> </t-form-item>
<t-form-item label="售价(元)"> <t-form-item label="售价(元)">
<t-input v-model.trim="unit.salePriceText" type="number" align="right" borderless placeholder="选填" /> <t-input v-model.trim="unit.salePriceText" type="number" align="right" borderless placeholder="选填" />
@@ -93,12 +90,16 @@ const visible = computed({
set: value => handleVisibleChange(value) set: value => handleVisibleChange(value)
}); });
const unitEditorZIndex = 12100; const unitEditorZIndex = 12100;
const isBaseUnitMigrationRequired = computed(() => { /// 新建 SKU 可自由选择基础单位,已保存的 SKU 仅在未产生业务记录时允许调整
if (!sku.value?.originalBaseUnitId) { const canChangeBaseUnit = computed(() => !sku.value?.id || sku.value?.unitEditable === true);
return false;
/// 基础单位与不可编辑单位的换算数量不可修改
function isUnitConversionLocked(unit: ProductSkuUnitForm): boolean {
if (unit.isBase) {
return true;
} }
return sku.value.unitList.find(unit => unit.isBase)?.id !== sku.value.originalBaseUnitId; return !!sku.value?.id && !!unit.id && sku.value?.unitEditable !== true;
}); }
function handleVisibleChange(value: boolean): void { function handleVisibleChange(value: boolean): void {
emit("update:modelValue", value); emit("update:modelValue", value);
@@ -142,6 +143,10 @@ function removeUnit(index: number): void {
return; return;
} }
const unit = sku.value.unitList[index]; const unit = sku.value.unitList[index];
if (unit?.isBase && sku.value.id && sku.value.unitEditable !== true) {
Message.warning("SKU 已产生业务记录,不能移除基础单位");
return;
}
if (unit?.id) { if (unit?.id) {
Message.info("已移除单位将在保存时由后端检查引用后处理"); Message.info("已移除单位将在保存时由后端检查引用后处理");
} }
@@ -169,7 +174,7 @@ function setBaseUnit(index: number): void {
.product-sku-unit-editor { .product-sku-unit-editor {
gap: .75rem; gap: .75rem;
display: flex; display: flex;
padding: .5rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); padding: .5rem 1rem calc(1rem + var(--tui-safe-bottom, 0px));
max-height: 100%; max-height: 100%;
overflow-y: auto; overflow-y: auto;
flex-direction: column; flex-direction: column;
@@ -4,85 +4,104 @@
:title="`${selectedDate} 库存流水`" :title="`${selectedDate} 库存流水`"
height="80vh" height="80vh"
left-button-text="关闭" left-button-text="关闭"
right-button-text=""
@left-button-click="visible = false" @left-button-click="visible = false"
> >
<div class="records"> <div v-if="canReadRecords" class="records">
<template v-if="canReadRecords"> <div class="filters glass-header">
<div class="directions"> <div v-if="selection" class="summary">
<t-segmented :value="direction" :options="directionOptions" @change="changeDirection" /> <span v-if="summaryLoading">汇总加载中</span>
<div v-if="selection" class="summary"> <span
<span v-if="summaryLoading">汇总加载中</span> v-else
<span v-else :class="direction === 'IN' ? 'in' : 'out'" :class="direction === 'IN' ? 'in' : 'out'"
v-text="`合计 ${formatQuantity(direction === 'IN' ? summary?.inQuantity : summary?.outQuantity)} ${currentUnit?.name || ''}`" /> v-text="`合计 ${formatQuantity(direction === 'IN' ? summary?.inQuantity : summary?.outQuantity)} ${currentUnit?.name || ''}`"
<t-button v-if="1 < units.length" size="extra-small" variant="outline" :content="`单位:${currentUnit?.name}`" @click="nextUnit" /> />
</div> <t-button
v-if="1 < units.length"
size="extra-small"
variant="outline"
:content="`单位:${currentUnit?.name}`"
@click="nextUnit"
/>
</div> </div>
<div class="record-list"> <t-segmented :value="direction" :options="directionOptions" @change="changeDirection" />
<t-cell-group v-if="records.length" class="list empty-cell-title-margin" theme="card"> </div>
<t-cell v-for="record in records" :key="record.id" class="item"> <t-cell-group v-if="records.length" class="list empty-cell-title-margin" theme="card">
<template #leftIcon> <t-cell v-for="record in records" :key="record.id" class="item">
<t-image <template #leftIcon>
v-if="getCustomerPhotoURL(record.customer, 64)" <t-image
:src="getCustomerPhotoURL(record.customer, 64)" v-if="getCustomerPhotoURL(record.customer, 64)"
:alt="getCustomerText(record)" :src="getCustomerPhotoURL(record.customer, 64)"
fit="cover" :alt="getCustomerText(record)"
class="avatar" fit="cover"
/> class="avatar"
<div />
v-else-if="record.customer" <div
class="avatar fallback" v-else-if="record.customer"
v-text="getCustomerText(record).slice(0, 1)" class="avatar fallback"
/> v-text="getCustomerText(record).slice(0, 1)"
<t-image />
v-else-if="record.operator" <t-image
:src="getOperatorAvatar(record)" v-else-if="record.operator"
:alt="getOperatorText(record)" :src="getOperatorAvatar(record)"
fit="cover" :alt="getOperatorText(record)"
class="avatar" fit="cover"
/> class="avatar"
/>
<span
v-else
class="icon"
:class="getDeltaClass(record.onHandDelta)"
>
<t-icon name="history" size="1.25rem" />
</span>
</template>
<template #title>
<div class="title">
<span v-if="record.customer" class="actor" v-text="getCustomerText(record)" />
<span
v-else-if="record.operator"
class="actor"
v-text="getOperatorText(record)"
/>
<strong
class="operation"
:class="getOperationClass(record.operationType)"
v-text="getStockOperationText(record.operationType)"
/>
<strong class="product-name" v-text="record.productNameSnapshot || '未命名产品'" />
<t-tag
v-if="record.skuNameSnapshot && record.productNameSnapshot !== record.skuNameSnapshot"
size="small"
:content="record.skuNameSnapshot"
/>
<span
v-if="record.quantity !== undefined && record.quantity !== null && record.quantity !== ''"
class="record-quantity"
v-text="`${getProductQuantityText(record.quantity)} ${record.unitSnapshot || ''}`"
/>
</div>
</template>
<template #description>
<div class="description">
<time-label :timestamp="record.occurredAt" underline />
<div>
<span <span
v-else class="delta"
class="icon" :class="getDeltaClass(record.onHandDelta)"
:class="getDeltaClass(record.onHandDelta)" v-text="getDeltaText(record.onHandDelta)"
> />
<t-icon name="history" size="1.25rem" /> </div>
</span> </div>
</template> </template>
<template #title> </t-cell>
<div class="record-title"> </t-cell-group>
<span v-if="record.customer" class="actor" v-text="getCustomerText(record)" /> <t-empty v-else-if="!recordsLoading" description="当天暂无流水" />
<span v-else-if="record.operator" class="actor" <t-button v-if="!noMore" block variant="text" :loading="recordsLoading" @click="loadRecords">
v-text="getOperatorText(record)" /> 加载更多
<strong class="operation" :class="getOperationClass(record.operationType)" </t-button>
v-text="getStockOperationText(record.operationType)" />
<strong class="product-name"
v-text="record.productNameSnapshot || '未命名产品'" />
<t-tag
v-if="record.skuNameSnapshot && record.productNameSnapshot !== record.skuNameSnapshot"
size="small" :content="record.skuNameSnapshot" />
<span
v-if="record.quantity !== undefined && record.quantity !== null && record.quantity !== ''"
class="record-quantity"
v-text="`${getProductQuantityText(record.quantity)} ${record.unitSnapshot || ''}`" />
</div>
</template>
<template #description>
<div class="description">
<time-label :timestamp="record.occurredAt" underline />
<div><span class="delta" :class="getDeltaClass(record.onHandDelta)"
v-text="getDeltaText(record.onHandDelta)" /></div>
</div>
</template>
</t-cell>
</t-cell-group>
<t-empty v-else-if="!recordsLoading" description="当天暂无流水" />
<t-button v-if="!noMore" block variant="text" :loading="recordsLoading" @click="loadRecords">
加载更多
</t-button>
</div>
</template>
<t-empty v-else description="暂无库存流水查看权限" />
</div> </div>
<t-empty v-else description="暂无库存流水查看权限" />
</bottom-popup> </bottom-popup>
</template> </template>
@@ -236,160 +255,158 @@ defineExpose({ openDay });
<style scoped lang="less"> <style scoped lang="less">
.records { .records {
height: 60vh; height: 100%;
display: flex; overflow-y: auto;
min-height: 0;
flex-direction: column;
.directions { .filters {
gap: .5rem; gap: .5rem;
top: 0;
display: flex; display: flex;
padding: .75rem; padding: .75rem;
z-index: 1;
position: sticky;
min-width: 0; min-width: 0;
flex-shrink: 0; flex-shrink: 0;
align-items: center; align-items: center;
justify-content: space-between; justify-content: end;
}
.summary { .summary {
gap: .75rem; gap: .75rem;
display: flex; display: flex;
min-width: 0; min-width: 0;
font-size: .875rem; font-size: .875rem;
align-items: center; align-items: center;
white-space: nowrap; white-space: nowrap;
.in { color: var(--td-success-color); } .in {
.out { color: var(--td-error-color); } color: var(--td-success-color);
} }
.record-list { .out {
overflow-x: hidden; color: var(--td-error-color);
overflow-y: auto; }
min-width: 0; }
min-height: 0;
flex: 1;
}
.avatar {
width: 3.5rem;
height: 3.5rem;
} }
.list { .list {
margin: 0; margin: 0;
}
.item { .item {
padding: .625rem; padding: .625rem;
min-width: 0; min-width: 0;
}
.icon { .avatar {
width: 2.25rem; width: 3.5rem;
height: 2.25rem; height: 3.5rem;
display: inline-flex;
background: var(--td-bg-color-secondarycontainer);
align-items: center;
border-radius: 50%;
justify-content: center;
}
.record-title {
gap: .25rem;
display: flex;
min-width: 0;
max-width: 100%;
font-size: .75rem;
align-items: center;
white-space: nowrap;
.actor {
flex: 0 0 auto;
color: var(--td-text-color-brand);
}
.operation, .record-quantity {
flex: 0 0 auto;
}
.operation {
color: var(--operation-color, var(--td-text-color-secondary));
&.initial-in {
--operation-color: #2563eb;
} }
&.manual-in { .icon {
--operation-color: #15803d; width: 2.25rem;
height: 2.25rem;
display: inline-flex;
background: var(--td-bg-color-secondarycontainer);
align-items: center;
border-radius: 50%;
justify-content: center;
} }
&.manual-out { .title {
--operation-color: #c2410c; gap: .25rem;
display: flex;
min-width: 0;
max-width: 100%;
font-size: .75rem;
align-items: center;
white-space: nowrap;
.actor {
flex: 0 0 auto;
color: var(--td-text-color-brand);
}
.operation, .record-quantity {
flex: 0 0 auto;
}
.operation {
color: var(--operation-color, var(--td-text-color-secondary));
&.initial-in {
--operation-color: #2563eb;
}
&.manual-in {
--operation-color: #15803d;
}
&.manual-out {
--operation-color: #c2410c;
}
&.manual-revoke {
--operation-color: #be123c;
}
&.order-reserve {
--operation-color: #7c3aed;
}
&.order-release {
--operation-color: #0891b2;
}
&.order-out {
--operation-color: #dc2626;
}
&.order-revoke {
--operation-color: #4f46e5;
}
&.return-in {
--operation-color: #15803d;
}
&.stocktake-gain {
--operation-color: #0f766e;
}
&.stocktake-loss {
--operation-color: #a16207;
}
}
.product-name {
overflow: hidden;
flex: 0 1 auto;
text-overflow: ellipsis;
}
.record-quantity {
color: var(--td-text-color-secondary);
}
} }
&.manual-revoke { .description {
--operation-color: #be123c; gap: .5rem;
display: flex;
font-size: .75rem;
align-items: center;
justify-content: space-between;
} }
&.order-reserve { .delta {
--operation-color: #7c3aed; font-size: 1.25rem;
} }
&.order-release { .positive {
--operation-color: #0891b2; color: var(--td-success-color);
} }
&.order-out { .negative {
--operation-color: #dc2626; color: var(--td-error-color);
}
&.order-revoke {
--operation-color: #4f46e5;
}
&.return-in {
--operation-color: #15803d;
}
&.stocktake-gain {
--operation-color: #0f766e;
}
&.stocktake-loss {
--operation-color: #a16207;
} }
} }
.product-name {
overflow: hidden;
flex: 0 1 auto;
text-overflow: ellipsis;
}
.record-quantity {
color: var(--td-text-color-secondary);
}
}
.description {
gap: .5rem;
display: flex;
font-size: .75rem;
align-items: center;
justify-content: space-between;
}
.delta {
font-size: 1.25rem;
}
.positive {
color: var(--td-success-color);
}
.negative {
color: var(--td-error-color);
} }
} }
@@ -232,7 +232,7 @@ watch(() => [visible.value, props.operation] as const, ([isVisible]) => {
<style scoped lang="less"> <style scoped lang="less">
.operation-popup { .operation-popup {
padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0)); padding-bottom: calc(1rem + var(--tui-safe-bottom, 0px));
.form { .form {
margin: 0; margin: 0;
+8 -4
View File
@@ -20,9 +20,6 @@
</t-navbar> </t-navbar>
<main class="tui-page-content scroll column" v-can="permissionCodes.salesOrder.create"> <main class="tui-page-content scroll column" v-can="permissionCodes.salesOrder.create">
<t-form class="form card" label-width="7rem" v-entrance-transition> <t-form class="form card" label-width="7rem" v-entrance-transition>
<t-form-item label-width="0">
<span>兑换单会生成一张交易订单,商品按订单履约分批领取。回收物支付独立核销,不产生资金流水,也不支持与现金混付。</span>
</t-form-item>
<t-form-item label="兑换模板" arrow content-align="right" @click="openRulePicker"> <t-form-item label="兑换模板" arrow content-align="right" @click="openRulePicker">
<div class="template"> <div class="template">
<span v-text="ruleDisplayText" /> <span v-text="ruleDisplayText" />
@@ -35,7 +32,14 @@
<span v-text="customerName || '请选择'" /> <span v-text="customerName || '请选择'" />
</t-form-item> </t-form-item>
<customer-profile-card v-if="customer" class="customer-profile" :customer="customer" /> <customer-profile-card v-if="customer" class="customer-profile" :customer="customer" />
<t-form-item v-if="canAdjust" label="回收物" arrow content-align="right" @click="itemPickerVisible = true"> <t-form-item
v-if="canAdjust"
label="回收物"
arrow
content-align="right"
required-mark
@click="itemPickerVisible = true"
>
<span v-text="recycleItemName || '请选择'" /> <span v-text="recycleItemName || '请选择'" />
</t-form-item> </t-form-item>
<t-form-item label="回收数量" required-mark content-align="right"> <t-form-item label="回收数量" required-mark content-align="right">
+14 -213
View File
@@ -89,71 +89,15 @@
@click="openEndTime" @click="openEndTime"
/> />
</t-cell-group> </t-cell-group>
<t-cell-group v-if="recordList.length" class="empty-cell-title-margin" theme="card"> <div v-if="recordList.length" class="records">
<t-cell <fund-record-list-cell
class="item"
v-for="item in recordList" v-for="item in recordList"
:key="item.id" :key="item.id"
arrow
v-entrance-transition="{ step: 30 }" v-entrance-transition="{ step: 30 }"
@click="toDetail(item)" :item="item"
> @detail="toDetail(item)"
<template #leftIcon> />
<t-image </div>
v-if="getCustomerPhotoURL(item.customer, 64)"
:src="getCustomerPhotoURL(item.customer, 64)"
:alt="getCustomerText(item)"
fit="cover"
class="avatar"
/>
<div v-else class="avatar fallback" v-text="getCustomerText(item).slice(0, 1)" />
</template>
<template #title>
<div class="title">
<span class="customer clip-text" v-text="getCustomerText(item)" />
<span class="type" :class="getOperationClass(item.operationType)" v-text="getFundOperationText(item.operationType)" />
<t-tag
size="small"
:content="getRecordStatusText(item)"
variant="light-outline"
:theme="getRecordStatusTheme(item)"
/>
</div>
</template>
<template #description>
<div class="description">
<div class="operator">
<div class="field">
<span class="label">发起人</span>
<span class="text-bold" v-text="getOperatorText(item)" />
</div>
<div v-if="item.verifier" class="field">
<span class="label">核销人</span>
<span class="text-bold" v-text="getVerifierText(item)" />
</div>
<time-label :timestamp="item.occurredAt" underline />
</div>
<div class="amounts">
<div class="order-amount">
<span class="label">订单总价</span>
<span>¥</span>
<span v-text="formatPackageAmount(item.salesOrderAmount)" />
</div>
<div class="unpaid-amount">
<span class="label">剩余待收</span>
<span>¥</span>
<span v-text="formatPackageAmount(item.salesOrderUnpaidAmountSnapshot)" />
</div>
<div class="record-amount">
<span class="label">流水金额</span>
<span class="red">¥</span>
<span class="value red" v-text="formatPackageAmount(item.amount)" />
</div>
</div>
</div>
</template>
</t-cell>
</t-cell-group>
<center-tips v-else :content="loading ? '正在加载资金流水' : '暂无资金流水'" /> <center-tips v-else :content="loading ? '正在加载资金流水' : '暂无资金流水'" />
<center-tips :content="loadStateText" /> <center-tips :content="loadStateText" />
</t-pull-down-refresh> </t-pull-down-refresh>
@@ -201,7 +145,8 @@
import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile"; import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
import { type DropdownValue } from "tdesign-mobile-vue"; import { type DropdownValue } from "tdesign-mobile-vue";
import FundRecordDetail from "@/pages/salesOrder/FundRecordDetail.vue"; import FundRecordDetail from "@/pages/salesOrder/FundRecordDetail.vue";
import { TimeLabel, Time } from "timi-web"; import FundRecordListCell from "@/pages/salesOrder/component/FundRecordListCell.vue";
import { Time } from "timi-web";
import { useUserStore } from "timi-web-api"; import { useUserStore } from "timi-web-api";
import CustomerAPI from "@/api/CustomerAPI"; import CustomerAPI from "@/api/CustomerAPI";
import SalesOrderAPI from "@/api/SalesOrderAPI"; import SalesOrderAPI from "@/api/SalesOrderAPI";
@@ -210,11 +155,8 @@ import type { FundOperationType, FundRecord, FundRecordStatus } from "@/types/Sa
import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date"; import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date";
import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter"; import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter";
import { getErrorMessage } from "@/utils/error"; import { getErrorMessage } from "@/utils/error";
import { formatPackageAmount } from "@/utils/package";
import { getFundOperationText, getFundStatusText } from "@/utils/salesOrder";
import { Message } from "@/utils/message"; import { Message } from "@/utils/message";
import { permissionCodes } from "@/utils/permission"; import { permissionCodes } from "@/utils/permission";
import { getCustomerPhotoURL } from "@/utils/customer";
import type { Customer } from "@/types/Customer"; import type { Customer } from "@/types/Customer";
@@ -475,39 +417,6 @@ function buildUnixRange(): [number | undefined, number | undefined] {
]; ];
} }
function getOperatorText(item: FundRecord): string {
return item.operator?.nick || item.operator?.name || item.operatorUserId || "未知";
}
function getVerifierText(item: FundRecord): string {
return item.verifier?.nick || item.verifier?.name || item.verifierUserId || "未核销";
}
function getCustomerText(item: FundRecord): string {
return item.customer?.name || item.customer?.code || item.customerId || "未知客户";
}
function getOperationClass(type?: FundOperationType): string {
return ({
RECEIVE: "receive",
REFUND: "refund",
CONFIRM_NO_REFUND: "confirm-no-refund",
REVOKE: "revoke"
} as Record<string, string>)[type || ""] || "unknown";
}
function getStatusTheme(statusValue?: FundRecordStatus): "success" | "warning" | "danger" | "default" {
return statusValue === "VERIFIED" ? "success" : statusValue === "PENDING" ? "warning" : statusValue === "REJECTED" ? "danger" : "default";
}
function getRecordStatusText(item: FundRecord): string {
return item.revokeRecordId ? "已被冲正" : getFundStatusText(item.status);
}
function getRecordStatusTheme(item: FundRecord): "success" | "warning" | "danger" | "default" {
return item.revokeRecordId ? "danger" : getStatusTheme(item.status);
}
async function toDetail(item: FundRecord): Promise<void> { async function toDetail(item: FundRecord): Promise<void> {
openDetail(item.id || ""); openDetail(item.id || "");
} }
@@ -530,121 +439,13 @@ onMounted(async () => {
.sales-order-record-list { .sales-order-record-list {
padding: var(--tui-nav-height) 0 1rem; padding: var(--tui-nav-height) 0 1rem;
.records {
.item { gap: .5rem;
margin: .75rem;
.avatar { display: flex;
width: 3.5rem; flex-direction: column;
height: 3.5rem;
}
.title {
gap: .25rem;
display: flex;
font-size: .75rem;
align-items: center;
justify-content: space-between;
.customer {
font-weight: 600;
}
.type {
font-weight: 700;
&.receive {
color: #15803d;
}
&.refund {
color: #dc2626;
}
&.confirm-no-refund {
color: #2563eb;
}
&.revoke {
color: #7c3aed;
}
}
}
.description {
display: flex;
align-items: start;
justify-content: space-between;
.operator {
gap: 0;
color: var(--td-text-color-secondary);
display: flex;
font-size: .75rem;
flex-wrap: wrap;
line-height: 1.5;
flex-direction: column;
.field {
gap: .25rem;
display: inline-flex;
}
.label {
color: var(--td-text-color-placeholder);
}
}
.amounts {
display: flex;
font-size: .75rem;
line-height: 1.5;
align-items: end;
flex-direction: column;
.label {
color: var(--td-text-color-placeholder);
}
.order-amount,
.unpaid-amount,
.record-amount {
display: flex;
align-items: baseline;
white-space: nowrap;
}
}
}
}
}
:deep(.sales-order-record-list .avatar .t-image__img) {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: inherit;
}
:global(html.theme-dark) .sales-order-record-list {
.fallback {
background: #115e59;
} }
.operation-type {
&.receive {
color: #86efac;
}
&.refund {
color: #fca5a5;
}
&.confirm-no-refund {
color: #93c5fd;
}
&.revoke {
color: #c4b5fd;
}
}
} }
</style> </style>
+3 -3
View File
@@ -603,7 +603,7 @@ onMounted(() => {
.sales-order-create { .sales-order-create {
gap: 1rem; gap: 1rem;
display: flex; display: flex;
padding: calc(var(--tui-nav-height) + 1rem) 0 calc(6.5rem + env(safe-area-inset-bottom, 0)); padding: calc(var(--tui-nav-height) + 1rem) 0 calc(6.5rem + var(--tui-safe-bottom, 0px));
flex-direction: column; flex-direction: column;
.form { .form {
@@ -753,10 +753,10 @@ onMounted(() => {
left: 1.5rem; left: 1.5rem;
right: 1.5rem; right: 1.5rem;
border: 1px solid rgba(0, 0, 0, .05); border: 1px solid rgba(0, 0, 0, .05);
bottom: calc(env(safe-area-inset-bottom, 0) + 1rem); bottom: calc(var(--tui-safe-bottom, 0px) + 1rem);
z-index: 12; z-index: 12;
display: flex; display: flex;
padding: .5rem 1rem calc(.5rem + env(safe-area-inset-bottom, 0)) 1rem; padding: .5rem 1rem calc(.5rem + var(--tui-safe-bottom, 0px)) 1rem;
position: fixed; position: fixed;
align-items: center; align-items: center;
border-radius: 1.75rem; border-radius: 1.75rem;
@@ -0,0 +1,199 @@
<template>
<div class="item">
<div class="header">
<t-image v-if="getCustomerPhotoURL(item.customer, 64)" :src="getCustomerPhotoURL(item.customer, 64)"
:alt="getCustomerText(item)" fit="cover" class="avatar" />
<div v-else class="avatar fallback" v-text="getCustomerText(item).slice(0, 1)" />
<div class="main">
<div class="customer-status">
<strong class="customer clip-text" v-text="getCustomerText(item)" />
<div class="tags">
<t-tag
size="small"
variant="light"
:theme="item.operationType === 'RECEIVE' ? 'success' : item.operationType === 'REFUND' ? 'danger' : 'default'"
:content="getFundOperationText(item.operationType)"
/>
<t-tag size="small" :content="getRecordStatusText(item)" variant="light-outline"
:theme="getRecordStatusTheme(item)" />
</div>
</div>
<div class="record-line">
<time-label class="time" :timestamp="item.occurredAt" underline />
<div class="amount">
<span class="red">¥</span>
<strong class="value red" v-text="formatPackageAmount(item.amount)" />
</div>
</div>
</div>
</div>
<t-divider />
<div class="amounts">
<span>订单总价 <strong v-text="`¥${formatPackageAmount(item.salesOrderAmount)}`" /></span>
<span>剩余待收 <strong v-text="`¥${formatPackageAmount(item.salesOrderUnpaidAmountSnapshot)}`" /></span>
</div>
<t-divider />
<div class="people-actions">
<div class="person"><span class="label">发起人</span><strong v-text="getOperatorText(item)" /></div>
<div v-if="item.verifier" class="person"><span class="label">核销人</span><strong
v-text="getVerifierText(item)" /></div>
<div class="actions">
<t-button theme="primary" size="extra-small" content="详情" @click.stop="emit('detail')" />
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { TimeLabel } from "timi-web";
import type { FundRecord, FundRecordStatus } from "@/types/SalesOrder";
import { getCustomerPhotoURL } from "@/utils/customer";
import { formatPackageAmount } from "@/utils/package";
import { getFundOperationText, getFundStatusText } from "@/utils/salesOrder";
defineOptions({ name: "FundRecordListCell" });
defineProps<{ item: FundRecord }>();
const emit = defineEmits<{ detail: [] }>();
function getOperatorText(item: FundRecord): string {
return item.operator?.nick || item.operator?.name || item.operatorUserId || "未知";
}
function getVerifierText(item: FundRecord): string {
return item.verifier?.nick || item.verifier?.name || item.verifierUserId || "未核销";
}
function getCustomerText(item: FundRecord): string {
return item.customer?.name || item.customer?.code || item.customerId || "未知客户";
}
function getStatusTheme(statusValue?: FundRecordStatus): "success" | "warning" | "danger" | "default" {
return statusValue === "VERIFIED" ? "success" : statusValue === "PENDING" ? "warning" : statusValue === "REJECTED" ? "danger" : "default";
}
function getRecordStatusText(item: FundRecord): string {
return item.revokeRecordId ? "已被冲正" : getFundStatusText(item.status);
}
function getRecordStatusTheme(item: FundRecord): "success" | "warning" | "danger" | "default" {
return item.revokeRecordId ? "danger" : getStatusTheme(item.status);
}
</script>
<style scoped lang="less">
.item {
gap: .5rem;
padding: .625rem;
display: flex;
background: var(--td-bg-color-container);
flex-direction: column;
border-radius: 1rem;
.header {
gap: .5rem;
display: flex;
.avatar {
width: 3.5rem;
height: 3.5rem;
}
.main {
gap: .5rem;
flex: 1;
display: flex;
min-width: 0;
flex-direction: column;
}
.customer-status, .record-line {
gap: .5rem;
display: flex;
align-items: center;
justify-content: space-between;
}
.customer {
min-width: 0;
}
.tags {
gap: .5rem;
display: flex;
align-items: center;
}
.record-line {
.time {
color: var(--td-text-color-secondary);
font-size: .75rem;
}
.amount {
.value {
font-size: 1.25rem;
}
}
}
}
.amounts {
gap: 1rem;
display: flex;
font-size: .75rem;
flex-wrap: wrap;
}
.people-actions {
gap: .75rem;
display: flex;
align-items: center;
justify-content: space-between;
.person {
gap: .25rem;
display: flex;
min-width: 0;
font-size: .75rem;
align-items: baseline;
.label {
color: var(--td-text-color-secondary);
flex: 0 0 auto;
}
strong {
max-width: 10rem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.actions {
--td-button-border-radius: .5rem;
display: flex;
justify-content: end;
.t-button {
padding-left: 1.5rem;
padding-right: 1.5rem;
}
}
}
}
:deep(.avatar .t-image__img) {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: inherit;
}
:global(html.theme-dark) .item .fallback {
background: #115e59;
}
</style>
+1 -1
View File
@@ -195,7 +195,7 @@ onMounted(async () => {
} }
.footer { .footer {
padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom, 0)); padding: 1.25rem 1rem calc(1rem + var(--tui-safe-bottom, 0px));
text-align: center; text-align: center;
p { p {
+2 -1
View File
@@ -211,7 +211,8 @@ const WEB_NOTE_LIMIT = 3;
const noteList = ref<AppUpdateNote[]>([]); const noteList = ref<AppUpdateNote[]>([]);
const noteTitle = computed<string>(() => (updateSupported ? "更新内容" : "最近更新")); /** 有更新时展示区间日志,已是最新时展示最近几个版本 */
const noteTitle = computed<string>(() => (hasUpdate() ? "更新内容" : "最近更新"));
/** 查询当前版本到通道最新版本之间的变更说明 */ /** 查询当前版本到通道最新版本之间的变更说明 */
async function loadNotes(): Promise<void> { async function loadNotes(): Promise<void> {
+1 -1
View File
@@ -265,7 +265,7 @@ watch(() => [props.diaryId, route.params.id], () => {
<style scoped lang="less"> <style scoped lang="less">
.store-diary-detail { .store-diary-detail {
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0)); padding: 0 0 calc(1rem + var(--tui-safe-bottom, 0px));
.header { .header {
margin: 0 1rem; margin: 0 1rem;
+1 -1
View File
@@ -262,7 +262,7 @@ async function removeStore(id: string): Promise<void> {
<style scoped lang="less"> <style scoped lang="less">
.store-edit { .store-edit {
gap: 1rem; gap: 1rem;
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0)) 0; padding: 0 0 calc(1rem + var(--tui-safe-bottom, 0px)) 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
+1 -1
View File
@@ -391,7 +391,7 @@ onBeforeRouteLeave(() => {
} }
.footer { .footer {
padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom, 0)); padding: 1.25rem 1rem calc(1rem + var(--tui-safe-bottom, 0px));
text-align: center; text-align: center;
p { p {
+1 -1
View File
@@ -244,7 +244,7 @@ onMounted(() => {
<style scoped lang="less"> <style scoped lang="less">
.profile-page { .profile-page {
gap: 1rem; gap: 1rem;
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0)) 0; padding: 0 0 calc(1rem + var(--tui-safe-bottom, 0px)) 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -23,6 +23,17 @@ const followUpReminderRoutes: RouteRecordRaw[] = [
darkBodyBackground: "#10161f" 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", path: "/management/customer-follow-up-reminders/:id",
name: "CustomerFollowUpReminderDetail", name: "CustomerFollowUpReminderDetail",
+19
View File
@@ -4,9 +4,24 @@ import type { Customer } from "@/types/Customer";
/** 客户跟进提醒业务状态。 */ /** 客户跟进提醒业务状态。 */
export type FollowUpReminderStatus = "PENDING" | "COMPLETED"; export type FollowUpReminderStatus = "PENDING" | "COMPLETED";
/** 客户跟进提醒来源。 */
export type FollowUpReminderSource = "MANUAL" | "SYSTEM";
/** 客户跟进提醒通知方式。 */ /** 客户跟进提醒通知方式。 */
export type FollowUpReminderNotifyChannel = "INTERNAL" | "SMS"; export type FollowUpReminderNotifyChannel = "INTERNAL" | "SMS";
/** 系统创建提醒的扩展信息快照。 */
export type FollowUpReminderMetadata = {
/** 业务类型,BIRTHDAY 为客户生日提醒 */
bizType?: string;
/** 生日对应的公历日期 */
birthdaySolar?: string;
/** 生日对应的农历月日,仅农历生日有值 */
birthdayLunar?: string;
/** true 为闰月,仅农历生日有值 */
leapMonth?: boolean;
};
/** 跟进提醒附件请求项。 */ /** 跟进提醒附件请求项。 */
export type FollowUpReminderAttachment = Partial<Attachment> & { export type FollowUpReminderAttachment = Partial<Attachment> & {
name?: string; name?: string;
@@ -21,6 +36,10 @@ export type FollowUpReminder = {
content?: string; content?: string;
remindAt?: number; remindAt?: number;
status?: FollowUpReminderStatus; status?: FollowUpReminderStatus;
source?: FollowUpReminderSource;
/** 系统创建的幂等键,手动创建为空 */
sourceKey?: string;
metadata?: FollowUpReminderMetadata;
internalNotifyEnabled?: boolean; internalNotifyEnabled?: boolean;
smsNotifyEnabled?: boolean; smsNotifyEnabled?: boolean;
internalNotifyDetailId?: string; internalNotifyDetailId?: string;
+2 -7
View File
@@ -55,12 +55,6 @@ export type ProductSkuUnit = {
sort?: number; sort?: number;
} & Model; } & Model;
export type ProductSkuBaseUnitMigrationRequest = {
targetUnitId?: string;
targetUnitName?: string;
oldToNewBaseRatio: number | string;
};
export type ProductSku = { export type ProductSku = {
storeId?: string; storeId?: string;
productId?: string; productId?: string;
@@ -77,7 +71,8 @@ export type ProductSku = {
updatedBy?: string; updatedBy?: string;
specValueIdList?: string[]; specValueIdList?: string[];
unitList?: ProductSkuUnit[]; unitList?: ProductSkuUnit[];
baseUnitMigrationRequest?: ProductSkuBaseUnitMigrationRequest; /** true 为允许修改基础单位与单位换算系数,SKU 产生业务记录或库存后为 false */
unitEditable?: boolean;
attachmentList?: Attachment[]; attachmentList?: Attachment[];
} & Model; } & Model;
+1 -1
View File
@@ -25,8 +25,8 @@ export type ProductSkuForm = Omit<ProductSku, "unitList"> & {
unitList: ProductSkuUnitForm[]; unitList: ProductSkuUnitForm[];
minStockQuantityText: string; minStockQuantityText: string;
photoItemList: PhotoItem[]; photoItemList: PhotoItem[];
/** 已保存 SKU 的基础单位 ID,用于锁定基础单位不可变更 */
originalBaseUnitId?: string; originalBaseUnitId?: string;
baseUnitMigrationRatioText: string;
}; };
export type ProductForm = Omit<Product, "specList" | "skuList"> & { export type ProductForm = Omit<Product, "specList" | "skuList"> & {
+4
View File
@@ -188,6 +188,10 @@ export const corePermissionCodes = {
read: "CORE:NOTIFY:READ", read: "CORE:NOTIFY:READ",
delete: "CORE:NOTIFY:DELETE", delete: "CORE:NOTIFY:DELETE",
cancel: "CORE:NOTIFY:CANCEL" cancel: "CORE:NOTIFY:CANCEL"
},
setting: {
read: "CORE:SETTING:READ",
update: "CORE:SETTING:UPDATE"
} }
} as const; } as const;