refine: 客户工作台与侧栏体验,收件地图与统计分区,顺带 H5/官网样式调整
Some checks failed
Build and Deploy Front / deploy (push) Failing after 16m30s

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-12-03 12:24:48 +08:00
parent a82cd856b4
commit bf6e7263fc
36 changed files with 3952 additions and 1993 deletions

View File

@ -48,6 +48,7 @@
"@codemirror/state": "^6.5.4",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.39.17",
"@fontsource/nunito": "^5.3.0",
"@handsontable/vue3": "^16.2.0",
"@types/lodash-es": "^4.17.12",
"@vueuse/core": "^9.3.0",

18
pnpm-lock.yaml generated
View File

@ -36,6 +36,9 @@ importers:
'@codemirror/view':
specifier: ^6.39.17
version: 6.39.17
'@fontsource/nunito':
specifier: ^5.3.0
version: 5.3.0
'@handsontable/vue3':
specifier: ^16.2.0
version: 16.2.0(handsontable@16.2.0)(vue@3.5.18(typescript@4.9.5))
@ -932,6 +935,9 @@ packages:
'@floating-ui/utils@0.2.10':
resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==}
'@fontsource/nunito@5.3.0':
resolution: {integrity: sha512-vw9TaTQJ/zpEpKrsODuPmOvaVjXgdda6B+xXA4YqjrdeJ62MLgVoDerdRXFQHyBnSCt2yQ2nHKCHPP/Pv7Xq4Q==}
'@handsontable/pikaday@1.0.0':
resolution: {integrity: sha512-1VN6N38t5/DcjJ7y7XUYrDx1LuzvvzlrFdBdMG90Qo1xc8+LXHqbWbsTEm5Ec5gXTEbDEO53vUT35R+2COmOyg==}
@ -7969,6 +7975,8 @@ snapshots:
'@floating-ui/utils@0.2.10': {}
'@fontsource/nunito@5.3.0': {}
'@handsontable/pikaday@1.0.0': {}
'@handsontable/vue3@16.2.0(handsontable@16.2.0)(vue@3.5.18(typescript@4.9.5))':
@ -12984,7 +12992,7 @@ snapshots:
dependencies:
htmlparser2: 3.10.1
postcss: 7.0.39
postcss-syntax: 0.36.2(postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-scss@2.1.1)(postcss@7.0.39)
postcss-syntax: 0.36.2(postcss-html@0.36.0)(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0)(postcss-scss@2.1.1)(postcss@7.0.39)
postcss-html@1.8.0:
dependencies:
@ -12997,7 +13005,7 @@ snapshots:
dependencies:
'@babel/core': 7.28.0
postcss: 7.0.39
postcss-syntax: 0.36.2(postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-scss@2.1.1)(postcss@7.0.39)
postcss-syntax: 0.36.2(postcss-html@0.36.0)(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0)(postcss-scss@2.1.1)(postcss@7.0.39)
transitivePeerDependencies:
- supports-color
@ -13012,7 +13020,7 @@ snapshots:
postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39):
dependencies:
postcss: 7.0.39
postcss-syntax: 0.36.2(postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-scss@2.1.1)(postcss@7.0.39)
postcss-syntax: 0.36.2(postcss-html@0.36.0)(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0)(postcss-scss@2.1.1)(postcss@7.0.39)
remark: 10.0.1
unist-util-find-all-after: 1.0.5
@ -13064,7 +13072,7 @@ snapshots:
dependencies:
postcss: 8.5.6
postcss-syntax@0.36.2(postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-scss@2.1.1)(postcss@7.0.39):
postcss-syntax@0.36.2(postcss-html@0.36.0)(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0)(postcss-scss@2.1.1)(postcss@7.0.39):
dependencies:
postcss: 7.0.39
optionalDependencies:
@ -14126,7 +14134,7 @@ snapshots:
postcss-sass: 0.3.5
postcss-scss: 2.1.1
postcss-selector-parser: 3.1.2
postcss-syntax: 0.36.2(postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-scss@2.1.1)(postcss@7.0.39)
postcss-syntax: 0.36.2(postcss-html@0.36.0)(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0)(postcss-scss@2.1.1)(postcss@7.0.39)
postcss-value-parser: 3.3.1
resolve-from: 4.0.0
signal-exit: 3.0.7

1
src/components.d.ts vendored
View File

@ -22,6 +22,7 @@ declare module 'vue' {
CodeMirror: typeof import('./components/CodeMirror/index.vue')['default']
CompleteContactModal: typeof import('./components/CompleteContactModal/index.vue')['default']
ContactService: typeof import('./components/ContactService/index.vue')['default']
CustomerPortalTopTools: typeof import('./components/customer-side-rail/CustomerPortalTopTools.vue')['default']
CustomerSideRail: typeof import('./components/customer-side-rail/index.vue')['default']
CustomLeftMenu: typeof import('./components/CustomLeftMenu/index.vue')['default']
CustomList: typeof import('./components/CustomList/index.vue')['default']

View File

@ -0,0 +1,326 @@
<template>
<div class="cpt-tools" role="toolbar" aria-label="门户快捷工具">
<button
type="button"
class="cpt-tools__wh"
:title="warehouseTitle"
:aria-label="warehouseTitle"
@click="openWarehousePeek"
>
<icon-home class="cpt-tools__wh-ico" />
<span class="cpt-tools__wh-name">{{ warehouseName }}</span>
<icon-down class="cpt-tools__wh-caret" />
</button>
<div class="cpt-tools__actions">
<a-dropdown
trigger="click"
position="br"
content-class="csr-dock-dropdown"
:popup-translate="[0, 8]"
@visible-change="onMessageVisible"
>
<button
type="button"
class="cpt-tools__chip"
:class="{ 'is-hot': messageTotal > 0 }"
:title="t('navbar.message')"
:aria-label="t('navbar.message')"
>
<icon-notification class="cpt-tools__chip-ico" />
<span class="cpt-tools__chip-label">{{ t('navbar.message') }}</span>
<span v-if="messageTotal > 0" class="cpt-tools__chip-count">
{{ messageBadge }}
</span>
</button>
<template #content>
<a-doption @click="goInbox('message')">
{{ t('navbar.messageInbox') }}({{ notificationCount }})
</a-doption>
<a-doption @click="goInbox('notice')">
{{ t('navbar.messageNotice') }}({{ noticeCount }})
</a-doption>
</template>
</a-dropdown>
<a-dropdown
trigger="click"
position="br"
content-class="csr-dock-dropdown"
:popup-translate="[0, 8]"
>
<button
type="button"
class="cpt-tools__chip"
:class="{
'is-on': printConnectionState.enabled,
'is-busy': printConnectionState.connecting,
}"
:title="printConnectionTitle"
:aria-label="t('nav.printControl.menu')"
>
<icon-printer class="cpt-tools__chip-ico" />
<span class="cpt-tools__chip-label">打印</span>
<span
class="cpt-tools__chip-dot"
:class="{
'is-on': printConnectionState.enabled,
'is-busy': printConnectionState.connecting,
}"
aria-hidden="true"
/>
</button>
<template #content>
<a-doption
:disabled="printConnectionState.connecting"
@click="onPrintConnectionClick"
>
{{ printConnectionTitle }}
</a-doption>
<a-doption @click="onPrintDownloadClick">
{{ t('nav.printControl.download') }}
</a-doption>
</template>
</a-dropdown>
</div>
<WarehouseAddressPeekModal v-model:visible="warehousePeekVisible" />
</div>
</template>
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { Message } from '@arco-design/web-vue';
import {
IconDown,
IconHome,
IconNotification,
IconPrinter,
} from '@arco-design/web-vue/es/icon';
import { useCurrentWarehouseStore } from '@/store';
import { getWarehouseList } from '@/api/system/warehouse';
import {
initHiprintClientState,
setHiprintClientEnabled,
useHiprintClientState,
} from '@/utils/hiprint/hiprintClientState';
import { PRINT_CONTROL_DOWNLOAD_URL } from '@/constants/printControl';
import { useInboxUnread } from '@/composables/useInboxUnread';
import WarehouseAddressPeekModal from '@/components/customer-side-rail/WarehouseAddressPeekModal.vue';
defineOptions({ name: 'CustomerPortalTopTools' });
const { t } = useI18n();
const router = useRouter();
const warehouseStore = useCurrentWarehouseStore();
const printConnectionState = useHiprintClientState();
const { notificationCount, noticeCount, totalCount, displayCount, refreshUnread } =
useInboxUnread();
const warehousePeekVisible = ref(false);
const warehouseName = computed(
() => warehouseStore.warehouseName || t('nav.contactService.selectWarehouse'),
);
const warehouseTitle = computed(() =>
t('nav.warehousePeek.currentPrefix', { name: warehouseName.value }),
);
const printConnectionTitle = computed(() => {
if (printConnectionState.connecting) return '打印连接中…';
return printConnectionState.enabled ? '打印已连接,点击断开' : '打印未连接,点击连接';
});
const messageTotal = computed(() => totalCount.value);
const messageBadge = computed(() => displayCount.value);
function openWarehousePeek() {
warehousePeekVisible.value = true;
}
function onMessageVisible(visible: boolean) {
if (visible) refreshUnread();
}
function goInbox(noticeType: 'message' | 'notice') {
router.push({ name: 'SystemAnnouncement', query: { noticeType } });
}
async function ensureWarehouseOptions() {
try {
const { items } = await getWarehouseList({ page: 1, pageSize: 100 });
const list = (items ?? [])
.filter((row) => row.id != null)
.map((row) => ({
label: row.warehouseName || String(row.id),
value: Number(row.id),
}));
warehouseStore.setOptions(list);
} catch {
/* ignore */
}
}
async function onPrintConnectionClick() {
if (printConnectionState.connecting) return;
try {
await setHiprintClientEnabled(!printConnectionState.enabled);
} catch (e: any) {
Message.warning(`连接失败:${e?.message || '请先启动 hiprint 客户端'}`);
}
}
function onPrintDownloadClick() {
window.open(PRINT_CONTROL_DOWNLOAD_URL, '_blank', 'noopener,noreferrer');
}
onMounted(() => {
initHiprintClientState().catch(() => undefined);
void ensureWarehouseOptions();
void refreshUnread();
});
</script>
<style lang="less" scoped>
.cpt-tools {
--cpt-ink: #1a2e38;
--cpt-muted: rgba(26, 46, 56, 0.52);
--cpt-h: 30px;
display: inline-flex;
align-items: center;
gap: 4px;
flex-shrink: 0;
height: var(--cpt-h);
padding: 0;
}
.cpt-tools__wh {
display: inline-flex;
align-items: center;
gap: 6px;
max-width: 180px;
height: 100%;
padding: 0 10px 0 8px;
border: none;
border-radius: 8px;
background: transparent;
color: var(--cpt-ink);
cursor: pointer;
transition: background-color 0.14s ease;
&:hover {
background: rgba(26, 46, 56, 0.05);
}
}
.cpt-tools__wh-ico {
flex-shrink: 0;
font-size: 15px;
color: var(--cpt-muted);
}
.cpt-tools__wh-name {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 13px;
font-weight: 500;
letter-spacing: -0.01em;
line-height: 1.2;
}
.cpt-tools__wh-caret {
flex-shrink: 0;
font-size: 11px;
color: var(--cpt-muted);
}
.cpt-tools__actions {
display: inline-flex;
align-items: center;
gap: 2px;
height: 100%;
}
.cpt-tools__chip {
display: inline-flex;
align-items: center;
gap: 6px;
height: 100%;
min-width: 0;
padding: 0 10px;
border: none;
border-radius: 8px;
background: transparent;
color: var(--cpt-muted);
cursor: pointer;
transition: color 0.14s ease, background-color 0.14s ease;
&:hover {
color: var(--cpt-ink);
background: rgba(26, 46, 56, 0.05);
}
&.is-hot {
color: var(--app-primary-color, #1d7281);
}
&.is-on {
color: var(--app-primary-color, #1d7281);
}
&.is-busy {
opacity: 0.55;
pointer-events: none;
}
}
.cpt-tools__chip-ico {
flex-shrink: 0;
font-size: 15px;
}
.cpt-tools__chip-label {
flex-shrink: 0;
font-size: 13px;
font-weight: 500;
line-height: 1;
color: inherit;
}
.cpt-tools__chip-count {
flex-shrink: 0;
min-width: 16px;
height: 16px;
padding: 0 4px;
border-radius: 8px;
background: #f53f3f;
color: #fff;
font-size: 11px;
font-weight: 600;
line-height: 16px;
text-align: center;
letter-spacing: -0.02em;
}
.cpt-tools__chip-dot {
flex-shrink: 0;
width: 6px;
height: 6px;
border-radius: 50%;
background: #c9cdd4;
&.is-on {
background: #00b42a;
}
&.is-busy {
background: #ff7d00;
}
}
</style>

View File

@ -5,10 +5,11 @@
'is-collapsed': collapsed,
'is-compact': compactLayout,
'is-animating': animating,
'is-resizing': resizing,
}"
:style="{
width: `${railWidth}px`,
'--csr-shell-width': `${CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH}px`,
'--csr-shell-width': `${expandedWidth}px`,
}"
aria-label="客户门户导航"
@transitionend="onRailTransitionEnd"
@ -56,7 +57,6 @@
:key="navKey(item)"
:content="formatTitle(item)"
position="right"
:disabled="!compactLayout"
>
<div class="customer-side-rail__item-wrap">
<button
@ -68,6 +68,7 @@
@pointerenter="prefetch(item)"
@click="onNavigate(item)"
>
<span class="customer-side-rail__active-dot" aria-hidden="true" />
<span class="customer-side-rail__icon">
<component :is="getSubMenuIcon(item, undefined, MENU_NAME_TO_LOCALE_KEY)" />
</span>
@ -90,7 +91,7 @@
</section>
</div>
<!-- 底栏:头像/消息/打印 → 当前仓+收起 -->
<!-- 底栏:头像 + 收起(消息/打印/仓库已移至主区右上角) -->
<div class="customer-side-rail__dock">
<div
class="customer-side-rail__toolbar"
@ -99,68 +100,11 @@
<div class="customer-side-rail__user">
<RightTopUser
variant="sider"
compact
:compact="compactLayout"
dropdown-position="tl"
:account-menus="accountMenus"
show-language-menu
show-recharge-cta
:balance-text="balanceDisplay"
/>
</div>
<div class="customer-side-rail__message-slot">
<RightTopMessage
dropdown-position="tl"
trigger="click"
content-class="csr-dock-dropdown"
/>
</div>
<a-dropdown
trigger="click"
position="tl"
content-class="csr-dock-dropdown"
:popup-translate="[0, -6]"
>
<button
type="button"
class="customer-side-rail__tool customer-side-rail__tool--print"
:class="{
'is-enabled': printConnectionState.enabled,
'is-loading': printConnectionState.connecting,
}"
:title="printConnectionTitle"
:aria-label="t('nav.printControl.menu')"
>
<icon-printer />
<span class="customer-side-rail__tool-dot" aria-hidden="true" />
</button>
<template #content>
<a-doption
:disabled="printConnectionState.connecting"
@click="onPrintConnectionClick"
>
{{ printConnectionTitle }}
</a-doption>
<a-doption @click="onPrintDownloadClick">
{{ t('nav.printControl.download') }}
</a-doption>
</template>
</a-dropdown>
</div>
<div class="customer-side-rail__warehouse-row">
<button
type="button"
class="customer-side-rail__warehouse-chip"
:class="{ 'is-compact': compactLayout }"
:title="warehouseDockTitle"
:aria-label="warehouseDockTitle"
@click="openWarehouseAddressPeek"
>
<icon-home class="customer-side-rail__warehouse-chip-icon" />
<span v-if="!compactLayout" class="customer-side-rail__warehouse-chip-body">
<span class="customer-side-rail__warehouse-chip-name">{{ warehouseDockName }}</span>
</span>
</button>
<button
type="button"
class="customer-side-rail__toggle"
@ -175,45 +119,45 @@
</div>
</div>
<WarehouseAddressPeekModal v-model:visible="warehousePeekVisible" />
<!-- Linear/Notion:右侧拖拽调宽,便于英文等长文案 -->
<div
v-show="!collapsed"
class="customer-side-rail__resize"
role="separator"
aria-orientation="vertical"
:aria-valuenow="expandedWidth"
:aria-valuemin="CUSTOMER_SIDE_RAIL_MIN_WIDTH"
:aria-valuemax="CUSTOMER_SIDE_RAIL_MAX_WIDTH"
:title="t('nav.sideRail.resize')"
@pointerdown="onResizePointerDown"
/>
</aside>
</template>
<script lang="ts" setup>
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { Message } from '@arco-design/web-vue'
import {
IconDoubleLeft,
IconDoubleRight,
IconHome,
IconPrinter,
IconRefresh,
} from '@arco-design/web-vue/es/icon'
import { useCurrentWarehouseStore, useTabBarStore } from '@/store'
import { useTabBarStore } from '@/store'
import type { TagProps } from '@/store/modules/tab-bar/types'
import { pub } from '@/utils/pub'
import { useRbacUserStore } from '@/store/modules/rbac-user'
import { getWarehouseList } from '@/api/system/warehouse'
import { getSubMenuIcon } from '@/utils/menu-icon'
import { MENU_NAME_TO_LOCALE_KEY, translateMenuTitle } from '@/utils/menu-i18n'
import { openWindow, regexUrl } from '@/utils'
import {
initHiprintClientState,
setHiprintClientEnabled,
useHiprintClientState,
} from '@/utils/hiprint/hiprintClientState'
import { PRINT_CONTROL_DOWNLOAD_URL } from '@/constants/printControl'
import { BRAND_TEXT_LOGO, brandLogoImages } from '@/utils/brandLogo'
import { brandCopy } from '@/utils/brandCopy'
import { resolveCurrentCustomer } from '@/api/customer/resolve'
import { CUSTOMER_BALANCE_CHANGED_EVENT } from '@/api/customer/accountFlow'
import { getMapIdFromAccessToken } from '@/utils/jwt'
import {
buildCustomerFlatNavMenus,
CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH,
CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH,
CUSTOMER_SIDE_RAIL_MAX_WIDTH,
CUSTOMER_SIDE_RAIL_MIN_WIDTH,
getCustomerNavPath,
groupCustomerNavMenus,
isCustomerBalanceMenuPath,
@ -221,23 +165,21 @@ import {
partitionCustomerNavMenus,
isCustomerAccountNavPath,
readCustomerSideRailCollapsed,
readCustomerSideRailExpandedWidth,
writeCustomerSideRailCollapsed,
writeCustomerSideRailExpandedWidth,
type CustomerNavGroup,
type CustomerNavItem,
} from '@/utils/customer-portal-nav'
import { resolvePortalDrawerPanel } from '@/views/user/portal-drawer/types'
import { openPortalSideDrawer } from '@/views/user/portal-drawer/usePortalSideDrawer'
import RightTopMessage from '@/components/top-nav/RightTopMessage.vue'
import RightTopUser from '@/components/top-nav/RightTopUser.vue'
import WarehouseAddressPeekModal from '@/components/customer-side-rail/WarehouseAddressPeekModal.vue'
const { t, te, locale } = useI18n()
const route = useRoute()
const router = useRouter()
const rbacUserStore = useRbacUserStore()
const warehouseStore = useCurrentWarehouseStore()
const tabBarStore = useTabBarStore()
const printConnectionState = useHiprintClientState()
/** 与 CSS transition 时长一致(Linear 风格约 300ms) */
const RAIL_ANIM_MS = 300
@ -248,12 +190,53 @@ const collapsed = ref(readCustomerSideRailCollapsed(false))
/** 布局紧凑态:动画结束后再切,避免收起中途图标跳动 */
const compactLayout = ref(collapsed.value)
const animating = ref(false)
const resizing = ref(false)
const expandedWidth = ref(readCustomerSideRailExpandedWidth(CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH))
let compactTimer = 0
let resizeStartX = 0
let resizeStartW = 0
const railWidth = computed(() =>
collapsed.value ? CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH : CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH,
collapsed.value ? CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH : expandedWidth.value,
)
function clampExpandedWidth(width: number) {
return Math.min(
CUSTOMER_SIDE_RAIL_MAX_WIDTH,
Math.max(CUSTOMER_SIDE_RAIL_MIN_WIDTH, Math.round(width)),
)
}
function onResizePointerDown(e: PointerEvent) {
if (collapsed.value || e.button !== 0) return
e.preventDefault()
resizing.value = true
animating.value = false
resizeStartX = e.clientX
resizeStartW = expandedWidth.value
document.body.style.cursor = 'col-resize'
document.body.style.userSelect = 'none'
window.addEventListener('pointermove', onResizePointerMove)
window.addEventListener('pointerup', onResizePointerUp)
window.addEventListener('pointercancel', onResizePointerUp)
}
function onResizePointerMove(e: PointerEvent) {
if (!resizing.value) return
expandedWidth.value = clampExpandedWidth(resizeStartW + (e.clientX - resizeStartX))
}
function onResizePointerUp() {
window.removeEventListener('pointermove', onResizePointerMove)
window.removeEventListener('pointerup', onResizePointerUp)
window.removeEventListener('pointercancel', onResizePointerUp)
document.body.style.cursor = ''
document.body.style.userSelect = ''
if (!resizing.value) return
resizing.value = false
writeCustomerSideRailExpandedWidth(expandedWidth.value)
}
const flatMenus = computed(() => {
if (!rbacUserStore.isCustomerPortal()) return [] as CustomerNavItem[]
return buildCustomerFlatNavMenus(
@ -291,84 +274,6 @@ const isAccountRouteActive = computed(() => {
const isBalanceRouteActive = computed(() => !!balanceOwnedPath.value)
const printConnectionTitle = computed(() => {
if (printConnectionState.connecting) return '打印连接中…'
return printConnectionState.enabled ? '打印已连接,点击断开' : '打印未连接,点击连接'
})
const customerBalance = ref<number | null>(null)
let balanceInflight: Promise<void> | null = null
const balanceDisplay = computed(() => {
const raw = customerBalance.value
if (raw == null) return '0.00'
const parsed = Number(raw)
return Number.isFinite(parsed) ? parsed.toFixed(2) : '0.00'
})
async function fetchCustomerBalance() {
if (!rbacUserStore.isCustomerPortal() || !rbacUserStore.isLoggedIn) {
customerBalance.value = null
return
}
const mapId = getMapIdFromAccessToken(rbacUserStore.accessToken)
const account = rbacUserStore.userInfo?.account?.trim() || ''
const data = await resolveCurrentCustomer({ mapId, account, force: true })
const raw = data?.accountBalance ?? data?.balance
if (raw == null || raw === '') {
customerBalance.value = 0
return
}
const parsed = Number(raw)
customerBalance.value = Number.isFinite(parsed) ? parsed : 0
}
function loadCustomerBalance() {
if (!balanceInflight) {
balanceInflight = fetchCustomerBalance().finally(() => {
balanceInflight = null
})
}
return balanceInflight
}
function handleCustomerBalanceChanged() {
void loadCustomerBalance().catch((error) => {
console.error('Failed to load customer balance', error)
})
}
const warehousePeekVisible = ref(false)
const warehouseDockName = computed(
() =>
warehouseStore.warehouseName ||
t('nav.contactService.selectWarehouse'),
)
const warehouseDockTitle = computed(() =>
t('nav.warehousePeek.currentPrefix', { name: warehouseDockName.value }),
)
function openWarehouseAddressPeek() {
warehousePeekVisible.value = true
}
async function ensureWarehouseOptions() {
try {
const { items } = await getWarehouseList({ page: 1, pageSize: 100 })
const list = (items ?? [])
.filter((row) => row.id != null)
.map((row) => ({
label: row.warehouseName || String(row.id),
value: Number(row.id),
}))
warehouseStore.setOptions(list)
} catch {
/* 侧栏仅展示已缓存仓名,打开弹窗时再拉地址 */
}
}
function groupLabel(group: CustomerNavGroup) {
if (te(group.labelKey)) return t(group.labelKey)
return group.labelFallback
@ -518,19 +423,6 @@ async function onRefresh(item: CustomerNavItem) {
})
}
async function onPrintConnectionClick() {
if (printConnectionState.connecting) return
try {
await setHiprintClientEnabled(!printConnectionState.enabled)
} catch (e: any) {
Message.warning(`连接失败:${e?.message || '请先启动 hiprint 客户端'}`)
}
}
function onPrintDownloadClick() {
window.open(PRINT_CONTROL_DOWNLOAD_URL, '_blank', 'noopener,noreferrer')
}
watch(
() => rbacUserStore.isCustomerPortal(),
(ok) => {
@ -540,34 +432,16 @@ watch(
},
)
watch(
() =>
[rbacUserStore.isLoggedIn, rbacUserStore.loginPortalType, rbacUserStore.accessToken] as const,
() => {
void loadCustomerBalance().catch((error) => {
console.error('Failed to load customer balance', error)
if (customerBalance.value == null) customerBalance.value = 0
})
},
{ immediate: true },
)
watch(activePath, () => {
scrollActiveNavIntoView()
}, { immediate: true })
onMounted(() => {
initHiprintClientState().catch(() => undefined)
void ensureWarehouseOptions()
window.addEventListener(CUSTOMER_BALANCE_CHANGED_EVENT, handleCustomerBalanceChanged)
})
onUnmounted(() => {
if (compactTimer) {
window.clearTimeout(compactTimer)
compactTimer = 0
}
window.removeEventListener(CUSTOMER_BALANCE_CHANGED_EVENT, handleCustomerBalanceChanged)
onResizePointerUp()
})
</script>
@ -579,7 +453,7 @@ onUnmounted(() => {
--csr-radius: 16px;
--csr-panel-radius: 16px;
--csr-panel-inset: 16px;
--csr-shell-width: 200px;
--csr-shell-width: 180px;
--csr-ease: cubic-bezier(0.32, 0.72, 0, 1);
--csr-dur: 0.3s;
@ -592,15 +466,51 @@ onUnmounted(() => {
overflow: hidden;
background: var(--app-card-bg, #fff);
border-radius: var(--csr-panel-radius);
position: relative;
/* 外层只动画宽度;内容在 shell 内固定宽,不随变窄重排(Linear / Notion) */
transition: width var(--csr-dur) var(--csr-ease);
will-change: width;
z-index: 10;
&.is-resizing {
transition: none;
will-change: width;
}
@media (prefers-reduced-motion: reduce) {
--csr-dur: 0.01ms;
}
&__resize {
position: absolute;
top: 10px;
right: -3px;
bottom: 10px;
width: 6px;
z-index: 3;
cursor: col-resize;
touch-action: none;
border-radius: 999px;
&::after {
content: '';
position: absolute;
top: 50%;
left: 2px;
width: 2px;
height: 28px;
margin-top: -14px;
border-radius: 1px;
background: transparent;
transition: background-color 0.15s ease;
}
&:hover::after,
.customer-side-rail.is-resizing &::after {
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 55%, transparent);
}
}
&__shell {
width: var(--csr-shell-width);
height: 100%;
@ -644,33 +554,6 @@ onUnmounted(() => {
border-bottom: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.06));
}
&__message-slot {
min-width: 0;
display: flex;
align-items: center;
justify-content: center;
:deep(.message-dropdown-trigger) {
width: 32px;
max-width: none;
height: 32px;
justify-content: center;
padding: 0;
border-radius: 6px;
color: var(--color-text-2);
gap: 0;
}
:deep(.message-dropdown-trigger:hover) {
color: var(--color-text-1);
background: rgba(255, 255, 255, 0.85);
}
:deep(.message-label) {
display: none;
}
}
&__brand-logo {
display: block;
width: 40px;
@ -783,10 +666,10 @@ onUnmounted(() => {
position: relative;
display: flex;
align-items: center;
gap: 12px;
gap: 8px;
width: 100%;
min-height: var(--csr-item-h);
padding: 0 12px 0 14px;
padding: 0 12px 0 8px;
border: none;
border-radius: 10px;
background: transparent;
@ -803,29 +686,45 @@ onUnmounted(() => {
background: rgba(15, 23, 42, 0.04);
}
/* 选中:实心主色胶囊(无描边框),白字 + 图标浅底 */
/* Linear 式:浅底 + 左侧选中点 */
&.active {
color: #fff;
background: var(--app-primary-color, #054f74);
color: var(--app-primary-color, #1d7281);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 10%, #fff);
font-weight: 600;
box-shadow: none;
.customer-side-rail__active-dot {
background: var(--app-primary-color, #1d7281);
box-shadow: 0 0 0 3px
color-mix(in srgb, var(--app-primary-color, #1d7281) 18%, transparent);
}
.customer-side-rail__icon {
color: #fff;
background: rgba(255, 255, 255, 0.16);
color: var(--app-primary-color, #1d7281);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 12%, #fff);
}
.customer-side-rail__text {
color: #fff;
color: var(--app-primary-color, #1d7281);
}
&:hover {
color: #fff;
background: color-mix(in srgb, var(--app-primary-color, #054f74) 88%, #000);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 14%, #fff);
}
}
}
&__active-dot {
flex-shrink: 0;
width: 6px;
height: 6px;
border-radius: 50%;
background: transparent;
transition:
background-color 0.16s ease,
box-shadow 0.16s ease;
}
&__icon {
display: inline-flex;
align-items: center;
@ -861,76 +760,12 @@ onUnmounted(() => {
flex-shrink: 0;
display: flex;
flex-direction: column;
gap: 6px;
gap: 0;
padding: 8px var(--csr-pad-x) 12px;
border-top: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.06));
}
/* 一级:当前仓 + 收起 同行 */
&__warehouse-row {
display: flex;
align-items: center;
gap: 2px;
min-width: 0;
width: 100%;
}
&__warehouse-chip {
display: flex;
align-items: center;
gap: 8px;
flex: 1;
min-width: 0;
height: 40px;
padding: 0 10px;
border: none;
border-radius: 8px;
background: transparent;
box-shadow: none;
color: var(--color-text-1);
cursor: pointer;
text-align: left;
transition: background-color 0.14s ease;
&:hover {
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 8%, transparent);
}
&.is-compact {
flex: 0 0 auto;
width: 40px;
height: 40px;
padding: 0;
justify-content: center;
gap: 0;
}
}
&__warehouse-chip-icon {
flex-shrink: 0;
font-size: 16px;
color: var(--color-text-3);
}
&__warehouse-chip-body {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 1px;
}
&__warehouse-chip-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 13px;
font-weight: 400;
line-height: 1.25;
color: var(--color-text-2);
}
/* 底栏:头像 + 消息 + 打印,三等分铺满 */
/* 底栏:头像 + 收起 */
&__toolbar {
display: flex;
align-items: center;
@ -941,17 +776,6 @@ onUnmounted(() => {
padding: 2px 4px;
border-radius: 8px;
background: transparent;
transition:
background-color 0.14s ease,
box-shadow 0.14s ease;
> * {
flex: 1 1 0;
min-width: 0;
display: flex;
align-items: center;
justify-content: center;
}
&.is-account-active {
:deep(.user-dropdown-trigger) {
@ -960,73 +784,44 @@ onUnmounted(() => {
}
}
&__tool {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 32px;
height: 32px;
border: none;
border-radius: 6px;
background: transparent;
color: var(--color-text-3);
cursor: pointer;
text-decoration: none;
font-size: 14px;
transition: color 0.14s ease, background-color 0.14s ease;
&:hover {
color: var(--color-text-1);
background: rgba(255, 255, 255, 0.85);
}
&.is-enabled {
color: var(--app-primary-color);
}
&.is-loading {
opacity: 0.6;
pointer-events: none;
}
&--print {
opacity: 0.9;
}
}
&__tool-dot {
position: absolute;
top: 5px;
right: 5px;
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--color-text-4, #c9cdd4);
}
&__tool.is-enabled &__tool-dot {
background: rgb(var(--green-6));
}
&__user {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
min-width: 0;
:deep(.user-dropdown-trigger),
:deep(.user-dropdown-trigger.is-compact) {
:deep(.user-dropdown-trigger) {
width: 100%;
max-width: none;
height: 40px;
padding: 0 8px 0 4px;
margin: 0;
gap: 10px;
justify-content: flex-start;
color: var(--color-text-1);
border-radius: 10px;
}
:deep(.user-avatar) {
width: 32px;
height: 32px;
padding: 0;
margin: 0;
justify-content: center;
}
:deep(.user-avatar--fallback) {
font-size: 14px;
}
:deep(.user-name) {
max-width: none;
flex: 1;
min-width: 0;
font-size: 14px;
font-weight: 600;
color: var(--color-text-1);
}
:deep(.user-dropdown-trigger:hover) {
background: rgba(255, 255, 255, 0.85);
background: rgba(15, 23, 42, 0.04);
}
}
@ -1036,9 +831,9 @@ onUnmounted(() => {
justify-content: center;
flex-shrink: 0;
width: 32px;
height: 32px;
height: 40px;
border: none;
border-radius: 6px;
border-radius: 8px;
background: transparent;
color: var(--color-text-3);
cursor: pointer;
@ -1046,7 +841,7 @@ onUnmounted(() => {
&:hover {
color: var(--app-primary-color);
background: rgba(255, 255, 255, 0.65);
background: rgba(15, 23, 42, 0.04);
}
}
@ -1109,87 +904,60 @@ onUnmounted(() => {
justify-content: center;
border-radius: var(--csr-radius);
/* 收起态用整块高亮,不再用左边条(裁切后会偏) */
&::before {
display: none;
}
&:hover {
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 8%, #fff);
}
&.active {
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 14%, #fff);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-primary-color, #1d7281) 22%, transparent);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 12%, #fff);
box-shadow: none;
}
}
.customer-side-rail__active-dot {
position: absolute;
top: 5px;
right: 5px;
width: 5px;
height: 5px;
}
.customer-side-rail__text {
display: none;
}
.customer-side-rail__dock {
align-items: center;
gap: 6px;
padding: 8px 0 10px;
}
.customer-side-rail__warehouse-row {
width: 40px;
flex-direction: column;
align-items: center;
gap: 2px;
}
.customer-side-rail__warehouse-chip {
width: 40px;
height: 40px;
padding: 0;
justify-content: center;
}
.customer-side-rail__toolbar {
width: 40px;
flex-direction: column;
align-items: center;
gap: 2px;
padding: 2px;
background: transparent;
box-shadow: none;
&.is-account-active {
background: transparent;
box-shadow: none;
}
}
.customer-side-rail__user {
width: 32px;
width: 36px;
flex: 0 0 auto;
}
justify-content: center;
.customer-side-rail__message-slot {
width: 32px;
flex: 0 0 auto;
:deep(.message-dropdown-trigger) {
width: 32px;
max-width: none;
height: 32px;
:deep(.user-dropdown-trigger),
:deep(.user-dropdown-trigger.is-compact) {
width: 36px;
height: 36px;
padding: 0;
background: transparent;
justify-content: center;
}
:deep(.message-count) {
display: none;
:deep(.user-avatar) {
width: 28px;
height: 28px;
}
}
.customer-side-rail__tool {
width: 32px;
height: 32px;
}
.customer-side-rail__toggle {
width: 32px;
height: 32px;

View File

@ -18,116 +18,76 @@
<span v-if="!compact" class="user-name">{{ displayName }}</span>
</div>
<!-- Cursor 风格:侧栏账户面板(头信息 / 菜单 / 登出固定底) -->
<!-- Linear / Notion / GitHub 式:身份头 + 分组菜单 + 底栏退出 -->
<template v-if="isSiderVariant" #content>
<div class="csr-user-panel" @click.stop>
<div class="csr-user-panel__header">
<div class="csr-user-panel__top">
<div class="csr-user-panel__identity">
<img
v-if="showCustomerAvatar"
:src="customerAvatarUrl"
alt=""
class="csr-user-panel__avatar"
/>
<span v-else class="csr-user-panel__avatar csr-user-panel__avatar--fallback">
{{ displayNameInitial }}
</span>
<div class="csr-user-panel__meta">
<div class="csr-user-panel__name">{{ displayName }}</div>
<div v-if="accountSubtitle" class="csr-user-panel__sub">{{ accountSubtitle }}</div>
</div>
</div>
<div
v-if="showLanguageMenu"
class="csr-user-panel__lang"
role="group"
:aria-label="t('nav.userMenu.language')"
>
<button
v-for="opt in languageOptions"
:key="opt.value"
type="button"
class="csr-user-panel__lang-btn"
:class="{ 'is-active': currentLanguage === opt.value }"
:aria-pressed="currentLanguage === opt.value"
:title="opt.label"
@click="onPanelAction(`lang:${opt.value}`)"
>
{{ opt.short }}
</button>
</div>
</div>
<button
v-if="showRechargeCta"
type="button"
class="csr-user-panel__balance"
@click="onPanelAction('recharge')"
>
<span class="csr-user-panel__balance-meta">
<span class="csr-user-panel__balance-label">{{ t('nav.balance.label') }}</span>
<span class="csr-user-panel__balance-amount">
<template v-if="balanceText">¥{{ balanceText }}</template>
<template v-else>—</template>
</span>
</span>
<span class="csr-user-panel__balance-action">
{{ t('nav.balance.recharge') }}
<i class="fa fa-angle-right" aria-hidden="true" />
</span>
</button>
</div>
<div class="csr-user-panel__body">
<button
v-for="item in primaryAccountMenus"
:key="accountMenuKey(item)"
type="button"
class="csr-user-panel__item"
@click="onPanelAction(accountMenuKey(item))"
>
<span class="csr-user-panel__item-icon">
<component :is="getSubMenuIcon(item, undefined, MENU_NAME_TO_LOCALE_KEY)" />
</span>
<span class="csr-user-panel__item-label">{{ formatAccountTitle(item) }}</span>
</button>
<button
v-if="isCustomerPortal && !hasAccountProfileItem"
type="button"
class="csr-user-panel__item"
@click="onPanelAction('userinfo')"
>
<span class="csr-user-panel__item-icon"><i class="fa fa-user" /></span>
<span class="csr-user-panel__item-label">{{ t('menu.user.profile') }}</span>
</button>
<button
type="button"
class="csr-user-panel__item"
@click="onPanelAction('changePassword')"
>
<span class="csr-user-panel__item-icon"><i class="fa fa-lock" /></span>
<span class="csr-user-panel__item-label">{{ t('profile.changePassword') }}</span>
</button>
<button
type="button"
class="csr-user-panel__item"
@click="onPanelAction('settings')"
>
<span class="csr-user-panel__item-icon"><i class="fa fa-cog" /></span>
<span class="csr-user-panel__item-label">{{ t('nav.userMenu.pageSettings') }}</span>
</button>
<button
v-for="item in trailingAccountMenus"
:key="accountMenuKey(item)"
type="button"
class="csr-user-panel__item"
@click="onPanelAction(accountMenuKey(item))"
>
<span class="csr-user-panel__item-icon">
<component :is="getSubMenuIcon(item, undefined, MENU_NAME_TO_LOCALE_KEY)" />
</span>
<span class="csr-user-panel__item-label">{{ formatAccountTitle(item) }}</span>
</button>
<section v-if="primaryAccountMenus.length" class="csr-user-panel__section">
<div class="csr-user-panel__section-label">账户</div>
<button
v-for="item in primaryAccountMenus"
:key="accountMenuKey(item)"
type="button"
class="csr-user-panel__item"
@click="onPanelAction(accountMenuKey(item))"
>
<span class="csr-user-panel__item-icon">
<component :is="getSubMenuIcon(item, undefined, MENU_NAME_TO_LOCALE_KEY)" />
</span>
<span class="csr-user-panel__item-label">{{ formatAccountTitle(item) }}</span>
</button>
</section>
<section class="csr-user-panel__section">
<div class="csr-user-panel__section-label">设置</div>
<button
v-if="isCustomerPortal && !hasAccountProfileItem"
type="button"
class="csr-user-panel__item"
@click="onPanelAction('userinfo')"
>
<span class="csr-user-panel__item-icon"><i class="fa fa-user" /></span>
<span class="csr-user-panel__item-label">{{ t('menu.user.profile') }}</span>
</button>
<button
type="button"
class="csr-user-panel__item"
@click="onPanelAction('changePassword')"
>
<span class="csr-user-panel__item-icon"><i class="fa fa-lock" /></span>
<span class="csr-user-panel__item-label">{{ t('profile.changePassword') }}</span>
</button>
<button
type="button"
class="csr-user-panel__item"
@click="onPanelAction('settings')"
>
<span class="csr-user-panel__item-icon"><i class="fa fa-cog" /></span>
<span class="csr-user-panel__item-label">{{ t('nav.userMenu.pageSettings') }}</span>
</button>
<button
type="button"
class="csr-user-panel__item"
:title="langToggleTitle"
@click="toggleLanguage"
>
<span class="csr-user-panel__item-icon"><i class="fa fa-language" /></span>
<span class="csr-user-panel__item-label">{{ t('nav.userMenu.switchLanguage') }}</span>
<span class="csr-user-panel__item-extra">{{ langToggleLabel }}</span>
</button>
<button
v-for="item in trailingAccountMenus"
:key="accountMenuKey(item)"
type="button"
class="csr-user-panel__item"
@click="onPanelAction(accountMenuKey(item))"
>
<span class="csr-user-panel__item-icon">
<component :is="getSubMenuIcon(item, undefined, MENU_NAME_TO_LOCALE_KEY)" />
</span>
<span class="csr-user-panel__item-label">{{ formatAccountTitle(item) }}</span>
</button>
</section>
</div>
<div class="csr-user-panel__footer">
@ -304,14 +264,11 @@ const props = withDefaults(
dropdownPosition?: 'br' | 'bl' | 'tr' | 'tl' | 'rt' | 'rb' | 'bottom' | 'top'
/** 客户侧栏:资产与账户菜单,收进用户下拉 */
accountMenus?: CustomerNavItem[]
/** 客户侧栏:语言收进用户菜单,不再单独占底栏 */
/** 侧栏面板内嵌语言切换;客户门户语言已挪到页签行右上角 */
showLanguageMenu?: boolean
/** navbar 保持原下拉;sider 用 Cursor 式面板 */
variant?: 'navbar' | 'sider'
trigger?: 'hover' | 'click'
/** 侧栏面板展示余额并提供去充值 CTA */
balanceText?: string
showRechargeCta?: boolean
}>(),
{
compact: false,
@ -320,8 +277,6 @@ const props = withDefaults(
showLanguageMenu: false,
variant: 'navbar',
trigger: undefined,
balanceText: '',
showRechargeCta: false,
},
);
@ -336,8 +291,6 @@ const menuVisible = ref(false);
const isSiderVariant = computed(() => props.variant === 'sider');
const showLanguageMenu = computed(() => props.showLanguageMenu);
const showRechargeCta = computed(() => props.showRechargeCta && isSiderVariant.value);
const balanceText = computed(() => String(props.balanceText || '').trim());
const dropdownTrigger = computed(() => {
if (props.trigger) return props.trigger;
@ -363,6 +316,15 @@ const languageOptions = [
] as const;
const currentLanguage = computed(() => String(locale.value || 'zh-CN'));
const isZh = computed(() => currentLanguage.value === 'zh-CN');
const langToggleLabel = computed(() => (isZh.value ? 'EN' : '中'));
const langToggleTitle = computed(() =>
isZh.value ? 'Switch to English' : '切换到中文',
);
function toggleLanguage() {
void changeLocale(isZh.value ? 'en-US' : 'zh-CN', { silent: true });
}
const isCustomerPortal = computed(() => rbacUserStore.isCustomerPortal());
@ -375,26 +337,6 @@ const displayNameInitial = computed(() => {
return name ? name.slice(0, 1).toUpperCase() : '?';
});
/** 后端占位邮箱,不当真实邮箱展示(客户 @noemail.local / 代理 @agent.local) */
function isPlaceholderEmail(value: string) {
const v = value.trim().toLowerCase();
if (!v) return true;
return (
v.endsWith('@noemail.local') ||
v.includes('@noemail.') ||
v.endsWith('@agent.local')
);
}
const accountSubtitle = computed(() => {
const info = rbacUserStore.userInfo as Record<string, unknown> | null | undefined;
const account = String(info?.account ?? '').trim();
const email = String(info?.email ?? '').trim();
if (email && !isPlaceholderEmail(email)) return email;
if (account && !isPlaceholderEmail(account)) return account;
return '';
});
const compact = computed(() => props.compact);
const accountMenus = computed(() => props.accountMenus || []);
@ -782,17 +724,18 @@ const onMenuClick = async (event: { key: string }) => {
}
}
/* Cursor 风格:侧栏 dock 账户面板 */
/* Linear / Notion 式账户面板壳 */
.csr-account-dropdown {
width: 224px !important;
min-width: 224px !important;
max-width: 224px !important;
width: 200px !important;
min-width: 200px !important;
max-width: 200px !important;
padding: 0 !important;
border: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.08)) !important;
border-radius: 12px !important;
border: 1px solid rgba(15, 23, 42, 0.08) !important;
border-radius: 14px !important;
box-shadow:
0 8px 28px rgba(15, 23, 42, 0.12),
0 2px 8px rgba(15, 23, 42, 0.06) !important;
0 0 0 1px rgba(15, 23, 42, 0.03),
0 12px 40px rgba(15, 23, 42, 0.12),
0 2px 8px rgba(15, 23, 42, 0.04) !important;
overflow: hidden;
background: #fff !important;
@ -812,7 +755,6 @@ const onMenuClick = async (event: { key: string }) => {
margin: 0 !important;
}
/* 固定宽度面板:禁止横向滚动条 */
.arco-scrollbar-container {
overflow-x: hidden !important;
}
@ -823,224 +765,51 @@ const onMenuClick = async (event: { key: string }) => {
}
.csr-user-panel {
width: 224px;
max-width: 224px;
width: 200px;
max-width: 200px;
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow-x: hidden;
background: #fff;
color: var(--color-text-1);
&__header {
padding: 14px 12px 12px;
border-bottom: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.06));
display: flex;
flex-direction: column;
gap: 12px;
}
&__top {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
&__identity {
flex: 1;
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
&__lang {
flex-shrink: 0;
display: inline-flex;
align-items: center;
padding: 2px;
border-radius: 8px;
background: var(--color-fill-2, #f2f3f5);
}
&__lang-btn {
min-width: 28px;
height: 24px;
padding: 0 7px;
border: none;
border-radius: 6px;
background: transparent;
color: var(--color-text-3);
font-size: 11px;
font-weight: 600;
letter-spacing: 0.02em;
line-height: 1;
cursor: pointer;
transition:
color 0.12s ease,
background-color 0.12s ease,
box-shadow 0.12s ease;
&:hover:not(.is-active) {
color: var(--color-text-1);
}
&.is-active {
background: #fff;
color: var(--app-primary-color, #1d7281);
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
cursor: default;
}
}
&__avatar {
width: 36px;
height: 36px;
border-radius: 50%;
object-fit: cover;
flex-shrink: 0;
background: var(--color-fill-3, #e5e6eb);
box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
&--fallback {
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 700;
color: var(--color-text-1);
}
}
&__meta {
min-width: 0;
flex: 1;
}
&__name {
font-size: 14px;
font-weight: 650;
line-height: 1.25;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&__sub {
margin-top: 2px;
font-size: 12px;
line-height: 1.3;
color: var(--color-text-3);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&__balance {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
width: 100%;
min-height: 52px;
padding: 8px 10px 8px 12px;
border: none;
border-radius: 10px;
background:
linear-gradient(
135deg,
color-mix(in srgb, var(--app-primary-color, #1d7281) 10%, #fff) 0%,
color-mix(in srgb, var(--app-primary-color, #1d7281) 4%, #fff) 100%
);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-primary-color, #1d7281) 16%, transparent);
color: var(--color-text-1);
text-align: left;
cursor: pointer;
transition:
background-color 0.14s ease,
box-shadow 0.14s ease,
transform 0.14s ease;
&:hover {
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-primary-color, #1d7281) 28%, transparent);
background:
linear-gradient(
135deg,
color-mix(in srgb, var(--app-primary-color, #1d7281) 14%, #fff) 0%,
color-mix(in srgb, var(--app-primary-color, #1d7281) 6%, #fff) 100%
);
.csr-user-panel__balance-action {
color: var(--app-primary-color, #1d7281);
}
}
&:active {
transform: scale(0.985);
}
}
&__balance-meta {
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
&__balance-label {
font-size: 11px;
font-weight: 500;
letter-spacing: 0.04em;
color: var(--color-text-3);
}
&__balance-amount {
font-size: 18px;
font-weight: 700;
font-variant-numeric: tabular-nums;
line-height: 1.2;
color: var(--dep-ink, #1a2e38);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&__balance-action {
flex-shrink: 0;
display: inline-flex;
align-items: center;
gap: 4px;
padding: 5px 8px;
border-radius: 999px;
background: #fff;
color: var(--app-primary-color, #1d7281);
font-size: 12px;
font-weight: 600;
line-height: 1;
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
transition: color 0.12s ease, background-color 0.12s ease;
.fa {
font-size: 12px;
opacity: 0.85;
}
}
color: #1a2e38;
&__body {
padding: 8px;
max-height: min(56vh, 420px);
padding: 4px 6px 6px;
max-height: min(60vh, 460px);
overflow-x: hidden;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 2px;
gap: 0;
}
&__section {
display: flex;
flex-direction: column;
gap: 0;
padding: 2px 0 4px;
& + & {
border-top: 1px solid rgba(15, 23, 42, 0.06);
margin-top: 2px;
padding-top: 4px;
}
}
&__section-label {
padding: 4px 10px 2px;
font-size: 11px;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: rgba(26, 46, 56, 0.38);
user-select: none;
}
&__footer {
padding: 8px;
border-top: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.06));
background: color-mix(in srgb, var(--color-fill-2, #f2f3f5) 55%, #fff);
padding: 4px 6px 6px;
border-top: 1px solid rgba(15, 23, 42, 0.06);
}
&__item {
@ -1048,39 +817,52 @@ const onMenuClick = async (event: { key: string }) => {
align-items: center;
gap: 10px;
width: 100%;
min-height: 40px;
padding: 0 12px;
min-height: 34px;
padding: 0 10px;
border: none;
border-radius: 8px;
background: transparent;
color: var(--color-text-1);
color: #1a2e38;
font-size: 13px;
font-weight: 500;
text-align: left;
cursor: pointer;
transition: background-color 0.12s ease;
transition: background-color 0.12s ease, color 0.12s ease;
&:hover {
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 8%, #fff);
background: rgba(15, 23, 42, 0.045);
}
&:active {
background: rgba(15, 23, 42, 0.07);
}
&.is-danger {
color: rgb(var(--red-6));
color: #c93c37;
justify-content: flex-start;
.csr-user-panel__item-icon {
color: rgb(var(--red-6));
color: #c93c37;
background: rgba(201, 60, 55, 0.08);
}
&:hover {
background: rgba(201, 60, 55, 0.06);
}
}
}
&__item-icon {
width: 18px;
width: 26px;
height: 26px;
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 14px;
color: var(--color-text-3);
border-radius: 7px;
font-size: 13px;
color: rgba(26, 46, 56, 0.55);
background: rgba(15, 23, 42, 0.04);
}
&__item-label {
@ -1091,6 +873,20 @@ const onMenuClick = async (event: { key: string }) => {
white-space: nowrap;
}
&__item-extra {
flex-shrink: 0;
min-width: 24px;
padding: 2px 7px;
border-radius: 999px;
background: rgba(15, 23, 42, 0.05);
color: rgba(26, 46, 56, 0.62);
font-size: 11px;
font-weight: 650;
letter-spacing: 0.02em;
line-height: 1.4;
text-align: center;
}
&__hint {
margin-left: 8px;
color: var(--app-primary-color, rgb(var(--primary-6)));

View File

@ -1,6 +1,6 @@
<template>
<a-layout class="layout">
<!-- 运营端顶栏;客户/代理门户无顶栏(能力沉底侧栏) -->
<!-- 运营端顶栏;客户/代理门户无 TopNav(工具在页签行右侧) -->
<TopNav v-if="!isPortalShell" />
<!-- 客户/代理门户:全高侧栏 + 主区(页签与运营端同一套 TabBar) -->
@ -11,8 +11,13 @@
<CustomerSideRail v-if="isCustomerShell" />
<AgentSideRail v-else-if="isAgentShell" />
<a-layout class="layout-main-wrap">
<div v-if="portalTabBarEnable" class="portal-tab-nav">
<TabBar />
<div
v-if="portalTabBarEnable || isCustomerShell"
class="portal-tab-nav"
:class="{ 'portal-tab-nav--tools-only': !portalTabBarEnable }"
>
<TabBar v-if="portalTabBarEnable" />
<CustomerPortalTopTools v-if="isCustomerShell" />
</div>
<a-layout-content class="layout-main">
<PageLayout />
@ -42,6 +47,7 @@
import { useRbacUserStore } from '@/store/modules/rbac-user';
import TopNav from '@/components/top-nav/index.vue';
import CustomerSideRail from '@/components/customer-side-rail/index.vue';
import CustomerPortalTopTools from '@/components/customer-side-rail/CustomerPortalTopTools.vue';
import AgentSideRail from '@/components/agent-side-rail/index.vue';
import TabBar from '@/components/tab-bar/index.vue';
import usePermission from '@/hooks/permission';
@ -152,22 +158,36 @@
overflow: hidden;
}
/* 与运营端 top-nav-tabs 同高;左缩进对齐页面内容 */
/* 页签占左侧弹性区,工具靠右,互不抢满宽 */
.portal-tab-nav {
flex-shrink: 0;
height: 28px;
height: 36px;
display: flex;
align-items: center;
gap: 12px;
background: transparent;
border-bottom: 1px dashed rgba(26, 46, 56, 0.14);
box-sizing: border-box;
padding-right: 12px;
:deep(.tab-bar) {
flex: 1 1 auto;
min-width: 0;
padding-left: 16px;
padding-right: 12px;
padding-right: 4px;
}
:deep(.tab-bar.is-overflow-left::before) {
left: 16px;
}
:deep(.tab-bar.is-overflow-right::after) {
right: 40px;
}
&--tools-only {
justify-content: flex-end;
}
}
:deep(.arco-layout-content.layout-main),

View File

@ -2006,9 +2006,11 @@ export default {
'nav.sideRail.collapse': 'Collapse menu',
'nav.sideRail.expand': 'Expand menu',
'nav.sideRail.refresh': 'Refresh page',
'nav.sideRail.resize': 'Drag to resize menu',
'nav.userMenu.logout': 'Log out',
'nav.userMenu.pageSettings': 'Page settings',
'nav.userMenu.language': 'Language',
'nav.userMenu.switchLanguage': 'Switch language',
'nav.userMenu.switchLanguage': 'Switch to {lang}',
'nav.warehousePeek.title': 'Warehouse address',
'nav.warehousePeek.tip': 'Put your customer code on the parcel for warehouse intake',

View File

@ -1703,9 +1703,11 @@ export default {
'nav.sideRail.collapse': '收起菜单',
'nav.sideRail.expand': '展开菜单',
'nav.sideRail.refresh': '刷新当前页面',
'nav.sideRail.resize': '拖动调整菜单宽度',
'nav.userMenu.logout': '退出登录',
'nav.userMenu.pageSettings': '页面配置',
'nav.userMenu.language': '语言',
'nav.userMenu.switchLanguage': '切换语言',
'nav.userMenu.switchLanguage': '切换到{lang}',
'nav.warehousePeek.title': '仓库地址',
'nav.warehousePeek.tip': '寄件请备注客户编号,便于仓库认领',

View File

@ -11,8 +11,12 @@ export const CUSTOMER_TOP_NAV_PRIORITY_PATHS = [
] as const
export const CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH = 64
export const CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH = 200
/** 默认展开宽;可拖拽,落在 MIN~MAX */
export const CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH = 180
export const CUSTOMER_SIDE_RAIL_MIN_WIDTH = 160
export const CUSTOMER_SIDE_RAIL_MAX_WIDTH = 280
export const CUSTOMER_SIDE_RAIL_STORAGE_KEY = 'oms.customerSideRail.collapsed'
export const CUSTOMER_SIDE_RAIL_WIDTH_STORAGE_KEY = 'oms.customerSideRail.expandedWidth'
export type CustomerNavItem = {
id?: string | number
@ -215,6 +219,39 @@ export function writeCustomerSideRailCollapsed(collapsed: boolean) {
}
}
function clampCustomerSideRailWidth(width: number) {
return Math.min(
CUSTOMER_SIDE_RAIL_MAX_WIDTH,
Math.max(CUSTOMER_SIDE_RAIL_MIN_WIDTH, Math.round(width)),
)
}
/** 读取用户拖拽后的展开宽;无记录则用默认 */
export function readCustomerSideRailExpandedWidth(
fallback = CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH,
): number {
try {
const raw = localStorage.getItem(CUSTOMER_SIDE_RAIL_WIDTH_STORAGE_KEY)
if (raw == null || raw === '') return clampCustomerSideRailWidth(fallback)
const n = Number(raw)
if (!Number.isFinite(n)) return clampCustomerSideRailWidth(fallback)
return clampCustomerSideRailWidth(n)
} catch {
return clampCustomerSideRailWidth(fallback)
}
}
export function writeCustomerSideRailExpandedWidth(width: number) {
try {
localStorage.setItem(
CUSTOMER_SIDE_RAIL_WIDTH_STORAGE_KEY,
String(clampCustomerSideRailWidth(width)),
)
} catch {
// ignore
}
}
function navPriority(path: string): number {
if (!path) return 9999
const idx = CUSTOMER_TOP_NAV_PRIORITY_PATHS.findIndex(

View File

@ -1,9 +1,21 @@
<template>
<section class="h5-journey h5-enter">
<section class="h5-journey h5-enter" :class="{ 'is-open': expanded }">
<button type="button" class="h5-journey__summary" @click="expanded = !expanded">
<div class="h5-journey__summary-text">
<h3>{{ t('h5.journey.title') }}</h3>
<div class="h5-journey__title-row">
<h3>{{ t('h5.journey.title') }}</h3>
<span class="h5-journey__badge">{{ t('h5.journey.badge') }}</span>
</div>
<p>{{ t('h5.journey.lead') }}</p>
<div v-if="!expanded" class="h5-journey__chips" aria-hidden="true">
<span
v-for="(step, index) in steps"
:key="step.key"
class="h5-journey__chip"
>
{{ index + 1 }}.{{ t(step.shortKey) }}
</span>
</div>
</div>
<span class="h5-journey__toggle">
{{ expanded ? t('h5.journey.collapse') : t('h5.journey.expand') }}
@ -17,8 +29,10 @@
:key="step.key"
class="h5-journey__step"
>
<span class="h5-journey__rail" aria-hidden="true">
<i class="h5-journey__dot">{{ index + 1 }}</i>
</span>
<button type="button" class="h5-journey__main" @click="onStep(step)">
<span class="h5-journey__index">{{ index + 1 }}</span>
<span class="h5-journey__icon">
<component :is="step.icon" />
</span>
@ -81,6 +95,7 @@ type StepKey = 'price' | 'warehouse' | 'ship' | 'order' | 'pay' | 'done';
type Step = {
key: StepKey;
titleKey: string;
shortKey: string;
hintKey: string;
icon: Component;
action: 'route' | 'warehouse' | 'ship' | 'placeOrder';
@ -118,6 +133,7 @@ const steps: Step[] = [
{
key: 'price',
titleKey: 'h5.journey.step.price',
shortKey: 'h5.journey.step.priceShort',
hintKey: 'h5.journey.step.priceHint',
icon: IconSearch,
action: 'route',
@ -126,6 +142,7 @@ const steps: Step[] = [
{
key: 'warehouse',
titleKey: 'h5.journey.step.warehouse',
shortKey: 'h5.journey.step.warehouseShort',
hintKey: 'h5.journey.step.warehouseHint',
icon: IconHome,
action: 'warehouse',
@ -133,6 +150,7 @@ const steps: Step[] = [
{
key: 'order',
titleKey: 'h5.journey.step.order',
shortKey: 'h5.journey.step.orderShort',
hintKey: 'h5.journey.step.orderHint',
icon: IconPlus,
action: 'placeOrder',
@ -140,6 +158,7 @@ const steps: Step[] = [
{
key: 'ship',
titleKey: 'h5.journey.step.ship',
shortKey: 'h5.journey.step.shipShort',
hintKey: 'h5.journey.step.shipHint',
icon: IconSend,
action: 'ship',
@ -147,6 +166,7 @@ const steps: Step[] = [
{
key: 'pay',
titleKey: 'h5.journey.step.pay',
shortKey: 'h5.journey.step.payShort',
hintKey: 'h5.journey.step.payHint',
icon: IconSafe,
action: 'route',
@ -155,6 +175,7 @@ const steps: Step[] = [
{
key: 'done',
titleKey: 'h5.journey.step.done',
shortKey: 'h5.journey.step.doneShort',
hintKey: 'h5.journey.step.doneHint',
icon: IconCheckCircle,
action: 'route',
@ -215,20 +236,25 @@ function onStep(step: Step) {
<style lang="less" scoped>
.h5-journey {
margin-top: 16px;
padding: 6px 4px 10px;
overflow: hidden;
border-radius: 18px;
background: #fff;
background:
radial-gradient(
120% 80% at 100% 0%,
color-mix(in srgb, var(--app-primary-color) 10%, transparent),
transparent 55%
),
#fff;
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}
.h5-journey__summary {
width: 100%;
display: flex;
align-items: center;
align-items: flex-start;
justify-content: space-between;
gap: 10px;
min-height: 72px;
padding: 16px 14px 14px;
padding: 14px 14px 12px;
border: none;
background: transparent;
text-align: left;
@ -237,29 +263,66 @@ function onStep(step: Step) {
.h5-journey__summary-text {
min-width: 0;
flex: 1;
}
.h5-journey__title-row {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 4px;
h3 {
margin: 0 0 6px;
font-size: 16px;
font-weight: 700;
color: #1d2129;
}
p {
margin: 0;
font-size: 13px;
color: #86909c;
line-height: 1.5;
font-size: 16px;
font-weight: 750;
color: #1d1d1f;
}
}
.h5-journey__badge {
flex-shrink: 0;
padding: 2px 7px;
border-radius: 999px;
background: color-mix(in srgb, var(--app-primary-color) 12%, #fff);
color: var(--app-primary-color);
font-size: 10px;
font-weight: 700;
line-height: 1.3;
}
.h5-journey__summary-text p {
margin: 0;
font-size: 12px;
color: #86909c;
line-height: 1.45;
}
.h5-journey__chips {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: 10px;
}
.h5-journey__chip {
padding: 4px 8px;
border-radius: 999px;
background: #f2f3f5;
color: #4e5969;
font-size: 11px;
font-weight: 600;
line-height: 1.2;
}
.h5-journey__toggle {
flex-shrink: 0;
display: inline-flex;
align-items: center;
gap: 2px;
margin-top: 2px;
font-size: 12px;
font-weight: 600;
font-weight: 650;
color: var(--app-primary-color);
:deep(.arco-icon) {
@ -274,54 +337,96 @@ function onStep(step: Step) {
.h5-journey__flow {
list-style: none;
margin: 0;
padding: 0 8px 8px;
padding: 2px 12px 14px;
display: flex;
flex-direction: column;
gap: 8px;
}
.h5-journey__step {
position: relative;
display: flex;
align-items: stretch;
gap: 10px;
min-height: 58px;
&:not(:last-child) .h5-journey__rail::after {
content: '';
position: absolute;
top: 28px;
bottom: -6px;
left: 50%;
width: 2px;
transform: translateX(-50%);
background: linear-gradient(
180deg,
color-mix(in srgb, var(--app-primary-color) 35%, #e5e6eb),
#eef0f3
);
}
}
.h5-journey__rail {
position: relative;
flex-shrink: 0;
width: 24px;
display: flex;
justify-content: center;
padding-top: 14px;
}
.h5-journey__dot {
position: relative;
z-index: 1;
width: 22px;
height: 22px;
border-radius: 50%;
background: var(--app-primary-color);
color: #fff;
font-size: 11px;
font-weight: 750;
font-style: normal;
display: inline-flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 10px color-mix(in srgb, var(--app-primary-color) 28%, transparent);
}
.h5-journey__main {
width: 100%;
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 10px;
padding: 12px;
border: 1px solid #eef0f3;
margin-bottom: 8px;
padding: 10px 10px 10px 8px;
border: none;
border-radius: 14px;
background: #fafbfc;
background: color-mix(in srgb, var(--app-primary-color) 4%, #f7f8fa);
text-align: left;
cursor: pointer;
&:active {
opacity: 0.92;
transform: scale(0.99);
}
}
.h5-journey__index {
width: 22px;
height: 22px;
border-radius: 50%;
background: #e5e6eb;
color: #4e5969;
font-size: 12px;
font-weight: 700;
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
.h5-journey__step:last-child .h5-journey__main {
margin-bottom: 0;
}
.h5-journey__icon {
width: 34px;
height: 34px;
border-radius: 10px;
background: color-mix(in srgb, var(--app-primary-color) 12%, #fff);
background: #fff;
color: var(--app-primary-color);
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 18px;
font-size: 17px;
flex-shrink: 0;
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.h5-journey__text {
@ -333,8 +438,8 @@ function onStep(step: Step) {
strong {
font-size: 14px;
font-weight: 600;
color: #1d2129;
font-weight: 700;
color: #1d1d1f;
}
em {

View File

@ -6,143 +6,552 @@
:footer="false"
:header="false"
unmount-on-close
:mask-closable="true"
:mask-closable="!busy"
:esc-to-close="!busy"
:drawer-style="drawerStyle"
popup-container="body"
class="h5-openapi-drawer"
@cancel="close"
@update:visible="(v: boolean) => emit('update:visible', v)"
>
<div class="h5-openapi">
<div class="h5-openapi__handle" aria-hidden="true" />
<header class="h5-openapi__head">
<h3>{{ t('h5.me.openapi') }}</h3>
<div class="h5-openapi__tools">
<button
v-if="openapiHasCredential"
type="button"
class="h5-openapi__tool"
:disabled="openapiBusy"
:title="t('user.customer.openapi.resetSecret')"
:aria-label="t('user.customer.openapi.resetSecret')"
@click="openapiPanelRef?.resetSecret()"
>
<icon-refresh />
</button>
<button type="button" class="h5-openapi__close" @click="close">
<icon-close />
</button>
<div class="h5-openapi__titles">
<h3>{{ t('h5.me.openapi') }}</h3>
<p>{{ t('h5.me.openapiHint') }}</p>
</div>
<button
type="button"
class="h5-openapi__close"
:disabled="busy"
:aria-label="t('h5.orders.detail.close')"
@click="close"
>
<icon-close />
</button>
</header>
<div class="h5-openapi__body">
<CustomerOpenApiCredentialPanel
v-if="visible"
ref="openapiPanelRef"
@status="onOpenapiStatus"
/>
<a-spin :loading="loading" class="h5-openapi__spin">
<div v-if="!loading && !credential.hasCredential" class="h5-openapi-empty">
<p class="h5-openapi-empty__text">{{ t('user.customer.openapi.empty') }}</p>
<p class="h5-openapi-empty__hint">{{ t('h5.me.openapiEmptyHint') }}</p>
<button
type="button"
class="h5-openapi__btn h5-openapi__btn--primary"
:disabled="busy"
@click="handleEnsure"
>
<span v-if="busy" class="h5-openapi__spinner" aria-hidden="true" />
{{ t('user.customer.openapi.generate') }}
</button>
</div>
<template v-else-if="credential.hasCredential">
<section class="h5-openapi-card">
<div class="h5-openapi-row">
<div class="h5-openapi-row__main">
<span class="h5-openapi-row__label">{{ t('user.customer.openapi.appKey') }}</span>
<code class="h5-openapi-row__value">{{ credential.appKey || '—' }}</code>
</div>
<button
type="button"
class="h5-openapi-row__act"
:disabled="!credential.appKey"
@click="copyText(credential.appKey)"
>
{{ t('user.customer.openapi.copy') }}
</button>
</div>
<div class="h5-openapi-row">
<div class="h5-openapi-row__main">
<span class="h5-openapi-row__label">
{{ t('user.customer.openapi.appSecret') }}
</span>
<code class="h5-openapi-row__value" :class="{ 'is-warn': credential.secretRevealed }">
{{ secretDisplay }}
</code>
<em class="h5-openapi-row__tip">
{{
credential.secretRevealed
? t('user.customer.openapi.secretOnce')
: t('user.customer.openapi.secretMasked')
}}
</em>
</div>
<button
v-if="credential.secretRevealed"
type="button"
class="h5-openapi-row__act"
:disabled="!credential.appSecret"
@click="copyText(credential.appSecret)"
>
{{ t('user.customer.openapi.copy') }}
</button>
</div>
</section>
<section class="h5-openapi-card h5-openapi-card--switch">
<div class="h5-openapi-switch">
<div>
<strong>{{ t('user.customer.openapi.enabled') }}</strong>
<p>
{{
credential.enabled
? t('h5.me.openapiEnabledOn')
: t('h5.me.openapiEnabledOff')
}}
</p>
</div>
<a-switch
:model-value="Boolean(credential.enabled)"
:loading="busy"
@change="onEnabledChange"
/>
</div>
</section>
<section v-if="credential.lastUsedAt" class="h5-openapi-meta">
<span>{{ t('user.customer.openapi.lastUsed') }}</span>
<strong>
{{ credential.lastUsedAt }}
<template v-if="credential.lastUsedIp"> · {{ credential.lastUsedIp }}</template>
</strong>
</section>
<button
type="button"
class="h5-openapi__btn h5-openapi__btn--ghost"
:disabled="busy"
@click="handleReset"
>
{{ t('user.customer.openapi.resetSecret') }}
</button>
</template>
</a-spin>
</div>
</div>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { IconClose, IconRefresh } from '@arco-design/web-vue/es/icon'
import CustomerOpenApiCredentialPanel from '@/views/user/customer/components/CustomerOpenApiCredentialPanel.vue'
import { computed, reactive, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { Message, Modal } from '@arco-design/web-vue';
import { IconClose } from '@arco-design/web-vue/es/icon';
import type { CustomerOpenApiCredentialDto } from '@/api/customer';
import { CustomerService } from '@/api/customer';
import { useRbacUserStore } from '@/store/modules/rbac-user';
defineOptions({ name: 'H5OpenApiCredentialSheet' })
defineOptions({ name: 'H5OpenApiCredentialSheet' });
defineProps<{
visible: boolean
}>()
const props = defineProps<{
visible: boolean;
}>();
const emit = defineEmits<{
'update:visible': [value: boolean]
}>()
'update:visible': [value: boolean];
}>();
const { t } = useI18n()
const openapiPanelRef = ref<{ resetSecret: () => void } | null>(null)
const openapiHasCredential = ref(false)
const openapiBusy = ref(false)
const { t } = useI18n();
const rbacUserStore = useRbacUserStore();
function onOpenapiStatus(payload: { hasCredential: boolean; busy: boolean }) {
openapiHasCredential.value = payload.hasCredential
openapiBusy.value = payload.busy
}
const loading = ref(false);
const busy = ref(false);
const credential = reactive<CustomerOpenApiCredentialDto>({
hasCredential: false,
enabled: false,
appKey: '',
appSecret: '',
secretRevealed: false,
});
const drawerStyle = {
borderRadius: '20px 20px 0 0',
overflow: 'hidden',
maxHeight: 'min(92vh, 780px)',
}
maxHeight: 'min(78vh, 560px)',
};
const secretDisplay = computed(() => {
if (credential.secretRevealed) return credential.appSecret || '—';
if (!credential.appSecret) return '••••••••••••••••';
return credential.appSecret;
});
function close() {
emit('update:visible', false)
if (busy.value) return;
emit('update:visible', false);
}
function canCallMineApi() {
return rbacUserStore.isCustomerPortal();
}
function applyCredential(data: CustomerOpenApiCredentialDto) {
Object.assign(credential, {
id: data.id,
customerId: data.customerId,
appKey: data.appKey ?? '',
appSecret: data.appSecret ?? '',
enabled: Boolean(data.enabled),
hasCredential: Boolean(data.hasCredential),
secretRevealed: Boolean(data.secretRevealed),
lastUsedAt: data.lastUsedAt,
lastUsedIp: data.lastUsedIp,
createTime: data.createTime,
updateTime: data.updateTime,
});
}
async function load() {
if (!canCallMineApi()) return;
loading.value = true;
try {
const data = await CustomerService.getOpenApiCredential();
applyCredential(data);
} catch (e: any) {
Message.error(e?.message || t('user.customer.openapi.loadFailed'));
} finally {
loading.value = false;
}
}
async function handleEnsure() {
if (!canCallMineApi() || busy.value) return;
busy.value = true;
try {
const data = await CustomerService.ensureOpenApiCredential();
applyCredential(data);
if (data.secretRevealed) {
Message.success(t('user.customer.openapi.generateSuccess'));
}
} catch (e: any) {
Message.error(e?.message || t('user.customer.openapi.generateFailed'));
} finally {
busy.value = false;
}
}
function handleReset() {
Modal.confirm({
title: t('user.customer.openapi.resetConfirmTitle'),
content: t('user.customer.openapi.resetConfirmContent'),
onOk: async () => {
if (!canCallMineApi()) return;
busy.value = true;
try {
const data = await CustomerService.resetOpenApiSecret();
applyCredential(data);
Message.success(t('user.customer.openapi.resetSuccess'));
} catch (e: any) {
Message.error(e?.message || t('user.customer.openapi.resetFailed'));
} finally {
busy.value = false;
}
},
});
}
async function onEnabledChange(value: string | number | boolean) {
if (!canCallMineApi()) return;
const enabled = Boolean(value);
busy.value = true;
try {
const data = await CustomerService.setOpenApiEnabled(enabled);
applyCredential(data);
Message.success(
enabled
? t('user.customer.openapi.enableSuccess')
: t('user.customer.openapi.disableSuccess'),
);
} catch (e: any) {
Message.error(e?.message || t('user.customer.openapi.setEnabledFailed'));
} finally {
busy.value = false;
}
}
async function copyText(text?: string | null) {
if (!text) return;
try {
await navigator.clipboard.writeText(text);
Message.success(t('user.customer.openapi.copySuccess'));
} catch {
Message.error(t('user.customer.openapi.copyFailed'));
}
}
watch(
() => props.visible,
(v) => {
if (v) {
void load();
}
},
);
</script>
<style scoped>
<style lang="less" scoped>
.h5-openapi {
padding: 8px 16px 24px;
display: flex;
flex-direction: column;
padding: 0 16px calc(14px + env(safe-area-inset-bottom, 0px));
color: #1d1d1f;
}
.h5-openapi__handle {
width: 36px;
height: 4px;
margin: 4px auto 12px;
margin: 8px auto 4px;
border-radius: 999px;
background: rgba(0, 0, 0, 0.12);
background: #d2d2d7;
}
.h5-openapi__head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
align-items: flex-start;
gap: 12px;
padding: 8px 0 12px;
}
.h5-openapi__head h3 {
margin: 0;
font-size: 17px;
font-weight: 600;
.h5-openapi__titles {
flex: 1;
min-width: 0;
h3 {
margin: 0;
font-size: 17px;
font-weight: 750;
letter-spacing: -0.01em;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 1.45;
color: #86868b;
}
}
.h5-openapi__tools {
display: inline-flex;
align-items: center;
gap: 2px;
}
.h5-openapi__tool,
.h5-openapi__close {
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
margin: 0;
border: none;
border-radius: 8px;
background: transparent;
padding: 0;
color: var(--color-text-2);
font-size: 16px;
border-radius: 50%;
background: #f2f2f7;
color: #3a3a3c;
cursor: pointer;
}
.h5-openapi__tool:hover:not(:disabled),
.h5-openapi__close:hover {
color: var(--app-primary-color);
background: color-mix(in srgb, var(--app-primary-color) 8%, transparent);
}
.h5-openapi__tool:disabled {
opacity: 0.5;
cursor: not-allowed;
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
.h5-openapi__body {
max-height: min(70vh, 560px);
max-height: min(58vh, 420px);
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.h5-openapi__spin {
width: 100%;
min-height: 120px;
}
.h5-openapi-empty {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 8px;
padding: 8px 0 4px;
text-align: center;
}
.h5-openapi-empty__text {
margin: 0;
font-size: 14px;
font-weight: 650;
color: #3a3a3c;
}
.h5-openapi-empty__hint {
margin: 0 0 8px;
font-size: 12px;
line-height: 1.5;
color: #86868b;
}
.h5-openapi-card {
margin-bottom: 10px;
padding: 4px 14px;
border-radius: 16px;
background: #fff;
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.h5-openapi-card--switch {
padding: 14px;
}
.h5-openapi-row {
display: flex;
align-items: flex-start;
gap: 10px;
padding: 12px 0;
border-bottom: 1px solid #f2f2f7;
&:last-child {
border-bottom: none;
}
}
.h5-openapi-row__main {
flex: 1;
min-width: 0;
}
.h5-openapi-row__label {
display: block;
margin-bottom: 4px;
font-size: 12px;
font-weight: 650;
color: #86868b;
}
.h5-openapi-row__value {
display: block;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 13px;
font-weight: 600;
line-height: 1.4;
color: #1d1d1f;
word-break: break-all;
&.is-warn {
color: #c45c12;
}
}
.h5-openapi-row__tip {
display: block;
margin-top: 4px;
font-style: normal;
font-size: 11px;
line-height: 1.4;
color: #86868b;
}
.h5-openapi-row__act {
flex-shrink: 0;
height: 30px;
margin-top: 14px;
padding: 0 10px;
border: none;
border-radius: 999px;
background: color-mix(in srgb, var(--app-primary-color, #023e8a) 10%, #fff);
color: var(--app-primary-color, #023e8a);
font-size: 12px;
font-weight: 700;
cursor: pointer;
&:disabled {
opacity: 0.45;
cursor: not-allowed;
}
}
.h5-openapi-switch {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
strong {
display: block;
font-size: 14px;
font-weight: 700;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 1.4;
color: #86868b;
}
}
.h5-openapi-meta {
display: flex;
flex-direction: column;
gap: 4px;
margin: 2px 2px 12px;
font-size: 12px;
color: #86868b;
strong {
font-size: 12px;
font-weight: 600;
color: #3a3a3c;
word-break: break-all;
}
}
.h5-openapi__btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
width: 100%;
min-height: 44px;
border: none;
border-radius: 12px;
font-size: 15px;
font-weight: 700;
cursor: pointer;
&:disabled {
opacity: 0.55;
cursor: not-allowed;
}
}
.h5-openapi__btn--primary {
background: var(--app-primary-color, #023e8a);
color: #fff;
}
.h5-openapi__btn--ghost {
background: #f2f2f7;
color: #3a3a3c;
font-weight: 650;
}
.h5-openapi__spinner {
width: 14px;
height: 14px;
border: 2px solid rgba(255, 255, 255, 0.35);
border-top-color: #fff;
border-radius: 50%;
animation: h5-openapi-spin 0.7s linear infinite;
}
@keyframes h5-openapi-spin {
to {
transform: rotate(360deg);
}
}
</style>
<style lang="less">
.h5-openapi-drawer.arco-drawer-bottom .arco-drawer-body {
padding: 0;
}
</style>

View File

@ -2,6 +2,7 @@
import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { Message } from '@arco-design/web-vue';
import { IconClose } from '@arco-design/web-vue/es/icon';
import { rebindOpenidByPhone, type WxLoginResult } from '@/api/wechat';
defineOptions({ name: 'WechatOpenidMigrateModal' });
@ -22,12 +23,16 @@ const { t } = useI18n();
const phone = ref('');
const submitting = ref(false);
const tip = computed(() =>
t('wechat.openidMigrate.tip', {
nickname: props.nickname?.trim() || t('wechat.register.wxUser'),
}),
const displayName = computed(
() => props.nickname?.trim() || t('wechat.register.wxUser'),
);
const drawerStyle = {
borderRadius: '20px 20px 0 0',
overflow: 'hidden',
maxHeight: 'min(72vh, 420px)',
};
watch(
() => props.visible,
(v) => {
@ -39,6 +44,7 @@ watch(
);
function close() {
if (submitting.value) return;
emit('update:visible', false);
}
@ -47,16 +53,17 @@ function handleCancel() {
emit('cancel');
}
async function handleBeforeOk(): Promise<boolean> {
async function submit() {
if (submitting.value) return;
const ticket = props.ticket?.trim();
const phoneVal = phone.value.trim();
if (!ticket) {
Message.error(t('wechat.openidMigrate.ticketExpired'));
return false;
return;
}
if (!phoneVal) {
Message.warning(t('wechat.openidMigrate.phoneRequired'));
return false;
return;
}
submitting.value = true;
@ -64,13 +71,12 @@ async function handleBeforeOk(): Promise<boolean> {
const result = await rebindOpenidByPhone({ ticket, phone: phoneVal });
if (!result?.accessToken) {
Message.error(t('wechat.openidMigrate.failed'));
return false;
return;
}
emit('success', result);
return true;
emit('update:visible', false);
} catch (e: any) {
Message.error(e?.message || t('wechat.openidMigrate.failed'));
return false;
} finally {
submitting.value = false;
}
@ -78,35 +84,275 @@ async function handleBeforeOk(): Promise<boolean> {
</script>
<template>
<a-modal
<a-drawer
:visible="visible"
:title="t('wechat.openidMigrate.title')"
:ok-text="t('wechat.openidMigrate.confirm')"
:cancel-text="t('wechat.openidMigrate.cancel')"
:ok-loading="submitting"
placement="bottom"
height="auto"
:footer="false"
:header="false"
unmount-on-close
:mask-closable="false"
:on-before-ok="handleBeforeOk"
@update:visible="(v: boolean) => emit('update:visible', v)"
:mask-closable="!submitting"
:esc-to-close="!submitting"
:drawer-style="drawerStyle"
popup-container="body"
class="wx-openid-migrate-drawer"
@cancel="handleCancel"
@update:visible="(v: boolean) => emit('update:visible', v)"
>
<p class="wx-openid-migrate__tip">{{ tip }}</p>
<a-input
v-model="phone"
size="large"
allow-clear
:placeholder="t('wechat.openidMigrate.phonePlaceholder')"
maxlength="16"
@press-enter="handleOk"
/>
</a-modal>
<div class="wx-openid-migrate">
<div class="wx-openid-migrate__handle" aria-hidden="true" />
<header class="wx-openid-migrate__head">
<div class="wx-openid-migrate__head-text">
<h3>{{ t('wechat.openidMigrate.title') }}</h3>
<p class="wx-openid-migrate__sub">
{{ t('wechat.openidMigrate.subtitle') }}
</p>
</div>
<button
type="button"
class="wx-openid-migrate__close"
:disabled="submitting"
:aria-label="t('wechat.openidMigrate.cancel')"
@click="handleCancel"
>
<icon-close />
</button>
</header>
<div class="wx-openid-migrate__body">
<div class="wx-openid-migrate__chip" :title="displayName">
<span class="wx-openid-migrate__chip-label">
{{ t('wechat.openidMigrate.nicknameLabel') }}
</span>
<strong class="wx-openid-migrate__chip-name">{{ displayName }}</strong>
</div>
<p class="wx-openid-migrate__tip">{{ t('wechat.openidMigrate.tip') }}</p>
<label class="wx-openid-migrate__field">
<span class="wx-openid-migrate__field-label">
{{ t('wechat.openidMigrate.phoneLabel') }}
</span>
<a-input
v-model="phone"
size="large"
allow-clear
inputmode="tel"
autocomplete="tel"
:disabled="submitting"
:placeholder="t('wechat.openidMigrate.phonePlaceholder')"
maxlength="16"
@press-enter="submit"
/>
</label>
</div>
<footer class="wx-openid-migrate__foot">
<button
type="button"
class="wx-openid-migrate__btn wx-openid-migrate__btn--ghost"
:disabled="submitting"
@click="handleCancel"
>
{{ t('wechat.openidMigrate.cancel') }}
</button>
<button
type="button"
class="wx-openid-migrate__btn wx-openid-migrate__btn--primary"
:disabled="submitting"
@click="submit"
>
<span v-if="submitting" class="wx-openid-migrate__spinner" aria-hidden="true" />
{{ t('wechat.openidMigrate.confirm') }}
</button>
</footer>
</div>
</a-drawer>
</template>
<style lang="less" scoped>
.wx-openid-migrate__tip {
margin: 0 0 12px;
.wx-openid-migrate {
display: flex;
flex-direction: column;
gap: 0;
padding: 0 16px calc(14px + env(safe-area-inset-bottom, 0px));
color: #1d1d1f;
}
.wx-openid-migrate__handle {
width: 36px;
height: 4px;
margin: 8px auto 4px;
border-radius: 999px;
background: #d2d2d7;
}
.wx-openid-migrate__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 8px 0 12px;
}
.wx-openid-migrate__head-text {
flex: 1;
min-width: 0;
}
.wx-openid-migrate__head h3 {
margin: 0;
font-size: 17px;
font-weight: 700;
line-height: 1.3;
letter-spacing: -0.01em;
}
.wx-openid-migrate__sub {
margin: 4px 0 0;
font-size: 12px;
line-height: 1.4;
color: #86868b;
}
.wx-openid-migrate__close {
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
margin-top: -2px;
border: none;
border-radius: 50%;
background: #f2f2f7;
color: #3a3a3c;
cursor: pointer;
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
.wx-openid-migrate__body {
display: flex;
flex-direction: column;
gap: 12px;
padding-bottom: 16px;
}
.wx-openid-migrate__chip {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
padding: 10px 12px;
border-radius: 12px;
background: color-mix(in srgb, var(--app-primary-color, #023e8a) 8%, #fff);
border: 1px solid color-mix(in srgb, var(--app-primary-color, #023e8a) 14%, #e5e5ea);
}
.wx-openid-migrate__chip-label {
flex-shrink: 0;
font-size: 12px;
color: #6e6e73;
}
.wx-openid-migrate__chip-name {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 14px;
font-weight: 700;
color: var(--app-primary-color, #023e8a);
}
.wx-openid-migrate__tip {
margin: 0;
font-size: 13px;
line-height: 1.5;
color: var(--color-text-2);
color: #3a3a3c;
}
.wx-openid-migrate__field {
display: flex;
flex-direction: column;
gap: 6px;
}
.wx-openid-migrate__field-label {
font-size: 12px;
font-weight: 600;
color: #6e6e73;
}
.wx-openid-migrate__field :deep(.arco-input-wrapper) {
min-height: 44px;
border-radius: 12px;
background: #f5f5f7;
border-color: transparent;
&:hover,
&.arco-input-wrapper-focus {
background: #fff;
border-color: color-mix(in srgb, var(--app-primary-color, #023e8a) 45%, #d2d2d7);
}
}
.wx-openid-migrate__foot {
display: grid;
grid-template-columns: 1fr 1.35fr;
gap: 10px;
padding-top: 4px;
}
.wx-openid-migrate__btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 44px;
padding: 0 14px;
border: none;
border-radius: 12px;
font-size: 15px;
font-weight: 600;
cursor: pointer;
&:disabled {
opacity: 0.55;
cursor: not-allowed;
}
}
.wx-openid-migrate__btn--ghost {
background: #f2f2f7;
color: #3a3a3c;
}
.wx-openid-migrate__btn--primary {
background: var(--app-primary-color, #023e8a);
color: #fff;
}
.wx-openid-migrate__spinner {
width: 14px;
height: 14px;
border: 2px solid rgba(255, 255, 255, 0.35);
border-top-color: #fff;
border-radius: 50%;
animation: wx-openid-migrate-spin 0.7s linear infinite;
}
@keyframes wx-openid-migrate-spin {
to {
transform: rotate(360deg);
}
}
</style>
<style lang="less">
.wx-openid-migrate-drawer.arco-drawer-bottom .arco-drawer-body {
padding: 0;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -397,6 +397,7 @@ export default {
'h5.invoice.apply': 'Request invoice',
'h5.invoice.profiles': 'Titles',
'h5.invoice.empty': 'No invoice applies yet',
'h5.invoice.emptyHint': 'Add a title first, then select billable items to apply',
'h5.invoice.submit': 'Submit',
'h5.invoice.needProfile': 'Enter invoice title and tax no.',
'h5.invoice.needLines': 'Select invoice lines',
@ -405,7 +406,16 @@ export default {
'h5.invoice.loadMore': 'Load more',
'h5.invoice.selectableEmpty': 'No billable sources',
'h5.invoice.selectedAmount': 'Selected total',
'h5.invoice.selectedCount': '{count} selected',
'h5.invoice.back': 'Back',
'h5.invoice.profilesEmpty': 'No invoice titles yet',
'h5.invoice.profilesHint': 'Titles are used for invoicing. You can set a default.',
'h5.invoice.applyHint': 'Pick a title and lines to submit. E-invoices appear in detail when issued.',
'h5.invoice.sectionProfile': 'Invoice info',
'h5.invoice.sectionLines': 'Lines',
'h5.invoice.detailLines': 'Lines',
'h5.invoice.no': 'Apply no.',
'h5.invoice.taxNoShort': 'Tax no.',
'h5.orderType.title': 'Choose order type',
'h5.orderType.subtitle': 'Select the type of order to create',
@ -727,17 +737,17 @@ export default {
'h5.placeOrder.err.platformCode': 'Enter ecommerce platform for summary mode',
'h5.me.coupons': 'Coupons',
'h5.me.couponsDesc': 'Save with coupons',
'h5.me.couponsDescReady': '{count} ready',
'h5.me.couponsDesc': 'Ship for less',
'h5.me.couponsDescReady': '{count} ready to use',
'h5.me.storeOrders': 'Store orders',
'h5.me.storeOrdersDesc': 'Pull & fulfill',
'h5.me.storeOrdersDesc': 'Pull & fulfill fast',
'h5.me.opening': 'Loading…',
'h5.me.openFailed': 'Failed to open, please retry',
'h5.me.invite': 'Invite',
'h5.me.inviteDesc': 'Invite & earn',
'h5.me.inviteDesc': 'Invite, both earn',
'h5.me.commission': 'Commission',
'h5.me.commissionDesc': 'Withdraw / balance',
'h5.me.invoice': 'Invoice',
'h5.me.commissionDesc': 'Cash out or wallet',
'h5.me.invoice': 'Invoice management',
'h5.me.placeOrder': 'Order',
'h5.me.placeOrderDesc': 'Ship in a few taps',
'h5.me.section.services': 'Services',
@ -908,20 +918,26 @@ export default {
'h5.journey.collapse': 'Collapse',
'h5.journey.summaryPay': '{count} pending payment(s) — expand to continue',
'h5.journey.payCta': 'Pay {count} order(s)',
'h5.journey.badge': 'For you',
'h5.journey.badge': 'Starter',
'h5.journey.tip': 'Tip: create a logistics order first, then ship or request pickup. Pending payments highlight “Pay”.',
'h5.journey.step.price': 'Get a quote',
'h5.journey.step.priceHint': 'Pick country & weight, compare first',
'h5.journey.step.priceShort': 'Quote',
'h5.journey.step.priceHint': 'Compare by country & weight first',
'h5.journey.step.warehouse': 'Warehouse address',
'h5.journey.step.warehouseHint': 'Copy recipient / phone / address',
'h5.journey.step.warehouseShort': 'Warehouse',
'h5.journey.step.warehouseHint': 'Copy address for inbound shipping',
'h5.journey.step.order': 'Create logistics order',
'h5.journey.step.orderShort': 'Order',
'h5.journey.step.orderHint': 'Fill receiver & declaration',
'h5.journey.step.ship': 'Pickup / ship to warehouse',
'h5.journey.step.shipHint': 'After ordering: self-ship or request pickup',
'h5.journey.step.shipShort': 'Pickup',
'h5.journey.step.shipHint': 'Self-ship or request door pickup',
'h5.journey.step.pay': 'Pay freight',
'h5.journey.step.payHint': 'Pay pending orders with balance',
'h5.journey.step.payShort': 'Pay',
'h5.journey.step.payHint': 'Pay pending freight with balance',
'h5.journey.step.done': 'Track & deliver',
'h5.journey.step.doneHint': 'Follow tracking until signed',
'h5.journey.step.doneShort': 'Deliver',
'h5.journey.step.doneHint': 'Track until delivery is signed',
'h5.journey.warehouse.title': 'Warehouse addresses',
'h5.journey.warehouse.lead': 'Ship to these warehouses and note your customer code for inbound.',
@ -1138,10 +1154,15 @@ export default {
'h5.me.addressManage': 'Addresses',
'h5.me.resetPassword': 'Change password',
'h5.me.openapi': 'Open API credentials',
'h5.me.openapiHint': 'For ERP machine-to-machine access. Keep secrets safe.',
'h5.me.openapiEmptyHint':
'Copy and save AppSecret right after generation. Full secret won’t show again.',
'h5.me.openapiEnabledOn': 'API calls are allowed',
'h5.me.openapiEnabledOff': 'Disabled. Integrators cannot call the API',
'h5.me.language': 'Switch language',
'h5.me.followOfficial': 'Follow official account',
'h5.me.followOfficialMissing': 'Official account link is not configured. Please contact support.',
'h5.me.wechatNotify': 'Order alerts',
'h5.me.wechatNotify': 'Subscriptions',
'h5.me.wechatNotifyTip':
'Off by default. Enable WeChat templates and/or email per event. Email goes to your profile address.',
'h5.me.wechatNotifyNeedBind': 'Bind WeChat before enabling WeChat alerts',

View File

@ -395,6 +395,7 @@ export default {
'h5.invoice.apply': '申请开票',
'h5.invoice.profiles': '抬头',
'h5.invoice.empty': '暂无开票申请',
'h5.invoice.emptyHint': '先维护发票抬头,再选择可开票费用提交申请',
'h5.invoice.submit': '提交申请',
'h5.invoice.needProfile': '请填写发票抬头和税号',
'h5.invoice.needLines': '请选择开票明细',
@ -403,7 +404,16 @@ export default {
'h5.invoice.loadMore': '加载更多',
'h5.invoice.selectableEmpty': '暂无可开票来源',
'h5.invoice.selectedAmount': '已选合计',
'h5.invoice.selectedCount': '已选 {count} 笔',
'h5.invoice.back': '返回',
'h5.invoice.profilesEmpty': '还没有发票抬头',
'h5.invoice.profilesHint': '抬头用于开票,可设一个默认项',
'h5.invoice.applyHint': '选择抬头与明细后提交,电子发票开出后可在详情查看',
'h5.invoice.sectionProfile': '发票信息',
'h5.invoice.sectionLines': '开票明细',
'h5.invoice.detailLines': '明细',
'h5.invoice.no': '申请单号',
'h5.invoice.taxNoShort': '税号',
'h5.orderType.title': '选择下单类型',
'h5.orderType.subtitle': '请先选择要创建的订单类型',
@ -713,17 +723,17 @@ export default {
'h5.placeOrder.err.platformCode': '汇总申报请填写电商平台',
'h5.me.coupons': '优惠券',
'h5.me.couponsDesc': '领券更省',
'h5.me.couponsDescReady': '{count} 张待用',
'h5.me.couponsDesc': '领券寄件更划算',
'h5.me.couponsDescReady': '{count}张券待使用',
'h5.me.storeOrders': '店铺订单',
'h5.me.storeOrdersDesc': '拉单与履约',
'h5.me.storeOrdersDesc': '一键拉单快速履约',
'h5.me.opening': '加载中…',
'h5.me.openFailed': '打开失败,请重试',
'h5.me.invite': '邀请好友',
'h5.me.inviteDesc': '邀友有礼',
'h5.me.inviteDesc': '邀友双方都有奖',
'h5.me.commission': '佣金',
'h5.me.commissionDesc': '提现/转余额',
'h5.me.invoice': '开票',
'h5.me.commissionDesc': '收益提现转余额',
'h5.me.invoice': '开票管理',
'h5.me.placeOrder': '去下单',
'h5.me.placeOrderDesc': '填好收件,一键寄出',
'h5.me.section.services': '常用服务',
@ -893,20 +903,26 @@ export default {
'h5.journey.collapse': '收起',
'h5.journey.summaryPay': '有 {count} 笔待支付,点展开按步骤处理',
'h5.journey.payCta': '去支付 {count} 笔订单',
'h5.journey.badge': '客户视角',
'h5.journey.badge': '新手必看',
'h5.journey.tip': '提示:先创建物流单,再寄仓或预约揽收;待支付会高亮「去支付」。',
'h5.journey.step.price': '查价格',
'h5.journey.step.priceHint': '选国家、重量,先比价再决定',
'h5.journey.step.priceShort': '查价',
'h5.journey.step.priceHint': '选国家重量,先比价再下单',
'h5.journey.step.warehouse': '查看仓库地址',
'h5.journey.step.warehouseHint': '复制收件人/电话/地址,寄仓用',
'h5.journey.step.warehouseShort': '仓库',
'h5.journey.step.warehouseHint': '一键复制收件信息寄仓',
'h5.journey.step.order': '创建物流订单',
'h5.journey.step.orderShort': '下单',
'h5.journey.step.orderHint': '填写收件人与申报信息',
'h5.journey.step.ship': '揽收寄仓',
'h5.journey.step.shipHint': '订单创建后,自寄或预约上门揽收',
'h5.journey.step.shipShort': '揽收',
'h5.journey.step.shipHint': '自寄仓库或预约上门取件',
'h5.journey.step.pay': '支付运费',
'h5.journey.step.payHint': '余额支付待处理订单',
'h5.journey.step.payShort': '支付',
'h5.journey.step.payHint': '余额支付待处理运费',
'h5.journey.step.done': '运输与签收',
'h5.journey.step.doneHint': '看轨迹,等到签收完成',
'h5.journey.step.doneShort': '签收',
'h5.journey.step.doneHint': '跟踪轨迹,等待签收完成',
'h5.journey.warehouse.title': '仓库地址',
'h5.journey.warehouse.lead': '把货寄到下列仓库地址,并备注你的客户编号,方便入库认领。',
@ -1123,10 +1139,14 @@ export default {
'h5.me.addressManage': '地址管理',
'h5.me.resetPassword': '修改密码',
'h5.me.openapi': '开放接口凭证',
'h5.me.openapiHint': '用于 ERP 机机对接,请妥善保管密钥',
'h5.me.openapiEmptyHint': '生成后请立即复制保存 AppSecret,关闭后将无法再查看完整密钥',
'h5.me.openapiEnabledOn': '接口可正常调用',
'h5.me.openapiEnabledOff': '已停用,对接方将无法调用',
'h5.me.language': '切换语言',
'h5.me.followOfficial': '关注公众号',
'h5.me.followOfficialMissing': '暂未配置公众号跳转链接,请联系客服',
'h5.me.wechatNotify': '订单通知',
'h5.me.wechatNotify': '订阅消息',
'h5.me.wechatNotifyTip':
'默认关闭。可按事件分别开启微信模板消息与邮件;邮件发至客户资料中的邮箱。',
'h5.me.wechatNotifyNeedBind': '请先绑定微信后再订阅微信通知',

View File

@ -101,29 +101,25 @@
<h2 class="h5-me-name">{{ displayName }}</h2>
<span class="h5-me-greet">{{ greetText }}</span>
</div>
<div class="h5-me-hero__meta">
<button
v-if="profile.customerCode"
type="button"
class="h5-me-code"
@click="copyText(profile.customerCode)"
>
{{ t('h5.me.customerCode') }} {{ profile.customerCode }}
<icon-copy />
</button>
<span v-if="profile.customerCode" class="h5-me-hero__dot" aria-hidden="true">·</span>
<span class="h5-me-balance__label">{{ t('h5.me.balance') }}</span>
<strong class="h5-me-balance__value">¥{{ formatMoney(accountBalance) }}</strong>
<button type="button" class="h5-me-recharge" @click="goRecharge">
{{ t('h5.me.recharge') }}
</button>
</div>
<button
v-if="profile.customerCode"
type="button"
class="h5-me-code"
@click="copyText(profile.customerCode)"
>
<span>{{ t('h5.me.customerCode') }} {{ profile.customerCode }}</span>
<icon-copy />
</button>
</div>
</div>
<div v-if="isLowBalance" class="h5-me-hero__low">
<span>{{ t('h5.me.lowBalance') }}</span>
<button type="button" class="h5-me-hero__low-cta" @click="goRecharge">
<div class="h5-me-wallet" :class="{ 'is-low': isLowBalance }">
<div class="h5-me-wallet__info">
<span class="h5-me-wallet__label">{{ t('h5.me.balance') }}</span>
<strong class="h5-me-wallet__value">¥{{ formatMoney(accountBalance) }}</strong>
<em v-if="isLowBalance" class="h5-me-wallet__warn">{{ t('h5.me.lowBalance') }}</em>
</div>
<button type="button" class="h5-me-wallet__cta" @click="goRecharge">
{{ t('h5.me.recharge') }}
</button>
</div>
@ -205,9 +201,11 @@
{{ item.badge > 99 ? '99+' : item.badge }}
</i>
</span>
<strong class="h5-me-services__label">{{ t(item.labelKey) }}</strong>
<span class="h5-me-services__text">
<strong class="h5-me-services__label">{{ t(item.labelKey) }}</strong>
<em class="h5-me-services__desc">{{ item.desc }}</em>
</span>
</span>
<em class="h5-me-services__desc">{{ item.desc }}</em>
</button>
</section>
@ -267,6 +265,13 @@
class="h5-me-list h5-me-enter"
style="--h5-me-delay: 280ms"
>
<button type="button" class="h5-me-list__item" @click="openWechatNotify">
<span class="h5-me-list__left">
<icon-notification class="h5-me-list__icon" />
{{ t('h5.me.wechatNotify') }}
</span>
<icon-right />
</button>
<button type="button" class="h5-me-list__item" @click="goInvoice">
<span class="h5-me-list__left">
<icon-file class="h5-me-list__icon" />
@ -305,13 +310,6 @@
</span>
<icon-right />
</button>
<button type="button" class="h5-me-list__item" @click="openWechatNotify">
<span class="h5-me-list__left">
<icon-notification class="h5-me-list__icon" />
{{ t('h5.me.wechatNotify') }}
</span>
<icon-right />
</button>
</section>
<button
@ -1245,10 +1243,13 @@ onActivated(() => {
display: flex;
flex-direction: column;
padding: 0;
overflow: visible;
border-radius: 16px;
background: #fff;
box-shadow: 0 4px 16px rgba(20, 38, 55, 0.05);
overflow: hidden;
border-radius: 18px;
background:
radial-gradient(120% 80% at 100% -10%, color-mix(in srgb, var(--me-teal) 16%, transparent), transparent 55%),
radial-gradient(90% 70% at -10% 0%, color-mix(in srgb, var(--me-ink) 8%, transparent), transparent 50%),
#fff;
box-shadow: 0 8px 24px rgba(20, 38, 55, 0.06);
margin-top: 6px;
}
@ -1460,13 +1461,13 @@ onActivated(() => {
align-items: center;
gap: 12px;
min-width: 0;
padding: 16px 14px 14px;
padding: 16px 14px 12px;
padding-right: 92px;
}
.h5-me-avatar {
flex-shrink: 0;
box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(20, 38, 55, 0.08);
box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 4px 14px rgba(20, 38, 55, 0.12);
}
.h5-me-hero__text {
@ -1489,10 +1490,11 @@ onActivated(() => {
margin: 0;
min-width: 0;
flex-shrink: 1;
font-size: 17px;
font-weight: 700;
font-size: 18px;
font-weight: 780;
color: var(--me-ink);
line-height: 1.25;
line-height: 1.2;
letter-spacing: -0.02em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@ -1508,120 +1510,126 @@ onActivated(() => {
white-space: nowrap;
}
.h5-me-hero__meta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px 6px;
min-width: 0;
}
.h5-me-code {
align-self: flex-start;
max-width: 100%;
margin: 0;
border: none;
background: transparent;
padding: 0;
border-radius: 999px;
background: rgba(255, 255, 255, 0.72);
box-shadow: inset 0 0 0 1px rgba(20, 38, 55, 0.06);
padding: 3px 8px 3px 10px;
font-size: 11px;
color: #86909c;
color: #4e5969;
line-height: 1.3;
display: inline-flex;
align-items: center;
gap: 4px;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
span {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
:deep(.arco-icon) {
flex-shrink: 0;
color: #c9cdd4;
color: #86909c;
}
}
.h5-me-hero__dot {
color: #c9cdd4;
font-size: 11px;
line-height: 1;
}
.h5-me-balance__label {
font-size: 11px;
color: #86909c;
line-height: 1.3;
}
.h5-me-balance__value {
font-size: 13px;
font-weight: 700;
color: var(--me-ink);
font-variant-numeric: tabular-nums;
line-height: 1.3;
letter-spacing: -0.02em;
}
.h5-me-hero.is-low .h5-me-balance__value {
color: #f53f3f;
}
.h5-me-recharge {
margin-left: 2px;
display: inline-flex;
align-items: center;
height: 22px;
padding: 0 8px;
border: none;
border-radius: 11px;
background: color-mix(in srgb, var(--me-teal) 12%, #fff);
color: var(--me-teal);
font-size: 11px;
font-weight: 600;
line-height: 1;
cursor: pointer;
&:active {
opacity: 0.8;
background: #fff;
}
}
.h5-me-hero.is-low .h5-me-recharge {
background: color-mix(in srgb, #f53f3f 12%, #fff);
color: #f53f3f;
}
.h5-me-hero__low {
.h5-me-wallet {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin: 0 14px 10px;
padding: 10px 12px;
border-radius: 10px;
background: #ffece8;
color: #f53f3f;
font-size: 12px;
font-weight: 600;
line-height: 1.35;
gap: 12px;
margin: 0 12px 12px;
padding: 12px 14px;
border-radius: 14px;
background:
linear-gradient(
135deg,
color-mix(in srgb, var(--me-teal) 14%, #fff) 0%,
color-mix(in srgb, var(--me-ink) 6%, #fff) 100%
);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
&.is-low {
background: linear-gradient(135deg, #fff1f0 0%, #fff7f6 100%);
}
}
.h5-me-hero__low-cta {
.h5-me-wallet__info {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.h5-me-wallet__label {
font-size: 11px;
font-weight: 600;
color: #86909c;
line-height: 1.2;
}
.h5-me-wallet__value {
font-size: 22px;
font-weight: 780;
color: var(--me-ink);
font-variant-numeric: tabular-nums;
line-height: 1.15;
letter-spacing: -0.03em;
}
.h5-me-wallet.is-low .h5-me-wallet__value {
color: #f53f3f;
}
.h5-me-wallet__warn {
margin-top: 2px;
font-style: normal;
font-size: 11px;
font-weight: 600;
color: #f53f3f;
line-height: 1.2;
}
.h5-me-wallet__cta {
flex-shrink: 0;
height: 28px;
padding: 0 12px;
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 72px;
height: 32px;
padding: 0 14px;
border: none;
border-radius: 14px;
background: #f53f3f;
border-radius: 999px;
background: var(--me-teal);
color: #fff;
font-size: 12px;
font-size: 13px;
font-weight: 700;
line-height: 1;
box-shadow: 0 6px 14px color-mix(in srgb, var(--me-teal) 28%, transparent);
cursor: pointer;
-webkit-tap-highlight-color: transparent;
&:active {
opacity: 0.88;
transform: scale(0.98);
}
}
.h5-me-wallet.is-low .h5-me-wallet__cta {
background: #f53f3f;
box-shadow: 0 6px 14px rgba(245, 63, 63, 0.28);
}
.h5-me-hero__points {
display: block;
width: calc(100% - 28px);
@ -1788,10 +1796,7 @@ onActivated(() => {
.h5-me-services__item {
position: relative;
display: flex;
flex-direction: column;
align-items: stretch;
gap: 6px;
display: block;
min-width: 0;
padding: 12px 10px;
border: none;
@ -1834,6 +1839,14 @@ onActivated(() => {
min-width: 0;
}
.h5-me-services__text {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
flex: 1;
}
.h5-me-services__icon {
position: relative;
flex-shrink: 0;
@ -1873,7 +1886,6 @@ onActivated(() => {
.h5-me-services__label {
min-width: 0;
flex: 1;
font-size: 10px;
font-weight: 700;
color: var(--me-ink);
@ -1884,17 +1896,14 @@ onActivated(() => {
}
.h5-me-services__desc {
position: relative;
z-index: 1;
font-style: normal;
font-size: 10px;
font-weight: 500;
color: #86909c;
line-height: 1.3;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 1.25;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.h5-me-notify-nudge {

View File

@ -2,7 +2,7 @@
<div class="world-map" :class="{ 'is-dense': dense, 'is-focus': focused }">
<div class="world-map__chrome">
<div class="world-map__label">
<strong>全球 · 目的国分布</strong>
<strong>{{ title }}</strong>
<span v-if="focused" class="world-map__hint">滚轮缩放 · 拖拽平移 · 点击美国下钻</span>
</div>
<div class="world-map__actions">
@ -72,8 +72,18 @@ const props = withDefaults(
focused?: boolean
/** 总览小窗显示「放大」 */
expandable?: boolean
/** 左上角标题 */
title?: string
/** 未放大时也可点美国下钻邮编/港口(客户单图场景) */
allowUsDrill?: boolean
}>(),
{ dense: false, focused: false, expandable: true },
{
dense: false,
focused: false,
expandable: true,
title: '全球 · 目的国分布',
allowUsDrill: false,
},
)
const emit = defineEmits<{
@ -164,7 +174,7 @@ const option = computed(() => {
`收件 ${formatCount(d.value)}`,
`均时 ${formatDays(d.avgDays)} · 成功率 ${(d.successRate * 100).toFixed(1)}%`,
]
if (props.focused && US_WORLD_NAMES.has(params.name)) {
if ((props.focused || props.allowUsDrill) && US_WORLD_NAMES.has(params.name)) {
tip.push('<span style="color:#1d7281">点击进入美国邮编 / 港口</span>')
}
return tip.join('<br/>')
@ -266,7 +276,7 @@ function onClick(params: any) {
return
}
if (params?.componentSubType === 'map' && params.name) {
if (props.focused && US_WORLD_NAMES.has(params.name)) {
if ((props.focused || props.allowUsDrill) && US_WORLD_NAMES.has(params.name)) {
emit('select-country', params.name)
emit('drill-us')
return

View File

@ -0,0 +1,294 @@
<template>
<a-card
class="general-card dest-map-card"
:bordered="false"
:header-style="{ display: 'none' }"
:body-style="{
padding: '0',
flex: 1,
minHeight: 0,
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
}"
>
<div class="dest-map-panel">
<div class="dest-map-panel__toolbar">
<div class="dest-map-panel__title">
<strong>{{ t('workplace.destMap.title') }}</strong>
<span class="dest-map-panel__sub">{{ t('workplace.destMap.sub') }}</span>
</div>
<div class="dest-map-panel__ranges" role="group" :aria-label="t('workplace.destMap.range')">
<button
v-for="item in rangeOptions"
:key="item.value"
type="button"
class="dest-map-panel__range"
:class="{ 'is-active': range === item.value }"
@click="range = item.value"
>
{{ item.label }}
</button>
<button
type="button"
class="dest-map-panel__refresh"
:disabled="loading"
:title="t('workplace.destMap.refresh')"
@click="refresh"
>
{{ loading ? '…' : t('workplace.destMap.refresh') }}
</button>
</div>
</div>
<div v-if="error" class="dest-map-panel__error" :title="error">
{{ error }}
</div>
<div class="dest-map-panel__map">
<WorldDestMap
:slice="slice"
:selected-country="selectedCountry"
:selected-lane-id="null"
latency-mode="success"
:expandable="true"
:allow-us-drill="true"
:title="t('workplace.destMap.mapLabel')"
@select-country="onSelectCountry"
@drill-status="onDrillStatus"
@expand="mapFocus = 'world'"
@drill-us="openUsDetail"
/>
</div>
<div
v-if="mapFocus !== 'none'"
class="dest-map-panel__focus"
role="dialog"
aria-modal="true"
:aria-label="focusAriaLabel"
>
<WorldDestMap
v-if="mapFocus === 'world'"
:slice="slice"
:selected-country="selectedCountry"
:selected-lane-id="null"
latency-mode="success"
:focused="true"
:expandable="false"
:title="t('workplace.destMap.mapLabel')"
@select-country="onSelectCountry"
@drill-status="onDrillStatus"
@collapse="closeMapFocus"
@drill-us="openUsDetail"
/>
<UsDestDetailMap
v-else
@back-world="mapFocus = 'world'"
@collapse="closeMapFocus"
/>
</div>
</div>
</a-card>
</template>
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import WorldDestMap from '../biz-ops/WorldDestMap.vue';
import UsDestDetailMap from '../biz-ops/UsDestDetailMap.vue';
import { useBizOpsData } from '../biz-ops/useBizOpsData';
import type { RangeKey } from '../biz-ops/types';
defineOptions({ name: 'CustomerDestMapPanel' });
const MY_ORDERS_PATH = '/order/myOrders';
const { t } = useI18n();
const router = useRouter();
const { range, laneDim, loading, error, slice, refresh } = useBizOpsData();
/** 客户工作台只看目的国维度 */
laneDim.value = 'country';
const selectedCountry = ref<string | null>(null);
/** none=总览;world=全球放大;us=美国邮编/港口 */
const mapFocus = ref<'none' | 'world' | 'us'>('none');
const rangeOptions = computed(() => [
{ value: '7' as RangeKey, label: t('workplace.destMap.range7') },
{ value: '30' as RangeKey, label: t('workplace.destMap.range30') },
{ value: '90' as RangeKey, label: t('workplace.destMap.range90') },
]);
const focusAriaLabel = computed(() =>
mapFocus.value === 'us'
? t('workplace.destMap.usLabel')
: t('workplace.destMap.mapLabel'),
);
watch(range, () => {
selectedCountry.value = null;
});
function periodQuery() {
const start = slice.value.periodStart;
const end = slice.value.periodEndExclusive;
return {
createTimeStart: start ? String(start).replace('T', ' ').slice(0, 19) : undefined,
createTimeEnd: end ? String(end).replace('T', ' ').slice(0, 19) : undefined,
};
}
function onSelectCountry(name: string | null) {
selectedCountry.value = name;
}
function openUsDetail() {
mapFocus.value = 'us';
}
function closeMapFocus() {
mapFocus.value = 'none';
}
function onFocusKeydown(e: KeyboardEvent) {
if (e.key === 'Escape' && mapFocus.value !== 'none') {
e.preventDefault();
if (mapFocus.value === 'us') {
mapFocus.value = 'world';
return;
}
closeMapFocus();
}
}
function onDrillStatus(status: 'all' | 'predeclared' | 'pendingPayment' | 'pendingShip') {
const query: Record<string, string> = {
status: status === 'all' ? 'all' : status,
};
const q = periodQuery();
if (q.createTimeStart) query.createTimeStart = q.createTimeStart;
if (q.createTimeEnd) query.createTimeEnd = q.createTimeEnd;
void router.push({ path: MY_ORDERS_PATH, query }).catch(() => undefined);
}
onMounted(() => {
window.addEventListener('keydown', onFocusKeydown);
});
onUnmounted(() => {
window.removeEventListener('keydown', onFocusKeydown);
});
</script>
<style lang="less" scoped>
.dest-map-card {
height: 100%;
background: var(--wp-card-bg, #fff);
border: var(--wp-card-border, 1px solid rgba(15, 23, 42, 0.06));
border-radius: var(--wp-card-radius, 14px);
box-shadow: var(--wp-card-shadow);
}
.dest-map-panel {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
}
.dest-map-panel__toolbar {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 14px 8px;
}
.dest-map-panel__title {
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
strong {
font-size: 14px;
font-weight: 650;
color: #1a2e38;
}
}
.dest-map-panel__sub {
font-size: 12px;
color: rgba(26, 46, 56, 0.45);
}
.dest-map-panel__ranges {
display: inline-flex;
align-items: center;
gap: 4px;
flex-shrink: 0;
}
.dest-map-panel__range,
.dest-map-panel__refresh {
height: 28px;
padding: 0 10px;
border: none;
border-radius: 8px;
background: rgba(15, 23, 42, 0.04);
color: rgba(26, 46, 56, 0.62);
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: background-color 0.14s ease, color 0.14s ease;
&:hover:not(:disabled) {
color: #1a2e38;
background: rgba(15, 23, 42, 0.07);
}
&:disabled {
opacity: 0.55;
cursor: default;
}
}
.dest-map-panel__range.is-active {
color: var(--app-primary-color, #1d7281);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 12%, #fff);
}
.dest-map-panel__error {
margin: 0 14px 8px;
padding: 8px 10px;
border-radius: 8px;
background: rgba(196, 92, 74, 0.08);
color: #c45c4a;
font-size: 12px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dest-map-panel__map {
flex: 1;
min-height: 0;
padding: 0 4px 8px;
}
.dest-map-panel__focus {
position: absolute;
inset: 8px;
z-index: 8;
border-radius: 12px;
background: #fff;
border: 1px solid rgba(15, 23, 42, 0.08);
box-shadow: none;
overflow: hidden;
}
</style>

View File

@ -2,15 +2,18 @@
<div class="workplace-container workplace-container--customer">
<div class="container">
<div class="left-side">
<div class="panel panel--hero">
<div class="panel panel--banner">
<Banner />
</div>
<div class="panel panel--stats">
<DataPanel />
</div>
<div class="panel panel--analysis panel--analysis-fill">
<AnalysisTabs />
<CustomerDestMapPanel />
</div>
<div class="panel panel--world-time">
<WorldTime :show-local="false" /> </div>
<WorldTime :show-local="false" />
</div>
</div>
<div class="right-side">
<MarketingShortcuts />
@ -36,28 +39,24 @@ import Announcement from './announcement.vue'
import WorldTime from './world-time.vue'
import NoticePopup from './notice-popup.vue'
const AnalysisTabs = defineAsyncComponent(() => import('./analysis-tabs.vue'))
const CustomerDestMapPanel = defineAsyncComponent(
() => import('./CustomerDestMapPanel.vue'),
)
defineOptions({ name: 'CustomerWorkplace' })
</script>
<style lang="less" scoped>
.workplace-container {
/* 对齐管理台:外层轻压,内卡细边 + 轻 inset(上方不发灰) */
--wp-card-radius: 16px;
--wp-inner-radius: 12px;
--wp-card-border: none;
/* 与地图卡统一:白底 + 细边 + 轻外阴影 */
--wp-card-radius: 14px;
--wp-inner-radius: 10px;
--wp-card-border: 1px solid rgba(15, 23, 42, 0.06);
--wp-card-bg: #ffffff;
--wp-card-shadow:
inset 0 2px 8px rgba(15, 23, 42, 0.07),
inset 0 1px 1px rgba(15, 23, 42, 0.04);
--wp-card-shadow: none;
--wp-well-bg: #ffffff;
--wp-well-shadow:
inset 0 0 0 1px rgba(15, 23, 42, 0.06),
inset 0 1px 4px rgba(15, 23, 42, 0.05);
--wp-well-shadow-deep:
inset 0 0 0 1px rgba(15, 23, 42, 0.08),
inset 0 2px 6px rgba(15, 23, 42, 0.07);
--wp-well-shadow: none;
--wp-well-shadow-deep: none;
box-sizing: border-box;
width: 100%;
height: 100%;
@ -98,16 +97,21 @@ defineOptions({ name: 'CustomerWorkplace' })
overflow: auto;
}
.left-side .panel--hero {
.left-side .panel--banner {
flex: 0 0 auto;
display: flex;
flex-direction: column;
overflow: visible;
max-height: none;
background: transparent;
border: none;
box-shadow: none;
}
.left-side .panel--hero :deep(.banner),
.left-side .panel--hero :deep(.stat-panel) {
.left-side .panel--stats {
flex: 0 0 auto;
overflow: visible;
}
.left-side .panel--banner :deep(.banner),
.left-side .panel--stats :deep(.stat-panel) {
flex-shrink: 0;
}
@ -118,7 +122,8 @@ defineOptions({ name: 'CustomerWorkplace' })
display: flex;
flex-direction: column;
:deep(.analysis-card.arco-card) {
:deep(.analysis-card.arco-card),
:deep(.dest-map-card.arco-card) {
flex: 1;
min-height: 0;
height: 100%;
@ -158,10 +163,10 @@ defineOptions({ name: 'CustomerWorkplace' })
.right-side {
flex: 3;
min-width: 280px;
max-width: 380px;
max-width: 360px;
display: flex;
flex-direction: column;
gap: 12px;
gap: 10px;
overflow: hidden;
justify-content: flex-start;
}
@ -217,7 +222,10 @@ defineOptions({ name: 'CustomerWorkplace' })
}
.moduler-wrap {
border: var(--wp-card-border);
border-radius: var(--wp-card-radius);
background: var(--wp-card-bg);
box-shadow: var(--wp-card-shadow);
}
:deep(.general-card) {
@ -236,7 +244,7 @@ defineOptions({ name: 'CustomerWorkplace' })
}
:deep(.marketing-shortcuts-panel) {
border: none;
border: var(--wp-card-border);
border-radius: var(--wp-card-radius);
background: var(--wp-card-bg);
box-shadow: var(--wp-card-shadow);
@ -353,7 +361,8 @@ defineOptions({ name: 'CustomerWorkplace' })
}
.left-side .panel,
.left-side .panel--hero,
.left-side .panel--banner,
.left-side .panel--stats,
.right-side .panel {
flex: none;
flex-shrink: 0;

View File

@ -229,22 +229,24 @@
<style scoped lang="less">
.announcement-panel {
--aw-ink: #1a2e38;
--aw-soft: rgba(26, 46, 56, 0.48);
--aw-soft: rgba(26, 46, 56, 0.45);
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
box-sizing: border-box;
padding: 14px 14px 16px;
padding: 14px 12px 12px;
}
.announcement-panel__title {
margin: 0 0 10px;
margin: 0 4px 6px;
flex-shrink: 0;
font-size: 14px;
font-weight: 700;
color: var(--aw-ink);
font-size: 12px;
font-weight: 650;
letter-spacing: 0.04em;
text-transform: uppercase;
color: rgba(26, 46, 56, 0.42);
}
.announcement-panel__body {
@ -258,8 +260,8 @@
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 64px;
padding: 12px;
min-height: 72px;
padding: 16px 12px;
text-align: center;
}
@ -291,24 +293,23 @@
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
padding: 10px 12px;
margin: 0 0 8px;
border-radius: 12px;
border: 1px solid var(--app-acrylic-border);
background: var(--app-acrylic-bg);
backdrop-filter: var(--app-acrylic-blur);
-webkit-backdrop-filter: var(--app-acrylic-blur);
gap: 10px;
padding: 10px 8px;
margin: 0;
border: none;
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
border-radius: 0;
background: transparent;
cursor: pointer;
transition: border-color 0.2s ease, background 0.2s ease;
transition: background-color 0.14s ease;
&:last-child {
margin-bottom: 0;
border-bottom: none;
}
&:hover {
border-color: var(--app-acrylic-border-strong);
background: var(--app-acrylic-hover-bg);
background: rgba(15, 23, 42, 0.03);
border-radius: 8px;
}
&__main {
@ -325,14 +326,16 @@
height: 6px;
margin-top: 6px;
border-radius: 50%;
background: var(--app-primary-color, rgb(var(--primary-6)));
background: var(--app-primary-color, #1d7281);
box-shadow: 0 0 0 3px
color-mix(in srgb, var(--app-primary-color, #1d7281) 16%, transparent);
}
&__title {
color: var(--aw-ink);
font-size: 13px;
font-weight: 600;
line-height: 1.45;
font-weight: 400;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
@ -342,8 +345,9 @@
&__time {
flex-shrink: 0;
color: var(--aw-soft);
font-size: 12px;
line-height: 1.45;
font-size: 11px;
line-height: 1.4;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
}

View File

@ -32,9 +32,8 @@
</p>
</template>
<template v-else>
<p class="banner-hello__line">
<span class="banner-hello__greet">{{ greetText }}</span>
<span class="banner-hello__name">{{ displayName }}</span>
<div class="banner-hello__title">
<p class="banner-hello__name">{{ displayName }}</p>
<MemberLevelBadge
v-if="showBalance && memberLevel.name"
class="banner-hello__level"
@ -43,39 +42,54 @@
:icon-url="memberLevel.iconUrl"
size="sm"
/>
</p>
<div
v-if="withClock"
class="banner-hello__clock"
aria-live="polite"
>
<span class="banner-hello__clock-date">{{ dateText }}</span>
<span class="banner-hello__clock-sep" aria-hidden="true">·</span>
<span class="banner-hello__clock-time">{{ timeText }}</span>
</div>
<div class="banner-hello__meta">
<span class="banner-hello__greet">{{ greetText }}</span>
<template v-if="showBalance && customerCode">
<span class="banner-hello__dot" aria-hidden="true">·</span>
<span
class="banner-hello__code"
:title="t('workplace.customerCode')"
>
{{ customerCode }}
</span>
</template>
<template v-if="withClock || (!compact && !cockpit)">
<span class="banner-hello__dot" aria-hidden="true">·</span>
<span class="banner-hello__clock" aria-live="polite">
<span class="banner-hello__clock-date">{{ dateText }}</span>
<span class="banner-hello__clock-time">{{ timeText }}</span>
</span>
</template>
</div>
</template>
</div>
<div v-if="!compact && !withClock && !cockpit" class="banner-local-clock" aria-live="polite">
<span class="banner-local-clock__label">{{ t('workplace.clock.local') }}</span>
<span class="banner-local-clock__date">{{ dateText }}</span>
<span class="banner-local-clock__time">{{ timeText }}</span>
</div>
</div>
<button
<div
v-if="showBalance"
type="button"
class="balance-chip"
:class="{ 'balance-chip--low': isLowBalance, 'balance-chip--loading': balanceLoading }"
:title="t('workplace.rechargeNow')"
@click="goRecharge"
>
<span class="balance-chip__label">{{ t('workplace.balance') }}</span>
<span class="balance-chip__value">
<template v-if="balanceLoading">···</template>
<template v-else>{{ balanceDisplay }}</template>
</span>
<span class="balance-chip__cta">{{ t('workplace.rechargeNow') }}</span>
</button>
<div class="balance-chip__stack">
<span class="balance-chip__label">{{ t('workplace.balance') }}</span>
<span
class="balance-chip__value"
:title="balanceDisplay === '--' ? undefined : `¥${balanceDisplay}`"
>
<template v-if="balanceLoading">···</template>
<template v-else-if="balanceDisplay === '--'">--</template>
<template v-else>¥{{ balanceDisplay }}</template>
</span>
</div>
<button
type="button"
class="balance-chip__cta"
:title="t('workplace.rechargeNow')"
@click="goRecharge"
>
{{ t('workplace.rechargeNow') }}
</button>
</div>
</div>
</div>
</template>
@ -122,6 +136,7 @@
const customerBalance = ref<number | null>(null);
const balanceLoading = ref(false);
const wechatAvatarRaw = ref('');
const customerCode = ref('');
const memberLevel = reactive({ code: '', name: '', iconUrl: '' });
const now = ref(new Date());
let timerId: number | undefined;
@ -212,10 +227,15 @@
}
}
function applyCustomerCode(data: { customerCode?: string } | null | undefined) {
customerCode.value = String(data?.customerCode ?? '').trim();
}
async function loadCustomerProfile() {
if (!rbacUserStore.isCustomerPortal() || !rbacUserStore.isLoggedIn) {
customerBalance.value = null;
wechatAvatarRaw.value = '';
customerCode.value = '';
applyMemberLevel(null);
return;
}
@ -224,6 +244,7 @@
const cached = peekCachedCurrentCustomer({ mapId, account });
if (cached) {
applyWechatAvatar(cached);
applyCustomerCode(cached);
const cachedBal = cached.accountBalance ?? cached.balance;
if (cachedBal != null && cachedBal !== '') {
const parsed = Number(cachedBal);
@ -236,6 +257,7 @@
try {
const data = await resolveCurrentCustomer({ mapId, account, force: true });
applyWechatAvatar(data);
applyCustomerCode(data);
const raw = data?.accountBalance ?? data?.balance;
if (raw == null || raw === '') {
customerBalance.value = 0;
@ -281,7 +303,7 @@
<style scoped lang="less">
.banner {
width: 100%;
padding: 16px 20px 4px;
padding: 12px 16px 8px;
background: transparent;
&.is-compact {
@ -386,7 +408,7 @@
align-items: center;
justify-content: space-between;
gap: 16px 24px;
min-height: 56px;
min-height: 52px;
}
.banner-hello {
@ -400,11 +422,25 @@
.banner-hello__copy {
display: flex;
flex-direction: column;
gap: 2px;
gap: 4px;
min-width: 0;
flex: 1;
}
.banner-hello__meta {
display: inline-flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
min-width: 0;
}
.banner-hello__dot {
color: rgba(26, 46, 56, 0.28);
font-size: 12px;
line-height: 1;
}
.banner-hello__clock {
display: inline-flex;
align-items: baseline;
@ -413,30 +449,24 @@
white-space: nowrap;
}
.banner-hello__clock-date {
.banner-hello__clock-date,
.banner-hello__clock-time {
font-size: 12px;
line-height: 1.2;
color: rgba(26, 46, 56, 0.48);
}
.banner-hello__clock-sep {
font-size: 12px;
color: rgba(26, 46, 56, 0.28);
}
.banner-hello__clock-time {
font-size: 12px;
font-weight: 700;
line-height: 1.2;
letter-spacing: 0.03em;
font-weight: 600;
letter-spacing: 0.02em;
font-variant-numeric: tabular-nums;
color: rgba(26, 46, 56, 0.72);
color: rgba(26, 46, 56, 0.58);
}
.banner-hello__avatar {
flex-shrink: 0;
border: 1px solid var(--app-acrylic-border);
background: var(--app-acrylic-bg);
border: 1px solid rgba(15, 23, 42, 0.06);
background: #fff;
box-shadow: none;
:deep(img) {
@ -447,13 +477,26 @@
}
}
.banner-hello__line {
display: flex;
.banner-hello__code {
flex-shrink: 0;
max-width: 140px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: rgba(26, 46, 56, 0.55);
font-size: 12px;
font-weight: 500;
font-variant-numeric: tabular-nums;
letter-spacing: 0.02em;
line-height: 1.2;
}
.banner-hello__title {
display: inline-flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
margin: 0;
min-width: 0;
max-width: 100%;
}
.banner-hello__level {
@ -462,97 +505,40 @@
.banner-hello__greet {
flex-shrink: 0;
color: var(--color-text-3);
font-size: 14px;
line-height: 1.3;
color: rgba(26, 46, 56, 0.48);
font-size: 12px;
line-height: 1.2;
}
.banner-hello__name {
margin: 0;
color: var(--color-text-1);
min-width: 0;
color: #1a2e38;
font-size: 20px;
font-weight: 600;
line-height: 1.3;
letter-spacing: 0.01em;
font-weight: 650;
line-height: 1.2;
letter-spacing: -0.01em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.banner-local-clock {
--aw-ink: #1a2e38;
--aw-soft: rgba(26, 46, 56, 0.48);
display: inline-flex;
align-items: baseline;
gap: 8px;
flex-shrink: 0;
min-width: 0;
margin-left: 4px;
padding: 8px 12px;
border-radius: 12px;
border: none;
background: #ffffff;
box-shadow: var(--wp-well-shadow, var(--aw-well-shadow));
backdrop-filter: none;
-webkit-backdrop-filter: none;
white-space: nowrap;
}
.banner-local-clock__label {
font-size: 12px;
font-weight: 600;
color: var(--aw-soft);
line-height: 1.2;
}
.banner-local-clock__date {
font-size: 12px;
color: var(--aw-soft);
line-height: 1.2;
}
.banner-local-clock__time {
font-size: 16px;
font-weight: 700;
font-variant-numeric: tabular-nums;
letter-spacing: 0.03em;
color: var(--aw-ink);
line-height: 1.15;
}
.balance-chip {
display: inline-flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
height: 44px;
padding: 0 12px 0 14px;
border: none;
border-radius: 12px;
background: #ffffff;
box-shadow: var(--wp-well-shadow, var(--aw-well-shadow));
backdrop-filter: none;
-webkit-backdrop-filter: none;
cursor: pointer;
transition: box-shadow 0.2s ease;
&:hover {
border-color: transparent;
background: #ffffff;
box-shadow: var(--wp-well-shadow-deep, var(--aw-well-shadow-deep));
.balance-chip__cta {
opacity: 1;
}
}
gap: 14px;
flex: 0 0 auto;
max-width: 100%;
min-height: 48px;
padding: 8px 10px 8px 16px;
border: 1px solid rgba(15, 23, 42, 0.07);
border-radius: 14px;
background: #fff;
box-shadow: none;
&--low {
border: none;
background: rgba(255, 125, 0, 0.06);
box-shadow:
inset 0 2px 5px rgba(255, 125, 0, 0.12),
inset 0 0 0 1px rgba(255, 125, 0, 0.35);
border-color: rgba(255, 125, 0, 0.32);
background: rgba(255, 125, 0, 0.04);
.balance-chip__value {
color: #ff7d00;
@ -565,33 +551,57 @@
}
}
&__stack {
display: inline-flex;
flex-direction: column;
gap: 4px;
align-items: flex-start;
flex: 0 1 auto;
min-width: 0;
padding-right: 14px;
border-right: 1px solid rgba(15, 23, 42, 0.06);
}
&__label {
color: var(--color-text-3);
font-size: 12px;
color: rgba(26, 46, 56, 0.42);
font-size: 11px;
font-weight: 500;
letter-spacing: 0.02em;
line-height: 1;
white-space: nowrap;
}
&__value {
color: var(--app-primary-color, rgb(var(--primary-6)));
font-size: 18px;
color: #1a2e38;
font-size: 17px;
font-weight: 650;
font-variant-numeric: tabular-nums;
line-height: 1;
letter-spacing: 0.02em;
line-height: 1.1;
letter-spacing: -0.02em;
white-space: nowrap;
/* 几十万~千万级金额随内容撑开,不截断 */
overflow: visible;
}
&__cta {
margin-left: 2px;
padding: 3px 10px;
border-radius: 8px;
background: var(--app-primary-color, rgb(var(--primary-6)));
color: #fff;
font-size: 12px;
line-height: 1.4;
appearance: none;
border: none;
margin: 0;
padding: 8px 14px;
border-radius: 10px;
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 10%, #fff);
color: var(--app-primary-color, #1d7281);
font-size: 13px;
font-weight: 600;
line-height: 1.2;
white-space: nowrap;
opacity: 0.92;
transition: opacity 0.2s;
cursor: pointer;
transition: background-color 0.14s ease, color 0.14s ease;
&:hover {
background: var(--app-primary-color, #1d7281);
color: #fff;
}
}
}

View File

@ -5,74 +5,85 @@
<a-spin />
</div>
<template v-else>
<div class="stat-grid stat-grid--priority">
<button
v-for="item in priorityItems"
:key="item.key"
type="button"
class="stat-card"
:class="[
`stat-card--${item.tone}`,
{
'stat-card--clickable': Boolean(item.to),
'stat-card--alert': item.alert && item.value > 0,
},
]"
:disabled="!item.to"
@click="onStatClick(item)"
>
<div class="stat-card__main">
<div class="stat-card__meta">
<a-avatar :size="40" class="stat-card__avatar">
<img alt="" :src="item.icon" />
</a-avatar>
<span class="stat-card__label">{{ t(item.titleKey) }}</span>
<section class="stat-section stat-section--todo" aria-labelledby="wp-stat-todo">
<header class="stat-section__head">
<h3 id="wp-stat-todo" class="stat-section__title">
{{ t('workplace.stat.sectionTodo') }}
</h3>
<span class="stat-section__sub">{{ t('workplace.stat.sectionTodoSub') }}</span>
</header>
<div class="stat-grid stat-grid--priority">
<button
v-for="item in priorityItems"
:key="item.key"
type="button"
class="stat-card"
:class="[
`stat-card--${item.tone}`,
{
'stat-card--clickable': Boolean(item.to),
'stat-card--alert': item.alert && item.value > 0,
'stat-card--empty': item.value <= 0,
},
]"
:title="item.hintKey ? t(item.hintKey) : undefined"
:disabled="!item.to"
@click="onStatClick(item)"
>
<div class="stat-card__main">
<div class="stat-card__meta">
<a-avatar :size="36" class="stat-card__avatar">
<img alt="" :src="item.icon" />
</a-avatar>
<span class="stat-card__label">{{ t(item.titleKey) }}</span>
</div>
<div class="stat-card__body">
<span class="stat-card__value">{{ formatValue(item) }}</span>
<span v-if="item.unitKey" class="stat-card__unit">{{ t(item.unitKey) }}</span>
</div>
</div>
<div class="stat-card__body">
<span class="stat-card__value">{{ formatValue(item) }}</span>
<span v-if="item.unitKey" class="stat-card__unit">{{ t(item.unitKey) }}</span>
</div>
</div>
<span v-if="item.hintKey" class="stat-card__hint">{{ t(item.hintKey) }}</span>
</button>
</div>
<icon-right class="stat-card__arrow" />
</button>
</div>
</section>
<div class="stat-grid stat-grid--secondary">
<button
v-for="item in secondaryItems"
:key="item.key"
type="button"
class="stat-card stat-card--compact"
:class="[
`stat-card--${item.tone}`,
{
'stat-card--clickable': Boolean(item.to),
'stat-card--alert': item.alert && item.value > 0,
},
]"
:disabled="!item.to"
@click="onStatClick(item)"
>
<div class="stat-card__main">
<div class="stat-card__meta">
<span class="stat-card__label">{{ t(item.titleKey) }}</span>
</div>
<div class="stat-card__body">
<span class="stat-card__value">{{ formatValue(item) }}</span>
<span v-if="item.unitKey" class="stat-card__unit">{{ t(item.unitKey) }}</span>
<section class="stat-section stat-section--overview" aria-labelledby="wp-stat-overview">
<header class="stat-section__head">
<h3 id="wp-stat-overview" class="stat-section__title">
{{ t('workplace.stat.sectionOverview') }}
</h3>
</header>
<div class="stat-overview">
<button
v-for="item in secondaryItems"
:key="item.key"
type="button"
class="stat-metric"
:class="{
'stat-metric--clickable': Boolean(item.to),
'stat-metric--alert': item.alert && item.value > 0,
}"
:title="item.hintKey ? t(item.hintKey) : undefined"
:disabled="!item.to"
@click="onStatClick(item)"
>
<span class="stat-metric__label">{{ t(item.titleKey) }}</span>
<span class="stat-metric__value-row">
<span class="stat-metric__value">{{ formatValue(item) }}</span>
<span v-if="item.unitKey" class="stat-metric__unit">{{ t(item.unitKey) }}</span>
<span
v-else-if="item.showTrend"
class="stat-card__trend"
class="stat-metric__trend"
:class="item.trendUp ? 'is-up' : 'is-down'"
>
<icon-caret-up v-if="item.trendUp" />
<icon-caret-down v-else />
%
</span>
</div>
</div>
</button>
</div>
</span>
</button>
</div>
</section>
</template>
</div>
</div>
@ -82,7 +93,7 @@
import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { IconCaretDown, IconCaretUp } from '@arco-design/web-vue/es/icon'
import { IconCaretDown, IconCaretUp, IconRight } from '@arco-design/web-vue/es/icon'
import { getOrderWorkplaceStats, type OrderWorkplaceStats } from '@/api/workplace'
import { useRbacUserStore } from '@/store/modules/rbac-user'
import iconOrderNew from '@/assets/icons/workplace/order-new.svg?url'
@ -202,8 +213,6 @@ const allStatItems = computed<StatItem[]>(() => {
trendUp: growthUp,
icon: iconGrowth,
tone: 'neutral',
hintKey: 'workplace.stat.clickHint',
to: { path: listPath },
},
{
key: 'storeCount',
@ -257,52 +266,197 @@ onMounted(() => {
display: flex;
flex-direction: column;
min-height: 0;
padding: 8px 16px 12px;
padding: 10px 14px 14px;
box-sizing: border-box;
background: transparent;
}
.stat-panel__body {
display: flex;
flex-direction: column;
gap: 14px;
flex: 1 1 auto;
min-height: 0;
overflow: auto;
}
.stat-section {
display: flex;
flex-direction: column;
gap: 8px;
min-width: 0;
}
.stat-section__head {
display: flex;
align-items: baseline;
gap: 8px;
min-width: 0;
padding: 0 2px;
}
.stat-section__title {
margin: 0;
color: #1a2e38;
font-size: 13px;
font-weight: 650;
line-height: 1.2;
letter-spacing: 0.01em;
}
.stat-section__sub {
color: rgba(26, 46, 56, 0.42);
font-size: 12px;
line-height: 1.2;
}
.stat-grid--priority {
flex: 0 0 auto;
gap: 10px;
}
.stat-grid--secondary {
margin-top: 8px;
}
/* 统计卡:白底轻 inset(外层面板由 CustomerWorkplace 压入) */
/* 待处理:独立卡片,箭头暗示可点,去掉重复「点击查看」文案 */
.stat-card {
min-height: 84px;
padding: 12px 14px 10px;
border: none;
background: #ffffff;
box-shadow: var(--wp-well-shadow);
position: relative;
min-height: 78px;
padding: 12px 14px;
border: 1px solid rgba(15, 23, 42, 0.07);
border-radius: 12px;
background: #fff;
box-shadow: none;
backdrop-filter: none;
-webkit-backdrop-filter: none;
&--empty:not(:hover) {
.stat-card__value {
color: rgba(26, 46, 56, 0.38);
}
}
&--clickable:hover {
border-color: transparent;
background: #ffffff;
box-shadow: var(--wp-well-shadow-deep);
border-color: color-mix(in srgb, var(--app-primary-color, #1d7281) 30%, transparent);
background: #fff;
box-shadow: none;
.stat-card__arrow {
opacity: 1;
transform: translateX(0);
color: var(--app-primary-color, #1d7281);
}
}
&__arrow {
position: absolute;
right: 10px;
bottom: 10px;
font-size: 12px;
color: rgba(26, 46, 56, 0.28);
opacity: 0;
transform: translateX(-2px);
transition: opacity 0.14s ease, transform 0.14s ease, color 0.14s ease;
pointer-events: none;
}
}
.stat-card--compact {
min-height: 64px;
padding: 10px 12px;
/* 概览:同一浅底井里的指标,和待处理卡明确分区 */
.stat-overview {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 0;
border: 1px solid rgba(15, 23, 42, 0.06);
border-radius: 12px;
background: rgba(15, 23, 42, 0.02);
overflow: hidden;
}
.stat-card__value {
font-size: 20px;
.stat-metric {
appearance: none;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 6px;
min-width: 0;
margin: 0;
padding: 12px 14px;
border: none;
border-right: 1px solid rgba(15, 23, 42, 0.06);
border-radius: 0;
background: transparent;
text-align: left;
font: inherit;
color: inherit;
cursor: default;
&:last-child {
border-right: none;
}
.stat-card__avatar {
display: none;
&--clickable {
cursor: pointer;
&:hover {
background: rgba(255, 255, 255, 0.72);
.stat-metric__value {
color: var(--app-primary-color, #1d7281);
}
}
&:focus-visible {
outline: 2px solid var(--app-primary-color, #1d7281);
outline-offset: -2px;
}
}
&:disabled {
cursor: default;
}
&__label {
color: rgba(26, 46, 56, 0.48);
font-size: 12px;
line-height: 1.2;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&__value-row {
display: inline-flex;
align-items: baseline;
gap: 4px;
min-width: 0;
}
&__value {
color: #1a2e38;
font-size: 20px;
font-weight: 650;
font-variant-numeric: tabular-nums;
line-height: 1;
letter-spacing: -0.02em;
transition: color 0.14s ease;
}
&__unit {
color: rgba(26, 46, 56, 0.42);
font-size: 12px;
font-weight: 500;
}
&__trend {
display: inline-flex;
align-items: center;
gap: 2px;
font-size: 12px;
font-weight: 600;
&.is-up {
color: #f53f3f;
}
&.is-down {
color: #00b42a;
}
}
}
@ -313,4 +467,37 @@ onMounted(() => {
min-height: 88px;
padding: 16px 0;
}
@media (max-width: 1280px) {
.stat-overview {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stat-metric {
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
&:nth-child(2n) {
border-right: none;
}
&:nth-last-child(-n + 2) {
border-bottom: none;
}
}
}
@media (max-width: 720px) {
.stat-overview {
grid-template-columns: 1fr;
}
.stat-metric {
border-right: none;
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
&:last-child {
border-bottom: none;
}
}
}
</style>

View File

@ -1,5 +1,8 @@
<template>
<div v-if="show" class="marketing-shortcuts-panel" aria-label="marketing">
<div class="msr-head">
<h3 class="msr-head__title">{{ t('workplace.marketing.section') }}</h3>
</div>
<div class="marketing-shortcuts">
<button
v-for="item in marketingShortcuts"
@ -9,7 +12,6 @@
:title="t(item.descKey)"
@click="goMarketing(item.panel)"
>
<span v-if="item.badge" class="marketing-chip__badge">{{ item.badge }}</span>
<span class="marketing-chip__icon" aria-hidden="true">
<component :is="item.icon" />
</span>
@ -17,6 +19,8 @@
<span class="marketing-chip__title">{{ t(item.titleKey) }}</span>
<span class="marketing-chip__desc">{{ t(item.descKey) }}</span>
</span>
<span v-if="item.badge" class="marketing-chip__badge">{{ item.badge }}</span>
<icon-right class="marketing-chip__arrow" />
</button>
</div>
</div>
@ -25,7 +29,13 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { IconGift, IconTrophy, IconStamp, IconSafe } from '@arco-design/web-vue/es/icon'
import {
IconGift,
IconTrophy,
IconStamp,
IconSafe,
IconRight,
} from '@arco-design/web-vue/es/icon'
import { useRbacUserStore } from '@/store/modules/rbac-user'
import { resolveCurrentCustomer } from '@/api/customer/resolve'
import { getCommissionOverview, getMyCoupons } from '@/api/marketing/portal'
@ -127,94 +137,83 @@ onMounted(async () => {
<style lang="less" scoped>
.marketing-shortcuts-panel {
flex-shrink: 0;
padding: 10px;
padding: 14px 12px 10px;
box-sizing: border-box;
}
.msr-head {
margin: 0 4px 8px;
}
.msr-head__title {
margin: 0;
font-size: 12px;
font-weight: 650;
letter-spacing: 0.04em;
text-transform: uppercase;
color: rgba(26, 46, 56, 0.42);
}
.marketing-shortcuts {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
grid-template-rows: repeat(2, minmax(64px, auto));
gap: 8px;
display: flex;
flex-direction: column;
gap: 2px;
width: 100%;
}
.marketing-chip {
position: relative;
display: grid;
grid-template-columns: 32px minmax(0, 1fr);
grid-template-columns: 34px minmax(0, 1fr) auto auto;
align-items: center;
column-gap: 10px;
width: 100%;
height: 100%;
min-height: 64px;
margin: 0;
padding: 10px 12px;
padding: 8px 10px;
border: none;
border-radius: var(--wp-inner-radius, 12px);
background: #ffffff;
backdrop-filter: none;
-webkit-backdrop-filter: none;
box-shadow: var(--wp-well-shadow);
border-radius: 10px;
background: transparent;
text-align: left;
font: inherit;
color: inherit;
cursor: pointer;
transition: box-shadow 0.2s ease;
transition: background-color 0.14s ease;
&:hover {
border-color: transparent;
background: #ffffff;
box-shadow: var(--wp-well-shadow-deep);
transform: none;
}
background: rgba(15, 23, 42, 0.04);
&__badge {
position: absolute;
top: 6px;
right: 6px;
z-index: 1;
margin: 0;
padding: 0 5px;
min-width: 16px;
height: 16px;
border-radius: 999px;
background: var(--app-primary-color, rgb(var(--primary-6)));
color: #fff;
font-size: 10px;
font-style: normal;
font-weight: 600;
line-height: 16px;
text-align: center;
.marketing-chip__arrow {
color: rgba(26, 46, 56, 0.45);
}
}
&__icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
width: 34px;
height: 34px;
border-radius: 10px;
font-size: 15px;
color: var(--app-primary-color, rgb(var(--primary-6)));
background: transparent;
color: var(--app-primary-color, #1d7281);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 10%, #fff);
}
&__body {
display: flex;
flex-direction: column;
justify-content: center;
gap: 2px;
gap: 1px;
min-width: 0;
}
&__title {
display: block;
overflow: hidden;
color: var(--color-text-1);
color: #1a2e38;
font-size: 13px;
font-weight: 600;
line-height: 18px;
line-height: 1.3;
white-space: nowrap;
text-overflow: ellipsis;
}
@ -222,11 +221,34 @@ onMounted(async () => {
&__desc {
display: block;
overflow: hidden;
color: var(--color-text-3);
color: rgba(26, 46, 56, 0.45);
font-size: 11px;
line-height: 16px;
line-height: 1.3;
white-space: nowrap;
text-overflow: ellipsis;
}
&__badge {
flex-shrink: 0;
margin: 0;
padding: 0 6px;
min-width: 18px;
height: 18px;
border-radius: 999px;
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 12%, #fff);
color: var(--app-primary-color, #1d7281);
font-size: 11px;
font-style: normal;
font-weight: 650;
line-height: 18px;
text-align: center;
}
&__arrow {
flex-shrink: 0;
font-size: 12px;
color: rgba(26, 46, 56, 0.22);
transition: color 0.14s ease;
}
}
</style>

View File

@ -1,33 +1,34 @@
<template>
<a-card
class="general-card start-business-card"
:title="t('workplace.quick.operation')"
:header-style="{ paddingBottom: '0' }"
:body-style="{ padding: '12px 16px 16px' }"
:bordered="false"
:header-style="{ display: 'none' }"
:body-style="{ padding: '14px 12px 12px' }"
>
<div class="biz-switch" role="tablist">
<button
type="button"
role="tab"
class="biz-switch__item"
:class="{ 'is-active': activeFlow === 'logistics' }"
:aria-selected="activeFlow === 'logistics'"
@click="activeFlow = 'logistics'"
>
<icon-send class="biz-switch__icon" />
<span>{{ t('workplace.quick.flow.logistics') }}</span>
</button>
<button
type="button"
role="tab"
class="biz-switch__item"
:class="{ 'is-active': activeFlow === 'dropship' }"
:aria-selected="activeFlow === 'dropship'"
@click="activeFlow = 'dropship'"
>
<icon-apps class="biz-switch__icon" />
<span>{{ t('workplace.quick.flow.dropship') }}</span>
</button>
<div class="sb-head">
<h3 class="sb-head__title">{{ t('workplace.quick.operation') }}</h3>
<div class="biz-switch" role="tablist">
<button
type="button"
role="tab"
class="biz-switch__item"
:class="{ 'is-active': activeFlow === 'logistics' }"
:aria-selected="activeFlow === 'logistics'"
@click="activeFlow = 'logistics'"
>
{{ t('workplace.quick.flow.logistics') }}
</button>
<button
type="button"
role="tab"
class="biz-switch__item"
:class="{ 'is-active': activeFlow === 'dropship' }"
:aria-selected="activeFlow === 'dropship'"
@click="activeFlow = 'dropship'"
>
{{ t('workplace.quick.flow.dropship') }}
</button>
</div>
</div>
<div class="start-business-flow">
@ -43,7 +44,9 @@
class="flow-step__main"
@click="go(step.path!)"
>
<span class="flow-step__index">{{ index + 1 }}</span>
<span class="flow-step__rail" aria-hidden="true">
<span class="flow-step__index">{{ index + 1 }}</span>
</span>
<span class="flow-step__icon">
<component :is="step.icon" />
</span>
@ -52,7 +55,9 @@
</button>
<div v-else class="flow-step__main flow-step__main--static">
<span class="flow-step__index">{{ index + 1 }}</span>
<span class="flow-step__rail" aria-hidden="true">
<span class="flow-step__index">{{ index + 1 }}</span>
</span>
<span class="flow-step__icon">
<component :is="step.icon" />
</span>
@ -74,18 +79,16 @@
</div>
<div v-if="currentSecondary.length" class="start-business-secondary">
<div class="start-business-secondary__actions">
<button
v-for="item in currentSecondary"
:key="item.path"
type="button"
class="sec-action"
@click="go(item.path)"
>
<component :is="item.icon" class="sec-action__icon" />
<span>{{ t(item.titleKey) }}</span>
</button>
</div>
<button
v-for="item in currentSecondary"
:key="item.path"
type="button"
class="sec-action"
@click="go(item.path)"
>
<component :is="item.icon" class="sec-action__icon" />
<span>{{ t(item.titleKey) }}</span>
</button>
</div>
</a-card>
</template>
@ -264,86 +267,76 @@
</script>
<style scoped lang="less">
.sb-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin: 0 4px 10px;
}
.sb-head__title {
margin: 0;
font-size: 12px;
font-weight: 650;
letter-spacing: 0.04em;
text-transform: uppercase;
color: rgba(26, 46, 56, 0.42);
white-space: nowrap;
}
.biz-switch {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-bottom: 12px;
display: inline-flex;
align-items: center;
padding: 2px;
border-radius: 999px;
background: rgba(15, 23, 42, 0.05);
}
.biz-switch__item {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
min-width: 0;
padding: 8px 10px;
height: 26px;
padding: 0 10px;
border: none;
border-radius: var(--wp-inner-radius, 12px);
background: #ffffff;
box-shadow: var(--wp-well-shadow);
backdrop-filter: none;
-webkit-backdrop-filter: none;
color: var(--color-text-2);
font-size: 13px;
border-radius: 999px;
background: transparent;
color: rgba(26, 46, 56, 0.55);
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: box-shadow 0.2s ease, color 0.2s ease;
transition: background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
&:hover {
border-color: transparent;
background: #ffffff;
box-shadow: var(--wp-well-shadow-deep);
&:hover:not(.is-active) {
color: #1a2e38;
}
&.is-active {
border: none;
background: #ffffff;
box-shadow:
inset 0 0 0 1px color-mix(in srgb, var(--app-primary-color) 28%, transparent),
inset 0 1px 4px rgba(15, 23, 42, 0.05);
color: var(--app-primary-color, rgb(var(--primary-6)));
.biz-switch__icon {
color: #fff;
background: var(--app-primary-color, rgb(var(--primary-6)));
}
background: #fff;
color: var(--app-primary-color, #1d7281);
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
}
.biz-switch__icon {
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 24px;
height: 24px;
border-radius: 8px;
background: transparent;
color: var(--color-text-2);
font-size: 13px;
}
.start-business-flow {
display: flex;
flex-direction: column;
gap: 6px;
gap: 0;
}
.flow-step {
position: relative;
border: none;
border-radius: var(--wp-inner-radius, 12px);
background: #ffffff;
box-shadow: var(--wp-well-shadow);
backdrop-filter: none;
-webkit-backdrop-filter: none;
overflow: hidden;
transition: box-shadow 0.2s ease;
background: transparent;
overflow: visible;
&:hover {
border-color: transparent;
background: #ffffff;
box-shadow: var(--wp-well-shadow-deep);
&:not(:last-child)::before {
content: '';
position: absolute;
left: 19px;
top: 34px;
bottom: -2px;
width: 1px;
background: rgba(15, 23, 42, 0.08);
}
&__main {
@ -351,28 +344,45 @@
align-items: center;
gap: 10px;
width: 100%;
padding: 9px 12px;
padding: 7px 8px;
border: none;
border-radius: 10px;
background: transparent;
text-align: left;
font: inherit;
color: inherit;
cursor: pointer;
transition: background-color 0.14s ease;
&:hover:not(.flow-step__main--static) {
background: rgba(15, 23, 42, 0.04);
.flow-step__arrow {
color: rgba(26, 46, 56, 0.45);
}
}
&--static {
cursor: default;
}
}
&__index {
&__rail {
flex-shrink: 0;
width: 22px;
display: inline-flex;
align-items: center;
justify-content: center;
}
&__index {
width: 20px;
height: 20px;
border-radius: 50%;
background: var(--app-primary-color, rgb(var(--primary-6)));
color: #fff;
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 12%, #fff);
color: var(--app-primary-color, #1d7281);
font-size: 11px;
font-weight: 600;
font-weight: 700;
line-height: 20px;
text-align: center;
}
@ -382,107 +392,88 @@
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 26px;
height: 26px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.9);
color: var(--app-primary-color, rgb(var(--primary-6)));
font-size: 13px;
width: 28px;
height: 28px;
border-radius: 8px;
background: rgba(15, 23, 42, 0.04);
color: rgba(26, 46, 56, 0.62);
font-size: 14px;
}
&__title {
flex: 1;
min-width: 0;
color: var(--color-text-1);
color: #1a2e38;
font-size: 13px;
font-weight: 500;
font-weight: 550;
line-height: 1.3;
}
&__arrow {
flex-shrink: 0;
color: var(--color-text-4);
color: rgba(26, 46, 56, 0.22);
font-size: 12px;
transition: color 0.14s ease;
}
&__links {
display: flex;
gap: 8px;
padding: 0 12px 10px 50px;
flex-wrap: wrap;
gap: 6px;
padding: 0 8px 8px 60px;
}
}
.flow-link {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
gap: 5px;
padding: 4px 9px;
border: none;
border-radius: 14px;
background: #ffffff;
box-shadow: var(--wp-well-shadow);
color: var(--color-text-2);
border-radius: 999px;
background: rgba(15, 23, 42, 0.04);
color: rgba(26, 46, 56, 0.62);
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: box-shadow 0.2s ease, color 0.2s ease;
transition: background-color 0.14s ease, color 0.14s ease;
&:hover {
border-color: transparent;
color: var(--app-primary-color, rgb(var(--primary-6)));
background: #ffffff;
box-shadow:
inset 0 0 0 1px color-mix(in srgb, var(--app-primary-color) 22%, transparent),
inset 0 1px 4px rgba(15, 23, 42, 0.05);
color: var(--app-primary-color, #1d7281);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 10%, #fff);
}
}
.start-business-secondary {
margin-top: 12px;
padding-top: 10px;
border-top: 1px dashed rgba(0, 0, 0, 0.08);
&__actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: 10px;
padding: 10px 4px 0;
border-top: 1px solid rgba(15, 23, 42, 0.06);
}
.sec-action {
display: inline-flex;
align-items: center;
gap: 6px;
gap: 5px;
padding: 5px 10px;
border: none;
border-radius: 16px;
background: #ffffff;
box-shadow: var(--wp-well-shadow);
color: var(--color-text-2);
border-radius: 8px;
background: transparent;
color: rgba(26, 46, 56, 0.58);
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: box-shadow 0.2s ease, color 0.2s ease;
transition: background-color 0.14s ease, color 0.14s ease;
&:hover {
border-color: transparent;
color: var(--app-primary-color, rgb(var(--primary-6)));
background: #ffffff;
box-shadow:
inset 0 0 0 1px color-mix(in srgb, var(--app-primary-color) 22%, transparent),
inset 0 1px 4px rgba(15, 23, 42, 0.05);
color: var(--app-primary-color, #1d7281);
background: rgba(15, 23, 42, 0.04);
}
&__icon {
font-size: 13px;
}
}
@media (max-width: 720px) {
.biz-switch {
grid-template-columns: 1fr;
}
.flow-step__links {
padding-left: 12px;
}
}
</style>

View File

@ -6,7 +6,9 @@ export default {
'workplace.greet.evening': 'Good evening',
'workplace.greet.night': 'Still up late',
'workplace.balance': 'Balance',
'workplace.customerCode': 'Member code',
'workplace.rechargeNow': 'Recharge',
'workplace.marketing.section': 'Rewards',
'workplace.marketing.invite': 'Invite',
'workplace.marketing.inviteDesc': 'Share & earn',
'workplace.marketing.member': 'Level',
@ -29,9 +31,21 @@ export default {
'workplace.storeOrderPending': 'Store Orders Pending',
'workplace.stores': 'stores',
'workplace.newFromYesterday': 'Day-over-Day Growth',
'workplace.stat.sectionTodo': 'Needs attention',
'workplace.stat.sectionTodoSub': 'Open the matching list',
'workplace.stat.sectionOverview': 'Today',
'workplace.stat.clickHint': 'View orders',
'workplace.stat.clickStore': 'View stores',
'workplace.stat.clickStoreOrder': 'View store orders',
'workplace.destMap.title': 'Destination map',
'workplace.destMap.sub': 'Click the US to open ZIP / ports',
'workplace.destMap.mapLabel': 'World · destinations',
'workplace.destMap.usLabel': 'US · ZIP / ports',
'workplace.destMap.range': 'Range',
'workplace.destMap.range7': '7D',
'workplace.destMap.range30': '30D',
'workplace.destMap.range90': '90D',
'workplace.destMap.refresh': 'Refresh',
'workplace.orderAnalysis.title': 'Order Analysis',
'workplace.orderAnalysis.day': 'Day',
'workplace.orderAnalysis.week': 'Week',

View File

@ -6,7 +6,9 @@ export default {
'workplace.greet.evening': '晚上好',
'workplace.greet.night': '夜深了',
'workplace.balance': '余额',
'workplace.customerCode': '会员编号',
'workplace.rechargeNow': '充值',
'workplace.marketing.section': '成长与权益',
'workplace.marketing.invite': '邀请好友',
'workplace.marketing.inviteDesc': '分享得奖励',
'workplace.marketing.member': '会员等级',
@ -29,9 +31,21 @@ export default {
'workplace.storeOrderPending': '店铺订单待处理',
'workplace.stores': '家',
'workplace.newFromYesterday': '较昨日新增',
'workplace.stat.clickHint': '点击查看订单',
'workplace.stat.clickStore': '点击查看店铺',
'workplace.stat.clickStoreOrder': '点击查看店铺订单',
'workplace.stat.sectionTodo': '待处理',
'workplace.stat.sectionTodoSub': '点击卡片进入对应列表',
'workplace.stat.sectionOverview': '今日概览',
'workplace.stat.clickHint': '查看订单',
'workplace.stat.clickStore': '查看店铺',
'workplace.stat.clickStoreOrder': '查看店铺订单',
'workplace.destMap.title': '收件目的国',
'workplace.destMap.sub': '点击美国可下钻邮编 / 港口',
'workplace.destMap.mapLabel': '全球 · 收件分布',
'workplace.destMap.usLabel': '美国 · 邮编 / 港口',
'workplace.destMap.range': '统计区间',
'workplace.destMap.range7': '近7天',
'workplace.destMap.range30': '近30天',
'workplace.destMap.range90': '近90天',
'workplace.destMap.refresh': '刷新',
'workplace.orderAnalysis.title': '订单分析',
'workplace.orderAnalysis.day': '日',
'workplace.orderAnalysis.week': '周',

View File

@ -1,6 +1,31 @@
<template>
<header id="header" class="header d-flex align-items-center fixed-top">
<div class="container-fluid container-xl d-flex align-items-center justify-content-between">
<a
href="/"
class="site-nav-wordmark"
:class="{
active: nav === 'home',
'is-active': nav === 'home',
}"
:aria-current="nav === 'home' ? 'page' : undefined"
aria-label="BCDship"
@click.prevent="onNavClick('home')"
>
<span
v-if="siteLogoSrc"
class="site-nav-wordmark__logo"
aria-hidden="true"
>
<img
:src="siteLogoSrc"
alt=""
width="36"
height="36"
/>
</span>
<span class="site-nav-wordmark__text">BCDship</span>
</a>
<button
type="button"
class="mobile-nav-toggle mobile-nav-show"
@ -38,29 +63,14 @@
:class="{
active: nav === item.id,
'is-active': nav === item.id,
'is-home': item.id === 'home',
'is-panel': isPanelItem(item.id) && panel === item.id,
}"
:aria-current="nav === item.id ? 'page' : undefined"
:aria-expanded="isPanelItem(item.id) ? panel === item.id : undefined"
:aria-haspopup="isPanelItem(item.id) ? 'dialog' : undefined"
:aria-label="item.id === 'home' ? `${brandCopy.navName} · ${isZh ? item.zh : item.en}` : undefined"
@click.prevent="onNavClick(item.id)"
>
<span
v-if="item.id === 'home' && siteLogoSrc"
class="site-nav-dock__brand"
aria-hidden="true"
>
<img
:src="siteLogoSrc"
alt=""
width="30"
height="30"
/>
</span>
<span
v-else
class="site-nav-dock__icon"
aria-hidden="true"
v-html="item.icon"
@ -129,7 +139,6 @@
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { brandLogoImages } from '@/utils/brandLogo';
import { brandCopy } from '@/utils/brandCopy';
import { useUserStore } from '@/store';
import { useRbacUserStore } from '@/store/modules/rbac-user';
import { applyRbacUserToUserStore } from '@/utils/enter-system';

View File

@ -74,7 +74,7 @@
);
const measureLabel = (label: string, fontSize: number) => {
const font = `600 ${fontSize}px "PingFang SC","Hiragino Sans GB","Microsoft YaHei","Segoe UI",sans-serif`;
const font = `700 ${fontSize}px "Nunito",ui-rounded,"SF Pro Rounded","PingFang SC","Hiragino Sans GB","Microsoft YaHei","Segoe UI",sans-serif`;
if (font !== cachedFont || label !== cachedLabel) {
ctx.font = font;
cachedFont = font;
@ -209,13 +209,18 @@
cachedFont = '';
const { totalW } = measureLabel(label || ' ', fontSize);
const fitW = fitWidthOf(totalW, fontSize);
const maxW = Math.floor(window.innerWidth * (isNarrow ? 0.58 : 0.7));
const parentW = Math.floor(root.parentElement?.clientWidth || window.innerWidth);
const maxW = Math.floor(
Math.min(parentW * 0.98, window.innerWidth * (isNarrow ? 0.92 : 0.92)),
);
const nextW = Math.max(80, Math.min(fitW, maxW));
// 按字宽写回,避免 CSS 固定大宽导致按钮盖字 / 离太远
if (Math.abs((parseFloat(root.style.width) || 0) - nextW) > 0.5) {
root.style.width = `${nextW}px`;
}
root.style.marginLeft = 'auto';
root.style.marginRight = 'auto';
const dpr = Math.min(window.devicePixelRatio || 1, dprCap);
if (nextW === width && nextH === height) {
@ -235,6 +240,7 @@
replayEnter = () => {
currentText = props.text;
cachedFont = '';
rebuild();
startEnter();
};

View File

@ -96,7 +96,9 @@
<script lang="ts" setup>
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import useLocale from '@/hooks/locale';
import SiteHeader from './SiteHeader.vue';
import SiteAdvisorShell from './SiteAdvisorShell.vue';
import SiteRoutesPanel from './SiteRoutesPanel.vue';
@ -136,7 +138,12 @@
);
const router = useRouter();
const lang = ref<'zh' | 'en'>('zh');
const { locale } = useI18n();
const { changeLocale } = useLocale();
/** 与全局 i18n / arco-locale 联动,不再单独存 ide-language */
const lang = computed<'zh' | 'en'>(() =>
String(locale.value || 'zh-CN').toLowerCase().startsWith('en') ? 'en' : 'zh',
);
const nav = ref('home');
const panel = ref<PanelId>(null);
const routesDest = ref('all');
@ -193,16 +200,6 @@
let previousTitle = '';
function readLang(): 'zh' | 'en' {
try {
const saved = localStorage.getItem('ide-language');
if (saved === 'zh' || saved === 'en') return saved;
} catch {
/* ignore */
}
return 'zh';
}
function ensureMeta(name: string, content: string) {
let node = document.querySelector(`meta[name="${name}"]`);
if (!node) {
@ -394,11 +391,15 @@
wecomOpen.value = true;
}
function toggleLang() {
const next = lang.value === 'zh' ? 'en' : 'zh';
lang.value = next;
localStorage.setItem('ide-language', next);
trackSiteEvent('home_lang_toggle', { lang: next });
async function toggleLang() {
const nextLocale = lang.value === 'zh' ? 'en-US' : 'zh-CN';
await changeLocale(nextLocale, { silent: true });
try {
localStorage.removeItem('ide-language');
} catch {
/* ignore */
}
trackSiteEvent('home_lang_toggle', { lang: lang.value });
}
function onKeydown(e: KeyboardEvent) {
@ -443,7 +444,19 @@
onMounted(() => {
previousTitle = document.title;
lang.value = readLang();
// 一次性把旧官网 ide-language 迁到全局 arco-locale
try {
const legacy = localStorage.getItem('ide-language');
if (legacy === 'en' || legacy === 'zh') {
const want = legacy === 'en' ? 'en-US' : 'zh-CN';
if (String(locale.value) !== want) {
void changeLocale(want, { silent: true });
}
localStorage.removeItem('ide-language');
}
} catch {
/* ignore */
}
applyMeta();
document.documentElement.classList.add('command-home');
document.body.classList.add('command-home');

View File

@ -0,0 +1,50 @@
/**
* Self-hosted Nunito (woff2) so macOS / iOS Safari get the same rounded face
* without depending on Google Fonts CDN.
*/
import nunito400 from '@fontsource/nunito/files/nunito-latin-400-normal.woff2?url';
import nunito500 from '@fontsource/nunito/files/nunito-latin-500-normal.woff2?url';
import nunito600 from '@fontsource/nunito/files/nunito-latin-600-normal.woff2?url';
import nunito700 from '@fontsource/nunito/files/nunito-latin-700-normal.woff2?url';
import nunito800 from '@fontsource/nunito/files/nunito-latin-800-normal.woff2?url';
import nunitoExt400 from '@fontsource/nunito/files/nunito-latin-ext-400-normal.woff2?url';
import nunitoExt500 from '@fontsource/nunito/files/nunito-latin-ext-500-normal.woff2?url';
import nunitoExt600 from '@fontsource/nunito/files/nunito-latin-ext-600-normal.woff2?url';
import nunitoExt700 from '@fontsource/nunito/files/nunito-latin-ext-700-normal.woff2?url';
import nunitoExt800 from '@fontsource/nunito/files/nunito-latin-ext-800-normal.woff2?url';
type Face = { weight: number; url: string; unicodeRange?: string };
const LATIN =
'U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD';
const LATIN_EXT =
'U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF';
const faces: Face[] = [
{ weight: 400, url: nunitoExt400, unicodeRange: LATIN_EXT },
{ weight: 500, url: nunitoExt500, unicodeRange: LATIN_EXT },
{ weight: 600, url: nunitoExt600, unicodeRange: LATIN_EXT },
{ weight: 700, url: nunitoExt700, unicodeRange: LATIN_EXT },
{ weight: 800, url: nunitoExt800, unicodeRange: LATIN_EXT },
{ weight: 400, url: nunito400, unicodeRange: LATIN },
{ weight: 500, url: nunito500, unicodeRange: LATIN },
{ weight: 600, url: nunito600, unicodeRange: LATIN },
{ weight: 700, url: nunito700, unicodeRange: LATIN },
{ weight: 800, url: nunito800, unicodeRange: LATIN },
];
export function buildOfficialSiteFontCss(): string {
return faces
.map(
(face) => `@font-face{
font-family:'Nunito';
font-style:normal;
font-display:swap;
font-weight:${face.weight};
src:url('${face.url}') format('woff2');
unicode-range:${face.unicodeRange};
}`,
)
.join('\n');
}

View File

@ -7,6 +7,7 @@ import vendorCss from '../styles/vendor.css?inline';
import iconsCss from '../styles/icons.css?inline';
import mainCss from '../styles/main.css?inline';
import advisorCss from '../styles/ai-advisor.css?inline';
import { buildOfficialSiteFontCss } from './site-fonts';
const STYLE_ID = 'official-site-css';
@ -16,7 +17,13 @@ export function mountOfficialSiteStyles() {
const el = document.createElement('style');
el.id = STYLE_ID;
el.setAttribute('data-official-site', '1');
el.textContent = [vendorCss, iconsCss, mainCss, advisorCss].join('\n');
el.textContent = [
buildOfficialSiteFontCss(),
vendorCss,
iconsCss,
mainCss,
advisorCss,
].join('\n');
document.head.appendChild(el);
}

View File

@ -185,11 +185,49 @@ body.command-home .site-nav-dock {
flex-direction: column;
}
body.command-home #header .site-nav-wordmark,
body.command-home #navbar .site-nav-dock a {
display: inline-flex;
align-items: center;
}
body.command-home #header .site-nav-wordmark {
position: relative;
z-index: 4;
flex-shrink: 0;
gap: 8px;
margin-right: auto;
color: var(--ai-brand);
font-weight: 750;
letter-spacing: 0.01em;
text-decoration: none;
white-space: nowrap;
}
body.command-home .site-nav-wordmark__text {
color: var(--ai-brand);
font-weight: 800;
font-size: 1.05rem;
letter-spacing: 0.02em;
line-height: 1;
}
body.command-home .site-nav-wordmark__logo {
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
}
body.command-home .site-nav-wordmark__logo img {
display: block;
width: 36px;
height: 36px;
object-fit: contain;
}
@media (max-width: 1279px) {
/* 手机/平板抽屉:纵向列表,浅色底保证对比度 */
body.command-home #navbar,
@ -210,6 +248,14 @@ body.command-home #navbar .site-nav-dock a {
border-bottom-left-radius: 24px;
box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
}
body.command-home #header .site-nav-wordmark {
position: relative;
z-index: 4;
height: 44px;
margin-right: auto;
padding: 0;
font-size: 1rem;
}
body.command-home .site-nav-dock {
display: contents;
}
@ -218,20 +264,6 @@ body.command-home #navbar .site-nav-dock a {
body.command-home .site-nav-tools__glass {
display: none !important;
}
body.command-home .site-nav-dock__brand {
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
}
body.command-home .site-nav-dock__brand img {
display: block;
width: 32px;
height: 32px;
object-fit: contain;
}
body.command-home #navbar > ul {
gap: 8px;
}
@ -342,6 +374,42 @@ body.command-home #navbar .site-nav-dock a {
padding: 0;
list-style: none;
}
body.command-home #header .site-nav-wordmark,
body.command-home #header .site-nav-wordmark:focus {
position: relative;
z-index: 4;
flex-shrink: 0;
gap: 8px;
height: 46px;
margin-right: auto;
padding: 0 2px;
border: none;
border-radius: 0;
background: transparent;
box-shadow: none;
color: var(--ai-brand);
font-size: 1.05rem;
font-weight: 750;
letter-spacing: 0.01em;
line-height: 1;
transition: color 0.18s ease, opacity 0.18s ease;
}
body.command-home .site-nav-wordmark__logo {
width: 36px;
height: 36px;
}
body.command-home .site-nav-wordmark__logo img {
width: 36px;
height: 36px;
}
body.command-home #header .site-nav-wordmark:hover,
body.command-home #header .site-nav-wordmark:focus-visible {
color: var(--ai-brand-hover);
}
body.command-home #header .site-nav-wordmark.is-active,
body.command-home #header .site-nav-wordmark.is-active:focus {
color: var(--ai-brand);
}
body.command-home .site-nav-dock {
position: absolute;
left: 50%;
@ -352,7 +420,7 @@ body.command-home #navbar .site-nav-dock a {
align-items: stretch;
justify-content: center;
gap: 0;
width: min(520px, calc(100vw - 300px));
width: min(460px, calc(100vw - 380px));
height: 46px;
padding: 4px;
overflow: hidden;
@ -365,35 +433,6 @@ body.command-home #navbar .site-nav-dock a {
0 10px 32px rgba(15, 23, 42, 0.09),
0 2px 6px rgba(15, 23, 42, 0.04);
}
/* 首页项:Logo,与其它菜单同宽同布局 */
body.command-home .site-nav-dock__brand {
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
}
body.command-home .site-nav-dock__brand img {
display: block;
width: 30px;
height: 30px;
object-fit: contain;
}
body.command-home #navbar .site-nav-dock__item.is-home {
gap: 0;
}
body.command-home #navbar .site-nav-dock__item.is-home .site-nav-dock__label {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
body.command-home .site-nav-dock__glass {
position: absolute;
inset: 0;
@ -457,7 +496,6 @@ body.command-home #navbar .site-nav-dock a {
color: var(--ai-text);
font-weight: 600;
}
body.command-home #navbar li.site-nav-dock:hover > a,
body.command-home #navbar .site-nav-dock:hover > a {
color: inherit;
}
@ -2398,8 +2436,10 @@ body.command-home #navbar .site-nav-avatar:hover {
}
.ai-welcome-title-wrap .ai-runway {
margin: 0 auto !important;
max-width: min(760px, 96%);
display: block;
margin-left: auto !important;
margin-right: auto !important;
max-width: min(1100px, 98%);
}
.ai-welcome-cta-row {

View File

@ -19,8 +19,10 @@
--kc-radius-sm: 10px;
--kc-radius-md: 20px;
--kc-radius-lg: 32px;
--font-default: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
'Microsoft YaHei', Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
/* Nunito self-hosted; ui-rounded / SF Pro Rounded cover Apple while loading */
--font-default: 'Nunito', ui-rounded, 'SF Pro Rounded', 'SF Pro Display',
-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
--font-primary: var(--font-default);
--font-secondary: var(--font-default);
--color-default: var(--kc-primary);

View File

@ -29,12 +29,15 @@ export default {
'wechat.follow.later': 'Maybe later',
'wechat.follow.openInWechat': 'Please open this page in WeChat to follow the official account',
'wechat.openidMigrate.title': 'Update WeChat binding',
'wechat.openidMigrate.title': 'Merge existing account',
'wechat.openidMigrate.subtitle': 'This WeChat nickname matches a customer',
'wechat.openidMigrate.nicknameLabel': 'WeChat name',
'wechat.openidMigrate.tip':
'WeChat nickname “{nickname}” matches an existing customer. If you switched official accounts, enter that customer’s phone to update WeChat OpenID / UnionID.',
'wechat.openidMigrate.phonePlaceholder': 'Enter phone number',
'If this is your account (e.g. you switched official accounts), enter that customer’s phone to merge and update WeChat binding.',
'wechat.openidMigrate.phoneLabel': 'Customer phone',
'wechat.openidMigrate.phonePlaceholder': 'Registered phone number',
'wechat.openidMigrate.phoneRequired': 'Phone number is required',
'wechat.openidMigrate.confirm': 'Update and sign in',
'wechat.openidMigrate.confirm': 'Merge & sign in',
'wechat.openidMigrate.cancel': 'Not now',
'wechat.openidMigrate.ticketExpired': 'Session expired. Please authorize again',
'wechat.openidMigrate.failed': 'Failed to update WeChat binding',

View File

@ -24,13 +24,16 @@ export default {
'wechat.follow.later': '稍后再说',
'wechat.follow.openInWechat': '请在微信内打开本页后再关注公众号',
'wechat.openidMigrate.title': '更新微信绑定',
'wechat.openidMigrate.title': '合并已有账号',
'wechat.openidMigrate.subtitle': '微信昵称与已有客户相同',
'wechat.openidMigrate.nicknameLabel': '微信昵称',
'wechat.openidMigrate.tip':
'检测到微信昵称「{nickname}」与已有客户相同。若您更换了公众号,请输入该客户手机号以更新微信绑定(OpenID / UnionID)。',
'wechat.openidMigrate.phonePlaceholder': '请输入手机号',
'若这是您本人账号(例如更换了公众号),请填写该客户手机号以合并并更新微信绑定。',
'wechat.openidMigrate.phoneLabel': '客户手机号',
'wechat.openidMigrate.phonePlaceholder': '请输入已注册手机号',
'wechat.openidMigrate.phoneRequired': '请输入手机号',
'wechat.openidMigrate.confirm': '确认更新并登录',
'wechat.openidMigrate.cancel': '暂不更新',
'wechat.openidMigrate.confirm': '确认合并并登录',
'wechat.openidMigrate.cancel': '暂不合并',
'wechat.openidMigrate.ticketExpired': '凭证已失效,请重新授权',
'wechat.openidMigrate.failed': '更新微信绑定失败',
'wechat.openidMigrate.success': '微信绑定已更新',