fix: some

This commit is contained in:
luo
2026-09-17 12:16:20 +08:00
parent 2308d82d0f
commit 76d4e4ec02
126 changed files with 11671 additions and 294 deletions

View File

@@ -11,10 +11,34 @@ export const AUGUST_PERMISSIONS = {
applicationCreate: 'employee_collection:application_create',
applicationDetail: 'employee_collection:application_detail',
applicationUpdate: 'employee_collection:application_update',
applicationViewVoucher: 'employee_collection:application_view_voucher',
paymentMethodPage: 'employee_collection:payment_method_view',
paymentMethodCreate: 'employee_collection:payment_method_create',
paymentMethodEdit: 'employee_collection:payment_method_edit',
paymentMethodDelete: 'employee_collection:payment_method_delete'
},
phoneAssetAssociation: {
list: 'phone_asset_association:list',
unbind: 'phone_asset_association:unbind',
unbindBatch: 'phone_asset_association:unbind_batch',
unbindImportPage: 'phone_asset_association:unbind_import_view',
unbindImportCreate: 'phone_asset_association:unbind_import_create',
unbindImportDetail: 'phone_asset_association:unbind_import_detail'
},
h5PopupConfiguration: {
list: 'h5_popup_configuration:list',
create: 'h5_popup_configuration:create',
update: 'h5_popup_configuration:update',
enable: 'h5_popup_configuration:enable',
disable: 'h5_popup_configuration:disable'
},
packageTrafficAlert: {
rulesView: 'package_traffic_alert:rules_view',
ruleCreate: 'package_traffic_alert:rule_create',
ruleUpdate: 'package_traffic_alert:rule_update',
recordsView: 'package_traffic_alert:records_view',
recordDetail: 'package_traffic_alert:record_detail',
export: 'package_traffic_alert:export'
}
} as const

View File

@@ -0,0 +1,48 @@
/**
* 业务用户组相关常量与权限编码
*/
import type { BusinessUserGroupBusinessLine } from '@/types/api'
/** 业务线选项:standard 标品 / smart 智能产品 / other 其他 */
export const BUSINESS_USER_GROUP_BUSINESS_LINE_OPTIONS: Array<{
label: string
value: BusinessUserGroupBusinessLine
type?: 'primary' | 'success' | 'warning' | 'info' | 'danger'
}> = [
{ label: '标品', value: 'standard', type: 'primary' },
{ label: '智能产品', value: 'smart', type: 'success' },
{ label: '其他', value: 'other', type: 'warning' }
]
/** 业务线文案映射 */
export const BUSINESS_USER_GROUP_BUSINESS_LINE_MAP = BUSINESS_USER_GROUP_BUSINESS_LINE_OPTIONS.reduce(
(map, item) => {
map[item.value] = item
return map
},
{} as Record<BusinessUserGroupBusinessLine, (typeof BUSINESS_USER_GROUP_BUSINESS_LINE_OPTIONS)[number]>
)
/** 获取业务线标签 */
export function getBusinessUserGroupBusinessLineLabel(businessLine?: string | null): string {
if (!businessLine) return '-'
return BUSINESS_USER_GROUP_BUSINESS_LINE_MAP[businessLine as BusinessUserGroupBusinessLine]
?.label ?? businessLine
}
/** 业务用户组页面与按钮权限编码 */
export const BUSINESS_USER_GROUP_PERMISSIONS = {
page: 'business_user_group:page',
create: 'business_user_group:create',
update: 'business_user_group:update',
delete: 'business_user_group:delete',
members: 'business_user_group:members'
}
/** 店铺业务负责人运营权限编码 */
export const SHOP_BUSINESS_OWNER_PERMISSIONS = {
batch: 'shop:business_owner_batch',
importPage: 'shop:business_owner_import',
importCreate: 'shop:business_owner_import'
}

View File

@@ -10,6 +10,7 @@ export const COMMISSION_STATUS_OPTIONS = [
{ label: '解冻中', value: CommissionStatus.UNFREEZING, type: 'warning' as const },
{ label: '已发放', value: CommissionStatus.RELEASED, type: 'success' as const },
{ label: '已失效', value: CommissionStatus.INVALID, type: 'danger' as const },
{ label: '回溯', value: CommissionStatus.CLAWBACK, type: 'danger' as const },
{ label: '待人工修正', value: CommissionStatus.PENDING_CORRECTION, type: 'warning' as const }
]
@@ -46,6 +47,7 @@ export const CommissionStatusMap = {
2: { label: '解冻中', type: 'warning' as const, color: '#E6A23C' },
3: { label: '已发放', type: 'success' as const, color: '#67C23A' },
4: { label: '已失效', type: 'danger' as const, color: '#F56C6C' },
5: { label: '回溯', type: 'danger' as const, color: '#F56C6C' },
99: { label: '待人工修正', type: 'warning' as const, color: '#E6A23C' }
}
@@ -113,3 +115,33 @@ export function getCommissionTypeType(type: string) {
const config = CommissionTypeMap[type as keyof typeof CommissionTypeMap]
return config?.type || 'info'
}
// ========== 佣金记录(含回溯明细)映射 ==========
// 记录来源映射 (original:原佣金, clawback:回溯明细)
export const COMMISSION_RECORD_SOURCE_MAP = {
original: { label: '原佣金', type: 'primary' as const },
clawback: { label: '回溯明细', type: 'danger' as const }
}
// 佣金记录状态筛选选项(含回溯,不含待人工修正)
export const COMMISSION_RECORD_STATUS_OPTIONS = [
{ label: '已冻结', value: CommissionStatus.FROZEN },
{ label: '解冻中', value: CommissionStatus.UNFREEZING },
{ label: '已发放', value: CommissionStatus.RELEASED },
{ label: '已失效', value: CommissionStatus.INVALID },
{ label: '回溯', value: CommissionStatus.CLAWBACK }
]
// 是否回溯明细行(source 与 status 双判断,兼容未返回 source 的响应)
export function isCommissionClawbackRecord(record: {
source?: string
status?: number
}): boolean {
return record.source === 'clawback' || record.status === CommissionStatus.CLAWBACK
}
// 列表行 key:原佣金与回溯明细 ID 空间独立,同一页可能出现相同 id
export function getCommissionRecordRowKey(record: { id: number; source?: string }): string {
return `${record.source || 'original'}:${record.id}`
}

View File

@@ -84,6 +84,24 @@ export const EXPORT_TASK_SCENE_CONFIG: Record<ExportTaskScene, ExportTaskSceneCo
detail: 'export_task:exchange_detail',
download: 'export_task:exchange_download'
}
},
commission_record: {
scene: 'commission_record',
sceneName: '佣金记录',
pageTitle: '导出佣金记录',
permissions: {
detail: 'export_task:commission_record_detail',
download: 'export_task:commission_record_download'
}
},
package_traffic_alert: {
scene: 'package_traffic_alert',
sceneName: '套餐真流量预警',
pageTitle: '导出套餐真流量预警',
permissions: {
detail: 'export_task:package_traffic_alert_detail',
download: 'export_task:package_traffic_alert_download'
}
}
}

View File

@@ -34,7 +34,12 @@ export * from './enableStatus'
// 导出任务相关
export * from './exportTask'
export * from './businessUserGroup'
// 套餐真流量预警相关
export * from './packageTrafficAlert'
// 批量订购相关
export * from './bulkPurchase'
export * from './julyIteration'
export * from './augustIteration'

View File

@@ -0,0 +1,60 @@
/**
* 套餐真流量预警相关常量
* 对应 docs/产品迭代8月份/套餐真流量预警_API_前端简版.md
*/
import {
PackageTrafficAlertNotificationStatus,
type PackageTrafficAlertAssetType
} from '@/types/api'
/** 通知投递结果选项(1:已通知, 2:待投递, 3:投递失败, 4:未通知(接收人已失效), 5:未通知(无有效业务员)) */
export const TRAFFIC_ALERT_NOTIFICATION_STATUS_OPTIONS = [
{
label: '已通知',
value: PackageTrafficAlertNotificationStatus.NOTIFIED,
tagType: 'success' as const
},
{
label: '待投递',
value: PackageTrafficAlertNotificationStatus.PENDING_DELIVERY,
tagType: 'info' as const
},
{
label: '投递失败',
value: PackageTrafficAlertNotificationStatus.DELIVERY_FAILED,
tagType: 'danger' as const
},
{
label: '未通知(接收人已失效)',
value: PackageTrafficAlertNotificationStatus.NOT_NOTIFIED_RECEIVER_INVALID,
tagType: 'warning' as const
},
{
label: '未通知(无有效业务员)',
value: PackageTrafficAlertNotificationStatus.NOT_NOTIFIED_NO_VALID_OWNER,
tagType: 'warning' as const
}
]
export const getTrafficAlertNotificationStatusOption = (
status?: PackageTrafficAlertNotificationStatus | null
) => TRAFFIC_ALERT_NOTIFICATION_STATUS_OPTIONS.find((item) => item.value === status)
/** 资产类型选项(iot_card:物联网卡, device:设备) */
export const TRAFFIC_ALERT_ASSET_TYPE_OPTIONS: Array<{
label: string
value: PackageTrafficAlertAssetType
}> = [
{ label: '物联网卡', value: 'iot_card' },
{ label: '设备', value: 'device' }
]
export const getTrafficAlertAssetTypeName = (assetType?: PackageTrafficAlertAssetType | null) =>
TRAFFIC_ALERT_ASSET_TYPE_OPTIONS.find((item) => item.value === assetType)?.label || '-'
/** 导出格式选项(xlsx:Excel, csv:CSV) */
export const TRAFFIC_ALERT_EXPORT_FORMAT_OPTIONS = [
{ label: 'XLSX', value: 'xlsx' as const },
{ label: 'CSV', value: 'csv' as const }
]

View File

@@ -0,0 +1,17 @@
/**
* 支付商户与商户池管理权限编码。
* 页面和按钮统一引用这里的常量,后端菜单权限可直接复用同名编码。
* 编码命名参考代理充值页 agent_recharge:<action> 风格。
*/
export const PAYMENT_MERCHANT_POOL_PERMISSIONS = {
merchantCreate: 'payment_merchant_pool:merchant_create',
merchantEdit: 'payment_merchant_pool:merchant_edit',
merchantToggle: 'payment_merchant_pool:merchant_toggle',
merchantDelete: 'payment_merchant_pool:merchant_delete',
merchantDetail: 'payment_merchant_pool:merchant_detail',
poolCreate: 'payment_merchant_pool:pool_create',
poolEdit: 'payment_merchant_pool:pool_edit',
poolToggle: 'payment_merchant_pool:pool_toggle',
poolDetail: 'payment_merchant_pool:pool_detail',
wechatAuthEdit: 'payment_merchant_pool:wechat_auth_edit'
} as const

View File

@@ -0,0 +1,89 @@
/**
* 退款管理展示与规则常量
*/
import {
RefundStatus,
RefundMethod,
ChannelRefundStatus,
RefundFailureReason
} from '@/types/api/refund'
/** 退款状态名称映射 */
export const RefundStatusNameMap: Record<RefundStatus, string> = {
[RefundStatus.PENDING]: '待审批',
[RefundStatus.APPROVED]: '已通过',
[RefundStatus.REJECTED]: '已拒绝',
[RefundStatus.RETURNED]: '已退回',
[RefundStatus.REFUNDING]: '原路退款处理中',
[RefundStatus.REFUND_FAILED]: '原路退款失败'
}
/** 退款状态标签类型映射 */
export const RefundStatusTypeMap: Record<
RefundStatus,
'warning' | 'success' | 'danger' | 'info'
> = {
[RefundStatus.PENDING]: 'warning',
[RefundStatus.APPROVED]: 'success',
[RefundStatus.REJECTED]: 'danger',
[RefundStatus.RETURNED]: 'info',
[RefundStatus.REFUNDING]: 'warning',
[RefundStatus.REFUND_FAILED]: 'danger'
}
/** 退款方式名称映射 */
export const RefundMethodNameMap: Record<RefundMethod, string> = {
[RefundMethod.ORIGINAL_ROUTE]: '原路退回',
[RefundMethod.CUSTOMER_ACCOUNT]: '客户收款信息',
[RefundMethod.ASSET_WALLET]: '资产钱包',
[RefundMethod.AGENT_WALLET]: '代理钱包'
}
/** 渠道退款状态名称映射 */
export const ChannelRefundStatusNameMap: Record<ChannelRefundStatus, string> = {
[ChannelRefundStatus.NOT_STARTED]: '未发起或不适用',
[ChannelRefundStatus.PROCESSING]: '处理中',
[ChannelRefundStatus.SUCCEEDED]: '已成功',
[ChannelRefundStatus.FAILED]: '已失败'
}
/** 失败分类名称映射 */
export const RefundFailureReasonNameMap: Record<RefundFailureReason, string> = {
[RefundFailureReason.CHANNEL_REJECTED]: '渠道明确拒绝',
[RefundFailureReason.CREDENTIAL_INVALID]: '渠道凭证失效',
[RefundFailureReason.INSUFFICIENT_BALANCE]: '渠道余额不足',
[RefundFailureReason.TIMEOUT_UNKNOWN]: '超时或结果未知',
[RefundFailureReason.APPROVAL_REJECTED]: '企微驳回或关闭',
[RefundFailureReason.REVOKED_AFTER_APPROVED]: '企微通过后撤销',
[RefundFailureReason.PAYMENT_FACT_INVALID]: '本地原支付事实不可用'
}
/** 退款方式选项(表单用) */
export const RefundMethodOptions = [
{ label: '原路退回', value: RefundMethod.ORIGINAL_ROUTE },
{ label: '客户收款信息', value: RefundMethod.CUSTOMER_ACCOUNT },
{ label: '资产钱包', value: RefundMethod.ASSET_WALLET },
{ label: '代理钱包', value: RefundMethod.AGENT_WALLET }
]
/**
* 是否可重提:3 已拒绝 / 4 已退回 / 6 原路退款失败(anomaly_flag=1 时禁止)
*/
export const canResubmitRefund = (item: {
status?: RefundStatus
anomaly_flag?: number
}): boolean => {
if (!item.status) return false
if (item.status === RefundStatus.REJECTED || item.status === RefundStatus.RETURNED) return true
if (item.status === RefundStatus.REFUND_FAILED) return item.anomaly_flag !== 1
return false
}
/**
* 审批操作是否可用:仅待审批且未关联企微审批实例(存量无实例)的申请
*/
export const canManualApproveRefund = (item: {
status?: RefundStatus
approval_instance_id?: number | null
}): boolean => item.status === RefundStatus.PENDING && !item.approval_instance_id