feat: 订单通知 H5 双通道订阅与运单详情通知日志
All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m10s

配置页支持系统 SMTP;H5 可分别订阅微信/邮件;运单操作日志增加全部/业务/通知筛选。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-11-21 10:55:25 +08:00
parent 3ce8955472
commit 836afd30a9
10 changed files with 1277 additions and 160 deletions

View File

@ -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<CustomerWechatNotifyStatus & { Items?: CustomerWechatNotifyPrefItem[] }>(
res.data
)
const data = unwrapData<any>(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)

View File

@ -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<OrderNotifyLogListResult> {
const res = await axiosInstance.get(orderUrl('/order/notify-log/list'), {
params: { orderId: Number(orderId) },
})
const data = unwrapData<any>(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<OrderExceptionEventListResult> {
const res = await axiosInstance.get(orderUrl('/order/exception-events/list'), {

View File

@ -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<WechatOrderNotifyTemplateDto>(res.data)
return mapTemplate(unwrapData(res.data))
}
export async function trialWechatOrderNotify(body: {
eventCode: string
orderId?: number
serviceNo?: string
}) {
}): Promise<TrialWechatOrderNotifyResult> {
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))
}

View File

@ -2529,8 +2529,18 @@ export default {
'order.myOrders.drawer.tabs.stockBind': 'Bound stock',
'order.myOrders.drawer.tabs.operationLog': 'Operation log',
'order.myOrders.drawer.operationLog.empty': 'No operation logs',
'order.myOrders.drawer.operationLog.notifyEmpty': 'No notify logs',
'order.myOrders.drawer.operationLog.refresh': 'Refresh',
'order.myOrders.drawer.operationLog.count': '{count} items',
'order.myOrders.drawer.operationLog.filterAll': 'All',
'order.myOrders.drawer.operationLog.filterBusiness': 'Business',
'order.myOrders.drawer.operationLog.filterNotify': 'Notify',
'order.myOrders.drawer.operationLog.channel': 'Channel',
'order.myOrders.drawer.operationLog.event': 'Event',
'order.myOrders.drawer.operationLog.status': 'Status',
'order.myOrders.drawer.operationLog.statusSent': 'Sent',
'order.myOrders.drawer.operationLog.statusFailed': 'Failed',
'order.myOrders.drawer.operationLog.statusSkipped': 'Skipped',
'order.myOrders.drawer.operationLog.field': 'Field',
'order.myOrders.drawer.operationLog.before': 'Before',
'order.myOrders.drawer.operationLog.after': 'After',
@ -4277,11 +4287,34 @@ export default {
'system.otherConfig.brandLogo.uploadSuccess': 'Brand logo updated',
'system.otherConfig.brandLogo.uploadFailed': 'Upload failed',
'system.otherConfig.brandLogo.loadFailed': 'Failed to load brand logo',
'system.otherConfig.actions.wechatOrderNotify': 'WeChat order notify',
'system.otherConfig.wechatOrderNotify.title': 'WeChat order notify templates',
'system.otherConfig.actions.wechatOrderNotify': 'Order notify',
'system.otherConfig.wechatOrderNotify.title': 'Order notify (WeChat / Email)',
'system.otherConfig.wechatOrderNotify.tip':
'Pick an event on the left, fill the template, then enable. Customers opt in on H5 Me (off by default). Secrets stay in wechat_mp.',
'system.otherConfig.wechatOrderNotify.enableLabel': 'Enable',
'Pick an event; configure WeChat and/or email. Both channels need H5 opt-in; email goes to the customer profile address. Prefer system SMTP so it is not tied to the operator.',
'system.otherConfig.wechatOrderNotify.enableLabel': 'Enable WeChat',
'system.otherConfig.wechatOrderNotify.emailEnableLabel': 'Enable email',
'system.otherConfig.wechatOrderNotify.emailTemplate': 'Email template',
'system.otherConfig.wechatOrderNotify.emailTemplatePh': 'Select a batch-email template',
'system.otherConfig.wechatOrderNotify.emailTemplateRequired': 'Select a template when email is enabled',
'system.otherConfig.wechatOrderNotify.emailGoBatch': 'Open Batch Email to edit templates / SMTP',
'system.otherConfig.wechatOrderNotify.emailHint':
'Subject/body placeholders match Batch Email; English tokens like {serviceNo}{latestTrack} also work.',
'system.otherConfig.wechatOrderNotify.emailHintShort':
'Same placeholders as Batch Email; optional system SMTP',
'system.otherConfig.wechatOrderNotify.emailUseSystemSmtp': 'Sender',
'system.otherConfig.wechatOrderNotify.emailUseSystemSmtpHint': 'Use system SMTP (not tied to operator)',
'system.otherConfig.wechatOrderNotify.systemSmtpTitle': 'System SMTP',
'system.otherConfig.wechatOrderNotify.systemSmtpConfigured': 'Configured: {account}',
'system.otherConfig.wechatOrderNotify.systemSmtpMissing': 'System SMTP not configured yet',
'system.otherConfig.wechatOrderNotify.systemSmtpEdit': 'Configure',
'system.otherConfig.wechatOrderNotify.systemSmtpCollapse': 'Collapse',
'system.otherConfig.wechatOrderNotify.systemSmtpSave': 'Save system SMTP',
'system.otherConfig.wechatOrderNotify.systemSmtpSaveSuccess': 'System SMTP saved',
'system.otherConfig.wechatOrderNotify.systemSmtpSaveFailed': 'Failed to save system SMTP',
'system.otherConfig.wechatOrderNotify.systemSmtpUsernameRequired': 'Enter SMTP username',
'system.otherConfig.wechatOrderNotify.systemSmtpFromName': 'From display name',
'system.otherConfig.wechatOrderNotify.channelWechat': 'WeChat',
'system.otherConfig.wechatOrderNotify.channelEmail': 'Email',
'system.otherConfig.wechatOrderNotify.emptySelect': 'Select an event',
'system.otherConfig.wechatOrderNotify.templateId': 'Template ID',
'system.otherConfig.wechatOrderNotify.templateIdPh': 'MP template message ID',
@ -4292,18 +4325,25 @@ export default {
'Placeholders: {baseUrl} {orderId} {serviceNo}',
'system.otherConfig.wechatOrderNotify.fieldMapping': 'Field mapping JSON',
'system.otherConfig.wechatOrderNotify.fieldMappingPh':
'[{"key":"keyword1","placeholder":"serviceNo"}]',
'[{"key":"character_string2","placeholder":"clientNo"}]',
'system.otherConfig.wechatOrderNotify.fieldMappingTipTitle': 'Mapping example',
'system.otherConfig.wechatOrderNotify.fieldMappingTipDesc':
'key = WeChat template field (without .DATA); placeholder = OMS value. e.g. order no → character_string2, waybill → character_string15, destination → thing9, signed at → time14.',
'system.otherConfig.wechatOrderNotify.fieldMappingHelp':
'Placeholders: serviceNo / clientNo / orderStatusName / eventName / eventTime / remark / customerName / consigneeCountry',
'system.otherConfig.wechatOrderNotify.trialServiceNo': 'Trial waybill no.',
'Placeholders: serviceNo / clientNo / orderId / orderStatus / orderStatusName / eventName / eventTime / remark / customerName / consigneeCountry / payableAmount / issueContent / issueTitle / issueRemark / inboundTime / outboundTime / signTime / payTime / latestTrack',
'system.otherConfig.wechatOrderNotify.trialServiceNo': 'Waybill no.',
'system.otherConfig.wechatOrderNotify.trialServiceNoRequired': 'Enter a waybill number',
'system.otherConfig.wechatOrderNotify.trial': 'Trial send',
'system.otherConfig.wechatOrderNotify.trialPanel': 'Trial send',
'system.otherConfig.wechatOrderNotify.trialHint':
'Trial by waybill: skips subscribe/dedupe; email uses enabled template + chosen SMTP',
'system.otherConfig.wechatOrderNotify.save': 'Save event',
'system.otherConfig.wechatOrderNotify.saveSuccess': 'Saved',
'system.otherConfig.wechatOrderNotify.saveFailed': 'Save failed',
'system.otherConfig.wechatOrderNotify.loadFailed': 'Load failed',
'system.otherConfig.wechatOrderNotify.trialSuccess': 'Trial submitted (check log / WeChat)',
'system.otherConfig.wechatOrderNotify.trialSuccess': 'Trial finished',
'system.otherConfig.wechatOrderNotify.trialFailed': 'Trial failed',
'system.otherConfig.wechatOrderNotify.trialResultTitle': 'WeChat trial result',
'system.otherConfig.paymentQr.title': 'Deposit Payment QR',
'system.otherConfig.paymentQr.tip':
'Shown on PC/H5 deposit pages. Changes take effect immediately; default images are used when empty.',

View File

@ -2329,8 +2329,18 @@ export default {
'order.myOrders.drawer.tabs.stockBind': '绑定包裹/库存',
'order.myOrders.drawer.tabs.operationLog': '操作日志',
'order.myOrders.drawer.operationLog.empty': '暂无操作日志',
'order.myOrders.drawer.operationLog.notifyEmpty': '暂无通知日志',
'order.myOrders.drawer.operationLog.refresh': '刷新',
'order.myOrders.drawer.operationLog.count': '{count} 条',
'order.myOrders.drawer.operationLog.filterAll': '全部',
'order.myOrders.drawer.operationLog.filterBusiness': '业务',
'order.myOrders.drawer.operationLog.filterNotify': '通知',
'order.myOrders.drawer.operationLog.channel': '通道',
'order.myOrders.drawer.operationLog.event': '事件',
'order.myOrders.drawer.operationLog.status': '状态',
'order.myOrders.drawer.operationLog.statusSent': '成功',
'order.myOrders.drawer.operationLog.statusFailed': '失败',
'order.myOrders.drawer.operationLog.statusSkipped': '跳过',
'order.myOrders.drawer.operationLog.field': '字段',
'order.myOrders.drawer.operationLog.before': '修改前',
'order.myOrders.drawer.operationLog.after': '修改后',
@ -4289,11 +4299,34 @@ export default {
'system.otherConfig.brandLogo.uploadSuccess': '品牌 Logo 已更新',
'system.otherConfig.brandLogo.uploadFailed': '上传失败',
'system.otherConfig.brandLogo.loadFailed': '加载品牌 Logo 失败',
'system.otherConfig.actions.wechatOrderNotify': '微信订单通知',
'system.otherConfig.wechatOrderNotify.title': '微信订单通知模板',
'system.otherConfig.actions.wechatOrderNotify': '订单通知',
'system.otherConfig.wechatOrderNotify.title': '订单通知(微信 / 邮件)',
'system.otherConfig.wechatOrderNotify.tip':
'左侧选事件,右侧填模板后启用。客户需在 H5「我的」自行订阅(默认全关)。密钥沿用 wechat_mp。',
'system.otherConfig.wechatOrderNotify.enableLabel': '启用推送',
'左侧选事件;右侧分别配置微信模板消息与邮件。微信/邮件均需客户 H5 订阅;邮件发给客户资料中的邮箱。发信可选用系统 SMTP,避免绑个人账号。',
'system.otherConfig.wechatOrderNotify.enableLabel': '启用微信',
'system.otherConfig.wechatOrderNotify.emailEnableLabel': '启用邮件',
'system.otherConfig.wechatOrderNotify.emailTemplate': '邮件模板',
'system.otherConfig.wechatOrderNotify.emailTemplatePh': '选择 batch-email 模板',
'system.otherConfig.wechatOrderNotify.emailTemplateRequired': '启用邮件时请选择模板',
'system.otherConfig.wechatOrderNotify.emailGoBatch': '去批量邮件编辑模板 / SMTP',
'system.otherConfig.wechatOrderNotify.emailHint':
'主题/正文占位与批量邮件一致,另支持 {serviceNo}{payableAmount}{latestTrack}{signTime} 等英文字段。',
'system.otherConfig.wechatOrderNotify.emailHintShort':
'占位同批量邮件;可选用系统 SMTP',
'system.otherConfig.wechatOrderNotify.emailUseSystemSmtp': '发信账号',
'system.otherConfig.wechatOrderNotify.emailUseSystemSmtpHint': '使用系统发信 SMTP(与配置人解耦)',
'system.otherConfig.wechatOrderNotify.systemSmtpTitle': '系统发信 SMTP',
'system.otherConfig.wechatOrderNotify.systemSmtpConfigured': '已配置:{account}',
'system.otherConfig.wechatOrderNotify.systemSmtpMissing': '尚未配置系统发信账号',
'system.otherConfig.wechatOrderNotify.systemSmtpEdit': '配置',
'system.otherConfig.wechatOrderNotify.systemSmtpCollapse': '收起',
'system.otherConfig.wechatOrderNotify.systemSmtpSave': '保存系统 SMTP',
'system.otherConfig.wechatOrderNotify.systemSmtpSaveSuccess': '系统 SMTP 已保存',
'system.otherConfig.wechatOrderNotify.systemSmtpSaveFailed': '系统 SMTP 保存失败',
'system.otherConfig.wechatOrderNotify.systemSmtpUsernameRequired': '请填写 SMTP 账号',
'system.otherConfig.wechatOrderNotify.systemSmtpFromName': '发件人显示名',
'system.otherConfig.wechatOrderNotify.channelWechat': '微信',
'system.otherConfig.wechatOrderNotify.channelEmail': '邮件',
'system.otherConfig.wechatOrderNotify.emptySelect': '请选择左侧事件',
'system.otherConfig.wechatOrderNotify.templateId': '微信模板 ID',
'system.otherConfig.wechatOrderNotify.templateIdPh': '公众号后台模板消息 ID',
@ -4304,18 +4337,25 @@ export default {
'可用占位:{baseUrl} {orderId} {serviceNo}',
'system.otherConfig.wechatOrderNotify.fieldMapping': '字段映射 JSON',
'system.otherConfig.wechatOrderNotify.fieldMappingPh':
'[{"key":"keyword1","placeholder":"serviceNo"}]',
'[{"key":"character_string2","placeholder":"clientNo"}]',
'system.otherConfig.wechatOrderNotify.fieldMappingTipTitle': '映射示例',
'system.otherConfig.wechatOrderNotify.fieldMappingTipDesc':
'key = 微信模板字段名(去掉 .DATA);placeholder = 系统取值。例如:订单号 → character_string2、物流单号 → character_string15、目的地 → thing9、签收时间 → time14。',
'system.otherConfig.wechatOrderNotify.fieldMappingHelp':
'placeholder 可用:serviceNo / clientNo / orderStatusName / eventName / eventTime / remark / customerName / consigneeCountry',
'system.otherConfig.wechatOrderNotify.trialServiceNo': '试发运单号',
'placeholder 可用:serviceNo / clientNo / orderId / orderStatus / orderStatusName / eventName / eventTime / remark / customerName / consigneeCountry / payableAmount / issueContent / issueTitle / issueRemark / inboundTime / outboundTime / signTime / payTime / latestTrack(最新轨迹)',
'system.otherConfig.wechatOrderNotify.trialServiceNo': '运单号',
'system.otherConfig.wechatOrderNotify.trialServiceNoRequired': '请输入试发运单号',
'system.otherConfig.wechatOrderNotify.trial': '试发',
'system.otherConfig.wechatOrderNotify.trialPanel': '试发校验',
'system.otherConfig.wechatOrderNotify.trialHint':
'按运单号试发:跳过客户订阅与去重;邮件走已启用模板与所选 SMTP',
'system.otherConfig.wechatOrderNotify.save': '保存当前事件',
'system.otherConfig.wechatOrderNotify.saveSuccess': '已保存',
'system.otherConfig.wechatOrderNotify.saveFailed': '保存失败',
'system.otherConfig.wechatOrderNotify.loadFailed': '加载失败',
'system.otherConfig.wechatOrderNotify.trialSuccess': '已提交试发(请查看发送日志/微信)',
'system.otherConfig.wechatOrderNotify.trialSuccess': '试发完成',
'system.otherConfig.wechatOrderNotify.trialFailed': '试发失败',
'system.otherConfig.wechatOrderNotify.trialResultTitle': '微信试发结果',
'system.otherConfig.paymentQr.title': '充值收款码',
'system.otherConfig.paymentQr.tip':
'用于客户 PC / H5 充值页展示。更换后立即生效;未上传时前端使用默认图。',

View File

@ -22,7 +22,7 @@
</header>
<div class="h5-wx-notify__body">
<a-alert v-if="!status?.hasOpenId" type="warning" class="h5-wx-notify__alert">
<a-alert v-if="status && !status.hasOpenId" type="warning" class="h5-wx-notify__alert">
{{ t('h5.me.wechatNotifyNeedBind') }}
<template #action>
<a-button size="mini" type="primary" @click="emit('bind')">
@ -30,35 +30,55 @@
</a-button>
</template>
</a-alert>
<a-alert v-else type="success" class="h5-wx-notify__alert">
<a-alert v-else-if="status?.hasOpenId" type="success" class="h5-wx-notify__alert">
{{ t('h5.me.wechatNotifyReady') }}
</a-alert>
<a-alert v-if="status && !status.hasEmail" type="warning" class="h5-wx-notify__alert">
{{ t('h5.me.wechatNotifyNeedEmail') }}
</a-alert>
<a-alert v-else-if="status?.hasEmail" type="success" class="h5-wx-notify__alert">
{{ t('h5.me.wechatNotifyEmailReady') }}
</a-alert>
<p v-if="guideKeyEvents" class="h5-wx-notify__tip is-guide">
{{ t('h5.me.wechatNotifyGuideTip') }}
</p>
<p v-else class="h5-wx-notify__tip">{{ t('h5.me.wechatNotifyTip') }}</p>
<div v-if="loading" class="h5-wx-notify__loading">
<div v-if="loading || !status" class="h5-wx-notify__loading">
<a-spin />
</div>
<section v-else class="h5-wx-notify__list">
<label
v-for="item in items"
:key="item.eventCode"
class="h5-wx-notify__row"
>
<span class="h5-wx-notify__row-main">
<div v-for="item in items" :key="item.eventCode" class="h5-wx-notify__row">
<div class="h5-wx-notify__row-main">
<span class="h5-wx-notify__name">{{ item.eventName }}</span>
<span v-if="!item.opsEnabled" class="h5-wx-notify__badge">
{{ t('h5.me.wechatNotifyOpsOff') }}
<span class="h5-wx-notify__badges">
<span v-if="!item.opsEnabled" class="h5-wx-notify__badge">
{{ t('h5.me.wechatNotifyOpsOffWechat') }}
</span>
<span v-if="!item.opsEmailEnabled" class="h5-wx-notify__badge">
{{ t('h5.me.wechatNotifyOpsOffEmail') }}
</span>
</span>
</span>
<a-switch
v-model="item.isSubscribed"
:disabled="saving || !status?.hasOpenId"
size="small"
/>
</label>
</div>
<div class="h5-wx-notify__switches">
<label class="h5-wx-notify__switch">
<span>{{ t('h5.me.wechatNotifyChannelWechat') }}</span>
<a-switch
v-model="item.isSubscribed"
:disabled="saving || !status.hasOpenId || !item.opsEnabled"
size="small"
/>
</label>
<label class="h5-wx-notify__switch">
<span>{{ t('h5.me.wechatNotifyChannelEmail') }}</span>
<a-switch
v-model="item.isEmailSubscribed"
:disabled="saving || !status.hasEmail || !item.opsEmailEnabled"
size="small"
/>
</label>
</div>
</div>
</section>
</div>
@ -66,7 +86,7 @@
<button
type="button"
class="h5-wx-notify__btn"
:disabled="saving || loading || !status?.hasOpenId"
:disabled="saving || loading || (!status?.hasOpenId && !status?.hasEmail)"
@click="submit"
>
<span v-if="saving" class="h5-wx-notify__loading-dot" aria-hidden="true" />
@ -135,6 +155,7 @@ function applyKeyEventGuide(rows: CustomerWechatNotifyPrefItem[]) {
return rows.map((x) => ({
...x,
isSubscribed: KEY_EVENT_CODES.has(x.eventCode) ? true : x.isSubscribed,
isEmailSubscribed: KEY_EVENT_CODES.has(x.eventCode) ? true : x.isEmailSubscribed,
}));
}
@ -152,8 +173,8 @@ async function load() {
}
async function submit() {
if (!status.value?.hasOpenId) {
Message.warning(t('h5.me.wechatNotifyNeedBind'));
if (!status.value?.hasOpenId && !status.value?.hasEmail) {
Message.warning(t('h5.me.wechatNotifyNeedChannel'));
return;
}
saving.value = true;
@ -162,6 +183,7 @@ async function submit() {
items.value.map((x) => ({
eventCode: x.eventCode,
isSubscribed: !!x.isSubscribed,
isEmailSubscribed: !!x.isEmailSubscribed,
}))
);
Message.success(t('h5.me.wechatNotifySaved'));
@ -178,7 +200,8 @@ watch(
() => props.visible,
(v) => {
if (v) void load();
}
},
{ immediate: true },
);
</script>
@ -249,10 +272,14 @@ watch(
.h5-wx-notify__row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-direction: column;
gap: 10px;
padding: 12px 14px;
border-bottom: 1px solid rgba(0, 0, 0, 0.04);
&:last-child {
border-bottom: 0;
}
}
.h5-wx-notify__row-main {
@ -267,11 +294,32 @@ watch(
font-weight: 500;
}
.h5-wx-notify__badges {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.h5-wx-notify__badge {
font-size: 11px;
color: #999;
}
.h5-wx-notify__switches {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 16px;
}
.h5-wx-notify__switch {
display: inline-flex;
align-items: center;
gap: 8px;
font-size: 12px;
color: #666;
}
.h5-wx-notify__foot {
margin-top: 16px;
}

View File

@ -1090,17 +1090,24 @@ export default {
'h5.me.language': 'Switch language',
'h5.me.followOfficial': 'Follow official account',
'h5.me.followOfficialMissing': 'Official account link is not configured. Please contact support.',
'h5.me.wechatNotify': 'Order WeChat alerts',
'h5.me.wechatNotify': 'Order alerts',
'h5.me.wechatNotifyTip':
'Off by default. When enabled, order status changes are sent via Official Account template messages.',
'h5.me.wechatNotifyNeedBind': 'Bind WeChat before subscribing',
'h5.me.wechatNotifyReady': 'WeChat bound — toggle alerts as needed',
'Off by default. Enable WeChat templates and/or email per event. Email goes to your profile address.',
'h5.me.wechatNotifyNeedBind': 'Bind WeChat before enabling WeChat alerts',
'h5.me.wechatNotifyReady': 'WeChat bound — toggle WeChat alerts as needed',
'h5.me.wechatNotifyNeedEmail': 'No valid email on your profile — email alerts unavailable',
'h5.me.wechatNotifyEmailReady': 'Email on file — toggle email alerts as needed',
'h5.me.wechatNotifyNeedChannel': 'Bind WeChat or add an email before saving',
'h5.me.wechatNotifyChannelWechat': 'WeChat',
'h5.me.wechatNotifyChannelEmail': 'Email',
'h5.me.notifyNudge.title': 'Turn on key order alerts',
'h5.me.notifyNudge.desc': 'Payment due, exceptions, and delivery — don’t miss them',
'h5.me.notifyNudge.action': 'Enable',
'h5.me.notifyNudge.dismiss': 'Not now',
'h5.me.wechatNotifyGuideTip': 'Pre-checked: payment / exceptions / delivered. Adjust then save',
'h5.me.wechatNotifyOpsOff': 'Not enabled by ops',
'h5.me.wechatNotifyOpsOffWechat': 'WeChat off',
'h5.me.wechatNotifyOpsOffEmail': 'Email off',
'h5.me.wechatNotifyLoadFailed': 'Failed to load preferences',
'h5.me.wechatNotifySaved': 'Preferences saved',
'h5.me.wechatNotifySaveFailed': 'Save failed',

View File

@ -1076,16 +1076,24 @@ export default {
'h5.me.language': '切换语言',
'h5.me.followOfficial': '关注公众号',
'h5.me.followOfficialMissing': '暂未配置公众号跳转链接,请联系客服',
'h5.me.wechatNotify': '订单微信通知',
'h5.me.wechatNotifyTip': '默认关闭。开启后,对应订单状态变更将通过公众号模板消息通知你。',
'h5.me.wechatNotifyNeedBind': '请先绑定微信后再订阅通知',
'h5.me.wechatNotifyReady': '已绑定微信,可按需开启通知',
'h5.me.wechatNotify': '订单通知',
'h5.me.wechatNotifyTip':
'默认关闭。可按事件分别开启微信模板消息与邮件;邮件发至客户资料中的邮箱。',
'h5.me.wechatNotifyNeedBind': '请先绑定微信后再订阅微信通知',
'h5.me.wechatNotifyReady': '已绑定微信,可开启微信通知',
'h5.me.wechatNotifyNeedEmail': '客户资料中暂无有效邮箱,无法订阅邮件通知',
'h5.me.wechatNotifyEmailReady': '已配置邮箱,可开启邮件通知',
'h5.me.wechatNotifyNeedChannel': '请先绑定微信或完善邮箱后再保存',
'h5.me.wechatNotifyChannelWechat': '微信',
'h5.me.wechatNotifyChannelEmail': '邮件',
'h5.me.notifyNudge.title': '开启关键订单通知',
'h5.me.notifyNudge.desc': '待支付、异常、签收不错过,少盯着订单页',
'h5.me.notifyNudge.action': '去开启',
'h5.me.notifyNudge.dismiss': '暂不',
'h5.me.wechatNotifyGuideTip': '已为你勾选待支付 / 异常 / 签收,可按需调整后保存',
'h5.me.wechatNotifyOpsOff': '运营暂未启用',
'h5.me.wechatNotifyOpsOffWechat': '微信未启用',
'h5.me.wechatNotifyOpsOffEmail': '邮件未启用',
'h5.me.wechatNotifyLoadFailed': '加载订阅失败',
'h5.me.wechatNotifySaved': '订阅已保存',
'h5.me.wechatNotifySaveFailed': '保存失败',

View File

@ -767,20 +767,36 @@
<!-- 操作日志 -->
<div v-if="activeTab === 'operationLog'" class="tab-panel operation-log-info">
<div class="operation-log-filter" role="tablist">
<button
v-for="opt in operationLogFilterOptions"
:key="opt.key"
type="button"
class="operation-log-filter__btn"
:class="{ 'is-active': operationLogFilter === opt.key }"
@click="operationLogFilter = opt.key"
>
{{ opt.label }}
</button>
</div>
<a-spin :loading="operationLogLoading" class="operation-log-spin">
<a-table
v-if="operationLogList.length"
v-if="operationLogFilter === 'notify' ? notifyLogList.length : filteredOperationLogList.length"
class="operation-log-table"
row-key="id"
size="small"
:pagination="false"
:bordered="{ cell: true }"
:columns="operationLogColumns"
:data="operationLogTableData"
:columns="operationLogFilter === 'notify' ? notifyLogColumns : operationLogColumns"
:data="operationLogFilter === 'notify' ? notifyLogTableData : operationLogTableData"
/>
<a-empty
v-else-if="!operationLogLoading"
:description="$t('order.myOrders.drawer.operationLog.empty')"
:description="
operationLogFilter === 'notify'
? $t('order.myOrders.drawer.operationLog.notifyEmpty')
: $t('order.myOrders.drawer.operationLog.empty')
"
:image-style="{ height: '60px' }"
/>
</a-spin>
@ -806,11 +822,11 @@
</a-tag>
</template>
<a-tag
v-else-if="activeTab === 'operationLog' && !showEditFooter && operationLogList.length"
v-else-if="activeTab === 'operationLog' && !showEditFooter && operationLogVisibleCount > 0"
size="small"
color="arcoblue"
>
{{ $t('order.myOrders.drawer.operationLog.count', { count: operationLogList.length }) }}
{{ $t('order.myOrders.drawer.operationLog.count', { count: operationLogVisibleCount }) }}
</a-tag>
</div>
<div class="drawer-action-bar__actions">
@ -1047,7 +1063,9 @@ import {
postOrderRecalculateReceivable,
postOrderRecalculatePayable,
postOrderAdditionalServicesUpdate,
getOrderNotifyLogList,
getOrderOperationLogList,
type OrderNotifyLogItem,
type OrderOperationLogItem,
} from '@/api/order';
import { getSalesProductDetail, getSalesProductList } from '@/api/channel/salesProduct';
@ -1518,8 +1536,32 @@ const tabList = computed(() => [
{ key: 'operationLog', label: t('order.myOrders.drawer.tabs.operationLog') },
]);
const NOTIFY_OPS_ACTIONS = new Set(['notifyWechat', 'notifyEmail']);
type OperationLogFilter = 'all' | 'business' | 'notify';
const operationLogList = ref<OrderOperationLogItem[]>([]);
const notifyLogList = ref<OrderNotifyLogItem[]>([]);
const operationLogLoading = ref(false);
const operationLogFilter = ref<OperationLogFilter>('all');
const operationLogFilterOptions = computed(() => [
{ key: 'all' as const, label: t('order.myOrders.drawer.operationLog.filterAll') },
{ key: 'business' as const, label: t('order.myOrders.drawer.operationLog.filterBusiness') },
{ key: 'notify' as const, label: t('order.myOrders.drawer.operationLog.filterNotify') },
]);
const filteredOperationLogList = computed(() => {
if (operationLogFilter.value === 'business') {
return operationLogList.value.filter((x) => !NOTIFY_OPS_ACTIONS.has(x.action));
}
return operationLogList.value;
});
const operationLogVisibleCount = computed(() =>
operationLogFilter.value === 'notify'
? notifyLogList.value.length
: filteredOperationLogList.value.length,
);
const operationLogColumns = computed<TableColumnData[]>(() => [
{
@ -1546,8 +1588,38 @@ const operationLogColumns = computed<TableColumnData[]>(() => [
},
]);
const notifyLogColumns = computed<TableColumnData[]>(() => [
{
title: t('order.myOrders.drawer.operationLog.time'),
dataIndex: 'createTime',
width: 188,
bodyCellClass: 'operation-log-time-cell',
},
{
title: t('order.myOrders.drawer.operationLog.channel'),
dataIndex: 'channelName',
width: 80,
},
{
title: t('order.myOrders.drawer.operationLog.event'),
dataIndex: 'eventName',
width: 110,
},
{
title: t('order.myOrders.drawer.operationLog.status'),
dataIndex: 'statusLabel',
width: 80,
},
{
title: t('order.myOrders.drawer.operationLog.content'),
dataIndex: 'summary',
ellipsis: true,
tooltip: true,
},
]);
const operationLogTableData = computed(() =>
operationLogList.value.map((item) => ({
filteredOperationLogList.value.map((item) => ({
id: item.id,
createTime: formatOperationLogTime(item.createTime),
actionName: item.actionName || item.action || '--',
@ -1556,6 +1628,17 @@ const operationLogTableData = computed(() =>
})),
);
const notifyLogTableData = computed(() =>
notifyLogList.value.map((item) => ({
id: item.id,
createTime: formatOperationLogTime(item.createTime),
channelName: item.channelName || item.channel || '--',
eventName: item.eventName || item.eventCode || '--',
statusLabel: formatNotifyStatus(item.status),
summary: item.summary || item.errMsg || '—',
})),
);
const slidingTabItems = computed(() =>
tabList.value.map((tab) => ({ key: tab.key, label: tab.label })),
);
@ -2846,14 +2929,20 @@ async function loadOperationLogs() {
const id = orderId.value;
if (!id) {
operationLogList.value = [];
notifyLogList.value = [];
return;
}
operationLogLoading.value = true;
try {
const res = await getOrderOperationLogList(id);
operationLogList.value = res.items || [];
const [ops, notify] = await Promise.all([
getOrderOperationLogList(id),
getOrderNotifyLogList(id),
]);
operationLogList.value = ops.items || [];
notifyLogList.value = notify.items || [];
} catch {
operationLogList.value = [];
notifyLogList.value = [];
} finally {
operationLogLoading.value = false;
}
@ -2867,6 +2956,14 @@ function formatOperationLogTime(value?: string) {
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
}
function formatNotifyStatus(status?: string) {
const key = String(status || '').toLowerCase();
if (key === 'sent') return t('order.myOrders.drawer.operationLog.statusSent');
if (key === 'failed') return t('order.myOrders.drawer.operationLog.statusFailed');
if (key === 'skipped') return t('order.myOrders.drawer.operationLog.statusSkipped');
return status || '--';
}
function handleTabChange(tabKey: string) {
resetEditState();
if (tabKey === 'basic') {
@ -4328,6 +4425,35 @@ defineExpose({
}
}
.operation-log-filter {
display: inline-flex;
align-items: center;
gap: 2px;
margin-bottom: 10px;
padding: 2px;
border-radius: 8px;
background: var(--color-fill-2, #e5e6eb);
flex-shrink: 0;
}
.operation-log-filter__btn {
height: 26px;
padding: 0 12px;
border: 0;
border-radius: 6px;
background: transparent;
color: var(--color-text-2);
font-size: 12px;
font-weight: 500;
cursor: pointer;
&.is-active {
background: #fff;
color: var(--color-text-1);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
}
.operation-log-info {
display: flex;
flex-direction: column;

View File

@ -331,12 +331,66 @@
v-model:visible="wechatNotifyVisible"
:title="t('system.otherConfig.wechatOrderNotify.title')"
:footer="false"
width="920px"
width="1040px"
:mask-closable="false"
unmount-on-close
modal-class="wechat-notify-modal"
>
<p class="wechat-notify-tip">{{ t('system.otherConfig.wechatOrderNotify.tip') }}</p>
<div class="wechat-notify-system-smtp">
<div class="wechat-notify-system-smtp__head">
<div>
<strong>{{ t('system.otherConfig.wechatOrderNotify.systemSmtpTitle') }}</strong>
<p>
{{
systemSmtpStatus?.configured
? t('system.otherConfig.wechatOrderNotify.systemSmtpConfigured', {
account: systemSmtpStatus.smtpUsername || '-',
})
: t('system.otherConfig.wechatOrderNotify.systemSmtpMissing')
}}
</p>
</div>
<a-button size="mini" @click="systemSmtpFormVisible = !systemSmtpFormVisible">
{{
systemSmtpFormVisible
? t('system.otherConfig.wechatOrderNotify.systemSmtpCollapse')
: t('system.otherConfig.wechatOrderNotify.systemSmtpEdit')
}}
</a-button>
</div>
<div v-if="systemSmtpFormVisible" class="wechat-notify-system-smtp__form">
<a-form :model="systemSmtpForm" layout="vertical" size="small">
<a-form-item :label="t('system.batchEmail.account')">
<a-input v-model="systemSmtpForm.smtpUsername" allow-clear />
</a-form-item>
<a-form-item :label="t('system.batchEmail.password')">
<a-input-password v-model="systemSmtpForm.smtpPassword" allow-clear />
</a-form-item>
<a-form-item :label="t('system.batchEmail.serverType')">
<a-select v-model="systemSmtpForm.serverType">
<a-option value="qiye">{{ t('system.batchEmail.server.qiye') }}</a-option>
<a-option value="qiye_ssl">{{ t('system.batchEmail.server.qiyeSsl') }}</a-option>
<a-option value="aliyun">{{ t('system.batchEmail.server.aliyun') }}</a-option>
<a-option value="aliyun_ssl">{{ t('system.batchEmail.server.aliyunSsl') }}</a-option>
<a-option value="mxhichina">{{ t('system.batchEmail.server.mxhichina') }}</a-option>
</a-select>
</a-form-item>
<a-form-item :label="t('system.otherConfig.wechatOrderNotify.systemSmtpFromName')">
<a-input v-model="systemSmtpForm.fromName" allow-clear />
</a-form-item>
<a-button
type="primary"
class="app-btn-primary-soft"
size="small"
:loading="systemSmtpSaving"
@click="handleSaveSystemSmtp"
>
{{ t('system.otherConfig.wechatOrderNotify.systemSmtpSave') }}
</a-button>
</a-form>
</div>
</div>
<div v-if="wechatNotifyLoading" class="wechat-notify-loading">
<a-spin />
</div>
@ -354,83 +408,209 @@
<span class="wechat-notify-nav__name">{{ item.eventName }}</span>
<span class="wechat-notify-nav__code">{{ item.eventCode }}</span>
</span>
<span
class="wechat-notify-nav__status"
:class="item.isEnabled ? 'is-on' : 'is-off'"
>
{{
item.isEnabled
? t('system.otherConfig.status.enabled')
: t('system.otherConfig.status.disabled')
}}
<span class="wechat-notify-nav__channels">
<span
class="wechat-notify-nav__chip"
:class="item.isEnabled ? 'is-on' : 'is-off'"
>
{{ t('system.otherConfig.wechatOrderNotify.channelWechat') }}
</span>
<span
class="wechat-notify-nav__chip"
:class="item.emailEnabled ? 'is-on' : 'is-off'"
>
{{ t('system.otherConfig.wechatOrderNotify.channelEmail') }}
</span>
</span>
</button>
</aside>
<section v-if="wechatNotifyActive" class="wechat-notify-editor">
<header class="wechat-notify-editor__head">
<div>
<div class="wechat-notify-editor__head-main">
<h3 class="wechat-notify-editor__title">{{ wechatNotifyActive.eventName }}</h3>
<p class="wechat-notify-editor__sub">{{ wechatNotifyActive.eventCode }}</p>
<code class="wechat-notify-editor__sub">{{ wechatNotifyActive.eventCode }}</code>
</div>
<div class="wechat-notify-editor__enable">
<span class="wechat-notify-editor__enable-label">{{
t('system.otherConfig.wechatOrderNotify.enableLabel')
}}</span>
<a-switch v-model="wechatNotifyActive.isEnabled" />
<div class="wechat-notify-editor__seg" role="tablist">
<button
type="button"
class="wechat-notify-editor__seg-btn"
:class="{ 'is-active': wechatNotifyChannelTab === 'wechat' }"
@click="wechatNotifyChannelTab = 'wechat'"
>
{{ t('system.otherConfig.wechatOrderNotify.channelWechat') }}
</button>
<button
type="button"
class="wechat-notify-editor__seg-btn"
:class="{ 'is-active': wechatNotifyChannelTab === 'email' }"
@click="wechatNotifyChannelTab = 'email'"
>
{{ t('system.otherConfig.wechatOrderNotify.channelEmail') }}
</button>
</div>
</header>
<a-form
:model="wechatNotifyActive"
layout="vertical"
class="wechat-notify-editor__form"
>
<a-form-item
:label="t('system.otherConfig.wechatOrderNotify.templateId')"
required
<div class="wechat-notify-editor__scroll">
<a-form
v-show="wechatNotifyChannelTab === 'wechat'"
:model="wechatNotifyActive"
layout="vertical"
class="wechat-notify-editor__form"
>
<a-input
v-model="wechatNotifyActive.templateId"
allow-clear
:placeholder="t('system.otherConfig.wechatOrderNotify.templateIdPh')"
/>
</a-form-item>
<a-form-item :label="t('system.otherConfig.wechatOrderNotify.urlTemplate')">
<a-input
v-model="wechatNotifyActive.urlTemplate"
allow-clear
:placeholder="t('system.otherConfig.wechatOrderNotify.urlTemplatePh')"
/>
<template #extra>
<span class="wechat-notify-help">{{
t('system.otherConfig.wechatOrderNotify.urlHelp')
}}</span>
</template>
</a-form-item>
<a-form-item :label="t('system.otherConfig.wechatOrderNotify.fieldMapping')">
<a-textarea
v-model="wechatNotifyActive.fieldMappingJson"
:auto-size="{ minRows: 4, maxRows: 8 }"
:placeholder="t('system.otherConfig.wechatOrderNotify.fieldMappingPh')"
/>
<template #extra>
<span class="wechat-notify-help">{{
t('system.otherConfig.wechatOrderNotify.fieldMappingHelp')
}}</span>
</template>
</a-form-item>
<a-form-item :label="t('system.otherConfig.form.remark')">
<a-input v-model="wechatNotifyActive.remark" allow-clear />
</a-form-item>
</a-form>
<div class="wechat-notify-editor__toolbar">
<label class="wechat-notify-editor__enable">
<a-switch
v-model="wechatNotifyActive.isEnabled"
size="small"
class="wechat-notify-enable-switch"
/>
<span class="wechat-notify-editor__enable-label">{{
t('system.otherConfig.wechatOrderNotify.enableLabel')
}}</span>
</label>
<a-input
v-model="wechatNotifyActive.remark"
allow-clear
class="wechat-notify-editor__remark"
:placeholder="t('system.otherConfig.form.remark')"
/>
</div>
<div class="wechat-notify-editor__row">
<a-form-item
class="wechat-notify-editor__field"
:label="t('system.otherConfig.wechatOrderNotify.templateId')"
required
>
<a-input
v-model="wechatNotifyActive.templateId"
allow-clear
:placeholder="t('system.otherConfig.wechatOrderNotify.templateIdPh')"
/>
</a-form-item>
<a-form-item
class="wechat-notify-editor__field"
:label="t('system.otherConfig.wechatOrderNotify.urlTemplate')"
>
<a-input
v-model="wechatNotifyActive.urlTemplate"
allow-clear
:placeholder="t('system.otherConfig.wechatOrderNotify.urlTemplatePh')"
/>
</a-form-item>
</div>
<a-form-item class="wechat-notify-editor__mapping-item">
<template #label>
<span class="wechat-notify-editor__label">
{{ t('system.otherConfig.wechatOrderNotify.fieldMapping') }}
<a-popover position="rt" :content-style="{ maxWidth: '440px' }">
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
<template #content>
<div class="wechat-notify-mapping-tip">
<p class="wechat-notify-mapping-tip__title">{{
t('system.otherConfig.wechatOrderNotify.fieldMappingTipTitle')
}}</p>
<p class="wechat-notify-mapping-tip__desc">{{
t('system.otherConfig.wechatOrderNotify.fieldMappingTipDesc')
}}</p>
<pre class="wechat-notify-mapping-tip__sample">{{
wechatFieldMappingSample
}}</pre>
<p class="wechat-notify-mapping-tip__desc">{{
t('system.otherConfig.wechatOrderNotify.fieldMappingHelp')
}}</p>
<p class="wechat-notify-mapping-tip__desc">{{
t('system.otherConfig.wechatOrderNotify.urlHelp')
}}</p>
</div>
</template>
</a-popover>
</span>
</template>
<a-textarea
v-model="wechatNotifyActive.fieldMappingJson"
:auto-size="{ minRows: 6, maxRows: 12 }"
class="wechat-notify-editor__mapping"
:placeholder="t('system.otherConfig.wechatOrderNotify.fieldMappingPh')"
/>
</a-form-item>
</a-form>
<a-form
v-show="wechatNotifyChannelTab === 'email'"
:model="wechatNotifyActive"
layout="vertical"
class="wechat-notify-editor__form"
>
<div class="wechat-notify-editor__toolbar">
<label class="wechat-notify-editor__enable">
<a-switch
v-model="wechatNotifyActive.emailEnabled"
size="small"
class="wechat-notify-enable-switch"
/>
<span class="wechat-notify-editor__enable-label">{{
t('system.otherConfig.wechatOrderNotify.emailEnableLabel')
}}</span>
</label>
<a-button type="text" size="mini" class="wechat-notify-editor__link" @click="goBatchEmail">
{{ t('system.otherConfig.wechatOrderNotify.emailGoBatch') }}
</a-button>
</div>
<a-form-item
:label="t('system.otherConfig.wechatOrderNotify.emailTemplate')"
:required="!!wechatNotifyActive.emailEnabled"
>
<a-select
v-model="wechatNotifyActive.emailTemplateName"
allow-clear
allow-search
:loading="batchEmailTplLoading"
:placeholder="t('system.otherConfig.wechatOrderNotify.emailTemplatePh')"
:options="batchEmailTplOptions"
/>
<template #extra>
<span class="wechat-notify-help">{{
t('system.otherConfig.wechatOrderNotify.emailHintShort')
}}</span>
</template>
</a-form-item>
<a-form-item :label="t('system.otherConfig.wechatOrderNotify.emailUseSystemSmtp')">
<label class="wechat-notify-editor__enable">
<a-switch
v-model="wechatNotifyActive.emailUseSystemSmtp"
size="small"
class="wechat-notify-enable-switch"
:disabled="!wechatNotifyActive.emailEnabled"
/>
<span class="wechat-notify-editor__enable-label">{{
t('system.otherConfig.wechatOrderNotify.emailUseSystemSmtpHint')
}}</span>
</label>
</a-form-item>
<div v-if="selectedBatchEmailTpl" class="wechat-notify-email-preview">
<div class="wechat-notify-email-preview__row">
<span>{{ t('system.batchEmail.subject') }}</span>
<strong>{{ selectedBatchEmailTpl.subject || '-' }}</strong>
</div>
<pre class="wechat-notify-email-preview__body">{{
selectedBatchEmailTpl.content || ''
}}</pre>
</div>
</a-form>
</div>
<footer class="wechat-notify-editor__foot">
<div class="wechat-notify-editor__trial">
<div class="wechat-notify-editor__trial-actions">
<a-tooltip :content="t('system.otherConfig.wechatOrderNotify.trialHint')">
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
<a-input
v-model="wechatTrialServiceNo[wechatNotifyActive.eventCode]"
allow-clear
class="wechat-notify-editor__trial-input"
:placeholder="t('system.otherConfig.wechatOrderNotify.trialServiceNo')"
@press-enter="handleWechatTrial(wechatNotifyActive.eventCode)"
/>
<a-button
:loading="wechatTrialLoading[wechatNotifyActive.eventCode]"
@ -441,7 +621,7 @@
</div>
<a-button
type="primary"
class="app-btn-primary-soft"
class="app-btn-primary-soft wechat-notify-editor__save"
:loading="wechatSaveLoading[wechatNotifyActive.eventCode]"
@click="handleWechatSave(wechatNotifyActive)"
>
@ -455,6 +635,16 @@
</div>
</a-modal>
<a-modal
v-model:visible="wechatTrialResultVisible"
:title="t('system.otherConfig.wechatOrderNotify.trialResultTitle')"
:width="720"
:footer="false"
unmount-on-close
>
<pre class="wechat-trial-result">{{ wechatTrialResultText }}</pre>
</a-modal>
<a-modal
v-model:visible="paymentQrVisible"
:title="t('system.otherConfig.paymentQr.title')"
@ -636,8 +826,16 @@
<script setup lang="ts">
import { computed, onMounted, reactive, ref, watch } from 'vue'
import { useRouter } from 'vue-router'
import { Message, Modal } from '@arco-design/web-vue'
import { IconQuestionCircle } from '@arco-design/web-vue/es/icon'
import { useI18n } from 'vue-i18n'
import {
listBatchEmailTemplates,
SMTP_SECRET_MASK,
type BatchEmailServerType,
type BatchEmailTemplate,
} from '@/api/system/batchEmail'
import {
API_CENTER_CONFIG_CODE,
PICKUP_OPEN_API_CONFIG_CODE,
@ -666,9 +864,13 @@ import {
rememberBrandImageFile,
} from '@/utils/brandLogo'
import {
formatWechatTrialResultText,
getOrderNotifySystemSmtp,
getWechatOrderNotifyTemplates,
saveOrderNotifySystemSmtp,
saveWechatOrderNotifyTemplate,
trialWechatOrderNotify,
type OrderNotifySystemSmtpStatus,
type WechatOrderNotifyTemplateDto,
} from '@/api/system/wechatOrderNotify'
import { resolveOmsAssetUrl } from '@/api/oms/common'
@ -679,6 +881,7 @@ defineOptions({
})
const { t } = useI18n()
const router = useRouter()
function defaultSiteOrigin(): string {
if (typeof window !== 'undefined' && window.location?.origin) {
@ -1289,9 +1492,30 @@ const wechatNotifyVisible = ref(false)
const wechatNotifyLoading = ref(false)
const wechatNotifyTemplates = ref<WechatOrderNotifyTemplateDto[]>([])
const wechatNotifyActiveCode = ref('')
const wechatNotifyChannelTab = ref<'wechat' | 'email'>('wechat')
const wechatSaveLoading = reactive<Record<string, boolean>>({})
const wechatTrialLoading = reactive<Record<string, boolean>>({})
const wechatTrialServiceNo = reactive<Record<string, string>>({})
const wechatTrialResultVisible = ref(false)
const wechatTrialResultText = ref('')
const batchEmailTplLoading = ref(false)
const batchEmailTemplates = ref<BatchEmailTemplate[]>([])
const systemSmtpStatus = ref<OrderNotifySystemSmtpStatus | null>(null)
const systemSmtpFormVisible = ref(false)
const systemSmtpSaving = ref(false)
const systemSmtpForm = reactive({
smtpUsername: '',
smtpPassword: '',
serverType: 'qiye' as BatchEmailServerType,
fromName: '',
})
/** 字段映射问号气泡示例(类目模板字段名 + OMS placeholder) */
const wechatFieldMappingSample = `[
{"key":"character_string2","placeholder":"clientNo"},
{"key":"character_string15","placeholder":"serviceNo"},
{"key":"thing9","placeholder":"consigneeCountry"},
{"key":"time14","placeholder":"signTime"}
]`
const wechatNotifyActive = computed(() => {
const code = wechatNotifyActiveCode.value
@ -1299,10 +1523,75 @@ const wechatNotifyActive = computed(() => {
return wechatNotifyTemplates.value.find((x) => x.eventCode === code) ?? null
})
const batchEmailTplOptions = computed(() =>
batchEmailTemplates.value.map((x) => ({ label: x.name, value: x.name })),
)
const selectedBatchEmailTpl = computed(() => {
const name = wechatNotifyActive.value?.emailTemplateName
if (!name) return null
return batchEmailTemplates.value.find((x) => x.name === name) ?? null
})
async function loadBatchEmailTemplatesForNotify() {
batchEmailTplLoading.value = true
try {
batchEmailTemplates.value = await listBatchEmailTemplates()
} catch {
batchEmailTemplates.value = []
} finally {
batchEmailTplLoading.value = false
}
}
function goBatchEmail() {
wechatNotifyVisible.value = false
void router.push('/system/batchEmail')
}
async function loadSystemSmtpStatus() {
try {
const status = await getOrderNotifySystemSmtp()
systemSmtpStatus.value = status
systemSmtpForm.smtpUsername = status.smtpUsername || ''
systemSmtpForm.fromName = status.fromName || ''
systemSmtpForm.smtpPassword = status.configured ? SMTP_SECRET_MASK : ''
} catch {
systemSmtpStatus.value = { configured: false }
}
}
async function handleSaveSystemSmtp() {
if (!String(systemSmtpForm.smtpUsername || '').trim()) {
Message.warning(t('system.otherConfig.wechatOrderNotify.systemSmtpUsernameRequired'))
return
}
systemSmtpSaving.value = true
try {
systemSmtpStatus.value = await saveOrderNotifySystemSmtp({
smtpUsername: systemSmtpForm.smtpUsername.trim(),
smtpPassword: systemSmtpForm.smtpPassword || SMTP_SECRET_MASK,
serverType: systemSmtpForm.serverType,
fromName: systemSmtpForm.fromName || null,
})
systemSmtpForm.smtpPassword = SMTP_SECRET_MASK
systemSmtpFormVisible.value = false
Message.success(t('system.otherConfig.wechatOrderNotify.systemSmtpSaveSuccess'))
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.wechatOrderNotify.systemSmtpSaveFailed'))
} finally {
systemSmtpSaving.value = false
}
}
async function loadWechatNotifyTemplates() {
wechatNotifyLoading.value = true
try {
const list = await getWechatOrderNotifyTemplates()
const [list] = await Promise.all([
getWechatOrderNotifyTemplates(),
loadBatchEmailTemplatesForNotify(),
loadSystemSmtpStatus(),
])
wechatNotifyTemplates.value = list.map((x) => ({
...x,
templateId: x.templateId ?? '',
@ -1310,6 +1599,9 @@ async function loadWechatNotifyTemplates() {
fieldMappingJson: x.fieldMappingJson ?? '',
remark: x.remark ?? '',
isEnabled: !!x.isEnabled,
emailEnabled: !!x.emailEnabled,
emailTemplateName: x.emailTemplateName ?? '',
emailUseSystemSmtp: !!x.emailUseSystemSmtp,
}))
if (
!wechatNotifyActiveCode.value ||
@ -1326,11 +1618,24 @@ async function loadWechatNotifyTemplates() {
async function openWechatNotifyModal() {
wechatNotifyActiveCode.value = ''
wechatNotifyChannelTab.value = 'wechat'
systemSmtpFormVisible.value = false
wechatNotifyVisible.value = true
await loadWechatNotifyTemplates()
}
async function handleWechatSave(item: WechatOrderNotifyTemplateDto) {
if (item.emailEnabled && !String(item.emailTemplateName || '').trim()) {
Message.warning(t('system.otherConfig.wechatOrderNotify.emailTemplateRequired'))
wechatNotifyChannelTab.value = 'email'
return
}
if (item.emailEnabled && item.emailUseSystemSmtp && !systemSmtpStatus.value?.configured) {
Message.warning(t('system.otherConfig.wechatOrderNotify.systemSmtpMissing'))
systemSmtpFormVisible.value = true
wechatNotifyChannelTab.value = 'email'
return
}
wechatSaveLoading[item.eventCode] = true
try {
const saved = await saveWechatOrderNotifyTemplate({
@ -1339,9 +1644,20 @@ async function handleWechatSave(item: WechatOrderNotifyTemplateDto) {
urlTemplate: item.urlTemplate || null,
fieldMappingJson: item.fieldMappingJson || null,
isEnabled: !!item.isEnabled,
emailEnabled: !!item.emailEnabled,
emailTemplateName: item.emailTemplateName || null,
emailUseSystemSmtp: !!item.emailUseSystemSmtp,
remark: item.remark || null,
})
Object.assign(item, saved)
Object.assign(item, {
...saved,
templateId: saved.templateId ?? '',
urlTemplate: saved.urlTemplate ?? '',
fieldMappingJson: saved.fieldMappingJson ?? '',
remark: saved.remark ?? '',
emailTemplateName: saved.emailTemplateName ?? '',
emailUseSystemSmtp: !!saved.emailUseSystemSmtp,
})
Message.success(t('system.otherConfig.wechatOrderNotify.saveSuccess'))
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.wechatOrderNotify.saveFailed'))
@ -1358,8 +1674,16 @@ async function handleWechatTrial(eventCode: string) {
}
wechatTrialLoading[eventCode] = true
try {
await trialWechatOrderNotify({ eventCode, serviceNo })
Message.success(t('system.otherConfig.wechatOrderNotify.trialSuccess'))
const result = await trialWechatOrderNotify({ eventCode, serviceNo })
wechatTrialResultText.value = formatWechatTrialResultText(result)
wechatTrialResultVisible.value = true
if (result.success) {
Message.success(t('system.otherConfig.wechatOrderNotify.trialSuccess'))
} else if (result.skipped) {
Message.warning(result.message || t('system.otherConfig.wechatOrderNotify.trialFailed'))
} else {
Message.error(result.message || t('system.otherConfig.wechatOrderNotify.trialFailed'))
}
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.wechatOrderNotify.trialFailed'))
} finally {
@ -2226,6 +2550,39 @@ onMounted(() => {
}
}
.wechat-notify-system-smtp {
margin: 0 0 12px;
padding: 10px 12px;
border-radius: 8px;
background: var(--color-fill-2, #f2f3f5);
}
.wechat-notify-system-smtp__head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
strong {
display: block;
font-size: 13px;
margin-bottom: 4px;
}
p {
margin: 0;
font-size: 12px;
color: var(--color-text-3);
line-height: 1.45;
}
}
.wechat-notify-system-smtp__form {
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid var(--color-border-2, #e5e6eb);
}
.wechat-notify-tip {
margin: 0 0 12px;
padding: 10px 12px;
@ -2245,10 +2602,10 @@ onMounted(() => {
.wechat-notify-layout {
display: grid;
grid-template-columns: 220px minmax(0, 1fr);
grid-template-columns: 200px minmax(0, 1fr);
gap: 0;
min-height: 420px;
max-height: min(62vh, 560px);
min-height: 480px;
max-height: min(72vh, 680px);
border: 1px solid var(--color-border-2);
border-radius: 8px;
overflow: hidden;
@ -2308,16 +2665,23 @@ onMounted(() => {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.wechat-notify-nav__status {
.wechat-notify-nav__channels {
display: flex;
flex-direction: column;
gap: 4px;
flex-shrink: 0;
padding: 1px 6px;
}
.wechat-notify-nav__chip {
padding: 0 6px;
border-radius: 999px;
font-size: 11px;
line-height: 18px;
text-align: center;
&.is-on {
color: var(--app-primary-color, #1d7281);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 14%, #fff);
color: #00b42a;
background: color-mix(in srgb, #00b42a 14%, #fff);
}
&.is-off {
@ -2326,12 +2690,48 @@ onMounted(() => {
}
}
.wechat-notify-editor__link {
padding: 0 4px;
height: 28px;
color: var(--app-primary-color, #1d7281);
}
.wechat-notify-email-preview {
padding: 10px 12px;
border-radius: 8px;
background: var(--color-fill-2);
border: 1px solid var(--color-border-2);
}
.wechat-notify-email-preview__row {
display: flex;
gap: 8px;
margin-bottom: 8px;
font-size: 12px;
color: var(--color-text-3);
strong {
color: var(--color-text-1);
font-weight: 600;
}
}
.wechat-notify-email-preview__body {
margin: 0;
max-height: 220px;
overflow: auto;
font-size: 12px;
line-height: 1.5;
white-space: pre-wrap;
word-break: break-word;
color: var(--color-text-2);
}
.wechat-notify-editor {
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
padding: 14px 16px 12px;
background: #fff;
}
@ -2344,25 +2744,120 @@ onMounted(() => {
.wechat-notify-editor__head {
display: flex;
align-items: flex-start;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
padding-bottom: 12px;
flex-shrink: 0;
padding: 10px 16px;
border-bottom: 1px solid var(--color-border-2);
background: #fafbfc;
}
.wechat-notify-editor__head-main {
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 8px;
min-width: 0;
}
.wechat-notify-editor__seg {
display: inline-flex;
padding: 2px;
border-radius: 8px;
background: var(--color-fill-2, #e5e6eb);
flex-shrink: 0;
}
.wechat-notify-editor__seg-btn {
height: 26px;
padding: 0 12px;
border: 0;
border-radius: 6px;
background: transparent;
color: var(--color-text-2);
font-size: 12px;
font-weight: 500;
cursor: pointer;
&.is-active {
background: #fff;
color: var(--color-text-1);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
}
.wechat-notify-editor__toolbar {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
}
.wechat-notify-editor__remark {
flex: 1;
min-width: 0;
max-width: 280px;
}
.wechat-notify-editor__label {
display: inline-flex;
align-items: center;
gap: 4px;
}
.wechat-notify-editor__help-icon {
color: var(--color-text-3);
font-size: 14px;
cursor: help;
&:hover {
color: var(--app-primary-color, #1d7281);
}
}
.wechat-notify-mapping-tip__title {
margin: 0 0 6px;
font-size: 13px;
font-weight: 600;
color: var(--color-text-1);
}
.wechat-notify-mapping-tip__desc {
margin: 0 0 8px;
font-size: 12px;
line-height: 1.5;
color: var(--color-text-2);
}
.wechat-notify-mapping-tip__sample {
margin: 0;
padding: 8px 10px;
border-radius: 4px;
background: var(--color-fill-2);
font-size: 12px;
line-height: 1.55;
white-space: pre-wrap;
word-break: break-all;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
color: var(--color-text-1);
}
.wechat-notify-editor__title {
margin: 0;
font-size: 16px;
font-size: 15px;
font-weight: 600;
color: var(--color-text-1);
}
.wechat-notify-editor__sub {
margin: 4px 0 0;
font-size: 12px;
margin: 0;
padding: 1px 6px;
border-radius: 4px;
font-size: 11px;
line-height: 18px;
color: var(--color-text-3);
background: var(--color-fill-2, #e5e6eb);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@ -2371,7 +2866,18 @@ onMounted(() => {
align-items: center;
gap: 8px;
flex-shrink: 0;
height: 32px;
height: 28px;
margin: 0;
cursor: pointer;
}
/* 覆盖 global.less 里 body .arco-switch-checked 的主色蓝 */
.wechat-notify-editor :deep(.wechat-notify-enable-switch.arco-switch-checked) {
background-color: #00b42a !important;
}
.wechat-notify-editor :deep(.wechat-notify-enable-switch.arco-switch-checked:hover) {
background-color: #23c343 !important;
}
.wechat-notify-editor__enable-label {
@ -2379,19 +2885,41 @@ onMounted(() => {
color: var(--color-text-2);
}
.wechat-notify-editor__form {
.wechat-notify-editor__scroll {
flex: 1;
min-height: 0;
overflow: auto;
padding-right: 4px;
padding: 12px 16px;
}
.wechat-notify-editor__form {
:deep(.arco-form-item) {
margin-bottom: 14px;
margin-bottom: 12px;
}
:deep(.arco-form-item-label-col > .arco-form-item-label) {
font-weight: 500;
}
:deep(.wechat-notify-editor__mapping-item) {
margin-bottom: 0;
}
}
.wechat-notify-editor__row {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
gap: 12px;
}
.wechat-notify-editor__field {
min-width: 0;
}
.wechat-notify-editor__mapping {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
line-height: 1.5;
}
.wechat-notify-help {
@ -2407,18 +2935,42 @@ onMounted(() => {
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 4px;
padding-top: 12px;
flex-shrink: 0;
padding: 10px 16px;
border-top: 1px solid var(--color-border-2);
background: #fafbfc;
}
.wechat-notify-editor__trial {
.wechat-notify-editor__trial-actions {
display: flex;
align-items: center;
gap: 8px;
flex: 1;
min-width: 0;
max-width: 420px;
max-width: 480px;
}
.wechat-notify-editor__trial-input {
flex: 1;
min-width: 0;
}
.wechat-notify-editor__save {
flex-shrink: 0;
height: 32px;
}
.wechat-trial-result {
margin: 0;
max-height: 480px;
overflow: auto;
padding: 12px;
background: var(--color-fill-2);
border-radius: 4px;
font-size: 12px;
line-height: 1.6;
white-space: pre-wrap;
word-break: break-all;
}
:deep(.wechat-notify-modal .arco-modal-body) {
@ -2444,13 +2996,33 @@ onMounted(() => {
flex: 1 1 calc(50% - 4px);
}
.wechat-notify-editor__row {
grid-template-columns: 1fr;
}
.wechat-notify-editor__foot {
flex-direction: column;
align-items: stretch;
}
.wechat-notify-editor__trial {
.wechat-notify-editor__trial-actions {
max-width: none;
}
.wechat-notify-editor__head {
flex-wrap: wrap;
}
.wechat-notify-editor__toolbar {
flex-wrap: wrap;
}
.wechat-notify-editor__remark {
max-width: none;
}
.wechat-notify-editor__save {
width: 100%;
}
}
</style>