feat: 开票管理与品牌文案统一(PC/H5 短名全称同源)
All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m25s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-11-21 12:22:57 +08:00
parent 836afd30a9
commit 8f3a41956e
53 changed files with 4564 additions and 198 deletions

View File

@ -87,16 +87,24 @@
root.style.setProperty('--ai-bg', pageBg);
root.style.setProperty('--ai-canvas', pageBg);
try {
/* 运营端 /h5/admin 勿复用客户中心标题,避免浏览器顶栏串文案 */
/* 运营端 /h5/admin 勿复用客户中心标题,避免浏览器顶栏串文案;短名优先读本地品牌缓存 */
var brandName = 'BCD';
try {
var brandRaw = localStorage.getItem('oms_brand_copy');
if (brandRaw) {
var brandObj = JSON.parse(brandRaw);
if (brandObj && brandObj.navName) brandName = String(brandObj.navName);
}
} catch (eBrand) {}
document.title = isAdminH5
? isEn
? 'BCD Ops Center'
: 'BCD运营中心'
? brandName + ' Ops Center'
: brandName + '运营中心'
: isH5
? isEn
? 'BCD Customer Center'
: 'BCD客户中心'
: 'BCD I Faster & Simpler';
? brandName + ' Customer Center'
: brandName + '客户中心'
: brandName + ' I Faster & Simpler';
} catch (e2) {}
if (path === '/login') {
var plane = document.createElement('link');
@ -113,6 +121,39 @@
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
/>
<title>BCD I Faster &amp; Simpler</title>
<script>
/* <title> 解析后会覆盖前面脚本写入的 document.title,这里再按本地品牌缓存刷一次 */
(function () {
try {
var path = location.pathname || '';
var isH5 =
path === '/h5' ||
path.indexOf('/h5/') === 0 ||
path.indexOf('/wechat/') === 0 ||
path === '/track/query' ||
path.indexOf('/track/query/') === 0;
var isAdminH5 = path === '/h5/admin' || path.indexOf('/h5/admin/') === 0;
var locale =
localStorage.getItem('arco-locale') || localStorage.getItem('locale') || '';
var isEn = /^en/i.test(locale);
var brandName = 'BCD';
var brandRaw = localStorage.getItem('oms_brand_copy');
if (brandRaw) {
var brandObj = JSON.parse(brandRaw);
if (brandObj && brandObj.navName) brandName = String(brandObj.navName);
}
document.title = isAdminH5
? isEn
? brandName + ' Ops Center'
: brandName + '运营中心'
: isH5
? isEn
? brandName + ' Customer Center'
: brandName + '客户中心'
: brandName + ' I Faster & Simpler';
} catch (e) {}
})();
</script>
<link rel="stylesheet" type="text/css" media="print" href="/print-lock.css" />
<!-- DNS 预解析,加速资源加载 -->
<link rel="dns-prefetch" href="//43.139.210.35" />

450
src/api/finance/invoice.ts Normal file
View File

@ -0,0 +1,450 @@
import { axiosInstance } from '@/api/rbac'
import { assertBusinessOk, omsUrl, parseListPayload, unwrapData } from '@/api/oms/common'
export const INVOICE_STATUS = {
Draft: 'draft',
PendingApproval: 'pendingApproval',
Approved: 'approved',
Issued: 'issued',
Rejected: 'rejected',
Voided: 'voided',
RedFlushed: 'redFlushed',
} as const
export const INVOICE_SOURCE_TYPE = {
ParcelOrder: 'parcelOrder',
PickupOrder: 'pickupOrder',
StorageRent: 'storageRent',
} as const
export const INVOICE_TYPE = {
Normal: 'normal',
Special: 'special',
} as const
export const INVOICE_MEDIUM = {
Electronic: 'electronic',
Paper: 'paper',
} as const
export const DEFAULT_INVOICE_TAX_RATE = 0.06
export interface InvoiceProfile {
id: number
customerId: number
titleName: string
taxNo: string
addressPhone?: string
bankNameAccount?: string
isDefault: boolean
remark?: string
createTime?: string
updateTime?: string
}
export interface InvoiceProfileSavePayload {
id?: number
customerId?: number
titleName: string
taxNo: string
addressPhone?: string
bankNameAccount?: string
isDefault?: boolean
remark?: string
}
export interface InvoiceSelectableItem {
sourceType: string
sourceTypeName: string
sourceId: number
sourceNo: string
baseAmount: number
occupiedAmount: number
remainingAmount: number
currency: string
paidTime?: string
}
export interface InvoiceSelectableParams {
customerId?: number
sourceType?: string
keyword?: string
page?: number
pageSize?: number
}
export interface InvoiceApplyLine {
id?: number
sourceType: string
sourceTypeName?: string
sourceId: number
sourceNo: string
amount: number
currency?: string
remark?: string
}
export interface InvoiceApply {
id: number
applyNo: string
customerId: number
customerCode?: string
customerName?: string
invoiceType: string
invoiceTypeName?: string
medium: string
mediumName?: string
titleName: string
taxNo: string
addressPhone?: string
bankNameAccount?: string
amountTotal: number
taxRate: number
currency: string
status: string
statusName?: string
applicantSource?: string
invoiceCode?: string
invoiceNumber?: string
invoiceDate?: string
invoicePdfUrl?: string
remark?: string
approvalInstanceId?: number | null
approvalInstanceNo?: string
approvalPending: boolean
rejectReason?: string
issueTime?: string
issueBy?: string
createTime?: string
updateTime?: string
decision?: string
message?: string
lines?: InvoiceApplyLine[]
}
export interface InvoiceApplyListParams {
page?: number
pageSize?: number
customerId?: number
status?: string
invoiceType?: string
keyword?: string
startTime?: string
endTime?: string
}
export interface InvoiceApplyLineInput {
sourceType: string
sourceId: number
amount: number
remark?: string
}
export interface InvoiceApplyCreatePayload {
customerId?: number
invoiceType: string
medium: string
profileId?: number
titleName?: string
taxNo?: string
addressPhone?: string
bankNameAccount?: string
taxRate?: number
remark?: string
submit?: boolean
lines: InvoiceApplyLineInput[]
}
export interface InvoiceApplyUpdatePayload extends InvoiceApplyCreatePayload {
id: number
}
export interface InvoiceIssuePayload {
id: number
invoiceCode?: string
invoiceNumber: string
invoiceDate?: string
invoicePdfUrl?: string
remark?: string
}
export type InvoiceExportParams = Omit<InvoiceApplyListParams, 'page' | 'pageSize'>
function pickRaw(item: any, ...keys: string[]) {
for (const key of keys) {
const value = item?.[key]
if (value !== undefined && value !== null) return value
}
return undefined
}
function toNumber(value: unknown, fallback = 0) {
const n = Number(value)
return Number.isFinite(n) ? n : fallback
}
function toOptionalNumber(value: unknown): number | null {
const n = Number(value)
return Number.isFinite(n) && n > 0 ? n : null
}
export function roundInvoiceMoney(value: number) {
return Math.round((Number(value) || 0) * 100) / 100
}
export function invoiceLineKey(sourceType: string, sourceId: number) {
return `${sourceType}:${sourceId}`
}
export function mapInvoiceProfile(item: any): InvoiceProfile {
return {
id: toNumber(pickRaw(item, 'id', 'Id')),
customerId: toNumber(pickRaw(item, 'customerId', 'CustomerId')),
titleName: String(pickRaw(item, 'titleName', 'TitleName') ?? ''),
taxNo: String(pickRaw(item, 'taxNo', 'TaxNo') ?? ''),
addressPhone: pickRaw(item, 'addressPhone', 'AddressPhone') || undefined,
bankNameAccount: pickRaw(item, 'bankNameAccount', 'BankNameAccount') || undefined,
isDefault: Boolean(pickRaw(item, 'isDefault', 'IsDefault')),
remark: pickRaw(item, 'remark', 'Remark') || undefined,
createTime: pickRaw(item, 'createTime', 'CreateTime') || undefined,
updateTime: pickRaw(item, 'updateTime', 'UpdateTime') || undefined,
}
}
export function mapInvoiceSelectableItem(item: any): InvoiceSelectableItem {
return {
sourceType: String(pickRaw(item, 'sourceType', 'SourceType') ?? ''),
sourceTypeName: String(pickRaw(item, 'sourceTypeName', 'SourceTypeName') ?? ''),
sourceId: toNumber(pickRaw(item, 'sourceId', 'SourceId')),
sourceNo: String(pickRaw(item, 'sourceNo', 'SourceNo') ?? ''),
baseAmount: toNumber(pickRaw(item, 'baseAmount', 'BaseAmount')),
occupiedAmount: toNumber(pickRaw(item, 'occupiedAmount', 'OccupiedAmount')),
remainingAmount: toNumber(pickRaw(item, 'remainingAmount', 'RemainingAmount')),
currency: String(pickRaw(item, 'currency', 'Currency') ?? 'CNY'),
paidTime: pickRaw(item, 'paidTime', 'PaidTime') || undefined,
}
}
export function mapInvoiceApplyLine(item: any): InvoiceApplyLine {
return {
id: toOptionalNumber(pickRaw(item, 'id', 'Id')) || undefined,
sourceType: String(pickRaw(item, 'sourceType', 'SourceType') ?? ''),
sourceTypeName: pickRaw(item, 'sourceTypeName', 'SourceTypeName') || undefined,
sourceId: toNumber(pickRaw(item, 'sourceId', 'SourceId')),
sourceNo: String(pickRaw(item, 'sourceNo', 'SourceNo') ?? ''),
amount: toNumber(pickRaw(item, 'amount', 'Amount')),
currency: pickRaw(item, 'currency', 'Currency') || 'CNY',
remark: pickRaw(item, 'remark', 'Remark') || undefined,
}
}
export function mapInvoiceApply(item: any): InvoiceApply {
const approvalId = toOptionalNumber(pickRaw(item, 'approvalInstanceId', 'ApprovalInstanceId'))
const linesRaw = pickRaw(item, 'lines', 'Lines')
return {
id: toNumber(pickRaw(item, 'id', 'Id')),
applyNo: String(pickRaw(item, 'applyNo', 'ApplyNo') ?? ''),
customerId: toNumber(pickRaw(item, 'customerId', 'CustomerId')),
customerCode: pickRaw(item, 'customerCode', 'CustomerCode') || undefined,
customerName: pickRaw(item, 'customerName', 'CustomerName') || undefined,
invoiceType: String(pickRaw(item, 'invoiceType', 'InvoiceType') ?? ''),
invoiceTypeName: pickRaw(item, 'invoiceTypeName', 'InvoiceTypeName') || undefined,
medium: String(pickRaw(item, 'medium', 'Medium') ?? ''),
mediumName: pickRaw(item, 'mediumName', 'MediumName') || undefined,
titleName: String(pickRaw(item, 'titleName', 'TitleName') ?? ''),
taxNo: String(pickRaw(item, 'taxNo', 'TaxNo') ?? ''),
addressPhone: pickRaw(item, 'addressPhone', 'AddressPhone') || undefined,
bankNameAccount: pickRaw(item, 'bankNameAccount', 'BankNameAccount') || undefined,
amountTotal: toNumber(pickRaw(item, 'amountTotal', 'AmountTotal')),
taxRate: toNumber(pickRaw(item, 'taxRate', 'TaxRate'), DEFAULT_INVOICE_TAX_RATE),
currency: String(pickRaw(item, 'currency', 'Currency') ?? 'CNY'),
status: String(pickRaw(item, 'status', 'Status') ?? ''),
statusName: pickRaw(item, 'statusName', 'StatusName') || undefined,
applicantSource: pickRaw(item, 'applicantSource', 'ApplicantSource') || undefined,
invoiceCode: pickRaw(item, 'invoiceCode', 'InvoiceCode') || undefined,
invoiceNumber: pickRaw(item, 'invoiceNumber', 'InvoiceNumber') || undefined,
invoiceDate: pickRaw(item, 'invoiceDate', 'InvoiceDate') || undefined,
invoicePdfUrl: pickRaw(item, 'invoicePdfUrl', 'InvoicePdfUrl') || undefined,
remark: pickRaw(item, 'remark', 'Remark') || undefined,
approvalInstanceId: approvalId,
approvalInstanceNo: String(pickRaw(item, 'approvalInstanceNo', 'ApprovalInstanceNo') ?? '').trim() || undefined,
approvalPending: Boolean(pickRaw(item, 'approvalPending', 'ApprovalPending')),
rejectReason: pickRaw(item, 'rejectReason', 'RejectReason') || undefined,
issueTime: pickRaw(item, 'issueTime', 'IssueTime') || undefined,
issueBy: pickRaw(item, 'issueBy', 'IssueBy') || undefined,
createTime: pickRaw(item, 'createTime', 'CreateTime') || undefined,
updateTime: pickRaw(item, 'updateTime', 'UpdateTime') || undefined,
decision: pickRaw(item, 'decision', 'Decision') || undefined,
message: pickRaw(item, 'message', 'Message') || undefined,
lines: Array.isArray(linesRaw) ? linesRaw.map(mapInvoiceApplyLine) : undefined,
}
}
/** 编辑草稿时把本单占用加回可开票余额,避免来源从 selectable 消失 */
export function mergeSelectableWithApplyLines(
items: InvoiceSelectableItem[],
lines: InvoiceApplyLine[] = [],
): InvoiceSelectableItem[] {
const map = new Map<string, InvoiceSelectableItem>()
for (const item of items) {
map.set(invoiceLineKey(item.sourceType, item.sourceId), { ...item })
}
for (const line of lines) {
const key = invoiceLineKey(line.sourceType, line.sourceId)
const existing = map.get(key)
if (existing) {
existing.remainingAmount = roundInvoiceMoney(existing.remainingAmount + line.amount)
} else {
map.set(key, {
sourceType: line.sourceType,
sourceTypeName: line.sourceTypeName || line.sourceType,
sourceId: line.sourceId,
sourceNo: line.sourceNo,
baseAmount: line.amount,
occupiedAmount: 0,
remainingAmount: line.amount,
currency: line.currency || 'CNY',
})
}
}
return Array.from(map.values())
}
function buildListQuery(params: InvoiceApplyListParams) {
return {
page: params.page,
pageSize: params.pageSize,
customerId: params.customerId || undefined,
status: params.status && params.status !== 'all' ? params.status : undefined,
invoiceType: params.invoiceType && params.invoiceType !== 'all' ? params.invoiceType : undefined,
keyword: params.keyword?.trim() || undefined,
startTime: params.startTime || undefined,
endTime: params.endTime || undefined,
}
}
/** GET /finance/invoice/profile/list */
export async function getInvoiceProfileList(customerId?: number) {
const res = await axiosInstance.get(omsUrl('/finance/invoice/profile/list'), {
params: { customerId: customerId || undefined },
})
const data = unwrapData<any>(res.data)
const list = Array.isArray(data) ? data : data?.items ?? data?.Items ?? []
return (Array.isArray(list) ? list : []).map(mapInvoiceProfile)
}
/** POST /finance/invoice/profile/save */
export async function saveInvoiceProfile(body: InvoiceProfileSavePayload) {
const res = await axiosInstance.post(omsUrl('/finance/invoice/profile/save'), body)
return mapInvoiceProfile(unwrapData(res.data))
}
/** POST /finance/invoice/profile/delete */
export async function deleteInvoiceProfile(id: number) {
const res = await axiosInstance.post(omsUrl('/finance/invoice/profile/delete'), { id })
assertBusinessOk(res.data)
}
/** GET /finance/invoice/selectable */
export async function getInvoiceSelectable(params: InvoiceSelectableParams) {
const res = await axiosInstance.get(omsUrl('/finance/invoice/selectable'), {
params: {
customerId: params.customerId || undefined,
sourceType: params.sourceType || undefined,
keyword: params.keyword?.trim() || undefined,
page: params.page || 1,
pageSize: params.pageSize || 50,
},
})
const payload = parseListPayload<any>(res.data)
return {
items: (payload.items || []).map(mapInvoiceSelectableItem),
total: payload.total,
}
}
/** GET /finance/invoice/list */
export async function getInvoiceApplyList(params: InvoiceApplyListParams) {
const res = await axiosInstance.get(omsUrl('/finance/invoice/list'), {
params: buildListQuery(params),
})
const payload = parseListPayload<any>(res.data)
return {
items: (payload.items || []).map(mapInvoiceApply),
total: payload.total,
}
}
/** GET /finance/invoice/detail */
export async function getInvoiceApplyDetail(id: number) {
const res = await axiosInstance.get(omsUrl('/finance/invoice/detail'), { params: { id } })
return mapInvoiceApply(unwrapData(res.data))
}
/** POST /finance/invoice/apply */
export async function createInvoiceApply(body: InvoiceApplyCreatePayload) {
const res = await axiosInstance.post(omsUrl('/finance/invoice/apply'), body)
return mapInvoiceApply(unwrapData(res.data))
}
/** POST /finance/invoice/update */
export async function updateInvoiceApply(body: InvoiceApplyUpdatePayload) {
const res = await axiosInstance.post(omsUrl('/finance/invoice/update'), body)
return mapInvoiceApply(unwrapData(res.data))
}
/** POST /finance/invoice/submit */
export async function submitInvoiceApply(id: number) {
const res = await axiosInstance.post(omsUrl('/finance/invoice/submit'), { id })
return mapInvoiceApply(unwrapData(res.data))
}
/** POST /finance/invoice/issue */
export async function issueInvoiceApply(body: InvoiceIssuePayload) {
const res = await axiosInstance.post(omsUrl('/finance/invoice/issue'), body)
return mapInvoiceApply(unwrapData(res.data))
}
/** POST /finance/invoice/void */
export async function voidInvoiceApply(id: number, remark?: string) {
const res = await axiosInstance.post(omsUrl('/finance/invoice/void'), {
id,
remark: remark?.trim() || undefined,
})
return mapInvoiceApply(unwrapData(res.data))
}
/** GET /finance/invoice/export → Excel 文件流 */
export async function exportInvoiceApplies(params: InvoiceExportParams) {
const res = await axiosInstance.get(omsUrl('/finance/invoice/export'), {
params: buildListQuery(params),
responseType: 'blob',
})
const blob = res.data as Blob
const ct = (res.headers['content-type'] || '').toString()
if (ct.includes('application/json')) {
const text = await blob.text()
try {
const json = JSON.parse(text)
throw new Error(json.msg ?? json.message ?? json.Message ?? '导出失败')
} catch (e: any) {
if (e?.message && e.message !== '导出失败') throw e
throw new Error(text || '导出失败')
}
}
const disposition = (res.headers['content-disposition'] || '').toString()
let fileName = `invoice-applies-${new Date().toISOString().slice(0, 10)}.xlsx`
const match = disposition.match(/filename\*?=(?:UTF-8'')?["']?([^"';]+)/i)
if (match?.[1]) {
fileName = decodeURIComponent(match[1].trim())
}
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = fileName.endsWith('.xlsx') ? fileName : `${fileName}.xlsx`
a.style.display = 'none'
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
URL.revokeObjectURL(url)
}

View File

@ -93,6 +93,27 @@ export interface BrandLogoDto {
mascotUrl?: string
}
export interface BrandCopyDto {
navName?: string
navFullName?: string
aiWelcomeTitleZh?: string
aiWelcomeTitleShortZh?: string
aiWelcomeTitleEn?: string
aiWelcomeTitleShortEn?: string
}
/** 获取品牌文案(匿名可读;对象存储 JSON,非数据库) */
export async function getBrandCopy() {
const res = await axiosInstance.get(omsUrl('/system/other-config/brand-copy'))
return unwrapData<BrandCopyDto>(res.data)
}
/** 保存品牌文案到对象存储 */
export async function saveBrandCopy(body: BrandCopyDto) {
const res = await axiosInstance.post(omsUrl('/system/other-config/brand-copy/save'), body)
return unwrapData<BrandCopyDto>(res.data)
}
/** 获取品牌 Logo(系统顶栏 / 官网 / 标签 / 吉祥物)可访问地址 */
export async function getBrandLogo() {
const res = await axiosInstance.get(omsUrl('/system/other-config/brand-logo'))

View File

@ -493,6 +493,7 @@ import { useRbacUserStore } from '@/store/modules/rbac-user';
import { isMobileUserAgent, isWeChatBrowser } from '@/utils/device';
import { openWecomKf } from '@/utils/wecomKf';
import { resolveTextModelId } from '@/views/system/aiAssistant/providerCatalog';
import { brandCopy } from '@/utils/brandCopy';
import EdiAvatar from './EdiAvatar.vue';
import EdiChatDialog from './EdiChatDialog.vue';
import EdiComposer from './EdiComposer.vue';
@ -1171,7 +1172,7 @@ function ensureWelcomeMessage() {
role: 'assistant',
content: isOpsAudience.value
? t('ediAssistant.ops.welcomeMsg')
: t('ediAssistant.welcomeMsg'),
: t('ediAssistant.welcomeMsg', { name: brandCopy.navName }),
});
saveThreads();
}
@ -1286,7 +1287,7 @@ function resolveTagReply(tagId: string) {
return t('ediAssistant.trackWaybillDemo', { no: waybillDisplayNo.value });
}
if (def.track) return t('ediAssistant.trackHint');
if (def.replyKey) return t(def.replyKey);
if (def.replyKey) return t(def.replyKey, { name: brandCopy.navName });
return t('ediAssistant.emptyReply');
}

View File

@ -17,13 +17,13 @@
<a
class="agent-side-rail__brand"
href="/"
:title="t('brand.fullName')"
:title="brandCopy.navFullName"
@click.prevent="goOfficialSite"
>
<template v-if="navLogoSrc">
<img :src="navLogoSrc" :alt="t('brand.name')" class="agent-side-rail__brand-logo" />
<img :src="navLogoSrc" :alt="brandCopy.navName" class="agent-side-rail__brand-logo" />
<span class="agent-side-rail__brand-name agent-side-rail__fade">{{
t('brand.name')
brandCopy.navName
}}</span>
</template>
<span v-else class="agent-side-rail__brand-mark" aria-hidden="true">{{
@ -118,6 +118,7 @@ import {
CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH,
} from '@/utils/customer-portal-nav'
import { BRAND_TEXT_LOGO, brandLogoImages } from '@/utils/brandLogo'
import { brandCopy } from '@/utils/brandCopy'
const AGENT_SIDE_RAIL_COLLAPSED_WIDTH = CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH
const AGENT_SIDE_RAIL_EXPANDED_WIDTH = CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH

View File

@ -18,13 +18,13 @@
<a
class="customer-side-rail__brand"
href="/"
:title="t('brand.fullName')"
:title="brandCopy.navFullName"
@click.prevent="goOfficialSite"
>
<template v-if="navLogoSrc">
<img :src="navLogoSrc" :alt="t('brand.name')" class="customer-side-rail__brand-logo" />
<img :src="navLogoSrc" :alt="brandCopy.navName" class="customer-side-rail__brand-logo" />
<span class="customer-side-rail__brand-name customer-side-rail__fade">{{
t('brand.name')
brandCopy.navName
}}</span>
</template>
<span v-else class="customer-side-rail__brand-mark" aria-hidden="true">{{
@ -207,6 +207,7 @@ import {
} 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'

View File

@ -6,13 +6,13 @@
v-if="navLogoSrc"
class="top-nav-logo"
href="/"
:title="t('brand.fullName')"
:title="brandCopy.navFullName"
@click="goOfficialSite"
>
<img :src="navLogoSrc" :alt="t('brand.name')" />
<img :src="navLogoSrc" :alt="brandCopy.navName" />
<div class="top-nav-logo__brand">
<span class="top-nav-logo__name">{{ t('brand.name') }}</span>
<span class="top-nav-logo__full">{{ t('brand.fullName') }}</span>
<span class="top-nav-logo__name">{{ brandCopy.navName }}</span>
<span class="top-nav-logo__full">{{ brandCopy.navFullName }}</span>
</div>
</a>
@ -289,6 +289,7 @@ import { openWindow, regexUrl } from '@/utils';
import { MenuService, AuthService } from '@/api/rbac';
import type { MenuTreeDto } from '@/api/rbac';
import { brandLogoImages } from '@/utils/brandLogo';
import { brandCopy } from '@/utils/brandCopy';
import {
initHiprintClientState,
setHiprintClientEnabled,

View File

@ -1,4 +1,5 @@
import { ref } from 'vue';
import { brandCopy } from '@/utils/brandCopy';
// RBAC 系统暂不使用系统配置接口
// import { sysSysInfoGet } from '@/api/SimpleAdmin/common';
@ -22,12 +23,12 @@ export function useSystemConfig() {
const fetchSysInfo = async () => {
try {
loading.value = true;
// RBAC 系统使用默认配置
// RBAC 系统使用默认配置(短名/全称跟品牌文案)
const defaultConfig = {
SYS_NAME: 'BCD',
SYS_NAME: brandCopy.navName,
SYS_VERSION: 'v1.0.0',
SYS_LOGO: '/src/assets/logo.png',
SYS_FULL_NAME: 'Business & Customer & Delivery',
SYS_FULL_NAME: brandCopy.navFullName,
};
sysInfo.value = defaultConfig;
logoUrl.value = defaultConfig.SYS_LOGO;

View File

@ -198,6 +198,8 @@ export const PERMISSION_ACTION_LABELS: Record<string, string> = {
OrderNow: '立刻下单',
SavePermissions: '保存权限',
SelectAll: '全选',
Issue: '开具',
Void: '作废',
DeselectAll: '取消全选',
ExpandAll: '全部展开',
CollapseAll: '全部收起',
@ -345,6 +347,8 @@ export const PAGE_BUTTON_PARENT_ALIASES: Record<string, string> = {
'User.Marketing.Member': 'User.Marketing.Member',
'User.Marketing.Coupons': 'User.Marketing.Coupons',
'User.Marketing.Commission': 'User.Marketing.Commission',
'User.Invoice': 'User.Invoice',
'Finance.InvoiceManage': 'Finance.InvoiceManage',
'Kb.Category.Query': 'Knowledge.Category',
'Kb.Article.Query': 'Knowledge.Article',
'Knowledge.Category.Query': 'Knowledge.Category',
@ -932,6 +936,11 @@ const CORE_GROUPS: PageButtonGroup[] = [
{ code: 'Transfer', name: '转余额' },
{ code: 'Withdraw', name: '提现' },
]),
B('User.Invoice', [
{ code: 'Query', name: '查询' },
{ code: 'Create', name: '申请开票' },
{ code: 'Submit', name: '提交' },
]),
// ── 财务 ──
B('Finance.Analysis', [
@ -960,6 +969,16 @@ const CORE_GROUPS: PageButtonGroup[] = [
{ code: 'Reset', name: '重置' },
{ code: 'Export', name: '导出' },
]),
B('Finance.InvoiceManage', [
{ code: 'Query', name: '查询' },
{ code: 'Search', name: '搜索' },
{ code: 'Reset', name: '重置' },
{ code: 'Export', name: '导出' },
{ code: 'Create', name: '新增' },
{ code: 'Submit', name: '提交' },
{ code: 'Issue', name: '开具' },
{ code: 'Void', name: '作废' },
]),
// ── 营销 ──
B('Marketing.Analysis', [

View File

@ -15,7 +15,7 @@ export default {
'ediAssistant.greet.night': 'Still up late',
'ediAssistant.quickLabel': 'Try asking',
'ediAssistant.welcomeMsg':
"Hi — I'm Xiaodi, your BCD logistics buddy. Tap below or type your own question.",
"Hi — I'm Xiaodi, your {name} logistics buddy. Tap below or type your own question.",
'ediAssistant.historyTitle': 'Chat history',
'ediAssistant.newChat': 'New chat',
'ediAssistant.emptyHistory': 'No conversations yet',
@ -78,7 +78,7 @@ export default {
'ediAssistant.quickAfterSales': 'Something went wrong?',
'ediAssistant.quickHuman': 'Talk to online advisor',
'ediAssistant.replySmall':
'Yes~ BCD welcomes SMB sellers and shipments others decline — special routes, complex cargo, and low-volume orders are in scope. Tell me origin, destination, and cargo type to get started.',
'Yes~ {name} welcomes SMB sellers and shipments others decline — special routes, complex cargo, and low-volume orders are in scope. Tell me origin, destination, and cargo type to get started.',
'ediAssistant.replyPrice':
'For a quote, destination country + actual weight (kg) is enough — e.g. US 0.5kg. Postal code/dims help; origin city is not required.',
'ediAssistant.replyQuoteSpeed':
@ -104,7 +104,7 @@ export default {
'ediAssistant.noAdvisor': 'No exclusive advisor assigned yet',
'ediAssistant.noWechatQr': 'WeChat QR code not uploaded',
'ediAssistant.greeting':
"Hi, I'm Xiaodi~ your BCD logistics buddy.\n\nAsk me about tracking, transit times, declared values, customs, and more. What shall we start with?",
"Hi, I'm Xiaodi~ your {name} logistics buddy.\n\nAsk me about tracking, transit times, declared values, customs, and more. What shall we start with?",
'ediAssistant.send': 'Send',
'ediAssistant.close': 'Close',
'ediAssistant.back': 'Back',

View File

@ -14,7 +14,7 @@ export default {
'ediAssistant.greet.evening': '晚上好',
'ediAssistant.greet.night': '这么晚还在忙呀',
'ediAssistant.quickLabel': '试试这样问',
'ediAssistant.welcomeMsg': '你好呀,我是小迪,BCD 的物流小助手~可以直接问我,也可以点下面的入口。',
'ediAssistant.welcomeMsg': '你好呀,我是小迪,{name} 的物流小助手~可以直接问我,也可以点下面的入口。',
'ediAssistant.historyTitle': '历史记录',
'ediAssistant.newChat': '新会话',
'ediAssistant.emptyHistory': '还没有会话哦',
@ -76,7 +76,7 @@ export default {
'ediAssistant.quickAfterSales': '出问题了怎么办?',
'ediAssistant.quickHuman': '联系在线顾问',
'ediAssistant.replySmall':
'可以的~ BCD 很欢迎中小卖家和别人不太接的单:特殊线路、复杂货型、小批量都在服务范围内。告诉我起运地、目的地和货型,咱们就开始吧。',
'可以的~ {name} 很欢迎中小卖家和别人不太接的单:特殊线路、复杂货型、小批量都在服务范围内。告诉我起运地、目的地和货型,咱们就开始吧。',
'ediAssistant.replyPrice':
'查价只需目的国和实重(kg)就好,例如:美国 0.5kg。有邮编/尺寸会更准;不需要起运地哦。',
'ediAssistant.replyQuoteSpeed':
@ -101,7 +101,7 @@ export default {
'ediAssistant.noAdvisor': '暂未分配专属顾问',
'ediAssistant.noWechatQr': '暂未上传微信二维码',
'ediAssistant.greeting':
'嗨,我是小迪~ BCD 的物流小助手\n\n查轨迹、渠道时效、申报价值和清关问题,都可以问我。今天想先聊哪一件呀?',
'嗨,我是小迪~ {name} 的物流小助手\n\n查轨迹、渠道时效、申报价值和清关问题,都可以问我。今天想先聊哪一件呀?',
'ediAssistant.send': '发送',
'ediAssistant.close': '关闭',
'ediAssistant.back': '返回',

View File

@ -69,11 +69,13 @@ export default {
'menu.user.exportQualification': 'Export Qualification',
'menu.user.profile': 'Personal Center',
'menu.user.recharge': 'Recharge',
'menu.user.invoice': 'My Invoices',
'menu.finance': 'Finance',
'menu.finance.analysis': 'Financial Analysis',
'menu.finance.rechargeRecord': 'Recharge Records',
'menu.finance.accountFlow': 'Account Transactions',
'menu.finance.receivablePayable': 'Receivables & Payables',
'menu.finance.invoiceManage': 'Invoice Management',
'menu.agentAdmin': 'Channel Agents',
'menu.agentAdmin.analysis': 'Agent Analysis',
'menu.agentAdmin.list': 'Agents',
@ -4261,10 +4263,26 @@ export default {
'system.otherConfig.actions.save': 'Save',
'system.otherConfig.actions.cancel': 'Cancel',
'system.otherConfig.actions.paymentQr': 'Payment QR',
'system.otherConfig.actions.brandLogo': 'Brand logo',
'system.otherConfig.brandLogo.title': 'Brand logo',
'system.otherConfig.actions.brandLogo': 'Brand settings',
'system.otherConfig.brandLogo.title': 'Brand settings',
'system.otherConfig.brandLogo.tip':
'Used for system top nav, official site header, browser tab icon, and boot mascot. Takes effect immediately; shows text LOGO when empty. Prefer square PNG.',
'Copy is stored as object JSON and cached locally for instant paint; logos cover top nav, site, tab icon, and boot mascot.',
'system.otherConfig.brandLogo.imagesTitle': 'Brand images',
'system.otherConfig.brandLogo.tab.copy': 'Brand copy',
'system.otherConfig.brandLogo.tab.images': 'Brand images',
'system.otherConfig.brandLogo.copy.navTitle': 'Top nav / site',
'system.otherConfig.brandLogo.copy.navHint': 'Shared by top nav and site header',
'system.otherConfig.brandLogo.copy.navName': 'Short name',
'system.otherConfig.brandLogo.copy.navFullName': 'Full name',
'system.otherConfig.brandLogo.copy.aiTitle': 'AI advisor welcome',
'system.otherConfig.brandLogo.copy.aiHint': 'Hero title on the advisor page',
'system.otherConfig.brandLogo.copy.aiWelcomeTitleZh': 'Chinese title',
'system.otherConfig.brandLogo.copy.aiWelcomeTitleShortZh': 'Chinese short title',
'system.otherConfig.brandLogo.copy.aiWelcomeTitleEn': 'English title',
'system.otherConfig.brandLogo.copy.aiWelcomeTitleShortEn': 'English short title',
'system.otherConfig.brandLogo.copy.save': 'Save copy',
'system.otherConfig.brandLogo.copy.saveSuccess': 'Brand copy saved',
'system.otherConfig.brandLogo.copy.saveFailed': 'Failed to save brand copy',
'system.otherConfig.brandLogo.portal': 'System top nav',
'system.otherConfig.brandLogo.site': 'Official site',
'system.otherConfig.brandLogo.favicon': 'Browser tab',
@ -5399,6 +5417,124 @@ export default {
'finance.receivablePayable.table.receiveTime': 'Receive time',
'finance.receivablePayable.table.shipTime': 'Ship time',
'finance.invoiceManage.search.keywordPlaceholder': 'Apply no. / invoice no. / title',
'finance.invoiceManage.search.statusPlaceholder': 'Status',
'finance.invoiceManage.search.statusAll': 'All statuses',
'finance.invoiceManage.search.invoiceTypePlaceholder': 'Invoice type',
'finance.invoiceManage.search.invoiceTypeAll': 'All types',
'finance.invoiceManage.search.customerIdPlaceholder': 'Customer ID',
'finance.invoiceManage.search.dateRange': 'Applied time',
'finance.invoiceManage.search.dateStart': 'From',
'finance.invoiceManage.search.dateEnd': 'To',
'finance.invoiceManage.search.actions.search': 'Search',
'finance.invoiceManage.search.actions.reset': 'Reset',
'finance.invoiceManage.search.actions.export': 'Export',
'finance.invoiceManage.search.actions.create': 'New apply',
'finance.invoiceManage.search.actions.apply': 'Request invoice',
'finance.invoiceManage.search.actions.profiles': 'Invoice titles',
'finance.invoiceManage.status.draft': 'Draft',
'finance.invoiceManage.status.pendingApproval': 'Pending approval',
'finance.invoiceManage.status.approved': 'Approved',
'finance.invoiceManage.status.issued': 'Issued',
'finance.invoiceManage.status.rejected': 'Rejected',
'finance.invoiceManage.status.voided': 'Voided',
'finance.invoiceManage.status.redFlushed': 'Red-flushed',
'finance.invoiceManage.type.normal': 'Normal VAT',
'finance.invoiceManage.type.special': 'Special VAT',
'finance.invoiceManage.medium.electronic': 'Electronic',
'finance.invoiceManage.medium.paper': 'Paper',
'finance.invoiceManage.source.parcelOrder': 'Parcel order',
'finance.invoiceManage.source.pickupOrder': 'Pickup order',
'finance.invoiceManage.source.storageRent': 'Storage rent',
'finance.invoiceManage.table.applyNo': 'Apply no.',
'finance.invoiceManage.table.customer': 'Customer',
'finance.invoiceManage.table.invoiceType': 'Type',
'finance.invoiceManage.table.medium': 'Medium',
'finance.invoiceManage.table.titleName': 'Title',
'finance.invoiceManage.table.amountTotal': 'Amount',
'finance.invoiceManage.table.status': 'Status',
'finance.invoiceManage.table.invoiceNumber': 'Invoice no.',
'finance.invoiceManage.table.createTime': 'Created',
'finance.invoiceManage.actions.detail': 'Detail',
'finance.invoiceManage.actions.edit': 'Edit',
'finance.invoiceManage.actions.submit': 'Submit',
'finance.invoiceManage.actions.issue': 'Issue',
'finance.invoiceManage.actions.void': 'Void',
'finance.invoiceManage.actions.viewApproval': 'Approval',
'finance.invoiceManage.drawer.create': 'New invoice apply',
'finance.invoiceManage.drawer.edit': 'Edit invoice apply',
'finance.invoiceManage.drawer.detail': 'Invoice detail',
'finance.invoiceManage.drawer.customerId': 'Customer ID',
'finance.invoiceManage.drawer.profile': 'Invoice title',
'finance.invoiceManage.drawer.profilePlaceholder': 'Select a saved title',
'finance.invoiceManage.drawer.titleName': 'Invoice title',
'finance.invoiceManage.drawer.taxNo': 'Tax no.',
'finance.invoiceManage.drawer.addressPhone': 'Address / phone',
'finance.invoiceManage.drawer.bankNameAccount': 'Bank & account',
'finance.invoiceManage.drawer.invoiceType': 'Invoice type',
'finance.invoiceManage.drawer.medium': 'Medium',
'finance.invoiceManage.drawer.taxRate': 'Tax rate',
'finance.invoiceManage.drawer.remark': 'Remark',
'finance.invoiceManage.drawer.submitNow': 'Submit after save',
'finance.invoiceManage.drawer.saveDraft': 'Save draft',
'finance.invoiceManage.drawer.submit': 'Submit',
'finance.invoiceManage.drawer.selectable': 'Billable sources',
'finance.invoiceManage.drawer.selectableKeyword': 'Source no.',
'finance.invoiceManage.drawer.sourceType': 'Source type',
'finance.invoiceManage.drawer.sourceTypeAll': 'All sources',
'finance.invoiceManage.drawer.selectedAmount': 'Selected total',
'finance.invoiceManage.drawer.needCustomer': 'Enter a customer ID',
'finance.invoiceManage.drawer.needLines': 'Select invoice lines',
'finance.invoiceManage.drawer.needTitle': 'Enter invoice title and tax no.',
'finance.invoiceManage.drawer.loadMore': 'Load more',
'finance.invoiceManage.selectable.sourceNo': 'Source no.',
'finance.invoiceManage.selectable.sourceType': 'Source',
'finance.invoiceManage.selectable.baseAmount': 'Base amount',
'finance.invoiceManage.selectable.remaining': 'Remaining',
'finance.invoiceManage.selectable.amount': 'Amount',
'finance.invoiceManage.selectable.paidTime': 'Paid time',
'finance.invoiceManage.selectable.empty': 'No billable sources',
'finance.invoiceManage.detail.lines': 'Lines',
'finance.invoiceManage.detail.taxNo': 'Tax no.',
'finance.invoiceManage.detail.rejectReason': 'Reject reason',
'finance.invoiceManage.detail.pdf': 'Invoice PDF',
'finance.invoiceManage.detail.issueTime': 'Issued at',
'finance.invoiceManage.detail.issueBy': 'Issued by',
'finance.invoiceManage.issue.title': 'Issue invoice',
'finance.invoiceManage.issue.invoiceCode': 'Invoice code',
'finance.invoiceManage.issue.invoiceNumber': 'Invoice number',
'finance.invoiceManage.issue.invoiceDate': 'Invoice date',
'finance.invoiceManage.issue.pdfUrl': 'Invoice PDF URL',
'finance.invoiceManage.issue.remark': 'Remark',
'finance.invoiceManage.issue.needNumber': 'Enter the invoice number',
'finance.invoiceManage.void.title': 'Void invoice',
'finance.invoiceManage.void.confirm': 'Voiding will release occupied amounts. Continue?',
'finance.invoiceManage.void.remark': 'Reason (optional)',
'finance.invoiceManage.profile.title': 'Invoice titles',
'finance.invoiceManage.profile.add': 'Add title',
'finance.invoiceManage.profile.edit': 'Edit title',
'finance.invoiceManage.profile.default': 'Default',
'finance.invoiceManage.profile.setDefault': 'Set default',
'finance.invoiceManage.profile.deleteConfirm': 'Delete this invoice title?',
'finance.invoiceManage.profile.empty': 'No invoice titles yet',
'finance.invoiceManage.profile.titleName': 'Invoice title',
'finance.invoiceManage.profile.taxNo': 'Tax no.',
'finance.invoiceManage.profile.addressPhone': 'Address / phone',
'finance.invoiceManage.profile.bankNameAccount': 'Bank & account',
'finance.invoiceManage.profile.isDefault': 'Set as default',
'finance.invoiceManage.profile.remark': 'Remark',
'finance.invoiceManage.profile.save': 'Save',
'finance.invoiceManage.message.loadError': 'Failed to load invoices',
'finance.invoiceManage.message.exportSuccess': 'Export completed',
'finance.invoiceManage.message.exportError': 'Export failed',
'finance.invoiceManage.message.saveSuccess': 'Saved',
'finance.invoiceManage.message.submitSuccess': 'Submitted',
'finance.invoiceManage.message.issueSuccess': 'Issued',
'finance.invoiceManage.message.voidSuccess': 'Voided',
'finance.invoiceManage.message.profileSaved': 'Title saved',
'finance.invoiceManage.message.profileDeleted': 'Title deleted',
'finance.invoiceManage.message.approvalMissing': 'No approval instance',
'user.recharge.record.message.exportError': 'Export failed',
'user.recharge.record.pagination.total': '{count} total',
'user.recharge.record.pagination.prev': 'Prev',

View File

@ -518,7 +518,7 @@ export default {
'marketing.register.title': 'Register',
'marketing.register.subtitle': 'Member pricing and welcome benefits',
'marketing.register.brandHint': 'Welcome to BCD customer portal',
'marketing.register.brandHint': 'Welcome to {name} customer portal',
'marketing.register.brandHint.web': 'Register with email & phone',
'marketing.register.brandHint.wechat': 'Register with WeChat',
'marketing.register.choose.group': 'Choose how to register',

View File

@ -515,9 +515,9 @@ export default {
'marketing.register.title': '客户注册',
'marketing.register.subtitle': '注册即享会员价与新人福利',
'marketing.register.brandHint': '欢迎注册 BCD 客户门户',
'marketing.register.brandHint.web': '网页注册 BCD 客户账号',
'marketing.register.brandHint.wechat': '微信扫码注册 BCD 客户账号',
'marketing.register.brandHint': '欢迎注册 {name} 客户门户',
'marketing.register.brandHint.web': '网页注册 {name} 客户账号',
'marketing.register.brandHint.wechat': '微信扫码注册 {name} 客户账号',
'marketing.register.choose.group': '选择注册方式',
'marketing.register.choose.web': '网页注册',
'marketing.register.choose.webDesc': '填写资料,立即开通客户门户',

View File

@ -69,11 +69,13 @@ export default {
'menu.user.exportQualification': '出口资质备案',
'menu.user.profile': '个人中心',
'menu.user.recharge': '资金充值',
'menu.user.invoice': '我的发票',
'menu.finance': '财务',
'menu.finance.analysis': '财务分析',
'menu.finance.rechargeRecord': '充值记录',
'menu.finance.accountFlow': '资金流水',
'menu.finance.receivablePayable': '应收应付',
'menu.finance.invoiceManage': '发票管理',
'menu.agentAdmin': '渠道代理',
'menu.agentAdmin.analysis': '代理分析',
'menu.agentAdmin.list': '代理管理',
@ -4273,10 +4275,26 @@ export default {
'system.otherConfig.actions.save': '保存',
'system.otherConfig.actions.cancel': '取消',
'system.otherConfig.actions.paymentQr': '收款码',
'system.otherConfig.actions.brandLogo': '品牌 Logo',
'system.otherConfig.brandLogo.title': '品牌 Logo',
'system.otherConfig.actions.brandLogo': '品牌配置',
'system.otherConfig.brandLogo.title': '品牌配置',
'system.otherConfig.brandLogo.tip':
'用于系统顶栏、官网头部、浏览器标签与启动页吉祥物。更换后立即生效;未上传时显示文字 LOGO。建议上传正方形 PNG。',
'文案存对象存储并本地缓存秒开;Logo 用于顶栏、官网、标签与启动页。保存文案或上传图片后立即生效。',
'system.otherConfig.brandLogo.imagesTitle': '品牌图片',
'system.otherConfig.brandLogo.tab.copy': '品牌文案',
'system.otherConfig.brandLogo.tab.images': '品牌图片',
'system.otherConfig.brandLogo.copy.navTitle': '顶栏 / 官网',
'system.otherConfig.brandLogo.copy.navHint': '顶栏与官网共用',
'system.otherConfig.brandLogo.copy.navName': '短名',
'system.otherConfig.brandLogo.copy.navFullName': '全称',
'system.otherConfig.brandLogo.copy.aiTitle': 'AI 顾问欢迎语',
'system.otherConfig.brandLogo.copy.aiHint': '官网顾问页大标题,中英分开',
'system.otherConfig.brandLogo.copy.aiWelcomeTitleZh': '中文主标题',
'system.otherConfig.brandLogo.copy.aiWelcomeTitleShortZh': '中文短标题',
'system.otherConfig.brandLogo.copy.aiWelcomeTitleEn': '英文主标题',
'system.otherConfig.brandLogo.copy.aiWelcomeTitleShortEn': '英文短标题',
'system.otherConfig.brandLogo.copy.save': '保存文案',
'system.otherConfig.brandLogo.copy.saveSuccess': '品牌文案已保存',
'system.otherConfig.brandLogo.copy.saveFailed': '保存品牌文案失败',
'system.otherConfig.brandLogo.portal': '系统顶栏',
'system.otherConfig.brandLogo.site': '官网',
'system.otherConfig.brandLogo.favicon': '网站标签',
@ -5416,6 +5434,124 @@ export default {
'finance.receivablePayable.table.receiveTime': '收货时间',
'finance.receivablePayable.table.shipTime': '发货时间',
'finance.invoiceManage.search.keywordPlaceholder': '申请单号 / 发票号 / 抬头',
'finance.invoiceManage.search.statusPlaceholder': '状态',
'finance.invoiceManage.search.statusAll': '全部状态',
'finance.invoiceManage.search.invoiceTypePlaceholder': '发票类型',
'finance.invoiceManage.search.invoiceTypeAll': '全部类型',
'finance.invoiceManage.search.customerIdPlaceholder': '客户ID',
'finance.invoiceManage.search.dateRange': '申请时间',
'finance.invoiceManage.search.dateStart': '申请起',
'finance.invoiceManage.search.dateEnd': '申请止',
'finance.invoiceManage.search.actions.search': '搜索',
'finance.invoiceManage.search.actions.reset': '重置',
'finance.invoiceManage.search.actions.export': '导出',
'finance.invoiceManage.search.actions.create': '新建申请',
'finance.invoiceManage.search.actions.apply': '申请开票',
'finance.invoiceManage.search.actions.profiles': '抬头管理',
'finance.invoiceManage.status.draft': '草稿',
'finance.invoiceManage.status.pendingApproval': '待审批',
'finance.invoiceManage.status.approved': '已审批待开票',
'finance.invoiceManage.status.issued': '已开票',
'finance.invoiceManage.status.rejected': '已驳回',
'finance.invoiceManage.status.voided': '已作废',
'finance.invoiceManage.status.redFlushed': '已红冲',
'finance.invoiceManage.type.normal': '普通发票',
'finance.invoiceManage.type.special': '专用发票',
'finance.invoiceManage.medium.electronic': '电子',
'finance.invoiceManage.medium.paper': '纸质',
'finance.invoiceManage.source.parcelOrder': '运单',
'finance.invoiceManage.source.pickupOrder': '揽收单',
'finance.invoiceManage.source.storageRent': '仓租',
'finance.invoiceManage.table.applyNo': '申请单号',
'finance.invoiceManage.table.customer': '客户',
'finance.invoiceManage.table.invoiceType': '发票类型',
'finance.invoiceManage.table.medium': '介质',
'finance.invoiceManage.table.titleName': '发票抬头',
'finance.invoiceManage.table.amountTotal': '开票金额',
'finance.invoiceManage.table.status': '状态',
'finance.invoiceManage.table.invoiceNumber': '发票号码',
'finance.invoiceManage.table.createTime': '申请时间',
'finance.invoiceManage.actions.detail': '详情',
'finance.invoiceManage.actions.edit': '编辑',
'finance.invoiceManage.actions.submit': '提交',
'finance.invoiceManage.actions.issue': '开具',
'finance.invoiceManage.actions.void': '作废',
'finance.invoiceManage.actions.viewApproval': '审批详情',
'finance.invoiceManage.drawer.create': '新建开票申请',
'finance.invoiceManage.drawer.edit': '编辑开票申请',
'finance.invoiceManage.drawer.detail': '开票详情',
'finance.invoiceManage.drawer.customerId': '客户ID',
'finance.invoiceManage.drawer.profile': '发票抬头',
'finance.invoiceManage.drawer.profilePlaceholder': '选择已保存抬头',
'finance.invoiceManage.drawer.titleName': '发票抬头',
'finance.invoiceManage.drawer.taxNo': '税号',
'finance.invoiceManage.drawer.addressPhone': '地址电话',
'finance.invoiceManage.drawer.bankNameAccount': '开户行及账号',
'finance.invoiceManage.drawer.invoiceType': '发票类型',
'finance.invoiceManage.drawer.medium': '介质',
'finance.invoiceManage.drawer.taxRate': '税率',
'finance.invoiceManage.drawer.remark': '备注',
'finance.invoiceManage.drawer.submitNow': '保存后立即提交',
'finance.invoiceManage.drawer.saveDraft': '保存草稿',
'finance.invoiceManage.drawer.submit': '提交申请',
'finance.invoiceManage.drawer.selectable': '可开票来源',
'finance.invoiceManage.drawer.selectableKeyword': '来源单号',
'finance.invoiceManage.drawer.sourceType': '来源类型',
'finance.invoiceManage.drawer.sourceTypeAll': '全部来源',
'finance.invoiceManage.drawer.selectedAmount': '已选合计',
'finance.invoiceManage.drawer.needCustomer': '请填写客户ID',
'finance.invoiceManage.drawer.needLines': '请选择开票明细',
'finance.invoiceManage.drawer.needTitle': '请填写发票抬头和税号',
'finance.invoiceManage.drawer.loadMore': '加载更多',
'finance.invoiceManage.selectable.sourceNo': '来源单号',
'finance.invoiceManage.selectable.sourceType': '来源',
'finance.invoiceManage.selectable.baseAmount': '原金额',
'finance.invoiceManage.selectable.remaining': '可开票',
'finance.invoiceManage.selectable.amount': '开票金额',
'finance.invoiceManage.selectable.paidTime': '支付时间',
'finance.invoiceManage.selectable.empty': '暂无可开票来源',
'finance.invoiceManage.detail.lines': '开票明细',
'finance.invoiceManage.detail.taxNo': '税号',
'finance.invoiceManage.detail.rejectReason': '驳回原因',
'finance.invoiceManage.detail.pdf': '发票PDF',
'finance.invoiceManage.detail.issueTime': '开具时间',
'finance.invoiceManage.detail.issueBy': '开具人',
'finance.invoiceManage.issue.title': '开具发票',
'finance.invoiceManage.issue.invoiceCode': '发票代码',
'finance.invoiceManage.issue.invoiceNumber': '发票号码',
'finance.invoiceManage.issue.invoiceDate': '开票日期',
'finance.invoiceManage.issue.pdfUrl': '发票PDF地址',
'finance.invoiceManage.issue.remark': '备注',
'finance.invoiceManage.issue.needNumber': '请填写发票号码',
'finance.invoiceManage.void.title': '作废发票',
'finance.invoiceManage.void.confirm': '作废后将释放来源占用,确认继续?',
'finance.invoiceManage.void.remark': '作废原因(选填)',
'finance.invoiceManage.profile.title': '发票抬头',
'finance.invoiceManage.profile.add': '新增抬头',
'finance.invoiceManage.profile.edit': '编辑抬头',
'finance.invoiceManage.profile.default': '默认',
'finance.invoiceManage.profile.setDefault': '设为默认',
'finance.invoiceManage.profile.deleteConfirm': '确认删除该抬头?',
'finance.invoiceManage.profile.empty': '暂无发票抬头',
'finance.invoiceManage.profile.titleName': '发票抬头',
'finance.invoiceManage.profile.taxNo': '税号',
'finance.invoiceManage.profile.addressPhone': '地址电话',
'finance.invoiceManage.profile.bankNameAccount': '开户行及账号',
'finance.invoiceManage.profile.isDefault': '设为默认抬头',
'finance.invoiceManage.profile.remark': '备注',
'finance.invoiceManage.profile.save': '保存',
'finance.invoiceManage.message.loadError': '加载发票数据失败',
'finance.invoiceManage.message.exportSuccess': '导出成功',
'finance.invoiceManage.message.exportError': '导出失败',
'finance.invoiceManage.message.saveSuccess': '保存成功',
'finance.invoiceManage.message.submitSuccess': '提交成功',
'finance.invoiceManage.message.issueSuccess': '开具成功',
'finance.invoiceManage.message.voidSuccess': '已作废',
'finance.invoiceManage.message.profileSaved': '抬头已保存',
'finance.invoiceManage.message.profileDeleted': '抬头已删除',
'finance.invoiceManage.message.approvalMissing': '暂无审批实例',
'user.recharge.record.message.exportError': '导出失败',
'user.recharge.record.pagination.total': '共 {count} 条',
'user.recharge.record.pagination.prev': '上一页',

View File

@ -89,6 +89,7 @@ export default function setupPermissionGuard(router: Router) {
path.startsWith('/user/marketing') ||
path.startsWith('/user/profile') ||
path.startsWith('/user/recharge') ||
path.startsWith('/user/invoice') ||
(path.startsWith('/h5') && !isAdminH5);
Message.warning(
isCustomerPortal

View File

@ -496,6 +496,17 @@ const router = createRouter({
h5HideHeader: true,
},
},
{
path: 'invoice',
name: 'H5Invoice',
component: () => import('@/views/h5/customer-center/invoice/index.vue'),
meta: {
requiresAuth: true,
locale: 'h5.invoice.title',
h5HideTabBar: true,
h5HideHeader: true,
},
},
{
path: 'place-order',
name: 'H5PlaceOrder',

View File

@ -70,6 +70,19 @@ const FINANCE: AppRouteRecordRaw = {
icon: 'icon-file',
},
},
{
path: 'invoiceManage',
name: 'FinanceInvoiceManage',
component: () => import('@/views/finance/invoiceManage/index.vue'),
meta: {
locale: 'menu.finance.invoiceManage',
requiresAuth: true,
roles: ['*'],
menuPermission: 'Finance.InvoiceManage',
order: 4,
icon: 'icon-file',
},
},
],
};

View File

@ -146,6 +146,22 @@ const USER: AppRouteRecordRaw = {
customerPortalOnly: true,
},
},
{
path: 'invoice',
name: 'UserInvoice',
component: () => import('@/views/user/invoice/index.vue'),
meta: {
locale: 'menu.user.invoice',
requiresAuth: true,
roles: ['*'],
hideInMenu: true,
ignoreCache: true,
syncInMenu: true,
menuPermission: 'User.Invoice',
order: 14,
customerPortalOnly: true,
},
},
],
};

View File

@ -1,5 +1,7 @@
/** 代理门户:催付款 / 邀请话术文案 */
import { brandCopy } from '@/utils/brandCopy'
export function buildPendingPaymentReminderText(opts: {
customerName?: string
pendingCount?: number
@ -39,6 +41,6 @@ export const AGENT_INVITE_TEMPLATES: Array<{
key: 'formal',
label: '商务简介',
build: (code, url) =>
`【BCD Express 渠道邀请】请通过专属链接完成注册绑定:${url}\n代理编号:${code}\n注册后即可查价下单,运单派送完成后按约定结算返佣。`,
`【${brandCopy.navName} Express 渠道邀请】请通过专属链接完成注册绑定:${url}\n代理编号:${code}\n注册后即可查价下单,运单派送完成后按约定结算返佣。`,
},
]

111
src/utils/brandCopy.ts Normal file
View File

@ -0,0 +1,111 @@
import { reactive } from 'vue'
import { resolveAdminApiPath } from '@/utils/adminApi'
import { unwrapData } from '@/api/oms/common'
/** 品牌文案本地缓存(首屏秒开,不依赖首屏打库) */
export const BRAND_COPY_CACHE_KEY = 'oms_brand_copy'
export type BrandCopy = {
navName: string
navFullName: string
aiWelcomeTitleZh: string
aiWelcomeTitleShortZh: string
aiWelcomeTitleEn: string
aiWelcomeTitleShortEn: string
}
export const DEFAULT_BRAND_COPY: BrandCopy = {
navName: 'BCD',
navFullName: 'Business & Customer & Delivery',
aiWelcomeTitleZh: 'BCD · 一站式跨境物流顾问',
aiWelcomeTitleShortZh: 'BCD · 跨境物流顾问',
aiWelcomeTitleEn: 'BCD · One-stop cross-border logistics advisor',
aiWelcomeTitleShortEn: 'BCD · Logistics advisor',
}
function normalizeBrandCopy(raw?: Partial<BrandCopy> | null): BrandCopy {
return {
navName: String(raw?.navName || '').trim() || DEFAULT_BRAND_COPY.navName,
navFullName: String(raw?.navFullName || '').trim() || DEFAULT_BRAND_COPY.navFullName,
aiWelcomeTitleZh:
String(raw?.aiWelcomeTitleZh || '').trim() || DEFAULT_BRAND_COPY.aiWelcomeTitleZh,
aiWelcomeTitleShortZh:
String(raw?.aiWelcomeTitleShortZh || '').trim() || DEFAULT_BRAND_COPY.aiWelcomeTitleShortZh,
aiWelcomeTitleEn:
String(raw?.aiWelcomeTitleEn || '').trim() || DEFAULT_BRAND_COPY.aiWelcomeTitleEn,
aiWelcomeTitleShortEn:
String(raw?.aiWelcomeTitleShortEn || '').trim() || DEFAULT_BRAND_COPY.aiWelcomeTitleShortEn,
}
}
function readCachedBrandCopy(): BrandCopy {
if (typeof localStorage === 'undefined') return { ...DEFAULT_BRAND_COPY }
try {
const parsed = JSON.parse(localStorage.getItem(BRAND_COPY_CACHE_KEY) || '') as Partial<BrandCopy>
return normalizeBrandCopy(parsed)
} catch {
return { ...DEFAULT_BRAND_COPY }
}
}
function writeCachedBrandCopy(copy: BrandCopy) {
try {
localStorage.setItem(BRAND_COPY_CACHE_KEY, JSON.stringify(copy))
} catch {
/* ignore quota */
}
}
function applyBrandCopy(copy: BrandCopy) {
const next = normalizeBrandCopy(copy)
brandCopy.navName = next.navName
brandCopy.navFullName = next.navFullName
brandCopy.aiWelcomeTitleZh = next.aiWelcomeTitleZh
brandCopy.aiWelcomeTitleShortZh = next.aiWelcomeTitleShortZh
brandCopy.aiWelcomeTitleEn = next.aiWelcomeTitleEn
brandCopy.aiWelcomeTitleShortEn = next.aiWelcomeTitleShortEn
writeCachedBrandCopy(next)
return next
}
/** 响应式品牌文案:模块加载即用本地缓存,后台再刷新 */
export const brandCopy = reactive<BrandCopy>(readCachedBrandCopy())
export function resolveAiWelcomeTitle(isZh: boolean, short = false): string {
if (isZh) {
return short ? brandCopy.aiWelcomeTitleShortZh : brandCopy.aiWelcomeTitleZh
}
return short ? brandCopy.aiWelcomeTitleShortEn : brandCopy.aiWelcomeTitleEn
}
function mapBrandCopyDto(data?: Record<string, any> | null): BrandCopy {
return normalizeBrandCopy({
navName: data?.navName ?? data?.NavName,
navFullName: data?.navFullName ?? data?.NavFullName,
aiWelcomeTitleZh: data?.aiWelcomeTitleZh ?? data?.AiWelcomeTitleZh,
aiWelcomeTitleShortZh: data?.aiWelcomeTitleShortZh ?? data?.AiWelcomeTitleShortZh,
aiWelcomeTitleEn: data?.aiWelcomeTitleEn ?? data?.AiWelcomeTitleEn,
aiWelcomeTitleShortEn: data?.aiWelcomeTitleShortEn ?? data?.AiWelcomeTitleShortEn,
})
}
/** 匿名拉取品牌文案(对象存储 JSON),写入本地缓存 */
export async function refreshBrandCopy(): Promise<BrandCopy> {
try {
const res = await fetch(resolveAdminApiPath('/system/other-config/brand-copy'), {
method: 'GET',
headers: { Accept: 'application/json' },
credentials: 'omit',
})
if (!res.ok) return { ...brandCopy }
const body = await res.json()
return applyBrandCopy(mapBrandCopyDto(unwrapData(body)))
} catch {
return { ...brandCopy }
}
}
/** 管理端保存成功后立刻应用到界面与本地缓存 */
export function rememberBrandCopy(data?: Record<string, any> | null): BrandCopy {
return applyBrandCopy(mapBrandCopyDto(data))
}

View File

@ -1,7 +1,9 @@
import { reactive, ref } from 'vue'
import type { BrandLogoDto } from '@/api/system/otherConfig'
import { streamFileBlob } from '@/api/fileStorage'
import { resolveOmsAssetUrl, unwrapData } from '@/api/oms/common'
import { resolveAdminApiPath } from '@/utils/adminApi'
import { refreshBrandCopy } from '@/utils/brandCopy'
export type BrandLogoUrls = {
portal: string
@ -160,11 +162,16 @@ function blobToDataUrl(blob: Blob): Promise<string> {
})
}
/** 把已拿到的图片地址读成 data URL。跨域读不到字节时抛错,调用方再决定是否退回远程地址。 */
async function embedImageUrl(url: string): Promise<string> {
const res = await fetch(url, { credentials: 'omit', cache: 'force-cache' })
if (!res.ok) throw new Error(`HTTP ${res.status}`)
const blob = await res.blob()
function isCosAssetUrl(url: string): boolean {
try {
const host = new URL(url).hostname.toLowerCase()
return host.startsWith('cos.') || host.includes('myqcloud.com')
} catch {
return false
}
}
async function blobToBrandDataUrl(blob: Blob): Promise<string> {
if (blob.size <= 0 || blob.size > 1_500_000) throw new Error('image size')
if (blob.type && !blob.type.startsWith('image/')) throw new Error('not image')
const data = await blobToDataUrl(blob)
@ -172,6 +179,23 @@ async function embedImageUrl(url: string): Promise<string> {
return data
}
/**
* 把图片地址读成 data URL。
* 生产环境 cos.test / 自定义域证书异常时,直连 fetch 会 ERR_CERT_COMMON_NAME_INVALID,
* 再经鉴权 /file-storage/stream 由后端 SDK 拉对象(不经坏证书域名)。
*/
async function embedImageUrl(url: string): Promise<string> {
try {
const res = await fetch(url, { credentials: 'omit', cache: 'force-cache' })
if (!res.ok) throw new Error(`HTTP ${res.status}`)
return await blobToBrandDataUrl(await res.blob())
} catch (directErr) {
if (!isCosAssetUrl(url) && !url.includes('/uploads/')) throw directErr
const blob = await streamFileBlob(url)
return blobToBrandDataUrl(blob)
}
}
function publishBrandImage(channel: BrandChannel, value: string) {
brandLogoImages[channel] = value
if (channel === 'favicon') applyDocumentFavicon(value)
@ -309,8 +333,11 @@ async function embedChannel(channel: BrandChannel, url: string, generation: numb
publishBrandImage(channel, data)
} catch {
if (generation !== brandImageGeneration) return
// 直连/stream 都失败时:开发态可退回远程 URL(有 /__cos__);生产勿把坏证书 COS 地址塞进 <img>
if (!readImageStore().images[channel]?.startsWith('data:')) {
publishBrandImage(channel, url)
if (import.meta.env.DEV || !isCosAssetUrl(url)) {
publishBrandImage(channel, url)
}
}
}
}
@ -386,12 +413,14 @@ function hasLocalBrandImage(): boolean {
* 第一次没有缓存:在启动页盖住期间把图片收成 data URL,页面出来时已经在布局里。
*/
export async function bootstrapBrandAssets() {
// 文案已从 localStorage 同步灌入;图片有缓存则后台刷新,无缓存则等一轮
void refreshBrandCopy()
if (hasLocalBrandImage()) {
void refreshBrandImages()
return
}
await Promise.race([
refreshBrandImages(),
Promise.all([refreshBrandImages(), refreshBrandCopy()]),
new Promise<void>((resolve) => {
window.setTimeout(resolve, 8000)
}),

View File

@ -1,5 +1,7 @@
/** 客户侧邀请落地页:公众号 OAuth 注册(携带 ?ref=) */
import { brandCopy } from '@/utils/brandCopy';
export function buildInviteRegisterUrl(inviteCode: string, origin = window.location.origin): string {
const code = inviteCode.trim();
if (!code) return '';
@ -41,7 +43,7 @@ export function buildInviteShareText(inviteCode: string, inviteUrl: string): str
const code = inviteCode.trim();
const url = inviteUrl.trim();
if (!code || !url) return url || code;
return `【BCD Express】送你一个专属邀请,微信打开链接注册即可:${url}\n邀请码:${code}`;
return `【${brandCopy.navName} Express】送你一个专属邀请,微信打开链接注册即可:${url}\n邀请码:${code}`;
}
/** 渠道代理分享话术(默认微信私聊) */

View File

@ -102,6 +102,7 @@ export function resolveCustomerEntryPath(path?: string | null): string {
}
if (raw.startsWith('/order/priceCheck')) return '/h5/price'
if (raw === '/assistant' || raw.startsWith('/assistant/')) return '/h5/assistant'
if (raw.startsWith('/user/invoice')) return '/h5/invoice'
if (
raw.startsWith('/user/profile') ||
raw.startsWith('/user/recharge') ||
@ -129,6 +130,7 @@ const CUSTOMER_PORTAL_ONLY_PATH_PREFIXES = [
'/user/profile',
'/user/marketing',
'/user/recharge',
'/user/invoice',
'/h5',
] as const

View File

@ -18,6 +18,8 @@ export const MENU_NAME_TO_LOCALE_KEY: Record<string, string> = {
充值记录: 'menu.finance.rechargeRecord',
资金流水: 'menu.finance.accountFlow',
应收应付: 'menu.finance.receivablePayable',
发票管理: 'menu.finance.invoiceManage',
我的发票: 'menu.user.invoice',
营销: 'menu.marketing',
营销指引: 'menu.marketing.marketingGuide',
订单: 'menu.order',

View File

@ -32,6 +32,8 @@ export const SUB_MENU_DEFAULT_ICONS: Record<string, string> = {
'menu.finance.rechargeRecord': 'IconList',
'menu.finance.accountFlow': 'IconSwap',
'menu.finance.receivablePayable': 'IconFile',
'menu.finance.invoiceManage': 'IconFile',
'menu.user.invoice': 'IconFile',
'menu.kb.training': 'IconBook',
'menu.order.orderGuide': 'IconBook',
'menu.order.priceCheck': 'IconSearch',

View File

@ -107,6 +107,8 @@ const routeNameMap: Record<string, string> = {
'/user': 'User',
'user_recharge': 'VipRechargeDeposit',
'/user/recharge': 'VipRechargeDeposit',
'user_invoice': 'UserInvoice',
'/user/invoice': 'UserInvoice',
'finance': 'Finance',
'/finance': 'FinanceAnalysis',
'finance_analysis': 'FinanceAnalysis',
@ -117,6 +119,8 @@ const routeNameMap: Record<string, string> = {
'/finance/accountFlow': 'FinanceAccountFlow',
'finance_receivable_payable': 'FinanceReceivablePayable',
'/finance/receivablePayable': 'FinanceReceivablePayable',
'finance_invoice_manage': 'FinanceInvoiceManage',
'/finance/invoiceManage': 'FinanceInvoiceManage',
// 渠道相关
'channel': 'Channel',

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,7 @@ import {
H5_ADMIN_TAB_KEEP_ALIVE,
useH5TabScrollMemory,
} from '@/views/h5/composables/useH5TabEnterOnce';
import { brandCopy } from '@/utils/brandCopy';
defineOptions({ name: 'H5AdminCenterLayout' });
@ -60,7 +61,7 @@ const headerTitle = computed(() => {
});
function syncDocumentTitle() {
document.title = t('h5Admin.documentTitle');
document.title = t('h5Admin.documentTitle', { name: brandCopy.navName });
}
async function refreshOrderBadge() {

View File

@ -1,6 +1,6 @@
export default {
'h5Admin.center.title': 'Ops Center',
'h5Admin.documentTitle': 'BCD Ops Center',
'h5Admin.documentTitle': '{name} Ops Center',
'h5Admin.tab.workplace': 'Home',
'h5Admin.tab.eddie': 'Xiaodi',
'h5Admin.tab.orders': 'Orders',

View File

@ -1,6 +1,6 @@
export default {
'h5Admin.center.title': '运营中心',
'h5Admin.documentTitle': 'BCD运营中心',
'h5Admin.documentTitle': '{name}运营中心',
'h5Admin.tab.workplace': '工作台',
'h5Admin.tab.eddie': '小迪',
'h5Admin.tab.orders': '运单',

View File

@ -24,7 +24,7 @@
<span v-else class="h5-login-card__logo-mark" aria-hidden="true">{{
BRAND_TEXT_LOGO
}}</span>
<h2 v-if="logoSrc" class="h5-login-card__title">{{ t('h5Admin.login.brandName') }}</h2>
<h2 v-if="logoSrc" class="h5-login-card__title">{{ brandCopy.navName }}</h2>
</button>
<p class="h5-login-card__hint">{{ t('h5Admin.login.brandHint') }}</p>
</header>
@ -118,6 +118,7 @@ import { useLoginCaptchaGate } from '@/composables/useLoginCaptchaGate';
import LoginCaptchaField from '@/components/LoginCaptchaField/index.vue';
import { ADMIN_H5_HOME_PATH, isAdminH5Path } from '@/utils/login-portal';
import { BRAND_TEXT_LOGO, brandLogoImages } from '@/utils/brandLogo';
import { brandCopy } from '@/utils/brandCopy';
import LoginLangToggle from '@/views/login/components/LoginLangToggle.vue';
import H5LoginPortalSwitch from '@/views/h5/components/H5LoginPortalSwitch.vue';
@ -236,7 +237,7 @@ async function handleSubmit() {
}
onMounted(() => {
document.title = t('h5Admin.documentTitle');
document.title = t('h5Admin.documentTitle', { name: brandCopy.navName });
if (isLogin() && rbacUserStore.loginPortalType === OmsLoginType.User) {
router.replace(resolveRedirectPath());
}

View File

@ -0,0 +1,784 @@
<template>
<div class="h5-inv-page">
<nav class="h5-inv-nav">
<button type="button" class="h5-inv-nav__back" aria-label="back" @click="goBack">
<icon-left />
</button>
<h1>{{ t('h5.invoice.title') }}</h1>
<button type="button" class="h5-inv-nav__action" @click="openProfiles">
{{ t('h5.invoice.profiles') }}
</button>
</nav>
<H5EmptyState v-if="loading && !rows.length" mode="loading" />
<a-spin :loading="loading && rows.length > 0" class="h5-inv-spin">
<H5EmptyState v-if="!loading && !rows.length" :text="t('h5.invoice.empty')">
<button type="button" class="h5-inv-empty-btn" @click="openApply">
{{ t('h5.invoice.apply') }}
</button>
</H5EmptyState>
<article v-for="(row, index) in rows" :key="row.id" class="h5-inv-card" :style="{ animationDelay: `${Math.min(index, 6) * 40}ms` }" @click="openDetail(row)">
<div class="h5-inv-card__head">
<strong>{{ row.applyNo }}</strong>
<span class="h5-inv-card__status" :style="statusStyle(row.status)">
{{ row.statusName || row.status }}
</span>
</div>
<p class="h5-inv-card__title">{{ row.titleName }}</p>
<div class="h5-inv-card__meta">
<em>¥{{ formatMoney(row.amountTotal) }}</em>
<span>{{ row.invoiceTypeName || row.invoiceType }}</span>
<span v-if="row.invoiceNumber">{{ row.invoiceNumber }}</span>
</div>
</article>
<button
v-if="hasMore"
type="button"
class="h5-inv-more"
:disabled="loadingMore"
@click="loadMore"
>
{{ loadingMore ? t('h5.me.opening') : t('h5.invoice.loadMore') }}
</button>
</a-spin>
<button type="button" class="h5-inv-fab" @click="openApply">
{{ t('h5.invoice.apply') }}
</button>
<a-drawer
:visible="applyVisible"
placement="bottom"
height="88%"
:footer="false"
:header="false"
unmount-on-close
class="h5-inv-drawer"
@cancel="applyVisible = false"
>
<div class="h5-inv-sheet">
<header class="h5-inv-sheet__head">
<button type="button" @click="applyVisible = false"><icon-left /></button>
<h3>{{ t('h5.invoice.apply') }}</h3>
<span />
</header>
<div class="h5-inv-sheet__body">
<label class="h5-inv-field">
<span>{{ t('finance.invoiceManage.drawer.profile') }}</span>
<select v-model.number="applyForm.profileId" @change="onProfileChange">
<option :value="0">{{ t('finance.invoiceManage.drawer.profilePlaceholder') }}</option>
<option v-for="p in profiles" :key="p.id" :value="p.id">
{{ p.titleName }}{{ p.isDefault ? ` (${t('finance.invoiceManage.profile.default')})` : '' }}
</option>
</select>
</label>
<label class="h5-inv-field">
<span>{{ t('finance.invoiceManage.drawer.titleName') }}</span>
<input v-model="applyForm.titleName" />
</label>
<label class="h5-inv-field">
<span>{{ t('finance.invoiceManage.drawer.taxNo') }}</span>
<input v-model="applyForm.taxNo" />
</label>
<label class="h5-inv-field">
<span>{{ t('finance.invoiceManage.drawer.invoiceType') }}</span>
<select v-model="applyForm.invoiceType">
<option value="normal">{{ t('finance.invoiceManage.type.normal') }}</option>
<option value="special">{{ t('finance.invoiceManage.type.special') }}</option>
</select>
</label>
<label class="h5-inv-field">
<span>{{ t('finance.invoiceManage.drawer.medium') }}</span>
<select v-model="applyForm.medium">
<option value="electronic">{{ t('finance.invoiceManage.medium.electronic') }}</option>
<option value="paper">{{ t('finance.invoiceManage.medium.paper') }}</option>
</select>
</label>
<p class="h5-inv-section">{{ t('finance.invoiceManage.drawer.selectable') }}</p>
<p v-if="!selectableItems.length" class="h5-inv-empty-text">
{{ t('h5.invoice.selectableEmpty') }}
</p>
<label
v-for="item in selectableItems"
:key="invoiceLineKey(item.sourceType, item.sourceId)"
class="h5-inv-pick"
:class="{ 'is-on': isLineSelected(item) }"
>
<input
type="checkbox"
:checked="isLineSelected(item)"
@change="toggleSelectable(item, ($event.target as HTMLInputElement).checked)"
/>
<div>
<strong>{{ item.sourceNo }}</strong>
<em>{{ item.sourceTypeName }} · ¥{{ formatMoney(item.remainingAmount) }}</em>
</div>
</label>
<div class="h5-inv-sum">
{{ t('h5.invoice.selectedAmount') }}
<strong>¥{{ formatMoney(selectedTotal) }}</strong>
</div>
</div>
<footer class="h5-inv-sheet__foot">
<button type="button" class="h5-inv-submit" :disabled="applySaving" @click="submitApply">
{{ applySaving ? t('h5.me.opening') : t('h5.invoice.submit') }}
</button>
</footer>
</div>
</a-drawer>
<a-drawer
:visible="profileVisible"
placement="bottom"
height="80%"
:footer="false"
:header="false"
unmount-on-close
@cancel="profileVisible = false"
>
<div class="h5-inv-sheet">
<header class="h5-inv-sheet__head">
<button type="button" @click="profileVisible = false"><icon-left /></button>
<h3>{{ t('h5.invoice.profiles') }}</h3>
<button type="button" class="h5-inv-nav__action" @click="openProfileForm()">
{{ t('finance.invoiceManage.profile.add') }}
</button>
</header>
<div class="h5-inv-sheet__body">
<article v-for="p in profiles" :key="p.id" class="h5-inv-profile">
<div>
<strong>{{ p.titleName }}</strong>
<span v-if="p.isDefault">{{ t('finance.invoiceManage.profile.default') }}</span>
<p>{{ p.taxNo }}</p>
</div>
<div class="h5-inv-profile__acts">
<button type="button" @click="openProfileForm(p)">{{ t('common.edit') }}</button>
<button type="button" @click="removeProfile(p)">{{ t('common.delete') }}</button>
</div>
</article>
</div>
</div>
</a-drawer>
<a-drawer
:visible="profileFormVisible"
placement="bottom"
height="auto"
:footer="false"
:header="false"
unmount-on-close
@cancel="profileFormVisible = false"
>
<div class="h5-inv-sheet">
<header class="h5-inv-sheet__head">
<button type="button" @click="profileFormVisible = false"><icon-left /></button>
<h3>{{ profileForm.id ? t('finance.invoiceManage.profile.edit') : t('finance.invoiceManage.profile.add') }}</h3>
<span />
</header>
<div class="h5-inv-sheet__body">
<label class="h5-inv-field">
<span>{{ t('finance.invoiceManage.profile.titleName') }}</span>
<input v-model="profileForm.titleName" />
</label>
<label class="h5-inv-field">
<span>{{ t('finance.invoiceManage.profile.taxNo') }}</span>
<input v-model="profileForm.taxNo" />
</label>
<label class="h5-inv-field">
<span>{{ t('finance.invoiceManage.profile.addressPhone') }}</span>
<input v-model="profileForm.addressPhone" />
</label>
<label class="h5-inv-field">
<span>{{ t('finance.invoiceManage.profile.bankNameAccount') }}</span>
<input v-model="profileForm.bankNameAccount" />
</label>
<label class="h5-inv-check">
<input v-model="profileForm.isDefault" type="checkbox" />
{{ t('finance.invoiceManage.profile.isDefault') }}
</label>
</div>
<footer class="h5-inv-sheet__foot">
<button type="button" class="h5-inv-submit" :disabled="profileSaving" @click="saveProfile">
{{ t('finance.invoiceManage.profile.save') }}
</button>
</footer>
</div>
</a-drawer>
<a-drawer
:visible="detailVisible"
placement="bottom"
height="70%"
:footer="false"
:header="false"
unmount-on-close
@cancel="detailVisible = false"
>
<div class="h5-inv-sheet">
<header class="h5-inv-sheet__head">
<button type="button" @click="detailVisible = false"><icon-left /></button>
<h3>{{ t('finance.invoiceManage.drawer.detail') }}</h3>
<span />
</header>
<div v-if="detail" class="h5-inv-sheet__body">
<p><b>{{ detail.applyNo }}</b> · {{ detail.statusName }}</p>
<p>{{ detail.titleName }} · ¥{{ formatMoney(detail.amountTotal) }}</p>
<p v-if="detail.invoiceNumber">{{ detail.invoiceNumber }}</p>
<article v-for="line in detail.lines || []" :key="line.id || invoiceLineKey(line.sourceType, line.sourceId)" class="h5-inv-pick">
<div>
<strong>{{ line.sourceNo }}</strong>
<em>{{ line.sourceTypeName }} · ¥{{ formatMoney(line.amount) }}</em>
</div>
</article>
</div>
</div>
</a-drawer>
</div>
</template>
<script lang="ts" setup>
import { computed, onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { Message, Modal } from '@arco-design/web-vue'
import { IconLeft } from '@arco-design/web-vue/es/icon'
import H5EmptyState from '../components/H5EmptyState.vue'
import { getStatusTagStyle } from '@/utils/statusTag'
import {
DEFAULT_INVOICE_TAX_RATE,
INVOICE_MEDIUM,
INVOICE_STATUS,
INVOICE_TYPE,
createInvoiceApply,
deleteInvoiceProfile,
getInvoiceApplyDetail,
getInvoiceApplyList,
getInvoiceProfileList,
getInvoiceSelectable,
invoiceLineKey,
roundInvoiceMoney,
saveInvoiceProfile,
type InvoiceApply,
type InvoiceApplyLine,
type InvoiceProfile,
type InvoiceSelectableItem,
} from '@/api/finance/invoice'
defineOptions({ name: 'H5Invoice' })
const { t } = useI18n()
const router = useRouter()
const loading = ref(false)
const loadingMore = ref(false)
const rows = ref<InvoiceApply[]>([])
const currentPage = ref(1)
const pageSize = 20
const totalCount = ref(0)
const hasMore = computed(() => rows.value.length < totalCount.value)
const applyVisible = ref(false)
const applySaving = ref(false)
const profiles = ref<InvoiceProfile[]>([])
const selectableItems = ref<InvoiceSelectableItem[]>([])
const selectedLines = ref<Record<string, InvoiceApplyLine>>({})
const applyForm = reactive({
profileId: 0,
titleName: '',
taxNo: '',
invoiceType: INVOICE_TYPE.Normal,
medium: INVOICE_MEDIUM.Electronic,
})
const selectedTotal = computed(() =>
roundInvoiceMoney(
Object.values(selectedLines.value).reduce((sum, line) => sum + Number(line.amount || 0), 0),
),
)
const profileVisible = ref(false)
const profileFormVisible = ref(false)
const profileSaving = ref(false)
const profileForm = reactive({
id: 0,
titleName: '',
taxNo: '',
addressPhone: '',
bankNameAccount: '',
isDefault: false,
})
const detailVisible = ref(false)
const detail = ref<InvoiceApply | null>(null)
function formatMoney(value?: number) {
return (Number(value) || 0).toFixed(2)
}
function statusStyle(status: string) {
const tone =
status === INVOICE_STATUS.Draft
? 'neutral'
: status === INVOICE_STATUS.PendingApproval
? 'wait'
: status === INVOICE_STATUS.Approved
? 'brand'
: status === INVOICE_STATUS.Issued
? 'ok'
: status === INVOICE_STATUS.Rejected
? 'alert'
: 'mute'
return getStatusTagStyle(tone)
}
function goBack() {
if (window.history.length > 1) {
router.back()
return
}
router.replace('/h5/me')
}
async function loadList(reset = true) {
if (reset) {
currentPage.value = 1
loading.value = true
} else {
loadingMore.value = true
}
try {
const { items, total } = await getInvoiceApplyList({
page: currentPage.value,
pageSize,
})
rows.value = reset ? items : [...rows.value, ...items]
totalCount.value = total
} catch (e: any) {
Message.error(e?.message || t('finance.invoiceManage.message.loadError'))
} finally {
loading.value = false
loadingMore.value = false
}
}
function loadMore() {
currentPage.value += 1
loadList(false)
}
async function loadProfiles(selectDefault = false) {
profiles.value = await getInvoiceProfileList()
if (selectDefault) {
const def = profiles.value.find((p) => p.isDefault) || profiles.value[0]
if (def) {
applyForm.profileId = def.id
onProfileChange()
}
}
}
async function openApply() {
applyForm.profileId = 0
applyForm.titleName = ''
applyForm.taxNo = ''
applyForm.invoiceType = INVOICE_TYPE.Normal
applyForm.medium = INVOICE_MEDIUM.Electronic
selectedLines.value = {}
applyVisible.value = true
try {
const [{ items }] = await Promise.all([
getInvoiceSelectable({ page: 1, pageSize: 100 }),
loadProfiles(true),
])
selectableItems.value = items
} catch (e: any) {
Message.error(e?.message || t('h5.invoice.failed'))
}
}
function onProfileChange() {
const profile = profiles.value.find((p) => p.id === applyForm.profileId)
if (!profile) return
applyForm.titleName = profile.titleName
applyForm.taxNo = profile.taxNo
}
function isLineSelected(item: InvoiceSelectableItem) {
return Boolean(selectedLines.value[invoiceLineKey(item.sourceType, item.sourceId)])
}
function toggleSelectable(item: InvoiceSelectableItem, checked: boolean) {
const key = invoiceLineKey(item.sourceType, item.sourceId)
const next = { ...selectedLines.value }
if (checked) {
next[key] = {
sourceType: item.sourceType,
sourceTypeName: item.sourceTypeName,
sourceId: item.sourceId,
sourceNo: item.sourceNo,
amount: item.remainingAmount,
currency: item.currency,
}
} else {
delete next[key]
}
selectedLines.value = next
}
async function submitApply() {
if (!applyForm.titleName.trim() || !applyForm.taxNo.trim()) {
Message.warning(t('h5.invoice.needProfile'))
return
}
if (!Object.keys(selectedLines.value).length) {
Message.warning(t('h5.invoice.needLines'))
return
}
applySaving.value = true
try {
const result = await createInvoiceApply({
invoiceType: applyForm.invoiceType,
medium: applyForm.medium,
profileId: applyForm.profileId || undefined,
titleName: applyForm.titleName.trim(),
taxNo: applyForm.taxNo.trim(),
taxRate: DEFAULT_INVOICE_TAX_RATE,
submit: true,
lines: Object.values(selectedLines.value).map((line) => ({
sourceType: line.sourceType,
sourceId: line.sourceId,
amount: roundInvoiceMoney(line.amount),
})),
})
Message.success(result.message || t('h5.invoice.success'))
applyVisible.value = false
await loadList(true)
} catch (e: any) {
Message.error(e?.message || t('h5.invoice.failed'))
} finally {
applySaving.value = false
}
}
async function openProfiles() {
profileVisible.value = true
try {
await loadProfiles()
} catch (e: any) {
Message.error(e?.message || t('h5.invoice.failed'))
}
}
function openProfileForm(row?: InvoiceProfile) {
profileForm.id = row?.id || 0
profileForm.titleName = row?.titleName || ''
profileForm.taxNo = row?.taxNo || ''
profileForm.addressPhone = row?.addressPhone || ''
profileForm.bankNameAccount = row?.bankNameAccount || ''
profileForm.isDefault = Boolean(row?.isDefault)
profileFormVisible.value = true
}
async function saveProfile() {
if (!profileForm.titleName.trim() || !profileForm.taxNo.trim()) {
Message.warning(t('h5.invoice.needProfile'))
return
}
profileSaving.value = true
try {
await saveInvoiceProfile({
id: profileForm.id || undefined,
titleName: profileForm.titleName.trim(),
taxNo: profileForm.taxNo.trim(),
addressPhone: profileForm.addressPhone.trim() || undefined,
bankNameAccount: profileForm.bankNameAccount.trim() || undefined,
isDefault: profileForm.isDefault,
})
Message.success(t('finance.invoiceManage.message.profileSaved'))
profileFormVisible.value = false
await loadProfiles()
} catch (e: any) {
Message.error(e?.message || t('h5.invoice.failed'))
} finally {
profileSaving.value = false
}
}
function removeProfile(row: InvoiceProfile) {
Modal.confirm({
title: t('finance.invoiceManage.profile.deleteConfirm'),
onOk: async () => {
await deleteInvoiceProfile(row.id)
Message.success(t('finance.invoiceManage.message.profileDeleted'))
await loadProfiles()
},
})
}
async function openDetail(row: InvoiceApply) {
detailVisible.value = true
try {
detail.value = await getInvoiceApplyDetail(row.id)
} catch (e: any) {
Message.error(e?.message || t('h5.invoice.failed'))
}
}
onMounted(() => {
loadList(true)
})
</script>
<style lang="less" scoped>
.h5-inv-page {
min-height: 100%;
min-height: 100dvh;
padding: 0 12px 88px;
box-sizing: border-box;
background: #f5f7f8;
}
.h5-inv-nav {
position: sticky;
top: 0;
z-index: 20;
display: flex;
align-items: center;
justify-content: space-between;
height: 48px;
margin: 0 -12px 10px;
padding: 0 8px;
background: color-mix(in srgb, #fff 92%, transparent);
backdrop-filter: blur(10px);
border-bottom: 1px solid #e5e6eb;
h1 {
margin: 0;
font-size: 16px;
font-weight: 600;
}
}
.h5-inv-nav__back,
.h5-inv-sheet__head button {
width: 40px;
height: 40px;
border: none;
background: transparent;
font-size: 20px;
color: #1d2129;
}
.h5-inv-nav__action {
height: 32px;
padding: 0 8px;
border: none;
background: transparent;
color: var(--app-primary-color);
font-size: 13px;
font-weight: 600;
}
.h5-inv-card {
margin-bottom: 10px;
padding: 12px;
border-radius: 12px;
background: #fff;
box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
.h5-inv-card__head {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
}
.h5-inv-card__title {
margin: 8px 0 0;
font-size: 13px;
color: #4e5969;
}
.h5-inv-card__meta {
display: flex;
gap: 8px;
margin-top: 8px;
font-size: 12px;
color: #86909c;
em {
font-style: normal;
font-weight: 700;
color: #1d2129;
}
}
.h5-inv-more,
.h5-inv-empty-btn {
width: 100%;
height: 36px;
margin-top: 8px;
border: none;
border-radius: 8px;
background: #fff;
color: var(--app-primary-color);
font-weight: 600;
}
.h5-inv-fab {
position: fixed;
left: 12px;
right: 12px;
bottom: calc(16px + env(safe-area-inset-bottom));
height: 44px;
border: none;
border-radius: 10px;
background: var(--app-primary-color);
color: #fff;
font-size: 15px;
font-weight: 600;
}
.h5-inv-sheet {
display: flex;
flex-direction: column;
height: 100%;
}
.h5-inv-sheet__head {
display: flex;
align-items: center;
justify-content: space-between;
height: 48px;
padding: 0 8px;
border-bottom: 1px solid #eef0f3;
h3 {
margin: 0;
font-size: 16px;
}
}
.h5-inv-sheet__body {
flex: 1;
overflow: auto;
padding: 12px;
}
.h5-inv-sheet__foot {
padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
border-top: 1px solid #eef0f3;
}
.h5-inv-field {
display: flex;
flex-direction: column;
gap: 6px;
margin-bottom: 12px;
font-size: 13px;
color: #4e5969;
input,
select {
height: 36px;
padding: 0 10px;
border: 1px solid #e5e6eb;
border-radius: 8px;
background: #fff;
}
}
.h5-inv-section {
margin: 8px 0;
font-weight: 600;
}
.h5-inv-empty-text {
color: #86909c;
font-size: 13px;
}
.h5-inv-pick {
display: flex;
gap: 10px;
align-items: center;
padding: 10px;
margin-bottom: 8px;
border-radius: 10px;
background: #f7f8fa;
&.is-on {
background: color-mix(in srgb, var(--app-primary-color) 8%, #fff);
}
strong {
display: block;
font-size: 13px;
}
em {
font-style: normal;
font-size: 12px;
color: #86909c;
}
}
.h5-inv-sum {
text-align: right;
margin-top: 8px;
strong {
color: var(--app-primary-color);
}
}
.h5-inv-submit {
width: 100%;
height: 42px;
border: none;
border-radius: 10px;
background: var(--app-primary-color);
color: #fff;
font-weight: 600;
}
.h5-inv-profile {
display: flex;
justify-content: space-between;
gap: 10px;
padding: 12px;
margin-bottom: 8px;
border-radius: 10px;
background: #f7f8fa;
p {
margin: 4px 0 0;
color: #86909c;
font-size: 12px;
}
}
.h5-inv-profile__acts {
display: flex;
gap: 8px;
button {
border: none;
background: transparent;
color: var(--app-primary-color);
font-size: 12px;
}
}
.h5-inv-check {
display: flex;
align-items: center;
gap: 8px;
margin: 8px 0 16px;
}
</style>

View File

@ -62,6 +62,7 @@ import {
H5_CUSTOMER_TAB_KEEP_ALIVE,
useH5TabScrollMemory,
} from '@/views/h5/composables/useH5TabEnterOnce';
import { brandCopy } from '@/utils/brandCopy';
defineOptions({ name: 'H5CustomerCenterLayout' });
@ -114,7 +115,7 @@ const headerTitle = computed(() => {
});
function syncDocumentTitle() {
document.title = t('h5.documentTitle');
document.title = t('h5.documentTitle', { name: brandCopy.navName });
}
async function refreshOrderBadge() {

View File

@ -1,6 +1,6 @@
export default {
'h5.center.title': 'Customer Center',
'h5.documentTitle': 'BCD Customer Center',
'h5.documentTitle': '{name} Customer Center',
'h5.noticePopup.title': 'Notice',
'h5.noticePopup.markRead': 'Mark as read',
'h5.noticePopup.later': 'Later',
@ -326,9 +326,8 @@ export default {
'h5.wxQr.success': 'Signed in',
'h5.login.title': 'Sign in',
'h5.login.brand': 'BCD Customer Center',
'h5.login.brandName': 'BCD',
'h5.login.brandHint': 'Welcome to your BCD portal',
'h5.login.brand': '{name} Customer Center',
'h5.login.brandHint': 'Welcome to your {name} portal',
'h5.login.backToSite': 'Back to website',
'h5.login.tab.wechat': 'WeChat',
'h5.login.tab.password': 'Account',
@ -379,6 +378,20 @@ export default {
'h5.recharge.backMe': 'Back to Me',
'h5.recharge.done': 'Done',
'h5.invoice.title': 'Invoices',
'h5.invoice.apply': 'Request invoice',
'h5.invoice.profiles': 'Titles',
'h5.invoice.empty': 'No invoice applies yet',
'h5.invoice.submit': 'Submit',
'h5.invoice.needProfile': 'Enter invoice title and tax no.',
'h5.invoice.needLines': 'Select invoice lines',
'h5.invoice.success': 'Invoice apply submitted',
'h5.invoice.failed': 'Submit failed',
'h5.invoice.loadMore': 'Load more',
'h5.invoice.selectableEmpty': 'No billable sources',
'h5.invoice.selectedAmount': 'Selected total',
'h5.invoice.back': 'Back',
'h5.orderType.title': 'Choose order type',
'h5.orderType.subtitle': 'Select the type of order to create',
'h5.orderType.logistics': 'Shipping order',
@ -709,6 +722,7 @@ export default {
'h5.me.inviteDesc': 'Invite & earn',
'h5.me.commission': 'Commission',
'h5.me.commissionDesc': 'Withdraw / balance',
'h5.me.invoice': 'Invoice',
'h5.me.placeOrder': 'Order',
'h5.me.placeOrderDesc': 'Ship in a few taps',
'h5.me.section.services': 'Services',

View File

@ -1,6 +1,6 @@
export default {
'h5.center.title': '客户中心',
'h5.documentTitle': 'BCD客户中心',
'h5.documentTitle': '{name}客户中心',
'h5.noticePopup.title': '公告',
'h5.noticePopup.markRead': '已读',
'h5.noticePopup.later': '稍后',
@ -325,9 +325,8 @@ export default {
'h5.wxQr.success': '登录成功',
'h5.login.title': '登录',
'h5.login.brand': 'BCD客户中心',
'h5.login.brandName': 'BCD',
'h5.login.brandHint': '欢迎登录 BCD 客户门户',
'h5.login.brand': '{name}客户中心',
'h5.login.brandHint': '欢迎登录 {name} 客户门户',
'h5.login.backToSite': '返回官网',
'h5.login.tab.wechat': '微信登录',
'h5.login.tab.password': '账号登录',
@ -378,6 +377,20 @@ export default {
'h5.recharge.backMe': '返回我的',
'h5.recharge.done': '完成',
'h5.invoice.title': '发票',
'h5.invoice.apply': '申请开票',
'h5.invoice.profiles': '抬头',
'h5.invoice.empty': '暂无开票申请',
'h5.invoice.submit': '提交申请',
'h5.invoice.needProfile': '请填写发票抬头和税号',
'h5.invoice.needLines': '请选择开票明细',
'h5.invoice.success': '已提交开票申请',
'h5.invoice.failed': '提交失败',
'h5.invoice.loadMore': '加载更多',
'h5.invoice.selectableEmpty': '暂无可开票来源',
'h5.invoice.selectedAmount': '已选合计',
'h5.invoice.back': '返回',
'h5.orderType.title': '选择下单类型',
'h5.orderType.subtitle': '请先选择要创建的订单类型',
'h5.orderType.logistics': '物流订单',
@ -696,6 +709,7 @@ export default {
'h5.me.inviteDesc': '邀友有礼',
'h5.me.commission': '佣金',
'h5.me.commissionDesc': '提现/转余额',
'h5.me.invoice': '开票',
'h5.me.placeOrder': '去下单',
'h5.me.placeOrderDesc': '填好收件,一键寄出',
'h5.me.section.services': '常用服务',

View File

@ -13,7 +13,7 @@
<span v-else class="h5-login-card__logo-mark" aria-hidden="true">{{
BRAND_TEXT_LOGO
}}</span>
<span v-if="logoSrc">{{ t('h5.login.brandName') }}</span>
<span v-if="logoSrc">{{ brandCopy.navName }}</span>
</div>
<a-spin :size="28" />
<p class="h5-login-oauth-screen__text">{{ t('h5.login.oauthLoggingIn') }}</p>
@ -47,9 +47,9 @@
<span v-else class="h5-login-card__logo-mark" aria-hidden="true">{{
BRAND_TEXT_LOGO
}}</span>
<h2 v-if="logoSrc" class="h5-login-card__title">{{ t('h5.login.brandName') }}</h2>
<h2 v-if="logoSrc" class="h5-login-card__title">{{ brandCopy.navName }}</h2>
</button>
<p class="h5-login-card__hint">{{ t('h5.login.brandHint') }}</p>
<p class="h5-login-card__hint">{{ t('h5.login.brandHint', { name: brandCopy.navName }) }}</p>
</header>
<form class="h5-login-form" @submit.prevent="handleSubmit">
@ -189,6 +189,7 @@ import { loginErrorForUser, useRbacUserStore } from '@/store/modules/rbac-user';
import { useLoginCaptchaGate } from '@/composables/useLoginCaptchaGate';
import LoginCaptchaField from '@/components/LoginCaptchaField/index.vue';
import { BRAND_TEXT_LOGO, brandLogoImages } from '@/utils/brandLogo';
import { brandCopy } from '@/utils/brandCopy';
import LoginLangToggle from '@/views/login/components/LoginLangToggle.vue';
import H5LoginPortalSwitch from '@/views/h5/components/H5LoginPortalSwitch.vue';
import WechatOAuthLoginButton from '../components/WechatOAuthLoginButton.vue';
@ -430,7 +431,7 @@ async function handleSubmit() {
}
onMounted(async () => {
document.title = t('h5.documentTitle');
document.title = t('h5.documentTitle', { name: brandCopy.navName });
if (isLogin()) {
router.replace(resolveRedirectPath());
return;

View File

@ -267,6 +267,13 @@
class="h5-me-list h5-me-enter"
style="--h5-me-delay: 280ms"
>
<button type="button" class="h5-me-list__item" @click="goInvoice">
<span class="h5-me-list__left">
<icon-file class="h5-me-list__icon" />
{{ t('h5.me.invoice') }}
</span>
<icon-right />
</button>
<button type="button" class="h5-me-list__item" @click="toggleLocale">
<span class="h5-me-list__left">
<icon-language class="h5-me-list__icon" />
@ -397,6 +404,7 @@ import {
IconWechat,
IconCustomerService,
IconNotification,
IconFile,
} from '@arco-design/web-vue/es/icon';
import type { CustomerDto } from '@/api/customer';
import {
@ -765,6 +773,10 @@ async function goRecharge() {
await openSheet('recharge', rechargeVisible);
}
function goInvoice() {
h5Navigate(router, '/h5/invoice');
}
async function openPickup() {
await openSheet('pickup', pickupVisible);
}

View File

@ -10,7 +10,7 @@
]"
>
<div v-if="isCustomer" class="login-hero__ambient" aria-hidden="true">
<span class="login-hero__watermark">{{ t('brand.name') }}</span>
<span class="login-hero__watermark">{{ brandCopy.navName }}</span>
</div>
<div class="login-hero__inner">
@ -30,14 +30,14 @@
<div class="login-hero__content">
<div v-if="isCustomer" class="login-hero__heading">
<h1 class="login-hero__tagline">{{ t('brand.fullName') }}</h1>
<h1 class="login-hero__tagline">{{ brandCopy.navFullName }}</h1>
<span class="login-hero__rule" aria-hidden="true" />
<p class="login-hero__trust">{{ t('login.hero.trust.customer') }}</p>
</div>
<template v-if="isCustomer">
<p class="login-hero__desc">
{{ t('login.hero.desc.customer') }}
{{ t('login.hero.desc.customer', { name: brandCopy.navName }) }}
</p>
<div class="login-hero__tools">
@ -139,6 +139,7 @@ import { computed, onBeforeUnmount, onMounted, ref, type Component } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { Message } from '@arco-design/web-vue';
import { brandCopy } from '@/utils/brandCopy';
import {
IconCheckCircle,
IconThunderbolt,

View File

@ -1,18 +1,17 @@
<template>
<div v-if="logoSrc" class="login-brand" aria-hidden="true">
<img class="login-brand__img" :src="logoSrc" alt="" draggable="false" />
<span class="login-brand__name">{{ t('brand.name') }}</span>
<span class="login-brand__name">{{ brandCopy.navName }}</span>
</div>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { brandLogoImages } from '@/utils/brandLogo';
import { brandCopy } from '@/utils/brandCopy';
defineOptions({ name: 'LoginLockLogo' });
const { t } = useI18n();
const logoSrc = computed(() => brandLogoImages.site);
</script>

View File

@ -142,6 +142,7 @@ import { useLoginCaptchaGate } from '@/composables/useLoginCaptchaGate';
import LoginCaptchaField from '@/components/LoginCaptchaField/index.vue';
import { LOGIN_CHARACTERS_KEY, type LoginCharactersApi } from '../../composables/useLoginCharacters';
import LoginLockLogo from '../LoginLockLogo.vue';
import { brandCopy } from '@/utils/brandCopy';
const { t } = useI18n();
@ -206,9 +207,10 @@ const loginCharacters = computed(() => loginCharactersRef?.value ?? null);
const isCustomerLogin = computed(() => props.loginType === OmsLoginType.Customer);
const isAgentLogin = computed(() => props.loginType === OmsLoginType.Agent);
const brandHint = computed(() => {
if (isCustomerLogin.value) return t('login.form.brandHint.customer');
if (isAgentLogin.value) return t('login.form.brandHint.agent');
return t('login.form.brandHint.admin');
const name = brandCopy.navName;
if (isCustomerLogin.value) return t('login.form.brandHint.customer', { name });
if (isAgentLogin.value) return t('login.form.brandHint.agent', { name });
return t('login.form.brandHint.admin', { name });
});
/** Logo / 欢迎文案 → 官网首页(与门户切换同一套中心虹膜过渡) */

View File

@ -23,7 +23,7 @@
class="login-brand-corner"
:class="{ 'login-brand-corner--light': isLightMode }"
>
<span class="login-brand-corner__name">{{ t('brand.name') }}</span>
<span class="login-brand-corner__name">{{ brandCopy.navName }}</span>
<span class="login-brand-corner__suffix">· {{ brandCornerSuffix }}</span>
</div>
<aside v-if="isCustomerLogin" class="login-hero-panel">
@ -114,6 +114,7 @@ import {
} from './composables/useLoginCharacters';
import { LOGIN_EXIT_KEY, type LoginExitApi } from './composables/useLoginExit';
import { isPortalIrisActive } from '@/utils/page-transition-flag';
import { brandCopy } from '@/utils/brandCopy';
/** Admin login never mounts WeChat; keep it out of the critical path */
const WechatLogin = defineAsyncComponent(
@ -139,7 +140,7 @@ const isCustomerLogin = computed(() => loginType.value === OmsLoginType.Customer
const isAgentLogin = computed(() => loginType.value === OmsLoginType.Agent);
const isAdminLogin = computed(() => loginType.value === OmsLoginType.User);
const brandCornerSuffix = computed(() =>
isAgentLogin.value ? t('login.brand.suffix.agent') : t('brand.fullName'),
isAgentLogin.value ? t('login.brand.suffix.agent') : brandCopy.navFullName,
);
/** 角色动画偏重,首屏延后空闲再挂 */
const showCharacters = ref(false);

View File

@ -1,6 +1,4 @@
export default {
'brand.name': 'BCD',
'brand.fullName': 'Business & Customer & Delivery',
'login.form.password.errMsg': 'Password cannot be empty',
'login.form.login.success': 'Login successful',
'login.form.login.failed': 'Login failed, please check your account and password',
@ -12,9 +10,9 @@
'login.captcha.required': 'Please enter the captcha',
'login.captcha.refresh': 'Click to refresh captcha',
'login.captcha.loading': 'Loading',
'login.form.brandHint.customer': 'Welcome to your BCD portal',
'login.form.brandHint.admin': 'Welcome to BCD Operations Console',
'login.form.brandHint.agent': 'Welcome to BCD Channel Agent Portal',
'login.form.brandHint.customer': 'Welcome to your {name} portal',
'login.form.brandHint.admin': 'Welcome to {name} Operations Console',
'login.form.brandHint.agent': 'Welcome to {name} Channel Agent Portal',
'login.brand.suffix.agent': 'Channel Agent',
'login.switchToWechat': 'Sign in with WeChat',
'login.switchToAccount': 'Account and password',
@ -40,7 +38,7 @@
'login.lang.toZh': 'Switch to Chinese',
'login.hero.tagline': 'Faster · Simpler · Professional',
'login.hero.desc.customer':
'Clear quotes, smooth booking, live tracking. AI flags risks and suggests next steps—from pickup to delivery, BCD keeps every shipment visible and accounted for.',
'Clear quotes, smooth booking, live tracking. AI flags risks and suggests next steps—from pickup to delivery, {name} keeps every shipment visible and accounted for.',
'login.hero.admin.pillar.care.title': 'More Professional',
'login.hero.admin.pillar.care.desc': 'Right lanes · No dropped issues · Clear end-to-end',
'login.hero.admin.pillar.speed.title': 'Faster',

View File

@ -1,6 +1,4 @@
export default {
'brand.name': 'BCD',
'brand.fullName': 'Business & Customer & Delivery',
'login.form.password.errMsg': '密码不能为空',
'login.form.login.success': '登录成功',
'login.form.login.failed': '登录失败,请检查账号密码',
@ -12,9 +10,9 @@
'login.captcha.required': '请输入验证码',
'login.captcha.refresh': '点击刷新验证码',
'login.captcha.loading': '加载中',
'login.form.brandHint.customer': '欢迎登录 BCD 客户门户',
'login.form.brandHint.admin': '欢迎登录 BCD 运营管理后台',
'login.form.brandHint.agent': '欢迎登录 BCD 渠道代理门户',
'login.form.brandHint.customer': '欢迎登录 {name} 客户门户',
'login.form.brandHint.admin': '欢迎登录 {name} 运营管理后台',
'login.form.brandHint.agent': '欢迎登录 {name} 渠道代理门户',
'login.brand.suffix.agent': '渠道代理',
'login.switchToWechat': '微信扫码登录',
'login.switchToAccount': '账号密码登录',
@ -40,7 +38,7 @@
'login.lang.toZh': '切换为中文',
'login.hero.tagline': 'Faster · Simpler · Professional',
'login.hero.desc.customer':
'查价说得清、下单走得顺、轨迹跟得上。AI 帮你看风险、提建议——从揽收到签收,BCD 陪你把每一票发好、盯紧、交代清楚。',
'查价说得清、下单走得顺、轨迹跟得上。AI 帮你看风险、提建议——从揽收到签收,{name} 陪你把每一票发好、盯紧、交代清楚。',
'login.hero.admin.pillar.care.title': '更专业',
'login.hero.admin.pillar.care.desc': '线路选对 · 异常不丢 · 全程说得清',
'login.hero.admin.pillar.speed.title': '更快速',

View File

@ -50,7 +50,7 @@
<a
class="nova-register__header"
href="/"
:title="t('marketing.register.brandHint')"
:title="brandHintText"
@click.prevent="goOfficialSite"
>
<LoginLockLogo />
@ -310,6 +310,7 @@ import { isAdminH5Path } from '@/utils/login-portal'
import LoginHero from '@/views/login/components/LoginHero.vue'
import LoginLangToggle from '@/views/login/components/LoginLangToggle.vue'
import LoginLockLogo from '@/views/login/components/LoginLockLogo.vue'
import { brandCopy } from '@/utils/brandCopy'
const LoginCharacters = defineAsyncComponent(
() => import('@/views/login/components/LoginCharacters.vue'),
@ -347,9 +348,10 @@ function parseStepFromQuery(mode: unknown): RegisterStep {
}
const brandHintText = computed(() => {
if (step.value === 'web') return t('marketing.register.brandHint.web')
if (step.value === 'wechat') return t('marketing.register.brandHint.wechat')
return t('marketing.register.brandHint')
const name = brandCopy.navName
if (step.value === 'web') return t('marketing.register.brandHint.web', { name })
if (step.value === 'wechat') return t('marketing.register.brandHint.wechat', { name })
return t('marketing.register.brandHint', { name })
})
function attributionQuery(): Record<string, string> {

View File

@ -1,7 +1,7 @@
export default {
'marketing.register.title': 'Register',
'marketing.register.subtitle': 'Member pricing and welcome benefits',
'marketing.register.brandHint': 'Welcome to BCD customer portal',
'marketing.register.brandHint': 'Welcome to {name} customer portal',
'marketing.register.brandHint.web': 'Register with email & phone',
'marketing.register.brandHint.wechat': 'Register with WeChat',
'marketing.register.choose.group': 'Choose how to register',

View File

@ -1,9 +1,9 @@
export default {
'marketing.register.title': '客户注册',
'marketing.register.subtitle': '注册即享会员价与新人福利',
'marketing.register.brandHint': '欢迎注册 BCD 客户门户',
'marketing.register.brandHint.web': '网页注册 BCD 客户账号',
'marketing.register.brandHint.wechat': '微信扫码注册 BCD 客户账号',
'marketing.register.brandHint': '欢迎注册 {name} 客户门户',
'marketing.register.brandHint.web': '网页注册 {name} 客户账号',
'marketing.register.brandHint.wechat': '微信扫码注册 {name} 客户账号',
'marketing.register.choose.group': '选择注册方式',
'marketing.register.choose.web': '网页注册',
'marketing.register.choose.webDesc': '填写资料,立即开通客户门户',

View File

@ -257,6 +257,7 @@
WELCOME_COPY,
} from './lib/site-welcome';
import { ROUTE_DEST_PRESETS } from './lib/portal-catalog';
import { resolveAiWelcomeTitle } from '@/utils/brandCopy';
/** 会话内跟进只保留前几条,避免底部一排挤占阅读 */
const FOLLOWUP_VISIBLE = 3;
@ -346,8 +347,8 @@
(d): d is (typeof HOME_DOORS)[number] => !!d,
);
/** 官网 H5 / PC 统一完整标题,不再用缩短版(避免「一站式」等字缺失) */
const heroTitle = computed(() => copy.value.title);
/** 官网 H5 / PC 统一完整标题(品牌 Logo 弹窗可配,本地缓存秒开) */
const heroTitle = computed(() => resolveAiWelcomeTitle(props.isZh, false));
const draft = computed({
get: () => props.modelValue,

View File

@ -7,10 +7,10 @@
class="logo d-flex align-items-center"
@click="$emit('home')"
>
<img :src="siteLogoSrc" alt="BCD logo" width="40" height="40" />
<img :src="siteLogoSrc" :alt="`${brandCopy.navName} logo`" width="40" height="40" />
<span class="brand-lockup">
<h1>BCD</h1>
<small class="brand-fullname">Business & Customer & Delivery</small>
<h1>{{ brandCopy.navName }}</h1>
<small class="brand-fullname">{{ brandCopy.navFullName }}</small>
</span>
</a>
@ -123,6 +123,7 @@
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

@ -51,6 +51,7 @@
import { computed } from 'vue';
import { officialLoginUrl, officialTrackLoginUrl } from './lib/site-urls';
import { SITE_CONTACT } from './lib/site-welcome';
import { brandCopy } from '@/utils/brandCopy';
type Card = Record<string, any>;
@ -135,7 +136,7 @@
kicker: isZh ? '9610 · 快捷出货' : '9610 · fastest exit',
title: isZh ? '基础通关服务' : 'Basic clearance',
body: isZh
? '仅需出货:物流商统一简易申报。出得快,但税务未规范可能被视同内销(增值税 + 所得税 + 滞纳金)。量起来后建议升到免征或退税,BCD 可评估路径。'
? `仅需出货:物流商统一简易申报。出得快,但税务未规范可能被视同内销(增值税 + 所得税 + 滞纳金)。量起来后建议升到免征或退税,${brandCopy.navName} 可评估路径。`
: 'Ship-only: carrier files a simplified declaration. Fast, but unstructured tax handling can be treated as domestic sales. We can review an upgrade path when volume grows.',
},
}[card.type];
@ -161,7 +162,7 @@
}
if (card.type === 'company') {
return {
kicker: isZh ? '关于我们' : 'About BCD',
kicker: isZh ? '关于我们' : `About ${brandCopy.navName}`,
title: isZh ? '中小卖家的跨境物流顾问' : 'Cross-border logistics for SMB sellers',
body: isZh
? '深圳宝安运营,备案主体可核(' + c.icp + ')。主做美欧与东南亚小包。接小批量、带电、别人不接的 9610。一人从报价跟到售后。'

View File

@ -119,6 +119,7 @@
import { useSiteAdvisor } from './useSiteAdvisor';
import { trackSiteEvent } from '@/utils/ga';
import { isPortalIrisActive } from '@/utils/page-transition-flag';
import { brandCopy } from '@/utils/brandCopy';
// 同步注入,离开页面时卸载,避免污染 /h5 与 EdiAssistant
mountOfficialSiteStyles();
@ -126,9 +127,13 @@
type PanelId = 'routes' | 'services' | 'pricing' | 'about' | 'contact' | null;
const NAV_PANELS: PanelId[] = ['routes', 'services', 'pricing', 'about', 'contact'];
const TITLE = 'BCD - 跨境物流,全球即递';
const DESCRIPTION =
'BCD 面向中小卖家的跨境物流。全球数字化一站式跨境物流服务商。注册登记后即可询价,一口价不砍,专属顾问跟到签收。';
const siteTitle = computed(
() => `${brandCopy.navName} - 跨境物流,全球即递`,
);
const siteDescription = computed(
() =>
`${brandCopy.navName} 面向中小卖家的跨境物流。全球数字化一站式跨境物流服务商。注册登记后即可询价,一口价不砍,专属顾问跟到签收。`,
);
const router = useRouter();
const lang = ref<'zh' | 'en'>('zh');
@ -219,15 +224,17 @@
}
function applyMeta() {
document.title = TITLE;
ensureMeta('description', DESCRIPTION);
const title = siteTitle.value;
const description = siteDescription.value;
document.title = title;
ensureMeta('description', description);
ensureMeta(
'keywords',
'BCD, 跨境物流, 中小卖家, 9610, 疑难单, 出口退税, 欧美专线, 东南亚专线',
`${brandCopy.navName}, 跨境物流, 中小卖家, 9610, 疑难单, 出口退税, 欧美专线, 东南亚专线`,
);
const origin = window.location.origin;
ensureOg('og:title', TITLE);
ensureOg('og:description', DESCRIPTION);
ensureOg('og:title', title);
ensureOg('og:description', description);
ensureOg('og:image', `${origin}/site/img/og-cover.png`);
ensureOg('og:url', `${origin}/`);
ensureOg('og:type', 'website');

View File

@ -740,85 +740,185 @@
width="720px"
:mask-closable="false"
unmount-on-close
modal-class="brand-config-modal"
>
<a-alert type="info" :show-icon="false" class="modal-form-tip">
{{ t('system.otherConfig.brandLogo.tip') }}
</a-alert>
<div v-if="brandLogoLoading" class="payment-qr-loading">
<a-spin />
</div>
<div v-else class="brand-logo-grid">
<div
v-for="item in brandLogoCards"
:key="item.channel"
class="brand-logo-card"
>
<div class="brand-logo-card__meta">
<div class="brand-logo-card__meta-text">
<span class="brand-logo-card__title">{{ item.title }}</span>
<span class="brand-logo-card__size">{{ item.sizeHint }}</span>
<div v-else class="brand-logo-editor">
<a-tabs v-model:active-key="brandLogoTab" type="rounded" size="small" class="brand-config-tabs">
<a-tab-pane key="copy" :title="t('system.otherConfig.brandLogo.tab.copy')">
<div class="brand-copy-pane">
<div class="brand-copy-block">
<div class="brand-copy-block__head">
<strong>{{ t('system.otherConfig.brandLogo.copy.navTitle') }}</strong>
<span>{{ t('system.otherConfig.brandLogo.copy.navHint') }}</span>
</div>
<a-row :gutter="12">
<a-col :span="8">
<a-form-item
:label="t('system.otherConfig.brandLogo.copy.navName')"
class="brand-copy-item"
>
<a-input v-model="brandCopyForm.navName" allow-clear :max-length="80" />
</a-form-item>
</a-col>
<a-col :span="16">
<a-form-item
:label="t('system.otherConfig.brandLogo.copy.navFullName')"
class="brand-copy-item"
>
<a-input v-model="brandCopyForm.navFullName" allow-clear :max-length="200" />
</a-form-item>
</a-col>
</a-row>
</div>
<div class="brand-copy-block">
<div class="brand-copy-block__head">
<strong>{{ t('system.otherConfig.brandLogo.copy.aiTitle') }}</strong>
<span>{{ t('system.otherConfig.brandLogo.copy.aiHint') }}</span>
</div>
<a-row :gutter="12">
<a-col :span="12">
<a-form-item
:label="t('system.otherConfig.brandLogo.copy.aiWelcomeTitleZh')"
class="brand-copy-item"
>
<a-input
v-model="brandCopyForm.aiWelcomeTitleZh"
allow-clear
:max-length="200"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="t('system.otherConfig.brandLogo.copy.aiWelcomeTitleShortZh')"
class="brand-copy-item"
>
<a-input
v-model="brandCopyForm.aiWelcomeTitleShortZh"
allow-clear
:max-length="200"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="t('system.otherConfig.brandLogo.copy.aiWelcomeTitleEn')"
class="brand-copy-item"
>
<a-input
v-model="brandCopyForm.aiWelcomeTitleEn"
allow-clear
:max-length="200"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="t('system.otherConfig.brandLogo.copy.aiWelcomeTitleShortEn')"
class="brand-copy-item"
>
<a-input
v-model="brandCopyForm.aiWelcomeTitleShortEn"
allow-clear
:max-length="200"
/>
</a-form-item>
</a-col>
</a-row>
</div>
<div class="brand-copy-actions">
<a-button
class="app-btn-primary-soft"
:loading="brandCopySaving"
@click="handleBrandCopySave"
>
{{ t('system.otherConfig.brandLogo.copy.save') }}
</a-button>
</div>
</div>
<a-button
v-if="item.url"
class="brand-logo-card__clear"
size="mini"
:loading="item.uploading"
@click.stop="handleBrandLogoClear(item.channel)"
>
{{ t('system.otherConfig.brandLogo.clear') }}
</a-button>
</div>
<div
class="brand-logo-card__zone"
:class="{
'is-filled': !!item.url,
'is-uploading': item.uploading,
'is-dragover': brandLogoDragOver[item.channel],
}"
@click="openBrandLogoPicker(item.channel)"
@dragenter.prevent="onBrandLogoDragEnter(item.channel)"
@dragover.prevent="onBrandLogoDragEnter(item.channel)"
@dragleave.prevent="onBrandLogoDragLeave(item.channel, $event)"
@drop.prevent="onBrandLogoDrop(item.channel, $event)"
>
<template v-if="item.url">
<img
class="brand-logo-card__img"
:src="item.url"
:alt="item.title"
draggable="false"
/>
<div v-if="item.uploading" class="brand-logo-card__mask is-busy">
<a-spin />
<span>{{ t('system.otherConfig.brandLogo.uploading') }}</span>
</a-tab-pane>
<a-tab-pane key="images" :title="t('system.otherConfig.brandLogo.tab.images')">
<div class="brand-logo-grid">
<div
v-for="item in brandLogoCards"
:key="item.channel"
class="brand-logo-card"
>
<div class="brand-logo-card__meta">
<div class="brand-logo-card__meta-text">
<span class="brand-logo-card__title">{{ item.title }}</span>
<span class="brand-logo-card__size">{{ item.sizeHint }}</span>
</div>
<a-button
v-if="item.url"
class="brand-logo-card__clear"
size="mini"
:loading="item.uploading"
@click.stop="handleBrandLogoClear(item.channel)"
>
{{ t('system.otherConfig.brandLogo.clear') }}
</a-button>
</div>
<div
class="brand-logo-card__zone"
:class="{
'is-filled': !!item.url,
'is-uploading': item.uploading,
'is-dragover': brandLogoDragOver[item.channel],
}"
@click="openBrandLogoPicker(item.channel)"
@dragenter.prevent="onBrandLogoDragEnter(item.channel)"
@dragover.prevent="onBrandLogoDragEnter(item.channel)"
@dragleave.prevent="onBrandLogoDragLeave(item.channel, $event)"
@drop.prevent="onBrandLogoDrop(item.channel, $event)"
>
<template v-if="item.url">
<img
class="brand-logo-card__img"
:src="item.url"
:alt="item.title"
draggable="false"
/>
<div v-if="item.uploading" class="brand-logo-card__mask is-busy">
<a-spin />
<span>{{ t('system.otherConfig.brandLogo.uploading') }}</span>
</div>
<div v-else class="brand-logo-card__mask">
{{ t('system.otherConfig.brandLogo.dropReplace') }}
</div>
</template>
<template v-else-if="item.uploading">
<a-spin />
<span class="brand-logo-card__hint">
{{ t('system.otherConfig.brandLogo.uploading') }}
</span>
</template>
<template v-else>
<span class="brand-logo-card__mark">LOGO</span>
<span class="brand-logo-card__hint">
{{ t('system.otherConfig.brandLogo.dropUpload') }}
</span>
</template>
<input
class="brand-logo-card__file"
type="file"
:data-channel="item.channel"
accept="image/png,image/jpeg,image/jpg,image/webp,image/gif,image/bmp"
:disabled="item.uploading"
@click.stop
@change="onBrandLogoFileChange(item.channel, $event)"
/>
</div>
</div>
<div v-else class="brand-logo-card__mask">
{{ t('system.otherConfig.brandLogo.dropReplace') }}
</div>
</template>
<template v-else-if="item.uploading">
<a-spin />
<span class="brand-logo-card__hint">
{{ t('system.otherConfig.brandLogo.uploading') }}
</span>
</template>
<template v-else>
<span class="brand-logo-card__mark">LOGO</span>
<span class="brand-logo-card__hint">
{{ t('system.otherConfig.brandLogo.dropUpload') }}
</span>
</template>
<input
class="brand-logo-card__file"
type="file"
:data-channel="item.channel"
accept="image/png,image/jpeg,image/jpg,image/webp,image/gif,image/bmp"
:disabled="item.uploading"
@click.stop
@change="onBrandLogoFileChange(item.channel, $event)"
/>
</div>
</div>
</div>
</a-tab-pane>
</a-tabs>
</div>
</a-modal>
</div>
@ -847,10 +947,12 @@ import {
deleteSystemOtherConfig,
clearBrandLogo,
clearPaymentReceiveQr,
getBrandCopy,
getBrandLogo,
getPaymentReceiveQr,
getSystemOtherConfigDetail,
getSystemOtherConfigList,
saveBrandCopy,
updateSystemOtherConfig,
uploadBrandLogo,
uploadPaymentReceiveQr,
@ -862,7 +964,12 @@ import {
brandLogoImages,
clearCachedBrandImage,
rememberBrandImageFile,
refreshBrandImages,
} from '@/utils/brandLogo'
import {
DEFAULT_BRAND_COPY,
rememberBrandCopy,
} from '@/utils/brandCopy'
import {
formatWechatTrialResultText,
getOrderNotifySystemSmtp,
@ -873,6 +980,7 @@ import {
type OrderNotifySystemSmtpStatus,
type WechatOrderNotifyTemplateDto,
} from '@/api/system/wechatOrderNotify'
import { streamFileBlob } from '@/api/fileStorage'
import { resolveOmsAssetUrl } from '@/api/oms/common'
import { prodApiOrigin } from '@/utils/rewriteBrowserApiPath'
@ -1382,6 +1490,7 @@ async function openPaymentQrModal() {
}
const brandLogoVisible = ref(false)
const brandLogoTab = ref<'copy' | 'images'>('copy')
const brandLogoLoading = ref(false)
const brandLogoUrls = reactive({
portal: '',
@ -1407,34 +1516,92 @@ const brandLogoLocalPreview = reactive<Record<BrandLogoChannel, string>>({
favicon: '',
mascot: '',
})
const brandCopySaving = ref(false)
const brandCopyForm = reactive({
navName: DEFAULT_BRAND_COPY.navName,
navFullName: DEFAULT_BRAND_COPY.navFullName,
aiWelcomeTitleZh: DEFAULT_BRAND_COPY.aiWelcomeTitleZh,
aiWelcomeTitleShortZh: DEFAULT_BRAND_COPY.aiWelcomeTitleShortZh,
aiWelcomeTitleEn: DEFAULT_BRAND_COPY.aiWelcomeTitleEn,
aiWelcomeTitleShortEn: DEFAULT_BRAND_COPY.aiWelcomeTitleShortEn,
})
function applyBrandCopyDto(data?: Record<string, any> | null) {
const next = rememberBrandCopy(data)
brandCopyForm.navName = next.navName
brandCopyForm.navFullName = next.navFullName
brandCopyForm.aiWelcomeTitleZh = next.aiWelcomeTitleZh
brandCopyForm.aiWelcomeTitleShortZh = next.aiWelcomeTitleShortZh
brandCopyForm.aiWelcomeTitleEn = next.aiWelcomeTitleEn
brandCopyForm.aiWelcomeTitleShortEn = next.aiWelcomeTitleShortEn
}
async function loadBrandCopy() {
try {
const data = await getBrandCopy()
applyBrandCopyDto(data as Record<string, any>)
} catch {
applyBrandCopyDto(DEFAULT_BRAND_COPY)
}
}
async function handleBrandCopySave() {
brandCopySaving.value = true
try {
const data = await saveBrandCopy({
navName: brandCopyForm.navName,
navFullName: brandCopyForm.navFullName,
aiWelcomeTitleZh: brandCopyForm.aiWelcomeTitleZh,
aiWelcomeTitleShortZh: brandCopyForm.aiWelcomeTitleShortZh,
aiWelcomeTitleEn: brandCopyForm.aiWelcomeTitleEn,
aiWelcomeTitleShortEn: brandCopyForm.aiWelcomeTitleShortEn,
})
applyBrandCopyDto(data as Record<string, any>)
Message.success(t('system.otherConfig.brandLogo.copy.saveSuccess'))
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.brandLogo.copy.saveFailed'))
} finally {
brandCopySaving.value = false
}
}
function pickBrandLogoCardUrl(channel: BrandLogoChannel) {
// 优先本地上传预览 / 已落地 data URL,避免线上直连 cos.* 证书 CN 不匹配
return (
brandLogoLocalPreview[channel] ||
brandLogoImages[channel] ||
brandLogoUrls[channel] ||
''
)
}
const brandLogoCards = computed(() => [
{
channel: 'portal' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.portal'),
sizeHint: t('system.otherConfig.brandLogo.size.portal'),
url: brandLogoLocalPreview.portal || brandLogoUrls.portal,
url: pickBrandLogoCardUrl('portal'),
uploading: brandLogoUploading.portal,
},
{
channel: 'site' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.site'),
sizeHint: t('system.otherConfig.brandLogo.size.site'),
url: brandLogoLocalPreview.site || brandLogoUrls.site,
url: pickBrandLogoCardUrl('site'),
uploading: brandLogoUploading.site,
},
{
channel: 'favicon' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.favicon'),
sizeHint: t('system.otherConfig.brandLogo.size.favicon'),
url: brandLogoLocalPreview.favicon || brandLogoUrls.favicon,
url: pickBrandLogoCardUrl('favicon'),
uploading: brandLogoUploading.favicon,
},
{
channel: 'mascot' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.mascot'),
sizeHint: t('system.otherConfig.brandLogo.size.mascot'),
url: brandLogoLocalPreview.mascot || brandLogoUrls.mascot,
url: pickBrandLogoCardUrl('mascot'),
uploading: brandLogoUploading.mascot,
},
])
@ -1444,11 +1611,14 @@ function pickBrandLogoUrl(data: Record<string, any> | null | undefined, camel: s
return typeof raw === 'string' ? raw : ''
}
/** 已签名 COS/OSS URL 勿再追加缓存戳,否则验签失败图片空白 */
/** 同源 file URL 已带 v=;COS 签名 URL 勿再追加缓存戳 */
function resolveBrandLogoDisplayUrl(raw?: string | null) {
const url = resolveOmsAssetUrl(raw)
if (!url) return ''
if (/[?&](q-sign-algorithm|x-oss-signature|Signature)=/i.test(url)) {
if (
/[?&](q-sign-algorithm|x-oss-signature|Signature|v)=/i.test(url) ||
/\/system\/other-config\/(brand-logo|payment-qr)\/file\b/i.test(url)
) {
return url
}
return `${url}${url.includes('?') ? '&' : '?'}_t=${Date.now()}`
@ -1471,11 +1641,44 @@ function applyBrandLogoDto(data?: {
brandLogoUrls.mascot = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'mascotUrl', 'MascotUrl'))
}
function isCosBrandAssetUrl(url: string): boolean {
try {
const host = new URL(url).hostname.toLowerCase()
return host.startsWith('cos.') || host.includes('myqcloud.com')
} catch {
return false
}
}
/** 线上 cos 自定义域证书异常时,经 stream 落成本地 blob 预览,避免 <img> 直连报错 */
async function hydrateBrandLogoSafePreviews() {
const channels: BrandLogoChannel[] = ['portal', 'site', 'favicon', 'mascot']
await Promise.all(
channels.map(async (channel) => {
if (brandLogoLocalPreview[channel]?.startsWith('blob:')) return
if (brandLogoImages[channel]?.startsWith('data:')) return
const remote = brandLogoUrls[channel]
if (!remote || !isCosBrandAssetUrl(remote)) return
try {
const blob = await streamFileBlob(remote)
if (!blob.type.startsWith('image/') && blob.size <= 0) return
const prev = brandLogoLocalPreview[channel]
if (prev.startsWith('blob:')) URL.revokeObjectURL(prev)
brandLogoLocalPreview[channel] = URL.createObjectURL(blob)
} catch {
/* 保留远程地址;全局 refreshBrandImages 仍会尝试 data URL */
}
}),
)
}
async function loadBrandLogo() {
brandLogoLoading.value = true
try {
const data = await getBrandLogo()
applyBrandLogoDto(data)
const [logoData] = await Promise.all([getBrandLogo(), loadBrandCopy()])
applyBrandLogoDto(logoData)
void refreshBrandImages()
await hydrateBrandLogoSafePreviews()
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.brandLogo.loadFailed'))
} finally {
@ -1484,6 +1687,7 @@ async function loadBrandLogo() {
}
async function openBrandLogoModal() {
brandLogoTab.value = 'copy'
brandLogoVisible.value = true
await loadBrandLogo()
}
@ -2378,20 +2582,86 @@ onMounted(() => {
min-height: 220px;
}
.brand-logo-editor {
display: flex;
flex-direction: column;
min-height: 0;
}
.brand-config-tabs {
:deep(.arco-tabs-nav) {
margin-bottom: 12px;
}
:deep(.arco-tabs-content) {
padding-top: 0;
}
:deep(.arco-tabs-content-item) {
padding: 0;
}
}
.brand-copy-pane {
display: flex;
flex-direction: column;
gap: 12px;
}
.brand-copy-block {
padding: 12px;
border: 1px solid var(--color-border-2);
border-radius: 8px;
background: var(--color-fill-1, #f7f8fa);
}
.brand-copy-block__head {
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 10px;
strong {
font-size: 13px;
font-weight: 600;
color: var(--color-text-1);
}
span {
font-size: 12px;
color: var(--color-text-3);
}
}
.brand-copy-item {
margin-bottom: 10px;
:deep(.arco-form-item-label-col > label) {
font-size: 12px;
}
}
.brand-copy-actions {
display: flex;
justify-content: flex-end;
padding-top: 4px;
}
.brand-logo-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
gap: 12px;
}
.brand-logo-card {
display: flex;
flex-direction: column;
gap: 12px;
gap: 8px;
min-width: 0;
padding: 16px;
padding: 12px;
border: 1px solid var(--color-border-2);
border-radius: 10px;
border-radius: 8px;
background: #fff;
}
@ -2452,10 +2722,10 @@ onMounted(() => {
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
gap: 6px;
width: 100%;
min-height: 148px;
padding: 16px;
min-height: 112px;
padding: 12px;
border: 1px dashed var(--color-border-3, #c9cdd4);
border-radius: 8px;
background: var(--color-fill-1, #f7f8fa);
@ -2978,6 +3248,13 @@ onMounted(() => {
padding-bottom: 16px;
}
:deep(.brand-config-modal .arco-modal-body) {
padding-top: 12px;
padding-bottom: 16px;
max-height: min(72vh, 640px);
overflow: auto;
}
@media (max-width: 720px) {
.wechat-notify-layout {
grid-template-columns: 1fr;

View File

@ -0,0 +1,977 @@
<template>
<div class="user-invoice-container">
<div class="user-invoice-page-card">
<div class="table-toolbar">
<div class="toolbar-left">
<a-space wrap :size="12">
<a-input
v-model="keyword"
allow-clear
:placeholder="t('finance.invoiceManage.search.keywordPlaceholder')"
style="width: 200px"
@press-enter="handleSearch"
/>
<a-select
v-model="statusFilter"
:placeholder="t('finance.invoiceManage.search.statusPlaceholder')"
allow-clear
style="width: 150px"
>
<a-option value="all">{{ t('finance.invoiceManage.search.statusAll') }}</a-option>
<a-option v-for="item in statusOptions" :key="item.value" :value="item.value">
{{ item.label }}
</a-option>
</a-select>
<a-button class="app-btn-search" @click="handleSearch">
{{ t('finance.invoiceManage.search.actions.search') }}
</a-button>
<a-button @click="handleReset">
{{ t('finance.invoiceManage.search.actions.reset') }}
</a-button>
<a-button @click="openProfiles">
{{ t('finance.invoiceManage.search.actions.profiles') }}
</a-button>
<a-button class="app-btn-primary-soft" @click="openCreate">
{{ t('finance.invoiceManage.search.actions.apply') }}
</a-button>
</a-space>
</div>
<div class="toolbar-right">
<PaginationPro
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
</div>
</div>
<a-spin class="list-spin" :loading="listLoading">
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
:columns="hotColumns"
:data="tableRows"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:show-action-column="true"
:action-renderer="actionRenderer"
:custom-cell-renderer="customCellRenderer"
:stretch-columns="true"
:height="handsontableHeight"
@action-click="handleActionClick"
/>
</div>
</a-spin>
</div>
<a-drawer
:visible="applyVisible"
:title="applyTitle"
:width="720"
unmount-on-close
:ok-loading="applySaving"
:ok-text="t('finance.invoiceManage.drawer.submit')"
@before-ok="handleApplySave"
@cancel="applyVisible = false"
>
<a-form :model="applyForm" layout="vertical">
<a-form-item :label="t('finance.invoiceManage.drawer.profile')">
<a-select
v-model="applyForm.profileId"
allow-clear
:placeholder="t('finance.invoiceManage.drawer.profilePlaceholder')"
:loading="profileLoading"
@change="onProfileChange"
>
<a-option v-for="p in profiles" :key="p.id" :value="p.id">
{{ p.titleName }}{{ p.isDefault ? ` (${t('finance.invoiceManage.profile.default')})` : '' }}
</a-option>
</a-select>
</a-form-item>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item :label="t('finance.invoiceManage.drawer.titleName')" required>
<a-input v-model="applyForm.titleName" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="t('finance.invoiceManage.drawer.taxNo')" required>
<a-input v-model="applyForm.taxNo" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item :label="t('finance.invoiceManage.drawer.addressPhone')">
<a-input v-model="applyForm.addressPhone" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="t('finance.invoiceManage.drawer.bankNameAccount')">
<a-input v-model="applyForm.bankNameAccount" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="8">
<a-form-item :label="t('finance.invoiceManage.drawer.invoiceType')">
<a-select v-model="applyForm.invoiceType">
<a-option :value="INVOICE_TYPE.Normal">
{{ t('finance.invoiceManage.type.normal') }}
</a-option>
<a-option :value="INVOICE_TYPE.Special">
{{ t('finance.invoiceManage.type.special') }}
</a-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item :label="t('finance.invoiceManage.drawer.medium')">
<a-select v-model="applyForm.medium">
<a-option :value="INVOICE_MEDIUM.Electronic">
{{ t('finance.invoiceManage.medium.electronic') }}
</a-option>
<a-option :value="INVOICE_MEDIUM.Paper">
{{ t('finance.invoiceManage.medium.paper') }}
</a-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item :label="t('finance.invoiceManage.drawer.taxRate')">
<a-input-number
v-model="applyForm.taxRate"
:min="0"
:max="1"
:step="0.01"
:precision="2"
hide-button
style="width: 100%"
/>
</a-form-item>
</a-col>
</a-row>
<a-form-item :label="t('finance.invoiceManage.drawer.remark')">
<a-textarea v-model="applyForm.remark" :auto-size="{ minRows: 2, maxRows: 4 }" />
</a-form-item>
</a-form>
<div class="selectable-toolbar">
<span class="selectable-title">{{ t('finance.invoiceManage.drawer.selectable') }}</span>
<a-input
v-model="selectableKeyword"
allow-clear
size="small"
:placeholder="t('finance.invoiceManage.drawer.selectableKeyword')"
style="width: 180px"
@press-enter="reloadSelectable"
/>
<a-button size="small" class="app-btn-search" @click="reloadSelectable">
{{ t('finance.invoiceManage.search.actions.search') }}
</a-button>
</div>
<a-spin :loading="selectableLoading">
<div v-if="!selectableItems.length" class="selectable-empty">
{{ t('finance.invoiceManage.selectable.empty') }}
</div>
<label
v-for="item in selectableItems"
:key="invoiceLineKey(item.sourceType, item.sourceId)"
class="selectable-row"
:class="{ 'is-on': isLineSelected(item) }"
>
<a-checkbox
:model-value="isLineSelected(item)"
@change="(checked) => toggleSelectable(item, !!checked)"
/>
<div class="selectable-row__main">
<div class="selectable-row__top">
<strong>{{ item.sourceNo }}</strong>
<span>{{ item.sourceTypeName }}</span>
</div>
<div class="selectable-row__meta">
{{ t('finance.invoiceManage.selectable.remaining') }} ¥{{ formatMoney(item.remainingAmount) }}
</div>
</div>
<a-input-number
v-if="isLineSelected(item)"
:model-value="selectedAmountOf(item)"
:min="0.01"
:max="item.remainingAmount"
:precision="2"
hide-button
size="small"
style="width: 110px"
@change="(val) => setLineAmount(item, Number(val))"
/>
</label>
</a-spin>
<div class="selected-sum">
{{ t('finance.invoiceManage.drawer.selectedAmount') }}
<strong>¥{{ formatMoney(selectedTotal) }}</strong>
</div>
</a-drawer>
<a-drawer
:visible="detailVisible"
:title="t('finance.invoiceManage.drawer.detail')"
:width="560"
:footer="false"
unmount-on-close
@cancel="detailVisible = false"
>
<a-spin :loading="detailLoading">
<template v-if="detail">
<a-descriptions :column="1" bordered size="small">
<a-descriptions-item :label="t('finance.invoiceManage.table.applyNo')">
{{ detail.applyNo }}
</a-descriptions-item>
<a-descriptions-item :label="t('finance.invoiceManage.table.status')">
{{ detail.statusName || detail.status }}
</a-descriptions-item>
<a-descriptions-item :label="t('finance.invoiceManage.drawer.titleName')">
{{ detail.titleName }}
</a-descriptions-item>
<a-descriptions-item :label="t('finance.invoiceManage.table.amountTotal')">
¥{{ formatMoney(detail.amountTotal) }}
</a-descriptions-item>
<a-descriptions-item :label="t('finance.invoiceManage.table.invoiceNumber')">
{{ detail.invoiceNumber || '--' }}
</a-descriptions-item>
</a-descriptions>
<h4 class="detail-lines-title">{{ t('finance.invoiceManage.detail.lines') }}</h4>
<a-table :data="detail.lines || []" :pagination="false" size="small" row-key="id">
<a-table-column :title="t('finance.invoiceManage.selectable.sourceNo')" data-index="sourceNo" />
<a-table-column :title="t('finance.invoiceManage.selectable.sourceType')" data-index="sourceTypeName" />
<a-table-column :title="t('finance.invoiceManage.selectable.amount')" data-index="amount">
<template #cell="{ record }">¥{{ formatMoney(record.amount) }}</template>
</a-table-column>
</a-table>
</template>
</a-spin>
</a-drawer>
<a-modal
v-model:visible="profileVisible"
:title="t('finance.invoiceManage.profile.title')"
:footer="false"
width="640px"
unmount-on-close
>
<div class="profile-toolbar">
<a-button class="app-btn-primary-soft" @click="openProfileForm()">
{{ t('finance.invoiceManage.profile.add') }}
</a-button>
</div>
<a-spin :loading="profileLoading">
<div v-if="!profiles.length" class="selectable-empty">
{{ t('finance.invoiceManage.profile.empty') }}
</div>
<div v-for="p in profiles" :key="p.id" class="profile-card">
<div>
<strong>{{ p.titleName }}</strong>
<span v-if="p.isDefault" class="profile-default">
{{ t('finance.invoiceManage.profile.default') }}
</span>
<p>{{ p.taxNo }}</p>
</div>
<a-space>
<a-button size="small" @click="openProfileForm(p)">
{{ t('common.edit') }}
</a-button>
<a-button
v-if="!p.isDefault"
size="small"
@click="setDefaultProfile(p)"
>
{{ t('finance.invoiceManage.profile.setDefault') }}
</a-button>
<a-button size="small" status="danger" @click="removeProfile(p)">
{{ t('common.delete') }}
</a-button>
</a-space>
</div>
</a-spin>
</a-modal>
<a-modal
v-model:visible="profileFormVisible"
:title="profileForm.id
? t('finance.invoiceManage.profile.edit')
: t('finance.invoiceManage.profile.add')"
:ok-loading="profileSaving"
@before-ok="saveProfileForm"
@cancel="profileFormVisible = false"
>
<a-form :model="profileForm" layout="vertical">
<a-form-item :label="t('finance.invoiceManage.profile.titleName')" required>
<a-input v-model="profileForm.titleName" />
</a-form-item>
<a-form-item :label="t('finance.invoiceManage.profile.taxNo')" required>
<a-input v-model="profileForm.taxNo" />
</a-form-item>
<a-form-item :label="t('finance.invoiceManage.profile.addressPhone')">
<a-input v-model="profileForm.addressPhone" />
</a-form-item>
<a-form-item :label="t('finance.invoiceManage.profile.bankNameAccount')">
<a-input v-model="profileForm.bankNameAccount" />
</a-form-item>
<a-form-item>
<a-checkbox v-model="profileForm.isDefault">
{{ t('finance.invoiceManage.profile.isDefault') }}
</a-checkbox>
</a-form-item>
<a-form-item :label="t('finance.invoiceManage.profile.remark')">
<a-textarea v-model="profileForm.remark" :auto-size="{ minRows: 2, maxRows: 4 }" />
</a-form-item>
</a-form>
</a-modal>
</div>
</template>
<script lang="ts" setup>
import { computed, onMounted, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { Message, Modal } from '@arco-design/web-vue'
import dayjs from 'dayjs'
import HandsontablePro from '@/components/HandsontablePro/index.vue'
import PaginationPro from '@/components/PaginationPro/index.vue'
import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
import { renderWarehouseActionBtn, wrapWarehouseActions } from '@/utils/warehouseActionRenderer'
import { buildStatusTagHtml } from '@/utils/statusTag'
import {
DEFAULT_INVOICE_TAX_RATE,
INVOICE_MEDIUM,
INVOICE_STATUS,
INVOICE_TYPE,
createInvoiceApply,
deleteInvoiceProfile,
getInvoiceApplyDetail,
getInvoiceApplyList,
getInvoiceProfileList,
getInvoiceSelectable,
invoiceLineKey,
mergeSelectableWithApplyLines,
roundInvoiceMoney,
saveInvoiceProfile,
submitInvoiceApply,
updateInvoiceApply,
type InvoiceApply,
type InvoiceApplyLine,
type InvoiceProfile,
type InvoiceSelectableItem,
} from '@/api/finance/invoice'
defineOptions({ name: 'UserInvoice' })
const { t } = useI18n()
const { tableContainerRef, tableHeight } = useTableContainerHeight()
const handsontableHeight = computed(() => Math.max(tableHeight.value || 0, 400))
const keyword = ref('')
const statusFilter = ref('all')
const currentPage = ref(1)
const pageSize = ref(50)
const totalCount = ref(0)
const listLoading = ref(false)
const tableRows = ref<InvoiceApply[]>([])
const applyVisible = ref(false)
const applySaving = ref(false)
const isEditApply = ref(false)
const editApplyId = ref(0)
const profileLoading = ref(false)
const profiles = ref<InvoiceProfile[]>([])
const selectableLoading = ref(false)
const selectableItems = ref<InvoiceSelectableItem[]>([])
const selectableKeyword = ref('')
const selectedLines = ref<Record<string, InvoiceApplyLine>>({})
const editLinesSnapshot = ref<InvoiceApplyLine[]>([])
const applyForm = reactive({
profileId: undefined as number | undefined,
titleName: '',
taxNo: '',
addressPhone: '',
bankNameAccount: '',
invoiceType: INVOICE_TYPE.Normal,
medium: INVOICE_MEDIUM.Electronic,
taxRate: DEFAULT_INVOICE_TAX_RATE,
remark: '',
})
const applyTitle = computed(() =>
isEditApply.value
? t('finance.invoiceManage.drawer.edit')
: t('finance.invoiceManage.drawer.create'),
)
const selectedTotal = computed(() =>
roundInvoiceMoney(
Object.values(selectedLines.value).reduce((sum, line) => sum + Number(line.amount || 0), 0),
),
)
const detailVisible = ref(false)
const detailLoading = ref(false)
const detail = ref<InvoiceApply | null>(null)
const profileVisible = ref(false)
const profileFormVisible = ref(false)
const profileSaving = ref(false)
const profileForm = reactive({
id: 0,
titleName: '',
taxNo: '',
addressPhone: '',
bankNameAccount: '',
isDefault: false,
remark: '',
})
const statusOptions = computed(() => [
{ value: INVOICE_STATUS.Draft, label: t('finance.invoiceManage.status.draft') },
{ value: INVOICE_STATUS.PendingApproval, label: t('finance.invoiceManage.status.pendingApproval') },
{ value: INVOICE_STATUS.Approved, label: t('finance.invoiceManage.status.approved') },
{ value: INVOICE_STATUS.Issued, label: t('finance.invoiceManage.status.issued') },
{ value: INVOICE_STATUS.Rejected, label: t('finance.invoiceManage.status.rejected') },
{ value: INVOICE_STATUS.Voided, label: t('finance.invoiceManage.status.voided') },
{ value: INVOICE_STATUS.RedFlushed, label: t('finance.invoiceManage.status.redFlushed') },
])
function formatMoney(value?: number) {
return (Number(value) || 0).toFixed(2)
}
async function loadList() {
listLoading.value = true
try {
const { items, total } = await getInvoiceApplyList({
page: currentPage.value,
pageSize: pageSize.value,
keyword: keyword.value.trim() || undefined,
status: statusFilter.value !== 'all' ? statusFilter.value : undefined,
})
tableRows.value = items
totalCount.value = total
} catch (e: any) {
Message.error(e?.message || t('finance.invoiceManage.message.loadError'))
tableRows.value = []
totalCount.value = 0
} finally {
listLoading.value = false
}
}
function handleSearch() {
currentPage.value = 1
loadList()
}
function handleReset() {
keyword.value = ''
statusFilter.value = 'all'
currentPage.value = 1
loadList()
}
function handlePageChange(page: number) {
currentPage.value = page
loadList()
}
function handlePageSizeChange(size: number) {
pageSize.value = size
currentPage.value = 1
loadList()
}
const hotColumns = computed(() => [
{ key: 'applyNo', label: t('finance.invoiceManage.table.applyNo'), width: 160 },
{ key: 'invoiceTypeName', label: t('finance.invoiceManage.table.invoiceType'), width: 110 },
{ key: 'mediumName', label: t('finance.invoiceManage.table.medium'), width: 90 },
{ key: 'titleName', label: t('finance.invoiceManage.table.titleName'), width: 180 },
{ key: 'amountTotal', label: t('finance.invoiceManage.table.amountTotal'), width: 110 },
{ key: 'statusName', label: t('finance.invoiceManage.table.status'), width: 120 },
{ key: 'invoiceNumber', label: t('finance.invoiceManage.table.invoiceNumber'), width: 140 },
{ key: 'createTime', label: t('finance.invoiceManage.table.createTime'), width: 170 },
])
function statusTone(status: string) {
if (status === INVOICE_STATUS.Draft) return 'neutral'
if (status === INVOICE_STATUS.PendingApproval) return 'wait'
if (status === INVOICE_STATUS.Approved) return 'brand'
if (status === INVOICE_STATUS.Issued) return 'ok'
if (status === INVOICE_STATUS.Rejected) return 'alert'
return 'mute'
}
function customCellRenderer(_row: number, col: number, _value: any, rowData: InvoiceApply): string | null {
const dataColIndex = col - 2
if (dataColIndex < 0 || dataColIndex >= hotColumns.value.length) return null
const colKey = hotColumns.value[dataColIndex].key
if (colKey === 'amountTotal') {
return rowData?.amountTotal != null ? `¥${formatMoney(rowData.amountTotal)}` : '--'
}
if (colKey === 'statusName') {
return buildStatusTagHtml(rowData?.statusName || rowData?.status || '--', statusTone(rowData?.status))
}
if (colKey === 'createTime') {
return rowData?.createTime ? dayjs(rowData.createTime).format('YYYY-MM-DD HH:mm:ss') : '--'
}
return null
}
function actionRenderer(row: InvoiceApply): string {
const parts = [renderWarehouseActionBtn('detail', t('finance.invoiceManage.actions.detail'), 'view')]
if (row.status === INVOICE_STATUS.Draft) {
parts.push(renderWarehouseActionBtn('submit', t('finance.invoiceManage.actions.submit'), 'publish'))
parts.push(renderWarehouseActionBtn('edit', t('finance.invoiceManage.actions.edit'), 'edit'))
}
return wrapWarehouseActions(parts)
}
async function handleActionClick(row: InvoiceApply, _rowIndex: number, action?: string) {
if (!row?.id) return
if (action === 'detail') {
openDetail(row.id)
return
}
if (action === 'edit') {
await openEdit(row.id)
return
}
if (action === 'submit') {
try {
const result = await submitInvoiceApply(row.id)
Message.success(result.message || t('finance.invoiceManage.message.submitSuccess'))
await loadList()
} catch (e: any) {
Message.error(e?.message || t('finance.invoiceManage.message.loadError'))
}
}
}
function resetApplyForm() {
applyForm.profileId = undefined
applyForm.titleName = ''
applyForm.taxNo = ''
applyForm.addressPhone = ''
applyForm.bankNameAccount = ''
applyForm.invoiceType = INVOICE_TYPE.Normal
applyForm.medium = INVOICE_MEDIUM.Electronic
applyForm.taxRate = DEFAULT_INVOICE_TAX_RATE
applyForm.remark = ''
selectableItems.value = []
selectableKeyword.value = ''
selectedLines.value = {}
editLinesSnapshot.value = []
}
async function openCreate() {
isEditApply.value = false
editApplyId.value = 0
resetApplyForm()
applyVisible.value = true
await Promise.all([loadProfiles(true), loadSelectable()])
}
async function openEdit(id: number) {
isEditApply.value = true
editApplyId.value = id
resetApplyForm()
applyVisible.value = true
try {
const data = await getInvoiceApplyDetail(id)
applyForm.titleName = data.titleName
applyForm.taxNo = data.taxNo
applyForm.addressPhone = data.addressPhone || ''
applyForm.bankNameAccount = data.bankNameAccount || ''
applyForm.invoiceType = data.invoiceType || INVOICE_TYPE.Normal
applyForm.medium = data.medium || INVOICE_MEDIUM.Electronic
applyForm.taxRate = data.taxRate ?? DEFAULT_INVOICE_TAX_RATE
applyForm.remark = data.remark || ''
editLinesSnapshot.value = data.lines || []
for (const line of editLinesSnapshot.value) {
selectedLines.value[invoiceLineKey(line.sourceType, line.sourceId)] = { ...line }
}
await Promise.all([loadProfiles(), loadSelectable()])
} catch (e: any) {
Message.error(e?.message || t('finance.invoiceManage.message.loadError'))
}
}
async function loadProfiles(selectDefault = false) {
profileLoading.value = true
try {
profiles.value = await getInvoiceProfileList()
if (selectDefault && !applyForm.profileId) {
const def = profiles.value.find((p) => p.isDefault) || profiles.value[0]
if (def) {
applyForm.profileId = def.id
onProfileChange(def.id)
}
}
} catch (e: any) {
Message.error(e?.message || t('finance.invoiceManage.message.loadError'))
} finally {
profileLoading.value = false
}
}
function onProfileChange(id?: number) {
const profile = profiles.value.find((p) => p.id === id)
if (!profile) return
applyForm.titleName = profile.titleName
applyForm.taxNo = profile.taxNo
applyForm.addressPhone = profile.addressPhone || ''
applyForm.bankNameAccount = profile.bankNameAccount || ''
}
async function loadSelectable() {
selectableLoading.value = true
try {
const { items } = await getInvoiceSelectable({
keyword: selectableKeyword.value,
page: 1,
pageSize: 100,
})
selectableItems.value = mergeSelectableWithApplyLines(items, editLinesSnapshot.value)
} catch (e: any) {
Message.error(e?.message || t('finance.invoiceManage.message.loadError'))
} finally {
selectableLoading.value = false
}
}
function reloadSelectable() {
loadSelectable()
}
function isLineSelected(item: InvoiceSelectableItem) {
return Boolean(selectedLines.value[invoiceLineKey(item.sourceType, item.sourceId)])
}
function selectedAmountOf(item: InvoiceSelectableItem) {
return selectedLines.value[invoiceLineKey(item.sourceType, item.sourceId)]?.amount ?? item.remainingAmount
}
function toggleSelectable(item: InvoiceSelectableItem, checked: boolean) {
const key = invoiceLineKey(item.sourceType, item.sourceId)
const next = { ...selectedLines.value }
if (checked) {
next[key] = {
sourceType: item.sourceType,
sourceTypeName: item.sourceTypeName,
sourceId: item.sourceId,
sourceNo: item.sourceNo,
amount: item.remainingAmount,
currency: item.currency,
}
} else {
delete next[key]
}
selectedLines.value = next
}
function setLineAmount(item: InvoiceSelectableItem, amount: number) {
const key = invoiceLineKey(item.sourceType, item.sourceId)
const current = selectedLines.value[key]
if (!current) return
selectedLines.value = {
...selectedLines.value,
[key]: { ...current, amount: roundInvoiceMoney(amount) },
}
}
async function handleApplySave() {
if (!applyForm.titleName.trim() || !applyForm.taxNo.trim()) {
Message.warning(t('finance.invoiceManage.drawer.needTitle'))
return false
}
if (!Object.keys(selectedLines.value).length) {
Message.warning(t('finance.invoiceManage.drawer.needLines'))
return false
}
applySaving.value = true
try {
const payload = {
invoiceType: applyForm.invoiceType,
medium: applyForm.medium,
profileId: applyForm.profileId,
titleName: applyForm.titleName.trim(),
taxNo: applyForm.taxNo.trim(),
addressPhone: applyForm.addressPhone.trim() || undefined,
bankNameAccount: applyForm.bankNameAccount.trim() || undefined,
taxRate: applyForm.taxRate,
remark: applyForm.remark.trim() || undefined,
submit: true,
lines: Object.values(selectedLines.value).map((line) => ({
sourceType: line.sourceType,
sourceId: line.sourceId,
amount: roundInvoiceMoney(line.amount),
})),
}
const result = isEditApply.value
? await updateInvoiceApply({ ...payload, id: editApplyId.value })
: await createInvoiceApply(payload)
Message.success(result.message || t('finance.invoiceManage.message.submitSuccess'))
applyVisible.value = false
await loadList()
return true
} catch (e: any) {
Message.error(e?.message || t('finance.invoiceManage.message.loadError'))
return false
} finally {
applySaving.value = false
}
}
async function openDetail(id: number) {
detailVisible.value = true
detailLoading.value = true
try {
detail.value = await getInvoiceApplyDetail(id)
} catch (e: any) {
Message.error(e?.message || t('finance.invoiceManage.message.loadError'))
detail.value = null
} finally {
detailLoading.value = false
}
}
async function openProfiles() {
profileVisible.value = true
await loadProfiles()
}
function openProfileForm(row?: InvoiceProfile) {
profileForm.id = row?.id || 0
profileForm.titleName = row?.titleName || ''
profileForm.taxNo = row?.taxNo || ''
profileForm.addressPhone = row?.addressPhone || ''
profileForm.bankNameAccount = row?.bankNameAccount || ''
profileForm.isDefault = Boolean(row?.isDefault)
profileForm.remark = row?.remark || ''
profileFormVisible.value = true
}
async function saveProfileForm() {
if (!profileForm.titleName.trim() || !profileForm.taxNo.trim()) {
Message.warning(t('finance.invoiceManage.drawer.needTitle'))
return false
}
profileSaving.value = true
try {
await saveInvoiceProfile({
id: profileForm.id || undefined,
titleName: profileForm.titleName.trim(),
taxNo: profileForm.taxNo.trim(),
addressPhone: profileForm.addressPhone.trim() || undefined,
bankNameAccount: profileForm.bankNameAccount.trim() || undefined,
isDefault: profileForm.isDefault,
remark: profileForm.remark.trim() || undefined,
})
Message.success(t('finance.invoiceManage.message.profileSaved'))
profileFormVisible.value = false
await loadProfiles()
return true
} catch (e: any) {
Message.error(e?.message || t('finance.invoiceManage.message.loadError'))
return false
} finally {
profileSaving.value = false
}
}
async function setDefaultProfile(row: InvoiceProfile) {
try {
await saveInvoiceProfile({
id: row.id,
titleName: row.titleName,
taxNo: row.taxNo,
addressPhone: row.addressPhone,
bankNameAccount: row.bankNameAccount,
isDefault: true,
remark: row.remark,
})
Message.success(t('finance.invoiceManage.message.profileSaved'))
await loadProfiles()
} catch (e: any) {
Message.error(e?.message || t('finance.invoiceManage.message.loadError'))
}
}
function removeProfile(row: InvoiceProfile) {
Modal.confirm({
title: t('finance.invoiceManage.profile.deleteConfirm'),
onOk: async () => {
await deleteInvoiceProfile(row.id)
Message.success(t('finance.invoiceManage.message.profileDeleted'))
await loadProfiles()
},
})
}
onMounted(() => {
loadList()
})
</script>
<style lang="less" scoped>
.user-invoice-container {
width: 100%;
box-sizing: border-box;
padding: 16px 16px 24px;
display: flex;
flex-direction: column;
background: var(--app-page-bg);
flex: 1;
min-height: 0;
overflow: hidden;
}
.user-invoice-page-card {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
background: var(--app-card-bg);
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
overflow: hidden;
}
.table-toolbar {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 16px 16px 0;
margin-bottom: 16px;
flex-shrink: 0;
flex-wrap: wrap;
gap: 12px;
.toolbar-left {
flex: 1;
min-width: 0;
}
.toolbar-right {
flex-shrink: 0;
}
}
.list-spin {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
padding: 0 16px 16px;
}
.list-spin :deep(.arco-spin-container) {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.list-wrap {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.selectable-toolbar {
display: flex;
align-items: center;
gap: 8px;
margin: 8px 0 12px;
}
.selectable-title {
font-weight: 600;
}
.selectable-empty {
padding: 16px;
text-align: center;
color: var(--color-text-3);
}
.selectable-row {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 10px;
border-radius: 6px;
background: #f7f8fa;
margin-bottom: 8px;
&.is-on {
background: color-mix(in srgb, var(--app-primary-color) 8%, #fff);
}
}
.selectable-row__main {
flex: 1;
min-width: 0;
}
.selectable-row__top {
display: flex;
gap: 8px;
}
.selectable-row__meta {
font-size: 12px;
color: var(--color-text-3);
}
.selected-sum {
margin-top: 12px;
text-align: right;
strong {
margin-left: 6px;
color: var(--app-primary-color);
}
}
.detail-lines-title {
margin: 16px 0 8px;
font-size: 14px;
}
.profile-toolbar {
margin-bottom: 12px;
}
.profile-card {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
padding: 12px;
border-radius: 8px;
background: #f7f8fa;
margin-bottom: 8px;
p {
margin: 4px 0 0;
color: var(--color-text-3);
font-size: 12px;
}
}
.profile-default {
margin-left: 8px;
font-size: 12px;
color: var(--app-primary-color);
}
</style>