fix: 回调配置, 调整信用位置, 套餐
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m55s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m55s
This commit is contained in:
@@ -21,10 +21,10 @@
|
||||
<ElDescriptionsItem label="状态">
|
||||
{{ role.status === 1 ? '启用' : '禁用' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="新建代理默认信用">
|
||||
<ElDescriptionsItem label="代理默认信用">
|
||||
{{ role.default_credit_enabled ? '启用' : '未启用' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="默认信用额度">
|
||||
<ElDescriptionsItem label="默认信用额度(元)">
|
||||
{{ formatCredit(role.default_credit_limit) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="信用生效范围">
|
||||
@@ -60,7 +60,10 @@
|
||||
|
||||
const formatCredit = (value?: number) => {
|
||||
if (value === undefined || value === null) return '-'
|
||||
return `${(value / 100).toFixed(2)} 元`
|
||||
return (value / 100).toLocaleString('zh-CN', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2
|
||||
})
|
||||
}
|
||||
|
||||
const handleBack = () => router.back()
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="默认信用额度">
|
||||
<div class="credit-form-unit">单位:元</div>
|
||||
<ElInputNumber
|
||||
v-model="form.credit_limit_yuan"
|
||||
:disabled="!form.credit_enabled"
|
||||
@@ -97,8 +98,10 @@
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
placeholder="请输入默认信用额度"
|
||||
:formatter="formatCreditInput"
|
||||
:parser="parseCreditInput"
|
||||
/>
|
||||
<div class="credit-form-tip">单位:元。修改后不会影响已有店铺</div>
|
||||
<div class="credit-form-tip">修改后不会影响已有店铺</div>
|
||||
</ElFormItem>
|
||||
</template>
|
||||
</ElForm>
|
||||
@@ -349,8 +352,8 @@
|
||||
{ label: '角色名称', prop: 'role_name' },
|
||||
{ label: '角色描述', prop: 'role_desc' },
|
||||
{ label: '角色类型', prop: 'role_type' },
|
||||
{ label: '新建代理默认信用', prop: 'default_credit_enabled' },
|
||||
{ label: '默认信用额度', prop: 'default_credit_limit' },
|
||||
{ label: '代理默认信用', prop: 'default_credit_enabled' },
|
||||
{ label: '默认信用额度(元)', prop: 'default_credit_limit' },
|
||||
...(canUpdateRoleStatus ? [{ label: '状态', prop: 'status' }] : []),
|
||||
{ label: '创建时间', prop: 'created_at' }
|
||||
]
|
||||
@@ -414,6 +417,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
const formatCreditInput = (value: string | number | undefined) => {
|
||||
if (value === undefined || value === null || value === '') return ''
|
||||
|
||||
const normalizedValue = String(value).replace(/,/g, '')
|
||||
const [integerPart, decimalPart] = normalizedValue.split('.')
|
||||
const formattedIntegerPart = (integerPart || '0').replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||
|
||||
return decimalPart === undefined
|
||||
? formattedIntegerPart
|
||||
: `${formattedIntegerPart}.${decimalPart}`
|
||||
}
|
||||
|
||||
const parseCreditInput = (value: string) => value.replace(/,/g, '')
|
||||
|
||||
const formatCreditYuan = (value?: number | null) => {
|
||||
if (value === undefined || value === null) return '-'
|
||||
|
||||
return fenToYuan(value).toLocaleString('zh-CN', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2
|
||||
})
|
||||
}
|
||||
|
||||
const roleList = ref<PlatformRole[]>([])
|
||||
|
||||
const getRoleId = (role: PlatformRole | any) => getCompatibleNumericId(role) ?? 0
|
||||
@@ -463,7 +489,7 @@
|
||||
},
|
||||
{
|
||||
prop: 'default_credit_enabled',
|
||||
label: '新建代理默认信用',
|
||||
label: '代理默认信用',
|
||||
width: 150,
|
||||
formatter: (row: PlatformRole) => {
|
||||
if (row.role_type !== RoleType.CUSTOMER) return '-'
|
||||
@@ -474,11 +500,11 @@
|
||||
},
|
||||
{
|
||||
prop: 'default_credit_limit',
|
||||
label: '默认信用额度',
|
||||
width: 140,
|
||||
label: '默认信用额度(元)',
|
||||
width: 160,
|
||||
formatter: (row: PlatformRole) => {
|
||||
if (row.role_type !== RoleType.CUSTOMER || !row.default_credit_enabled) return '-'
|
||||
return `${fenToYuan(row.default_credit_limit)} 元`
|
||||
return formatCreditYuan(row.default_credit_limit)
|
||||
}
|
||||
},
|
||||
...(canUpdateRoleStatus
|
||||
@@ -1267,6 +1293,13 @@
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.credit-form-unit {
|
||||
margin-bottom: 6px;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.permission-tree-transfer-container {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
|
||||
Reference in New Issue
Block a user