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:
@@ -19,6 +19,23 @@ CI 规则(.gitea/workflows/release.yml):
|
||||
需要更正请发补丁版本
|
||||
-->
|
||||
|
||||
## v1.4.0
|
||||
|
||||
### 新增
|
||||
|
||||
- 自动生成客户生日跟进提醒。在启用功能,配置负责人且客户保存了出生日期时,系统将会在生日前 7 天生成跟进提醒
|
||||
|
||||
### 调整
|
||||
|
||||
- 现在产生库存流水、订单的产品 SKU 不再允许修改基础单位
|
||||
- 平板横屏下左侧导航可点击回到根页面
|
||||
|
||||
### 修复
|
||||
|
||||
- APK 端无法显示更新日志
|
||||
- APK 端没有完全全屏(仍然避让状态栏)
|
||||
- 部分页面样式
|
||||
|
||||
## v1.3.2
|
||||
|
||||
### 调整
|
||||
|
||||
@@ -7,8 +7,8 @@ android {
|
||||
applicationId "com.imyeyu.gao.customer"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0.0"
|
||||
versionCode 2
|
||||
versionName "1.0.1"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
aaptOptions {
|
||||
// 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;
|
||||
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.WebSettings;
|
||||
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 java.util.Locale;
|
||||
|
||||
public class MainActivity extends BridgeActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
applyEdgeToEdge();
|
||||
getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
|
||||
@Override
|
||||
public void handleOnBackPressed() {
|
||||
@@ -26,4 +38,67 @@ public class MainActivity extends BridgeActivity {
|
||||
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
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "gao-customer-h5",
|
||||
"private": true,
|
||||
"version": "1.3.2",
|
||||
"version": "1.4.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite --host",
|
||||
@@ -30,7 +30,7 @@
|
||||
"less": "^4.3.0",
|
||||
"pinia": "^3.0.2",
|
||||
"tdesign-mobile-vue": "^1.17.1",
|
||||
"timi-tdesign-mobile": "^1.2.0",
|
||||
"timi-tdesign-mobile": "^1.3.1",
|
||||
"timi-ts": "^1.0.0",
|
||||
"timi-web": "^1.0.2",
|
||||
"timi-web-api": "^1.0.2",
|
||||
|
||||
Generated
+5
-5
@@ -47,8 +47,8 @@ importers:
|
||||
specifier: ^1.17.1
|
||||
version: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3))
|
||||
timi-tdesign-mobile:
|
||||
specifier: ^1.2.0
|
||||
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))
|
||||
specifier: ^1.3.1
|
||||
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:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0
|
||||
@@ -2748,8 +2748,8 @@ packages:
|
||||
through2@4.0.2:
|
||||
resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==}
|
||||
|
||||
timi-tdesign-mobile@1.2.0:
|
||||
resolution: {integrity: sha512-FW9LyZlh+aSjaG3tEXBf3+YYmm+OruYVH+atQMFmlCT33q3e6Gt0rr6n6d4vLH5n0tzyidlAJ0hmrvKspKKDdw==}
|
||||
timi-tdesign-mobile@1.3.1:
|
||||
resolution: {integrity: sha512-6hz7MSqseCUyyJzRiyQjymMDfSZ3kJrFP6J5DxHpE1pJ8xeByCzKgELS4CnO4187mqPEx46TtF03qB9XS4Mpuw==}
|
||||
engines: {node: '>=20.0.0'}
|
||||
peerDependencies:
|
||||
vue: ^3.5.0
|
||||
@@ -5849,7 +5849,7 @@ snapshots:
|
||||
dependencies:
|
||||
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:
|
||||
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))
|
||||
|
||||
@@ -3,7 +3,7 @@ $ErrorActionPreference = "Stop"
|
||||
$env:VITE_API_BASE_URL = if ($env:ANDROID_API_BASE_URL) {
|
||||
$env:ANDROID_API_BASE_URL
|
||||
} else {
|
||||
"http://10.0.2.2:18091"
|
||||
"http://192.168.11.14:18091"
|
||||
}
|
||||
Write-Host "Android 调试接口地址:$env:VITE_API_BASE_URL"
|
||||
|
||||
|
||||
+23
-3
@@ -3,21 +3,38 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Capacitor, SystemBars, SystemBarsStyle } from "@capacitor/core";
|
||||
import { useGlobalUIStore } from "@/store/globalUI";
|
||||
import { useSettingStore } from "@/store/settingStore";
|
||||
|
||||
const globalUIStore = useGlobalUIStore();
|
||||
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") {
|
||||
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
return mediaQuery.matches ? "dark" : "light";
|
||||
return prefersDark.value ? "dark" : "light";
|
||||
}
|
||||
|
||||
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> {
|
||||
await settingStore.unlockSoundPlayers();
|
||||
}
|
||||
@@ -28,6 +45,7 @@ watch(
|
||||
const rootElement = document.documentElement;
|
||||
rootElement.classList.toggle("theme-dark", themeMode === "dark");
|
||||
rootElement.dataset.theme = themeMode;
|
||||
void syncSystemBars(themeMode).catch(() => undefined);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
@@ -54,10 +72,12 @@ watch(
|
||||
|
||||
onMounted(() => {
|
||||
settingStore.loadSoundPlayers();
|
||||
darkMediaQuery.addEventListener("change", handleSystemThemeChange);
|
||||
window.addEventListener("pointerdown", unlockSoundOnUserGesture, { once: true });
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
darkMediaQuery.removeEventListener("change", handleSystemThemeChange);
|
||||
window.removeEventListener("pointerdown", unlockSoundOnUserGesture);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -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;
|
||||
@@ -119,7 +119,7 @@ html.theme-dark body {
|
||||
min-height: 0;
|
||||
overflow-x: hidden;
|
||||
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;
|
||||
|
||||
.t-pull-down-refresh__track {
|
||||
|
||||
@@ -361,7 +361,7 @@ onUnmounted(() => {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
min-height: 0;
|
||||
padding-bottom: env(safe-area-inset-bottom, 0);
|
||||
padding-bottom: var(--tui-safe-bottom, 0px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ function toDateValue(date: Date): number {
|
||||
.day-record-panel,
|
||||
.filter-popup {
|
||||
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;
|
||||
background: #f5f5f8;
|
||||
border-radius: 1rem 1rem 0 0;
|
||||
@@ -344,7 +344,7 @@ function toDateValue(date: Date): number {
|
||||
}
|
||||
|
||||
.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-body {
|
||||
|
||||
@@ -311,7 +311,7 @@ function updateSelectedSkuIdList(value: string[]): void {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding-bottom: env(safe-area-inset-bottom, 0);
|
||||
padding-bottom: var(--tui-safe-bottom, 0px);
|
||||
|
||||
.selector {
|
||||
border-radius: 0;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
tab-bar-float
|
||||
:hide-nav="!tabBarStore.isShowing"
|
||||
@change="onChangeTab"
|
||||
@rail-click="onRailClick"
|
||||
>
|
||||
<template #rail-extra>
|
||||
<t-button
|
||||
@@ -174,11 +175,19 @@ function resolveVisibleTabValue(path: string): string {
|
||||
|
||||
function onChangeTab(value: string | number): void {
|
||||
const path = String(value);
|
||||
if (resolveTabValue(route.path) === path) {
|
||||
if ((railVisible.value ? route.path : resolveTabValue(route.path)) === path) {
|
||||
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 边距 ----------
|
||||
|
||||
@@ -275,7 +275,7 @@ watch(() => props.sessionKey, async () => {
|
||||
.ai-conversation-list {
|
||||
width: min(70vw, 24rem);
|
||||
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;
|
||||
overflow: auto;
|
||||
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
|
||||
size="small"
|
||||
variant="outline"
|
||||
:theme="internalNotifyStatus ? getNotifyStatusTheme(internalNotifyStatus.status) : 'primary'"
|
||||
:content="internalNotifyStatus ? getNotifyStatusText(internalNotifyStatus.status) : '已配置'"
|
||||
:theme="internalNotifyStatus ? getNotifyStatusTheme(internalNotifyStatus.status) : (isNotifyPending ? 'warning' : 'primary')"
|
||||
:content="internalNotifyStatus ? getNotifyStatusText(internalNotifyStatus.status) : (isNotifyPending ? '待发送' : '已配置')"
|
||||
/>
|
||||
</template>
|
||||
</t-cell>
|
||||
@@ -162,6 +162,8 @@ const isLoading = ref(false);
|
||||
const isCompleting = ref(false);
|
||||
const isDeleting = ref(false);
|
||||
const internalNotifyStatus = ref<NotifyDetail>();
|
||||
// 站内通知在提醒时间之后才对接收人可见,未到时间时后端按未发送处理
|
||||
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) {
|
||||
|
||||
@@ -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<void> {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -8,14 +8,7 @@
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
v-if="canCreate"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="新增"
|
||||
@click="toCreate"
|
||||
/>
|
||||
<navbar-actions :actions="actionList" />
|
||||
</template>
|
||||
</t-navbar>
|
||||
<master-detail-page
|
||||
@@ -80,93 +73,30 @@
|
||||
<t-cell v-if="dateFilterType !== 'all'" title="提醒时间" :note="dateFilterLabel" />
|
||||
<t-cell v-if="selectedResponsibleId" title="负责人" :note="selectedResponsibleName" />
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="pageResult.list.length" class="items fix-last-cell-line empty-cell-title-margin" theme="card">
|
||||
<t-swipe-cell
|
||||
<div v-if="pageResult.list.length" class="items">
|
||||
<follow-up-reminder-list-cell
|
||||
v-for="(item, index) in pageResult.list"
|
||||
:key="item.id || index"
|
||||
class="item"
|
||||
>
|
||||
<t-cell
|
||||
v-entrance-transition="{ step: 30 }"
|
||||
class="cell"
|
||||
arrow
|
||||
@click="toDetail(item)"
|
||||
>
|
||||
<template #leftIcon>
|
||||
<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="短信"
|
||||
:item="item"
|
||||
:can-complete="canComplete"
|
||||
:can-delete="canDelete"
|
||||
@complete="item.status = 'COMPLETED'"
|
||||
@delete="removeFromList(item)"
|
||||
@detail="toDetail(item)"
|
||||
/>
|
||||
</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 ? '已经到底了' : '上拉加载更多') : '暂无跟进提醒'" />
|
||||
</div>
|
||||
</t-pull-down-refresh>
|
||||
</template>
|
||||
<template #detail>
|
||||
<birthday-reminder-setting v-if="selectedId === birthdayPaneId" />
|
||||
<follow-up-reminder-edit
|
||||
v-if="editing"
|
||||
v-else-if="editing || selectedId === createPaneId"
|
||||
:key="`edit-${selectedId}`"
|
||||
:reminder-id="selectedId"
|
||||
:reminder-id="selectedId === createPaneId ? '' : selectedId"
|
||||
:customer-id="selectedCustomerId"
|
||||
/>
|
||||
<follow-up-reminder-detail
|
||||
v-else
|
||||
@@ -176,7 +106,6 @@
|
||||
/>
|
||||
</template>
|
||||
</master-detail-page>
|
||||
|
||||
<customer-selector
|
||||
v-model="selectedCustomerId"
|
||||
v-model:visible="customerSelectorVisible"
|
||||
@@ -213,13 +142,14 @@
|
||||
@confirm="confirmEnd"
|
||||
/>
|
||||
</t-popup>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
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 FollowUpReminderEdit from "@/pages/followUpReminder/FollowUpReminderEdit.vue";
|
||||
import { Time } from "timi-web";
|
||||
@@ -229,13 +159,14 @@ import { getErrorMessage } from "@/utils/error";
|
||||
import FollowUpReminderAPI from "@/api/FollowUpReminderAPI";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
import CustomerSelector from "@/components/CustomerSelector.vue";
|
||||
import NavbarActions from "@/components/NavbarActions.vue";
|
||||
import ManagedUserSelector from "@/pages/followUpReminder/component/ManagedUserSelector.vue";
|
||||
import type { NavbarAction } from "@/types/NavbarAction.ts";
|
||||
import { useCurrentStoreStore } from "@/store/currentStoreStore";
|
||||
import type { ManagedUser } from "@/types/ManagedUser";
|
||||
import type { FollowUpReminder, FollowUpReminderPage, FollowUpReminderStatus } from "@/types/FollowUpReminder";
|
||||
import { getCustomerPhotoURL } from "@/utils/customer";
|
||||
import { parseDateTime } from "@/utils/date";
|
||||
import { gaoRoleCodes, permissionCodes } from "@/utils/permission";
|
||||
import { corePermissionCodes, gaoRoleCodes, permissionCodes } from "@/utils/permission";
|
||||
|
||||
import type { Customer } from "@/types/Customer";
|
||||
|
||||
@@ -248,12 +179,21 @@ defineOptions({
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const createPaneId = "__create__";
|
||||
const birthdayPaneId = "__birthday_setting__";
|
||||
|
||||
// 选中项、编辑态、切换方向、关闭逻辑、转屏、query 同步都在这里
|
||||
const { selectedId, editing, detailVersion, paneDirection, isWide, openDetail, openEdit } =
|
||||
useMasterDetailPane({
|
||||
path: "/management/customer-follow-up-reminders",
|
||||
detail: id => `/management/customer-follow-up-reminders/${id}`,
|
||||
edit: id => `/management/customer-follow-up-reminders/${id}/edit`
|
||||
detail: id => id === birthdayPaneId
|
||||
? "/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 currentStoreStore = useCurrentStoreStore();
|
||||
@@ -262,6 +202,7 @@ const isGlobalManager = computed(() => userStore.hasRoles(gaoRoleCodes.globalMan
|
||||
const canCreate = computed(() => userStore.hasPermissions(permissionCodes.customerFollowUpReminder.create));
|
||||
const canComplete = computed(() => userStore.hasPermissions(permissionCodes.customerFollowUpReminder.complete));
|
||||
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 {
|
||||
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("");
|
||||
const operatingType = ref<"complete" | "delete">();
|
||||
|
||||
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);
|
||||
function removeFromList(item: FollowUpReminder): void {
|
||||
pageResult.list = pageResult.list.filter(current => current.id !== item.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> {
|
||||
if (isWide.value) {
|
||||
openDetail(createPaneId);
|
||||
return;
|
||||
}
|
||||
await router.push({
|
||||
name: "CustomerFollowUpReminderCreate",
|
||||
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> {
|
||||
openDetail(item.id || "");
|
||||
}
|
||||
|
||||
watch([selectedId, detailVersion], async ([id, version], [previousId, previousVersion]) => {
|
||||
if ((!id && previousId) || version !== previousVersion) {
|
||||
await refresh();
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
try {
|
||||
@@ -714,106 +587,13 @@ watch(() => route.query.customerId, async value => {
|
||||
}
|
||||
|
||||
.items {
|
||||
|
||||
.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%;
|
||||
margin: 0 1rem;
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
font-size: .875rem;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-direction: column;
|
||||
|
||||
.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) {
|
||||
@@ -823,17 +603,12 @@ watch(() => route.query.customerId, async value => {
|
||||
}
|
||||
|
||||
|
||||
.summary,
|
||||
.items .item,
|
||||
.items .cell {
|
||||
.summary {
|
||||
color: #e2e8f0;
|
||||
background: rgba(30, 41, 59, .9);
|
||||
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>
|
||||
@@ -528,7 +528,7 @@ onMounted(async () => {
|
||||
.package-config-edit {
|
||||
gap: 1rem;
|
||||
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;
|
||||
|
||||
.form {
|
||||
|
||||
@@ -280,7 +280,7 @@ onMounted(async () => {
|
||||
.bottom-actions {
|
||||
left: 1rem;
|
||||
right: 1rem;
|
||||
bottom: calc(.75rem + env(safe-area-inset-bottom, 0));
|
||||
bottom: calc(.75rem + var(--tui-safe-bottom, 0px));
|
||||
position: fixed;
|
||||
|
||||
.t-button {
|
||||
|
||||
@@ -554,7 +554,7 @@ onUnmounted(() => {
|
||||
right: 1rem;
|
||||
gap: .75rem;
|
||||
z-index: 20;
|
||||
bottom: calc(.75rem + env(safe-area-inset-bottom, 0));
|
||||
bottom: calc(.75rem + var(--tui-safe-bottom, 0px));
|
||||
display: flex;
|
||||
position: fixed;
|
||||
|
||||
|
||||
@@ -616,7 +616,7 @@ onMounted(async () => {
|
||||
|
||||
<style scoped lang="less">
|
||||
.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 {
|
||||
gap: 1rem;
|
||||
|
||||
@@ -202,7 +202,6 @@
|
||||
<product-sku-unit-batch-editor
|
||||
v-model="batchUnitEditorVisible"
|
||||
v-model:unit-list="batchUnitList"
|
||||
v-model:base-unit-migration-ratio-text="batchBaseUnitMigrationRatioText"
|
||||
:product-type="form.productType"
|
||||
:sku-count="form.skuList.length"
|
||||
@apply="applyBatchUnitTemplate"
|
||||
@@ -348,7 +347,6 @@ const unitEditorVisible = ref(false);
|
||||
const editingSku = ref<SkuForm>();
|
||||
const batchUnitEditorVisible = ref(false);
|
||||
const batchUnitList = ref<UnitForm[]>([]);
|
||||
const batchBaseUnitMigrationRatioText = ref("");
|
||||
const removedSkuKeySet = new Set<string>();
|
||||
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),
|
||||
unitList: sourceUnitList.length ? sourceUnitList.map(unit => createUnit(unit)) : [createUnit({ isBase: true, baseQuantityPerUnit: "1" })],
|
||||
originalBaseUnitId,
|
||||
baseUnitMigrationRatioText: "",
|
||||
photoItemList
|
||||
};
|
||||
}
|
||||
@@ -473,7 +470,6 @@ function openBatchUnitEditor(): void {
|
||||
return;
|
||||
}
|
||||
batchUnitList.value = sourceSku.unitList.map(unit => ({ ...unit, id: undefined, skuId: undefined, clientKey: window.crypto.randomUUID() }));
|
||||
batchBaseUnitMigrationRatioText.value = "";
|
||||
batchUnitEditorVisible.value = true;
|
||||
}
|
||||
|
||||
@@ -483,10 +479,15 @@ function closeBatchUnitEditor(): void {
|
||||
|
||||
function applyBatchUnitTemplate(): void {
|
||||
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 => {
|
||||
const oldUnitList = sku.unitList;
|
||||
const oldUnitMap = new Map(oldUnitList.filter(unit => !!unit.id).map(unit => [unit.name.trim(), unit]));
|
||||
const oldBaseUnit = oldUnitList.find(unit => unit.isBase);
|
||||
const oldUnitMap = new Map(sku.unitList.filter(unit => !!unit.id).map(unit => [unit.name.trim(), unit]));
|
||||
sku.unitList = templateList.map((unit, unitIndex) => ({
|
||||
...unit,
|
||||
id: oldUnitMap.get(unit.name.trim())?.id,
|
||||
@@ -494,14 +495,31 @@ function applyBatchUnitTemplate(): void {
|
||||
clientKey: window.crypto.randomUUID(),
|
||||
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 统一配置销售单位`);
|
||||
}
|
||||
|
||||
/// 校验批量模板与已保存 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 {
|
||||
const sku = form.skuList[index];
|
||||
if (!sku) {
|
||||
@@ -969,13 +987,8 @@ function validate(): boolean {
|
||||
return false;
|
||||
}
|
||||
const selectedBaseUnit = sku.unitList.find(unit => unit.isBase);
|
||||
const isBaseUnitChanged = !!sku.originalBaseUnitId && selectedBaseUnit?.id !== sku.originalBaseUnitId;
|
||||
if (isBaseUnitChanged && !/^\d+(?:\.\d{1,6})?$/.test(sku.baseUnitMigrationRatioText.trim())) {
|
||||
Message.warning("切换基础单位时,请填写有效的新旧基础单位换算比例,最多六位小数");
|
||||
return false;
|
||||
}
|
||||
if (isBaseUnitChanged && !(0 < Number(sku.baseUnitMigrationRatioText))) {
|
||||
Message.warning("新旧基础单位换算比例必须大于 0");
|
||||
if (sku.originalBaseUnitId && selectedBaseUnit?.id !== sku.originalBaseUnitId && sku.unitEditable !== true) {
|
||||
Message.warning("SKU 已产生业务记录,不能更换基础单位,如需调整请新建 SKU");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1007,14 +1020,7 @@ function buildSkuPayload(sku: SkuForm, index: number): ProductSku {
|
||||
allowPurchase: form.productType === "SERVICE" ? false : !!unit.allowPurchase,
|
||||
allowSale: !!unit.allowSale,
|
||||
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 {
|
||||
padding: .5rem 1rem calc(1rem + env(safe-area-inset-bottom, 0));
|
||||
padding: .5rem 1rem calc(1rem + var(--tui-safe-bottom, 0px));
|
||||
|
||||
.tip {
|
||||
margin: 0 0 .75rem;
|
||||
|
||||
@@ -179,7 +179,7 @@ function setSkuStatus(value: boolean | string | number): void {
|
||||
}
|
||||
|
||||
.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%;
|
||||
overflow-y: auto;
|
||||
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
<div class="editor-context">
|
||||
<strong>批量配置销售单位</strong>
|
||||
<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 class="unit-list">
|
||||
@@ -29,7 +26,7 @@
|
||||
<t-form-item label="单位名称" required-mark>
|
||||
<t-input v-model.trim="unit.name" borderless maxlength="32" placeholder="如 件、盒、箱" />
|
||||
</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-form-item>
|
||||
<t-form-item label="换算数量" help="1 个当前单位对应的基础单位数量" required-mark>
|
||||
@@ -74,7 +71,6 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const unitList = defineModel<ProductSkuUnitForm[]>("unitList", { required: true });
|
||||
const baseUnitMigrationRatioText = defineModel<string>("baseUnitMigrationRatioText", { default: "" });
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: boolean];
|
||||
apply: [];
|
||||
@@ -145,7 +141,7 @@ function setBaseUnit(index: number): void {
|
||||
.batch-editor {
|
||||
max-height: 100%;
|
||||
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 {
|
||||
gap: .25rem;
|
||||
|
||||
@@ -35,14 +35,11 @@
|
||||
<t-form-item label="单位名称" required-mark>
|
||||
<t-input v-model.trim="unit.name" borderless maxlength="32" placeholder="如 件、盒、箱" />
|
||||
</t-form-item>
|
||||
<t-form-item label="基础单位" content-align="right">
|
||||
<t-switch v-model="unit.isBase" size="small" :disabled="sku.unitList.length === 1" @change="setBaseUnit(unitIndex)" />
|
||||
<t-form-item label="基础单位" content-align="right" :help="canChangeBaseUnit ? undefined : 'SKU 已产生业务记录,基础单位不可更换'">
|
||||
<t-switch v-model="unit.isBase" size="small" :disabled="!canChangeBaseUnit || sku.unitList.length === 1" @change="setBaseUnit(unitIndex)" />
|
||||
</t-form-item>
|
||||
<t-form-item v-if="isBaseUnitMigrationRequired" label="新旧基础单位比例" help="填写 1 个旧基础单位等于多少个新基础单位;最多六位小数" required-mark>
|
||||
<t-input v-model.trim="sku.baseUnitMigrationRatioText" type="number" align="right" borderless placeholder="例如 30" />
|
||||
</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 label="换算数量" :help="isUnitConversionLocked(unit) ? '已保存单位的换算关系不可修改' : '1 个当前单位对应的基础单位数量'" required-mark>
|
||||
<t-input v-model.trim="unit.baseQuantityPerUnit" type="number" align="right" borderless :disabled="isUnitConversionLocked(unit)" placeholder="1" />
|
||||
</t-form-item>
|
||||
<t-form-item label="售价(元)">
|
||||
<t-input v-model.trim="unit.salePriceText" type="number" align="right" borderless placeholder="选填" />
|
||||
@@ -93,12 +90,16 @@ const visible = computed({
|
||||
set: value => handleVisibleChange(value)
|
||||
});
|
||||
const unitEditorZIndex = 12100;
|
||||
const isBaseUnitMigrationRequired = computed(() => {
|
||||
if (!sku.value?.originalBaseUnitId) {
|
||||
return false;
|
||||
/// 新建 SKU 可自由选择基础单位,已保存的 SKU 仅在未产生业务记录时允许调整
|
||||
const canChangeBaseUnit = computed(() => !sku.value?.id || sku.value?.unitEditable === true);
|
||||
|
||||
/// 基础单位与不可编辑单位的换算数量不可修改
|
||||
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 {
|
||||
emit("update:modelValue", value);
|
||||
@@ -142,6 +143,10 @@ function removeUnit(index: number): void {
|
||||
return;
|
||||
}
|
||||
const unit = sku.value.unitList[index];
|
||||
if (unit?.isBase && sku.value.id && sku.value.unitEditable !== true) {
|
||||
Message.warning("SKU 已产生业务记录,不能移除基础单位");
|
||||
return;
|
||||
}
|
||||
if (unit?.id) {
|
||||
Message.info("已移除单位将在保存时由后端检查引用后处理");
|
||||
}
|
||||
@@ -169,7 +174,7 @@ function setBaseUnit(index: number): void {
|
||||
.product-sku-unit-editor {
|
||||
gap: .75rem;
|
||||
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%;
|
||||
overflow-y: auto;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -4,20 +4,28 @@
|
||||
:title="`${selectedDate} 库存流水`"
|
||||
height="80vh"
|
||||
left-button-text="关闭"
|
||||
right-button-text=""
|
||||
@left-button-click="visible = false"
|
||||
>
|
||||
<div class="records">
|
||||
<template v-if="canReadRecords">
|
||||
<div class="directions">
|
||||
<t-segmented :value="direction" :options="directionOptions" @change="changeDirection" />
|
||||
<div v-if="canReadRecords" class="records">
|
||||
<div class="filters glass-header">
|
||||
<div v-if="selection" class="summary">
|
||||
<span v-if="summaryLoading">汇总加载中</span>
|
||||
<span v-else :class="direction === 'IN' ? 'in' : 'out'"
|
||||
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" />
|
||||
<span
|
||||
v-else
|
||||
:class="direction === 'IN' ? 'in' : 'out'"
|
||||
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-segmented :value="direction" :options="directionOptions" @change="changeDirection" />
|
||||
</div>
|
||||
<div class="record-list">
|
||||
<t-cell-group v-if="records.length" class="list empty-cell-title-margin" theme="card">
|
||||
<t-cell v-for="record in records" :key="record.id" class="item">
|
||||
<template #leftIcon>
|
||||
@@ -49,28 +57,41 @@
|
||||
</span>
|
||||
</template>
|
||||
<template #title>
|
||||
<div class="record-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 || '未命名产品'" />
|
||||
<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" />
|
||||
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 || ''}`" />
|
||||
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>
|
||||
<span
|
||||
class="delta"
|
||||
:class="getDeltaClass(record.onHandDelta)"
|
||||
v-text="getDeltaText(record.onHandDelta)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</t-cell>
|
||||
@@ -80,9 +101,7 @@
|
||||
加载更多
|
||||
</t-button>
|
||||
</div>
|
||||
</template>
|
||||
<t-empty v-else description="暂无库存流水查看权限" />
|
||||
</div>
|
||||
</bottom-popup>
|
||||
</template>
|
||||
|
||||
@@ -236,20 +255,20 @@ defineExpose({ openDay });
|
||||
|
||||
<style scoped lang="less">
|
||||
.records {
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
min-height: 0;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
|
||||
.directions {
|
||||
.filters {
|
||||
gap: .5rem;
|
||||
top: 0;
|
||||
display: flex;
|
||||
padding: .75rem;
|
||||
z-index: 1;
|
||||
position: sticky;
|
||||
min-width: 0;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
justify-content: end;
|
||||
|
||||
.summary {
|
||||
gap: .75rem;
|
||||
@@ -259,30 +278,26 @@ defineExpose({ openDay });
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
|
||||
.in { color: var(--td-success-color); }
|
||||
.out { color: var(--td-error-color); }
|
||||
.in {
|
||||
color: var(--td-success-color);
|
||||
}
|
||||
|
||||
.record-list {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
flex: 1;
|
||||
.out {
|
||||
color: var(--td-error-color);
|
||||
}
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 3.5rem;
|
||||
height: 3.5rem;
|
||||
}
|
||||
|
||||
.list {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.item {
|
||||
padding: .625rem;
|
||||
min-width: 0;
|
||||
|
||||
.avatar {
|
||||
width: 3.5rem;
|
||||
height: 3.5rem;
|
||||
}
|
||||
|
||||
.icon {
|
||||
@@ -295,7 +310,7 @@ defineExpose({ openDay });
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.record-title {
|
||||
.title {
|
||||
gap: .25rem;
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
@@ -391,6 +406,8 @@ defineExpose({ openDay });
|
||||
.negative {
|
||||
color: var(--td-error-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:global(html.theme-dark) .records .operation {
|
||||
|
||||
@@ -232,7 +232,7 @@ watch(() => [visible.value, props.operation] as const, ([isVisible]) => {
|
||||
|
||||
<style scoped lang="less">
|
||||
.operation-popup {
|
||||
padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
|
||||
padding-bottom: calc(1rem + var(--tui-safe-bottom, 0px));
|
||||
|
||||
.form {
|
||||
margin: 0;
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
</t-navbar>
|
||||
<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-item label-width="0">
|
||||
<span>兑换单会生成一张交易订单,商品按订单履约分批领取。回收物支付独立核销,不产生资金流水,也不支持与现金混付。</span>
|
||||
</t-form-item>
|
||||
<t-form-item label="兑换模板" arrow content-align="right" @click="openRulePicker">
|
||||
<div class="template">
|
||||
<span v-text="ruleDisplayText" />
|
||||
@@ -35,7 +32,14 @@
|
||||
<span v-text="customerName || '请选择'" />
|
||||
</t-form-item>
|
||||
<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 || '请选择'" />
|
||||
</t-form-item>
|
||||
<t-form-item label="回收数量" required-mark content-align="right">
|
||||
|
||||
@@ -89,71 +89,15 @@
|
||||
@click="openEndTime"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="recordList.length" class="empty-cell-title-margin" theme="card">
|
||||
<t-cell
|
||||
class="item"
|
||||
<div v-if="recordList.length" class="records">
|
||||
<fund-record-list-cell
|
||||
v-for="item in recordList"
|
||||
:key="item.id"
|
||||
arrow
|
||||
v-entrance-transition="{ step: 30 }"
|
||||
@click="toDetail(item)"
|
||||
>
|
||||
<template #leftIcon>
|
||||
<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)" />
|
||||
</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)"
|
||||
:item="item"
|
||||
@detail="toDetail(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 :content="loadStateText" />
|
||||
</t-pull-down-refresh>
|
||||
@@ -201,7 +145,8 @@
|
||||
import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
|
||||
import { type DropdownValue } from "tdesign-mobile-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 CustomerAPI from "@/api/CustomerAPI";
|
||||
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 { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter";
|
||||
import { getErrorMessage } from "@/utils/error";
|
||||
import { formatPackageAmount } from "@/utils/package";
|
||||
import { getFundOperationText, getFundStatusText } from "@/utils/salesOrder";
|
||||
import { Message } from "@/utils/message";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
import { getCustomerPhotoURL } from "@/utils/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> {
|
||||
openDetail(item.id || "");
|
||||
}
|
||||
@@ -530,121 +439,13 @@ onMounted(async () => {
|
||||
.sales-order-record-list {
|
||||
padding: var(--tui-nav-height) 0 1rem;
|
||||
|
||||
|
||||
.item {
|
||||
|
||||
.avatar {
|
||||
width: 3.5rem;
|
||||
height: 3.5rem;
|
||||
}
|
||||
|
||||
.title {
|
||||
gap: .25rem;
|
||||
.records {
|
||||
gap: .5rem;
|
||||
margin: .75rem;
|
||||
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>
|
||||
|
||||
@@ -603,7 +603,7 @@ onMounted(() => {
|
||||
.sales-order-create {
|
||||
gap: 1rem;
|
||||
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;
|
||||
|
||||
.form {
|
||||
@@ -753,10 +753,10 @@ onMounted(() => {
|
||||
left: 1.5rem;
|
||||
right: 1.5rem;
|
||||
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;
|
||||
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;
|
||||
align-items: center;
|
||||
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>
|
||||
@@ -195,7 +195,7 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.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;
|
||||
|
||||
p {
|
||||
|
||||
@@ -211,7 +211,8 @@ const WEB_NOTE_LIMIT = 3;
|
||||
|
||||
const noteList = ref<AppUpdateNote[]>([]);
|
||||
|
||||
const noteTitle = computed<string>(() => (updateSupported ? "更新内容" : "最近更新"));
|
||||
/** 有更新时展示区间日志,已是最新时展示最近几个版本 */
|
||||
const noteTitle = computed<string>(() => (hasUpdate() ? "更新内容" : "最近更新"));
|
||||
|
||||
/** 查询当前版本到通道最新版本之间的变更说明 */
|
||||
async function loadNotes(): Promise<void> {
|
||||
|
||||
@@ -265,7 +265,7 @@ watch(() => [props.diaryId, route.params.id], () => {
|
||||
|
||||
<style scoped lang="less">
|
||||
.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 {
|
||||
margin: 0 1rem;
|
||||
|
||||
@@ -262,7 +262,7 @@ async function removeStore(id: string): Promise<void> {
|
||||
<style scoped lang="less">
|
||||
.store-edit {
|
||||
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;
|
||||
flex-direction: column;
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ onBeforeRouteLeave(() => {
|
||||
}
|
||||
|
||||
.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;
|
||||
|
||||
p {
|
||||
|
||||
@@ -244,7 +244,7 @@ onMounted(() => {
|
||||
<style scoped lang="less">
|
||||
.profile-page {
|
||||
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;
|
||||
flex-direction: column;
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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<Attachment> & {
|
||||
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;
|
||||
|
||||
@@ -55,12 +55,6 @@ export type ProductSkuUnit = {
|
||||
sort?: number;
|
||||
} & Model;
|
||||
|
||||
export type ProductSkuBaseUnitMigrationRequest = {
|
||||
targetUnitId?: string;
|
||||
targetUnitName?: string;
|
||||
oldToNewBaseRatio: number | string;
|
||||
};
|
||||
|
||||
export type ProductSku = {
|
||||
storeId?: string;
|
||||
productId?: string;
|
||||
@@ -77,7 +71,8 @@ export type ProductSku = {
|
||||
updatedBy?: string;
|
||||
specValueIdList?: string[];
|
||||
unitList?: ProductSkuUnit[];
|
||||
baseUnitMigrationRequest?: ProductSkuBaseUnitMigrationRequest;
|
||||
/** true 为允许修改基础单位与单位换算系数,SKU 产生业务记录或库存后为 false */
|
||||
unitEditable?: boolean;
|
||||
attachmentList?: Attachment[];
|
||||
} & Model;
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ export type ProductSkuForm = Omit<ProductSku, "unitList"> & {
|
||||
unitList: ProductSkuUnitForm[];
|
||||
minStockQuantityText: string;
|
||||
photoItemList: PhotoItem[];
|
||||
/** 已保存 SKU 的基础单位 ID,用于锁定基础单位不可变更 */
|
||||
originalBaseUnitId?: string;
|
||||
baseUnitMigrationRatioText: string;
|
||||
};
|
||||
|
||||
export type ProductForm = Omit<Product, "specList" | "skuList"> & {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user