front/src/views/system/otherConfig/index.vue
zzh d9185f34ed
Some checks failed
Build and Deploy Front / deploy (push) Failing after 3m53s
feat: 支付可选跳过余额,配置项提示与构建内存收敛
混合支付支持 UseBalance;微信/支付宝配置改为问号提示;Vite 堆降至 4G 并关闭 gzip 体积统计,减轻生产同机 CI 压力。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-12-04 17:19:53 +08:00

5385 lines
176 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="other-config-container">
<div class="other-config-page-card">
<div class="page-header">
<div class="page-header-main">
<h2 class="page-title">{{ t('system.otherConfig.pageTitle') }}</h2>
<p class="page-desc">{{ t('system.otherConfig.pageDesc') }}</p>
</div>
<div class="page-header-actions">
<div class="page-header-actions__group" role="group">
<a-button
class="header-tool-btn"
:loading="
listLoading ||
paymentQrLoading ||
brandLogoLoading ||
wechatNotifyLoading ||
wechatPayLoading ||
alipayPayLoading
"
@click="refreshCurrent"
>
<template #icon><icon-refresh /></template>
{{ t('system.otherConfig.actions.refresh') }}
</a-button>
<a-button type="primary" class="app-btn-primary-soft" @click="handleAdd">
<template #icon><icon-plus /></template>
{{ t('system.otherConfig.actions.add') }}
</a-button>
</div>
</div>
</div>
<div v-if="listLoading && !list.length" class="config-empty">
<a-spin />
</div>
<div v-else class="config-workspace">
<aside class="config-nav">
<div class="config-nav__search">
<a-input
v-model="keyword"
allow-clear
:placeholder="t('system.otherConfig.search.placeholder')"
>
<template #prefix>
<icon-search />
</template>
</a-input>
<span class="config-nav__count">
{{
t('system.otherConfig.search.count', {
count: filteredOpsNavItems.length + filteredList.length,
})
}}
</span>
</div>
<div
v-if="!filteredOpsNavItems.length && !filteredList.length"
class="config-nav__empty"
>
{{ t('system.otherConfig.empty.title') }}
</div>
<div v-else class="config-nav__list">
<template v-if="filteredOpsNavItems.length">
<p class="config-nav__group">{{ t('system.otherConfig.nav.ops') }}</p>
<button
v-for="item in filteredOpsNavItems"
:key="item.key"
type="button"
class="config-nav__item"
:class="{ 'is-active': activePanel === item.key }"
@click="selectOpsPanel(item.key)"
>
<span class="config-nav__main">
<span class="config-nav__name">{{ item.name }}</span>
<span class="config-nav__code">{{ item.desc }}</span>
</span>
</button>
</template>
<template v-if="filteredList.length">
<p class="config-nav__group">{{ t('system.otherConfig.nav.integration') }}</p>
<button
v-for="item in filteredList"
:key="item.id"
type="button"
class="config-nav__item"
:class="{
'is-active':
activePanel === 'config' && String(item.id) === String(editingId),
'is-disabled': !item.enabled,
}"
@click="selectConfig(item)"
>
<span class="config-nav__main">
<span class="config-nav__name">{{ item.configName || '-' }}</span>
<span class="config-nav__code">{{ item.configCode || '-' }}</span>
</span>
<span class="config-nav__status" :class="item.enabled ? 'is-on' : 'is-off'">
{{
item.enabled
? t('system.otherConfig.status.enabled')
: t('system.otherConfig.status.disabled')
}}
</span>
</button>
</template>
</div>
</aside>
<section class="config-editor">
<template v-if="activePanel === 'paymentQr'">
<header class="config-editor__head">
<div>
<h3 class="config-editor__title">{{ t('system.otherConfig.paymentQr.title') }}</h3>
<p class="config-editor__sub">{{ t('system.otherConfig.paymentQr.tip') }}</p>
</div>
</header>
<a-tabs
v-model:active-key="paymentQrTab"
type="rounded"
size="small"
class="brand-config-tabs"
@change="onPaymentQrTabChange"
>
<a-tab-pane key="qr" :title="t('system.otherConfig.paymentQr.tab.qr')">
<div v-if="paymentQrLoading" class="payment-qr-loading">
<a-spin />
</div>
<div v-else class="brand-logo-grid ops-panel-grid">
<div
v-for="item in paymentQrCards"
:key="item.channel"
class="brand-logo-card"
>
<div class="brand-logo-card__meta">
<div class="brand-logo-card__meta-text">
<span class="brand-logo-card__title">{{ item.title }}</span>
</div>
<a-button
v-if="item.url"
class="brand-logo-card__clear"
size="mini"
:loading="item.uploading"
@click.stop="handlePaymentQrClear(item.channel)"
>
{{ t('system.otherConfig.paymentQr.clear') }}
</a-button>
</div>
<div
class="brand-logo-card__zone"
:class="{
'is-filled': !!item.url,
'is-uploading': item.uploading,
'is-dragover': paymentQrDragOver[item.channel],
}"
@click="openPaymentQrPicker(item.channel)"
@dragenter.prevent="onPaymentQrDragEnter(item.channel)"
@dragover.prevent="onPaymentQrDragEnter(item.channel)"
@dragleave.prevent="onPaymentQrDragLeave(item.channel, $event)"
@drop.prevent="onPaymentQrDrop(item.channel, $event)"
>
<template v-if="item.url">
<img
class="brand-logo-card__img brand-logo-card__img--qr"
:src="item.url"
:alt="item.title"
draggable="false"
/>
<div v-if="item.uploading" class="brand-logo-card__mask is-busy">
<a-spin />
<span>{{ t('system.otherConfig.paymentQr.uploading') }}</span>
</div>
<div v-else class="brand-logo-card__mask">
{{ t('system.otherConfig.paymentQr.dropReplace') }}
</div>
</template>
<template v-else-if="item.uploading">
<a-spin />
<span class="brand-logo-card__hint">
{{ t('system.otherConfig.paymentQr.uploading') }}
</span>
</template>
<template v-else>
<span class="brand-logo-card__plus">+</span>
<span class="brand-logo-card__hint">
{{ t('system.otherConfig.paymentQr.dropUpload') }}
</span>
</template>
<input
class="brand-logo-card__file"
type="file"
:data-channel="`qr-${item.channel}`"
accept="image/png,image/jpeg,image/jpg,image/webp,image/gif,image/bmp"
:disabled="item.uploading"
@click.stop
@change="onPaymentQrFileChange(item.channel, $event)"
/>
</div>
</div>
</div>
</a-tab-pane>
<a-tab-pane key="bank" :title="t('system.otherConfig.paymentQr.tab.bank')">
<div class="payment-bank-pane">
<div class="payment-bank-toolbar">
<a-button class="app-btn-primary-soft" @click="openBankAccountForm()">
{{ t('system.otherConfig.paymentQr.bank.add') }}
</a-button>
</div>
<a-spin :loading="bankAccountLoading">
<div
v-if="!bankAccountLoading && bankAccountRows.length === 0"
class="payment-bank-empty"
>
<p class="payment-bank-empty__title">
{{ t('system.otherConfig.paymentQr.bank.emptyTitle') }}
</p>
<p class="payment-bank-empty__hint">
{{ t('system.otherConfig.paymentQr.bank.emptyHint') }}
</p>
<a-button class="app-btn-primary-soft" @click="openBankAccountForm()">
{{ t('system.otherConfig.paymentQr.bank.add') }}
</a-button>
</div>
<div v-else class="payment-bank-cards">
<article
v-for="record in bankAccountRows"
:key="record.id"
class="payment-bank-card"
>
<header class="payment-bank-card__head">
<div class="payment-bank-card__title-wrap">
<h4 class="payment-bank-card__title">
{{ record.accountName || '—' }}
</h4>
<span
v-if="record.isDefault"
class="payment-bank-card__badge"
>
{{ t('system.otherConfig.paymentQr.bank.defaultBadge') }}
</span>
</div>
<div class="payment-bank-card__actions">
<a-button
type="text"
size="mini"
class="payment-bank-action"
:title="t('system.otherConfig.paymentQr.bank.edit')"
@click="openBankAccountForm(record)"
>
<icon-edit />
</a-button>
<a-button
type="text"
size="mini"
status="danger"
class="payment-bank-action"
:title="t('system.otherConfig.paymentQr.bank.delete')"
@click="handleBankAccountDelete(record)"
>
<icon-delete />
</a-button>
</div>
</header>
<dl class="payment-bank-card__fields">
<div class="payment-bank-card__field">
<dt>{{ t('system.otherConfig.paymentQr.bank.bankName') }}</dt>
<dd>{{ record.bankName || '—' }}</dd>
</div>
<div class="payment-bank-card__field payment-bank-card__field--account">
<dt>{{ t('system.otherConfig.paymentQr.bank.accountNo') }}</dt>
<dd>
<code>{{ record.accountNo || '—' }}</code>
</dd>
</div>
<div class="payment-bank-card__field">
<dt>{{ t('system.otherConfig.paymentQr.bank.currency') }}</dt>
<dd>{{ record.currency || 'CNY' }}</dd>
</div>
</dl>
</article>
</div>
</a-spin>
</div>
</a-tab-pane>
<a-tab-pane key="wechatPay" :title="t('system.otherConfig.paymentQr.tab.wechatPay')">
<div class="wx-pay-pane">
<a-spin :loading="wechatPayLoading">
<div class="wx-pay-pane__inner">
<header class="wx-pay-hero">
<div class="wx-pay-hero__main">
<div class="wx-pay-hero__title-row">
<h4 class="wx-pay-hero__title">
{{ t('system.otherConfig.paymentQr.wechatPay.panelTitle') }}
</h4>
<span
class="wx-pay-badge"
:class="wechatPayReady ? 'is-ready' : 'is-pending'"
>
{{
wechatPayReady
? t('system.otherConfig.paymentQr.wechatPay.statusReady')
: t('system.otherConfig.paymentQr.wechatPay.statusPending')
}}
</span>
</div>
<p class="wx-pay-hero__tip">
{{ t('system.otherConfig.paymentQr.wechatPay.tip') }}
</p>
<div class="wx-pay-checklist" aria-label="readiness">
<span
v-for="item in wechatPayChecklist"
:key="item.key"
class="wx-pay-check"
:class="item.ok ? 'is-ok' : 'is-miss'"
>
<i class="wx-pay-check__dot" aria-hidden="true" />
{{ item.label }}
</span>
</div>
</div>
<label class="wx-pay-enable">
<span class="wx-pay-enable__text">
<strong>{{ t('system.otherConfig.paymentQr.wechatPay.enabled') }}</strong>
<small>{{
wechatPayForm.enabled
? t('system.otherConfig.paymentQr.wechatPay.enabledOn')
: t('system.otherConfig.paymentQr.wechatPay.enabledOff')
}}</small>
</span>
<a-switch v-model="wechatPayForm.enabled" />
</label>
</header>
<div class="wx-pay-grid">
<section class="wx-pay-card">
<header class="wx-pay-card__head">
<strong>{{ t('system.otherConfig.paymentQr.wechatPay.sectionBasic') }}</strong>
<span>{{ t('system.otherConfig.paymentQr.wechatPay.sectionBasicHint') }}</span>
</header>
<a-form :model="wechatPayForm" layout="vertical" class="wx-pay-form">
<a-form-item
required
:validate-status="wechatPayErrors.mchId ? 'error' : undefined"
:help="wechatPayErrors.mchId"
>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.wechatPay.mchId') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.wechatPay.mchIdPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
</span>
</template>
<a-input
v-model="wechatPayForm.mchId"
allow-clear
:placeholder="t('system.otherConfig.paymentQr.wechatPay.mchIdPlaceholder')"
@input="wechatPayErrors.mchId = ''"
/>
</a-form-item>
<a-form-item
required
:validate-status="wechatPayErrors.mchSerialNo ? 'error' : undefined"
:help="wechatPayErrors.mchSerialNo"
>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.wechatPay.mchSerialNo') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.wechatPay.mchSerialNoPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
</span>
</template>
<a-input
v-model="wechatPayForm.mchSerialNo"
allow-clear
:placeholder="t('system.otherConfig.paymentQr.wechatPay.mchSerialNoPlaceholder')"
@input="wechatPayErrors.mchSerialNo = ''"
/>
</a-form-item>
<a-form-item
required
:validate-status="wechatPayErrors.platformPublicKeyId ? 'error' : undefined"
:help="wechatPayErrors.platformPublicKeyId"
>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.wechatPay.platformPublicKeyId') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.wechatPay.platformPublicKeyIdPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
</span>
</template>
<a-input
v-model="wechatPayForm.platformPublicKeyId"
allow-clear
:placeholder="
t('system.otherConfig.paymentQr.wechatPay.platformPublicKeyIdPlaceholder')
"
@input="wechatPayErrors.platformPublicKeyId = ''"
/>
</a-form-item>
<a-form-item
required
:validate-status="wechatPayErrors.notifyUrl ? 'error' : undefined"
:help="wechatPayErrors.notifyUrl"
>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.wechatPay.notifyUrl') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.wechatPay.notifyUrlPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
</span>
</template>
<div class="wx-pay-field-row">
<a-input
v-model="wechatPayForm.notifyUrl"
allow-clear
:placeholder="suggestedWechatPayNotifyUrl"
@input="wechatPayErrors.notifyUrl = ''"
/>
<a-button class="wx-pay-field-row__btn" @click="fillWechatPayNotifyUrl">
{{ t('system.otherConfig.paymentQr.wechatPay.fillNotify') }}
</a-button>
</div>
</a-form-item>
</a-form>
</section>
<section class="wx-pay-card">
<header class="wx-pay-card__head">
<strong>{{ t('system.otherConfig.paymentQr.wechatPay.sectionSecret') }}</strong>
<span>{{ t('system.otherConfig.paymentQr.wechatPay.sectionSecretHint') }}</span>
</header>
<a-form :model="wechatPayForm" layout="vertical" class="wx-pay-form">
<a-form-item>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.wechatPay.apiV3Key') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.wechatPay.apiV3KeyPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
<span
class="wx-pay-tag"
:class="wechatPayMeta.hasApiV3Key ? 'is-ok' : 'is-miss'"
>
{{
wechatPayMeta.hasApiV3Key
? t('system.otherConfig.paymentQr.wechatPay.hasKey')
: t('system.otherConfig.paymentQr.wechatPay.missingKey')
}}
</span>
</span>
</template>
<a-input-password
v-model="wechatPayForm.apiV3Key"
allow-clear
:placeholder="
wechatPayMeta.hasApiV3Key
? t('system.otherConfig.paymentQr.wechatPay.apiV3KeyPlaceholder')
: t('system.otherConfig.paymentQr.wechatPay.apiV3KeyRequired')
"
/>
</a-form-item>
<a-form-item>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.wechatPay.privateKeyPem') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.wechatPay.privateKeyPemPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
<span
class="wx-pay-tag"
:class="wechatPayMeta.hasPrivateKey ? 'is-ok' : 'is-miss'"
>
{{
wechatPayMeta.hasPrivateKey
? t('system.otherConfig.paymentQr.wechatPay.hasKey')
: t('system.otherConfig.paymentQr.wechatPay.missingKey')
}}
</span>
</span>
</template>
<div class="wx-pay-pem-block">
<a-textarea
v-model="wechatPayForm.privateKeyPem"
class="wx-pay-pem"
:auto-size="{ minRows: 4, maxRows: 10 }"
:placeholder="
wechatPayMeta.hasPrivateKey
? t('system.otherConfig.paymentQr.wechatPay.privateKeyPlaceholder')
: t('system.otherConfig.paymentQr.wechatPay.privateKeyRequired')
"
/>
<div class="wx-pay-pem-actions">
<label class="wx-pay-file">
<input
type="file"
accept=".pem,.key,text/plain"
@change="onWechatPayPemFile"
/>
{{ t('system.otherConfig.paymentQr.wechatPay.importPem') }}
</label>
<button
v-if="wechatPayForm.privateKeyPem"
type="button"
class="wx-pay-link-btn"
@click="wechatPayForm.privateKeyPem = ''"
>
{{ t('system.otherConfig.paymentQr.wechatPay.clearPem') }}
</button>
</div>
</div>
</a-form-item>
<a-form-item>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.wechatPay.platformPublicKeyPem') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.wechatPay.platformPublicKeyPemPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
<span
class="wx-pay-tag"
:class="wechatPayMeta.hasPlatformPublicKey ? 'is-ok' : 'is-miss'"
>
{{
wechatPayMeta.hasPlatformPublicKey
? t('system.otherConfig.paymentQr.wechatPay.hasKey')
: t('system.otherConfig.paymentQr.wechatPay.missingKey')
}}
</span>
</span>
</template>
<div class="wx-pay-pem-block">
<a-textarea
v-model="wechatPayForm.platformPublicKeyPem"
class="wx-pay-pem"
:auto-size="{ minRows: 4, maxRows: 10 }"
:placeholder="
wechatPayMeta.hasPlatformPublicKey
? t('system.otherConfig.paymentQr.wechatPay.platformPublicKeyPlaceholder')
: t('system.otherConfig.paymentQr.wechatPay.platformPublicKeyRequired')
"
/>
<div class="wx-pay-pem-actions">
<label class="wx-pay-file">
<input
type="file"
accept=".pem,.key,text/plain"
@change="onWechatPayPublicPemFile"
/>
{{ t('system.otherConfig.paymentQr.wechatPay.importPem') }}
</label>
<button
v-if="wechatPayForm.platformPublicKeyPem"
type="button"
class="wx-pay-link-btn"
@click="wechatPayForm.platformPublicKeyPem = ''"
>
{{ t('system.otherConfig.paymentQr.wechatPay.clearPem') }}
</button>
</div>
</div>
</a-form-item>
</a-form>
</section>
<section class="wx-pay-card wx-pay-card--wide">
<header class="wx-pay-card__head">
<strong>{{ t('system.otherConfig.paymentQr.wechatPay.sectionBind') }}</strong>
<span>{{ t('system.otherConfig.paymentQr.wechatPay.sectionBindHint') }}</span>
</header>
<div class="wx-pay-bind">
<div class="wx-pay-bind__field">
<span class="wx-pay-bind__label">
{{ t('system.otherConfig.paymentQr.wechatPay.appId') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.wechatPay.appIdPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
</span>
<code v-if="wechatPayMeta.appId" class="wx-pay-bind__value">
{{ wechatPayMeta.appId }}
</code>
<span v-else class="wx-pay-bind__empty">
{{ t('system.otherConfig.paymentQr.wechatPay.appIdEmpty') }}
</span>
</div>
<a-button
size="small"
:disabled="!wechatMpConfigRow"
@click="openWechatMpConfig"
>
{{ t('system.otherConfig.paymentQr.wechatPay.openMpConfig') }}
</a-button>
</div>
</section>
</div>
<footer class="wx-pay-footer">
<div class="wx-pay-footer__hint">
<template v-if="wechatPayDirty">
{{ t('system.otherConfig.paymentQr.wechatPay.dirtyHint') }}
</template>
<template v-else>
{{ t('system.otherConfig.paymentQr.wechatPay.cleanHint') }}
</template>
</div>
<div class="wx-pay-footer__actions">
<a-button :disabled="!wechatPayDirty || wechatPaySaving" @click="resetWechatPayForm">
{{ t('system.otherConfig.paymentQr.wechatPay.reset') }}
</a-button>
<a-button
type="primary"
class="app-btn-primary-soft"
:loading="wechatPaySaving"
:disabled="!wechatPayDirty"
@click="handleWechatPaySave"
>
{{ t('system.otherConfig.paymentQr.wechatPay.save') }}
</a-button>
</div>
</footer>
</div>
</a-spin>
</div>
</a-tab-pane>
<a-tab-pane key="alipayPay" :title="t('system.otherConfig.paymentQr.tab.alipayPay')">
<div class="wx-pay-pane">
<a-spin :loading="alipayPayLoading">
<div class="wx-pay-pane__inner">
<header class="wx-pay-hero">
<div class="wx-pay-hero__main">
<div class="wx-pay-hero__title-row">
<h4 class="wx-pay-hero__title">
{{ t('system.otherConfig.paymentQr.alipayPay.panelTitle') }}
</h4>
<span
class="wx-pay-badge"
:class="alipayPayReady ? 'is-ready' : 'is-pending'"
>
{{
alipayPayReady
? t('system.otherConfig.paymentQr.alipayPay.statusReady')
: t('system.otherConfig.paymentQr.alipayPay.statusPending')
}}
</span>
</div>
<p class="wx-pay-hero__tip">
{{ t('system.otherConfig.paymentQr.alipayPay.tip') }}
</p>
<div class="wx-pay-checklist" aria-label="readiness">
<span
v-for="item in alipayPayChecklist"
:key="item.key"
class="wx-pay-check"
:class="item.ok ? 'is-ok' : 'is-miss'"
>
<i class="wx-pay-check__dot" aria-hidden="true" />
{{ item.label }}
</span>
</div>
</div>
<label class="wx-pay-enable">
<span class="wx-pay-enable__text">
<strong>{{ t('system.otherConfig.paymentQr.alipayPay.enabled') }}</strong>
<small>{{
alipayPayForm.enabled
? t('system.otherConfig.paymentQr.alipayPay.enabledOn')
: t('system.otherConfig.paymentQr.alipayPay.enabledOff')
}}</small>
</span>
<a-switch v-model="alipayPayForm.enabled" />
</label>
</header>
<div class="wx-pay-grid">
<section class="wx-pay-card">
<header class="wx-pay-card__head">
<strong>{{ t('system.otherConfig.paymentQr.alipayPay.sectionBasic') }}</strong>
<span>{{ t('system.otherConfig.paymentQr.alipayPay.sectionBasicHint') }}</span>
</header>
<a-form :model="alipayPayForm" layout="vertical" class="wx-pay-form">
<a-form-item
required
:validate-status="alipayPayErrors.appId ? 'error' : undefined"
:help="alipayPayErrors.appId"
>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.alipayPay.appId') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.alipayPay.appIdPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
</span>
</template>
<a-input
v-model="alipayPayForm.appId"
allow-clear
:placeholder="t('system.otherConfig.paymentQr.alipayPay.appIdPlaceholder')"
@input="alipayPayErrors.appId = ''"
/>
</a-form-item>
<a-form-item
required
:validate-status="alipayPayErrors.notifyUrl ? 'error' : undefined"
:help="alipayPayErrors.notifyUrl"
>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.alipayPay.notifyUrl') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.alipayPay.notifyUrlPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
</span>
</template>
<div class="wx-pay-field-row">
<a-input
v-model="alipayPayForm.notifyUrl"
allow-clear
:placeholder="suggestedAlipayPayNotifyUrl"
@input="alipayPayErrors.notifyUrl = ''"
/>
<a-button class="wx-pay-field-row__btn" @click="fillAlipayPayNotifyUrl">
{{ t('system.otherConfig.paymentQr.alipayPay.fillNotify') }}
</a-button>
</div>
</a-form-item>
<a-form-item>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.alipayPay.returnUrl') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.alipayPay.returnUrlPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
</span>
</template>
<a-input
v-model="alipayPayForm.returnUrl"
allow-clear
:placeholder="t('system.otherConfig.paymentQr.alipayPay.returnUrlPlaceholder')"
/>
</a-form-item>
</a-form>
</section>
<section class="wx-pay-card">
<header class="wx-pay-card__head">
<strong>{{ t('system.otherConfig.paymentQr.alipayPay.sectionSecret') }}</strong>
<span>{{ t('system.otherConfig.paymentQr.alipayPay.sectionSecretHint') }}</span>
</header>
<a-form :model="alipayPayForm" layout="vertical" class="wx-pay-form">
<a-form-item>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.alipayPay.privateKeyPem') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.alipayPay.privateKeyPemPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
<span
class="wx-pay-tag"
:class="alipayPayMeta.hasPrivateKey ? 'is-ok' : 'is-miss'"
>
{{
alipayPayMeta.hasPrivateKey
? t('system.otherConfig.paymentQr.alipayPay.hasKey')
: t('system.otherConfig.paymentQr.alipayPay.missingKey')
}}
</span>
</span>
</template>
<div class="wx-pay-pem-block">
<a-textarea
v-model="alipayPayForm.privateKeyPem"
class="wx-pay-pem"
:auto-size="{ minRows: 5, maxRows: 12 }"
:placeholder="
alipayPayMeta.hasPrivateKey
? t('system.otherConfig.paymentQr.alipayPay.privateKeyPlaceholder')
: t('system.otherConfig.paymentQr.alipayPay.privateKeyRequired')
"
/>
<div class="wx-pay-pem-actions">
<label class="wx-pay-file">
<input
type="file"
accept=".pem,.key,text/plain"
@change="onAlipayPayPrivateKeyFile"
/>
{{ t('system.otherConfig.paymentQr.alipayPay.importPem') }}
</label>
<button
v-if="alipayPayForm.privateKeyPem"
type="button"
class="wx-pay-link-btn"
@click="alipayPayForm.privateKeyPem = ''"
>
{{ t('system.otherConfig.paymentQr.alipayPay.clearPem') }}
</button>
</div>
</div>
</a-form-item>
<a-form-item>
<template #label>
<span class="wx-pay-label">
{{ t('system.otherConfig.paymentQr.alipayPay.alipayPublicKey') }}
<a-tooltip
:content="t('system.otherConfig.paymentQr.alipayPay.alipayPublicKeyPath')"
position="top"
:content-style="{ maxWidth: '360px' }"
>
<IconQuestionCircle class="wechat-notify-editor__help-icon" />
</a-tooltip>
<span
class="wx-pay-tag"
:class="alipayPayMeta.hasAlipayPublicKey ? 'is-ok' : 'is-miss'"
>
{{
alipayPayMeta.hasAlipayPublicKey
? t('system.otherConfig.paymentQr.alipayPay.hasKey')
: t('system.otherConfig.paymentQr.alipayPay.missingKey')
}}
</span>
</span>
</template>
<a-textarea
v-model="alipayPayForm.alipayPublicKey"
class="wx-pay-pem"
:auto-size="{ minRows: 4, maxRows: 10 }"
:placeholder="
alipayPayMeta.hasAlipayPublicKey
? t('system.otherConfig.paymentQr.alipayPay.publicKeyPlaceholder')
: t('system.otherConfig.paymentQr.alipayPay.publicKeyRequired')
"
/>
</a-form-item>
</a-form>
</section>
</div>
<footer class="wx-pay-footer">
<div class="wx-pay-footer__hint">
<template v-if="alipayPayDirty">
{{ t('system.otherConfig.paymentQr.alipayPay.dirtyHint') }}
</template>
<template v-else>
{{ t('system.otherConfig.paymentQr.alipayPay.cleanHint') }}
</template>
</div>
<div class="wx-pay-footer__actions">
<a-button :disabled="!alipayPayDirty || alipayPaySaving" @click="resetAlipayPayForm">
{{ t('system.otherConfig.paymentQr.alipayPay.reset') }}
</a-button>
<a-button
type="primary"
class="app-btn-primary-soft"
:loading="alipayPaySaving"
:disabled="!alipayPayDirty"
@click="handleAlipayPaySave"
>
{{ t('system.otherConfig.paymentQr.alipayPay.save') }}
</a-button>
</div>
</footer>
</div>
</a-spin>
</div>
</a-tab-pane>
</a-tabs>
<a-modal
v-model:visible="bankAccountFormVisible"
:title="
bankAccountForm.id
? t('system.otherConfig.paymentQr.bank.edit')
: t('system.otherConfig.paymentQr.bank.add')
"
:ok-loading="bankAccountSaving"
unmount-on-close
@before-ok="handleBankAccountSave"
>
<a-form :model="bankAccountForm" layout="vertical">
<a-form-item :label="t('system.otherConfig.paymentQr.bank.accountName')" required>
<a-input v-model="bankAccountForm.accountName" />
</a-form-item>
<a-form-item :label="t('system.otherConfig.paymentQr.bank.bankName')" required>
<a-input v-model="bankAccountForm.bankName" />
</a-form-item>
<a-form-item :label="t('system.otherConfig.paymentQr.bank.accountNo')" required>
<a-input v-model="bankAccountForm.accountNo" />
</a-form-item>
<a-form-item :label="t('system.otherConfig.paymentQr.bank.currency')">
<a-input v-model="bankAccountForm.currency" />
</a-form-item>
<a-form-item :label="t('system.otherConfig.paymentQr.bank.isDefault')">
<a-switch v-model="bankAccountForm.isDefault" />
</a-form-item>
</a-form>
</a-modal>
</template>
<template v-else-if="activePanel === 'brandLogo'">
<header class="config-editor__head">
<div>
<h3 class="config-editor__title">{{ t('system.otherConfig.brandLogo.title') }}</h3>
<p class="config-editor__sub">{{ t('system.otherConfig.brandLogo.tip') }}</p>
</div>
</header>
<div v-if="brandLogoLoading" class="payment-qr-loading">
<a-spin />
</div>
<div v-else class="brand-logo-editor">
<a-tabs
v-model:active-key="brandLogoTab"
type="rounded"
size="small"
class="brand-config-tabs"
>
<a-tab-pane key="copy" :title="t('system.otherConfig.brandLogo.tab.copy')">
<div class="brand-copy-pane">
<div class="brand-copy-block">
<div class="brand-copy-block__head">
<strong>{{ t('system.otherConfig.brandLogo.copy.navTitle') }}</strong>
<span>{{ t('system.otherConfig.brandLogo.copy.navHint') }}</span>
</div>
<div class="brand-copy-fields brand-copy-fields--nav">
<label class="brand-copy-field">
<span>{{ t('system.otherConfig.brandLogo.copy.navName') }}</span>
<a-input
v-model="brandCopyForm.navName"
allow-clear
:max-length="80"
/>
</label>
<label class="brand-copy-field">
<span>{{ t('system.otherConfig.brandLogo.copy.navFullName') }}</span>
<a-input
v-model="brandCopyForm.navFullName"
allow-clear
:max-length="200"
/>
</label>
<label class="brand-copy-field brand-copy-field--full">
<span>{{ t('system.otherConfig.brandLogo.copy.icp') }}</span>
<a-input
v-model="brandCopyForm.icp"
allow-clear
:max-length="80"
:placeholder="t('system.otherConfig.brandLogo.copy.icpPlaceholder')"
/>
</label>
</div>
</div>
<div class="brand-copy-block">
<div class="brand-copy-block__head">
<strong>{{ t('system.otherConfig.brandLogo.copy.aiTitle') }}</strong>
<span>{{ t('system.otherConfig.brandLogo.copy.aiHint') }}</span>
</div>
<div class="brand-copy-fields brand-copy-fields--ai">
<label class="brand-copy-field">
<span>{{ t('system.otherConfig.brandLogo.copy.aiWelcomeTitleZh') }}</span>
<a-input
v-model="brandCopyForm.aiWelcomeTitleZh"
allow-clear
:max-length="200"
/>
</label>
<label class="brand-copy-field">
<span>{{
t('system.otherConfig.brandLogo.copy.aiWelcomeTitleShortZh')
}}</span>
<a-input
v-model="brandCopyForm.aiWelcomeTitleShortZh"
allow-clear
:max-length="200"
/>
</label>
<label class="brand-copy-field">
<span>{{ t('system.otherConfig.brandLogo.copy.aiWelcomeTitleEn') }}</span>
<a-input
v-model="brandCopyForm.aiWelcomeTitleEn"
allow-clear
:max-length="200"
/>
</label>
<label class="brand-copy-field">
<span>{{
t('system.otherConfig.brandLogo.copy.aiWelcomeTitleShortEn')
}}</span>
<a-input
v-model="brandCopyForm.aiWelcomeTitleShortEn"
allow-clear
:max-length="200"
/>
</label>
</div>
</div>
<div class="brand-copy-actions">
<a-button
class="app-btn-primary-soft"
:loading="brandCopySaving"
@click="handleBrandCopySave"
>
{{ t('system.otherConfig.brandLogo.copy.save') }}
</a-button>
</div>
</div>
</a-tab-pane>
<a-tab-pane key="images" :title="t('system.otherConfig.brandLogo.tab.images')">
<div class="brand-logo-grid">
<div
v-for="item in brandLogoCards"
:key="item.channel"
class="brand-logo-card"
>
<div class="brand-logo-card__meta">
<div class="brand-logo-card__meta-text">
<span class="brand-logo-card__title">{{ item.title }}</span>
<span class="brand-logo-card__size">{{ item.sizeHint }}</span>
</div>
<a-button
v-if="item.url"
class="brand-logo-card__clear"
size="mini"
:loading="item.uploading"
@click.stop="handleBrandLogoClear(item.channel)"
>
{{ t('system.otherConfig.brandLogo.clear') }}
</a-button>
</div>
<div
class="brand-logo-card__zone"
:class="{
'is-filled': !!item.url,
'is-uploading': item.uploading,
'is-dragover': brandLogoDragOver[item.channel],
}"
@click="openBrandLogoPicker(item.channel)"
@dragenter.prevent="onBrandLogoDragEnter(item.channel)"
@dragover.prevent="onBrandLogoDragEnter(item.channel)"
@dragleave.prevent="onBrandLogoDragLeave(item.channel, $event)"
@drop.prevent="onBrandLogoDrop(item.channel, $event)"
>
<template v-if="item.url">
<img
class="brand-logo-card__img"
:src="item.url"
:alt="item.title"
draggable="false"
/>
<div v-if="item.uploading" class="brand-logo-card__mask is-busy">
<a-spin />
<span>{{ t('system.otherConfig.brandLogo.uploading') }}</span>
</div>
<div v-else class="brand-logo-card__mask">
{{ t('system.otherConfig.brandLogo.dropReplace') }}
</div>
</template>
<template v-else-if="item.uploading">
<a-spin />
<span class="brand-logo-card__hint">
{{ t('system.otherConfig.brandLogo.uploading') }}
</span>
</template>
<template v-else>
<span class="brand-logo-card__mark">BCDship</span>
<span class="brand-logo-card__hint">
{{ t('system.otherConfig.brandLogo.dropUpload') }}
</span>
</template>
<input
class="brand-logo-card__file"
type="file"
:data-channel="item.channel"
accept="image/png,image/jpeg,image/jpg,image/webp,image/gif,image/bmp"
:disabled="item.uploading"
@click.stop
@change="onBrandLogoFileChange(item.channel, $event)"
/>
</div>
</div>
</div>
</a-tab-pane>
</a-tabs>
</div>
</template>
<template v-else-if="activePanel === 'wechatNotify'">
<header class="config-editor__head">
<div>
<h3 class="config-editor__title">
{{ t('system.otherConfig.wechatOrderNotify.title') }}
</h3>
<p class="config-editor__sub">{{ t('system.otherConfig.wechatOrderNotify.tip') }}</p>
</div>
</header>
<div class="wechat-notify-panel">
<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>
<div v-else class="wechat-notify-layout">
<aside class="wechat-notify-nav" aria-label="events">
<button
v-for="item in wechatNotifyTemplates"
:key="item.eventCode"
type="button"
class="wechat-notify-nav__item"
:class="{ 'is-active': item.eventCode === wechatNotifyActiveCode }"
@click="wechatNotifyActiveCode = item.eventCode"
>
<span class="wechat-notify-nav__main">
<span class="wechat-notify-nav__name">{{ item.eventName }}</span>
<span class="wechat-notify-nav__code">{{ item.eventCode }}</span>
</span>
<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 class="wechat-notify-editor__head-main">
<h3 class="wechat-notify-editor__title">{{ wechatNotifyActive.eventName }}</h3>
<code class="wechat-notify-editor__sub">{{
wechatNotifyActive.eventCode
}}</code>
</div>
<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>
<div class="wechat-notify-editor__scroll">
<a-form
v-show="wechatNotifyChannelTab === 'wechat'"
: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.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-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]"
@click="handleWechatTrial(wechatNotifyActive.eventCode)"
>
{{ t('system.otherConfig.wechatOrderNotify.trial') }}
</a-button>
</div>
<a-button
type="primary"
class="app-btn-primary-soft wechat-notify-editor__save"
:loading="wechatSaveLoading[wechatNotifyActive.eventCode]"
@click="handleWechatSave(wechatNotifyActive)"
>
{{ t('system.otherConfig.wechatOrderNotify.save') }}
</a-button>
</footer>
</section>
<section v-else class="wechat-notify-editor wechat-notify-editor--empty">
{{ t('system.otherConfig.wechatOrderNotify.emptySelect') }}
</section>
</div>
</div>
</template>
<template v-else-if="activePanel === 'config' && editorOpen && editingId">
<header class="config-editor__head">
<div>
<h3 class="config-editor__title">
{{ formState.configName || t('system.otherConfig.modal.editTitle') }}
</h3>
<p class="config-editor__sub">{{ formState.configCode }}</p>
</div>
<div class="config-editor__enable">
<span class="config-editor__enable-label">{{
t('system.otherConfig.form.enabled')
}}</span>
<a-switch v-model="formState.enabled" />
</div>
</header>
<p v-if="fieldHint" class="config-editor__tip">{{ fieldHint }}</p>
<p v-else class="config-editor__tip">{{ t('system.otherConfig.modal.tipEdit') }}</p>
<a-form
ref="formRef"
:model="formState"
:rules="formRules"
layout="vertical"
class="other-config-form config-editor__form"
>
<div class="form-section-title">{{ t('system.otherConfig.section.basic') }}</div>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item :label="t('system.otherConfig.form.configCode')" field="configCode">
<a-input
v-model="formState.configCode"
:placeholder="t('system.otherConfig.placeholder.configCode')"
disabled
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="t('system.otherConfig.form.configName')" field="configName">
<a-input
v-model="formState.configName"
:placeholder="t('system.otherConfig.placeholder.input')"
/>
</a-form-item>
</a-col>
</a-row>
<div class="form-section-title">{{ t('system.otherConfig.section.connection') }}</div>
<a-row :gutter="16">
<a-col :span="24">
<a-form-item :label="fieldLabels.baseUrl" field="baseUrl">
<a-input v-model="formState.baseUrl" :placeholder="fieldPlaceholders.baseUrl" />
</a-form-item>
</a-col>
<a-col v-if="showAppKey" :span="12">
<a-form-item :label="fieldLabels.appKey" field="appKey">
<a-input v-model="formState.appKey" :placeholder="fieldPlaceholders.appKey" />
</a-form-item>
</a-col>
<a-col v-if="showAppSecret" :span="12">
<a-form-item :label="fieldLabels.appSecret" field="appSecret">
<a-input-password
v-model="formState.appSecret"
:placeholder="t('system.otherConfig.placeholder.appSecretEdit')"
allow-clear
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="t('system.otherConfig.form.timeoutSeconds')"
field="timeoutSeconds"
>
<a-input-number
v-model="formState.timeoutSeconds"
:min="5"
:max="300"
:precision="0"
style="width: 100%"
/>
</a-form-item>
</a-col>
</a-row>
<template v-if="showRemark">
<div class="form-section-title">{{ t('system.otherConfig.section.more') }}</div>
<a-row :gutter="16">
<a-col :span="24">
<a-form-item :label="fieldLabels.remark" field="remark">
<a-textarea
v-model="formState.remark"
:placeholder="fieldPlaceholders.remark"
:auto-size="{ minRows: 2, maxRows: 4 }"
/>
</a-form-item>
</a-col>
</a-row>
</template>
</a-form>
<footer class="config-editor__foot">
<a-button
status="danger"
:disabled="saveLoading"
@click="handleDeleteConfirm({ id: editingId, configName: formState.configName })"
>
{{ t('system.otherConfig.actions.delete') }}
</a-button>
<div class="config-editor__foot-right">
<a-button
type="primary"
class="app-btn-primary-soft"
:loading="saveLoading"
@click="handleSave"
>
{{ t('system.otherConfig.actions.save') }}
</a-button>
</div>
</footer>
</template>
<div v-else class="config-editor__empty">
{{ t('system.otherConfig.emptySelect') }}
</div>
</section>
</div>
</div>
<a-modal
v-model:visible="createModalVisible"
:title="t('system.otherConfig.modal.addTitle')"
:confirm-loading="createLoading"
width="640px"
:mask-closable="false"
unmount-on-close
@ok="handleCreateOk"
>
<a-alert type="info" :show-icon="false" class="modal-form-tip">
{{ createFieldHint || t('system.otherConfig.modal.tip') }}
</a-alert>
<a-form
ref="createFormRef"
:model="createFormState"
:rules="createFormRules"
layout="vertical"
class="other-config-form"
>
<div class="form-section-title">{{ t('system.otherConfig.section.basic') }}</div>
<a-row :gutter="16">
<a-col :span="24">
<a-form-item :label="t('system.otherConfig.form.preset')" field="preset">
<a-select
v-model="createSelectedPreset"
:options="presetOptions"
:placeholder="t('system.otherConfig.placeholder.preset')"
allow-search
@change="applyCreatePreset"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="t('system.otherConfig.form.configCode')" field="configCode">
<a-input
v-model="createFormState.configCode"
:placeholder="t('system.otherConfig.placeholder.configCode')"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="t('system.otherConfig.form.configName')" field="configName">
<a-input
v-model="createFormState.configName"
:placeholder="t('system.otherConfig.placeholder.input')"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="t('system.otherConfig.form.enabled')" field="enabled">
<a-switch v-model="createFormState.enabled" />
</a-form-item>
</a-col>
</a-row>
<div class="form-section-title">{{ t('system.otherConfig.section.connection') }}</div>
<a-row :gutter="16">
<a-col :span="24">
<a-form-item :label="createFieldLabels.baseUrl" field="baseUrl">
<a-input
v-model="createFormState.baseUrl"
:placeholder="fieldPlaceholders.baseUrl"
/>
</a-form-item>
</a-col>
<a-col v-if="createShowAppKey" :span="12">
<a-form-item :label="createFieldLabels.appKey" field="appKey">
<a-input
v-model="createFormState.appKey"
:placeholder="fieldPlaceholders.appKey"
/>
</a-form-item>
</a-col>
<a-col v-if="createShowAppSecret" :span="12">
<a-form-item :label="createFieldLabels.appSecret" field="appSecret">
<a-input-password
v-model="createFormState.appSecret"
:placeholder="fieldPlaceholders.appSecret"
allow-clear
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="t('system.otherConfig.form.timeoutSeconds')"
field="timeoutSeconds"
>
<a-input-number
v-model="createFormState.timeoutSeconds"
:min="5"
:max="300"
:precision="0"
style="width: 100%"
/>
</a-form-item>
</a-col>
</a-row>
<template v-if="createShowRemark">
<div class="form-section-title">{{ t('system.otherConfig.section.more') }}</div>
<a-row :gutter="16">
<a-col :span="24">
<a-form-item :label="createFieldLabels.remark" field="remark">
<a-textarea
v-model="createFormState.remark"
:placeholder="fieldPlaceholders.remark"
:auto-size="{ minRows: 2, maxRows: 4 }"
/>
</a-form-item>
</a-col>
</a-row>
</template>
</a-form>
</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>
</div>
</template>
<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,
PLATFORM_SHOP_CONFIG_CODES,
TRACK_SERVICE_CONFIG_CODE,
WECHAT_MP_CONFIG_CODE,
WECHAT_MP_FOLLOW_CONFIG_CODE,
createSystemOtherConfig,
deleteSystemOtherConfig,
clearBrandLogo,
clearPaymentReceiveQr,
getBrandCopy,
getBrandLogo,
getPaymentReceiveQr,
getSystemOtherConfigDetail,
getSystemOtherConfigList,
saveBrandCopy,
updateSystemOtherConfig,
uploadBrandLogo,
uploadPaymentReceiveQr,
type BrandLogoChannel,
type PaymentReceiveQrChannel,
type SystemOtherConfigDto,
} from '@/api/system/otherConfig'
import {
deleteFinanceCompanyAccount,
getFinanceCompanyAccountList,
saveFinanceCompanyAccount,
type FinanceCompanyAccount,
} from '@/api/finance/master'
import {
getWeChatPayMerchantConfig,
saveWeChatPayMerchantConfig,
} from '@/api/recharge/wechatPay'
import {
getAlipayPayMerchantConfig,
saveAlipayPayMerchantConfig,
} from '@/api/recharge/alipayPay'
import {
brandLogoImages,
clearCachedBrandImage,
rememberBrandImageFile,
refreshBrandImages,
} from '@/utils/brandLogo'
import {
DEFAULT_BRAND_COPY,
rememberBrandCopy,
} from '@/utils/brandCopy'
import {
formatWechatTrialResultText,
getOrderNotifySystemSmtp,
getWechatOrderNotifyTemplates,
saveOrderNotifySystemSmtp,
saveWechatOrderNotifyTemplate,
trialWechatOrderNotify,
type OrderNotifySystemSmtpStatus,
type WechatOrderNotifyTemplateDto,
} from '@/api/system/wechatOrderNotify'
import { streamFileBlob } from '@/api/fileStorage'
import { extractOmsRequestError, resolveOmsAssetUrl } from '@/api/oms/common'
import { BCDSHIP_TEST_API } from '@/config/deployTargets'
import { prodApiOrigin } from '@/utils/rewriteBrowserApiPath'
defineOptions({
name: 'SystemOtherConfig',
})
const { t } = useI18n()
const router = useRouter()
function defaultSiteOrigin(): string {
if (typeof window !== 'undefined' && window.location?.origin) {
return window.location.origin.replace(/\/$/, '')
}
return BCDSHIP_TEST_API.siteOrigin
}
function defaultApiOrigin(): string {
return prodApiOrigin()
}
const list = ref<SystemOtherConfigDto[]>([])
const listLoading = ref(false)
const keyword = ref('')
const filteredList = computed(() => {
const q = keyword.value.trim().toLowerCase()
if (!q) return list.value
return list.value.filter((item) => {
const code = String(item.configCode || '').toLowerCase()
const name = String(item.configName || '').toLowerCase()
const url = String(item.baseUrl || '').toLowerCase()
const remark = String(item.remark || '').toLowerCase()
return code.includes(q) || name.includes(q) || url.includes(q) || remark.includes(q)
})
})
type OpsPanelKey = 'paymentQr' | 'brandLogo' | 'wechatNotify'
type ActivePanel = OpsPanelKey | 'config'
const activePanel = ref<ActivePanel>('paymentQr')
const opsNavItems = computed(() => [
{
key: 'paymentQr' as OpsPanelKey,
name: t('system.otherConfig.actions.paymentQr'),
desc: t('system.otherConfig.paymentQr.navDesc'),
},
{
key: 'brandLogo' as OpsPanelKey,
name: t('system.otherConfig.actions.brandLogo'),
desc: t('system.otherConfig.brandLogo.navDesc'),
},
{
key: 'wechatNotify' as OpsPanelKey,
name: t('system.otherConfig.actions.wechatOrderNotify'),
desc: t('system.otherConfig.wechatOrderNotify.navDesc'),
},
])
const filteredOpsNavItems = computed(() => {
const q = keyword.value.trim().toLowerCase()
if (!q) return opsNavItems.value
return opsNavItems.value.filter(
(item) => item.name.toLowerCase().includes(q) || item.desc.toLowerCase().includes(q),
)
})
const saveLoading = ref(false)
const createLoading = ref(false)
const createModalVisible = ref(false)
const editorOpen = ref(false)
const editingId = ref<number | string>()
const formRef = ref()
const createFormRef = ref()
const selectedPreset = ref(TRACK_SERVICE_CONFIG_CODE)
const createSelectedPreset = ref(TRACK_SERVICE_CONFIG_CODE)
type FieldMeta = {
baseUrl: string
appKey: string
appSecret: string
remark: string
hint?: string
showAppKey?: boolean
showAppSecret?: boolean
showRemark?: boolean
requireAppKey?: boolean
requireAppSecret?: boolean
requireBaseUrl?: boolean
requireRemark?: boolean
}
const PRESET_DEFS: Array<{
code: string
nameKey: string
defaults: Partial<typeof formState>
meta: FieldMeta
}> = [
{
code: TRACK_SERVICE_CONFIG_CODE,
nameKey: 'system.otherConfig.defaults.trackServiceName',
defaults: {
configCode: TRACK_SERVICE_CONFIG_CODE,
enabled: true,
baseUrl: `${defaultApiOrigin()}/track`,
timeoutSeconds: 30,
},
meta: {
baseUrl: 'system.otherConfig.form.baseUrl',
appKey: 'system.otherConfig.form.appKey',
appSecret: 'system.otherConfig.form.appSecret',
remark: 'system.otherConfig.form.remark',
requireBaseUrl: true,
requireAppKey: true,
requireAppSecret: true,
},
},
{
code: API_CENTER_CONFIG_CODE,
nameKey: 'system.otherConfig.defaults.apiCenterName',
defaults: {
configCode: API_CENTER_CONFIG_CODE,
enabled: true,
baseUrl: `${defaultApiOrigin()}/itfx`,
timeoutSeconds: 30,
},
meta: {
baseUrl: 'system.otherConfig.fields.apiCenter.baseUrl',
appKey: 'system.otherConfig.fields.apiCenter.appKey',
appSecret: 'system.otherConfig.fields.apiCenter.appSecret',
remark: 'system.otherConfig.form.remark',
hint: 'system.otherConfig.hint.apiCenter',
showRemark: false,
requireBaseUrl: true,
requireAppKey: true,
requireAppSecret: true,
},
},
{
code: PICKUP_OPEN_API_CONFIG_CODE,
nameKey: 'system.otherConfig.defaults.pickupOpenApiName',
defaults: {
configCode: PICKUP_OPEN_API_CONFIG_CODE,
enabled: true,
timeoutSeconds: 30,
},
meta: {
baseUrl: 'system.otherConfig.form.baseUrl',
appKey: 'system.otherConfig.form.appKey',
appSecret: 'system.otherConfig.form.appSecret',
remark: 'system.otherConfig.form.remark',
hint: 'system.otherConfig.hint.pickupOpenApi',
showAppSecret: false,
requireAppKey: true,
},
},
{
code: WECHAT_MP_CONFIG_CODE,
nameKey: 'system.otherConfig.defaults.wechatMpName',
defaults: {
configCode: WECHAT_MP_CONFIG_CODE,
enabled: true,
baseUrl: defaultSiteOrigin(),
timeoutSeconds: 30,
},
meta: {
baseUrl: 'system.otherConfig.fields.wechat.baseUrl',
appKey: 'system.otherConfig.fields.wechat.appKey',
appSecret: 'system.otherConfig.fields.wechat.appSecret',
remark: 'system.otherConfig.fields.wechat.remark',
hint: 'system.otherConfig.hint.wechat',
requireAppKey: true,
requireAppSecret: true,
requireRemark: true,
},
},
{
code: WECHAT_MP_FOLLOW_CONFIG_CODE,
nameKey: 'system.otherConfig.defaults.wechatMpFollowName',
defaults: {
configCode: WECHAT_MP_FOLLOW_CONFIG_CODE,
enabled: true,
timeoutSeconds: 10,
},
meta: {
baseUrl: 'system.otherConfig.fields.wechatFollow.baseUrl',
appKey: 'system.otherConfig.form.appKey',
appSecret: 'system.otherConfig.form.appSecret',
remark: 'system.otherConfig.form.remark',
hint: 'system.otherConfig.hint.wechatFollow',
showAppKey: false,
showAppSecret: false,
showRemark: false,
requireBaseUrl: true,
},
},
{
code: PLATFORM_SHOP_CONFIG_CODES.common,
nameKey: 'system.otherConfig.defaults.platformShopName',
defaults: {
configCode: PLATFORM_SHOP_CONFIG_CODES.common,
enabled: true,
baseUrl: 'http://localhost:5173',
timeoutSeconds: 30,
},
meta: {
baseUrl: 'system.otherConfig.fields.platformShop.baseUrl',
appKey: 'system.otherConfig.form.appKey',
appSecret: 'system.otherConfig.form.appSecret',
remark: 'system.otherConfig.fields.platformShop.remark',
hint: 'system.otherConfig.hint.platformShop',
showAppKey: false,
showAppSecret: false,
requireBaseUrl: true,
},
},
{
code: PLATFORM_SHOP_CONFIG_CODES.tiktok,
nameKey: 'system.otherConfig.defaults.platformShopTiktokName',
defaults: {
configCode: PLATFORM_SHOP_CONFIG_CODES.tiktok,
enabled: true,
baseUrl: 'https://auth.tiktok-shops.com',
remark: 'https://open-api.tiktokglobalshop.com',
timeoutSeconds: 30,
},
meta: {
baseUrl: 'system.otherConfig.fields.tiktok.baseUrl',
appKey: 'system.otherConfig.form.appKey',
appSecret: 'system.otherConfig.form.appSecret',
remark: 'system.otherConfig.fields.tiktok.remark',
requireBaseUrl: true,
requireAppKey: true,
requireAppSecret: true,
},
},
{
code: PLATFORM_SHOP_CONFIG_CODES.temu,
nameKey: 'system.otherConfig.defaults.platformShopTemuName',
defaults: {
configCode: PLATFORM_SHOP_CONFIG_CODES.temu,
enabled: true,
baseUrl: 'https://openapi-b-us.temu.com/openapi/router',
timeoutSeconds: 30,
},
meta: {
baseUrl: 'system.otherConfig.fields.temu.baseUrl',
appKey: 'system.otherConfig.form.appKey',
appSecret: 'system.otherConfig.form.appSecret',
remark: 'system.otherConfig.form.remark',
requireBaseUrl: true,
requireAppKey: true,
requireAppSecret: true,
},
},
{
code: PLATFORM_SHOP_CONFIG_CODES.shopee,
nameKey: 'system.otherConfig.defaults.platformShopShopeeName',
defaults: {
configCode: PLATFORM_SHOP_CONFIG_CODES.shopee,
enabled: true,
baseUrl: 'https://partner.shopeemobile.com',
remark: 'https://openplatform.shopee.cn',
timeoutSeconds: 30,
},
meta: {
baseUrl: 'system.otherConfig.fields.shopee.baseUrl',
appKey: 'system.otherConfig.fields.shopee.appKey',
appSecret: 'system.otherConfig.fields.shopee.appSecret',
remark: 'system.otherConfig.fields.shopee.remark',
requireBaseUrl: true,
requireAppKey: true,
requireAppSecret: true,
},
},
{
code: PLATFORM_SHOP_CONFIG_CODES.lazada,
nameKey: 'system.otherConfig.defaults.platformShopLazadaName',
defaults: {
configCode: PLATFORM_SHOP_CONFIG_CODES.lazada,
enabled: true,
baseUrl: 'https://auth.lazada.com/oauth/authorize',
remark: 'https://auth.lazada.com/rest',
timeoutSeconds: 30,
},
meta: {
baseUrl: 'system.otherConfig.fields.lazada.baseUrl',
appKey: 'system.otherConfig.form.appKey',
appSecret: 'system.otherConfig.form.appSecret',
remark: 'system.otherConfig.fields.lazada.remark',
requireBaseUrl: true,
requireAppKey: true,
requireAppSecret: true,
},
},
]
const emptyForm = () => ({
configCode: TRACK_SERVICE_CONFIG_CODE,
configName: '',
enabled: false,
baseUrl: '',
appKey: '',
appSecret: '',
timeoutSeconds: 30,
remark: '',
})
const formState = reactive(emptyForm())
const createFormState = reactive(emptyForm())
const presetOptions = computed(() =>
PRESET_DEFS.map((p) => ({ label: `${t(p.nameKey)} (${p.code})`, value: p.code })),
)
const activeMeta = computed(() => resolveFieldMeta(formState.configCode))
const createActiveMeta = computed(() => resolveFieldMeta(createFormState.configCode))
const fieldLabels = computed(() => ({
baseUrl: t(activeMeta.value.baseUrl),
appKey: t(activeMeta.value.appKey),
appSecret: t(activeMeta.value.appSecret),
remark: t(activeMeta.value.remark),
}))
const createFieldLabels = computed(() => ({
baseUrl: t(createActiveMeta.value.baseUrl),
appKey: t(createActiveMeta.value.appKey),
appSecret: t(createActiveMeta.value.appSecret),
remark: t(createActiveMeta.value.remark),
}))
const fieldPlaceholders = computed(() => ({
baseUrl: t('system.otherConfig.placeholder.input'),
appKey: t('system.otherConfig.placeholder.input'),
appSecret: t('system.otherConfig.placeholder.input'),
remark: t('system.otherConfig.placeholder.input'),
}))
const showAppKey = computed(() => activeMeta.value.showAppKey !== false)
const showAppSecret = computed(() => activeMeta.value.showAppSecret !== false)
const showRemark = computed(() => activeMeta.value.showRemark !== false)
const fieldHint = computed(() => (activeMeta.value.hint ? t(activeMeta.value.hint) : ''))
const createShowAppKey = computed(() => createActiveMeta.value.showAppKey !== false)
const createShowAppSecret = computed(() => createActiveMeta.value.showAppSecret !== false)
const createShowRemark = computed(() => createActiveMeta.value.showRemark !== false)
const createFieldHint = computed(() =>
createActiveMeta.value.hint ? t(createActiveMeta.value.hint) : ''
)
function resolveFieldMeta(configCode?: string): FieldMeta {
const code = (configCode || '').trim().toLowerCase()
return (
PRESET_DEFS.find((p) => p.code === code)?.meta ?? {
baseUrl: 'system.otherConfig.form.baseUrl',
appKey: 'system.otherConfig.form.appKey',
appSecret: 'system.otherConfig.form.appSecret',
remark: 'system.otherConfig.form.remark',
requireBaseUrl: true,
requireAppKey: true,
requireAppSecret: true,
}
)
}
function buildFormRules(meta: FieldMeta, opts: { requireSecret: boolean; showKey: boolean; showSecret: boolean }) {
return {
configCode: [{ required: true, message: t('system.otherConfig.rule.configCodeRequired') }],
configName: [{ required: true, message: t('system.otherConfig.rule.configNameRequired') }],
baseUrl: meta.requireBaseUrl
? [{ required: true, message: t('system.otherConfig.rule.baseUrlRequired') }]
: [],
appKey:
meta.requireAppKey && opts.showKey
? [{ required: true, message: t('system.otherConfig.rule.appKeyRequired') }]
: [],
appSecret:
meta.requireAppSecret && opts.showSecret && opts.requireSecret
? [{ required: true, message: t('system.otherConfig.rule.appSecretRequired') }]
: [],
timeoutSeconds: [{ required: true, message: t('system.otherConfig.rule.timeoutSecondsRequired') }],
remark: meta.requireRemark
? [{ required: true, message: t('system.otherConfig.rule.remarkRequired') }]
: [],
}
}
const formRules = computed(() =>
buildFormRules(activeMeta.value, {
requireSecret: false,
showKey: showAppKey.value,
showSecret: showAppSecret.value,
})
)
const createFormRules = computed(() =>
buildFormRules(createActiveMeta.value, {
requireSecret: true,
showKey: createShowAppKey.value,
showSecret: createShowAppSecret.value,
})
)
function applyPresetTo(
target: typeof formState,
code: string,
presetRef: { value: string }
) {
const preset = PRESET_DEFS.find((p) => p.code === code)
if (!preset) return
presetRef.value = code
Object.assign(target, {
configCode: preset.defaults.configCode || code,
configName: t(preset.nameKey),
enabled: preset.defaults.enabled ?? true,
baseUrl: preset.defaults.baseUrl || '',
appKey: preset.defaults.appKey || '',
appSecret: '',
timeoutSeconds: preset.defaults.timeoutSeconds ?? 30,
remark: preset.defaults.remark || '',
})
}
function applyCreatePreset(code: string) {
applyPresetTo(createFormState, code, createSelectedPreset)
}
function handleAdd() {
createSelectedPreset.value = TRACK_SERVICE_CONFIG_CODE
applyCreatePreset(TRACK_SERVICE_CONFIG_CODE)
createModalVisible.value = true
}
async function selectOpsPanel(key: OpsPanelKey) {
activePanel.value = key
editorOpen.value = false
editingId.value = undefined
if (key === 'paymentQr') {
paymentQrTab.value = 'qr'
await Promise.all([
loadPaymentQr(),
loadBankAccounts(),
loadWechatPayMerchant(),
loadAlipayPayMerchant(),
])
return
}
if (key === 'brandLogo') {
brandLogoTab.value = 'copy'
await loadBrandLogo()
return
}
wechatNotifyActiveCode.value = ''
wechatNotifyChannelTab.value = 'wechat'
systemSmtpFormVisible.value = false
await loadWechatNotifyTemplates()
}
async function selectConfig(row: SystemOtherConfigDto) {
if (!row.id) return
activePanel.value = 'config'
editingId.value = row.id
editorOpen.value = true
try {
const detail = await getSystemOtherConfigDetail(row.id)
selectedPreset.value = detail.configCode || TRACK_SERVICE_CONFIG_CODE
Object.assign(formState, {
configCode: detail.configCode || '',
configName: detail.configName || '',
enabled: !!detail.enabled,
baseUrl: detail.baseUrl || '',
appKey: detail.appKey || '',
appSecret: detail.appSecret || '',
timeoutSeconds: detail.timeoutSeconds ?? 30,
remark: detail.remark || '',
})
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.message.loadDetailFailed'))
}
}
async function refreshCurrent() {
if (activePanel.value === 'paymentQr') {
if (paymentQrTab.value === 'bank') {
await loadBankAccounts()
return
}
if (paymentQrTab.value === 'wechatPay') {
await loadWechatPayMerchant()
return
}
if (paymentQrTab.value === 'alipayPay') {
await loadAlipayPayMerchant()
return
}
await Promise.all([
loadPaymentQr(),
loadBankAccounts(),
loadWechatPayMerchant(),
loadAlipayPayMerchant(),
])
return
}
if (activePanel.value === 'brandLogo') {
await loadBrandLogo()
return
}
if (activePanel.value === 'wechatNotify') {
await loadWechatNotifyTemplates()
return
}
await loadData()
if (editingId.value) {
const row = list.value.find((x) => String(x.id) === String(editingId.value))
if (row) await selectConfig(row)
}
}
function handleDeleteConfirm(row: Pick<SystemOtherConfigDto, 'id' | 'configName'>) {
Modal.confirm({
content: t('system.otherConfig.modal.deleteConfirmContentSingle', {
configName: row.configName || '',
}),
onOk: () => handleDelete(row.id),
})
}
async function handleDelete(id?: number | string) {
if (!id) return
await deleteSystemOtherConfig(id)
Message.success(t('system.otherConfig.message.deleteSuccess'))
if (String(editingId.value) === String(id)) {
editorOpen.value = false
editingId.value = undefined
}
await loadData()
}
const paymentQrLoading = ref(false)
const paymentQrUrls = reactive({
alipay: '',
wechat: '',
})
const paymentQrUploading = reactive({
alipay: false,
wechat: false,
})
const paymentQrDragOver = reactive({
alipay: false,
wechat: false,
})
const paymentQrLocalPreview = reactive<Record<PaymentReceiveQrChannel, string>>({
alipay: '',
wechat: '',
})
const paymentQrCards = computed(() => [
{
channel: 'alipay' as PaymentReceiveQrChannel,
title: t('system.otherConfig.paymentQr.alipay'),
url: paymentQrLocalPreview.alipay || paymentQrUrls.alipay,
uploading: paymentQrUploading.alipay,
},
{
channel: 'wechat' as PaymentReceiveQrChannel,
title: t('system.otherConfig.paymentQr.wechat'),
url: paymentQrLocalPreview.wechat || paymentQrUrls.wechat,
uploading: paymentQrUploading.wechat,
},
])
function applyPaymentQrDto(
data?: {
alipayUrl?: string
wechatUrl?: string
AlipayUrl?: string
WechatUrl?: string
} | null,
) {
const row = (data || {}) as Record<string, any>
paymentQrUrls.alipay = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'alipayUrl', 'AlipayUrl'))
paymentQrUrls.wechat = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'wechatUrl', 'WechatUrl'))
}
async function loadPaymentQr() {
paymentQrLoading.value = true
try {
const data = await getPaymentReceiveQr()
applyPaymentQrDto(data)
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.paymentQr.loadFailed'))
} finally {
paymentQrLoading.value = false
}
}
const paymentQrTab = ref<'qr' | 'bank' | 'wechatPay' | 'alipayPay'>('qr')
const wechatPayLoading = ref(false)
const wechatPaySaving = ref(false)
const alipayPayLoading = ref(false)
const alipayPaySaving = ref(false)
const alipayPayMeta = reactive({
configured: false,
hasPrivateKey: false,
hasAlipayPublicKey: false,
})
const alipayPayForm = reactive({
enabled: false,
appId: '',
notifyUrl: '',
returnUrl: '',
privateKeyPem: '',
alipayPublicKey: '',
})
const alipayPaySnapshot = reactive({
enabled: false,
appId: '',
notifyUrl: '',
returnUrl: '',
privateKeyPem: '',
alipayPublicKey: '',
})
const alipayPayErrors = reactive({
appId: '',
notifyUrl: '',
})
const wechatPayMeta = reactive({
configured: false,
hasApiV3Key: false,
hasPrivateKey: false,
hasPlatformPublicKey: false,
appId: '' as string | undefined,
})
const wechatPayForm = reactive({
enabled: false,
mchId: '',
mchSerialNo: '',
platformPublicKeyId: '',
notifyUrl: '',
apiV3Key: '',
privateKeyPem: '',
platformPublicKeyPem: '',
})
const wechatPaySnapshot = reactive({
enabled: false,
mchId: '',
mchSerialNo: '',
platformPublicKeyId: '',
notifyUrl: '',
apiV3Key: '',
privateKeyPem: '',
platformPublicKeyPem: '',
})
const wechatPayErrors = reactive({
mchId: '',
mchSerialNo: '',
platformPublicKeyId: '',
notifyUrl: '',
})
const bankAccountLoading = ref(false)
const suggestedWechatPayNotifyUrl = computed(() => {
const origin = String(prodApiOrigin() || '').replace(/\/$/, '')
return origin ? `${origin}/pay/wechat/notify` : 'https://api.example.com/pay/wechat/notify'
})
const wechatPayDirty = computed(() => {
return (
wechatPayForm.enabled !== wechatPaySnapshot.enabled ||
wechatPayForm.mchId !== wechatPaySnapshot.mchId ||
wechatPayForm.mchSerialNo !== wechatPaySnapshot.mchSerialNo ||
wechatPayForm.platformPublicKeyId !== wechatPaySnapshot.platformPublicKeyId ||
wechatPayForm.notifyUrl !== wechatPaySnapshot.notifyUrl ||
wechatPayForm.apiV3Key !== wechatPaySnapshot.apiV3Key ||
wechatPayForm.privateKeyPem !== wechatPaySnapshot.privateKeyPem ||
wechatPayForm.platformPublicKeyPem !== wechatPaySnapshot.platformPublicKeyPem
)
})
const wechatPayReady = computed(() => {
return (
wechatPayForm.enabled &&
!!wechatPayForm.mchId.trim() &&
!!wechatPayForm.mchSerialNo.trim() &&
!!wechatPayForm.platformPublicKeyId.trim() &&
!!wechatPayForm.notifyUrl.trim() &&
(wechatPayMeta.hasApiV3Key || !!wechatPayForm.apiV3Key.trim()) &&
(wechatPayMeta.hasPrivateKey || !!wechatPayForm.privateKeyPem.trim()) &&
(wechatPayMeta.hasPlatformPublicKey || !!wechatPayForm.platformPublicKeyPem.trim()) &&
!!wechatPayMeta.appId
)
})
const wechatPayChecklist = computed(() => [
{
key: 'mch',
ok:
!!wechatPayForm.mchId.trim() &&
!!wechatPayForm.mchSerialNo.trim() &&
!!wechatPayForm.platformPublicKeyId.trim(),
label: t('system.otherConfig.paymentQr.wechatPay.checkMerchant'),
},
{
key: 'notify',
ok: !!wechatPayForm.notifyUrl.trim(),
label: t('system.otherConfig.paymentQr.wechatPay.checkNotify'),
},
{
key: 'secret',
ok:
(wechatPayMeta.hasApiV3Key || !!wechatPayForm.apiV3Key.trim()) &&
(wechatPayMeta.hasPrivateKey || !!wechatPayForm.privateKeyPem.trim()) &&
(wechatPayMeta.hasPlatformPublicKey || !!wechatPayForm.platformPublicKeyPem.trim()),
label: t('system.otherConfig.paymentQr.wechatPay.checkSecret'),
},
{
key: 'appId',
ok: !!wechatPayMeta.appId,
label: t('system.otherConfig.paymentQr.wechatPay.checkAppId'),
},
])
const wechatMpConfigRow = computed(() =>
list.value.find((x) => String(x.configCode || '') === WECHAT_MP_CONFIG_CODE),
)
function applyWechatPaySnapshot() {
wechatPaySnapshot.enabled = wechatPayForm.enabled
wechatPaySnapshot.mchId = wechatPayForm.mchId
wechatPaySnapshot.mchSerialNo = wechatPayForm.mchSerialNo
wechatPaySnapshot.platformPublicKeyId = wechatPayForm.platformPublicKeyId
wechatPaySnapshot.notifyUrl = wechatPayForm.notifyUrl
wechatPaySnapshot.apiV3Key = wechatPayForm.apiV3Key
wechatPaySnapshot.privateKeyPem = wechatPayForm.privateKeyPem
wechatPaySnapshot.platformPublicKeyPem = wechatPayForm.platformPublicKeyPem
}
function fillWechatPayNotifyUrl() {
wechatPayForm.notifyUrl = suggestedWechatPayNotifyUrl.value
wechatPayErrors.notifyUrl = ''
}
function resetWechatPayForm() {
wechatPayForm.enabled = wechatPaySnapshot.enabled
wechatPayForm.mchId = wechatPaySnapshot.mchId
wechatPayForm.mchSerialNo = wechatPaySnapshot.mchSerialNo
wechatPayForm.platformPublicKeyId = wechatPaySnapshot.platformPublicKeyId
wechatPayForm.notifyUrl = wechatPaySnapshot.notifyUrl
wechatPayForm.apiV3Key = wechatPaySnapshot.apiV3Key
wechatPayForm.privateKeyPem = wechatPaySnapshot.privateKeyPem
wechatPayForm.platformPublicKeyPem = wechatPaySnapshot.platformPublicKeyPem
wechatPayErrors.mchId = ''
wechatPayErrors.mchSerialNo = ''
wechatPayErrors.platformPublicKeyId = ''
wechatPayErrors.notifyUrl = ''
}
async function openWechatMpConfig() {
const row = wechatMpConfigRow.value
if (!row) {
Message.warning(t('system.otherConfig.paymentQr.wechatPay.mpMissing'))
return
}
await selectConfig(row)
}
async function onWechatPayPemFile(ev: Event) {
const input = ev.target as HTMLInputElement
const file = input.files?.[0]
input.value = ''
if (!file) return
try {
const text = await file.text()
if (!text.includes('BEGIN')) {
Message.warning(t('system.otherConfig.paymentQr.wechatPay.pemInvalid'))
return
}
wechatPayForm.privateKeyPem = text.trim()
Message.success(t('system.otherConfig.paymentQr.wechatPay.pemImported'))
} catch {
Message.error(t('system.otherConfig.paymentQr.wechatPay.pemReadFailed'))
}
}
async function onWechatPayPublicPemFile(ev: Event) {
const input = ev.target as HTMLInputElement
const file = input.files?.[0]
input.value = ''
if (!file) return
try {
const text = await file.text()
if (!text.includes('BEGIN PUBLIC KEY')) {
Message.warning(t('system.otherConfig.paymentQr.wechatPay.publicPemInvalid'))
return
}
wechatPayForm.platformPublicKeyPem = text.trim()
Message.success(t('system.otherConfig.paymentQr.wechatPay.publicPemImported'))
} catch {
Message.error(t('system.otherConfig.paymentQr.wechatPay.pemReadFailed'))
}
}
const bankAccountRows = ref<FinanceCompanyAccount[]>([])
const bankAccountFormVisible = ref(false)
const bankAccountSaving = ref(false)
const bankAccountForm = reactive({
id: undefined as number | undefined,
accountName: '',
bankName: '',
accountNo: '',
currency: 'CNY',
isDefault: false,
})
async function loadBankAccounts() {
bankAccountLoading.value = true
try {
const { items } = await getFinanceCompanyAccountList({ page: 1, pageSize: 200 })
bankAccountRows.value = items
} catch (e) {
bankAccountRows.value = []
Message.error(extractOmsRequestError(e) || t('system.otherConfig.paymentQr.bank.loadFailed'))
} finally {
bankAccountLoading.value = false
}
}
async function loadWechatPayMerchant() {
wechatPayLoading.value = true
try {
const cfg = await getWeChatPayMerchantConfig()
wechatPayForm.enabled = cfg.enabled
wechatPayForm.mchId = cfg.mchId
wechatPayForm.mchSerialNo = cfg.mchSerialNo
wechatPayForm.platformPublicKeyId = cfg.platformPublicKeyId
wechatPayForm.notifyUrl = cfg.notifyUrl
wechatPayForm.apiV3Key = ''
wechatPayForm.privateKeyPem = ''
wechatPayForm.platformPublicKeyPem = ''
wechatPayMeta.configured = cfg.configured
wechatPayMeta.hasApiV3Key = cfg.hasApiV3Key
wechatPayMeta.hasPrivateKey = cfg.hasPrivateKey
wechatPayMeta.hasPlatformPublicKey = cfg.hasPlatformPublicKey
wechatPayMeta.appId = cfg.appId
wechatPayErrors.mchId = ''
wechatPayErrors.mchSerialNo = ''
wechatPayErrors.platformPublicKeyId = ''
wechatPayErrors.notifyUrl = ''
applyWechatPaySnapshot()
} catch (e) {
Message.error(extractOmsRequestError(e) || t('system.otherConfig.paymentQr.wechatPay.loadFailed'))
} finally {
wechatPayLoading.value = false
}
}
function validateWechatPayForm(): boolean {
let ok = true
wechatPayErrors.mchId = ''
wechatPayErrors.mchSerialNo = ''
wechatPayErrors.platformPublicKeyId = ''
wechatPayErrors.notifyUrl = ''
if (!wechatPayForm.mchId.trim()) {
wechatPayErrors.mchId = t('system.otherConfig.paymentQr.wechatPay.needMchId')
ok = false
}
if (!wechatPayForm.mchSerialNo.trim()) {
wechatPayErrors.mchSerialNo = t('system.otherConfig.paymentQr.wechatPay.needSerial')
ok = false
}
if (!wechatPayForm.platformPublicKeyId.trim()) {
wechatPayErrors.platformPublicKeyId = t('system.otherConfig.paymentQr.wechatPay.needPublicKeyId')
ok = false
}
if (!wechatPayForm.notifyUrl.trim()) {
wechatPayErrors.notifyUrl = t('system.otherConfig.paymentQr.wechatPay.needNotify')
ok = false
} else if (!/^https:\/\//i.test(wechatPayForm.notifyUrl.trim())) {
wechatPayErrors.notifyUrl = t('system.otherConfig.paymentQr.wechatPay.needHttps')
ok = false
}
if (!wechatPayMeta.hasApiV3Key && !wechatPayForm.apiV3Key.trim()) {
Message.warning(t('system.otherConfig.paymentQr.wechatPay.needApiV3Key'))
ok = false
}
if (!wechatPayMeta.hasPrivateKey && !wechatPayForm.privateKeyPem.trim()) {
Message.warning(t('system.otherConfig.paymentQr.wechatPay.needPrivateKey'))
ok = false
}
if (!wechatPayMeta.hasPlatformPublicKey && !wechatPayForm.platformPublicKeyPem.trim()) {
Message.warning(t('system.otherConfig.paymentQr.wechatPay.needPlatformPublicKey'))
ok = false
}
return ok
}
async function handleWechatPaySave() {
if (!validateWechatPayForm()) return
wechatPaySaving.value = true
try {
const cfg = await saveWeChatPayMerchantConfig({
enabled: wechatPayForm.enabled,
mchId: wechatPayForm.mchId.trim(),
mchSerialNo: wechatPayForm.mchSerialNo.trim(),
platformPublicKeyId: wechatPayForm.platformPublicKeyId.trim(),
notifyUrl: wechatPayForm.notifyUrl.trim() || undefined,
apiV3Key: wechatPayForm.apiV3Key.trim() || undefined,
privateKeyPem: wechatPayForm.privateKeyPem.trim() || undefined,
platformPublicKeyPem: wechatPayForm.platformPublicKeyPem.trim() || undefined,
})
wechatPayForm.apiV3Key = ''
wechatPayForm.privateKeyPem = ''
wechatPayForm.platformPublicKeyPem = ''
wechatPayForm.enabled = cfg.enabled
wechatPayForm.mchId = cfg.mchId
wechatPayForm.mchSerialNo = cfg.mchSerialNo
wechatPayForm.platformPublicKeyId = cfg.platformPublicKeyId
wechatPayForm.notifyUrl = cfg.notifyUrl
wechatPayMeta.configured = cfg.configured
wechatPayMeta.hasApiV3Key = cfg.hasApiV3Key
wechatPayMeta.hasPrivateKey = cfg.hasPrivateKey
wechatPayMeta.hasPlatformPublicKey = cfg.hasPlatformPublicKey
wechatPayMeta.appId = cfg.appId
applyWechatPaySnapshot()
Message.success(t('system.otherConfig.paymentQr.wechatPay.saveSuccess'))
} catch (e) {
Message.error(extractOmsRequestError(e) || t('system.otherConfig.paymentQr.wechatPay.saveFailed'))
} finally {
wechatPaySaving.value = false
}
}
const suggestedAlipayPayNotifyUrl = computed(() => {
const origin = String(prodApiOrigin() || '').replace(/\/$/, '')
return origin ? `${origin}/pay/alipay/notify` : 'https://api.example.com/pay/alipay/notify'
})
const alipayPayDirty = computed(() => {
return (
alipayPayForm.enabled !== alipayPaySnapshot.enabled ||
alipayPayForm.appId !== alipayPaySnapshot.appId ||
alipayPayForm.notifyUrl !== alipayPaySnapshot.notifyUrl ||
alipayPayForm.returnUrl !== alipayPaySnapshot.returnUrl ||
alipayPayForm.privateKeyPem !== alipayPaySnapshot.privateKeyPem ||
alipayPayForm.alipayPublicKey !== alipayPaySnapshot.alipayPublicKey
)
})
const alipayPayReady = computed(() => {
return (
alipayPayForm.enabled &&
!!alipayPayForm.appId.trim() &&
!!alipayPayForm.notifyUrl.trim() &&
(alipayPayMeta.hasPrivateKey || !!alipayPayForm.privateKeyPem.trim()) &&
(alipayPayMeta.hasAlipayPublicKey || !!alipayPayForm.alipayPublicKey.trim())
)
})
const alipayPayChecklist = computed(() => [
{
key: 'appId',
ok: !!alipayPayForm.appId.trim(),
label: t('system.otherConfig.paymentQr.alipayPay.checkAppId'),
},
{
key: 'notify',
ok: !!alipayPayForm.notifyUrl.trim(),
label: t('system.otherConfig.paymentQr.alipayPay.checkNotify'),
},
{
key: 'secret',
ok:
(alipayPayMeta.hasPrivateKey || !!alipayPayForm.privateKeyPem.trim()) &&
(alipayPayMeta.hasAlipayPublicKey || !!alipayPayForm.alipayPublicKey.trim()),
label: t('system.otherConfig.paymentQr.alipayPay.checkSecret'),
},
])
function applyAlipayPaySnapshot() {
alipayPaySnapshot.enabled = alipayPayForm.enabled
alipayPaySnapshot.appId = alipayPayForm.appId
alipayPaySnapshot.notifyUrl = alipayPayForm.notifyUrl
alipayPaySnapshot.returnUrl = alipayPayForm.returnUrl
alipayPaySnapshot.privateKeyPem = alipayPayForm.privateKeyPem
alipayPaySnapshot.alipayPublicKey = alipayPayForm.alipayPublicKey
}
function fillAlipayPayNotifyUrl() {
alipayPayForm.notifyUrl = suggestedAlipayPayNotifyUrl.value
alipayPayErrors.notifyUrl = ''
}
function resetAlipayPayForm() {
alipayPayForm.enabled = alipayPaySnapshot.enabled
alipayPayForm.appId = alipayPaySnapshot.appId
alipayPayForm.notifyUrl = alipayPaySnapshot.notifyUrl
alipayPayForm.returnUrl = alipayPaySnapshot.returnUrl
alipayPayForm.privateKeyPem = alipayPaySnapshot.privateKeyPem
alipayPayForm.alipayPublicKey = alipayPaySnapshot.alipayPublicKey
alipayPayErrors.appId = ''
alipayPayErrors.notifyUrl = ''
}
async function onAlipayPayPrivateKeyFile(ev: Event) {
const input = ev.target as HTMLInputElement
const file = input.files?.[0]
input.value = ''
if (!file) return
try {
const text = await file.text()
alipayPayForm.privateKeyPem = text.trim()
Message.success(t('system.otherConfig.paymentQr.alipayPay.pemImported'))
} catch {
Message.error(t('system.otherConfig.paymentQr.alipayPay.pemReadFailed'))
}
}
async function loadAlipayPayMerchant() {
alipayPayLoading.value = true
try {
const cfg = await getAlipayPayMerchantConfig()
alipayPayForm.enabled = cfg.enabled
alipayPayForm.appId = cfg.appId
alipayPayForm.notifyUrl = cfg.notifyUrl
alipayPayForm.returnUrl = cfg.returnUrl
alipayPayForm.privateKeyPem = ''
alipayPayForm.alipayPublicKey = ''
alipayPayMeta.configured = cfg.configured
alipayPayMeta.hasPrivateKey = cfg.hasPrivateKey
alipayPayMeta.hasAlipayPublicKey = cfg.hasAlipayPublicKey
alipayPayErrors.appId = ''
alipayPayErrors.notifyUrl = ''
applyAlipayPaySnapshot()
} catch (e) {
Message.error(extractOmsRequestError(e) || t('system.otherConfig.paymentQr.alipayPay.loadFailed'))
} finally {
alipayPayLoading.value = false
}
}
function validateAlipayPayForm(): boolean {
let ok = true
alipayPayErrors.appId = ''
alipayPayErrors.notifyUrl = ''
if (!alipayPayForm.appId.trim()) {
alipayPayErrors.appId = t('system.otherConfig.paymentQr.alipayPay.needAppId')
ok = false
}
if (!alipayPayForm.notifyUrl.trim()) {
alipayPayErrors.notifyUrl = t('system.otherConfig.paymentQr.alipayPay.needNotify')
ok = false
} else if (!/^https:\/\//i.test(alipayPayForm.notifyUrl.trim())) {
alipayPayErrors.notifyUrl = t('system.otherConfig.paymentQr.alipayPay.needHttps')
ok = false
}
if (!alipayPayMeta.hasPrivateKey && !alipayPayForm.privateKeyPem.trim()) {
Message.warning(t('system.otherConfig.paymentQr.alipayPay.needPrivateKey'))
ok = false
}
if (!alipayPayMeta.hasAlipayPublicKey && !alipayPayForm.alipayPublicKey.trim()) {
Message.warning(t('system.otherConfig.paymentQr.alipayPay.needPublicKey'))
ok = false
}
return ok
}
async function handleAlipayPaySave() {
if (!validateAlipayPayForm()) return
alipayPaySaving.value = true
try {
const cfg = await saveAlipayPayMerchantConfig({
enabled: alipayPayForm.enabled,
appId: alipayPayForm.appId.trim(),
notifyUrl: alipayPayForm.notifyUrl.trim() || undefined,
returnUrl: alipayPayForm.returnUrl.trim() || undefined,
privateKeyPem: alipayPayForm.privateKeyPem.trim() || undefined,
alipayPublicKey: alipayPayForm.alipayPublicKey.trim() || undefined,
})
alipayPayForm.privateKeyPem = ''
alipayPayForm.alipayPublicKey = ''
alipayPayForm.enabled = cfg.enabled
alipayPayForm.appId = cfg.appId
alipayPayForm.notifyUrl = cfg.notifyUrl
alipayPayForm.returnUrl = cfg.returnUrl
alipayPayMeta.configured = cfg.configured
alipayPayMeta.hasPrivateKey = cfg.hasPrivateKey
alipayPayMeta.hasAlipayPublicKey = cfg.hasAlipayPublicKey
applyAlipayPaySnapshot()
Message.success(t('system.otherConfig.paymentQr.alipayPay.saveSuccess'))
} catch (e) {
Message.error(extractOmsRequestError(e) || t('system.otherConfig.paymentQr.alipayPay.saveFailed'))
} finally {
alipayPaySaving.value = false
}
}
async function onPaymentQrTabChange(key: string | number) {
const k = String(key)
if (k === 'bank') {
await loadBankAccounts()
} else if (k === 'wechatPay') {
await loadWechatPayMerchant()
} else if (k === 'alipayPay') {
await loadAlipayPayMerchant()
}
}
function openBankAccountForm(row?: FinanceCompanyAccount) {
bankAccountForm.id = row?.id
bankAccountForm.accountName = row?.accountName || ''
bankAccountForm.bankName = row?.bankName || ''
bankAccountForm.accountNo = row?.accountNo || ''
bankAccountForm.currency = row?.currency || 'CNY'
bankAccountForm.isDefault = row?.isDefault || false
bankAccountFormVisible.value = true
}
async function handleBankAccountSave() {
if (
!bankAccountForm.accountName.trim() ||
!bankAccountForm.bankName.trim() ||
!bankAccountForm.accountNo.trim()
) {
Message.warning(t('system.otherConfig.paymentQr.bank.needFields'))
return false
}
bankAccountSaving.value = true
try {
await saveFinanceCompanyAccount({ ...bankAccountForm })
Message.success(t('system.otherConfig.paymentQr.bank.saveSuccess'))
bankAccountFormVisible.value = false
await loadBankAccounts()
return true
} catch (e) {
Message.error(extractOmsRequestError(e) || t('system.otherConfig.paymentQr.bank.saveFailed'))
return false
} finally {
bankAccountSaving.value = false
}
}
function handleBankAccountDelete(row: FinanceCompanyAccount) {
if (!row?.id) return
Modal.confirm({
title: t('system.otherConfig.paymentQr.bank.deleteConfirm'),
content: `${row.accountName} / ${row.accountNo}`,
onOk: async () => {
try {
await deleteFinanceCompanyAccount(row.id)
Message.success(t('system.otherConfig.paymentQr.bank.deleteSuccess'))
await loadBankAccounts()
} catch (e) {
Message.error(extractOmsRequestError(e) || t('system.otherConfig.paymentQr.bank.deleteFailed'))
}
},
})
}
const brandLogoTab = ref<'copy' | 'images'>('copy')
const brandLogoLoading = ref(false)
const brandLogoUrls = reactive({
portal: '',
site: '',
favicon: '',
mascot: '',
})
const brandLogoUploading = reactive({
portal: false,
site: false,
favicon: false,
mascot: false,
})
const brandLogoDragOver = reactive({
portal: false,
site: false,
favicon: false,
mascot: false,
})
const brandLogoLocalPreview = reactive<Record<BrandLogoChannel, string>>({
portal: '',
site: '',
favicon: '',
mascot: '',
})
const brandCopySaving = ref(false)
const brandCopyForm = reactive({
navName: DEFAULT_BRAND_COPY.navName,
navFullName: DEFAULT_BRAND_COPY.navFullName,
aiWelcomeTitleZh: DEFAULT_BRAND_COPY.aiWelcomeTitleZh,
aiWelcomeTitleShortZh: DEFAULT_BRAND_COPY.aiWelcomeTitleShortZh,
aiWelcomeTitleEn: DEFAULT_BRAND_COPY.aiWelcomeTitleEn,
aiWelcomeTitleShortEn: DEFAULT_BRAND_COPY.aiWelcomeTitleShortEn,
icp: DEFAULT_BRAND_COPY.icp,
})
function applyBrandCopyDto(data?: Record<string, any> | null) {
const next = rememberBrandCopy(data)
brandCopyForm.navName = next.navName
brandCopyForm.navFullName = next.navFullName
brandCopyForm.aiWelcomeTitleZh = next.aiWelcomeTitleZh
brandCopyForm.aiWelcomeTitleShortZh = next.aiWelcomeTitleShortZh
brandCopyForm.aiWelcomeTitleEn = next.aiWelcomeTitleEn
brandCopyForm.aiWelcomeTitleShortEn = next.aiWelcomeTitleShortEn
brandCopyForm.icp = next.icp
}
async function loadBrandCopy() {
try {
const data = await getBrandCopy()
applyBrandCopyDto(data as Record<string, any>)
} catch {
applyBrandCopyDto(DEFAULT_BRAND_COPY)
}
}
async function handleBrandCopySave() {
brandCopySaving.value = true
try {
const data = await saveBrandCopy({
navName: brandCopyForm.navName,
navFullName: brandCopyForm.navFullName,
aiWelcomeTitleZh: brandCopyForm.aiWelcomeTitleZh,
aiWelcomeTitleShortZh: brandCopyForm.aiWelcomeTitleShortZh,
aiWelcomeTitleEn: brandCopyForm.aiWelcomeTitleEn,
aiWelcomeTitleShortEn: brandCopyForm.aiWelcomeTitleShortEn,
icp: brandCopyForm.icp,
})
applyBrandCopyDto(data as Record<string, any>)
Message.success(t('system.otherConfig.brandLogo.copy.saveSuccess'))
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.brandLogo.copy.saveFailed'))
} finally {
brandCopySaving.value = false
}
}
function pickBrandLogoCardUrl(channel: BrandLogoChannel) {
// 优先本地上传预览 / 已落地 data URL,避免线上直连 cos.* 证书 CN 不匹配
return (
brandLogoLocalPreview[channel] ||
brandLogoImages[channel] ||
brandLogoUrls[channel] ||
''
)
}
const brandLogoCards = computed(() => [
{
channel: 'portal' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.portal'),
sizeHint: t('system.otherConfig.brandLogo.size.portal'),
url: pickBrandLogoCardUrl('portal'),
uploading: brandLogoUploading.portal,
},
{
channel: 'site' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.site'),
sizeHint: t('system.otherConfig.brandLogo.size.site'),
url: pickBrandLogoCardUrl('site'),
uploading: brandLogoUploading.site,
},
{
channel: 'favicon' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.favicon'),
sizeHint: t('system.otherConfig.brandLogo.size.favicon'),
url: pickBrandLogoCardUrl('favicon'),
uploading: brandLogoUploading.favicon,
},
{
channel: 'mascot' as BrandLogoChannel,
title: t('system.otherConfig.brandLogo.mascot'),
sizeHint: t('system.otherConfig.brandLogo.size.mascot'),
url: pickBrandLogoCardUrl('mascot'),
uploading: brandLogoUploading.mascot,
},
])
function pickBrandLogoUrl(data: Record<string, any> | null | undefined, camel: string, pascal: string) {
const raw = data?.[camel] ?? data?.[pascal]
return typeof raw === 'string' ? raw : ''
}
/** 同源 file URL 已带 v=;COS 签名 URL 勿再追加缓存戳 */
function resolveBrandLogoDisplayUrl(raw?: string | null) {
const url = resolveOmsAssetUrl(raw)
if (!url) return ''
if (
/[?&](q-sign-algorithm|x-oss-signature|Signature|v)=/i.test(url) ||
/\/system\/other-config\/(brand-logo|payment-qr)\/file\b/i.test(url)
) {
return url
}
return `${url}${url.includes('?') ? '&' : '?'}_t=${Date.now()}`
}
function applyBrandLogoDto(data?: {
portalUrl?: string
siteUrl?: string
faviconUrl?: string
mascotUrl?: string
PortalUrl?: string
SiteUrl?: string
FaviconUrl?: string
MascotUrl?: string
} | null) {
const row = (data || {}) as Record<string, any>
brandLogoUrls.portal = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'portalUrl', 'PortalUrl'))
brandLogoUrls.site = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'siteUrl', 'SiteUrl'))
brandLogoUrls.favicon = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'faviconUrl', 'FaviconUrl'))
brandLogoUrls.mascot = resolveBrandLogoDisplayUrl(pickBrandLogoUrl(row, 'mascotUrl', 'MascotUrl'))
}
function isCosBrandAssetUrl(url: string): boolean {
try {
const host = new URL(url).hostname.toLowerCase()
return host.startsWith('cos.') || host.includes('myqcloud.com')
} catch {
return false
}
}
/** 线上 cos 自定义域证书异常时,经 stream 落成本地 blob 预览,避免 <img> 直连报错 */
async function hydrateBrandLogoSafePreviews() {
const channels: BrandLogoChannel[] = ['portal', 'site', 'favicon', 'mascot']
await Promise.all(
channels.map(async (channel) => {
if (brandLogoLocalPreview[channel]?.startsWith('blob:')) return
if (brandLogoImages[channel]?.startsWith('data:')) return
const remote = brandLogoUrls[channel]
if (!remote || !isCosBrandAssetUrl(remote)) return
try {
const blob = await streamFileBlob(remote)
if (!blob.type.startsWith('image/') && blob.size <= 0) return
const prev = brandLogoLocalPreview[channel]
if (prev.startsWith('blob:')) URL.revokeObjectURL(prev)
brandLogoLocalPreview[channel] = URL.createObjectURL(blob)
} catch {
/* 保留远程地址;全局 refreshBrandImages 仍会尝试 data URL */
}
}),
)
}
async function loadBrandLogo() {
brandLogoLoading.value = true
try {
const [logoData] = await Promise.all([getBrandLogo(), loadBrandCopy()])
applyBrandLogoDto(logoData)
void refreshBrandImages()
await hydrateBrandLogoSafePreviews()
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.brandLogo.loadFailed'))
} finally {
brandLogoLoading.value = 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
if (!code) return null
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() {
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 Promise.all([
getWechatOrderNotifyTemplates(),
loadBatchEmailTemplatesForNotify(),
loadSystemSmtpStatus(),
])
wechatNotifyTemplates.value = list.map((x) => ({
...x,
templateId: x.templateId ?? '',
urlTemplate: x.urlTemplate ?? '',
fieldMappingJson: x.fieldMappingJson ?? '',
remark: x.remark ?? '',
isEnabled: !!x.isEnabled,
emailEnabled: !!x.emailEnabled,
emailTemplateName: x.emailTemplateName ?? '',
emailUseSystemSmtp: !!x.emailUseSystemSmtp,
}))
if (
!wechatNotifyActiveCode.value ||
!wechatNotifyTemplates.value.some((x) => x.eventCode === wechatNotifyActiveCode.value)
) {
wechatNotifyActiveCode.value = wechatNotifyTemplates.value[0]?.eventCode || ''
}
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.wechatOrderNotify.loadFailed'))
} finally {
wechatNotifyLoading.value = false
}
}
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({
eventCode: item.eventCode,
templateId: item.templateId || null,
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,
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'))
} finally {
wechatSaveLoading[item.eventCode] = false
}
}
async function handleWechatTrial(eventCode: string) {
const serviceNo = (wechatTrialServiceNo[eventCode] || '').trim()
if (!serviceNo) {
Message.warning(t('system.otherConfig.wechatOrderNotify.trialServiceNoRequired'))
return
}
wechatTrialLoading[eventCode] = true
try {
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 {
wechatTrialLoading[eventCode] = false
}
}
function revokePaymentQrLocalPreview(channel: PaymentReceiveQrChannel) {
const prev = paymentQrLocalPreview[channel]
if (prev && prev.startsWith('blob:')) {
URL.revokeObjectURL(prev)
}
paymentQrLocalPreview[channel] = ''
}
function setPaymentQrLocalPreview(channel: PaymentReceiveQrChannel, file: File) {
revokePaymentQrLocalPreview(channel)
paymentQrLocalPreview[channel] = URL.createObjectURL(file)
}
function openPaymentQrPicker(channel: PaymentReceiveQrChannel) {
if (paymentQrUploading[channel]) return
document
.querySelector<HTMLInputElement>(`.brand-logo-card__file[data-channel="qr-${channel}"]`)
?.click()
}
function onPaymentQrDragEnter(channel: PaymentReceiveQrChannel) {
if (paymentQrUploading[channel]) return
paymentQrDragOver[channel] = true
}
function onPaymentQrDragLeave(channel: PaymentReceiveQrChannel, e: DragEvent) {
const current = e.currentTarget as HTMLElement | null
const related = e.relatedTarget as Node | null
if (current && related && current.contains(related)) return
paymentQrDragOver[channel] = false
}
function onPaymentQrDrop(channel: PaymentReceiveQrChannel, e: DragEvent) {
paymentQrDragOver[channel] = false
if (paymentQrUploading[channel]) return
const file = e.dataTransfer?.files?.[0]
if (!isBrandLogoImageFile(file)) {
Message.warning(t('system.otherConfig.paymentQr.invalidFile'))
return
}
void uploadPaymentQrFile(channel, file)
}
function onPaymentQrFileChange(channel: PaymentReceiveQrChannel, e: Event) {
const input = e.target as HTMLInputElement
const file = input.files?.[0]
input.value = ''
if (!isBrandLogoImageFile(file)) {
if (file) Message.warning(t('system.otherConfig.paymentQr.invalidFile'))
return
}
void uploadPaymentQrFile(channel, file)
}
async function uploadPaymentQrFile(channel: PaymentReceiveQrChannel, file: File) {
setPaymentQrLocalPreview(channel, file)
paymentQrUploading[channel] = true
try {
const data = await uploadPaymentReceiveQr(channel, file)
applyPaymentQrDto(data)
revokePaymentQrLocalPreview(channel)
Message.success(t('system.otherConfig.paymentQr.uploadSuccess'))
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.paymentQr.uploadFailed'))
} finally {
paymentQrUploading[channel] = false
}
}
async function handlePaymentQrClear(channel: PaymentReceiveQrChannel) {
paymentQrUploading[channel] = true
try {
const data = await clearPaymentReceiveQr(channel)
revokePaymentQrLocalPreview(channel)
applyPaymentQrDto(data)
Message.success(t('system.otherConfig.paymentQr.clearSuccess'))
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.paymentQr.clearFailed'))
} finally {
paymentQrUploading[channel] = false
}
}
function revokeBrandLogoLocalPreview(channel: BrandLogoChannel) {
const prev = brandLogoLocalPreview[channel]
if (prev && prev.startsWith('blob:')) {
URL.revokeObjectURL(prev)
}
brandLogoLocalPreview[channel] = ''
}
function setBrandLogoLocalPreview(channel: BrandLogoChannel, file: File) {
revokeBrandLogoLocalPreview(channel)
brandLogoLocalPreview[channel] = URL.createObjectURL(file)
}
function isBrandLogoImageFile(file: File | null | undefined): file is File {
if (!file) return false
if (file.type && file.type.startsWith('image/')) return true
return /\.(png|jpe?g|webp|gif|bmp)$/i.test(file.name || '')
}
function openBrandLogoPicker(channel: BrandLogoChannel) {
if (brandLogoUploading[channel]) return
const fileInput = document.querySelector<HTMLInputElement>(
`.brand-logo-card__file[data-channel="${channel}"]`,
)
fileInput?.click()
}
function onBrandLogoDragEnter(channel: BrandLogoChannel) {
if (brandLogoUploading[channel]) return
brandLogoDragOver[channel] = true
}
function onBrandLogoDragLeave(channel: BrandLogoChannel, e: DragEvent) {
const current = e.currentTarget as HTMLElement | null
const related = e.relatedTarget as Node | null
if (current && related && current.contains(related)) return
brandLogoDragOver[channel] = false
}
function onBrandLogoDrop(channel: BrandLogoChannel, e: DragEvent) {
brandLogoDragOver[channel] = false
if (brandLogoUploading[channel]) return
const file = e.dataTransfer?.files?.[0]
if (!isBrandLogoImageFile(file)) {
Message.warning(t('system.otherConfig.brandLogo.invalidFile'))
return
}
void uploadBrandLogoFile(channel, file)
}
function onBrandLogoFileChange(channel: BrandLogoChannel, e: Event) {
const input = e.target as HTMLInputElement
const file = input.files?.[0]
input.value = ''
if (!isBrandLogoImageFile(file)) {
if (file) Message.warning(t('system.otherConfig.brandLogo.invalidFile'))
return
}
void uploadBrandLogoFile(channel, file)
}
async function uploadBrandLogoFile(channel: BrandLogoChannel, file: File) {
setBrandLogoLocalPreview(channel, file)
brandLogoUploading[channel] = true
try {
const data = await uploadBrandLogo(channel, file)
await rememberBrandImageFile(
channel,
file,
pickBrandLogoUrl(data as any, `${channel}Url`, `${channel[0].toUpperCase()}${channel.slice(1)}Url`),
)
applyBrandLogoDto(data)
brandLogoUrls[channel] = brandLogoImages[channel] || brandLogoUrls[channel]
revokeBrandLogoLocalPreview(channel)
Message.success(t('system.otherConfig.brandLogo.uploadSuccess'))
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.brandLogo.uploadFailed'))
} finally {
brandLogoUploading[channel] = false
}
}
async function handleBrandLogoClear(channel: BrandLogoChannel) {
brandLogoUploading[channel] = true
try {
const data = await clearBrandLogo(channel)
clearCachedBrandImage(channel)
revokeBrandLogoLocalPreview(channel)
applyBrandLogoDto(data)
Message.success(t('system.otherConfig.brandLogo.clearSuccess'))
} catch (e: any) {
Message.error(e?.message || t('system.otherConfig.brandLogo.clearFailed'))
} finally {
brandLogoUploading[channel] = false
}
}
async function handleSave() {
if (!editingId.value) return
try {
await formRef.value.validate()
saveLoading.value = true
await updateSystemOtherConfig({
id: editingId.value,
configCode: formState.configCode.trim(),
configName: formState.configName.trim(),
enabled: formState.enabled,
baseUrl: formState.baseUrl.trim(),
appKey: formState.appKey.trim(),
appSecret: formState.appSecret?.trim() || undefined,
timeoutSeconds: Number(formState.timeoutSeconds),
remark: formState.remark?.trim() || undefined,
})
Message.success(t('system.otherConfig.message.editSuccess'))
await loadData()
} finally {
saveLoading.value = false
}
}
async function handleCreateOk() {
try {
await createFormRef.value.validate()
} catch {
return Promise.reject(new Error('validation'))
}
createLoading.value = true
try {
const payload = {
configCode: createFormState.configCode.trim(),
configName: createFormState.configName.trim(),
enabled: createFormState.enabled,
baseUrl: createFormState.baseUrl.trim(),
appKey: createFormState.appKey.trim(),
appSecret: createFormState.appSecret?.trim() || undefined,
timeoutSeconds: Number(createFormState.timeoutSeconds),
remark: createFormState.remark?.trim() || undefined,
}
await createSystemOtherConfig(payload)
Message.success(t('system.otherConfig.message.addSuccess'))
createModalVisible.value = false
await loadData()
const created = list.value.find(
(x) => String(x.configCode || '').toLowerCase() === payload.configCode.toLowerCase()
)
if (created) await selectConfig(created)
} catch (e) {
return Promise.reject(e)
} finally {
createLoading.value = false
}
}
async function loadData() {
listLoading.value = true
try {
const { items } = await getSystemOtherConfigList({ page: 1, pageSize: 100 })
list.value = items || []
if (
activePanel.value === 'config' &&
editingId.value &&
!list.value.some((x) => String(x.id) === String(editingId.value))
) {
editorOpen.value = false
editingId.value = undefined
if (list.value[0]) await selectConfig(list.value[0])
}
} finally {
listLoading.value = false
}
}
watch(
() => createFormState.configCode,
(code) => {
if (createModalVisible.value && code) createSelectedPreset.value = code
}
)
onMounted(() => {
void loadData()
void selectOpsPanel('paymentQr')
})
</script>
<style lang="less" scoped>
.other-config-container {
width: 100%;
box-sizing: border-box;
padding: 16px 16px 24px;
background-color: var(--app-page-bg);
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
overflow-x: hidden;
overflow-y: hidden;
}
.other-config-page-card {
background: transparent;
border-radius: 0;
padding: 0;
box-shadow: none;
box-sizing: border-box;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.page-header {
flex-shrink: 0;
display: flex;
align-items: flex-start;
justify-content: space-between;
padding: 0 0 12px;
gap: 16px;
}
.page-header-main {
min-width: 0;
}
.page-title {
margin: 0;
font-size: 20px;
font-weight: 600;
color: var(--color-text-1);
}
.page-desc {
margin: 6px 0 0;
font-size: 13px;
line-height: 1.5;
color: var(--color-text-3);
}
.page-header-actions {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
flex-wrap: wrap;
justify-content: flex-end;
}
.page-header-actions__group {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 4px;
border-radius: 8px;
background: #fff;
border: 1px solid var(--color-border-2);
}
.page-header-actions__divider {
width: 1px;
height: 22px;
background: var(--color-border-2);
flex-shrink: 0;
}
.header-tool-btn {
height: 32px;
border-radius: 6px;
color: var(--color-text-2);
&:hover {
color: var(--app-primary-color, #1d7281);
border-color: color-mix(in srgb, var(--app-primary-color, #1d7281) 35%, var(--color-border-2));
}
:deep(.arco-icon) {
font-size: 14px;
}
}
.page-header-actions :deep(.arco-btn-primary.app-btn-primary-soft) {
height: 32px;
border-radius: 6px;
}
.config-empty {
flex: 1;
min-height: 240px;
display: flex;
align-items: center;
justify-content: center;
border: 1px dashed var(--color-border-2);
border-radius: 12px;
background: #fff;
}
.config-workspace {
flex: 1;
min-height: 0;
display: grid;
grid-template-columns: 280px minmax(0, 1fr);
border: 1px solid var(--color-border-2);
border-radius: 10px;
overflow: hidden;
background: #fff;
}
.config-nav {
display: flex;
flex-direction: column;
min-height: 0;
background: #f5f7f8;
border-right: 1px solid var(--color-border-2);
}
.config-nav__search {
flex-shrink: 0;
display: flex;
flex-direction: column;
gap: 8px;
padding: 12px 12px 8px;
}
.config-nav__count {
font-size: 12px;
color: var(--color-text-3);
}
.config-nav__empty {
padding: 24px 12px;
text-align: center;
font-size: 13px;
color: var(--color-text-3);
}
.config-nav__list {
flex: 1;
min-height: 0;
overflow: auto;
padding: 4px 8px 12px;
display: flex;
flex-direction: column;
gap: 4px;
}
.config-nav__group {
margin: 10px 6px 4px;
font-size: 11px;
font-weight: 600;
letter-spacing: 0.04em;
color: var(--color-text-3);
text-transform: none;
&:first-child {
margin-top: 2px;
}
}
.config-nav__item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
width: 100%;
padding: 10px 10px;
border: 0;
border-radius: 6px;
background: transparent;
text-align: left;
cursor: pointer;
transition: background 0.15s ease;
&:hover {
background: rgba(0, 0, 0, 0.04);
}
&.is-active {
background: #fff;
box-shadow: 0 0 0 1px var(--color-border-2);
}
&.is-disabled .config-nav__name {
color: var(--color-text-3);
}
}
.config-nav__main {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.config-nav__name {
font-size: 13px;
font-weight: 600;
color: var(--color-text-1);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.config-nav__code {
font-size: 11px;
color: var(--color-text-3);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.config-nav__status {
flex-shrink: 0;
padding: 1px 6px;
border-radius: 999px;
font-size: 11px;
line-height: 18px;
&.is-on {
color: var(--app-primary-color, #1d7281);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 14%, #fff);
}
&.is-off {
color: var(--color-text-3);
background: var(--color-fill-2, #e5e6eb);
}
}
.config-editor {
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
overflow: hidden;
padding: 16px 18px 12px;
background: #fff;
}
.config-editor__empty {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
color: var(--color-text-3);
font-size: 13px;
}
.config-editor__head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
padding-bottom: 12px;
border-bottom: 1px solid var(--color-border-2);
}
.config-editor__title {
margin: 0;
font-size: 16px;
font-weight: 600;
color: var(--color-text-1);
}
.config-editor__sub {
margin: 4px 0 0;
font-size: 12px;
color: var(--color-text-3);
line-height: 1.5;
}
.config-editor__head .config-editor__sub {
max-width: 640px;
}
/* 收款码:按内容高度,勿被右侧栏撑满 */
.ops-panel-grid {
flex: 0 0 auto;
align-self: start;
width: 100%;
max-width: 640px;
align-content: start;
.brand-logo-card__zone {
min-height: 200px;
height: 200px;
}
.brand-logo-card__img--qr {
max-height: 160px;
}
}
/* 品牌配置:占满编辑区宽度与可用高度 */
.brand-logo-editor {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
width: 100%;
max-width: none;
overflow: auto;
.brand-logo-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
}
.brand-logo-card__zone {
min-height: 140px;
}
.brand-logo-card__img {
max-height: 120px;
}
}
.wechat-notify-panel {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
gap: 12px;
overflow: hidden;
}
.config-editor__enable {
display: inline-flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
height: 32px;
}
.config-editor__enable-label {
font-size: 13px;
color: var(--color-text-2);
}
.config-editor__tip {
margin: 0 0 12px;
padding: 10px 12px;
border-radius: 6px;
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 8%, #fff);
color: var(--color-text-2);
font-size: 13px;
line-height: 1.55;
}
.config-editor__form {
flex: 1;
min-width: 0;
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
padding-right: 4px;
/* a-row gutter 负边距会撑出横向滚动条 */
:deep(.arco-row) {
margin-left: 0 !important;
margin-right: 0 !important;
max-width: 100%;
}
:deep(.arco-col) {
max-width: 100%;
}
}
.config-editor__foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 8px;
padding-top: 12px;
border-top: 1px solid var(--color-border-2);
}
.config-editor__foot-right {
display: flex;
align-items: center;
gap: 8px;
}
@media (max-width: 960px) {
.config-workspace {
grid-template-columns: 1fr;
}
.config-nav {
border-right: 0;
border-bottom: 1px solid var(--color-border-2);
max-height: 240px;
}
}
@media (max-width: 768px) {
.page-header {
flex-direction: column;
align-items: stretch;
}
.page-header-actions {
justify-content: flex-start;
}
.page-header-actions__divider {
display: none;
}
.page-header-actions__group {
width: 100%;
justify-content: stretch;
:deep(.arco-btn) {
flex: 1;
}
}
}
.modal-form-tip {
margin-bottom: 16px;
border-radius: 6px;
background: color-mix(in srgb, var(--app-primary-color) 8%, #fff);
border: 1px solid color-mix(in srgb, var(--app-primary-color) 18%, transparent);
color: var(--color-text-2);
font-size: 13px;
line-height: 1.5;
}
.form-section-title {
margin: 0 0 12px;
padding: 0 0 8px;
font-size: 13px;
font-weight: 600;
color: var(--color-text-2);
border-bottom: 1px solid var(--color-border-2);
~ .form-section-title {
margin-top: 8px;
}
}
.other-config-form {
width: 100%;
max-width: 100%;
box-sizing: border-box;
:deep(.arco-form-item) {
margin-bottom: 16px;
}
:deep(.arco-input-wrapper),
:deep(.arco-input-password),
:deep(.arco-textarea-wrapper),
:deep(.arco-select-view),
:deep(.arco-input-number) {
max-width: 100%;
}
}
.payment-qr-loading {
display: flex;
align-items: center;
justify-content: center;
min-height: 220px;
}
.brand-config-tabs {
flex: 1;
min-height: 0;
:deep(.arco-tabs-nav) {
margin-bottom: 12px;
}
:deep(.arco-tabs-content) {
padding-top: 0;
}
:deep(.arco-tabs-content-item) {
padding: 0;
}
}
.payment-bank-pane {
display: flex;
flex-direction: column;
gap: 12px;
width: 100%;
:deep(.arco-spin) {
display: block;
width: 100%;
}
}
.payment-bank-toolbar {
display: flex;
justify-content: flex-start;
}
.payment-bank-empty {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 8px;
max-width: 720px;
padding: 28px 24px;
border-radius: 12px;
border: 1px dashed var(--color-border-3);
background: var(--color-fill-1, #f7f8fa);
}
.payment-bank-empty__title {
margin: 0;
font-size: 14px;
font-weight: 600;
color: var(--color-text-1);
}
.payment-bank-empty__hint {
margin: 0 0 4px;
font-size: 12px;
line-height: 1.5;
color: var(--color-text-3);
max-width: 420px;
}
.payment-bank-cards {
display: flex;
flex-direction: column;
gap: 12px;
width: 100%;
max-width: 720px;
}
.payment-bank-card {
padding: 14px 16px 12px;
border-radius: 12px;
background: #fff;
border: 1px solid var(--color-border-2);
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.payment-bank-card__head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.payment-bank-card__title-wrap {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
min-width: 0;
}
.payment-bank-card__title {
margin: 0;
font-size: 14px;
font-weight: 600;
color: var(--color-text-1);
line-height: 1.3;
}
.payment-bank-card__badge {
display: inline-flex;
align-items: center;
height: 20px;
padding: 0 8px;
border-radius: 999px;
font-size: 11px;
font-weight: 500;
color: var(--app-primary-color);
background: color-mix(in srgb, var(--app-primary-color) 12%, #fff);
}
.payment-bank-card__actions {
flex-shrink: 0;
display: inline-flex;
align-items: center;
gap: 2px;
}
.payment-bank-card__fields {
display: grid;
grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) auto;
gap: 10px 16px;
margin: 0;
}
.payment-bank-card__field {
min-width: 0;
dt {
margin: 0 0 4px;
font-size: 12px;
color: var(--color-text-3);
}
dd {
margin: 0;
font-size: 13px;
color: var(--color-text-1);
word-break: break-all;
}
code {
display: inline-block;
max-width: 100%;
padding: 2px 6px;
border-radius: 6px;
background: var(--color-fill-2, #f2f3f5);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
line-height: 1.4;
}
}
.payment-bank-action {
padding: 0 4px;
color: var(--app-primary-color);
&:hover {
color: var(--app-primary-color);
}
&.arco-btn-status-danger {
color: rgb(var(--danger-6));
&:hover {
color: rgb(var(--danger-6));
}
}
}
@media (max-width: 720px) {
.payment-bank-card__fields {
grid-template-columns: 1fr;
}
}
.wx-pay-pane {
width: 100%;
min-height: 420px;
/* Arco Spin 默认 inline-block,会按开关文案等内容收缩,导致下方卡片忽宽忽窄 */
:deep(.arco-spin) {
display: block;
width: 100%;
}
:deep(.arco-spin-children),
:deep(.arco-spin > .wx-pay-pane__inner) {
width: 100%;
}
}
.wx-pay-pane__inner {
display: flex;
flex-direction: column;
gap: 14px;
width: 100%;
max-width: 1080px;
box-sizing: border-box;
}
.wx-pay-hero {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
width: 100%;
box-sizing: border-box;
padding: 16px 18px;
border-radius: 12px;
background:
linear-gradient(
135deg,
color-mix(in srgb, var(--app-primary-color) 10%, #fff) 0%,
#fff 55%
);
border: 1px solid color-mix(in srgb, var(--app-primary-color) 18%, var(--color-border-2));
}
.wx-pay-hero__main {
min-width: 0;
flex: 1;
}
.wx-pay-hero__title-row {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 6px;
}
.wx-pay-hero__title {
margin: 0;
font-size: 15px;
font-weight: 600;
color: var(--color-text-1);
}
.wx-pay-hero__tip {
margin: 0 0 10px;
font-size: 12px;
line-height: 1.55;
color: var(--color-text-3);
max-width: 720px;
}
.wx-pay-badge {
display: inline-flex;
align-items: center;
height: 22px;
padding: 0 8px;
border-radius: 999px;
font-size: 12px;
font-weight: 500;
&.is-ready {
color: rgb(var(--success-6));
background: color-mix(in srgb, rgb(var(--success-6)) 12%, #fff);
}
&.is-pending {
color: rgb(var(--warning-6));
background: color-mix(in srgb, rgb(var(--warning-6)) 12%, #fff);
}
}
.wx-pay-checklist {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.wx-pay-check {
display: inline-flex;
align-items: center;
gap: 6px;
height: 26px;
padding: 0 10px;
border-radius: 8px;
font-size: 12px;
background: var(--color-fill-2, #f2f3f5);
color: var(--color-text-2);
&.is-ok {
color: rgb(var(--success-6));
background: color-mix(in srgb, rgb(var(--success-6)) 10%, #fff);
}
&.is-miss {
color: var(--color-text-3);
}
}
.wx-pay-check__dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
opacity: 0.85;
}
.wx-pay-enable {
flex-shrink: 0;
display: flex;
align-items: center;
gap: 12px;
width: 228px;
min-width: 228px;
padding: 10px 12px;
border-radius: 10px;
background: #fff;
border: 1px solid var(--color-border-2);
cursor: pointer;
box-sizing: border-box;
}
.wx-pay-enable__text {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
flex: 1;
strong {
font-size: 13px;
color: var(--color-text-1);
}
small {
font-size: 12px;
line-height: 1.35;
color: var(--color-text-3);
}
}
.wx-pay-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
width: 100%;
}
.wx-pay-card {
padding: 14px 16px 8px;
border-radius: 12px;
background: #fff;
border: 1px solid var(--color-border-2);
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
&--wide {
grid-column: 1 / -1;
}
}
.wx-pay-card__head {
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 6px 10px;
margin-bottom: 10px;
strong {
font-size: 13px;
color: var(--color-text-1);
}
span {
font-size: 12px;
color: var(--color-text-3);
}
}
.wx-pay-form {
:deep(.arco-form-item) {
margin-bottom: 14px;
}
:deep(.arco-form-item-label-col > .arco-form-item-label) {
font-size: 13px;
}
}
.wx-pay-label {
display: inline-flex;
align-items: center;
gap: 8px;
}
.wx-pay-tag {
display: inline-flex;
align-items: center;
height: 18px;
padding: 0 6px;
border-radius: 4px;
font-size: 11px;
font-weight: 500;
&.is-ok {
color: rgb(var(--success-6));
background: color-mix(in srgb, rgb(var(--success-6)) 12%, #fff);
}
&.is-miss {
color: rgb(var(--warning-6));
background: color-mix(in srgb, rgb(var(--warning-6)) 12%, #fff);
}
}
.wx-pay-field-row {
display: flex;
gap: 8px;
width: 100%;
.arco-input-wrapper {
flex: 1;
min-width: 0;
}
}
.wx-pay-field-row__btn {
flex-shrink: 0;
}
.wx-pay-pem-block {
display: flex;
flex-direction: column;
gap: 8px;
width: 100%;
min-width: 0;
}
.wx-pay-pem {
width: 100%;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
}
.wx-pay-pem-actions {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 10px 14px;
width: 100%;
}
.wx-pay-file {
position: relative;
display: inline-flex;
align-items: center;
flex-shrink: 0;
height: 30px;
padding: 0 12px;
border-radius: 6px;
border: 1px dashed var(--color-border-3);
background: var(--color-fill-1, #f7f8fa);
color: var(--color-text-2);
font-size: 12px;
white-space: nowrap;
cursor: pointer;
input {
position: absolute;
inset: 0;
opacity: 0;
cursor: pointer;
}
&:hover {
border-color: color-mix(in srgb, var(--app-primary-color) 45%, var(--color-border-3));
color: var(--app-primary-color);
}
}
.wx-pay-link-btn {
border: none;
background: transparent;
padding: 0;
color: var(--color-text-3);
font-size: 12px;
cursor: pointer;
&:hover {
color: rgb(var(--danger-6));
}
}
.wx-pay-bind {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 4px 0 10px;
}
.wx-pay-bind__field {
min-width: 0;
display: flex;
flex-direction: column;
gap: 4px;
}
.wx-pay-bind__label {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 12px;
color: var(--color-text-3);
}
.wx-pay-bind__value {
display: inline-block;
max-width: 100%;
padding: 4px 8px;
border-radius: 6px;
background: var(--color-fill-2, #f2f3f5);
color: var(--color-text-1);
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wx-pay-bind__empty {
font-size: 13px;
color: rgb(var(--warning-6));
}
.wx-pay-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 14px;
border-radius: 12px;
background: var(--color-fill-1, #f7f8fa);
border: 1px solid var(--color-border-2);
position: sticky;
bottom: 0;
z-index: 2;
}
.wx-pay-footer__hint {
font-size: 12px;
color: var(--color-text-3);
}
.wx-pay-footer__actions {
display: flex;
gap: 8px;
flex-shrink: 0;
}
@media (max-width: 960px) {
.wx-pay-hero {
flex-direction: column;
}
.wx-pay-enable {
width: 100%;
justify-content: space-between;
}
.wx-pay-grid {
grid-template-columns: 1fr;
}
.wx-pay-footer {
flex-direction: column;
align-items: stretch;
}
.wx-pay-footer__actions {
justify-content: flex-end;
}
}
.brand-copy-pane {
display: flex;
flex-direction: column;
gap: 14px;
max-width: 960px;
}
.brand-copy-block {
padding: 14px 16px;
border: 1px solid var(--color-border-2);
border-radius: 8px;
background: var(--color-fill-1, #f7f8fa);
}
.brand-copy-block__head {
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 6px 8px;
margin-bottom: 8px;
strong {
font-size: 13px;
font-weight: 600;
color: var(--color-text-1);
}
span {
font-size: 12px;
color: var(--color-text-3);
}
}
.brand-copy-fields {
display: grid;
gap: 8px 12px;
}
.brand-copy-fields--nav {
grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
}
.brand-copy-fields--ai {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.brand-copy-field {
display: grid;
gap: 4px;
min-width: 0;
margin: 0;
> span {
font-size: 12px;
line-height: 1.3;
color: var(--color-text-2);
}
}
.brand-copy-field--full {
grid-column: 1 / -1;
}
.brand-copy-actions {
display: flex;
justify-content: flex-end;
margin-top: auto;
}
.brand-logo-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.brand-logo-card {
display: flex;
flex-direction: column;
gap: 6px;
min-width: 0;
min-height: 0;
padding: 10px;
border: 1px solid var(--color-border-2);
border-radius: 8px;
background: #fff;
}
.brand-logo-card__meta {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 8px;
min-width: 0;
}
.brand-logo-card__meta-text {
display: grid;
gap: 4px;
min-width: 0;
flex: 1;
}
.brand-logo-card__title {
font-size: 14px;
font-weight: 600;
color: var(--color-text-1);
line-height: 1.3;
}
.brand-logo-card__size {
font-size: 12px;
line-height: 1.45;
color: var(--color-text-3);
}
.brand-logo-card__clear {
flex-shrink: 0;
margin-top: -2px;
}
.brand-logo-card__upload {
width: 100%;
flex: 1;
:deep(.arco-upload),
:deep(.arco-upload-trigger),
:deep(.arco-upload-list) {
width: 100%;
}
:deep(.arco-upload-drag) {
width: 100%;
padding: 0;
border: none;
background: transparent;
}
}
.brand-logo-card__zone {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
width: 100%;
min-height: 96px;
padding: 10px;
border: 1px dashed var(--color-border-3, #c9cdd4);
border-radius: 8px;
background: var(--color-fill-1, #f7f8fa);
overflow: hidden;
cursor: pointer;
transition:
border-color 0.15s ease,
background-color 0.15s ease;
&:hover:not(.is-uploading) {
border-color: var(--app-primary-color, #1d7281);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 6%, #fff);
}
&.is-filled {
border-style: solid;
background: #fff;
}
&.is-dragover {
border-color: var(--app-primary-color, #1d7281);
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 10%, #fff);
}
&.is-uploading {
cursor: wait;
}
}
.brand-logo-card__file {
position: absolute;
width: 0;
height: 0;
opacity: 0;
pointer-events: none;
}
.brand-logo-card__img {
max-width: 100%;
max-height: 88px;
object-fit: contain;
display: block;
}
.brand-logo-card__img--qr {
max-height: 200px;
}
.brand-logo-card__mark {
font-size: 22px;
font-weight: 700;
letter-spacing: 0.12em;
line-height: 1;
color: var(--color-text-3, #86909c);
user-select: none;
}
.brand-logo-card__hint {
font-size: 12px;
color: var(--color-text-3);
text-align: center;
}
.brand-logo-card__mask {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
padding: 8px;
background: rgba(0, 0, 0, 0.45);
color: #fff;
font-size: 13px;
opacity: 0;
transition: opacity 0.15s ease;
pointer-events: none;
&.is-busy {
opacity: 1;
}
}
.brand-logo-card__zone.is-filled:hover .brand-logo-card__mask {
opacity: 1;
}
@media (max-width: 720px) {
.brand-logo-grid {
grid-template-columns: 1fr;
}
}
.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;
border-radius: 6px;
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 8%, #fff);
color: var(--color-text-2);
font-size: 13px;
line-height: 1.55;
}
.wechat-notify-loading {
display: flex;
align-items: center;
justify-content: center;
min-height: 360px;
}
.wechat-notify-layout {
display: grid;
grid-template-columns: 200px minmax(0, 1fr);
gap: 0;
flex: 1;
min-height: 420px;
border: 1px solid var(--color-border-2);
border-radius: 8px;
overflow: hidden;
background: #fff;
}
.wechat-notify-nav {
display: flex;
flex-direction: column;
gap: 4px;
padding: 10px 8px;
background: #f5f7f8;
border-right: 1px solid var(--color-border-2);
overflow: auto;
}
.wechat-notify-nav__item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
width: 100%;
padding: 10px 10px;
border: 0;
border-radius: 6px;
background: transparent;
text-align: left;
cursor: pointer;
transition: background 0.15s ease;
&:hover {
background: rgba(0, 0, 0, 0.04);
}
&.is-active {
background: #fff;
box-shadow: 0 0 0 1px var(--color-border-2);
}
}
.wechat-notify-nav__main {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.wechat-notify-nav__name {
font-size: 13px;
font-weight: 600;
color: var(--color-text-1);
}
.wechat-notify-nav__code {
font-size: 11px;
color: var(--color-text-3);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.wechat-notify-nav__channels {
display: flex;
flex-direction: column;
gap: 4px;
flex-shrink: 0;
}
.wechat-notify-nav__chip {
padding: 0 6px;
border-radius: 999px;
font-size: 11px;
line-height: 18px;
text-align: center;
&.is-on {
color: #00b42a;
background: color-mix(in srgb, #00b42a 14%, #fff);
}
&.is-off {
color: var(--color-text-3);
background: var(--color-fill-2, #e5e6eb);
}
}
.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;
background: #fff;
}
.wechat-notify-editor--empty {
align-items: center;
justify-content: center;
color: var(--color-text-3);
font-size: 13px;
}
.wechat-notify-editor__head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 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: 15px;
font-weight: 600;
color: var(--color-text-1);
}
.wechat-notify-editor__sub {
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;
}
.wechat-notify-editor__enable {
display: inline-flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
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 {
font-size: 13px;
color: var(--color-text-2);
}
.wechat-notify-editor__scroll {
flex: 1;
min-height: 0;
overflow: auto;
padding: 12px 16px;
}
.wechat-notify-editor__form {
:deep(.arco-form-item) {
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 {
display: block;
margin-top: 4px;
font-size: 12px;
line-height: 1.45;
color: var(--color-text-3);
}
.wechat-notify-editor__foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-shrink: 0;
padding: 10px 16px;
border-top: 1px solid var(--color-border-2);
background: #fafbfc;
}
.wechat-notify-editor__trial-actions {
display: flex;
align-items: center;
gap: 8px;
flex: 1;
min-width: 0;
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;
}
@media (max-width: 720px) {
.wechat-notify-layout {
grid-template-columns: 1fr;
min-height: 0;
}
.wechat-notify-nav {
flex-direction: row;
flex-wrap: wrap;
border-right: 0;
border-bottom: 1px solid var(--color-border-2);
}
.wechat-notify-nav__item {
width: auto;
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-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>