diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index 7fd1b8b..66da8b1 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -4,6 +4,7 @@ "Component": true, "ComponentPublicInstance": true, "ComputedRef": true, + "CountryRegionAddressFields": true, "DirectiveBinding": true, "EdiAdvisorAudience": true, "EdiAdvisorOpenOptions": true, @@ -194,6 +195,7 @@ "useConfirmDialog": true, "useContentHeight": true, "useCounter": true, + "useCountryRegionSelects": true, "useCssModule": true, "useCssVar": true, "useCssVars": true, @@ -272,6 +274,7 @@ "useOperationScanFeedback": true, "useOperationScanFocus": true, "useOperationVoiceBroadcast": true, + "useOpsScanNumberType": true, "usePageLeave": true, "useParallax": true, "usePermission": true, diff --git a/index.html b/index.html index b03def7..8e14db4 100644 --- a/index.html +++ b/index.html @@ -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" /> BCD I Faster & Simpler + diff --git a/package.json b/package.json index 49ebd27..8f784ea 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,10 @@ "dev": "vite", "dev:test": "vite --mode ideship-test", "dev:nanafa": "vite --mode nanafa", - "build": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=1 node --max-old-space-size=4096 node_modules/vite/bin/vite.js build", - "build:prod": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=1 node --max-old-space-size=4096 node_modules/vite/bin/vite.js build --mode production", - "build:test": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=1 node --max-old-space-size=4096 node_modules/vite/bin/vite.js build --mode ideship-test", - "build:nanafa": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=1 node --max-old-space-size=4096 node_modules/vite/bin/vite.js build --mode nanafa", + "build": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=1 node --max-old-space-size=8192 node_modules/vite/bin/vite.js build", + "build:prod": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=1 node --max-old-space-size=8192 node_modules/vite/bin/vite.js build --mode production", + "build:test": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=1 node --max-old-space-size=8192 node_modules/vite/bin/vite.js build --mode ideship-test", + "build:nanafa": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=1 node --max-old-space-size=8192 node_modules/vite/bin/vite.js build --mode nanafa", "postbuild": "node scripts/postbuild-cleanup-dist.js", "report": "cross-env REPORT=true pnpm run build", "preview": "npm run build && vite preview --host", diff --git a/src/api/customer/wechatNotify.ts b/src/api/customer/wechatNotify.ts index fee7a10..55172aa 100644 --- a/src/api/customer/wechatNotify.ts +++ b/src/api/customer/wechatNotify.ts @@ -5,29 +5,46 @@ export interface CustomerWechatNotifyPrefItem { eventCode: string eventName: string opsEnabled: boolean + opsEmailEnabled: boolean isSubscribed: boolean + isEmailSubscribed: boolean } export interface CustomerWechatNotifyStatus { hasOpenId: boolean + hasEmail: boolean hasFollowUrl: boolean items: CustomerWechatNotifyPrefItem[] } +function mapPrefItem(raw: any): CustomerWechatNotifyPrefItem { + return { + eventCode: String(raw?.eventCode ?? raw?.EventCode ?? ''), + eventName: String(raw?.eventName ?? raw?.EventName ?? ''), + opsEnabled: !!(raw?.opsEnabled ?? raw?.OpsEnabled), + opsEmailEnabled: !!(raw?.opsEmailEnabled ?? raw?.OpsEmailEnabled), + isSubscribed: !!(raw?.isSubscribed ?? raw?.IsSubscribed), + isEmailSubscribed: !!(raw?.isEmailSubscribed ?? raw?.IsEmailSubscribed), + } +} + export async function getCustomerWechatNotifyStatus() { const res = await axiosInstance.get(omsUrl('/customer/wechat-notify/status')) - const data = unwrapData( - res.data - ) + const data = unwrapData(res.data) return { - hasOpenId: !!(data?.hasOpenId ?? (data as any)?.HasOpenId), - hasFollowUrl: !!(data?.hasFollowUrl ?? (data as any)?.HasFollowUrl), - items: data?.items ?? data?.Items ?? [], + hasOpenId: !!(data?.hasOpenId ?? data?.HasOpenId), + hasEmail: !!(data?.hasEmail ?? data?.HasEmail), + hasFollowUrl: !!(data?.hasFollowUrl ?? data?.HasFollowUrl), + items: (data?.items ?? data?.Items ?? []).map(mapPrefItem), } satisfies CustomerWechatNotifyStatus } export async function saveCustomerWechatNotifyPrefs( - items: { eventCode: string; isSubscribed: boolean }[] + items: { + eventCode: string + isSubscribed: boolean + isEmailSubscribed: boolean + }[] ) { const res = await axiosInstance.post(omsUrl('/customer/wechat-notify/prefs'), { items }) assertBusinessOk(res.data) diff --git a/src/api/finance/contract.ts b/src/api/finance/contract.ts new file mode 100644 index 0000000..890ff58 --- /dev/null +++ b/src/api/finance/contract.ts @@ -0,0 +1,204 @@ +import { axiosInstance } from '@/api/rbac' +import { assertBusinessOk, omsUrl, parseListPayload, unwrapData } from '@/api/oms/common' + +export const CONTRACT_PARTY_TYPE = { + Customer: 'customer', + Supplier: 'supplier', + Agent: 'agent', +} as const + +export const CONTRACT_STATUS = { + Draft: 'draft', + Active: 'active', + Expired: 'expired', + Terminated: 'terminated', +} as const + +export const SETTLEMENT_METHOD = { + Prepaid: 'prepaid', + Ticket: 'ticket', + Monthly: 'monthly', + Biweekly: 'biweekly', +} as const + +export interface FinanceContract { + id: number + contractNo: string + contractName: string + partyType: string + partyTypeName?: string + partyId: number + partyCode?: string + partyName?: string + ourEntityName?: string + signDate?: string + effectiveDate: string + expireDate?: string + autoRenew: boolean + settlementMethod: string + settlementMethodName?: string + paymentTermDays: number + billingDay?: number | null + paymentDay?: number | null + currency: string + creditLimit?: number | null + commissionBaseType?: string + commissionRate?: number | null + requireVendorInvoice: boolean + ownerUserId?: number | null + ownerName?: string + status: string + statusName?: string + attachmentUrls?: string + attachmentCount: number + remark?: string + renewedFromId?: number | null + terminatedTime?: string + terminateReason?: string + expiringSoon: boolean + createTime?: string + updateTime?: string +} + +export interface FinanceContractListParams { + page?: number + pageSize?: number + partyType?: string + partyId?: number + status?: string + keyword?: string + signStartTime?: string + signEndTime?: string +} + +export interface FinanceContractSavePayload { + id?: number + contractName: string + partyType: string + partyId: number + ourEntityName?: string + signDate?: string + effectiveDate: string + expireDate?: string + autoRenew?: boolean + settlementMethod: string + paymentTermDays?: number + billingDay?: number | null + paymentDay?: number | null + currency?: string + creditLimit?: number | null + commissionBaseType?: string + commissionRate?: number | null + requireVendorInvoice?: boolean + ownerUserId?: number | null + ownerName?: string + attachmentUrls?: string + remark?: string + activate?: boolean +} + +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 { + if (value === undefined || value === null || value === '') return null + const n = Number(value) + return Number.isFinite(n) ? n : null +} + +export function mapFinanceContract(item: any): FinanceContract { + return { + id: toNumber(pickRaw(item, 'id', 'Id')), + contractNo: String(pickRaw(item, 'contractNo', 'ContractNo') ?? ''), + contractName: String(pickRaw(item, 'contractName', 'ContractName') ?? ''), + partyType: String(pickRaw(item, 'partyType', 'PartyType') ?? ''), + partyTypeName: pickRaw(item, 'partyTypeName', 'PartyTypeName') || undefined, + partyId: toNumber(pickRaw(item, 'partyId', 'PartyId')), + partyCode: pickRaw(item, 'partyCode', 'PartyCode') || undefined, + partyName: pickRaw(item, 'partyName', 'PartyName') || undefined, + ourEntityName: pickRaw(item, 'ourEntityName', 'OurEntityName') || undefined, + signDate: pickRaw(item, 'signDate', 'SignDate') || undefined, + effectiveDate: String(pickRaw(item, 'effectiveDate', 'EffectiveDate') ?? ''), + expireDate: pickRaw(item, 'expireDate', 'ExpireDate') || undefined, + autoRenew: Boolean(pickRaw(item, 'autoRenew', 'AutoRenew')), + settlementMethod: String(pickRaw(item, 'settlementMethod', 'SettlementMethod') ?? ''), + settlementMethodName: pickRaw(item, 'settlementMethodName', 'SettlementMethodName') || undefined, + paymentTermDays: toNumber(pickRaw(item, 'paymentTermDays', 'PaymentTermDays'), 30), + billingDay: toOptionalNumber(pickRaw(item, 'billingDay', 'BillingDay')), + paymentDay: toOptionalNumber(pickRaw(item, 'paymentDay', 'PaymentDay')), + currency: String(pickRaw(item, 'currency', 'Currency') ?? 'CNY'), + creditLimit: toOptionalNumber(pickRaw(item, 'creditLimit', 'CreditLimit')), + commissionBaseType: pickRaw(item, 'commissionBaseType', 'CommissionBaseType') || undefined, + commissionRate: toOptionalNumber(pickRaw(item, 'commissionRate', 'CommissionRate')), + requireVendorInvoice: Boolean(pickRaw(item, 'requireVendorInvoice', 'RequireVendorInvoice')), + ownerUserId: toOptionalNumber(pickRaw(item, 'ownerUserId', 'OwnerUserId')), + ownerName: pickRaw(item, 'ownerName', 'OwnerName') || undefined, + status: String(pickRaw(item, 'status', 'Status') ?? ''), + statusName: pickRaw(item, 'statusName', 'StatusName') || undefined, + attachmentUrls: pickRaw(item, 'attachmentUrls', 'AttachmentUrls') || undefined, + attachmentCount: toNumber(pickRaw(item, 'attachmentCount', 'AttachmentCount')), + remark: pickRaw(item, 'remark', 'Remark') || undefined, + renewedFromId: toOptionalNumber(pickRaw(item, 'renewedFromId', 'RenewedFromId')), + terminatedTime: pickRaw(item, 'terminatedTime', 'TerminatedTime') || undefined, + terminateReason: pickRaw(item, 'terminateReason', 'TerminateReason') || undefined, + expiringSoon: Boolean(pickRaw(item, 'expiringSoon', 'ExpiringSoon')), + createTime: pickRaw(item, 'createTime', 'CreateTime') || undefined, + updateTime: pickRaw(item, 'updateTime', 'UpdateTime') || undefined, + } +} + +export async function getFinanceContractList(params?: FinanceContractListParams) { + const res = await axiosInstance.get(omsUrl('/finance/contract/list'), { params }) + const { items, total } = parseListPayload(res.data) + return { items: items.map(mapFinanceContract), total } +} + +export async function getFinanceContractDetail(id: number) { + const res = await axiosInstance.get(omsUrl('/finance/contract/detail'), { params: { id } }) + assertBusinessOk(res.data) + return mapFinanceContract(unwrapData(res.data) ?? res.data?.data ?? res.data) +} + +export async function getActiveFinanceContractByParty(partyType: string, partyId: number) { + const res = await axiosInstance.get(omsUrl('/finance/contract/active-by-party'), { + params: { partyType, partyId }, + }) + assertBusinessOk(res.data) + const raw = unwrapData(res.data) ?? res.data?.data ?? res.data?.Data + if (!raw || (typeof raw === 'object' && !pickRaw(raw, 'id', 'Id'))) return null + return mapFinanceContract(raw) +} + +export async function saveFinanceContract(payload: FinanceContractSavePayload) { + const res = await axiosInstance.post(omsUrl('/finance/contract/save'), payload) + assertBusinessOk(res.data) + return mapFinanceContract(unwrapData(res.data) ?? res.data?.data ?? res.data) +} + +export async function activateFinanceContract(id: number) { + const res = await axiosInstance.post(omsUrl('/finance/contract/activate'), { id }) + assertBusinessOk(res.data) + return mapFinanceContract(unwrapData(res.data) ?? res.data?.data ?? res.data) +} + +export async function renewFinanceContract(id: number) { + const res = await axiosInstance.post(omsUrl('/finance/contract/renew'), { id }) + assertBusinessOk(res.data) + return mapFinanceContract(unwrapData(res.data) ?? res.data?.data ?? res.data) +} + +export async function terminateFinanceContract(id: number, reason?: string) { + const res = await axiosInstance.post(omsUrl('/finance/contract/terminate'), { id, reason }) + assertBusinessOk(res.data) + return mapFinanceContract(unwrapData(res.data) ?? res.data?.data ?? res.data) +} diff --git a/src/api/finance/invoice.ts b/src/api/finance/invoice.ts new file mode 100644 index 0000000..f7f3154 --- /dev/null +++ b/src/api/finance/invoice.ts @@ -0,0 +1,454 @@ +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 + customerCode?: string + customerName?: string + 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 + +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')), + customerCode: pickRaw(item, 'customerCode', 'CustomerCode') || undefined, + customerName: pickRaw(item, 'customerName', 'CustomerName') || 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, + 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() + 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(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(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(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) +} diff --git a/src/api/finance/master.ts b/src/api/finance/master.ts new file mode 100644 index 0000000..d7d8f77 --- /dev/null +++ b/src/api/finance/master.ts @@ -0,0 +1,165 @@ +import { axiosInstance } from '@/api/rbac' +import { assertBusinessOk, omsUrl, parseListPayload, unwrapData } from '@/api/oms/common' + +export interface FinanceSupplier { + id: number + supplierCode: string + supplierName: string + contactName?: string + phone?: string + email?: string + bankAccountName?: string + bankName?: string + bankAccountNo?: string + currency: string + status: number + remark?: string + createTime?: string + updateTime?: string +} + +export interface FinanceSupplierSavePayload { + id?: number + supplierCode: string + supplierName: string + contactName?: string + phone?: string + email?: string + bankAccountName?: string + bankName?: string + bankAccountNo?: string + currency?: string + status?: number + remark?: string +} + +export interface FinanceCompanyAccount { + id: number + accountName: string + bankName: string + accountNo: string + currency: string + isDefault: boolean + status: number + remark?: string + createTime?: string + updateTime?: string +} + +export interface FinanceCompanyAccountSavePayload { + id?: number + accountName: string + bankName: string + accountNo: string + currency?: string + isDefault?: boolean + status?: number + remark?: string +} + +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 +} + +export function mapFinanceSupplier(item: any): FinanceSupplier { + return { + id: toNumber(pickRaw(item, 'id', 'Id')), + supplierCode: String(pickRaw(item, 'supplierCode', 'SupplierCode') ?? ''), + supplierName: String(pickRaw(item, 'supplierName', 'SupplierName') ?? ''), + contactName: pickRaw(item, 'contactName', 'ContactName') || undefined, + phone: pickRaw(item, 'phone', 'Phone') || undefined, + email: pickRaw(item, 'email', 'Email') || undefined, + bankAccountName: pickRaw(item, 'bankAccountName', 'BankAccountName') || undefined, + bankName: pickRaw(item, 'bankName', 'BankName') || undefined, + bankAccountNo: pickRaw(item, 'bankAccountNo', 'BankAccountNo') || undefined, + currency: String(pickRaw(item, 'currency', 'Currency') ?? 'CNY'), + status: toNumber(pickRaw(item, 'status', 'Status'), 2), + remark: pickRaw(item, 'remark', 'Remark') || undefined, + createTime: pickRaw(item, 'createTime', 'CreateTime') || undefined, + updateTime: pickRaw(item, 'updateTime', 'UpdateTime') || undefined, + } +} + +export function mapFinanceCompanyAccount(item: any): FinanceCompanyAccount { + return { + id: toNumber(pickRaw(item, 'id', 'Id')), + accountName: String(pickRaw(item, 'accountName', 'AccountName') ?? ''), + bankName: String(pickRaw(item, 'bankName', 'BankName') ?? ''), + accountNo: String(pickRaw(item, 'accountNo', 'AccountNo') ?? ''), + currency: String(pickRaw(item, 'currency', 'Currency') ?? 'CNY'), + isDefault: Boolean(pickRaw(item, 'isDefault', 'IsDefault')), + status: toNumber(pickRaw(item, 'status', 'Status'), 2), + remark: pickRaw(item, 'remark', 'Remark') || undefined, + createTime: pickRaw(item, 'createTime', 'CreateTime') || undefined, + updateTime: pickRaw(item, 'updateTime', 'UpdateTime') || undefined, + } +} + +export async function getFinanceSupplierList(params?: { + keyword?: string + status?: number + page?: number + pageSize?: number +}) { + const res = await axiosInstance.get(omsUrl('/finance/supplier/list'), { params }) + const { items, total } = parseListPayload(res.data) + return { items: items.map(mapFinanceSupplier), total } +} + +export async function getFinanceSupplierOptions(keyword?: string) { + const res = await axiosInstance.get(omsUrl('/finance/supplier/options'), { + params: { keyword }, + }) + assertBusinessOk(res.data) + const raw = unwrapData(res.data) ?? res.data?.data ?? res.data?.Data ?? [] + return (Array.isArray(raw) ? raw : []).map(mapFinanceSupplier) +} + +export async function saveFinanceSupplier(payload: FinanceSupplierSavePayload) { + const res = await axiosInstance.post(omsUrl('/finance/supplier/save'), payload) + assertBusinessOk(res.data) + return mapFinanceSupplier(unwrapData(res.data) ?? res.data?.data ?? res.data) +} + +export async function deleteFinanceSupplier(id: number) { + const res = await axiosInstance.post(omsUrl('/finance/supplier/delete'), { id }) + assertBusinessOk(res.data) +} + +export async function getFinanceCompanyAccountList(params?: { + keyword?: string + status?: number + page?: number + pageSize?: number +}) { + const res = await axiosInstance.get(omsUrl('/finance/company-account/list'), { params }) + const { items, total } = parseListPayload(res.data) + return { items: items.map(mapFinanceCompanyAccount), total } +} + +export async function getFinanceCompanyAccountOptions() { + const res = await axiosInstance.get(omsUrl('/finance/company-account/options')) + assertBusinessOk(res.data) + const raw = unwrapData(res.data) ?? res.data?.data ?? res.data?.Data ?? [] + return (Array.isArray(raw) ? raw : []).map(mapFinanceCompanyAccount) +} + +export async function saveFinanceCompanyAccount(payload: FinanceCompanyAccountSavePayload) { + const res = await axiosInstance.post(omsUrl('/finance/company-account/save'), payload) + assertBusinessOk(res.data) + return mapFinanceCompanyAccount(unwrapData(res.data) ?? res.data?.data ?? res.data) +} + +export async function deleteFinanceCompanyAccount(id: number) { + const res = await axiosInstance.post(omsUrl('/finance/company-account/delete'), { id }) + assertBusinessOk(res.data) +} diff --git a/src/api/finance/paymentApply.ts b/src/api/finance/paymentApply.ts new file mode 100644 index 0000000..5d6bb7a --- /dev/null +++ b/src/api/finance/paymentApply.ts @@ -0,0 +1,234 @@ +import { axiosInstance } from '@/api/rbac' +import { assertBusinessOk, omsUrl, parseListPayload, unwrapData } from '@/api/oms/common' + +export const PAYMENT_TYPE = { + Supplier: 'supplier', + AgentCommission: 'agentCommission', + CustomerRefund: 'customerRefund', + Other: 'other', +} as const + +export const PAYMENT_STATUS = { + Draft: 'draft', + PendingApproval: 'pendingApproval', + PendingPay: 'pendingPay', + Paid: 'paid', + Rejected: 'rejected', +} as const + +export interface FinancePaymentApplyLine { + id?: number + description: string + amount: number + refNo?: string + remark?: string +} + +export interface FinancePaymentApply { + id: number + applyNo: string + paymentType: string + paymentTypeName?: string + payeeType: string + payeeTypeName?: string + payeeId: number + payeeCode?: string + payeeName?: string + contractId?: number | null + contractNo?: string + currency: string + amountTotal: number + expectPayDate?: string + payeeAccountName?: string + payeeBankName?: string + payeeAccountNo?: string + companyAccountId?: number | null + companyAccountName?: string + status: string + statusName?: string + applicantName?: string + attachmentUrls?: string + remark?: string + approvalInstanceId?: number | null + approvalInstanceNo?: string + approvalPending: boolean + rejectReason?: string + paidTime?: string + bankTxnNo?: string + paidBy?: string + paidVoucherUrl?: string + createTime?: string + updateTime?: string + decision?: string + message?: string + lines?: FinancePaymentApplyLine[] +} + +export interface FinancePaymentApplyListParams { + page?: number + pageSize?: number + status?: string + paymentType?: string + payeeType?: string + payeeId?: number + currency?: string + keyword?: string + startTime?: string + endTime?: string +} + +export interface FinancePaymentApplySavePayload { + id?: number + paymentType: string + payeeId: number + contractId?: number | null + currency?: string + expectPayDate?: string + payeeAccountName?: string + payeeBankName?: string + payeeAccountNo?: string + companyAccountId?: number | null + attachmentUrls?: string + remark?: string + submit?: boolean + lines: FinancePaymentApplyLine[] +} + +export interface FinancePaymentSummaryItem { + currency: string + pendingApprovalAmount: number + pendingPayAmount: number + paidThisMonthAmount: number +} + +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 { + if (value === undefined || value === null || value === '') return null + const n = Number(value) + return Number.isFinite(n) && n > 0 ? n : null +} + +export function roundPaymentMoney(value: number) { + return Math.round((Number(value) || 0) * 100) / 100 +} + +export function mapFinancePaymentLine(item: any): FinancePaymentApplyLine { + return { + id: toOptionalNumber(pickRaw(item, 'id', 'Id')) ?? undefined, + description: String(pickRaw(item, 'description', 'Description') ?? ''), + amount: toNumber(pickRaw(item, 'amount', 'Amount')), + refNo: pickRaw(item, 'refNo', 'RefNo') || undefined, + remark: pickRaw(item, 'remark', 'Remark') || undefined, + } +} + +export function mapFinancePaymentApply(item: any): FinancePaymentApply { + const linesRaw = pickRaw(item, 'lines', 'Lines') + return { + id: toNumber(pickRaw(item, 'id', 'Id')), + applyNo: String(pickRaw(item, 'applyNo', 'ApplyNo') ?? ''), + paymentType: String(pickRaw(item, 'paymentType', 'PaymentType') ?? ''), + paymentTypeName: pickRaw(item, 'paymentTypeName', 'PaymentTypeName') || undefined, + payeeType: String(pickRaw(item, 'payeeType', 'PayeeType') ?? ''), + payeeTypeName: pickRaw(item, 'payeeTypeName', 'PayeeTypeName') || undefined, + payeeId: toNumber(pickRaw(item, 'payeeId', 'PayeeId')), + payeeCode: pickRaw(item, 'payeeCode', 'PayeeCode') || undefined, + payeeName: pickRaw(item, 'payeeName', 'PayeeName') || undefined, + contractId: toOptionalNumber(pickRaw(item, 'contractId', 'ContractId')), + contractNo: pickRaw(item, 'contractNo', 'ContractNo') || undefined, + currency: String(pickRaw(item, 'currency', 'Currency') ?? 'CNY'), + amountTotal: toNumber(pickRaw(item, 'amountTotal', 'AmountTotal')), + expectPayDate: pickRaw(item, 'expectPayDate', 'ExpectPayDate') || undefined, + payeeAccountName: pickRaw(item, 'payeeAccountName', 'PayeeAccountName') || undefined, + payeeBankName: pickRaw(item, 'payeeBankName', 'PayeeBankName') || undefined, + payeeAccountNo: pickRaw(item, 'payeeAccountNo', 'PayeeAccountNo') || undefined, + companyAccountId: toOptionalNumber(pickRaw(item, 'companyAccountId', 'CompanyAccountId')), + companyAccountName: pickRaw(item, 'companyAccountName', 'CompanyAccountName') || undefined, + status: String(pickRaw(item, 'status', 'Status') ?? ''), + statusName: pickRaw(item, 'statusName', 'StatusName') || undefined, + applicantName: pickRaw(item, 'applicantName', 'ApplicantName') || undefined, + attachmentUrls: pickRaw(item, 'attachmentUrls', 'AttachmentUrls') || undefined, + remark: pickRaw(item, 'remark', 'Remark') || undefined, + approvalInstanceId: toOptionalNumber(pickRaw(item, 'approvalInstanceId', 'ApprovalInstanceId')), + approvalInstanceNo: pickRaw(item, 'approvalInstanceNo', 'ApprovalInstanceNo') || undefined, + approvalPending: Boolean(pickRaw(item, 'approvalPending', 'ApprovalPending')), + rejectReason: pickRaw(item, 'rejectReason', 'RejectReason') || undefined, + paidTime: pickRaw(item, 'paidTime', 'PaidTime') || undefined, + bankTxnNo: pickRaw(item, 'bankTxnNo', 'BankTxnNo') || undefined, + paidBy: pickRaw(item, 'paidBy', 'PaidBy') || undefined, + paidVoucherUrl: pickRaw(item, 'paidVoucherUrl', 'PaidVoucherUrl') || 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(mapFinancePaymentLine) : undefined, + } +} + +export async function getFinancePaymentApplyList(params?: FinancePaymentApplyListParams) { + const res = await axiosInstance.get(omsUrl('/finance/payment-apply/list'), { params }) + const { items, total } = parseListPayload(res.data) + return { items: items.map(mapFinancePaymentApply), total } +} + +export async function getFinancePaymentApplySummary() { + const res = await axiosInstance.get(omsUrl('/finance/payment-apply/summary')) + assertBusinessOk(res.data) + const raw = unwrapData(res.data) ?? res.data?.data ?? res.data + const itemsRaw = pickRaw(raw, 'items', 'Items') ?? [] + const items: FinancePaymentSummaryItem[] = (Array.isArray(itemsRaw) ? itemsRaw : []).map((item: any) => ({ + currency: String(pickRaw(item, 'currency', 'Currency') ?? 'CNY'), + pendingApprovalAmount: toNumber(pickRaw(item, 'pendingApprovalAmount', 'PendingApprovalAmount')), + pendingPayAmount: toNumber(pickRaw(item, 'pendingPayAmount', 'PendingPayAmount')), + paidThisMonthAmount: toNumber(pickRaw(item, 'paidThisMonthAmount', 'PaidThisMonthAmount')), + })) + return { items } +} + +export async function getFinancePaymentApplyDetail(id: number) { + const res = await axiosInstance.get(omsUrl('/finance/payment-apply/detail'), { params: { id } }) + assertBusinessOk(res.data) + return mapFinancePaymentApply(unwrapData(res.data) ?? res.data?.data ?? res.data) +} + +export async function saveFinancePaymentApply(payload: FinancePaymentApplySavePayload) { + const res = await axiosInstance.post(omsUrl('/finance/payment-apply/save'), payload) + assertBusinessOk(res.data) + return mapFinancePaymentApply(unwrapData(res.data) ?? res.data?.data ?? res.data) +} + +export async function submitFinancePaymentApply(id: number) { + const res = await axiosInstance.post(omsUrl('/finance/payment-apply/submit'), { id }) + assertBusinessOk(res.data) + return mapFinancePaymentApply(unwrapData(res.data) ?? res.data?.data ?? res.data) +} + +export async function withdrawFinancePaymentApply(id: number) { + const res = await axiosInstance.post(omsUrl('/finance/payment-apply/withdraw'), { id }) + assertBusinessOk(res.data) + return mapFinancePaymentApply(unwrapData(res.data) ?? res.data?.data ?? res.data) +} + +export async function markFinancePaymentPaid(payload: { + id: number + paidTime?: string + bankTxnNo?: string + paidVoucherUrl?: string + remark?: string +}) { + const res = await axiosInstance.post(omsUrl('/finance/payment-apply/mark-paid'), payload) + assertBusinessOk(res.data) + return mapFinancePaymentApply(unwrapData(res.data) ?? res.data?.data ?? res.data) +} diff --git a/src/api/order/index.ts b/src/api/order/index.ts index 05da310..b2ddf32 100644 --- a/src/api/order/index.ts +++ b/src/api/order/index.ts @@ -1429,6 +1429,65 @@ export async function getOrderOperationLogList( return { items } } +export interface OrderNotifyLogItem { + id: number + orderId: number + channel: string + channelName: string + eventCode: string + eventName: string + recipient?: string | null + templateRef?: string | null + subject?: string | null + status: string + providerMsgId?: string | null + errCode?: number | null + errMsg?: string | null + smtpUsername?: string | null + summary: string + payloadJson?: string | null + createTime?: string +} + +export interface OrderNotifyLogListResult { + items: OrderNotifyLogItem[] +} + +function mapNotifyLogItem(raw: any): OrderNotifyLogItem { + return { + id: Number(raw?.id ?? raw?.Id ?? 0), + orderId: Number(raw?.orderId ?? raw?.OrderId ?? 0), + channel: String(raw?.channel ?? raw?.Channel ?? ''), + channelName: String(raw?.channelName ?? raw?.ChannelName ?? ''), + eventCode: String(raw?.eventCode ?? raw?.EventCode ?? ''), + eventName: String(raw?.eventName ?? raw?.EventName ?? ''), + recipient: raw?.recipient ?? raw?.Recipient ?? null, + templateRef: raw?.templateRef ?? raw?.TemplateRef ?? null, + subject: raw?.subject ?? raw?.Subject ?? null, + status: String(raw?.status ?? raw?.Status ?? ''), + providerMsgId: raw?.providerMsgId ?? raw?.ProviderMsgId ?? null, + errCode: raw?.errCode ?? raw?.ErrCode ?? null, + errMsg: raw?.errMsg ?? raw?.ErrMsg ?? null, + smtpUsername: raw?.smtpUsername ?? raw?.SmtpUsername ?? null, + summary: String(raw?.summary ?? raw?.Summary ?? ''), + payloadJson: raw?.payloadJson ?? raw?.PayloadJson ?? null, + createTime: raw?.createTime ?? raw?.CreateTime, + } +} + +/** GET /order/notify-log/list */ +export async function getOrderNotifyLogList( + orderId: number | string, +): Promise { + const res = await axiosInstance.get(orderUrl('/order/notify-log/list'), { + params: { orderId: Number(orderId) }, + }) + const data = unwrapData(res.data) ?? {} + const itemsRaw = data?.items ?? data?.Items ?? [] + const items = Array.isArray(itemsRaw) ? itemsRaw.map(mapNotifyLogItem) : [] + return { items } +} + /** GET /order/exception-events/list */ export async function getOrderExceptionEventList(orderId: number | string): Promise { const res = await axiosInstance.get(orderUrl('/order/exception-events/list'), { diff --git a/src/api/system/otherConfig.ts b/src/api/system/otherConfig.ts index 41b0c2e..1e42794 100644 --- a/src/api/system/otherConfig.ts +++ b/src/api/system/otherConfig.ts @@ -93,6 +93,29 @@ export interface BrandLogoDto { mascotUrl?: string } +export interface BrandCopyDto { + navName?: string + navFullName?: string + aiWelcomeTitleZh?: string + aiWelcomeTitleShortZh?: string + aiWelcomeTitleEn?: string + aiWelcomeTitleShortEn?: string + /** 工信部 ICP 备案号 */ + icp?: string +} + +/** 获取品牌文案(匿名可读;对象存储 JSON,非数据库) */ +export async function getBrandCopy() { + const res = await axiosInstance.get(omsUrl('/system/other-config/brand-copy')) + return unwrapData(res.data) +} + +/** 保存品牌文案到对象存储 */ +export async function saveBrandCopy(body: BrandCopyDto) { + const res = await axiosInstance.post(omsUrl('/system/other-config/brand-copy/save'), body) + return unwrapData(res.data) +} + /** 获取品牌 Logo(系统顶栏 / 官网 / 标签 / 吉祥物)可访问地址 */ export async function getBrandLogo() { const res = await axiosInstance.get(omsUrl('/system/other-config/brand-logo')) diff --git a/src/api/system/wechatOrderNotify.ts b/src/api/system/wechatOrderNotify.ts index 2c24eda..2cadefd 100644 --- a/src/api/system/wechatOrderNotify.ts +++ b/src/api/system/wechatOrderNotify.ts @@ -9,6 +9,11 @@ export interface WechatOrderNotifyTemplateDto { urlTemplate?: string | null fieldMappingJson?: string | null isEnabled?: boolean + emailEnabled?: boolean + emailTemplateName?: string | null + emailTemplateOwnerUserId?: number | null + emailSmtpOwnerUserId?: number | null + emailUseSystemSmtp?: boolean remark?: string | null } @@ -18,29 +23,224 @@ export interface SaveWechatOrderNotifyTemplateBody { urlTemplate?: string | null fieldMappingJson?: string | null isEnabled: boolean + emailEnabled: boolean + emailTemplateName?: string | null + emailUseSystemSmtp?: boolean remark?: string | null } +export interface OrderNotifySystemSmtpStatus { + configured: boolean + smtpUsername?: string | null + fromName?: string | null +} + +export interface TrialOrderNotifyEmailResult { + success: boolean + skipped: boolean + status: string + message?: string | null + toEmail?: string | null + templateName?: string | null + subject?: string | null + body?: string | null + smtpUsername?: string | null +} + +export interface TrialWechatOrderNotifyResult { + success: boolean + skipped: boolean + status: string + message?: string | null + orderId: number + serviceNo?: string | null + eventCode: string + eventName?: string | null + openId?: string | null + templateId?: string | null + url?: string | null + requestUrl?: string | null + requestBody?: string | null + responseBody?: string | null + wxMsgId?: string | null + errCode?: number | null + email?: TrialOrderNotifyEmailResult | null +} + +function mapEmailResult(raw: any): TrialOrderNotifyEmailResult | null { + if (raw == null) return null + return { + success: !!(raw.success ?? raw.Success), + skipped: !!(raw.skipped ?? raw.Skipped), + status: String(raw.status ?? raw.Status ?? ''), + message: raw.message ?? raw.Message ?? null, + toEmail: raw.toEmail ?? raw.ToEmail ?? null, + templateName: raw.templateName ?? raw.TemplateName ?? null, + subject: raw.subject ?? raw.Subject ?? null, + body: raw.body ?? raw.Body ?? null, + smtpUsername: raw.smtpUsername ?? raw.SmtpUsername ?? null, + } +} + +function mapTrialResult(raw: any): TrialWechatOrderNotifyResult { + return { + success: !!(raw?.success ?? raw?.Success), + skipped: !!(raw?.skipped ?? raw?.Skipped), + status: String(raw?.status ?? raw?.Status ?? ''), + message: raw?.message ?? raw?.Message ?? null, + orderId: Number(raw?.orderId ?? raw?.OrderId ?? 0), + serviceNo: raw?.serviceNo ?? raw?.ServiceNo ?? null, + eventCode: String(raw?.eventCode ?? raw?.EventCode ?? ''), + eventName: raw?.eventName ?? raw?.EventName ?? null, + openId: raw?.openId ?? raw?.OpenId ?? null, + templateId: raw?.templateId ?? raw?.TemplateId ?? null, + url: raw?.url ?? raw?.Url ?? null, + requestUrl: raw?.requestUrl ?? raw?.RequestUrl ?? null, + requestBody: raw?.requestBody ?? raw?.RequestBody ?? null, + responseBody: raw?.responseBody ?? raw?.ResponseBody ?? null, + wxMsgId: raw?.wxMsgId ?? raw?.WxMsgId ?? null, + errCode: raw?.errCode ?? raw?.ErrCode ?? null, + email: mapEmailResult(raw?.email ?? raw?.Email), + } +} + +function prettyJson(raw: string): string { + try { + return JSON.stringify(JSON.parse(raw), null, 2) + } catch { + return raw + } +} + +function formatEmailBlock(email: TrialOrderNotifyEmailResult): string { + const lines = [ + '【邮件试发】', + `状态:${email.status || '-'}`, + `成功:${email.success ? '是' : '否'}`, + ] + if (email.skipped) { + lines.push(`跳过:${email.message || '未知原因'}`) + return lines.join('\n') + } + if (email.message) lines.push(`说明:${email.message}`) + if (email.templateName) lines.push(`模板:${email.templateName}`) + if (email.smtpUsername) lines.push(`发件 SMTP:${email.smtpUsername}`) + if (email.toEmail) lines.push(`收件:${email.toEmail}`) + if (email.subject) { + lines.push('主题:') + lines.push(email.subject) + } + if (email.body) { + lines.push('正文:') + lines.push(email.body) + } + return lines.join('\n') +} + +/** 格式化试发结果(微信 + 邮件) */ +export function formatWechatTrialResultText(result: TrialWechatOrderNotifyResult): string { + const title = result.eventName + ? `${result.eventName}(${result.eventCode})` + : result.eventCode || '-' + const lines = [ + `【微信试发】${title}`, + `运单号:${result.serviceNo || '-'}`, + `订单 Id:${result.orderId || '-'}`, + `状态:${result.status || '-'}`, + `成功:${result.success ? '是' : '否'}`, + ] + if (result.skipped) { + lines.push(`跳过:${result.message || '未知原因'}`) + } else { + if (result.message) lines.push(`说明:${result.message}`) + if (result.openId) lines.push(`OpenId:${result.openId}`) + if (result.templateId) lines.push(`模板 ID:${result.templateId}`) + if (result.url) lines.push(`跳转 URL:${result.url}`) + if (result.wxMsgId) lines.push(`msgid:${result.wxMsgId}`) + if (result.errCode != null) lines.push(`errcode:${result.errCode}`) + if (result.requestUrl) lines.push(`请求:${result.requestUrl}`) + if (result.requestBody) { + lines.push('请求体:') + lines.push(prettyJson(result.requestBody)) + } + if (result.responseBody) { + lines.push('响应:') + lines.push(prettyJson(result.responseBody)) + } + } + + if (result.email) { + lines.push('') + lines.push(formatEmailBlock(result.email)) + } + + return lines.join('\n') +} + +function mapTemplate(raw: any): WechatOrderNotifyTemplateDto { + return { + id: raw?.id ?? raw?.Id, + eventCode: String(raw?.eventCode ?? raw?.EventCode ?? ''), + eventName: String(raw?.eventName ?? raw?.EventName ?? ''), + templateId: raw?.templateId ?? raw?.TemplateId ?? null, + urlTemplate: raw?.urlTemplate ?? raw?.UrlTemplate ?? null, + fieldMappingJson: raw?.fieldMappingJson ?? raw?.FieldMappingJson ?? null, + isEnabled: !!(raw?.isEnabled ?? raw?.IsEnabled), + emailEnabled: !!(raw?.emailEnabled ?? raw?.EmailEnabled), + emailTemplateName: raw?.emailTemplateName ?? raw?.EmailTemplateName ?? null, + emailTemplateOwnerUserId: + raw?.emailTemplateOwnerUserId ?? raw?.EmailTemplateOwnerUserId ?? null, + emailSmtpOwnerUserId: raw?.emailSmtpOwnerUserId ?? raw?.EmailSmtpOwnerUserId ?? null, + emailUseSystemSmtp: !!(raw?.emailUseSystemSmtp ?? raw?.EmailUseSystemSmtp), + remark: raw?.remark ?? raw?.Remark ?? null, + } +} + +function mapSystemSmtp(raw: any): OrderNotifySystemSmtpStatus { + return { + configured: !!(raw?.configured ?? raw?.Configured), + smtpUsername: raw?.smtpUsername ?? raw?.SmtpUsername ?? null, + fromName: raw?.fromName ?? raw?.FromName ?? null, + } +} + export async function getWechatOrderNotifyTemplates() { const res = await axiosInstance.get(omsUrl('/system/wechat-order-notify/templates')) const data = unwrapData<{ - items?: WechatOrderNotifyTemplateDto[] - Items?: WechatOrderNotifyTemplateDto[] - } | WechatOrderNotifyTemplateDto[]>(res.data) - if (Array.isArray(data)) return data - return data?.items ?? data?.Items ?? [] + items?: any[] + Items?: any[] + } | any[]>(res.data) + const list = Array.isArray(data) ? data : (data?.items ?? data?.Items ?? []) + return list.map(mapTemplate) } export async function saveWechatOrderNotifyTemplate(body: SaveWechatOrderNotifyTemplateBody) { const res = await axiosInstance.post(omsUrl('/system/wechat-order-notify/templates/save'), body) - return unwrapData(res.data) + return mapTemplate(unwrapData(res.data)) } export async function trialWechatOrderNotify(body: { eventCode: string orderId?: number serviceNo?: string -}) { +}): Promise { const res = await axiosInstance.post(omsUrl('/system/wechat-order-notify/trial-send'), body) assertBusinessOk(res.data) + return mapTrialResult(unwrapData(res.data)) +} + +export async function getOrderNotifySystemSmtp() { + const res = await axiosInstance.get(omsUrl('/system/wechat-order-notify/system-smtp')) + return mapSystemSmtp(unwrapData(res.data)) +} + +export async function saveOrderNotifySystemSmtp(body: { + smtpUsername: string + smtpPassword: string + serverType?: string + fromName?: string | null +}) { + const res = await axiosInstance.post(omsUrl('/system/wechat-order-notify/system-smtp/save'), body) + assertBusinessOk(res.data) + return mapSystemSmtp(unwrapData(res.data)) } diff --git a/src/assets/logo.png b/src/assets/logo.png deleted file mode 100644 index d47e19f..0000000 Binary files a/src/assets/logo.png and /dev/null differ diff --git a/src/assets/logo2.png b/src/assets/logo2.png deleted file mode 100644 index 3f851af..0000000 Binary files a/src/assets/logo2.png and /dev/null differ diff --git a/src/assets/wx-biubuy.png b/src/assets/wx-biubuy.png deleted file mode 100644 index f363c73..0000000 Binary files a/src/assets/wx-biubuy.png and /dev/null differ diff --git a/src/assets/zfb-biubuy.png b/src/assets/zfb-biubuy.png deleted file mode 100644 index 2fdc60d..0000000 Binary files a/src/assets/zfb-biubuy.png and /dev/null differ diff --git a/src/assets/企业微信客服二维码.png b/src/assets/企业微信客服二维码.png deleted file mode 100644 index 92be15f..0000000 Binary files a/src/assets/企业微信客服二维码.png and /dev/null differ diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts index e1a7f27..aa0e632 100644 --- a/src/auto-imports.d.ts +++ b/src/auto-imports.d.ts @@ -168,6 +168,7 @@ declare global { const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog'] const useContentHeight: typeof import('./composables/index')['useContentHeight'] const useCounter: typeof import('@vueuse/core')['useCounter'] + const useCountryRegionSelects: typeof import('./composables/useCountryRegionSelects')['useCountryRegionSelects'] const useCssModule: typeof import('vue')['useCssModule'] const useCssVar: typeof import('@vueuse/core')['useCssVar'] const useCssVars: typeof import('vue')['useCssVars'] @@ -246,6 +247,7 @@ declare global { const useOperationScanFeedback: typeof import('./composables/useOperationScanFeedback')['useOperationScanFeedback'] const useOperationScanFocus: typeof import('./composables/useOperationScanFocus')['useOperationScanFocus'] const useOperationVoiceBroadcast: typeof import('./composables/useOperationVoiceBroadcast')['useOperationVoiceBroadcast'] + const useOpsScanNumberType: typeof import('./composables/useOpsScanNumberType')['useOpsScanNumberType'] const usePageLeave: typeof import('@vueuse/core')['usePageLeave'] const useParallax: typeof import('@vueuse/core')['useParallax'] const usePermission: typeof import('@vueuse/core')['usePermission'] @@ -356,6 +358,9 @@ declare global { export type { WaybillSource, WaybillContext } from './composables/useAskAdvisor' import('./composables/useAskAdvisor') // @ts-ignore + export type { CountryRegionAddressFields } from './composables/useCountryRegionSelects' + import('./composables/useCountryRegionSelects') + // @ts-ignore export type { EdiAdvisorOpenOptions } from './composables/useEdiAdvisorPanel' import('./composables/useEdiAdvisorPanel') // @ts-ignore @@ -539,6 +544,7 @@ declare module 'vue' { readonly useConfirmDialog: UnwrapRef readonly useContentHeight: UnwrapRef readonly useCounter: UnwrapRef + readonly useCountryRegionSelects: UnwrapRef readonly useCssModule: UnwrapRef readonly useCssVar: UnwrapRef readonly useCssVars: UnwrapRef @@ -617,6 +623,7 @@ declare module 'vue' { readonly useOperationScanFeedback: UnwrapRef readonly useOperationScanFocus: UnwrapRef readonly useOperationVoiceBroadcast: UnwrapRef + readonly useOpsScanNumberType: UnwrapRef readonly usePageLeave: UnwrapRef readonly useParallax: UnwrapRef readonly usePermission: UnwrapRef diff --git a/src/components/EdiAssistant/AiAdvisorShell.vue b/src/components/EdiAssistant/AiAdvisorShell.vue index 4c9cd22..39b60b1 100644 --- a/src/components/EdiAssistant/AiAdvisorShell.vue +++ b/src/components/EdiAssistant/AiAdvisorShell.vue @@ -493,10 +493,10 @@ 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'; -import logoImg from '@/assets/logo2.png'; const props = withDefaults( defineProps<{ @@ -529,7 +529,6 @@ type QuickTagDef = { replyKey?: string; track?: boolean; human?: boolean; - iconSrc?: string; }; type ChatMessage = { role: 'user' | 'assistant'; content: string }; @@ -689,7 +688,6 @@ const quickTagDefs: QuickTagDef[] = [ icon: IconUser, labelKey: 'ediAssistant.quickHuman', human: true, - iconSrc: logoImg, }, ]; @@ -697,7 +695,6 @@ const quickTags = computed(() => quickTagDefs.map((tag) => ({ id: tag.id, icon: tag.icon, - iconSrc: tag.iconSrc, label: t(tag.labelKey), })), ); @@ -1171,7 +1168,7 @@ function ensureWelcomeMessage() { role: 'assistant', content: isOpsAudience.value ? t('ediAssistant.ops.welcomeMsg') - : t('ediAssistant.welcomeMsg'), + : t('ediAssistant.welcomeMsg', { name: brandCopy.navName }), }); saveThreads(); } @@ -1286,7 +1283,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'); } diff --git a/src/components/agent-side-rail/index.vue b/src/components/agent-side-rail/index.vue index c4ef298..c6dff85 100644 --- a/src/components/agent-side-rail/index.vue +++ b/src/components/agent-side-rail/index.vue @@ -17,15 +17,15 @@ - + @@ -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 @@ -266,8 +267,9 @@ onUnmounted(() => { .agent-side-rail { --asr-pad-x: 14px; --asr-item-h: 44px; - --asr-radius: 10px; - --asr-panel-radius: 4px; + /* 与工作台 banner / panel 卡片圆角一致 */ + --asr-radius: 16px; + --asr-panel-radius: 16px; --asr-panel-inset: 16px; --asr-shell-width: 200px; --asr-ease: cubic-bezier(0.32, 0.72, 0, 1); @@ -322,10 +324,10 @@ onUnmounted(() => { display: flex; align-items: center; justify-content: center; - gap: 10px; + gap: 0; flex-shrink: 0; - min-height: 56px; - padding: 10px 16px; + min-height: 40px; + padding: 2px 16px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.06)); @@ -333,25 +335,14 @@ onUnmounted(() => { &__brand-logo { display: block; - width: 32px; - height: 32px; + width: 40px; + height: 40px; flex-shrink: 0; object-fit: contain; } - &__brand-name { - min-width: 0; - font-size: 15px; - font-weight: 700; - line-height: 1.2; - color: var(--color-text-1); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - &__brand-mark { - font-size: 15px; + font-size: 18px; font-weight: 700; letter-spacing: 0.12em; line-height: 1; diff --git a/src/components/customer-side-rail/index.vue b/src/components/customer-side-rail/index.vue index 1719de9..616e347 100644 --- a/src/components/customer-side-rail/index.vue +++ b/src/components/customer-side-rail/index.vue @@ -18,15 +18,15 @@ - + @@ -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' @@ -575,9 +576,9 @@ onUnmounted(() => { .customer-side-rail { --csr-pad-x: 14px; --csr-item-h: 44px; - --csr-radius: 10px; - /* 与右侧内容卡片一致(如 account-flow-page-card) */ - --csr-panel-radius: 4px; + /* 与工作台 banner / panel 卡片圆角一致 */ + --csr-radius: 16px; + --csr-panel-radius: 16px; --csr-panel-inset: 16px; --csr-shell-width: 200px; --csr-ease: cubic-bezier(0.32, 0.72, 0, 1); @@ -635,10 +636,10 @@ onUnmounted(() => { display: flex; align-items: center; justify-content: center; - gap: 10px; + gap: 0; flex-shrink: 0; - min-height: 56px; - padding: 10px 16px; + min-height: 40px; + padding: 2px 16px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.06)); @@ -673,8 +674,8 @@ onUnmounted(() => { &__brand-logo { display: block; - width: 32px; - height: 32px; + width: 40px; + height: 40px; flex-shrink: 0; /* 与登录页一致:contain 避免 cover 裁切发糊;圆角过大也会让小图发软 */ object-fit: contain; @@ -682,19 +683,8 @@ onUnmounted(() => { image-rendering: -webkit-optimize-contrast; } - &__brand-name { - min-width: 0; - font-size: 15px; - font-weight: 700; - line-height: 1.2; - color: var(--color-text-1); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - &__brand-mark { - font-size: 15px; + font-size: 18px; font-weight: 700; letter-spacing: 0.12em; line-height: 1; @@ -952,7 +942,7 @@ onUnmounted(() => { color: var(--color-text-1); } - /* 二级:头像 + 消息 + 打印 + 收起 */ + /* 底栏:头像 + 消息 + 打印 + 收起 */ &__toolbar { display: flex; align-items: center; @@ -1080,12 +1070,8 @@ onUnmounted(() => { .customer-side-rail__brand { justify-content: center; gap: 0; - padding: 12px 0; - min-height: 52px; - } - - .customer-side-rail__brand-name { - display: none; + padding: 2px 0; + min-height: 40px; } .customer-side-rail__scroll { @@ -1124,7 +1110,7 @@ onUnmounted(() => { padding: 0; gap: 0; justify-content: center; - border-radius: 8px; + border-radius: var(--csr-radius); /* 收起态用整块高亮,不再用左边条(裁切后会偏) */ &::before { diff --git a/src/components/global-setting/index.vue b/src/components/global-setting/index.vue index 18e15a2..084670e 100644 --- a/src/components/global-setting/index.vue +++ b/src/components/global-setting/index.vue @@ -71,23 +71,6 @@ {{ $t(item.labelKey) }} -

{{ $t('settings.themeColorLiquid') }}

-
- -
@@ -147,20 +130,6 @@ { color: '#1e7fa0', labelKey: 'settings.themeBrand.cyan' }, ]; - // 液态暖色卡片(主色取自关怀卡片中调,样式复刻液态质感) - const liquidPresets = [ - { id: 'peach', color: '#e8885a', labelKey: 'settings.themeLiquid.peach' }, - { id: 'apricot', color: '#d9924a', labelKey: 'settings.themeLiquid.apricot' }, - { id: 'clay', color: '#c17a52', labelKey: 'settings.themeLiquid.clay' }, - { id: 'rose', color: '#c4788a', labelKey: 'settings.themeLiquid.rose' }, - { id: 'lilac', color: '#9b7bb8', labelKey: 'settings.themeLiquid.lilac' }, - { id: 'mist', color: '#5b8fc9', labelKey: 'settings.themeLiquid.mist' }, - { id: 'ocean', color: '#3d9a9a', labelKey: 'settings.themeLiquid.ocean' }, - { id: 'moss', color: '#6b9e6a', labelKey: 'settings.themeLiquid.moss' }, - { id: 'ember', color: '#d45c5c', labelKey: 'settings.themeLiquid.ember' }, - { id: 'rouge', color: '#c45a72', labelKey: 'settings.themeLiquid.rouge' }, - ]; - const cancel = () => { appStore.updateSettings({ globalSettings: false }); emit('cancel'); @@ -384,338 +353,6 @@ } } - .settings-section__subhint { - margin: 16px 0 10px; - font-size: 12px; - line-height: 1.45; - color: var(--color-text-3); - } - - .liquid-presets { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 10px; - } - - .liquid-preset { - position: relative; - display: flex; - align-items: flex-end; - min-height: 64px; - padding: 10px 12px; - overflow: hidden; - isolation: isolate; - border: 1px solid rgba(255, 214, 170, 0.55); - border-radius: 18px 14px 20px 16px; - cursor: pointer; - text-align: left; - background: - linear-gradient(145deg, rgba(255, 248, 240, 0.92), rgba(255, 236, 220, 0.72)), - rgba(255, 250, 245, 0.85); - box-shadow: - 0 8px 20px rgba(180, 110, 70, 0.12), - inset 0 1px 0 rgba(255, 255, 255, 0.8); - transition: - transform 0.2s ease, - box-shadow 0.2s ease, - border-color 0.2s ease; - animation: settings-liquid-morph 8s ease-in-out infinite; - - &:hover { - transform: translateY(-1px) scale(1.02); - box-shadow: - 0 12px 26px rgba(180, 110, 70, 0.16), - inset 0 1px 0 rgba(255, 255, 255, 0.85); - } - - &.is-active { - box-shadow: - 0 0 0 2px var(--color-bg-2), - 0 0 0 4px var(--app-primary-color), - 0 12px 26px rgba(180, 110, 70, 0.16), - inset 0 1px 0 rgba(255, 255, 255, 0.85); - } - } - - .liquid-preset__blob { - position: absolute; - border-radius: 50%; - filter: blur(12px); - opacity: 0.9; - pointer-events: none; - z-index: 0; - mix-blend-mode: multiply; - } - - .liquid-preset__blob--a { - width: 56px; - height: 56px; - top: -18px; - right: -12px; - animation: settings-blob-a 7s ease-in-out infinite; - } - - .liquid-preset__blob--b { - width: 48px; - height: 48px; - bottom: -16px; - left: -10px; - animation: settings-blob-b 9s ease-in-out infinite; - } - - .liquid-preset__blob--c { - width: 36px; - height: 36px; - top: 40%; - left: 42%; - animation: settings-blob-c 6.5s ease-in-out infinite; - } - - .liquid-preset__label { - position: relative; - z-index: 1; - font-size: 12px; - font-weight: 600; - letter-spacing: 0.02em; - color: #5c3d2e; - } - - .liquid-preset--peach { - .liquid-preset__blob--a { - background: radial-gradient(circle, #ffb48a 0%, rgba(255, 180, 138, 0) 70%); - } - .liquid-preset__blob--b { - background: radial-gradient(circle, #ffd6a5 0%, rgba(255, 214, 165, 0) 72%); - } - .liquid-preset__blob--c { - background: radial-gradient(circle, #ffe8c8 0%, rgba(255, 232, 200, 0) 70%); - } - } - - .liquid-preset--apricot { - border-color: rgba(255, 210, 140, 0.55); - background: - linear-gradient(145deg, rgba(255, 250, 236, 0.94), rgba(255, 232, 190, 0.75)), - rgba(255, 248, 235, 0.88); - - .liquid-preset__blob--a { - background: radial-gradient(circle, #ffd28a 0%, rgba(255, 210, 138, 0) 70%); - } - .liquid-preset__blob--b { - background: radial-gradient(circle, #ffe0a8 0%, rgba(255, 224, 168, 0) 72%); - } - .liquid-preset__blob--c { - background: radial-gradient(circle, #fff0cc 0%, rgba(255, 240, 204, 0) 70%); - } - } - - .liquid-preset--clay { - border-color: rgba(220, 170, 130, 0.55); - background: - linear-gradient(145deg, rgba(255, 244, 232, 0.94), rgba(240, 210, 185, 0.72)), - rgba(250, 240, 230, 0.88); - - .liquid-preset__blob--a { - background: radial-gradient(circle, #e0a888 0%, rgba(224, 168, 136, 0) 70%); - } - .liquid-preset__blob--b { - background: radial-gradient(circle, #d4a078 0%, rgba(212, 160, 120, 0) 72%); - } - .liquid-preset__blob--c { - background: radial-gradient(circle, #f0d4b8 0%, rgba(240, 212, 184, 0) 70%); - } - } - - .liquid-preset--rose { - border-color: rgba(242, 201, 222, 0.6); - background: - linear-gradient(145deg, rgba(255, 246, 250, 0.94), rgba(250, 228, 238, 0.72)), - rgba(255, 248, 252, 0.88); - - .liquid-preset__blob--a { - background: radial-gradient(circle, #f2c9de 0%, rgba(242, 201, 222, 0) 72%); - } - .liquid-preset__blob--b { - background: radial-gradient(circle, #e8b8d0 0%, rgba(232, 184, 208, 0) 70%); - } - .liquid-preset__blob--c { - background: radial-gradient(circle, #f8dceb 0%, rgba(248, 220, 235, 0) 70%); - } - .liquid-preset__label { - color: #5a3d4a; - } - } - - .liquid-preset--lilac { - border-color: rgba(220, 190, 230, 0.55); - background: - linear-gradient(145deg, rgba(252, 246, 255, 0.94), rgba(240, 228, 250, 0.72)), - rgba(250, 246, 255, 0.88); - - .liquid-preset__blob--a { - background: radial-gradient(circle, #d7b8ef 0%, rgba(215, 184, 239, 0) 70%); - } - .liquid-preset__blob--b { - background: radial-gradient(circle, #f2c9de 0%, rgba(242, 201, 222, 0) 72%); - } - .liquid-preset__blob--c { - background: radial-gradient(circle, #e8d9f8 0%, rgba(232, 217, 248, 0) 70%); - } - .liquid-preset__label { - color: #4a3a55; - } - } - - .liquid-preset--mist { - border-color: rgba(170, 200, 240, 0.55); - background: - linear-gradient(145deg, rgba(244, 248, 255, 0.94), rgba(220, 232, 250, 0.72)), - rgba(246, 250, 255, 0.88); - - .liquid-preset__blob--a { - background: radial-gradient(circle, #a8c8f0 0%, rgba(168, 200, 240, 0) 70%); - } - .liquid-preset__blob--b { - background: radial-gradient(circle, #c5daf8 0%, rgba(197, 218, 248, 0) 72%); - } - .liquid-preset__blob--c { - background: radial-gradient(circle, #dde9fb 0%, rgba(221, 233, 251, 0) 70%); - } - .liquid-preset__label { - color: #3a4f6e; - } - } - - .liquid-preset--ocean { - border-color: rgba(150, 220, 215, 0.55); - background: - linear-gradient(145deg, rgba(240, 252, 250, 0.94), rgba(210, 240, 236, 0.72)), - rgba(244, 252, 250, 0.88); - - .liquid-preset__blob--a { - background: radial-gradient(circle, #7ecfc8 0%, rgba(126, 207, 200, 0) 70%); - } - .liquid-preset__blob--b { - background: radial-gradient(circle, #a8e0da 0%, rgba(168, 224, 218, 0) 72%); - } - .liquid-preset__blob--c { - background: radial-gradient(circle, #d0f0ec 0%, rgba(208, 240, 236, 0) 70%); - } - .liquid-preset__label { - color: #2d5c58; - } - } - - .liquid-preset--moss { - border-color: rgba(170, 210, 165, 0.55); - background: - linear-gradient(145deg, rgba(244, 252, 242, 0.94), rgba(220, 238, 215, 0.72)), - rgba(246, 252, 244, 0.88); - - .liquid-preset__blob--a { - background: radial-gradient(circle, #9ed09a 0%, rgba(158, 208, 154, 0) 70%); - } - .liquid-preset__blob--b { - background: radial-gradient(circle, #b8deb4 0%, rgba(184, 222, 180, 0) 72%); - } - .liquid-preset__blob--c { - background: radial-gradient(circle, #d8eed4 0%, rgba(216, 238, 212, 0) 70%); - } - .liquid-preset__label { - color: #3a5a3a; - } - } - - .liquid-preset--ember { - border-color: rgba(240, 170, 170, 0.55); - background: - linear-gradient(145deg, rgba(255, 244, 244, 0.94), rgba(250, 220, 220, 0.72)), - rgba(255, 248, 248, 0.88); - - .liquid-preset__blob--a { - background: radial-gradient(circle, #f0a0a0 0%, rgba(240, 160, 160, 0) 70%); - } - .liquid-preset__blob--b { - background: radial-gradient(circle, #f5b8b8 0%, rgba(245, 184, 184, 0) 72%); - } - .liquid-preset__blob--c { - background: radial-gradient(circle, #fad0d0 0%, rgba(250, 208, 208, 0) 70%); - } - .liquid-preset__label { - color: #6e3a3a; - } - } - - .liquid-preset--rouge { - border-color: rgba(235, 170, 190, 0.55); - background: - linear-gradient(145deg, rgba(255, 244, 248, 0.94), rgba(248, 220, 230, 0.72)), - rgba(255, 248, 250, 0.88); - - .liquid-preset__blob--a { - background: radial-gradient(circle, #e8a0b8 0%, rgba(232, 160, 184, 0) 70%); - } - .liquid-preset__blob--b { - background: radial-gradient(circle, #f0b8c8 0%, rgba(240, 184, 200, 0) 72%); - } - .liquid-preset__blob--c { - background: radial-gradient(circle, #f5d0dc 0%, rgba(245, 208, 220, 0) 70%); - } - .liquid-preset__label { - color: #6a3a4a; - } - } - - @keyframes settings-liquid-morph { - 0%, - 100% { - border-radius: 18px 14px 20px 16px; - } - 33% { - border-radius: 14px 20px 14px 18px; - } - 66% { - border-radius: 20px 16px 18px 22px; - } - } - - @keyframes settings-blob-a { - 0%, - 100% { - transform: translate(0, 0) scale(1); - } - 50% { - transform: translate(-8px, 6px) scale(1.12); - } - } - - @keyframes settings-blob-b { - 0%, - 100% { - transform: translate(0, 0) scale(1); - } - 50% { - transform: translate(8px, -6px) scale(1.16); - } - } - - @keyframes settings-blob-c { - 0%, - 100% { - transform: translate(0, 0) scale(1); - } - 50% { - transform: translate(-5px, -4px) scale(1.22); - } - } - - @media (prefers-reduced-motion: reduce) { - .liquid-preset, - .liquid-preset__blob { - animation: none !important; - } - } - .settings-persist-tip { margin: 8px 0 0; padding-top: 16px; diff --git a/src/components/top-nav/RightTopUser.vue b/src/components/top-nav/RightTopUser.vue index 203c043..07fb351 100644 --- a/src/components/top-nav/RightTopUser.vue +++ b/src/components/top-nav/RightTopUser.vue @@ -62,7 +62,7 @@
+