Compare commits

...

2 Commits

Author SHA1 Message Date
c7882571fc Merge pull request 'fix: 修复标准创建的参数错误' (#3) from develop into main
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m0s
Reviewed-on: https://code.juyouwu.cn/pay/pay-admin/pulls/3
2025-09-08 18:53:49 +08:00
uiuJun
1f10028524 fix: 修复标准创建的参数错误
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m1s
2025-09-08 18:53:13 +08:00
3 changed files with 128 additions and 66 deletions

View File

@ -76,9 +76,17 @@ export default function Create(props: MyBetaModalFormProps) {
// 避免计费模式切换导致的价格异常
price:
values?.price_algorithm ===
HouseChargeStandardsPriceAlgorithmEnum.Fixed.value
HouseChargeStandardsPriceAlgorithmEnum.Fixed.value ||
values?.calculation_mode ===
HouseChargeStandardsCalculationModeEnum.FixedAmount.value
? values.price
: 0,
is_tiered:
values?.price_algorithm ===
HouseChargeStandardsPriceAlgorithmEnum.Fixed.value
? 0
: 1,
})
.then(() => {
props.reload?.();
@ -148,6 +156,12 @@ export default function Create(props: MyBetaModalFormProps) {
return obj;
},
required: true,
fieldProps: {
onChange: () => {
// 切换计量单位时清空计费模式
form.setFieldValue('calculation_mode', undefined);
},
},
}),
]
: charge_type === HouseBillsTypeEnum.WaterFee.value ||
@ -172,6 +186,12 @@ export default function Create(props: MyBetaModalFormProps) {
return obj;
},
required: true,
fieldProps: {
onChange: () => {
// 切换计量单位时清空计费模式
form.setFieldValue('calculation_mode', undefined);
},
},
}),
]
: [];
@ -203,7 +223,14 @@ export default function Create(props: MyBetaModalFormProps) {
key: 'calculation_mode',
title: '计费模式',
colProps: { span: 12 },
valueEnum: HouseChargeStandardsCalculationModeEnum,
// valueEnum: HouseChargeStandardsCalculationModeEnum,
valueEnum: () => {
let obj: any = JSON.parse(
JSON.stringify(HouseChargeStandardsCalculationModeEnum),
);
delete obj.FixedAmount;
return obj;
},
required: true,
}),
];
@ -256,6 +283,7 @@ export default function Create(props: MyBetaModalFormProps) {
colProps: { span: 10 },
fieldProps: {
addonAfter: '元',
max: 99,
},
formItemProps: { ...rulesHelper.number },
},
@ -270,8 +298,8 @@ export default function Create(props: MyBetaModalFormProps) {
formItemProps: { ...rulesHelper.array },
initialValue: [
{
start: 0,
end: null,
min_quantity: 0,
max_quantity: null,
price: null,
},
],
@ -287,38 +315,40 @@ export default function Create(props: MyBetaModalFormProps) {
columns: [
{
key: 'min_quantity',
colProps: { span: 10 },
title: '起始值',
colProps: { span: 9 },
// title: '起始值',
valueType: 'number',
fieldProps: {
min: 0,
addonBefore: (
_: any,
{
field,
}: { field: { index: number[] } },
) => `${field.index[1] + 1}阶梯`,
addonBefore: '阶梯范围',
placeholder: '起始值',
},
width: '100%',
formItemProps: { ...rulesHelper.number },
},
{
key: 'max_quantity',
colProps: { span: 6 },
title: '结束值',
colProps: { span: 5 },
// title: '结束值',
valueType: 'number',
width: '100%',
formItemProps: { ...rulesHelper.number },
fieldProps: { maxLength: 12 },
fieldProps: {
min: 0,
max: 999,
placeholder: '结束值',
},
},
{
key: 'price',
colProps: { span: 8 },
title: '阶梯单价',
colProps: { span: 10 },
// title: '阶梯单价',
valueType: 'number',
fieldProps: {
addonBefore: '阶梯单价',
addonAfter: '元',
min: 0,
max: 999,
},
formItemProps: { ...rulesHelper.number },
},
@ -337,8 +367,8 @@ export default function Create(props: MyBetaModalFormProps) {
formItemProps: { ...rulesHelper.array },
initialValue: [
{
start: 0,
end: null,
min_quantity: 0,
max_quantity: null,
price: null,
},
],
@ -354,38 +384,40 @@ export default function Create(props: MyBetaModalFormProps) {
columns: [
{
key: 'min_quantity',
colProps: { span: 10 },
title: '起始值',
colProps: { span: 9 },
// title: '起始值',
valueType: 'number',
fieldProps: {
min: 0,
addonBefore: (
_: any,
{
field,
}: { field: { name: number[] } },
) => `${field.name[1] + 1}阶梯`,
addonBefore: '阶梯范围',
placeholder: '起始值',
},
width: '100%',
formItemProps: { ...rulesHelper.number },
},
{
key: 'max_quantity',
colProps: { span: 6 },
title: '结束值',
colProps: { span: 5 },
// title: '结束值',
valueType: 'number',
width: '100%',
formItemProps: { ...rulesHelper.number },
fieldProps: { maxLength: 12 },
fieldProps: {
min: 0,
max: 999,
placeholder: '结束值',
},
},
{
key: 'price',
colProps: { span: 8 },
title: '阶梯单价',
colProps: { span: 10 },
// title: '阶梯单价',
valueType: 'number',
fieldProps: {
addonBefore: '阶梯单价',
addonAfter: '元',
min: 0,
max: 999,
},
formItemProps: { ...rulesHelper.number },
},

View File

@ -76,9 +76,16 @@ export default function Update(props: MyBetaModalFormProps) {
// 避免计费模式切换导致的价格异常
price:
values?.price_algorithm ===
HouseChargeStandardsPriceAlgorithmEnum.Fixed.value
HouseChargeStandardsPriceAlgorithmEnum.Fixed.value ||
values?.calculation_mode ===
HouseChargeStandardsCalculationModeEnum.FixedAmount.value
? values.price
: 0,
is_tiered:
values?.price_algorithm ===
HouseChargeStandardsPriceAlgorithmEnum.Fixed.value
? 0
: 1,
})
.then(() => {
props.reload?.();
@ -142,6 +149,12 @@ export default function Update(props: MyBetaModalFormProps) {
return obj;
},
required: true,
fieldProps: {
onChange: () => {
// 切换计量单位时清空计费模式
form.setFieldValue('calculation_mode', undefined);
},
},
}),
]
: charge_type === HouseBillsTypeEnum.WaterFee.value ||
@ -166,6 +179,12 @@ export default function Update(props: MyBetaModalFormProps) {
return obj;
},
required: true,
fieldProps: {
onChange: () => {
// 切换计量单位时清空计费模式
form.setFieldValue('calculation_mode', undefined);
},
},
}),
]
: [];
@ -197,7 +216,14 @@ export default function Update(props: MyBetaModalFormProps) {
key: 'calculation_mode',
title: '计费模式',
colProps: { span: 12 },
valueEnum: HouseChargeStandardsCalculationModeEnum,
// valueEnum: HouseChargeStandardsCalculationModeEnum,
valueEnum: () => {
let obj: any = JSON.parse(
JSON.stringify(HouseChargeStandardsCalculationModeEnum),
);
delete obj.FixedAmount;
return obj;
},
required: true,
}),
];
@ -281,38 +307,40 @@ export default function Update(props: MyBetaModalFormProps) {
columns: [
{
key: 'min_quantity',
colProps: { span: 10 },
title: '起始值',
colProps: { span: 9 },
// title: '起始值',
valueType: 'number',
fieldProps: {
min: 0,
addonBefore: (
_: any,
{
field,
}: { field: { index: number[] } },
) => `${field.index[1] + 1}阶梯`,
addonBefore: '阶梯范围',
placeholder: '起始值',
},
width: '100%',
formItemProps: { ...rulesHelper.number },
},
{
key: 'max_quantity',
colProps: { span: 6 },
title: '结束值',
colProps: { span: 5 },
// title: '结束值',
valueType: 'number',
width: '100%',
formItemProps: { ...rulesHelper.number },
fieldProps: { maxLength: 12 },
fieldProps: {
min: 0,
max: 999,
placeholder: '结束值',
},
},
{
key: 'price',
colProps: { span: 8 },
title: '阶梯单价',
colProps: { span: 10 },
// title: '阶梯单价',
valueType: 'number',
fieldProps: {
addonBefore: '阶梯单价',
addonAfter: '元',
min: 0,
max: 999,
},
formItemProps: { ...rulesHelper.number },
},
@ -348,38 +376,40 @@ export default function Update(props: MyBetaModalFormProps) {
columns: [
{
key: 'min_quantity',
colProps: { span: 10 },
title: '起始值',
colProps: { span: 9 },
// title: '起始值',
valueType: 'number',
fieldProps: {
min: 0,
addonBefore: (
_: any,
{
field,
}: { field: { name: number[] } },
) => `${field.name[1] + 1}阶梯`,
addonBefore: '阶梯范围',
placeholder: '起始值',
},
width: '100%',
formItemProps: { ...rulesHelper.number },
},
{
key: 'max_quantity',
colProps: { span: 6 },
title: '结束值',
colProps: { span: 5 },
// title: '结束值',
valueType: 'number',
width: '100%',
formItemProps: { ...rulesHelper.number },
fieldProps: { maxLength: 12 },
fieldProps: {
min: 0,
max: 999,
placeholder: '结束值',
},
},
{
key: 'price',
colProps: { span: 8 },
title: '阶梯单价',
colProps: { span: 10 },
// title: '阶梯单价',
valueType: 'number',
fieldProps: {
addonBefore: '阶梯单价',
addonAfter: '元',
min: 0,
max: 999,
},
formItemProps: { ...rulesHelper.number },
},

View File

@ -63,17 +63,17 @@ export default function Index({ title = '点位管理' }) {
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
<MyButtons.View
title="查看"
onClick={() => {
navigate(`/banner_space/${item.id}`);
}}
/>
<BannerSpaceUpdate
item={item}
reload={action?.reload}
title={title}
/>
<MyButtons.View
title="配置"
onClick={() => {
navigate(`/banner_space/${item.id}`);
}}
/>
<MyButtons.Delete
onConfirm={() =>
Apis.Banner.BannerSpaces.Delete({ id: item.id }).then(() =>