diff --git a/CHANGELOG.md b/CHANGELOG.md index 9914c2d..200fafa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,23 @@ CI 规则(.gitea/workflows/release.yml): 需要更正请发补丁版本 --> +## v1.4.0 + +### 新增 + +- 自动生成客户生日跟进提醒。在启用功能,配置负责人且客户保存了出生日期时,系统将会在生日前 7 天生成跟进提醒 + +### 调整 + +- 现在产生库存流水、订单的产品 SKU 不再允许修改基础单位 +- 平板横屏下左侧导航可点击回到根页面 + +### 修复 + +- APK 端无法显示更新日志 +- APK 端没有完全全屏(仍然避让状态栏) +- 部分页面样式 + ## v1.3.2 ### 调整 diff --git a/android/app/build.gradle b/android/app/build.gradle index 67132d2..731ee0b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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. diff --git a/android/app/src/main/java/com/imyeyu/gao/customer/MainActivity.java b/android/app/src/main/java/com/imyeyu/gao/customer/MainActivity.java index 16b878b..ad886a2 100644 --- a/android/app/src/main/java/com/imyeyu/gao/customer/MainActivity.java +++ b/android/app/src/main/java/com/imyeyu/gao/customer/MainActivity.java @@ -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); + } } diff --git a/package.json b/package.json index 98b6aa4..b4ef357 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7489b8..a0008bb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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)) diff --git a/scripts/android-open.ps1 b/scripts/android-open.ps1 index c0e208f..5dad8e1 100644 --- a/scripts/android-open.ps1 +++ b/scripts/android-open.ps1 @@ -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" diff --git a/src/Root.vue b/src/Root.vue index 4612898..eec9d35 100644 --- a/src/Root.vue +++ b/src/Root.vue @@ -3,21 +3,38 @@ diff --git a/src/api/StoreSettingAPI.ts b/src/api/StoreSettingAPI.ts new file mode 100644 index 0000000..2417c53 --- /dev/null +++ b/src/api/StoreSettingAPI.ts @@ -0,0 +1,56 @@ +import { axios } from "timi-web-api"; + +/** 门店配置项。 */ +export type StoreSetting = { + bizType?: string; + bizId?: string; + code?: string; + description?: string; + value?: string; + valueType?: string; + valueArgs?: unknown; +}; + +/** 门店配置保存项。 */ +export type StoreSettingPayload = { + code: string; + value: string; +}; + +const BASE_URI = "/gao/store/setting"; + +/** 客户生日提醒开关。 */ +export const BIRTHDAY_REMINDER_ENABLED = "CUSTOMER_BIRTHDAY_REMINDER_ENABLED"; + +/** 客户生日提醒负责人。 */ +export const BIRTHDAY_REMINDER_RESPONSIBLE_USER_ID = "CUSTOMER_BIRTHDAY_REMINDER_RESPONSIBLE_USER_ID"; + +/** + * 门店配置接口 + * + * 门店由后端按登录用户所属门店决定,前端不传 storeId + */ +const StoreSettingAPI = { + /** + * 查询当前门店配置 + * + * @param codeList 配置代码列表,为空返回全部 + * @returns 配置代码与配置的映射 + */ + async map(codeList?: string[]): Promise> { + return await axios.post(`${BASE_URI}/map`, codeList ?? []); + }, + + /** + * 保存当前门店配置 + * + * 合并写入,未提交的配置项保留 + * + * @param settingList 配置列表 + */ + async update(settingList: StoreSettingPayload[]): Promise { + await axios.post(`${BASE_URI}/update`, settingList); + } +}; + +export default StoreSettingAPI; diff --git a/src/assets/styles/global.less b/src/assets/styles/global.less index 23224fe..e340d3a 100644 --- a/src/assets/styles/global.less +++ b/src/assets/styles/global.less @@ -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 { diff --git a/src/components/CustomerSelector.vue b/src/components/CustomerSelector.vue index 9bf4668..75df430 100644 --- a/src/components/CustomerSelector.vue +++ b/src/components/CustomerSelector.vue @@ -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); } } diff --git a/src/components/EventRecordCalendar.vue b/src/components/EventRecordCalendar.vue index 6228996..62222bf 100644 --- a/src/components/EventRecordCalendar.vue +++ b/src/components/EventRecordCalendar.vue @@ -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 { diff --git a/src/components/productSelector/ProductSelectPopup.vue b/src/components/productSelector/ProductSelectPopup.vue index 183c3fa..f6566b1 100644 --- a/src/components/productSelector/ProductSelectPopup.vue +++ b/src/components/productSelector/ProductSelectPopup.vue @@ -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; diff --git a/src/layout/MainLayout.vue b/src/layout/MainLayout.vue index a349b51..2f0fd1d 100644 --- a/src/layout/MainLayout.vue +++ b/src/layout/MainLayout.vue @@ -7,6 +7,7 @@ tab-bar-float :hide-nav="!tabBarStore.isShowing" @change="onChangeTab" + @rail-click="onRailClick" > @@ -162,6 +162,8 @@ const isLoading = ref(false); const isCompleting = ref(false); const isDeleting = ref(false); const internalNotifyStatus = ref(); +// 站内通知在提醒时间之后才对接收人可见,未到时间时后端按未发送处理 +const isNotifyPending = computed(() => Boolean(detail.value?.remindAt && Time.now() < detail.value.remindAt)); let loadToken = 0; const canUpdate = computed(() => detail.value?.status === "PENDING" @@ -258,6 +260,10 @@ async function loadInternalNotifyStatus(item: FollowUpReminder, token: number): if (!item.internalNotifyDetailId || !userStore.hasPermissions(corePermissionCodes.notify.read)) { return; } + // 未到提醒时间时后端按未发送处理,直接跳过避免必然失败的请求 + if (item.remindAt && Time.now() < item.remindAt) { + return; + } try { const result = await NotifyAPI.internalDetail(item.internalNotifyDetailId); if (token === loadToken) { diff --git a/src/pages/followUpReminder/FollowUpReminderEdit.vue b/src/pages/followUpReminder/FollowUpReminderEdit.vue index 301e05d..863212a 100644 --- a/src/pages/followUpReminder/FollowUpReminderEdit.vue +++ b/src/pages/followUpReminder/FollowUpReminderEdit.vue @@ -166,8 +166,10 @@ const route = useRoute(); const props = withDefaults(defineProps<{ /** 内联到主从分栏时由列表页传入,优先于路由参数 */ reminderId?: string; + customerId?: string; }>(), { - reminderId: "" + reminderId: "", + customerId: "" }); /** 非空说明当前被内联在右栏里,退出走 close 而不是路由 */ @@ -177,8 +179,8 @@ const routeId = computed(() => props.reminderId || String(route.params.id || "") // 竖屏整页编辑转横屏:回到分栏,并用 view=edit 让列表页把右栏还原成编辑 useExpandToMaster({ path: "/management/customer-follow-up-reminders", - id: () => routeId.value, - query: { view: "edit" } + id: () => routeId.value || "__create__", + query: { view: "edit", ...(route.query.customerId ? { customerId: String(route.query.customerId) } : {}) } }); /** 退出编辑:分栏时交回列表页,整页时回路由 */ @@ -199,7 +201,7 @@ const routeNavBarTitle = computed(() => { return "编辑跟进提醒"; default: // 内联在右栏时路由仍是列表页,标题不能只看 route.name - return pane ? "编辑跟进提醒" : ""; + return pane ? (routeId.value ? "编辑跟进提醒" : "新增跟进提醒") : ""; } }); const router = useRouter(); @@ -510,7 +512,7 @@ async function loadForm(): Promise { await loadStoreScope(); if (!routeId.value) { formModel.notifyChannelList = ["INTERNAL"]; - const queryCustomerId = String(route.query.customerId || ""); + const queryCustomerId = String(props.customerId || route.query.customerId || ""); if (queryCustomerId) { await handleCustomerChange(queryCustomerId); } diff --git a/src/pages/followUpReminder/FollowUpReminderList.vue b/src/pages/followUpReminder/FollowUpReminderList.vue index 51b09d2..a447206 100644 --- a/src/pages/followUpReminder/FollowUpReminderList.vue +++ b/src/pages/followUpReminder/FollowUpReminderList.vue @@ -8,14 +8,7 @@ @left-click="$router.back()" > - - + - - - - - - - - + v-entrance-transition="{ step: 30 }" + :item="item" + :can-complete="canComplete" + :can-delete="canDelete" + @complete="item.status = 'COMPLETED'" + @delete="removeFromList(item)" + @detail="toDetail(item)" + /> + - - + + + - + + - - - - - - - + + + diff --git a/src/pages/package/PackageConfigEdit.vue b/src/pages/package/PackageConfigEdit.vue index ac2f0fa..fc65d2e 100644 --- a/src/pages/package/PackageConfigEdit.vue +++ b/src/pages/package/PackageConfigEdit.vue @@ -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 { diff --git a/src/pages/point/PointAdjust.vue b/src/pages/point/PointAdjust.vue index 5d72dd8..4add31f 100644 --- a/src/pages/point/PointAdjust.vue +++ b/src/pages/point/PointAdjust.vue @@ -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 { diff --git a/src/pages/point/PointLedgerList.vue b/src/pages/point/PointLedgerList.vue index 3c5f6b6..98c200f 100644 --- a/src/pages/point/PointLedgerList.vue +++ b/src/pages/point/PointLedgerList.vue @@ -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; diff --git a/src/pages/point/PointRuleEdit.vue b/src/pages/point/PointRuleEdit.vue index 4ec85a0..87d983a 100644 --- a/src/pages/point/PointRuleEdit.vue +++ b/src/pages/point/PointRuleEdit.vue @@ -616,7 +616,7 @@ onMounted(async () => { diff --git a/src/pages/salesOrder/SalesOrderCreate.vue b/src/pages/salesOrder/SalesOrderCreate.vue index ebd5ca2..c1eead3 100644 --- a/src/pages/salesOrder/SalesOrderCreate.vue +++ b/src/pages/salesOrder/SalesOrderCreate.vue @@ -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; diff --git a/src/pages/salesOrder/component/FundRecordListCell.vue b/src/pages/salesOrder/component/FundRecordListCell.vue new file mode 100644 index 0000000..9f97184 --- /dev/null +++ b/src/pages/salesOrder/component/FundRecordListCell.vue @@ -0,0 +1,199 @@ + + + + + diff --git a/src/pages/setting/About.vue b/src/pages/setting/About.vue index 51f54a2..b194587 100644 --- a/src/pages/setting/About.vue +++ b/src/pages/setting/About.vue @@ -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 { diff --git a/src/pages/setting/AppUpdate.vue b/src/pages/setting/AppUpdate.vue index 1de48c2..a1d62b3 100644 --- a/src/pages/setting/AppUpdate.vue +++ b/src/pages/setting/AppUpdate.vue @@ -211,7 +211,8 @@ const WEB_NOTE_LIMIT = 3; const noteList = ref([]); -const noteTitle = computed(() => (updateSupported ? "更新内容" : "最近更新")); +/** 有更新时展示区间日志,已是最新时展示最近几个版本 */ +const noteTitle = computed(() => (hasUpdate() ? "更新内容" : "最近更新")); /** 查询当前版本到通道最新版本之间的变更说明 */ async function loadNotes(): Promise { diff --git a/src/pages/store/StoreDiaryDetail.vue b/src/pages/store/StoreDiaryDetail.vue index a39879f..3c8bd91 100644 --- a/src/pages/store/StoreDiaryDetail.vue +++ b/src/pages/store/StoreDiaryDetail.vue @@ -265,7 +265,7 @@ watch(() => [props.diaryId, route.params.id], () => {