货币体系: 全平台统一使用积分(POINT)替代人民币(CNY)
后端: - 模型 currency 默认值 CNY→POINT (MerchantProduct/WalletAccount/FulfillmentOrder) - DashboardStats TotalSales/TotalFees 从 float64 改为 int64,去掉 /100.0 转换 - 上游 OpenOrderQuery.Amount 从 float64 改为 int64,直接返回积分整数 - 钱包/商品创建时 currency 默认 POINT 前端: - 去掉 centsToYuan/yuanToCents 转换函数,金额直接用整数积分 - money() 显示从 ¥X.XX 改为 X 积分 - 商品售价/成本表单字段名改回 price_amount/cost_amount,precision 改 0 - 钱包调整表单 amount_yuan→amount,precision 改 0 - 手续费固定金额表单 precision 改 0,label 改积分 - 币种选项 CNY→POINT - Dashboard 成交金额/手续费 suffix 元→积分,去掉 precision 数据库: - 新增迁移 004: currency 默认值 CNY→POINT,存量数据更新
This commit is contained in:
@@ -70,7 +70,7 @@ export default function PlatformMerchants() {
|
||||
features: featureListToText(values.features),
|
||||
fee_type: values.fee_type,
|
||||
fee_rate_bp: Number(values.fee_rate_bp || 0),
|
||||
fee_fixed_amount: yuanToCents(values.fee_fixed_yuan),
|
||||
fee_fixed_amount: Number(values.fee_fixed_amount || 0),
|
||||
})
|
||||
message.success('商户已创建')
|
||||
setCreateOpen(false)
|
||||
@@ -93,7 +93,7 @@ export default function PlatformMerchants() {
|
||||
features: featureListToText(values.features),
|
||||
fee_type: values.fee_type,
|
||||
fee_rate_bp: Number(values.fee_rate_bp || 0),
|
||||
fee_fixed_amount: yuanToCents(values.fee_fixed_yuan),
|
||||
fee_fixed_amount: Number(values.fee_fixed_amount || 0),
|
||||
})
|
||||
message.success('商户设置已更新')
|
||||
setSettingsOpen(false)
|
||||
@@ -131,7 +131,7 @@ export default function PlatformMerchants() {
|
||||
width: 160,
|
||||
render: (_, r) =>
|
||||
r.fee_type === 'fixed'
|
||||
? `固定 ¥${centsToYuan(r.fee_fixed_amount).toFixed(2)}/单`
|
||||
? `固定 ${r.fee_fixed_amount} 积分/单`
|
||||
: `${(r.fee_rate_bp / 100).toFixed(2)}%`,
|
||||
},
|
||||
{
|
||||
@@ -174,7 +174,7 @@ export default function PlatformMerchants() {
|
||||
...record,
|
||||
features: featuresToList(record.features),
|
||||
fee_type: record.fee_type || 'rate',
|
||||
fee_fixed_yuan: centsToYuan(record.fee_fixed_amount),
|
||||
fee_fixed_amount: record.fee_fixed_amount,
|
||||
})
|
||||
setSettingsOpen(true)
|
||||
}}
|
||||
@@ -221,7 +221,7 @@ export default function PlatformMerchants() {
|
||||
features: featureOptions.map((item) => item.value),
|
||||
fee_type: 'rate',
|
||||
fee_rate_bp: 0,
|
||||
fee_fixed_yuan: 0,
|
||||
fee_fixed_amount: 0,
|
||||
})
|
||||
setCreateOpen(true)
|
||||
}}
|
||||
@@ -281,15 +281,15 @@ export default function PlatformMerchants() {
|
||||
<Select
|
||||
options={[
|
||||
{ value: 'rate', label: '按百分比(每单按订单金额比例收取)' },
|
||||
{ value: 'fixed', label: '按固定金额(每单固定手续费)' },
|
||||
{ value: 'fixed', label: '按固定金额(每单固定积分)' },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item noStyle shouldUpdate={(prev, cur) => prev.fee_type !== cur.fee_type}>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('fee_type') === 'fixed' ? (
|
||||
<Form.Item name="fee_fixed_yuan" label="每单固定手续费(元)" rules={[{ required: true }]}>
|
||||
<InputNumber min={0} precision={2} style={{ width: '100%' }} />
|
||||
<Form.Item name="fee_fixed_amount" label="每单固定手续费(积分)" rules={[{ required: true }]}>
|
||||
<InputNumber min={0} precision={0} style={{ width: '100%' }} />
|
||||
</Form.Item>
|
||||
) : (
|
||||
<Form.Item name="fee_rate_bp" label="手续费比例 BP(1BP=0.01%,如 250=2.5%)" rules={[{ required: true }]}>
|
||||
@@ -324,15 +324,15 @@ export default function PlatformMerchants() {
|
||||
<Select
|
||||
options={[
|
||||
{ value: 'rate', label: '按百分比(每单按订单金额比例收取)' },
|
||||
{ value: 'fixed', label: '按固定金额(每单固定手续费)' },
|
||||
{ value: 'fixed', label: '按固定金额(每单固定积分)' },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item noStyle shouldUpdate={(prev, cur) => prev.fee_type !== cur.fee_type}>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('fee_type') === 'fixed' ? (
|
||||
<Form.Item name="fee_fixed_yuan" label="每单固定手续费(元)" rules={[{ required: true }]}>
|
||||
<InputNumber min={0} precision={2} style={{ width: '100%' }} />
|
||||
<Form.Item name="fee_fixed_amount" label="每单固定手续费(积分)" rules={[{ required: true }]}>
|
||||
<InputNumber min={0} precision={0} style={{ width: '100%' }} />
|
||||
</Form.Item>
|
||||
) : (
|
||||
<Form.Item name="fee_rate_bp" label="手续费比例 BP(1BP=0.01%,如 250=2.5%)" rules={[{ required: true }]}>
|
||||
@@ -381,11 +381,3 @@ function featureListToText(features?: string[]) {
|
||||
function featureText(feature: string) {
|
||||
return featureOptions.find((item) => item.value === feature)?.label || feature
|
||||
}
|
||||
|
||||
function yuanToCents(value?: number | null) {
|
||||
return Math.round(Number(value || 0) * 100)
|
||||
}
|
||||
|
||||
function centsToYuan(value?: number | null) {
|
||||
return Number(((value || 0) / 100).toFixed(2))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user