优化页面展示 计价 分成
This commit is contained in:
parent
8ba44ae2fb
commit
2da956c1b4
@ -132,8 +132,8 @@ const {
|
||||
render: (row) => {
|
||||
if (!row.pricingRule) return '';
|
||||
const suffixMap = {
|
||||
'gjjjnzh': ' * 交易金额',
|
||||
'xzzhsdshlcltsdj': ' 元/条',
|
||||
'BIZ006': ' * 交易金额',
|
||||
'BIZ028': ' * 交易金额',
|
||||
'default': ' 元/条'
|
||||
};
|
||||
|
||||
|
@ -149,7 +149,10 @@ watch(visible, () => {
|
||||
:rows="3"
|
||||
placeholder="请输入计价规则说明"
|
||||
>
|
||||
<template #suffix>
|
||||
<template v-if="model.typeId === 'BIZ006' || model.typeId === 'BIZ028' " #suffix>
|
||||
* 交易金额
|
||||
</template>
|
||||
<template else #suffix>
|
||||
元/条
|
||||
</template>
|
||||
</NInput>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script setup lang="tsx">
|
||||
import { NDivider } from 'naive-ui';
|
||||
import { NDivider, NEllipsis } from 'naive-ui';
|
||||
import { fetchBatchDeletePercentage, fetchGetPercentageList } from '@/service/api/business/percentage';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useAuth } from '@/hooks/business/auth';
|
||||
@ -79,7 +79,24 @@ const {
|
||||
align: 'center',
|
||||
minWidth: 120,
|
||||
ellipsis: true,
|
||||
resizable: true
|
||||
resizable: true,
|
||||
render: (row,index) => {
|
||||
if (row.yxPercent === null || row.yxPercent === undefined) return '';
|
||||
|
||||
// 将小数转换为百分比(乘以100)
|
||||
const percentageValue = parseFloat(row.yxPercent) * 100;
|
||||
|
||||
// 可选:去除小数点后的多余零(如50.00% → 50%)
|
||||
const formattedValue = percentageValue % 1 === 0
|
||||
? percentageValue.toFixed(0)
|
||||
: percentageValue.toFixed(2);
|
||||
|
||||
return (
|
||||
<NEllipsis style="width: 100%;" tooltip={true}>
|
||||
{formattedValue}%
|
||||
</NEllipsis>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'jbPercent',
|
||||
@ -87,7 +104,24 @@ const {
|
||||
align: 'center',
|
||||
minWidth: 120,
|
||||
ellipsis: true,
|
||||
resizable: true
|
||||
resizable: true,
|
||||
render: (row,index) => {
|
||||
if (row.jbPercent === null || row.jbPercent === undefined) return '';
|
||||
|
||||
// 将小数转换为百分比(乘以100)
|
||||
const percentageValue = parseFloat(row.jbPercent) * 100;
|
||||
|
||||
// 可选:去除小数点后的多余零(如50.00% → 50%)
|
||||
const formattedValue = percentageValue % 1 === 0
|
||||
? percentageValue.toFixed(0)
|
||||
: percentageValue.toFixed(2);
|
||||
|
||||
return (
|
||||
<NEllipsis style="width: 100%;" tooltip={true}>
|
||||
{formattedValue}%
|
||||
</NEllipsis>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'operate',
|
||||
@ -112,7 +146,7 @@ const {
|
||||
type="primary"
|
||||
local-icon="drive-file-rename-outline-outline"
|
||||
tooltipContent={$t('common.edit')}
|
||||
onClick={() => edit(row.id!)}
|
||||
onClick={() => edit(row.branchId!)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -128,7 +162,7 @@ const {
|
||||
local-icon="delete-outline"
|
||||
tooltipContent={$t('common.delete')}
|
||||
popconfirmContent={$t('common.confirmDelete')}
|
||||
onPositiveClick={() => handleDelete(row.id!)}
|
||||
onPositiveClick={() => handleDelete(row.branchId!)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -192,7 +226,7 @@ async function handleDelete(id: CommonType.IdType) {
|
||||
}
|
||||
|
||||
function edit(id: CommonType.IdType) {
|
||||
handleEdit('id', id);
|
||||
handleEdit('branchId', id);
|
||||
}
|
||||
|
||||
function handleImport() {
|
||||
@ -242,7 +276,7 @@ function handleExport() {
|
||||
:scroll-x="scrollX"
|
||||
:loading="loading"
|
||||
remote
|
||||
:row-key="row => row.id"
|
||||
:row-key="row => row.branchId"
|
||||
:pagination="mobilePagination"
|
||||
class="sm:h-full"
|
||||
@update-resize-widths="scrollX = calculateTotalWidth()"
|
||||
|
@ -47,8 +47,8 @@ function createDefaultModel(): Model {
|
||||
return {
|
||||
branchId: '',
|
||||
branchName: '',
|
||||
yxPercent: undefined,
|
||||
jbPercent: undefined,
|
||||
yxPercent: 0.5,
|
||||
jbPercent: 0.5,
|
||||
};
|
||||
}
|
||||
|
||||
@ -121,6 +121,28 @@ watch(visible, () => {
|
||||
restoreValidation();
|
||||
}
|
||||
});
|
||||
|
||||
function handlePercentageChange(changedField: 'yx' | 'jb') {
|
||||
if (changedField === 'yx') {
|
||||
displayJbPercent.value = 100 - displayYxPercent.value
|
||||
} else {
|
||||
displayYxPercent.value = 100 - displayJbPercent.value
|
||||
}
|
||||
}
|
||||
|
||||
const displayYxPercent = computed({
|
||||
get: () => model.yxPercent ? Math.round(model.yxPercent * 100) : 0,
|
||||
set: (val) => {
|
||||
model.yxPercent = val ? val / 100 : 0
|
||||
}
|
||||
})
|
||||
|
||||
const displayJbPercent = computed({
|
||||
get: () => model.jbPercent ? Math.round(model.jbPercent * 100) : 0,
|
||||
set: (val) => {
|
||||
model.jbPercent = val ? val / 100 : 0
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -134,10 +156,34 @@ watch(visible, () => {
|
||||
<NInput v-model:value="model.branchName" placeholder="请输入支行名称" />
|
||||
</NFormItem>
|
||||
<NFormItem label="营销人员分成比例" path="yxPercent">
|
||||
<NInput v-model:value="model.yxPercent" placeholder="请输入营销人员分成比例" />
|
||||
<!-- <NInput v-model:value="model.yxPercent" placeholder="请输入营销人员分成比例" />-->
|
||||
<NInput-number
|
||||
v-model:value="displayYxPercent"
|
||||
:min="0"
|
||||
:max="100"
|
||||
:precision="0"
|
||||
step="10"
|
||||
@update:value="handlePercentageChange('yx')"
|
||||
placeholder="请输入营销人员分成比例"
|
||||
>
|
||||
<template #suffix>
|
||||
%
|
||||
</template>
|
||||
</NInput-number>
|
||||
</NFormItem>
|
||||
<NFormItem label="经办人员分成比例" path="jbPercent">
|
||||
<NInput v-model:value="model.jbPercent" placeholder="请输入经办人员分成比例" />
|
||||
<NInput-number
|
||||
v-model:value="displayJbPercent"
|
||||
:min="0"
|
||||
:max="100"
|
||||
:precision="0"
|
||||
step="10"
|
||||
@update:value="handlePercentageChange('jb')"
|
||||
placeholder="请输入经办人员分成比例" >
|
||||
<template #suffix>
|
||||
%
|
||||
</template>
|
||||
</NInput-number>
|
||||
</NFormItem>
|
||||
</NForm>
|
||||
<template #footer>
|
||||
|
Loading…
Reference in New Issue
Block a user