diff --git a/src/api/channel/salesProduct.ts b/src/api/channel/salesProduct.ts index a60ca2c..1101809 100644 --- a/src/api/channel/salesProduct.ts +++ b/src/api/channel/salesProduct.ts @@ -214,6 +214,14 @@ export async function getSalesProductPublishSyncStatus(params: { OnlinePublishTime?: string | null pendingContentHash?: string | null onlineContentHash?: string | null + approvalPending?: boolean + ApprovalPending?: boolean + approvalInstanceId?: number | null + ApprovalInstanceId?: number | null + approvalInstanceNo?: string | null + ApprovalInstanceNo?: string | null + approvalStatusName?: string | null + ApprovalStatusName?: string | null }>(res.data) } diff --git a/src/components.d.ts b/src/components.d.ts index 5637a3b..f8bb9d3 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -12,6 +12,7 @@ declare module 'vue' { AgentSideRail: typeof import('./components/agent-side-rail/index.vue')['default'] AiAdvisorShell: typeof import('./components/NanaAssistant/AiAdvisorShell.vue')['default'] ApiTest: typeof import('./components/ApiTest/index.vue')['default'] + ApprovalDetailDrawer: typeof import('./components/ApprovalDetailDrawer/index.vue')['default'] BasicLayoutLeftRight: typeof import('./components/BasicLayoutLeftRight/index.vue')['default'] Block: typeof import('./components/global-setting/block.vue')['default'] Cascader: typeof import('./components/CascaderPro/Cascader.vue')['default'] diff --git a/src/components/ApprovalDetailDrawer/index.vue b/src/components/ApprovalDetailDrawer/index.vue new file mode 100644 index 0000000..94a3f13 --- /dev/null +++ b/src/components/ApprovalDetailDrawer/index.vue @@ -0,0 +1,1016 @@ + + + + + diff --git a/src/locale/en-US.ts b/src/locale/en-US.ts index 7dc9c47..79fa9f0 100644 --- a/src/locale/en-US.ts +++ b/src/locale/en-US.ts @@ -1502,7 +1502,39 @@ export default { 'system.approval.inbox.reject': 'Reject', 'system.approval.inbox.withdraw': 'Withdraw', 'system.approval.inbox.payload': 'Payload', + 'system.approval.inbox.basicInfo': 'Basics', + 'system.approval.inbox.bizSummary': 'Business content', + 'system.approval.inbox.noSummary': 'No business summary', + 'system.approval.inbox.rawPayload': 'View raw payload', + 'system.approval.inbox.price.description': 'Description', + 'system.approval.inbox.price.aiReport': 'AI analysis report', + 'system.approval.inbox.price.noAiReport': 'No AI report attached', + 'system.approval.inbox.price.expandReport': 'Expand full AI report', + 'system.approval.inbox.price.skippedAi': 'AI skipped', + 'system.approval.inbox.recharge.customer': 'Customer', + 'system.approval.inbox.recharge.payType': 'Payment method', + 'system.approval.inbox.recharge.serialNo': 'Serial No.', + 'system.approval.inbox.recharge.remark': 'Remark', + 'system.approval.inbox.recharge.screenshot': 'Screenshot', + 'system.approval.inbox.recharge.viewImage': 'View image', + 'system.approval.inbox.recharge.noScreenshot': 'No screenshot', + 'system.approval.inbox.noTimeline': 'No timeline yet', + 'system.approval.inbox.completedTime': 'Completed at', + 'system.approval.inbox.executedTime': 'Executed at', + 'system.approval.inbox.executeMessage': 'Execution result', + 'system.approval.inbox.copy': 'Copy', + 'system.approval.inbox.copySuccess': 'Copied', + 'system.approval.inbox.copyFailed': 'Copy failed', 'system.approval.inbox.timeline': 'Timeline', + 'system.approval.inbox.event.submitted': 'Submitted', + 'system.approval.inbox.event.approved': 'Approved', + 'system.approval.inbox.event.rejected': 'Rejected', + 'system.approval.inbox.event.withdrawn': 'Withdrawn', + 'system.approval.inbox.event.executing': 'Executing', + 'system.approval.inbox.event.executed': 'Executed', + 'system.approval.inbox.event.executeFailed': 'Execution failed', + 'system.approval.inbox.event.rejectCompensateFailed': 'Reject compensate failed', + 'system.approval.inbox.event.withdrawCompensateFailed': 'Withdraw compensate failed', 'system.approval.inbox.rejectPlaceholder': 'Rejection reason', 'system.approval.inbox.rejectRequired': 'Rejection reason is required', 'system.approval.inbox.approveConfirm': 'Approve instance {no}?', @@ -4585,6 +4617,7 @@ export default { 'system.announcement.actions.view': 'View', 'system.announcement.actions.delete': 'Delete', 'system.announcement.actions.readConfirm': 'Confirm Read', + 'system.announcement.actions.openApproval': 'Open approval', 'system.announcement.messageType.inform': 'Inform', 'system.announcement.messageType.message': 'Message', 'system.announcement.messageType.notice': 'Notice', @@ -4788,6 +4821,9 @@ export default { 'user.recharge.deposit.message.uploadVoucherFirst': 'Please upload recharge voucher first', 'user.recharge.deposit.message.submitFailed': 'Submit failed', 'user.recharge.deposit.message.submitSuccess': 'Recharge application submitted, pending review', + 'user.recharge.deposit.message.pendingApproval': 'Submitted for approval ({no}); credited after approval', + 'user.recharge.deposit.message.pendingApprovalFallback': 'Submitted for approval; credited after approval', + 'user.recharge.deposit.message.bypassed': 'Recharge credited', // User - Recharge Record 'user.recharge.record.search.serialNo': 'Serial No', @@ -4795,7 +4831,8 @@ export default { 'user.recharge.record.search.status': 'Recharge Status', 'user.recharge.record.search.statusPlaceholder': 'Please select', 'user.recharge.record.search.statusAll': 'All', - 'user.recharge.record.search.statusPending': 'Pending', + 'user.recharge.record.search.statusPending': 'Pending review', + 'user.recharge.record.search.statusPendingApproval': 'Pending approval', 'user.recharge.record.search.statusSuccess': 'Success', 'user.recharge.record.search.statusFailed': 'Failed', 'user.recharge.record.search.actions.search': 'Search', @@ -4815,18 +4852,25 @@ export default { 'user.recharge.record.message.approveError': 'Approve failed', 'user.recharge.record.message.rejectError': 'Reject failed', 'user.recharge.record.table.serialNo': 'Serial No', + 'user.recharge.record.table.customerCode': 'Customer Code', + 'user.recharge.record.table.customerName': 'Customer Name', 'user.recharge.record.table.payTime': 'Recharge Time', 'user.recharge.record.table.payType': 'Payment Method', 'user.recharge.record.table.payAmount': 'Recharge Amount', 'user.recharge.record.table.payImage': 'Recharge Screenshot', 'user.recharge.record.table.viewImage': 'View', 'user.recharge.record.table.payStatus': 'Recharge Status', + 'user.recharge.record.table.approvalNo': 'Approval No.', + 'user.recharge.record.table.auditTime': 'Audit Time', + 'user.recharge.record.table.auditBy': 'Auditor', 'user.recharge.record.table.remarks': 'Remarks', 'user.recharge.record.message.noPayImage': 'No screenshot available', + 'user.recharge.record.message.approvalDetailMissing': 'Approval instance missing; refresh and retry', 'user.recharge.record.payment.alipay': 'Alipay', 'user.recharge.record.payment.wechat': 'WeChat', 'user.recharge.record.actions.approve': 'Approve', 'user.recharge.record.actions.reject': 'Reject', + 'user.recharge.record.actions.viewApproval': 'View approval', 'user.recharge.record.message.approveSuccess': 'Approved', 'user.recharge.record.message.rejectSuccess': 'Rejected', 'user.recharge.record.message.exportSuccess': 'Exported successfully', @@ -5377,6 +5421,7 @@ export default { 'channel.salesProducts.actions.publishConfig': 'Publish config', 'channel.salesProducts.actions.publishRules': 'Publish rules', 'channel.salesProducts.actions.publishPrice': 'Publish prices', + 'channel.salesProducts.actions.viewPriceApproval': 'View approval', 'channel.salesProducts.actions.add': 'Add', 'channel.salesProducts.actions.edit': 'Edit', 'channel.salesProducts.actions.delete': 'Delete', @@ -5469,9 +5514,12 @@ export default { 'channel.salesProducts.publish.legend.remove': 'Removed', 'channel.salesProducts.publish.legend.change': 'Changed', 'channel.salesProducts.publish.legend.same': 'Unchanged', - 'channel.salesProducts.publish.badge.pending': 'Pending', - 'channel.salesProducts.publish.badge.synced': 'Synced', + 'channel.salesProducts.publish.badge.pending': 'Pending publish', + 'channel.salesProducts.publish.badge.pendingApproval': 'Pending approval', + 'channel.salesProducts.publish.badge.synced': 'Published', 'channel.salesProducts.publish.badge.checking': 'Checking…', + 'channel.salesProducts.publish.approvalNo': 'Approval No. {no}', + 'channel.salesProducts.publish.approvalDetailMissing': 'Approval instance missing; refresh and retry', 'channel.salesProducts.rules.schemeTitle': 'Shipping scheme', 'channel.salesProducts.rules.scheme.costLowest': 'Lowest cost', diff --git a/src/locale/zh-CN.ts b/src/locale/zh-CN.ts index f48ed6c..138a8b5 100644 --- a/src/locale/zh-CN.ts +++ b/src/locale/zh-CN.ts @@ -1493,7 +1493,39 @@ export default { 'system.approval.inbox.reject': '驳回', 'system.approval.inbox.withdraw': '撤回', 'system.approval.inbox.payload': '业务载荷', - 'system.approval.inbox.timeline': '事件时间线', + 'system.approval.inbox.basicInfo': '基本信息', + 'system.approval.inbox.bizSummary': '业务内容', + 'system.approval.inbox.noSummary': '暂无业务摘要', + 'system.approval.inbox.rawPayload': '查看原始载荷', + 'system.approval.inbox.price.description': '发布说明', + 'system.approval.inbox.price.aiReport': 'AI 分析报告', + 'system.approval.inbox.price.noAiReport': '提交时未附带 AI 报告', + 'system.approval.inbox.price.expandReport': '展开完整 AI 报告', + 'system.approval.inbox.price.skippedAi': '已跳过 AI', + 'system.approval.inbox.recharge.customer': '客户', + 'system.approval.inbox.recharge.payType': '支付方式', + 'system.approval.inbox.recharge.serialNo': '流水号', + 'system.approval.inbox.recharge.remark': '备注', + 'system.approval.inbox.recharge.screenshot': '充值截图', + 'system.approval.inbox.recharge.viewImage': '查看大图', + 'system.approval.inbox.recharge.noScreenshot': '未上传截图', + 'system.approval.inbox.noTimeline': '暂无流转记录', + 'system.approval.inbox.completedTime': '完成时间', + 'system.approval.inbox.executedTime': '执行时间', + 'system.approval.inbox.executeMessage': '执行结果', + 'system.approval.inbox.copy': '复制', + 'system.approval.inbox.copySuccess': '单号已复制', + 'system.approval.inbox.copyFailed': '复制失败', + 'system.approval.inbox.timeline': '审批流转', + 'system.approval.inbox.event.submitted': '已提交', + 'system.approval.inbox.event.approved': '已通过', + 'system.approval.inbox.event.rejected': '已驳回', + 'system.approval.inbox.event.withdrawn': '已撤回', + 'system.approval.inbox.event.executing': '执行中', + 'system.approval.inbox.event.executed': '执行成功', + 'system.approval.inbox.event.executeFailed': '执行失败', + 'system.approval.inbox.event.rejectCompensateFailed': '驳回补偿失败', + 'system.approval.inbox.event.withdrawCompensateFailed': '撤回补偿失败', 'system.approval.inbox.rejectPlaceholder': '请填写驳回意见', 'system.approval.inbox.rejectRequired': '驳回意见不能为空', 'system.approval.inbox.approveConfirm': '确认通过审批单 {no}?', @@ -4607,6 +4639,7 @@ export default { 'system.announcement.actions.view': '查看', 'system.announcement.actions.delete': '删除', 'system.announcement.actions.readConfirm': '确认已读', + 'system.announcement.actions.openApproval': '打开审批单', 'system.announcement.messageType.inform': '通知', 'system.announcement.messageType.message': '消息', 'system.announcement.messageType.notice': '公告', @@ -4810,6 +4843,9 @@ export default { 'user.recharge.deposit.message.uploadVoucherFirst': '请先上传充值凭证', 'user.recharge.deposit.message.submitFailed': '提交失败', 'user.recharge.deposit.message.submitSuccess': '充值申请已提交,请等待审核', + 'user.recharge.deposit.message.pendingApproval': '已提交审批({no}),通过后入账', + 'user.recharge.deposit.message.pendingApprovalFallback': '已提交审批,通过后入账', + 'user.recharge.deposit.message.bypassed': '充值已入账', // 用户 - 充值记录 'user.recharge.record.search.serialNo': '流水号', @@ -4818,6 +4854,7 @@ export default { 'user.recharge.record.search.statusPlaceholder': '请选择', 'user.recharge.record.search.statusAll': '全部', 'user.recharge.record.search.statusPending': '待审核', + 'user.recharge.record.search.statusPendingApproval': '待审批', 'user.recharge.record.search.statusSuccess': '成功', 'user.recharge.record.search.statusFailed': '失败', 'user.recharge.record.search.actions.search': '搜索', @@ -4837,18 +4874,25 @@ export default { 'user.recharge.record.message.approveError': '审核失败', 'user.recharge.record.message.rejectError': '拒绝失败', 'user.recharge.record.table.serialNo': '流水号', + 'user.recharge.record.table.customerCode': '客户编码', + 'user.recharge.record.table.customerName': '客户名称', 'user.recharge.record.table.payTime': '充值时间', 'user.recharge.record.table.payType': '支付方式', 'user.recharge.record.table.payAmount': '充值金额', 'user.recharge.record.table.payImage': '充值截图', 'user.recharge.record.table.viewImage': '查看', 'user.recharge.record.table.payStatus': '充值状态', + 'user.recharge.record.table.approvalNo': '审批号', + 'user.recharge.record.table.auditTime': '审核时间', + 'user.recharge.record.table.auditBy': '审核人', 'user.recharge.record.table.remarks': '备注', 'user.recharge.record.message.noPayImage': '暂无充值截图', + 'user.recharge.record.message.approvalDetailMissing': '暂无审批单,请刷新后重试', 'user.recharge.record.payment.alipay': '支付宝', 'user.recharge.record.payment.wechat': '微信', 'user.recharge.record.actions.approve': '通过', 'user.recharge.record.actions.reject': '拒绝', + 'user.recharge.record.actions.viewApproval': '查看审批', 'user.recharge.record.message.approveSuccess': '已通过', 'user.recharge.record.message.rejectSuccess': '已拒绝', 'user.recharge.record.message.exportSuccess': '导出成功', @@ -5400,6 +5444,7 @@ export default { 'channel.salesProducts.actions.publishConfig': '发布配置', 'channel.salesProducts.actions.publishRules': '发布规则', 'channel.salesProducts.actions.publishPrice': '价格发布', + 'channel.salesProducts.actions.viewPriceApproval': '查看审批', 'channel.salesProducts.actions.add': '新增', 'channel.salesProducts.actions.edit': '编辑', 'channel.salesProducts.actions.delete': '删除', @@ -5493,8 +5538,11 @@ export default { 'channel.salesProducts.publish.legend.change': '修改', 'channel.salesProducts.publish.legend.same': '不变', 'channel.salesProducts.publish.badge.pending': '待发布', - 'channel.salesProducts.publish.badge.synced': '已同步', + 'channel.salesProducts.publish.badge.pendingApproval': '待审批', + 'channel.salesProducts.publish.badge.synced': '已发布', 'channel.salesProducts.publish.badge.checking': '检测中…', + 'channel.salesProducts.publish.approvalNo': '审批号 {no}', + 'channel.salesProducts.publish.approvalDetailMissing': '暂无审批单,请刷新后重试', 'channel.salesProducts.rules.schemeTitle': '排货方案', 'channel.salesProducts.rules.scheme.costLowest': '成本最低', diff --git a/src/utils/approvalNoticeLink.ts b/src/utils/approvalNoticeLink.ts new file mode 100644 index 0000000..80da722 --- /dev/null +++ b/src/utils/approvalNoticeLink.ts @@ -0,0 +1,47 @@ +/** 审批站内信深链标记,例:[OMS_APPROVAL:id=12&tab=todo] */ + +export type ApprovalNoticeTab = 'todo' | 'submitted' + +export type ApprovalNoticeLink = { + instanceId: number + tab: ApprovalNoticeTab +} + +const MARKER_RE = /\[OMS_APPROVAL:([^\]]+)\]/i + +export function buildApprovalNoticeMarker( + instanceId: number, + tab: ApprovalNoticeTab = 'todo', +): string { + return `[OMS_APPROVAL:id=${instanceId}&tab=${tab}]` +} + +export function parseApprovalNoticeLink(content?: string | null): ApprovalNoticeLink | null { + const text = String(content || '') + const match = text.match(MARKER_RE) + if (!match?.[1]) return null + const params = new URLSearchParams(match[1].replace(/;/g, '&')) + const id = Number(params.get('id') || 0) + if (!Number.isFinite(id) || id <= 0) return null + const tabRaw = String(params.get('tab') || 'todo').trim() + const tab: ApprovalNoticeTab = tabRaw === 'submitted' ? 'submitted' : 'todo' + return { instanceId: id, tab } +} + +/** 展示给用户时去掉机器标记 */ +export function stripApprovalNoticeMarker(content?: string | null): string { + return String(content || '') + .replace(MARKER_RE, '') + .replace(/\n{3,}/g, '\n\n') + .trim() +} + +export function buildApprovalInboxLocation(link: ApprovalNoticeLink) { + return { + path: '/system/approval/inbox', + query: { + tab: link.tab, + instanceId: String(link.instanceId), + }, + } +} diff --git a/src/views/channel/salesProducts/index.vue b/src/views/channel/salesProducts/index.vue index ea89832..fe12d57 100644 --- a/src/views/channel/salesProducts/index.vue +++ b/src/views/channel/salesProducts/index.vue @@ -52,6 +52,7 @@ import PricePublishAiAssistDrawer from './components/PricePublishAiAssistDrawer.vue'; import type { PricePublishAiAdoptPayload } from './components/PricePublishAiAssistDrawer.vue'; import BillingSimulateDrawer from './components/BillingSimulateDrawer.vue'; + import ApprovalDetailDrawer from '@/components/ApprovalDetailDrawer/index.vue'; import { buildPricePublishAiSkipReport, type PricePublishRiskLevel } from './pricePublishAiSkill'; import { pickResolvedAudit } from '@/utils/auditFields'; import { useUserStore } from '@/store'; @@ -1452,12 +1453,15 @@ return detail?.content ?? detail?.Content ?? null; } - /** 仅展示后端 sync-status.pending,前端不做快照 diff */ + /** 同步态:待发布 / 待审批(+审批号) / 已发布 */ async function refreshPricePublishSyncStatus(productId?: number) { const pid = productId ?? selectedProduct.value; if (pid == null) { pricePublishChecking.value = false; pricePublishPending.value = null; + priceApprovalPending.value = false; + priceApprovalInstanceId.value = null; + priceApprovalInstanceNo.value = ''; return; } const seq = priceTabLoadSeq; @@ -1470,13 +1474,46 @@ if (seq !== priceTabLoadSeq || selectedProduct.value !== pid) return; const pending = status?.pending ?? status?.Pending; pricePublishPending.value = typeof pending === 'boolean' ? pending : null; + const approvalPending = Boolean( + status?.approvalPending ?? status?.ApprovalPending, + ); + priceApprovalPending.value = approvalPending; + const instanceId = + status?.approvalInstanceId ?? status?.ApprovalInstanceId ?? null; + priceApprovalInstanceId.value = + typeof instanceId === 'number' && instanceId > 0 ? instanceId : null; + priceApprovalInstanceNo.value = String( + status?.approvalInstanceNo ?? status?.ApprovalInstanceNo ?? '', + ).trim(); } catch { - if (seq === priceTabLoadSeq) pricePublishPending.value = null; + if (seq === priceTabLoadSeq) { + pricePublishPending.value = null; + priceApprovalPending.value = false; + priceApprovalInstanceId.value = null; + priceApprovalInstanceNo.value = ''; + } } finally { if (seq === priceTabLoadSeq) pricePublishChecking.value = false; } } + const priceApprovalDrawerVisible = ref(false); + + function openPriceApprovalDrawer() { + if (!priceApprovalInstanceId.value) { + Message.warning(t('channel.salesProducts.publish.approvalDetailMissing')); + return; + } + priceApprovalDrawerVisible.value = true; + } + + async function onPriceApprovalChanged() { + const pid = selectedProduct.value; + if (pid == null) return; + await refreshPricePublishSyncStatus(pid); + await loadPriceTabData(pid, { force: true }); + } + let recordsTabLoadedProductId: number | null = null; let recordsLoadSeq = 0; let publishContentSeq = 0; @@ -1635,12 +1672,18 @@ priceTabLoadedProductId = null; pricePublishPending.value = null; pricePublishChecking.value = false; + priceApprovalPending.value = false; + priceApprovalInstanceId.value = null; + priceApprovalInstanceNo.value = ''; effectiveVersion.value = '--'; effectiveTime.value = '--'; } else if (activeTab.value === 'price') { // 切到卖价 tab / 换产品:先清空徽章,等 sync-status 回来再显示 pricePublishPending.value = null; pricePublishChecking.value = false; + priceApprovalPending.value = false; + priceApprovalInstanceId.value = null; + priceApprovalInstanceNo.value = ''; } if (productChanged && activeTab.value !== 'rules') { rulesTabLoadedProductId = null; @@ -1907,6 +1950,9 @@ const publishDiffRows = ref([]); const pricePublishPending = ref(null); const pricePublishChecking = ref(false); + const priceApprovalPending = ref(false); + const priceApprovalInstanceId = ref(null); + const priceApprovalInstanceNo = ref(''); const publishDiffStatus = computed(() => { if (!publishHasOnlineSnapshot.value) return 'first'; @@ -2332,6 +2378,14 @@ ? t('channel.salesProducts.publish.pendingApproval', { no: approvalNo }) : t('channel.salesProducts.publish.pendingApprovalFallback'), ); + if (operatorType === 'price') { + priceApprovalPending.value = true; + priceApprovalInstanceNo.value = approvalNo; + const approvalId = + publishResult?.approvalInstanceId ?? publishResult?.ApprovalInstanceId ?? null; + priceApprovalInstanceId.value = + typeof approvalId === 'number' && approvalId > 0 ? approvalId : null; + } } else { Message.success(t('channel.salesProducts.publish.success')); } @@ -2348,14 +2402,12 @@ publishConfirmDate.value = dayjs(); clearPricePublishAiReport(); publishModalMethods.closeModal(); - if (decision !== 'PendingApproval') { + if (operatorType === 'price') { + await loadRecordsTabData(pid, true); + await loadPriceTabData(pid, { force: true }); + await refreshPricePublishSyncStatus(pid); + } else if (decision !== 'PendingApproval') { await loadRecordsTabData(pid, true); - if (operatorType === 'price') { - // 不乐观改徽章;等后端 sync-status 重算 - pricePublishPending.value = null; - await loadPriceTabData(pid, { force: true }); - await refreshPricePublishSyncStatus(pid); - } } } catch (e: any) { Message.error(e?.message || t('channel.salesProducts.publish.fail')); @@ -4530,6 +4582,15 @@
+ {{ t('channel.salesProducts.actions.viewPriceApproval') }} + + 生效时间:{{ effectiveTime }} {{ t('channel.salesProducts.publish.badge.checking') }} + + {{ t('channel.salesProducts.publish.badge.pendingApproval') }} + + + + + +
@@ -129,6 +135,7 @@ import { useI18n } from 'vue-i18n' import { Message, Modal } from '@arco-design/web-vue' import HandsontablePro from '@/components/HandsontablePro/index.vue' import PaginationPro from '@/components/PaginationPro/index.vue' +import ApprovalDetailDrawer from '@/components/ApprovalDetailDrawer/index.vue' import { useTableContainerHeight } from '@/composables/useTableContainerHeight' import dayjs from 'dayjs' import zfbIcon from '@/assets/zfb.png' @@ -147,17 +154,26 @@ defineOptions({ const { t } = useI18n() const { tableContainerRef, tableHeight } = useTableContainerHeight() +const approvalDrawerVisible = ref(false) +const approvalDrawerInstanceId = ref(null) const handsontableHeight = computed(() => Math.max(tableHeight.value || 0, 400)) interface RechargeRecord { id?: number | string serialNo: string + customerCode: string + customerName: string payTime: string payType: string payAmount: number payImage?: string payStatus: string remarks?: string + auditTime: string + auditBy: string + approvalPending: boolean + approvalInstanceId: number | null + approvalInstanceNo: string } /** 无截图占位(提交时写 "0");GetPublicUrl("0") 也会返回空串 */ @@ -169,18 +185,31 @@ function resolvePayImageUrl(raw: unknown): string | undefined { } function mapRow(item: any): RechargeRecord { - const pt = Number(item.payType) + const pt = Number(item.payType ?? item.PayType) // 接口约定:1-微信 2-支付宝 const payType = pt === 2 ? 'zfb' : 'wx' + const auditTimeRaw = item.auditTime ?? item.AuditTime + const approvalPending = Boolean(item.approvalPending ?? item.ApprovalPending) + const approvalId = item.approvalInstanceId ?? item.ApprovalInstanceId ?? null return { - id: item.id, - serialNo: item.serialNumber ?? '', - payTime: item.rechargeTime ?? '', + id: item.id ?? item.Id, + serialNo: item.serialNumber ?? item.SerialNumber ?? '', + customerCode: item.customerCode ?? item.CustomerCode ?? '', + customerName: item.customerName ?? item.CustomerName ?? '', + payTime: item.rechargeTime ?? item.RechargeTime ?? '', payType, - payAmount: item.rechargeAmount ?? 0, + payAmount: item.rechargeAmount ?? item.RechargeAmount ?? 0, payImage: resolvePayImageUrl(item.rechargeScreenshot ?? item.RechargeScreenshot), - payStatus: String(item.rechargeStatus ?? ''), - remarks: item.remark ?? '', + payStatus: String(item.rechargeStatus ?? item.RechargeStatus ?? ''), + remarks: item.remark ?? item.Remark ?? '', + auditTime: auditTimeRaw ? dayjs(auditTimeRaw).format('YYYY-MM-DD HH:mm:ss') : '', + auditBy: item.auditBy ?? item.AuditBy ?? '', + approvalPending, + approvalInstanceId: + typeof approvalId === 'number' && approvalId > 0 ? approvalId : null, + approvalInstanceNo: String( + item.approvalInstanceNo ?? item.ApprovalInstanceNo ?? '', + ).trim(), } } @@ -284,11 +313,16 @@ onMounted(() => { const hotColumns = computed(() => [ { key: 'serialNo', label: t('user.recharge.record.table.serialNo'), width: 180 }, + { key: 'customerCode', label: t('user.recharge.record.table.customerCode'), width: 120 }, + { key: 'customerName', label: t('user.recharge.record.table.customerName'), width: 140 }, { key: 'payTime', label: t('user.recharge.record.table.payTime'), width: 180 }, { key: 'payType', label: t('user.recharge.record.table.payType'), width: 120 }, { key: 'payAmount', label: t('user.recharge.record.table.payAmount'), width: 120 }, { key: 'payImage', label: t('user.recharge.record.table.payImage'), width: 120 }, { key: 'payStatus', label: t('user.recharge.record.table.payStatus'), width: 100 }, + { key: 'approvalInstanceNo', label: t('user.recharge.record.table.approvalNo'), width: 160 }, + { key: 'auditTime', label: t('user.recharge.record.table.auditTime'), width: 180 }, + { key: 'auditBy', label: t('user.recharge.record.table.auditBy'), width: 120 }, { key: 'remarks', label: t('user.recharge.record.table.remarks'), width: 150 }, ]) @@ -317,6 +351,9 @@ function customCellRenderer(row: number, col: number, value: any, rowData: any): } if (colKey === 'payStatus') { const status = rowData?.payStatus + if (status === '1' && rowData?.approvalPending) { + return buildStatusTagHtml(t('user.recharge.record.search.statusPendingApproval'), 'brand') + } if (status === '1') { return buildStatusTagHtml(t('user.recharge.record.search.statusPending'), 'wait') } @@ -328,14 +365,34 @@ function customCellRenderer(row: number, col: number, value: any, rowData: any): } return '--' } + if (colKey === 'approvalInstanceNo') { + const no = String(rowData?.approvalInstanceNo || '').trim() + if (!no) return '--' + return `${no}` + } if (colKey === 'remarks') { return value ? `${value}` : null } return null } +function openRechargeApprovalDrawer(row?: RechargeRecord | null) { + const id = row?.approvalInstanceId + if (!id) { + Message.warning(t('user.recharge.record.message.approvalDetailMissing')) + return + } + approvalDrawerInstanceId.value = id + approvalDrawerVisible.value = true +} + function actionRenderer(row: any, _rowIndex: number): string { if (String(row?.payStatus) !== '1') return '' + if (row?.approvalPending) { + return wrapWarehouseActions([ + renderWarehouseActionBtn('viewApproval', t('user.recharge.record.actions.viewApproval')), + ]) + } return wrapWarehouseActions([ renderWarehouseActionBtn('approve', t('user.recharge.record.actions.approve')), renderWarehouseActionBtn('reject', t('user.recharge.record.actions.reject')), @@ -344,6 +401,10 @@ function actionRenderer(row: any, _rowIndex: number): string { async function handleActionClick(row: any, _rowIndex: number, action?: string) { if (!row?.id) return + if (action === 'viewApproval') { + openRechargeApprovalDrawer(row) + return + } if (action === 'approve') { Modal.confirm({ title: t('user.recharge.record.modal.approveConfirmTitle'), @@ -391,6 +452,18 @@ async function handleRejectSubmit() { } function handleViewPayImageClick(event: MouseEvent) { + const approvalTrigger = (event.target as HTMLElement | null)?.closest?.( + '[data-role="view-recharge-approval"]', + ) + if (approvalTrigger) { + const rowIndex = Number(approvalTrigger.getAttribute('data-row-index')) + const row = Number.isFinite(rowIndex) ? tableRows.value[rowIndex] : null + event.preventDefault() + event.stopPropagation() + openRechargeApprovalDrawer(row) + return + } + const trigger = (event.target as HTMLElement | null)?.closest?.('[data-role="view-pay-image"]') if (!trigger) return const rowIndex = Number(trigger.getAttribute('data-row-index')) diff --git a/src/views/h5/admin-center/locale/en-US.ts b/src/views/h5/admin-center/locale/en-US.ts index 7304e74..43d25a6 100644 --- a/src/views/h5/admin-center/locale/en-US.ts +++ b/src/views/h5/admin-center/locale/en-US.ts @@ -43,12 +43,15 @@ export default { 'h5Admin.recharge.loadMore': 'Load more', 'h5Admin.recharge.loadFailed': 'Failed to load', 'h5Admin.recharge.tab.pending': 'Pending', + 'h5Admin.recharge.tab.pendingApproval': 'Pending approval', 'h5Admin.recharge.tab.all': 'All', 'h5Admin.recharge.tab.success': 'Approved', 'h5Admin.recharge.tab.failed': 'Rejected', 'h5Admin.recharge.customer': 'Customer', 'h5Admin.recharge.serialNo': 'Serial No.', 'h5Admin.recharge.time': 'Time', + 'h5Admin.recharge.approvalNo': 'Approval No.', + 'h5Admin.recharge.approvalTip': 'In approval flow — handle it in PC Approval Inbox', 'h5Admin.recharge.remark': 'Remark', 'h5Admin.recharge.viewImage': 'Screenshot', 'h5Admin.recharge.approve': 'Approve', diff --git a/src/views/h5/admin-center/locale/zh-CN.ts b/src/views/h5/admin-center/locale/zh-CN.ts index 4329347..99f9952 100644 --- a/src/views/h5/admin-center/locale/zh-CN.ts +++ b/src/views/h5/admin-center/locale/zh-CN.ts @@ -43,12 +43,15 @@ export default { 'h5Admin.recharge.loadMore': '加载更多', 'h5Admin.recharge.loadFailed': '加载失败', 'h5Admin.recharge.tab.pending': '待审核', + 'h5Admin.recharge.tab.pendingApproval': '待审批', 'h5Admin.recharge.tab.all': '全部', 'h5Admin.recharge.tab.success': '已通过', 'h5Admin.recharge.tab.failed': '已驳回', 'h5Admin.recharge.customer': '客户', 'h5Admin.recharge.serialNo': '流水号', 'h5Admin.recharge.time': '时间', + 'h5Admin.recharge.approvalNo': '审批号', + 'h5Admin.recharge.approvalTip': '已进入审批流,请到 PC「审批待办」处理', 'h5Admin.recharge.remark': '备注', 'h5Admin.recharge.viewImage': '查看截图', 'h5Admin.recharge.approve': '通过', diff --git a/src/views/h5/admin-center/recharge/index.vue b/src/views/h5/admin-center/recharge/index.vue index 5768546..6919091 100644 --- a/src/views/h5/admin-center/recharge/index.vue +++ b/src/views/h5/admin-center/recharge/index.vue @@ -67,8 +67,8 @@
¥{{ formatAmount(row.payAmount) }} - - {{ statusLabel(row.payStatus) }} + + {{ statusLabel(row.payStatus, row.approvalPending) }}
@@ -90,6 +90,10 @@ {{ t('h5Admin.recharge.time') }} {{ formatTime(row.payTime) }}

+

+ {{ t('h5Admin.recharge.approvalNo') }} + {{ row.approvalInstanceNo }} +

{{ t('h5Admin.recharge.remark') }} {{ row.remarks }} @@ -105,7 +109,10 @@ > {{ t('h5Admin.recharge.viewImage') }} -