Commit 86e65a9d1d1d1053630efecebcb219044152f0a8

Authored by 杨鑫
1 parent 94c284c5

泰额版修改最新

Showing 308 changed files with 6767 additions and 1438 deletions

Too many changes.

To preserve performance only 100 of 308 files are displayed.

.pnpm-store/v11/projects/0e47ef389c0c12bdfaeb86af6e6a20bb/src/utils/categoryButtonAppearance.ts
1 1 /** 与平台端 `categoryButtonAppearance.ts` 逻辑对齐,供 APP 列表与打标页渲染 */
2 2  
  3 +import { isAppLocalMediaPath } from './resolveMediaUrl'
  4 +
3 5 export type AppearanceToken = 'TEXT' | 'COLOR' | 'IMAGE'
4 6  
5 7 const ORDER: AppearanceToken[] = ['TEXT', 'COLOR', 'IMAGE']
... ... @@ -41,6 +43,7 @@ export function normalizeHexColor(v: unknown): string {
41 43  
42 44 function looksLikeImageUrl(s: string): boolean {
43 45 if (!s) return false
  46 + if (isAppLocalMediaPath(s)) return true
44 47 if (/^https?:\/\//i.test(s)) return true
45 48 if (s.startsWith('/')) return true
46 49 if (/\.(png|jpe?g|gif|webp|svg)(\?|$)/i.test(s)) return true
... ...
.pnpm-store/v11/projects/0e47ef389c0c12bdfaeb86af6e6a20bb/src/utils/offlineLabelingSupport.ts
... ... @@ -4,7 +4,7 @@
4 4 */
5 5 import type { PrintLogItemDto, UsAppLabelPrintInputVo } from '../types/usAppLabeling'
6 6 import { fetchLabelMultipleOptionById } from '../services/labelMultipleOption'
7   -import { resolveMediaUrlForApp } from './resolveMediaUrl'
  7 +import { isAppLocalMediaPath, resolveMediaUrlForApp } from './resolveMediaUrl'
8 8 import { getOfflineCache, hasOfflineCache, setOfflineCache } from './sqliteSync'
9 9  
10 10 export type PrintLogPageCache = {
... ... @@ -181,8 +181,7 @@ function downloadAuthHeaders(): Record<string, string> {
181 181 function needsOfflineMediaDownload(raw: string): boolean {
182 182 const s = String(raw || '').trim()
183 183 if (!s) return false
184   - if (s.startsWith('data:') || s.startsWith('file://')) return false
185   - if (s.startsWith('_doc/') || s.startsWith('_www/')) return false
  184 + if (isAppLocalMediaPath(s)) return false
186 185 if (/^https?:\/\//i.test(s)) return true
187 186 if (
188 187 s.startsWith('/picture/')
... ... @@ -280,6 +279,44 @@ function cfgStr(cfg: Record<string, unknown>, keys: string[]): string {
280 279 return ''
281 280 }
282 281  
  282 +async function localizeMediaStringValue(raw: string): Promise<{ next: string; count: number }> {
  283 + const trimmed = String(raw || '').trim()
  284 + if (!trimmed) return { next: raw, count: 0 }
  285 +
  286 + // categoryPhotoUrl 常为 JSON 数组:["文案","#fff","/picture/xx.png"]
  287 + if (trimmed.startsWith('[')) {
  288 + try {
  289 + const arr = JSON.parse(trimmed) as unknown
  290 + if (Array.isArray(arr)) {
  291 + let count = 0
  292 + const nextArr: unknown[] = []
  293 + for (const item of arr) {
  294 + if (typeof item !== 'string') {
  295 + nextArr.push(item)
  296 + continue
  297 + }
  298 + const local = await localizeMediaPath(item)
  299 + if (local) {
  300 + nextArr.push(local)
  301 + count += 1
  302 + } else {
  303 + nextArr.push(item)
  304 + }
  305 + }
  306 + return {
  307 + next: count > 0 ? JSON.stringify(nextArr) : trimmed,
  308 + count,
  309 + }
  310 + }
  311 + } catch {
  312 + /* 非 JSON,按普通 URL 处理 */
  313 + }
  314 + }
  315 +
  316 + const local = await localizeMediaPath(trimmed)
  317 + return local ? { next: local, count: 1 } : { next: raw, count: 0 }
  318 +}
  319 +
283 320 async function replaceUrlField(
284 321 obj: Record<string, unknown>,
285 322 keys: string[],
... ... @@ -288,10 +325,10 @@ async function replaceUrlField(
288 325 for (const k of keys) {
289 326 const raw = obj[k]
290 327 if (raw == null || typeof raw !== 'string') continue
291   - const local = await localizeMediaPath(raw)
292   - if (local) {
293   - obj[k] = local
294   - n += 1
  328 + const { next, count } = await localizeMediaStringValue(raw)
  329 + if (count > 0) {
  330 + obj[k] = next
  331 + n += count
295 332 }
296 333 }
297 334 return n
... ...
.pnpm-store/v11/projects/0e47ef389c0c12bdfaeb86af6e6a20bb/src/utils/offlineSyncManager.ts
... ... @@ -164,10 +164,9 @@ export async function performInitialOfflineSync(): Promise&lt;void&gt; {
164 164 ])
165 165 if (treeResult.status === 'fulfilled' && Array.isArray(treeResult.value)) {
166 166 try {
167   - const photos = await localizeTreeMediaUrls(treeResult.value)
168   - if (photos > 0) {
169   - await setOfflineCache('labeling', `labeling-tree:${locId}::`, treeResult.value)
170   - }
  167 + // 无论本次新下载几张图,都写回本地化后的树,避免断网仍读到远端 URL
  168 + await localizeTreeMediaUrls(treeResult.value)
  169 + await setOfflineCache('labeling', `labeling-tree:${locId}::`, treeResult.value)
171 170 } catch {
172 171 /* 树图本地化失败不阻断 */
173 172 }
... ...
.pnpm-store/v11/projects/0e47ef389c0c12bdfaeb86af6e6a20bb/src/utils/resolveMediaUrl.ts
1 1 import { buildApiUrl, getStaticMediaOrigin } from './apiBase'
2 2  
3   -/** 相对路径拼后端根;绝对 URL / data URL 原样返回 */
  3 +/**
  4 + * App 本地媒体路径(离线 downloadFile/saveFile、包内资源等)。
  5 + * 这类路径禁止再拼 API 域名,否则断网后图片/Logo 全部挂掉。
  6 + */
  7 +export function isAppLocalMediaPath(stored: string | null | undefined): boolean {
  8 + const s = String(stored ?? '').trim()
  9 + if (!s) return false
  10 + if (s.startsWith('data:')) return true
  11 + if (s.startsWith('blob:')) return true
  12 + if (s.startsWith('file://')) return true
  13 + if (s.startsWith('wxfile://') || s.startsWith('weixin://')) return true
  14 + if (s.startsWith('content://')) return true
  15 + if (s.startsWith('_doc/') || s.startsWith('_www/') || s.startsWith('_downloads/')) {
  16 + return true
  17 + }
  18 + // uni.saveFile / plus.io 常见绝对路径
  19 + if (/^[a-zA-Z]:[\\/]/.test(s)) return true
  20 + if (
  21 + s.startsWith('/var/')
  22 + || s.startsWith('/data/')
  23 + || s.startsWith('/storage/')
  24 + || s.startsWith('/sdcard/')
  25 + ) {
  26 + return true
  27 + }
  28 + return false
  29 +}
  30 +
  31 +/** 相对路径拼后端根;绝对 URL / data URL / 本地路径原样返回 */
4 32 export function resolveMediaUrlForApp(stored: string | null | undefined): string {
5 33 const s = (stored ?? '').trim()
6 34 if (!s) return ''
7   - if (s.startsWith('data:')) return s
  35 + // 离线已落地的本地文件必须原样返回,禁止再拼 API
  36 + if (isAppLocalMediaPath(s)) return s
8 37 if (/^https?:\/\//i.test(s)) return s
9 38 const path = s.startsWith('/') ? s : `/${s}`
10 39 const mediaOrigin = getStaticMediaOrigin()
... ... @@ -21,6 +50,8 @@ export function storedValueLooksLikeImagePath(stored: string | null | undefined)
21 50 if (!s) return false
22 51 const lower = s.toLowerCase()
23 52 if (lower.startsWith('data:image/')) return true
  53 + if (isAppLocalMediaPath(s) && /\.(png|jpe?g|gif|webp|bmp)(\?|#|$)/i.test(s)) return true
  54 + if (isAppLocalMediaPath(s)) return true
24 55 if (lower.startsWith('/picture/') || lower.startsWith('/static/')) return true
25 56 if (/\.(png|jpe?g|gif|webp|bmp)(\?|#|$)/i.test(s)) return true
26 57 if (/^https?:\/\//i.test(s)) {
... ...
泰额版/Food Labeling Management App UniApp/package.json
... ... @@ -2,7 +2,9 @@
2 2 "name": "food-labeling-management-app-uniapp",
3 3 "version": "0.0.0",
4 4 "scripts": {
  5 + "sync:static-fonts": "node scripts/sync-static-fonts.js",
5 6 "sync:native-fast-printer": "powershell -ExecutionPolicy Bypass -File scripts/sync-native-fast-printer.ps1",
  7 + "prebuild:app": "node scripts/sync-static-fonts.js",
6 8 "dev:custom": "uni -p",
7 9 "dev:h5": "uni",
8 10 "dev:h5:ssr": "uni --ssr",
... ...
泰额版/Food Labeling Management App UniApp/scripts/sync-static-fonts.js 0 → 100644
  1 +/**
  2 + * 将项目根 static/fonts 同步到 src/static/fonts,确保 HBuilderX / 自定义基座 APK 内存在 _www/static/fonts。
  3 + * uni-app vite 工程内 src/static 会原样打进包;仅根目录 static/ 时部分打包链路会漏字体。
  4 + */
  5 +const fs = require('fs');
  6 +const path = require('path');
  7 +
  8 +const root = path.resolve(__dirname, '..');
  9 +const srcDir = path.join(root, 'static', 'fonts');
  10 +const destDir = path.join(root, 'src', 'static', 'fonts');
  11 +
  12 +if (!fs.existsSync(srcDir)) {
  13 + console.warn('[sync-static-fonts] 未找到 static/fonts,跳过');
  14 + process.exit(0);
  15 +}
  16 +
  17 +function copyRecursive(src, dest) {
  18 + if (!fs.existsSync(dest)) {
  19 + fs.mkdirSync(dest, { recursive: true });
  20 + }
  21 + const entries = fs.readdirSync(src, { withFileTypes: true });
  22 + for (const e of entries) {
  23 + const s = path.join(src, e.name);
  24 + const d = path.join(dest, e.name);
  25 + if (e.isDirectory()) {
  26 + copyRecursive(s, d);
  27 + } else {
  28 + fs.copyFileSync(s, d);
  29 + }
  30 + }
  31 +}
  32 +
  33 +copyRecursive(srcDir, destDir);
  34 +console.log('[sync-static-fonts] 已同步 static/fonts -> src/static/fonts');
... ...
泰额版/Food Labeling Management App UniApp/src/App.vue
... ... @@ -4,6 +4,11 @@ import { initOfflineSqlite } from &quot;./utils/sqliteSync&quot;;
4 4 import { syncNowAndRefreshCaches } from "./utils/offlineSyncManager";
5 5 import { isLoggedIn } from "./utils/authSession";
6 6 import { preloadAllLabelEditorFonts } from "./utils/labelEditorFonts";
  7 +import {
  8 + pauseGlobalAlertTimerMonitor,
  9 + startGlobalAlertTimerMonitor,
  10 + stopGlobalAlertTimerMonitor,
  11 +} from "./utils/globalAlertTimerMonitor";
7 12  
8 13 let networkSyncInFlight = false;
9 14  
... ... @@ -19,14 +24,21 @@ onLaunch(() =&gt; {
19 24 networkSyncInFlight = false;
20 25 });
21 26 });
  27 + if (isLoggedIn()) {
  28 + startGlobalAlertTimerMonitor();
  29 + }
22 30 });
23 31  
24 32 onShow(() => {
25   - // App Show
  33 + if (isLoggedIn()) {
  34 + startGlobalAlertTimerMonitor();
  35 + } else {
  36 + stopGlobalAlertTimerMonitor();
  37 + }
26 38 });
27 39  
28 40 onHide(() => {
29   - // App Hide
  41 + pauseGlobalAlertTimerMonitor();
30 42 });
31 43 </script>
32 44  
... ...
泰额版/Food Labeling Management App UniApp/src/components/AppIcon.vue
... ... @@ -41,6 +41,8 @@ const icons: Record&lt;string, string&gt; = {
41 41 utensils: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2"/><path d="M7 2v20"/><path d="M21 15V2v0a5 5 0 0 0-5 5v6c0 2.21 1.79 4 4 4h3"/><path d="M21 15v-2a3 3 0 0 0-3-3h-1"/></svg>',
42 42 plus: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>',
43 43 clock: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',
  44 + pin: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg>',
  45 + coffee: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 8h1a4 4 0 1 1 0 8h-1"/><path d="M3 8h14v9a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4Z"/><line x1="6" y1="2" x2="6" y2="4"/><line x1="10" y1="2" x2="10" y2="4"/><line x1="14" y1="2" x2="14" y2="4"/></svg>',
44 46 settings: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',
45 47 globe: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',
46 48 cloud: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z"/></svg>',
... ...
泰额版/Food Labeling Management App UniApp/src/components/LocationPicker.vue
... ... @@ -8,7 +8,7 @@
8 8 <view v-if="showPicker" class="picker-mask" @click="showPicker = false">
9 9 <view class="picker-body" @click.stop>
10 10 <view class="picker-header">
11   - <text class="picker-title">{{ t('location.switchLocation') }}</text>
  11 + <text class="picker-title">Switch Location</text>
12 12 <view class="picker-close" @click="showPicker = false">
13 13 <AppIcon name="plus" size="sm" color="gray" />
14 14 </view>
... ... @@ -50,6 +50,8 @@ import {
50 50 getBoundLocations,
51 51 getCurrentLocationCode,
52 52 } from '../utils/stores'
  53 +import { usAppFetchMyProfile } from '../services/usAppAuth'
  54 +import { isAppAdminUser } from '../utils/appAdminRole'
53 55 import type { UsAppBoundLocationDto } from '../types/usAppBound'
54 56  
55 57 const { t } = useI18n()
... ... @@ -57,6 +59,7 @@ const stores = ref&lt;UsAppBoundLocationDto[]&gt;([])
57 59 const currentId = ref(getCurrentStoreId())
58 60 const currentName = ref(getCurrentStoreName())
59 61 const showPicker = ref(false)
  62 +const checkingAdminScope = ref(false)
60 63  
61 64 function refreshList() {
62 65 stores.value = getBoundLocations().filter((s) => s.state !== false)
... ... @@ -80,7 +83,20 @@ const displayLocationName = computed(() =&gt; {
80 83 return code || ''
81 84 })
82 85  
83   -function openPicker() {
  86 +async function openPicker() {
  87 + if (checkingAdminScope.value) return
  88 + checkingAdminScope.value = true
  89 + try {
  90 + const profile = await usAppFetchMyProfile()
  91 + if (isAppAdminUser(profile)) {
  92 + uni.redirectTo({ url: '/pages/store-select/store-select' })
  93 + return
  94 + }
  95 + } catch {
  96 + // If the role lookup fails, keep the existing local picker available.
  97 + } finally {
  98 + checkingAdminScope.value = false
  99 + }
84 100 refreshList()
85 101 currentId.value = getCurrentStoreId()
86 102 showPicker.value = true
... ...
泰额版/Food Labeling Management App UniApp/src/components/SideMenu.vue
... ... @@ -67,7 +67,9 @@
67 67 </view>
68 68  
69 69 <view class="drawer-footer" :style="{ paddingBottom: (bottomSafeArea + 24) + 'px' }">
70   - <image class="footer-logo-img" src="/static/logo_us.png" mode="aspectFit" />
  70 + <view class="footer-logo-box">
  71 + <image class="footer-logo-img" src="/static/logo_us.png" mode="widthFix" />
  72 + </view>
71 73 </view>
72 74 </view>
73 75 </view>
... ... @@ -79,6 +81,7 @@ import { useI18n } from &#39;vue-i18n&#39;
79 81 import AppIcon from './AppIcon.vue'
80 82 import { getStatusBarHeight, getBottomSafeArea } from '../utils/statusBar'
81 83 import { clearAuthSession } from '../utils/authSession'
  84 +import { stopGlobalAlertTimerMonitor } from '../utils/globalAlertTimerMonitor'
82 85 import { STORE_CHANGED_EVENT, getCurrentStoreName } from '../utils/stores'
83 86  
84 87 const props = defineProps<{
... ... @@ -122,6 +125,7 @@ const items = [
122 125 },
123 126 { key: 'profile', path: '/pages/more/profile', icon: 'user', labelKey: 'more.profile' },
124 127 { key: 'location', path: '/pages/more/location', icon: 'mapPin', labelKey: 'more.location' },
  128 + { key: 'printerSetting', path: '/pages/labels/bluetooth', icon: 'printer', labelKey: 'more.printers' },
125 129 { key: 'training', path: '/pages/more/training', icon: 'fileText', labelKey: 'more.training' },
126 130 { key: 'alerts', path: '/pages/more/alerts', icon: 'alert', labelKey: 'more.alerts' },
127 131 { key: 'sync', path: '/pages/more/sync', icon: 'refresh', labelKey: 'more.sync' },
... ... @@ -169,6 +173,7 @@ const currentPath = computed(() =&gt; {
169 173 const isActive = (path: string) => !!path && path !== '__logout__' && currentPath.value === path
170 174  
171 175 const handleLogout = () => {
  176 + stopGlobalAlertTimerMonitor()
172 177 clearAuthSession()
173 178 uni.redirectTo({ url: '/pages/login/login' })
174 179 }
... ... @@ -352,12 +357,17 @@ const handleItemClick = (item: any) =&gt; {
352 357 flex-shrink: 0;
353 358 }
354 359  
355   -.footer-logo-img {
356   - width: 260rpx;
357   - height: 72rpx;
358   - opacity: 0.85;
359   - background: rgba(255,255,255,0.92);
  360 +.footer-logo-box {
  361 + width: 340rpx;
  362 + background: rgba(255, 255, 255, 0.96);
360 363 border-radius: 10rpx;
361   - padding: 8rpx 12rpx;
  364 + padding: 8rpx 10rpx;
  365 + box-sizing: border-box;
  366 + opacity: 0.95;
  367 +}
  368 +
  369 +.footer-logo-img {
  370 + width: 100%;
  371 + display: block;
362 372 }
363 373 </style>
... ...
泰额版/Food Labeling Management App UniApp/src/locales/en.ts
... ... @@ -218,6 +218,8 @@ export default {
218 218 product: 'Product',
219 219 expiresAt: 'Expires At',
220 220 printedAt: 'Printed At',
  221 + location: 'Location',
  222 + printedBy: 'Printed By',
221 223 loading: 'Loading...',
222 224 loadingMore: 'Loading more...',
223 225 endOfList: 'End of list',
... ... @@ -226,10 +228,31 @@ export default {
226 228 loadFailed: 'Failed to load alerts',
227 229 delete: 'Delete',
228 230 deleting: 'Deleting...',
229   - deleteTitle: 'Delete Alert',
230   - deleteConfirm: 'Delete alert "{name}"?',
  231 + deleteTitle: 'Delete Timer Alert',
  232 + deleteConfirm: 'Delete the current timer alert?',
231 233 deleteSuccess: 'Deleted',
232 234 deleteFailed: 'Delete failed',
  235 + expiredTitle: 'Label Expired',
  236 + expiredConfirm: 'OK',
  237 + expiredUserFallback: 'colleague',
  238 + expiredAt: 'Label "{name}" expired at {time}. Please handle it promptly.',
  239 + addTimer: 'Add Timer',
  240 + addTimerTitle: 'Select Alert Template',
  241 + addTimerHint: 'Pick an enabled alert template to start a countdown',
  242 + addTimerConfirm: 'Confirm',
  243 + addTimerSuccess: 'Timer added',
  244 + addTimerFailed: 'Failed to add timer',
  245 + addTimerNoTemplate: 'Please select a template',
  246 + addTimerEmpty: 'No alert templates available',
  247 + addTimerLoading: 'Loading templates...',
  248 + durationLabel: 'Duration',
  249 + unitYear: 'Year',
  250 + unitMonth: 'Month',
  251 + unitDay: 'Day',
  252 + unitHour: 'Hour',
  253 + unitMinute: 'Minute',
  254 + unitSecond: 'Second',
  255 + unitCombined: 'Combined',
233 256 },
234 257 location: {
235 258 title: 'Location',
... ...
泰额版/Food Labeling Management App UniApp/src/locales/zh.ts
... ... @@ -218,6 +218,8 @@ export default {
218 218 product: '产品',
219 219 expiresAt: '过期时间',
220 220 printedAt: '打印时间',
  221 + location: '门店',
  222 + printedBy: '打印人',
221 223 loading: '加载中...',
222 224 loadingMore: '加载更多...',
223 225 endOfList: '已到底',
... ... @@ -226,10 +228,31 @@ export default {
226 228 loadFailed: '警告列表加载失败',
227 229 delete: '删除',
228 230 deleting: '删除中...',
229   - deleteTitle: '删除警告',
230   - deleteConfirm: '将删除警告 "{name}",是否确认?',
  231 + deleteTitle: '删除计时警告',
  232 + deleteConfirm: '是否删除当前计时警告?',
231 233 deleteSuccess: '删除成功',
232 234 deleteFailed: '删除失败',
  235 + expiredTitle: '标签已过期',
  236 + expiredConfirm: '知道了',
  237 + expiredUserFallback: '同事',
  238 + expiredAt: '标签「{name}」已于 {time} 过期,请及时处理',
  239 + addTimer: '新增计时',
  240 + addTimerTitle: '选择警告模板',
  241 + addTimerHint: '选择启用中的警告模板后确认,将加入倒计时列表',
  242 + addTimerConfirm: '确认添加',
  243 + addTimerSuccess: '已添加计时',
  244 + addTimerFailed: '添加计时失败',
  245 + addTimerNoTemplate: '请选择警告模板',
  246 + addTimerEmpty: '暂无可用警告模板',
  247 + addTimerLoading: '加载模板中...',
  248 + durationLabel: '时长',
  249 + unitYear: '年',
  250 + unitMonth: '月',
  251 + unitDay: '日',
  252 + unitHour: '时',
  253 + unitMinute: '分',
  254 + unitSecond: '秒',
  255 + unitCombined: '组合时间',
233 256 },
234 257 location: {
235 258 title: '工作地点',
... ...
泰额版/Food Labeling Management App UniApp/src/manifest.json
1 1 {
2   - "name" : "food.labeling",
  2 + "name" : "3F",
3 3 "appid" : "__UNI__5C033BE",
4   - "description" : "",
5   - "versionName" : "1.0.5",
6   - "versionCode" : 105,
  4 + "description" : "3F",
  5 + "versionName" : "1.0.8",
  6 + "versionCode" : 108,
7 7 "transformPx" : false,
8 8 /* 5+App特有相关 */
9 9 "app-plus" : {
... ... @@ -52,7 +52,10 @@
52 52 "<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\"/>",
53 53 "<uses-permission android:name=\"android.permission.BLUETOOTH_ADVERTISE\"/>",
54 54 "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
55   - "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>"
  55 + "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
  56 + "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>",
  57 + "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
  58 + "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>"
56 59 ],
57 60 "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ]
58 61 },
... ... @@ -93,6 +96,9 @@
93 96 "spotlight@3x" : "unpackage/res/icons/120x120.png"
94 97 }
95 98 }
  99 + },
  100 + "splashscreen" : {
  101 + "iosStyle" : "common"
96 102 }
97 103 },
98 104 "nativePlugins" : {
... ...
泰额版/Food Labeling Management App UniApp/src/pages.json
... ... @@ -95,7 +95,8 @@
95 95 "path": "pages/more/alerts",
96 96 "style": {
97 97 "navigationBarTitleText": "Alerts",
98   - "navigationStyle": "custom"
  98 + "navigationStyle": "custom",
  99 + "disableScroll": true
99 100 }
100 101 },
101 102 {
... ...
泰额版/Food Labeling Management App UniApp/src/pages/index/index.vue
... ... @@ -4,7 +4,9 @@
4 4 <view class="top-bar">
5 5 <view class="top-left-empty" />
6 6 <view class="top-center">
7   - <image class="header-logo" src="/static/logo_us.png" mode="aspectFit" />
  7 + <view class="header-logo-box">
  8 + <image class="header-logo" src="/static/logo_us.png" mode="widthFix" />
  9 + </view>
8 10 </view>
9 11 <view class="top-right" @click="isMenuOpen = true">
10 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -12,7 +14,6 @@
12 14 </view>
13 15 <view class="hero-info">
14 16 <text class="app-sub">{{ storeName }}</text>
15   - <LocationPicker />
16 17 </view>
17 18 </view>
18 19  
... ... @@ -44,7 +45,6 @@ import { useI18n } from &#39;vue-i18n&#39;
44 45 import { onShow } from '@dcloudio/uni-app'
45 46 import AppIcon from '../../components/AppIcon.vue'
46 47 import SideMenu from '../../components/SideMenu.vue'
47   -import LocationPicker from '../../components/LocationPicker.vue'
48 48 import { getStatusBarHeight } from '../../utils/statusBar'
49 49 import { getAccessToken } from '../../utils/authSession'
50 50 import { STORE_CHANGED_EVENT, getCurrentStoreName } from '../../utils/stores'
... ... @@ -101,7 +101,7 @@ const navTo = (path: string) =&gt; {
101 101 }
102 102  
103 103 .header-hero {
104   - min-height: 260rpx;
  104 + min-height: 300rpx;
105 105 background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
106 106 padding-left: 32rpx;
107 107 padding-right: 32rpx;
... ... @@ -109,15 +109,17 @@ const navTo = (path: string) =&gt; {
109 109 }
110 110  
111 111 .top-bar {
112   - height: 96rpx;
  112 + min-height: 96rpx;
113 113 display: flex;
114 114 align-items: center;
115 115 justify-content: space-between;
  116 + gap: 12rpx;
116 117 }
117 118  
118 119 .top-left-empty {
119 120 width: 64rpx;
120 121 height: 64rpx;
  122 + flex-shrink: 0;
121 123 }
122 124  
123 125 .top-right {
... ... @@ -128,22 +130,32 @@ const navTo = (path: string) =&gt; {
128 130 display: flex;
129 131 align-items: center;
130 132 justify-content: center;
  133 + flex-shrink: 0;
131 134 }
132 135  
133 136 .top-center {
134 137 flex: 1;
  138 + min-width: 0;
135 139 display: flex;
136 140 flex-direction: column;
137 141 align-items: center;
138 142 }
139 143  
140   -.header-logo {
141   - width: 300rpx;
142   - height: 80rpx;
143   - background: rgba(255, 255, 255, 0.92);
  144 +.header-logo-box {
  145 + width: 440rpx;
  146 + background: rgba(255, 255, 255, 0.96);
144 147 border-radius: 12rpx;
145 148 padding: 8rpx 12rpx;
146 149 margin-bottom: 8rpx;
  150 + box-sizing: border-box;
  151 + display: flex;
  152 + align-items: center;
  153 + justify-content: center;
  154 +}
  155 +
  156 +.header-logo {
  157 + width: 100%;
  158 + display: block;
147 159 }
148 160  
149 161 .hero-info {
... ...
泰额版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="page-title">Printer</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -299,9 +298,10 @@
299 298 <text class="tips-item">1. Ensure the printer is powered on and in pairing mode</text>
300 299 <text class="tips-item">2. On Android: enable Location (required for Bluetooth scan)</text>
301 300 <text class="tips-item">3. Place the printer within 10 m and tap Scan again</text>
302   - <text class="tips-item">4. Prefer GP-D320FX-spp_* (classic / Gainscha SDK2). Avoid GP-D320FX-ble_* (slow + layout wrap).</text>
303   - <text class="tips-item">5. Pair the printer in system Bluetooth first if it does not appear after Scan</text>
304   - <text class="tips-item tips-item-last">6. Restart the printer or app if not visible</text>
  301 + <text class="tips-item">4. GP-D320FX has two names: spp_* (classic, fast) and ble_* (BLE, slower). App Scan may only show ble_* until spp is paired in Android Settings.</text>
  302 + <text class="tips-item">5. To get spp_*: open Android Bluetooth → pair the printer → look for GP-D320FX-spp_* → then Scan again (paired devices are listed).</text>
  303 + <text class="tips-item">6. If only ble_* appears: connect ble_* (BLE path works). Do not force classic/SDK2 on a ble_* name (that hangs at 20%).</text>
  304 + <text class="tips-item tips-item-last">7. Restart the printer or app if not visible; keep Location ON for Android scan</text>
305 305 </view>
306 306 </view>
307 307 </view>
... ... @@ -385,7 +385,6 @@
385 385 import { ref, computed, onMounted, onUnmounted, getCurrentInstance, nextTick } from 'vue'
386 386 import { onLoad, onShow } from '@dcloudio/uni-app'
387 387 import AppIcon from '../../components/AppIcon.vue'
388   -import LocationPicker from '../../components/LocationPicker.vue'
389 388 import SideMenu from '../../components/SideMenu.vue'
390 389 import { getStatusBarHeight } from '../../utils/statusBar'
391 390 import { getDeviceIdentity, isGpD740AioDevice, isGpD750AioDevice } from '../../utils/deviceInfo'
... ... @@ -843,9 +842,44 @@ const onDeviceFound = (res: any) =&gt; {
843 842 devices.value.sort((a, b) => (b.RSSI || -100) - (a.RSSI || -100))
844 843 }
845 844  
  845 +/** 把系统已配对经典设备并入列表(GP-D320FX-spp_* 常要先在系统蓝牙配对才看得见)。 */
  846 +function loadPairedClassicDevices () {
  847 + // #ifdef APP-PLUS
  848 + try {
  849 + const classic = classicBluetooth
  850 + if (!classic || typeof classic.getPairedDevices !== 'function') {
  851 + debugInfo.value.pairedCount = 0
  852 + return
  853 + }
  854 + const list = classic.getPairedDevices() || []
  855 + debugInfo.value.pairedCount = list.length
  856 + let sppCount = 0
  857 + list.forEach((item: any) => {
  858 + const name = String(item?.name || item?.localName || '').trim()
  859 + if (!name) return
  860 + if (/d320fx-spp|gp-d320fx-spp|\-spp_/i.test(name)) sppCount += 1
  861 + upsertDevice({
  862 + deviceId: item.deviceId,
  863 + name,
  864 + type: (item.type as BtDevice['type']) || 'classic',
  865 + RSSI: -40,
  866 + })
  867 + })
  868 + debugInfo.value.lastClassicEvent = sppCount > 0
  869 + ? `paired loaded (spp=${sppCount})`
  870 + : (list.length > 0 ? 'paired loaded (no spp name)' : 'no paired devices')
  871 + } catch (e) {
  872 + console.error('loadPairedClassicDevices failed', e)
  873 + debugInfo.value.pairedCount = 0
  874 + debugInfo.value.lastClassicEvent = 'load paired failed'
  875 + }
  876 + // #endif
  877 +}
  878 +
846 879 function startClassicScan () {
847 880 // #ifdef APP-PLUS
848 881 const classic = classicBluetooth
  882 + loadPairedClassicDevices()
849 883 if (classic && classic.startClassicDiscovery) {
850 884 try {
851 885 classic.startClassicDiscovery(
... ...
泰额版/Food Labeling Management App UniApp/src/pages/labels/labels.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="app-name">Labeling</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -306,7 +305,6 @@
306 305 import { ref, computed, watch } from 'vue'
307 306 import { onShow } from '@dcloudio/uni-app'
308 307 import AppIcon from '../../components/AppIcon.vue'
309   -import LocationPicker from '../../components/LocationPicker.vue'
310 308 import SideMenu from '../../components/SideMenu.vue'
311 309 import { getStatusBarHeight } from '../../utils/statusBar'
312 310 import { getCurrentPrinterSummary } from '../../utils/print/manager/printerManager'
... ...
泰额版/Food Labeling Management App UniApp/src/pages/labels/preview.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="page-title">Label Preview</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -201,6 +200,29 @@
201 200 </view>
202 201 </view>
203 202  
  203 + <!-- 页面内进度层:Log 做在卡片内,保证一定可点(勿用 uni.showLoading mask) -->
  204 + <view v-if="isPrinting" class="print-progress-overlay" @touchmove.stop.prevent>
  205 + <view class="print-progress-card" @click.stop>
  206 + <view class="print-progress-spinner" />
  207 + <text class="print-progress-text">Printing {{ printProgressPercent }}%</text>
  208 + <text class="print-progress-hint">{{ PRINT_BUILD_FINGERPRINT }}</text>
  209 + <view
  210 + class="print-progress-log-btn"
  211 + @click.stop="copyPrintRunDiagnosticsToClipboard"
  212 + >
  213 + <text class="print-progress-log-btn-text">Copy Log</text>
  214 + </view>
  215 + </view>
  216 + </view>
  217 +
  218 + <!-- 右下角 Log:始终可点(打印中也显示) -->
  219 + <view
  220 + class="print-diag-log-btn"
  221 + @click.stop="copyPrintRunDiagnosticsToClipboard"
  222 + >
  223 + <text class="print-diag-log-text">Log</text>
  224 + </view>
  225 +
204 226 <view v-if="showPreviewModal && previewImageSrc" class="modal-mask" @click="showPreviewModal = false">
205 227 <view class="modal-body modal-body-label-only" @click.stop>
206 228 <view class="modal-label-wrap">
... ... @@ -265,7 +287,6 @@ import { ref, computed, getCurrentInstance, nextTick, watch } from &#39;vue&#39;
265 287 import { onLoad, onShow, onUnload } from '@dcloudio/uni-app'
266 288 import { useI18n } from 'vue-i18n'
267 289 import AppIcon from '../../components/AppIcon.vue'
268   -import LocationPicker from '../../components/LocationPicker.vue'
269 290 import SideMenu from '../../components/SideMenu.vue'
270 291 import NoPrinterModal from '../../components/NoPrinterModal.vue'
271 292 import { getStatusBarHeight } from '../../utils/statusBar'
... ... @@ -284,6 +305,7 @@ import {
284 305 import classicBluetooth from '../../utils/print/bluetoothTool.js'
285 306 import { getNativeFastPrinterState, isNativeFastPrinterAvailable } from '../../utils/print/nativeFastPrinter'
286 307 import { showNativeFastPrinterDebugModal } from '../../utils/print/showNativeFastPrinterDebugModal'
  308 +import { refreshGlobalAlertTimerMonitor } from '../../utils/globalAlertTimerMonitor'
287 309 import { getCurrentPrinterMediaDebugInfo, getCurrentPrinterMediaGapMm, getCurrentPrinterMediaType, shouldDisableCutterForCurrentMedia } from '../../utils/print/printerMediaSettings'
288 310 import type { SystemLabelTemplate, SystemTemplateElementBase } from '../../utils/print/types/printer'
289 311 import { fetchLabelMultipleOptionById } from '../../services/labelMultipleOption'
... ... @@ -385,10 +407,13 @@ import {
385 407 restoreD320faxVirtualBtBluetoothMode,
386 408 isVirtualBtBluetoothConnection,
387 409 } from '../../utils/print/printerConnection'
  410 +import { logLabelEditorFontPackDiagnostics } from '../../utils/labelEditorFonts'
388 411 import {
  412 + getPrintRunDiagnosticsText,
389 413 getPrintRunDiagnosticsTextForModal,
390 414 persistPrintRunDiagnostics,
391 415 printRunDiag,
  416 + PRINT_BUILD_FINGERPRINT,
392 417 startPrintRunDiagnostics,
393 418 } from '../../utils/print/printRunDiagnostics'
394 419 import { isUsAppSessionExpiredError } from '../../utils/usAppApiRequest'
... ... @@ -520,7 +545,7 @@ function buildPrintPreflightDeviceInfoText (args: {
520 545 lines.push(`- platform: ${String(sys.platform || '-')}`)
521 546 lines.push(`- system: ${String(sys.system || '-')}`)
522 547 lines.push(`- fingerprint: ${String(getDeviceFingerprint?.() || '-')}`)
523   - lines.push(`- jsBuild: upos-no-silent-fallback@2026-04-22`)
  548 + lines.push(`- jsBuild: ${PRINT_BUILD_FINGERPRINT}`)
524 549 lines.push('')
525 550 lines.push('Printer / Connection')
526 551 lines.push(`- selectedType: ${String(summary.type || '-')}`)
... ... @@ -895,8 +920,61 @@ function applyNativeTemplateStyleScale(
895 920 }
896 921 }
897 922  
898   -/** ????????0??00%?????????????? showLoading ?????? 0 ????????1%??*/
  923 +/** 打印进度:页面内 overlay 显示,禁止 uni.showLoading(mask) 挡 Log */
899 924 let lastShownPrintPct = -999
  925 +let printDiagPersistTimer: ReturnType<typeof setInterval> | null = null
  926 +const printProgressPercent = ref(0)
  927 +
  928 +function startPrintDiagPersistLoop () {
  929 + stopPrintDiagPersistLoop()
  930 + try {
  931 + persistPrintRunDiagnostics()
  932 + } catch (_) {}
  933 + printDiagPersistTimer = setInterval(() => {
  934 + try {
  935 + persistPrintRunDiagnostics()
  936 + } catch (_) {}
  937 + }, 2000)
  938 +}
  939 +
  940 +function stopPrintDiagPersistLoop () {
  941 + if (printDiagPersistTimer) {
  942 + clearInterval(printDiagPersistTimer)
  943 + printDiagPersistTimer = null
  944 + }
  945 + try {
  946 + persistPrintRunDiagnostics()
  947 + } catch (_) {}
  948 +}
  949 +
  950 +function copyPrintRunDiagnosticsToClipboard () {
  951 + // 先落盘再读,避免卡在 SDK2 时剪贴板还是旧的
  952 + try {
  953 + persistPrintRunDiagnostics()
  954 + } catch (_) {}
  955 + const text = getPrintRunDiagnosticsText()
  956 + if (!text.trim()) {
  957 + uni.showToast({ title: 'No print log yet', icon: 'none' })
  958 + return
  959 + }
  960 + uni.setClipboardData({
  961 + data: text,
  962 + success: () => {
  963 + uni.showToast({
  964 + title: `Copied (${PRINT_BUILD_FINGERPRINT})`,
  965 + icon: 'none',
  966 + duration: 2800,
  967 + })
  968 + },
  969 + fail: () => {
  970 + uni.showModal({
  971 + title: 'Print diagnostics',
  972 + content: getPrintRunDiagnosticsTextForModal(3600),
  973 + showCancel: false,
  974 + })
  975 + },
  976 + })
  977 +}
900 978  
901 979 function showPrintProgress (percent: number) {
902 980 const p = Math.max(0, Math.min(100, Math.round(percent)))
... ... @@ -910,8 +988,10 @@ function showPrintProgress (percent: number) {
910 988 return
911 989 }
912 990 lastShownPrintPct = p
  991 + printProgressPercent.value = p
  992 + // 不用 uni.showLoading:原生遮罩会盖住 Log,导致无法点复制
913 993 try {
914   - uni.showLoading({ title: `Printing ${p}%`, mask: true })
  994 + uni.hideLoading()
915 995 } catch (_) {}
916 996 }
917 997  
... ... @@ -1862,7 +1942,11 @@ const handlePrint = async () =&gt; {
1862 1942 }
1863 1943  
1864 1944 isPrinting.value = true
  1945 + printProgressPercent.value = 0
  1946 + lastShownPrintPct = -999
1865 1947 startPrintRunDiagnostics()
  1948 + startPrintDiagPersistLoop()
  1949 + void logLabelEditorFontPackDiagnostics()
1866 1950 const printJobId = createPrintJobId()
1867 1951 let watchdog: ReturnType<typeof setTimeout> | null = null
1868 1952 let globalWatchdog: ReturnType<typeof setTimeout> | null = null
... ... @@ -1882,7 +1966,8 @@ const handlePrint = async () =&gt; {
1882 1966 }
1883 1967 try {
1884 1968 lastShownPrintPct = -999
1885   - uni.showLoading({ title: 'Rendering...', mask: true })
  1969 + printProgressPercent.value = 1
  1970 + showPrintProgress(1)
1886 1971 /** Print base time: Prep / Use By share this click timestamp. */
1887 1972 const printBaseTime = new Date()
1888 1973 const mergedForPrint = computeMergedPreviewTemplate(printBaseTime)
... ... @@ -2059,8 +2144,7 @@ const handlePrint = async () =&gt; {
2059 2144 route: printRoute,
2060 2145 stage: printStage,
2061 2146 })
2062   - /** ???? + native-plugin?JSON ??printTemplate??????????????*/
2063   - uni.showLoading({ title: 'Printing...', mask: true })
  2147 + showPrintProgress(5)
2064 2148 watchdog = setTimeout(() => {
2065 2149 timeoutHandledByWatchdog = true
2066 2150 try { uni.hideLoading() } catch (_) {}
... ... @@ -2594,6 +2678,7 @@ const handlePrint = async () =&gt; {
2594 2678 icon: printLogSyncFailed ? 'none' : 'success',
2595 2679 duration: printLogSyncFailed ? 2800 : 2000,
2596 2680 })
  2681 + refreshGlobalAlertTimerMonitor()
2597 2682 if (ENABLE_AUTO_NATIVE_DEBUG_MODAL && !printResultShown && shouldShowNativeFastDebugModal()) {
2598 2683 setTimeout(() => {
2599 2684 void showNativeFastPrinterDebugModal({ title: 'SDK print debug' })
... ... @@ -2605,7 +2690,7 @@ const handlePrint = async () =&gt; {
2605 2690 uni.hideLoading()
2606 2691 const msg = e?.message ? String(e.message) : 'Print failed'
2607 2692 /** withTimeout ??????????????watchdog ????????? */
2608   - if (msg.includes('PRINT_TIMEOUT')) {
  2693 + if (msg.includes('PRINT_TIMEOUT') || msg.includes('PRINT_STAGE_TIMEOUT')) {
2609 2694 closeClassicBluetoothAfterInterruptedPrint('timeout')
2610 2695 console.warn(
2611 2696 '[preview] print job timeout (promise)',
... ... @@ -2622,9 +2707,11 @@ const handlePrint = async () =&gt; {
2622 2707 await showPrintResultOnce()
2623 2708 } else {
2624 2709 uni.showToast({
2625   - title: 'Printing is taking longer, please wait...',
  2710 + title: msg.includes('PRINT_STAGE_TIMEOUT')
  2711 + ? 'Print stuck — Logcat: [print-diag]'
  2712 + : 'Printing is taking longer, please wait...',
2626 2713 icon: 'none',
2627   - duration: 2500,
  2714 + duration: 3200,
2628 2715 })
2629 2716 }
2630 2717 return
... ... @@ -2648,7 +2735,7 @@ const handlePrint = async () =&gt; {
2648 2735 } else {
2649 2736 uni.showModal({
2650 2737 title: 'Print Failed',
2651   - content: `${msg}\n\n${buildPrintDebugText({
  2738 + content: `${msg}\n\nLogcat / HBuilderX 搜 [print-diag],指纹 ${PRINT_BUILD_FINGERPRINT}\n\n${buildPrintDebugText({
2652 2739 stage: printStage,
2653 2740 route: printRoute,
2654 2741 jobId: printJobId,
... ... @@ -2664,6 +2751,7 @@ const handlePrint = async () =&gt; {
2664 2751 })
2665 2752 }
2666 2753 } finally {
  2754 + stopPrintDiagPersistLoop()
2667 2755 persistPrintRunDiagnostics()
2668 2756 if (!isPrintJobActive(printJobId)) return
2669 2757 try {
... ... @@ -3153,6 +3241,88 @@ const handlePrint = async () =&gt; {
3153 3241 white-space: nowrap;
3154 3242 }
3155 3243  
  3244 +.print-progress-overlay {
  3245 + position: fixed;
  3246 + inset: 0;
  3247 + z-index: 1100;
  3248 + display: flex;
  3249 + align-items: center;
  3250 + justify-content: center;
  3251 + background: rgba(0, 0, 0, 0.28);
  3252 + /* 遮罩不拦截;卡片与按钮自行接收点击 */
  3253 + pointer-events: none;
  3254 +}
  3255 +
  3256 +.print-progress-card {
  3257 + pointer-events: auto;
  3258 + min-width: 320rpx;
  3259 + padding: 36rpx 40rpx;
  3260 + border-radius: 20rpx;
  3261 + background: rgba(17, 24, 39, 0.92);
  3262 + display: flex;
  3263 + flex-direction: column;
  3264 + align-items: center;
  3265 + gap: 16rpx;
  3266 +}
  3267 +
  3268 +.print-progress-log-btn {
  3269 + margin-top: 8rpx;
  3270 + padding: 14rpx 28rpx;
  3271 + border-radius: 999rpx;
  3272 + background: #2563eb;
  3273 + pointer-events: auto;
  3274 +}
  3275 +
  3276 +.print-progress-log-btn-text {
  3277 + color: #fff;
  3278 + font-size: 26rpx;
  3279 + font-weight: 600;
  3280 +}
  3281 +
  3282 +.print-progress-spinner {
  3283 + width: 48rpx;
  3284 + height: 48rpx;
  3285 + border-radius: 50%;
  3286 + border: 4rpx solid rgba(255, 255, 255, 0.25);
  3287 + border-top-color: #fff;
  3288 + animation: print-spin 0.8s linear infinite;
  3289 +}
  3290 +
  3291 +@keyframes print-spin {
  3292 + to {
  3293 + transform: rotate(360deg);
  3294 + }
  3295 +}
  3296 +
  3297 +.print-progress-text {
  3298 + color: #fff;
  3299 + font-size: 28rpx;
  3300 + font-weight: 600;
  3301 +}
  3302 +
  3303 +.print-progress-hint {
  3304 + color: rgba(255, 255, 255, 0.55);
  3305 + font-size: 20rpx;
  3306 +}
  3307 +
  3308 +.print-diag-log-btn {
  3309 + position: fixed;
  3310 + right: 32rpx;
  3311 + bottom: calc(env(safe-area-inset-bottom, 0px) + 200rpx);
  3312 + z-index: 12000;
  3313 + padding: 16rpx 28rpx;
  3314 + border-radius: 999rpx;
  3315 + background: rgba(17, 24, 39, 0.92);
  3316 + box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.22);
  3317 + pointer-events: auto;
  3318 +}
  3319 +
  3320 +.print-diag-log-text {
  3321 + color: #fff;
  3322 + font-size: 26rpx;
  3323 + font-weight: 600;
  3324 +}
  3325 +
3156 3326 .bottom-bar {
3157 3327 position: fixed;
3158 3328 bottom: 0;
... ...
泰额版/Food Labeling Management App UniApp/src/pages/login/login.vue
... ... @@ -2,7 +2,9 @@
2 2 <view class="login-page">
3 3 <view class="header-hero" :style="{ paddingTop: (statusBarHeight + 16) + 'px' }">
4 4 <view class="logo-section">
5   - <image class="login-logo" src="/static/logo_us.png" mode="aspectFit" />
  5 + <view class="login-logo-box">
  6 + <image class="login-logo" src="/static/logo_us.png" mode="widthFix" />
  7 + </view>
6 8 <text class="hero-sub">{{ t('login.employeePortal') }}</text>
7 9 </view>
8 10 </view>
... ... @@ -414,13 +416,22 @@ const handleLogin = async () =&gt; {
414 416 align-items: center;
415 417 }
416 418  
417   -.login-logo {
418   - width: 360rpx;
419   - height: 120rpx;
  419 +.login-logo-box {
  420 + width: 520rpx;
  421 + max-width: 100%;
420 422 margin-bottom: 12rpx;
421   - background: rgba(255, 255, 255, 0.92);
  423 + background: rgba(255, 255, 255, 0.96);
422 424 border-radius: 16rpx;
423   - padding: 16rpx;
  425 + padding: 12rpx 16rpx;
  426 + box-sizing: border-box;
  427 + display: flex;
  428 + align-items: center;
  429 + justify-content: center;
  430 +}
  431 +
  432 +.login-logo {
  433 + width: 100%;
  434 + display: block;
424 435 }
425 436  
426 437 .hero-sub {
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/alerts.vue
1 1 <template>
2 2 <view class="page">
3 3 <view class="header">
4   - <view class="header-top">
5   - <view class="menu-button" @click="isMenuOpen = true">
6   - <AppIcon name="menu" size="sm" color="primary" />
7   - </view>
8   - <view class="header-text">
9   - <text class="title">{{ t('alerts.title') }}</text>
10   - <text class="subtitle">{{ storeName || t('alerts.currentStore') }}</text>
11   - </view>
12   - <view class="refresh-button" @click="refresh">
13   - <AppIcon name="refresh" size="sm" color="primary" />
  4 + <view class="status-bar" :style="{ height: statusBarPad + 'px' }" />
  5 + <view class="header-inner">
  6 + <view class="header-top">
  7 + <view class="menu-button" @click="isMenuOpen = true">
  8 + <AppIcon name="menu" size="sm" color="primary" />
  9 + </view>
  10 + <view class="header-text">
  11 + <text class="title">{{ t('alerts.title') }}</text>
  12 + <text class="subtitle">{{ storeName || t('alerts.currentStore') }}</text>
  13 + </view>
  14 + <view class="refresh-button" @click="refresh">
  15 + <AppIcon name="refresh" size="sm" color="primary" />
  16 + </view>
14 17 </view>
15   - </view>
16 18  
17   - <view class="summary-row">
18   - <view class="summary-card">
19   - <text class="summary-value">{{ runningCount }}</text>
20   - <text class="summary-label">{{ t('alerts.running') }}</text>
21   - </view>
22   - <view class="summary-card danger">
23   - <text class="summary-value">{{ expiredCount }}</text>
24   - <text class="summary-label">{{ t('alerts.expired') }}</text>
  19 + <view class="summary-row">
  20 + <view class="summary-card">
  21 + <text class="summary-value">{{ runningCount }}</text>
  22 + <text class="summary-label">{{ t('alerts.running') }}</text>
  23 + </view>
  24 + <view class="summary-card danger">
  25 + <text class="summary-value">{{ expiredCount }}</text>
  26 + <text class="summary-label">{{ t('alerts.expired') }}</text>
  27 + </view>
  28 + <view class="summary-card">
  29 + <text class="summary-value">{{ totalCount }}</text>
  30 + <text class="summary-label">{{ t('alerts.total') }}</text>
  31 + </view>
25 32 </view>
26   - <view class="summary-card">
27   - <text class="summary-value">{{ totalCount }}</text>
28   - <text class="summary-label">{{ t('alerts.total') }}</text>
  33 +
  34 + <view class="add-timer-btn" @click="openAddTimer">
  35 + <AppIcon name="plus" size="sm" color="white" />
  36 + <text class="add-timer-btn-text">{{ t('alerts.addTimer') }}</text>
29 37 </view>
30 38 </view>
31 39 </view>
... ... @@ -41,14 +49,11 @@
41 49 <view v-if="loading && !items.length" class="state">
42 50 <text class="state-text">{{ t('alerts.loading') }}</text>
43 51 </view>
44   - <view v-else-if="!locationId" class="state">
45   - <text class="state-text">{{ t('alerts.selectStore') }}</text>
46   - </view>
47 52 <view v-else-if="!items.length" class="state">
48 53 <text class="state-text">{{ t('alerts.empty') }}</text>
49 54 </view>
50 55  
51   - <view v-else class="timer-list">
  56 + <view v-else class="timer-grid">
52 57 <view
53 58 v-for="timer in items"
54 59 :key="timer.id"
... ... @@ -56,68 +61,110 @@
56 61 :class="{ expired: isExpired(timer) }"
57 62 >
58 63 <view class="card-head">
59   - <view class="timer-icon" :class="{ expired: isExpired(timer) }">
60   - <AppIcon name="clock" size="md" :color="isExpired(timer) ? 'red' : 'blue'" />
61   - </view>
62   - <view class="timer-title-wrap">
63   - <text class="timer-title">{{ getTimerTitle(timer) }}</text>
64   - <text class="timer-subtitle">{{ timer.subtitle || formatExpiresAt(timer.expiresAt) }}</text>
65   - </view>
66   - <text class="status-pill" :class="{ expired: isExpired(timer) }">
67   - {{ isExpired(timer) ? t('alerts.expired') : t('alerts.running') }}
68   - </text>
  64 + <text class="timer-title">{{ getTimerTitle(timer) }}</text>
  65 + <text v-if="timer.locationName" class="timer-loc">{{ timer.locationName }}</text>
  66 + <text class="timer-expire">{{ displayExpiresAt(timer) }}</text>
69 67 </view>
70 68  
71   - <view class="timer-body">
72   - <view class="time-block">
73   - <text class="time-value" :class="{ expired: isExpired(timer) }">
74   - {{ formatDuration(timer.remainingTime) }}
75   - </text>
76   - <text class="time-label">{{ t('alerts.remaining') }}</text>
77   - </view>
78   - <view class="progress-track">
  69 + <view class="ring-wrap">
  70 + <view class="ring">
  71 + <view class="ring-track" />
79 72 <view
80   - class="progress-fill"
  73 + class="ring-progress"
81 74 :class="{ expired: isExpired(timer) }"
82   - :style="{ width: progressPercent(timer) + '%' }"
  75 + :style="ringStyle(timer)"
83 76 />
  77 + <view class="ring-hole" />
  78 + <view class="ring-center">
  79 + <text class="time-value" :class="{ expired: isExpired(timer) }">
  80 + {{ isExpired(timer) ? t('alerts.expired') : formatDuration(timer.remainingTime) }}
  81 + </text>
  82 + <text v-if="!isExpired(timer)" class="time-label">
  83 + {{ t('alerts.remaining') }}
  84 + </text>
  85 + </view>
84 86 </view>
85 87 </view>
86 88  
87   - <view class="meta-list">
88   - <view class="meta-row">
89   - <text class="meta-label">{{ t('alerts.product') }}</text>
90   - <text class="meta-value">{{ timer.productName || '-' }}</text>
  89 + <view class="card-foot">
  90 + <view class="foot-slot foot-left">
  91 + <view class="foot-pin">
  92 + <AppIcon name="pin" size="sm" color="blue" />
  93 + </view>
91 94 </view>
92   - <view class="meta-row">
93   - <text class="meta-label">{{ t('alerts.expiresAt') }}</text>
94   - <text class="meta-value">{{ formatExpiresAt(timer.expiresAt) }}</text>
  95 + <view class="foot-slot foot-center">
  96 + <view class="foot-badge">
  97 + <AppIcon name="coffee" size="sm" color="gray" />
  98 + </view>
95 99 </view>
96   - <view class="meta-row">
97   - <text class="meta-label">{{ t('alerts.printedAt') }}</text>
98   - <text class="meta-value">{{ formatDateTime(timer.printedAt) }}</text>
  100 + <view class="foot-slot foot-right">
  101 + <view
  102 + class="delete-fab"
  103 + :class="{ disabled: deletingId === timer.id }"
  104 + @click.stop="confirmDelete(timer)"
  105 + >
  106 + <text class="delete-fab-x">×</text>
  107 + </view>
99 108 </view>
100 109 </view>
101   -
102   - <view class="card-actions">
103   - <button
104   - class="delete-btn"
105   - :disabled="deletingId === timer.id"
106   - @click="confirmDelete(timer)"
107   - >
108   - {{ deletingId === timer.id ? t('alerts.deleting') : t('alerts.delete') }}
109   - </button>
110   - </view>
111 110 </view>
  111 + </view>
  112 +
  113 + <view v-if="loadingMore" class="load-more">
  114 + <text class="load-more-text">{{ t('alerts.loadingMore') }}</text>
  115 + </view>
  116 + <view v-else-if="!hasMore && items.length" class="load-more">
  117 + <text class="load-more-text">{{ t('alerts.endOfList') }}</text>
  118 + </view>
  119 + </scroll-view>
112 120  
113   - <view v-if="loadingMore" class="load-more">
114   - <text class="load-more-text">{{ t('alerts.loadingMore') }}</text>
  121 + <view v-if="showAddModal" class="add-timer-overlay" @click="closeAddTimer">
  122 + <view class="add-timer-dialog" @click.stop>
  123 + <view class="add-timer-dialog-title">{{ t('alerts.addTimerTitle') }}</view>
  124 + <view class="add-timer-dialog-desc">{{ t('alerts.addTimerHint') }}</view>
  125 +
  126 + <view v-if="templateLoading" class="add-timer-state">
  127 + <text class="add-timer-state-text">{{ t('alerts.addTimerLoading') }}</text>
115 128 </view>
116   - <view v-else-if="!hasMore && items.length" class="load-more">
117   - <text class="load-more-text">{{ t('alerts.endOfList') }}</text>
  129 + <view v-else-if="!templateOptions.length" class="add-timer-state">
  130 + <text class="add-timer-state-text">{{ t('alerts.addTimerEmpty') }}</text>
  131 + </view>
  132 + <scroll-view v-else class="template-list" scroll-y>
  133 + <view
  134 + v-for="opt in templateOptions"
  135 + :key="opt.id"
  136 + class="template-item"
  137 + :class="{ selected: selectedTemplateId === opt.id }"
  138 + @click="selectedTemplateId = opt.id"
  139 + >
  140 + <view class="template-info">
  141 + <view class="template-name">{{ opt.templateName }}</view>
  142 + <view class="template-duration">
  143 + {{ t('alerts.durationLabel') }}: {{ formatTemplateDuration(opt) }}
  144 + </view>
  145 + </view>
  146 + <view v-if="selectedTemplateId === opt.id" class="template-check">
  147 + <AppIcon name="check" size="sm" color="white" />
  148 + </view>
  149 + </view>
  150 + </scroll-view>
  151 +
  152 + <view class="add-timer-actions">
  153 + <view class="btn-cancel" @click="closeAddTimer">
  154 + <text class="btn-cancel-text">{{ t('common.cancel') }}</text>
  155 + </view>
  156 + <view
  157 + class="btn-confirm"
  158 + :class="{ disabled: addingTimer || !selectedTemplateId }"
  159 + @click="confirmAddTimer"
  160 + >
  161 + <text class="btn-confirm-text">
  162 + {{ addingTimer ? t('common.loading') : t('alerts.addTimerConfirm') }}
  163 + </text>
  164 + </view>
118 165 </view>
119 166 </view>
120   - </scroll-view>
  167 + </view>
121 168  
122 169 <SideMenu v-model="isMenuOpen" />
123 170 </view>
... ... @@ -129,18 +176,33 @@ import { onShow } from &#39;@dcloudio/uni-app&#39;
129 176 import { useI18n } from 'vue-i18n'
130 177 import AppIcon from '../../components/AppIcon.vue'
131 178 import SideMenu from '../../components/SideMenu.vue'
132   -import { deleteUsAppAlertTimer, fetchUsAppAlertTimerList } from '../../services/usAppAlertTimer'
  179 +import { fetchUsAppAlertTemplateOptions } from '../../services/usAppAlertTemplate'
  180 +import {
  181 + createUsAppAlertTimerFromTemplate,
  182 + deleteUsAppAlertTimer,
  183 + fetchUsAppAlertTimerList,
  184 +} from '../../services/usAppAlertTimer'
  185 +import type { UsAppAlertTemplateOptionDto } from '../../types/usAppAlertTemplate'
133 186 import type { UsAppAlertTimerDto } from '../../types/usAppAlertTimer'
  187 +import { refreshGlobalAlertTimerMonitor } from '../../utils/globalAlertTimerMonitor'
  188 +import { getStatusBarHeight } from '../../utils/statusBar'
134 189 import { getCurrentStoreId, getCurrentStoreName } from '../../utils/stores'
135 190 import { isUsAppSessionExpiredError } from '../../utils/usAppApiRequest'
136 191  
137 192 const { t } = useI18n()
  193 +/** 状态栏占位:至少留出常见高度,避免部分机型读到 0 仍沉浸覆盖 */
  194 +const statusBarPad = Math.max(getStatusBarHeight(), 24)
138 195 const pageSize = 50
139 196  
140 197 const isMenuOpen = ref(false)
141 198 const loading = ref(false)
142 199 const loadingMore = ref(false)
143 200 const refreshing = ref(false)
  201 +const showAddModal = ref(false)
  202 +const templateLoading = ref(false)
  203 +const addingTimer = ref(false)
  204 +const selectedTemplateId = ref('')
  205 +const templateOptions = ref<UsAppAlertTemplateOptionDto[]>([])
144 206 const deletingId = ref('')
145 207 const pageIndex = ref(1)
146 208 const totalCount = ref(0)
... ... @@ -153,15 +215,26 @@ const hasMore = computed(() =&gt; items.value.length &lt; totalCount.value)
153 215 const runningCount = computed(() => items.value.filter((item) => !isExpired(item)).length)
154 216 const expiredCount = computed(() => items.value.filter((item) => isExpired(item)).length)
155 217  
  218 +function remainingFromExpiresAt(expiresAt?: string | null): number | null {
  219 + const raw = String(expiresAt ?? '').trim()
  220 + if (!raw) return null
  221 + const end = new Date(raw.replace(/-/g, '/')).getTime()
  222 + if (!Number.isFinite(end)) return null
  223 + return Math.max(0, Math.floor((end - Date.now()) / 1000))
  224 +}
  225 +
156 226 function normalizeTimerRuntime(timer: UsAppAlertTimerDto): UsAppAlertTimerDto {
157   - const remainingTime = Math.max(0, Number(timer.remainingTime ?? 0))
  227 + const fromExpires = remainingFromExpiresAt(timer.expiresAt)
  228 + const remainingTime =
  229 + fromExpires != null ? fromExpires : Math.max(0, Number(timer.remainingTime ?? 0))
158 230 return {
159 231 ...timer,
160 232 remainingTime,
161 233 totalTime: Math.max(0, Number(timer.totalTime ?? 0)),
162   - status: String(timer.status || '').toLowerCase() === 'expired' || remainingTime <= 0
163   - ? 'expired'
164   - : 'running',
  234 + status:
  235 + String(timer.status || '').toLowerCase() === 'expired' || remainingTime <= 0
  236 + ? 'expired'
  237 + : 'running',
165 238 }
166 239 }
167 240  
... ... @@ -170,7 +243,7 @@ function isExpired(timer: UsAppAlertTimerDto) {
170 243 }
171 244  
172 245 function getTimerTitle(timer: UsAppAlertTimerDto) {
173   - return timer.title || timer.productName || timer.labelCode || timer.id
  246 + return timer.labelName || timer.title || timer.productName || timer.labelCode || timer.id
174 247 }
175 248  
176 249 function formatDuration(seconds: number) {
... ... @@ -187,7 +260,7 @@ function formatDuration(seconds: number) {
187 260  
188 261 function formatDateTime(value?: string | null) {
189 262 if (!value) return '-'
190   - const d = new Date(value)
  263 + const d = new Date(String(value).replace(/-/g, '/'))
191 264 if (Number.isNaN(d.getTime())) return String(value)
192 265 const y = d.getFullYear()
193 266 const m = String(d.getMonth() + 1).padStart(2, '0')
... ... @@ -197,16 +270,27 @@ function formatDateTime(value?: string | null) {
197 270 return `${y}-${m}-${day} ${hh}:${mm}`
198 271 }
199 272  
200   -function formatExpiresAt(value?: string | null) {
201   - return formatDateTime(value)
  273 +function displayExpiresAt(timer: UsAppAlertTimerDto) {
  274 + const formatted = String(timer.formattedExpiresAt ?? '').trim()
  275 + if (formatted) return formatted
  276 + return formatDateTime(timer.expiresAt)
202 277 }
203 278  
204   -function progressPercent(timer: UsAppAlertTimerDto) {
  279 +/** 已消耗比例 0~100,用于圆形进度(与平台端一致) */
  280 +function elapsedPercent(timer: UsAppAlertTimerDto) {
205 281 const total = Number(timer.totalTime || 0)
206 282 const remaining = Number(timer.remainingTime || 0)
207   - if (total <= 0) return isExpired(timer) ? 100 : 0
208   - const pct = ((total - Math.max(0, remaining)) / total) * 100
209   - return Math.max(0, Math.min(100, Math.round(pct)))
  283 + if (isExpired(timer)) return 100
  284 + if (total <= 0) return 0
  285 + return Math.max(0, Math.min(100, ((total - Math.max(0, remaining)) / total) * 100))
  286 +}
  287 +
  288 +function ringStyle(timer: UsAppAlertTimerDto) {
  289 + const pct = elapsedPercent(timer)
  290 + const color = isExpired(timer) ? '#ef4444' : '#3b82f6'
  291 + return {
  292 + background: `conic-gradient(${color} ${pct * 3.6}deg, transparent 0deg)`,
  293 + }
210 294 }
211 295  
212 296 function refreshStore() {
... ... @@ -215,11 +299,6 @@ function refreshStore() {
215 299 }
216 300  
217 301 async function loadPage(reset = false) {
218   - if (!locationId.value) {
219   - items.value = []
220   - totalCount.value = 0
221   - return
222   - }
223 302 if (reset) {
224 303 pageIndex.value = 1
225 304 }
... ... @@ -227,7 +306,7 @@ async function loadPage(reset = false) {
227 306 loading.value = reset || !items.value.length
228 307 try {
229 308 const res = await fetchUsAppAlertTimerList({
230   - locationId: locationId.value,
  309 + locationId: locationId.value || '',
231 310 skipCount: currentPage,
232 311 maxResultCount: pageSize,
233 312 })
... ... @@ -258,11 +337,92 @@ function loadMore() {
258 337 void loadPage(false)
259 338 }
260 339  
  340 +function formatTemplateDuration(opt: UsAppAlertTemplateOptionDto) {
  341 + const unit = String(opt.durationUnit || '').trim()
  342 + const value = Number(opt.durationValue || 0)
  343 + if (!unit || value < 1) return '—'
  344 + const map: Record<string, string> = {
  345 + Year: t('alerts.unitYear'),
  346 + Month: t('alerts.unitMonth'),
  347 + Day: t('alerts.unitDay'),
  348 + Hour: t('alerts.unitHour'),
  349 + Minute: t('alerts.unitMinute'),
  350 + Second: t('alerts.unitSecond'),
  351 + Combined: t('alerts.unitCombined'),
  352 + }
  353 + const label = map[unit] || unit
  354 + if (unit === 'Combined') return `${value}${t('alerts.unitSecond')}`
  355 + return `${value} ${label}`
  356 +}
  357 +
  358 +async function openAddTimer() {
  359 + if (!locationId.value) {
  360 + uni.showToast({ title: t('alerts.selectStore'), icon: 'none' })
  361 + return
  362 + }
  363 + showAddModal.value = true
  364 + selectedTemplateId.value = ''
  365 + templateLoading.value = true
  366 + try {
  367 + templateOptions.value = await fetchUsAppAlertTemplateOptions()
  368 + } catch (e: unknown) {
  369 + templateOptions.value = []
  370 + if (!isUsAppSessionExpiredError(e)) {
  371 + const msg = e instanceof Error ? e.message : String(e)
  372 + uni.showToast({ title: msg || t('alerts.loadFailed'), icon: 'none' })
  373 + }
  374 + } finally {
  375 + templateLoading.value = false
  376 + }
  377 +}
  378 +
  379 +function closeAddTimer() {
  380 + if (addingTimer.value) return
  381 + showAddModal.value = false
  382 + selectedTemplateId.value = ''
  383 +}
  384 +
  385 +async function confirmAddTimer() {
  386 + if (addingTimer.value) return
  387 + const tid = selectedTemplateId.value.trim()
  388 + if (!tid) {
  389 + uni.showToast({ title: t('alerts.addTimerNoTemplate'), icon: 'none' })
  390 + return
  391 + }
  392 + addingTimer.value = true
  393 + try {
  394 + refreshStore()
  395 + const created = await createUsAppAlertTimerFromTemplate({
  396 + alertTemplateId: tid,
  397 + locationId: locationId.value || '',
  398 + })
  399 + // 先合入本次返回,再关弹窗并重拉列表,保证新增后立刻看到
  400 + const row = normalizeTimerRuntime(created)
  401 + if (row.id) {
  402 + items.value = [row, ...items.value.filter((item) => item.id !== row.id)]
  403 + totalCount.value = Math.max(Number(totalCount.value || 0) + 1, items.value.length)
  404 + }
  405 + showAddModal.value = false
  406 + selectedTemplateId.value = ''
  407 + uni.showToast({ title: t('alerts.addTimerSuccess'), icon: 'success' })
  408 + refreshGlobalAlertTimerMonitor()
  409 + await loadPage(true)
  410 + } catch (e: unknown) {
  411 + if (!isUsAppSessionExpiredError(e)) {
  412 + const msg = e instanceof Error ? e.message : String(e)
  413 + uni.showToast({ title: msg || t('alerts.addTimerFailed'), icon: 'none' })
  414 + }
  415 + } finally {
  416 + addingTimer.value = false
  417 + }
  418 +}
  419 +
261 420 function confirmDelete(timer: UsAppAlertTimerDto) {
  421 + if (deletingId.value) return
262 422 uni.showModal({
263 423 title: t('alerts.deleteTitle'),
264   - content: t('alerts.deleteConfirm', { name: getTimerTitle(timer) }),
265   - confirmText: t('alerts.delete'),
  424 + content: t('alerts.deleteConfirm'),
  425 + confirmText: t('common.confirm'),
266 426 cancelText: t('common.cancel'),
267 427 confirmColor: '#dc2626',
268 428 success: (res) => {
... ... @@ -292,13 +452,7 @@ async function deleteTimer(timer: UsAppAlertTimerDto) {
292 452 function startTicker() {
293 453 if (ticker) return
294 454 ticker = setInterval(() => {
295   - items.value = items.value.map((item) => {
296   - if (isExpired(item)) return normalizeTimerRuntime(item)
297   - return normalizeTimerRuntime({
298   - ...item,
299   - remainingTime: Math.max(0, Number(item.remainingTime || 0) - 1),
300   - })
301   - })
  455 + items.value = items.value.map((item) => normalizeTimerRuntime(item))
302 456 }, 1000)
303 457 }
304 458  
... ... @@ -316,7 +470,7 @@ onMounted(() =&gt; {
316 470 onShow(() => {
317 471 const oldLocation = locationId.value
318 472 refreshStore()
319   - if (locationId.value && locationId.value !== oldLocation) {
  473 + if (locationId.value !== oldLocation) {
320 474 void loadPage(true)
321 475 }
322 476 })
... ... @@ -328,19 +482,37 @@ onBeforeUnmount(() =&gt; {
328 482  
329 483 <style scoped>
330 484 .page {
331   - min-height: 100vh;
  485 + position: relative;
  486 + height: 100vh;
332 487 background: #f3f4f6;
  488 + display: flex;
  489 + flex-direction: column;
  490 + overflow: hidden;
  491 + box-sizing: border-box;
333 492 }
334 493  
335 494 .header {
  495 + flex-shrink: 0;
336 496 background: #fff;
337 497 border-bottom: 1rpx solid #e5e7eb;
338   - padding: 48rpx;
  498 + box-sizing: border-box;
  499 + z-index: 10;
  500 +}
  501 +
  502 +.status-bar {
  503 + width: 100%;
  504 + flex-shrink: 0;
  505 +}
  506 +
  507 +.header-inner {
  508 + padding: 16rpx 32rpx 28rpx;
  509 + box-sizing: border-box;
339 510 }
340 511  
341 512 .header-top {
342 513 display: flex;
343 514 align-items: center;
  515 + justify-content: space-between;
344 516 gap: 16rpx;
345 517 }
346 518  
... ... @@ -358,6 +530,7 @@ onBeforeUnmount(() =&gt; {
358 530 .header-text {
359 531 flex: 1;
360 532 min-width: 0;
  533 + text-align: center;
361 534 }
362 535  
363 536 .title {
... ... @@ -377,14 +550,14 @@ onBeforeUnmount(() =&gt; {
377 550 .summary-row {
378 551 display: flex;
379 552 gap: 16rpx;
380   - margin-top: 32rpx;
  553 + margin-top: 28rpx;
381 554 }
382 555  
383 556 .summary-card {
384 557 flex: 1;
385 558 border-radius: 18rpx;
386 559 background: #eff6ff;
387   - padding: 18rpx 12rpx;
  560 + padding: 16rpx 10rpx;
388 561 text-align: center;
389 562 }
390 563  
... ... @@ -394,7 +567,7 @@ onBeforeUnmount(() =&gt; {
394 567  
395 568 .summary-value {
396 569 display: block;
397   - font-size: 40rpx;
  570 + font-size: 36rpx;
398 571 font-weight: 800;
399 572 color: #1f3a8a;
400 573 }
... ... @@ -406,13 +579,32 @@ onBeforeUnmount(() =&gt; {
406 579 .summary-label {
407 580 display: block;
408 581 margin-top: 4rpx;
409   - font-size: 24rpx;
  582 + font-size: 22rpx;
410 583 color: #6b7280;
411 584 }
412 585  
  586 +.add-timer-btn {
  587 + margin-top: 24rpx;
  588 + height: 80rpx;
  589 + border-radius: 16rpx;
  590 + background: var(--theme-primary, #1f3a8a);
  591 + display: flex;
  592 + align-items: center;
  593 + justify-content: center;
  594 + gap: 10rpx;
  595 +}
  596 +
  597 +.add-timer-btn-text {
  598 + font-size: 28rpx;
  599 + font-weight: 600;
  600 + color: #fff;
  601 +}
  602 +
413 603 .content {
414   - height: calc(100vh - 258rpx);
415   - padding: 32rpx;
  604 + flex: 1;
  605 + height: 0;
  606 + min-height: 0;
  607 + padding: 24rpx;
416 608 box-sizing: border-box;
417 609 }
418 610  
... ... @@ -426,180 +618,369 @@ onBeforeUnmount(() =&gt; {
426 618 color: #6b7280;
427 619 }
428 620  
429   -.timer-list {
430   - padding-bottom: 40rpx;
431   -}
432   -
433   -.timer-card {
434   - background: #fff;
435   - border-radius: 22rpx;
436   - padding: 28rpx;
437   - margin-bottom: 24rpx;
438   - border: 1rpx solid #e5e7eb;
439   - box-shadow: 0 4rpx 14rpx rgba(15, 23, 42, 0.06);
440   -}
441   -
442   -.timer-card.expired {
443   - border-color: #fecaca;
444   - background: #fff7f7;
445   -}
446   -
447   -.card-head {
  621 +.timer-grid {
448 622 display: flex;
449   - align-items: center;
450   - gap: 18rpx;
  623 + flex-wrap: wrap;
  624 + gap: 20rpx;
  625 + padding-bottom: 24rpx;
451 626 }
452 627  
453   -.timer-icon {
454   - width: 76rpx;
455   - height: 76rpx;
456   - border-radius: 18rpx;
457   - background: #dbeafe;
  628 +.timer-card {
  629 + position: relative;
  630 + width: calc((100% - 20rpx) / 2);
  631 + box-sizing: border-box;
  632 + background: #e5e7eb;
  633 + border-radius: 20rpx;
  634 + padding: 22rpx 16rpx 20rpx;
458 635 display: flex;
  636 + flex-direction: column;
459 637 align-items: center;
460   - justify-content: center;
  638 + min-height: 520rpx;
  639 + border: 1rpx solid #d1d5db;
461 640 }
462 641  
463   -.timer-icon.expired {
  642 +.timer-card.expired {
464 643 background: #fee2e2;
  644 + border-color: #fecaca;
465 645 }
466 646  
467   -.timer-title-wrap {
468   - flex: 1;
469   - min-width: 0;
  647 +.card-head {
  648 + width: 100%;
  649 + text-align: center;
  650 + margin-bottom: 12rpx;
470 651 }
471 652  
472 653 .timer-title {
473 654 display: block;
474   - font-size: 32rpx;
475   - font-weight: 700;
476   - color: #111827;
  655 + font-size: 30rpx;
  656 + font-weight: 600;
  657 + color: #1f2937;
477 658 overflow: hidden;
478 659 text-overflow: ellipsis;
479 660 white-space: nowrap;
480 661 }
481 662  
482   -.timer-subtitle {
  663 +.timer-loc {
483 664 display: block;
484 665 margin-top: 6rpx;
485   - font-size: 24rpx;
  666 + font-size: 22rpx;
  667 + color: #4b5563;
  668 + overflow: hidden;
  669 + text-overflow: ellipsis;
  670 + white-space: nowrap;
  671 +}
  672 +
  673 +.timer-expire {
  674 + display: block;
  675 + margin-top: 4rpx;
  676 + font-size: 20rpx;
486 677 color: #6b7280;
  678 + overflow: hidden;
  679 + text-overflow: ellipsis;
  680 + white-space: nowrap;
487 681 }
488 682  
489   -.status-pill {
490   - border-radius: 999rpx;
491   - background: #dcfce7;
492   - color: #15803d;
493   - padding: 8rpx 16rpx;
494   - font-size: 24rpx;
495   - font-weight: 700;
  683 +.ring-wrap {
  684 + flex: 1;
  685 + display: flex;
  686 + align-items: center;
  687 + justify-content: center;
  688 + padding: 12rpx 0;
496 689 }
497 690  
498   -.status-pill.expired {
499   - background: #fee2e2;
500   - color: #dc2626;
  691 +.ring {
  692 + position: relative;
  693 + width: 220rpx;
  694 + height: 220rpx;
501 695 }
502 696  
503   -.timer-body {
504   - margin-top: 30rpx;
  697 +.ring-track {
  698 + position: absolute;
  699 + inset: 0;
  700 + border-radius: 50%;
  701 + background: #fff;
505 702 }
506 703  
507   -.time-block {
508   - text-align: center;
  704 +.ring-progress {
  705 + position: absolute;
  706 + inset: 0;
  707 + border-radius: 50%;
  708 +}
  709 +
  710 +.ring-hole {
  711 + position: absolute;
  712 + inset: 28rpx;
  713 + border-radius: 50%;
  714 + background: #e5e7eb;
  715 +}
  716 +
  717 +.timer-card.expired .ring-hole {
  718 + background: #fee2e2;
  719 +}
  720 +
  721 +.ring-center {
  722 + position: absolute;
  723 + inset: 0;
  724 + display: flex;
  725 + flex-direction: column;
  726 + align-items: center;
  727 + justify-content: center;
  728 + z-index: 1;
509 729 }
510 730  
511 731 .time-value {
512   - display: block;
513   - font-size: 56rpx;
  732 + font-size: 40rpx;
514 733 font-weight: 800;
515 734 color: #1f2937;
516   - font-family: monospace;
  735 + font-variant-numeric: tabular-nums;
  736 + line-height: 1.1;
517 737 }
518 738  
519 739 .time-value.expired {
520   - color: #dc2626;
  740 + color: #ef4444;
  741 + font-size: 32rpx;
521 742 }
522 743  
523 744 .time-label {
524   - display: block;
525   - margin-top: 4rpx;
526   - font-size: 24rpx;
527   - color: #6b7280;
  745 + margin-top: 6rpx;
  746 + font-size: 20rpx;
  747 + color: #9ca3af;
  748 + text-transform: uppercase;
528 749 }
529 750  
530   -.progress-track {
531   - height: 14rpx;
532   - border-radius: 999rpx;
533   - overflow: hidden;
534   - background: #e5e7eb;
535   - margin-top: 20rpx;
  751 +.time-label.expired {
  752 + color: #f87171;
536 753 }
537 754  
538   -.progress-fill {
539   - height: 100%;
540   - border-radius: 999rpx;
  755 +.card-foot {
  756 + width: 100%;
  757 + display: flex;
  758 + align-items: center;
  759 + justify-content: space-between;
  760 + margin-top: 8rpx;
  761 + padding: 0 4rpx;
  762 +}
  763 +
  764 +.foot-slot {
  765 + flex: 1;
  766 + display: flex;
  767 + align-items: center;
  768 + min-width: 0;
  769 +}
  770 +
  771 +.foot-left {
  772 + justify-content: flex-start;
  773 +}
  774 +
  775 +.foot-center {
  776 + justify-content: center;
  777 +}
  778 +
  779 +.foot-right {
  780 + justify-content: flex-end;
  781 +}
  782 +
  783 +.foot-pin {
  784 + width: 48rpx;
  785 + height: 48rpx;
  786 + display: flex;
  787 + align-items: center;
  788 + justify-content: center;
  789 +}
  790 +
  791 +.foot-badge {
  792 + width: 64rpx;
  793 + height: 64rpx;
  794 + border-radius: 50%;
  795 + border: 2rpx solid #9ca3af;
  796 + display: flex;
  797 + align-items: center;
  798 + justify-content: center;
  799 + background: transparent;
  800 +}
  801 +
  802 +.delete-fab {
  803 + width: 48rpx;
  804 + height: 48rpx;
  805 + border-radius: 50%;
541 806 background: #2563eb;
  807 + display: flex;
  808 + align-items: center;
  809 + justify-content: center;
  810 + box-shadow: 0 4rpx 12rpx rgba(37, 99, 235, 0.35);
  811 +}
  812 +
  813 +.delete-fab.disabled {
  814 + opacity: 0.55;
  815 +}
  816 +
  817 +.delete-fab-x {
  818 + color: #fff;
  819 + font-size: 36rpx;
  820 + line-height: 1;
  821 + font-weight: 600;
  822 + margin-top: -4rpx;
542 823 }
543 824  
544   -.progress-fill.expired {
545   - background: #dc2626;
  825 +.load-more {
  826 + padding: 20rpx 0 48rpx;
  827 + text-align: center;
  828 + width: 100%;
546 829 }
547 830  
548   -.meta-list {
549   - margin-top: 26rpx;
550   - border-top: 1rpx solid #e5e7eb;
551   - padding-top: 18rpx;
  831 +.load-more-text {
  832 + color: #9ca3af;
  833 + font-size: 26rpx;
552 834 }
553 835  
554   -.meta-row {
  836 +/* absolute 相对 .page,避免 flex+overflow 导致 fixed 失效、弹层被挤到页面底部 */
  837 +.add-timer-overlay {
  838 + position: absolute;
  839 + top: 0;
  840 + left: 0;
  841 + right: 0;
  842 + bottom: 0;
  843 + width: 100%;
  844 + height: 100%;
  845 + background: rgba(0, 0, 0, 0.5);
  846 + z-index: 2000;
555 847 display: flex;
556   - gap: 20rpx;
557   - margin-top: 10rpx;
  848 + align-items: center;
  849 + justify-content: center;
  850 + padding: 48rpx;
  851 + box-sizing: border-box;
558 852 }
559 853  
560   -.meta-label {
561   - width: 150rpx;
562   - font-size: 24rpx;
  854 +.add-timer-dialog {
  855 + width: 100%;
  856 + max-width: 640rpx;
  857 + max-height: 80%;
  858 + background: #fff;
  859 + border-radius: 24rpx;
  860 + padding: 36rpx;
  861 + box-sizing: border-box;
  862 + display: flex;
  863 + flex-direction: column;
  864 + box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.18);
  865 +}
  866 +
  867 +.add-timer-dialog-title {
  868 + font-size: 34rpx;
  869 + font-weight: 700;
  870 + color: #111827;
  871 + line-height: 1.3;
  872 + margin-bottom: 8rpx;
  873 +}
  874 +
  875 +.add-timer-dialog-desc {
  876 + font-size: 26rpx;
563 877 color: #6b7280;
  878 + line-height: 1.4;
  879 + margin-bottom: 24rpx;
564 880 }
565 881  
566   -.meta-value {
  882 +.add-timer-state {
  883 + padding: 48rpx 16rpx;
  884 + text-align: center;
  885 +}
  886 +
  887 +.add-timer-state-text {
  888 + font-size: 28rpx;
  889 + color: #6b7280;
  890 +}
  891 +
  892 +.template-list {
  893 + flex: 1;
  894 + max-height: 420rpx;
  895 + margin-bottom: 24rpx;
  896 +}
  897 +
  898 +.template-item {
  899 + display: flex;
  900 + align-items: center;
  901 + gap: 16rpx;
  902 + padding: 24rpx;
  903 + border-radius: 16rpx;
  904 + border: 2rpx solid #e5e7eb;
  905 + margin-bottom: 12rpx;
  906 + background: #fff;
  907 + box-sizing: border-box;
  908 +}
  909 +
  910 +.template-item.selected {
  911 + border-color: var(--theme-primary, #1f3a8a);
  912 + background: var(--theme-primary-light, #e8ecf5);
  913 +}
  914 +
  915 +.template-info {
567 916 flex: 1;
568 917 min-width: 0;
  918 +}
  919 +
  920 +.template-name {
  921 + font-size: 28rpx;
  922 + font-weight: 600;
  923 + color: #111827;
  924 + margin-bottom: 4rpx;
  925 + overflow: hidden;
  926 + text-overflow: ellipsis;
  927 + white-space: nowrap;
  928 +}
  929 +
  930 +.template-duration {
569 931 font-size: 24rpx;
570   - color: #374151;
571   - text-align: right;
  932 + color: #6b7280;
572 933 }
573 934  
574   -.card-actions {
  935 +.template-check {
  936 + width: 44rpx;
  937 + height: 44rpx;
  938 + border-radius: 50%;
  939 + background: var(--theme-primary, #1f3a8a);
575 940 display: flex;
576   - justify-content: flex-end;
577   - margin-top: 24rpx;
  941 + align-items: center;
  942 + justify-content: center;
  943 + flex-shrink: 0;
578 944 }
579 945  
580   -.delete-btn {
581   - min-width: 176rpx;
582   - height: 72rpx;
583   - line-height: 72rpx;
584   - border-radius: 14rpx;
585   - border: none;
586   - background: #fee2e2;
587   - color: #dc2626;
588   - font-size: 28rpx;
589   - font-weight: 700;
  946 +.add-timer-actions {
  947 + display: flex;
  948 + flex-direction: row;
  949 + gap: 16rpx;
  950 + flex-shrink: 0;
590 951 }
591 952  
592   -.delete-btn[disabled] {
593   - opacity: 0.6;
  953 +.btn-cancel,
  954 +.btn-confirm {
  955 + flex: 1;
  956 + height: 84rpx;
  957 + border-radius: 16rpx;
  958 + display: flex;
  959 + align-items: center;
  960 + justify-content: center;
594 961 }
595 962  
596   -.load-more {
597   - padding: 28rpx 0 48rpx;
598   - text-align: center;
  963 +.btn-cancel {
  964 + background: #f3f4f6;
599 965 }
600 966  
601   -.load-more-text {
602   - color: #9ca3af;
603   - font-size: 26rpx;
  967 +.btn-confirm {
  968 + background: var(--theme-primary, #1f3a8a);
  969 +}
  970 +
  971 +.btn-confirm.disabled {
  972 + opacity: 0.45;
  973 +}
  974 +
  975 +.btn-cancel-text {
  976 + font-size: 28rpx;
  977 + color: #374151;
  978 + font-weight: 500;
  979 +}
  980 +
  981 +.btn-confirm-text {
  982 + font-size: 28rpx;
  983 + color: #fff;
  984 + font-weight: 600;
604 985 }
605 986 </style>
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/change-password.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="page-title">{{ t('password.changeTitle') }}</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -98,7 +97,6 @@ import { ref, computed } from &#39;vue&#39;
98 97 import { useI18n } from 'vue-i18n'
99 98 import AppIcon from '../../components/AppIcon.vue'
100 99 import SideMenu from '../../components/SideMenu.vue'
101   -import LocationPicker from '../../components/LocationPicker.vue'
102 100 import { getStatusBarHeight } from '../../utils/statusBar'
103 101 import { usAppChangePassword } from '../../services/usAppAuth'
104 102  
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/label-report.vue
... ... @@ -16,8 +16,6 @@
16 16  
17 17 <text class="page-title">Label Report</text>
18 18  
19   - <LocationPicker />
20   -
21 19 </view>
22 20  
23 21 <view class="top-right" @click="isMenuOpen = true">
... ... @@ -300,8 +298,6 @@ import AppDatePicker from &#39;../../components/AppDatePicker.vue&#39;
300 298  
301 299 import SideMenu from '../../components/SideMenu.vue'
302 300  
303   -import LocationPicker from '../../components/LocationPicker.vue'
304   -
305 301 import { getStatusBarHeight } from '../../utils/statusBar'
306 302  
307 303 import { getCurrentStoreId } from '../../utils/stores'
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/language.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="page-title">{{ t('language.title') }}</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -45,7 +44,6 @@ import { useI18n } from &#39;vue-i18n&#39;
45 44 import { setLocale } from '../../utils/i18n'
46 45 import AppIcon from '../../components/AppIcon.vue'
47 46 import SideMenu from '../../components/SideMenu.vue'
48   -import LocationPicker from '../../components/LocationPicker.vue'
49 47 import { getStatusBarHeight } from '../../utils/statusBar'
50 48  
51 49 const { t, locale } = useI18n()
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/location.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="page-title">{{ t('location.title') }}</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -81,7 +80,7 @@
81 80 </view>
82 81 </view>
83 82  
84   - <view class="switch-btn" @click="showDialog = true">
  83 + <view class="switch-btn" @click="openSwitchStore">
85 84 <AppIcon name="refresh" size="sm" color="primary" />
86 85 <text class="switch-btn-text">{{ t('location.switchStore') }}</text>
87 86 </view>
... ... @@ -132,13 +131,13 @@ import { useI18n } from &#39;vue-i18n&#39;
132 131 import { onShow } from '@dcloudio/uni-app'
133 132 import AppIcon from '../../components/AppIcon.vue'
134 133 import SideMenu from '../../components/SideMenu.vue'
135   -import LocationPicker from '../../components/LocationPicker.vue'
136 134 import { getStatusBarHeight } from '../../utils/statusBar'
137 135 import { getBoundLocations, switchStore, getCurrentStoreId } from '../../utils/stores'
138 136 import { setBoundLocations } from '../../utils/authSession'
139   -import { usAppFetchMyLocations, usAppFetchLocationDetail } from '../../services/usAppAuth'
  137 +import { usAppFetchMyLocations, usAppFetchLocationDetail, usAppFetchMyProfile } from '../../services/usAppAuth'
140 138 import type { UsAppLocationDetailOutputDto } from '../../services/usAppAuth'
141 139 import type { UsAppBoundLocationDto } from '../../types/usAppBound'
  140 +import { isAppAdminUser } from '../../utils/appAdminRole'
142 141  
143 142 const { t } = useI18n()
144 143 const statusBarHeight = getStatusBarHeight()
... ... @@ -147,6 +146,7 @@ const showDialog = ref(false)
147 146 const selectedId = ref(getCurrentStoreId())
148 147 const locationList = ref<UsAppBoundLocationDto[]>([])
149 148 const locationDetail = ref<UsAppLocationDetailOutputDto | null>(null)
  149 +const isAdminUser = ref(false)
150 150 let locationDetailRequestSeq = 0
151 151  
152 152 const stores = computed(() => locationList.value.filter((s) => s.state !== false))
... ... @@ -185,6 +185,11 @@ async function loadPageData() {
185 185 const requestSeq = ++locationDetailRequestSeq
186 186 uni.showLoading({ title: t('common.loading'), mask: true })
187 187 try {
  188 + try {
  189 + isAdminUser.value = isAppAdminUser(await usAppFetchMyProfile())
  190 + } catch {
  191 + isAdminUser.value = false
  192 + }
188 193 const list = await usAppFetchMyLocations()
189 194 setBoundLocations(list)
190 195 locationList.value = list
... ... @@ -227,6 +232,14 @@ const goBack = () =&gt; {
227 232 }
228 233 }
229 234  
  235 +const openSwitchStore = () => {
  236 + if (isAdminUser.value) {
  237 + uni.redirectTo({ url: '/pages/store-select/store-select' })
  238 + return
  239 + }
  240 + showDialog.value = true
  241 +}
  242 +
230 243 const handleSwitch = async () => {
231 244 const cur = (getCurrentStoreId() || '').trim()
232 245 if (selectedId.value === cur) return
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/more.vue
... ... @@ -21,7 +21,7 @@
21 21 </view>
22 22 <AppIcon name="chevronRight" size="sm" color="gray" />
23 23 </view>
24   - <view class="menu-item" @click="navTo('/pages/more/printers')">
  24 + <view class="menu-item" @click="navTo('/pages/labels/bluetooth')">
25 25 <view class="menu-icon gray"><AppIcon name="printer" size="md" color="gray" /></view>
26 26 <view class="menu-content">
27 27 <text class="menu-title">{{ t('more.printers') }}</text>
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/print-detail.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="page-title">Print Detail</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -76,7 +75,6 @@ import { ref, computed } from &#39;vue&#39;
76 75 import { onLoad } from '@dcloudio/uni-app'
77 76 import AppIcon from '../../components/AppIcon.vue'
78 77 import SideMenu from '../../components/SideMenu.vue'
79   -import LocationPicker from '../../components/LocationPicker.vue'
80 78 import { getStatusBarHeight } from '../../utils/statusBar'
81 79 import { getRecordByLabelId } from '../../utils/printLog'
82 80 import chickenLabelImg from '../../static/chicken-lable.png'
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/print-log.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="page-title">{{ t('printLog.title') }}</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -163,7 +162,6 @@ import { onShow } from &#39;@dcloudio/uni-app&#39;
163 162 import AppIcon from '../../components/AppIcon.vue'
164 163 import AppDatePicker from '../../components/AppDatePicker.vue'
165 164 import SideMenu from '../../components/SideMenu.vue'
166   -import LocationPicker from '../../components/LocationPicker.vue'
167 165 import { getStatusBarHeight } from '../../utils/statusBar'
168 166 import { getCurrentStoreId } from '../../utils/stores'
169 167 import {
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/printers.vue
... ... @@ -167,7 +167,13 @@
167 167  
168 168 <script setup lang="ts">
169 169 import { ref, onMounted, onUnmounted, getCurrentInstance, nextTick } from 'vue'
  170 +import { onShow } from '@dcloudio/uni-app'
170 171 import { useI18n } from 'vue-i18n'
  172 +
  173 +/** 与美版一致:完整打印机/缝隙纸设置在 labels/bluetooth */
  174 +onShow(() => {
  175 + uni.redirectTo({ url: '/pages/labels/bluetooth' })
  176 +})
171 177 import AppIcon from '../../components/AppIcon.vue'
172 178 import SideMenu from '../../components/SideMenu.vue'
173 179 import { getDeviceIdentity } from '../../utils/deviceInfo'
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/profile.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="page-title">{{ t('profile.title') }}</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -81,7 +80,6 @@ import { useI18n } from &#39;vue-i18n&#39;
81 80 import { onShow } from '@dcloudio/uni-app'
82 81 import AppIcon from '../../components/AppIcon.vue'
83 82 import SideMenu from '../../components/SideMenu.vue'
84   -import LocationPicker from '../../components/LocationPicker.vue'
85 83 import { getStatusBarHeight } from '../../utils/statusBar'
86 84 import { usAppFetchMyProfile } from '../../services/usAppAuth'
87 85 import { formatDisplayText } from '../../utils/emptyDisplay'
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/support.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="page-title">{{ t('support.title') }}</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -71,7 +70,6 @@ import { useI18n } from &#39;vue-i18n&#39;
71 70 import { onShow } from '@dcloudio/uni-app'
72 71 import AppIcon from '../../components/AppIcon.vue'
73 72 import SideMenu from '../../components/SideMenu.vue'
74   -import LocationPicker from '../../components/LocationPicker.vue'
75 73 import { getStatusBarHeight } from '../../utils/statusBar'
76 74 import { fetchGlobalSupportContact } from '../../services/locationSupport'
77 75 import manifest from '../../manifest.json'
... ...
泰额版/Food Labeling Management App UniApp/src/pages/more/sync.vue
... ... @@ -7,7 +7,6 @@
7 7 </view>
8 8 <view class="top-center">
9 9 <text class="page-title">{{ t('sync.title') }}</text>
10   - <LocationPicker />
11 10 </view>
12 11 <view class="top-right" @click="isMenuOpen = true">
13 12 <AppIcon name="menu" size="sm" color="white" />
... ... @@ -123,7 +122,6 @@ import { useI18n } from &#39;vue-i18n&#39;
123 122 import { onShow } from '@dcloudio/uni-app'
124 123 import AppIcon from '../../components/AppIcon.vue'
125 124 import SideMenu from '../../components/SideMenu.vue'
126   -import LocationPicker from '../../components/LocationPicker.vue'
127 125 import { getStatusBarHeight } from '../../utils/statusBar'
128 126 import {
129 127 clearFailedOfflineMutationItems,
... ...
泰额版/Food Labeling Management App UniApp/src/pages/store-select/store-select.vue
... ... @@ -133,6 +133,10 @@ import type { UsAppBoundLocationDto } from &#39;../../types/usAppBound&#39;
133 133 import { isUsAppSessionExpiredError } from '../../utils/usAppApiRequest'
134 134 import { isAppAdminUser, isCompanyAdminUser } from '../../utils/appAdminRole'
135 135 import { setBoundLocations, getBoundLocations, clearAuthSession } from '../../utils/authSession'
  136 +import {
  137 + startGlobalAlertTimerMonitor,
  138 + stopGlobalAlertTimerMonitor,
  139 +} from '../../utils/globalAlertTimerMonitor'
136 140 import { switchStore } from '../../utils/stores'
137 141  
138 142 const { t } = useI18n()
... ... @@ -298,6 +302,7 @@ const canConfirm = computed(() =&gt; {
298 302 })
299 303  
300 304 const handleBackToLogin = () => {
  305 + stopGlobalAlertTimerMonitor()
301 306 clearAuthSession()
302 307 uni.redirectTo({ url: '/pages/login/login' })
303 308 }
... ... @@ -328,6 +333,7 @@ const handleConfirm = async () =&gt; {
328 333 } else {
329 334 switchStore(store.id, store.locationName, store.locationCode)
330 335 }
  336 + startGlobalAlertTimerMonitor()
331 337 uni.showToast({ title: t('login.storeSelected'), icon: 'success' })
332 338 setTimeout(() => {
333 339 uni.redirectTo({ url: '/pages/index/index' })
... ...
泰额版/Food Labeling Management App UniApp/src/services/usAppAlertTemplate.ts 0 → 100644
  1 +import type {
  2 + UsAppAlertTemplateOptionDto,
  3 +} from '../types/usAppAlertTemplate'
  4 +import { usAppApiRequest } from '../utils/usAppApiRequest'
  5 +
  6 +const PATH = '/api/app/alert-template'
  7 +
  8 +function asArr(v: unknown): unknown[] {
  9 + return Array.isArray(v) ? v : []
  10 +}
  11 +
  12 +function str(o: Record<string, unknown>, camel: string, pascal: string): string {
  13 + return String(o[camel] ?? o[pascal] ?? '').trim()
  14 +}
  15 +
  16 +function num(o: Record<string, unknown>, camel: string, pascal: string): number {
  17 + const n = Number(o[camel] ?? o[pascal] ?? 0)
  18 + return Number.isFinite(n) ? n : 0
  19 +}
  20 +
  21 +function normalizeOption(raw: unknown): UsAppAlertTemplateOptionDto {
  22 + const o = (raw && typeof raw === 'object' ? raw : {}) as Record<string, unknown>
  23 + return {
  24 + id: str(o, 'id', 'Id'),
  25 + templateName: str(o, 'templateName', 'TemplateName'),
  26 + durationUnit: str(o, 'durationUnit', 'DurationUnit') || 'Day',
  27 + durationValue: Math.max(0, num(o, 'durationValue', 'DurationValue')),
  28 + dateTimeFormat: str(o, 'dateTimeFormat', 'DateTimeFormat') || null,
  29 + }
  30 +}
  31 +
  32 +/** GET /api/app/alert-template/options — 仅启用中的模板 */
  33 +export async function fetchUsAppAlertTemplateOptions(): Promise<UsAppAlertTemplateOptionDto[]> {
  34 + const raw = await usAppApiRequest<unknown>({
  35 + path: `${PATH}/options`,
  36 + method: 'GET',
  37 + auth: true,
  38 + })
  39 + return asArr(raw).map(normalizeOption).filter((item) => item.id)
  40 +}
... ...
泰额版/Food Labeling Management App UniApp/src/services/usAppAlertTimer.ts
... ... @@ -36,15 +36,24 @@ function normalizeTimer(raw: unknown): UsAppAlertTimerDto {
36 36 printTaskId: nullableStr(o, 'printTaskId', 'PrintTaskId'),
37 37 labelId: nullableStr(o, 'labelId', 'LabelId'),
38 38 labelCode: nullableStr(o, 'labelCode', 'LabelCode'),
  39 + labelName: nullableStr(o, 'labelName', 'LabelName'),
39 40 title: nullableStr(o, 'title', 'Title'),
40 41 subtitle: nullableStr(o, 'subtitle', 'Subtitle'),
41 42 totalTime: Math.max(0, num(o, 'totalTime', 'TotalTime')),
42 43 remainingTime,
43 44 status: rawStatus === 'expired' || remainingTime <= 0 ? 'expired' : 'running',
44 45 expiresAt: nullableStr(o, 'expiresAt', 'ExpiresAt'),
  46 + formattedExpiresAt: nullableStr(o, 'formattedExpiresAt', 'FormattedExpiresAt'),
45 47 printedAt: nullableStr(o, 'printedAt', 'PrintedAt'),
46 48 locationId: nullableStr(o, 'locationId', 'LocationId'),
  49 + locationName: nullableStr(o, 'locationName', 'LocationName'),
47 50 productName: nullableStr(o, 'productName', 'ProductName'),
  51 + alertTemplateId: nullableStr(o, 'alertTemplateId', 'AlertTemplateId'),
  52 + alertTemplateName: nullableStr(o, 'alertTemplateName', 'AlertTemplateName'),
  53 + dateTimeFormat: nullableStr(o, 'dateTimeFormat', 'DateTimeFormat'),
  54 + printedByUserId: nullableStr(o, 'printedByUserId', 'PrintedByUserId'),
  55 + printedByUserName: nullableStr(o, 'printedByUserName', 'PrintedByUserName'),
  56 + expiredMessageTemplate: nullableStr(o, 'expiredMessageTemplate', 'ExpiredMessageTemplate'),
48 57 }
49 58 }
50 59  
... ... @@ -58,15 +67,18 @@ function normalizePage(raw: unknown): UsAppAlertTimerPageResult {
58 67 return { items, totalCount, pageIndex, pageSize, totalPages }
59 68 }
60 69  
  70 +/**
  71 + * POST /api/app/label-alert-timer/app-list
  72 + * §7.2:locationId 可选;忽略 dateDay(服务端固定当天及之后)
  73 + */
61 74 export async function fetchUsAppAlertTimerList(
62 75 input: UsAppAlertTimerListInput,
63 76 ): Promise<UsAppAlertTimerPageResult> {
64 77 const body: Record<string, unknown> = {
  78 + locationId: input.locationId?.trim() || '',
65 79 skipCount: input.skipCount,
66 80 maxResultCount: input.maxResultCount,
67 81 }
68   - if (input.locationId) body.locationId = input.locationId
69   - if (input.dateDay) body.dateDay = input.dateDay
70 82  
71 83 const raw = await usAppApiRequest<unknown>({
72 84 path: `${PATH}/app-list`,
... ... @@ -84,3 +96,23 @@ export function deleteUsAppAlertTimer(id: string): Promise&lt;void&gt; {
84 96 auth: true,
85 97 })
86 98 }
  99 +
  100 +/**
  101 + * POST /api/app/label-alert-timer/create
  102 + * 文档 §11:按启用模板新增计时器(App Confirm 走这条)
  103 + */
  104 +export async function createUsAppAlertTimerFromTemplate(input: {
  105 + alertTemplateId: string
  106 + locationId?: string
  107 +}): Promise<UsAppAlertTimerDto> {
  108 + const raw = await usAppApiRequest<unknown>({
  109 + path: `${PATH}/create`,
  110 + method: 'POST',
  111 + data: {
  112 + alertTemplateId: input.alertTemplateId.trim(),
  113 + locationId: input.locationId?.trim() || '',
  114 + },
  115 + auth: true,
  116 + })
  117 + return normalizeTimer(raw)
  118 +}
... ...
泰额版/Food Labeling Management App UniApp/src/static/fonts/bebas-neue/bebas-neue-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/bebas-neue/bebas-neue-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/century-gothic/century-gothic-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/century-gothic/century-gothic-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/fira-code/fira-code-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/fira-code/fira-code-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/fira-sans/fira-sans-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/fira-sans/fira-sans-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/fira-sans/fira-sans-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/freight-sans-bold/FreightSans-Bold.ttf 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/inter/inter-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/inter/inter-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/inter/inter-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/jetbrains-mono/jetbrains-mono-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/jetbrains-mono/jetbrains-mono-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/jetbrains-mono/jetbrains-mono-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/lato/lato-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/lato/lato-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/lato/lato-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/libre-baskerville/libre-baskerville-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/libre-baskerville/libre-baskerville-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/libre-baskerville/libre-baskerville-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/lora/lora-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/lora/lora-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/lora/lora-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/merriweather/merriweather-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/merriweather/merriweather-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/merriweather/merriweather-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/montserrat/montserrat-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/montserrat/montserrat-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/montserrat/montserrat-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/open-sans/open-sans-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/open-sans/open-sans-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/open-sans/open-sans-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/oswald/oswald-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/oswald/oswald-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/playfair-display/playfair-display-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/playfair-display/playfair-display-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/playfair-display/playfair-display-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/poppins/poppins-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/poppins/poppins-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/poppins/poppins-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/raleway/raleway-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/raleway/raleway-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/raleway/raleway-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/roboto-mono/roboto-mono-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/roboto-mono/roboto-mono-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/roboto-mono/roboto-mono-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/roboto/roboto-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/roboto/roboto-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/roboto/roboto-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/sora/sora-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/sora/sora-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/source-sans-3/source-sans-3-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/source-sans-3/source-sans-3-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/source-sans-3/source-sans-3-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/tinos/tinos-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/tinos/tinos-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/tinos/tinos-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/work-sans/work-sans-latin-400-italic.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/work-sans/work-sans-latin-400-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/fonts/work-sans/work-sans-latin-700-normal.woff2 0 → 100644
No preview for this file type
泰额版/Food Labeling Management App UniApp/src/static/logo.png

3.93 KB | W: | H:

16.9 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin