90 lines
2.6 KiB
TypeScript
90 lines
2.6 KiB
TypeScript
import {
|
|
MyBetaModalFormProps,
|
|
MyButtons,
|
|
MyFormItems,
|
|
MyModalFormProps,
|
|
rulesHelper,
|
|
} from '@/common';
|
|
import { Selects } from '@/components/Selects';
|
|
import { Apis } from '@/gen/Apis';
|
|
import { CommissionTypeEnum } from '@/gen/Enums';
|
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
import { message } from 'antd';
|
|
|
|
export default function UpdateCounters(props: MyBetaModalFormProps) {
|
|
return (
|
|
<BetaSchemaForm<ApiTypes.MerchantCounters.Update>
|
|
{...MyModalFormProps.props}
|
|
title={`编辑${props.title}`}
|
|
trigger={<MyButtons.Edit />}
|
|
wrapperCol={{ span: 24 }}
|
|
width="800px"
|
|
request={() => Promise.resolve(props.item)}
|
|
onFinish={async (values) =>
|
|
Apis.MerchantCounters.Update({ ...values, id: props.item?.id ?? 0 })
|
|
.then(() => {
|
|
props.reload?.();
|
|
message.success(props.title + '成功');
|
|
return true;
|
|
})
|
|
.catch(() => false)
|
|
}
|
|
columns={[
|
|
Selects.Markets({ required: true }),
|
|
{
|
|
key: 'name',
|
|
title: '名称',
|
|
formItemProps: { ...rulesHelper.text },
|
|
},
|
|
{
|
|
key: 'up_merchant_no',
|
|
title: '上游商家编号',
|
|
formItemProps: { ...rulesHelper.text },
|
|
},
|
|
{
|
|
valueType: 'formList',
|
|
dataIndex: 'commissions',
|
|
title: '分佣配置',
|
|
formItemProps: { ...rulesHelper.array },
|
|
fieldProps: {
|
|
copyIconProps: false,
|
|
},
|
|
columns: [
|
|
{
|
|
valueType: 'group',
|
|
colProps: { span: 24 },
|
|
columns: [
|
|
{
|
|
key: 'seq',
|
|
colProps: { span: 3 },
|
|
title: '序号',
|
|
width: '100%',
|
|
formItemProps: { ...rulesHelper.text },
|
|
},
|
|
MyFormItems.EnumSelect({
|
|
key: 'type',
|
|
title: '类型',
|
|
colProps: { span: 4 },
|
|
valueEnum: CommissionTypeEnum,
|
|
required: true,
|
|
formItemProps: { ...rulesHelper.text },
|
|
}),
|
|
{
|
|
key: 'merchant_no',
|
|
colProps: { span: 9 },
|
|
title: '商户编号',
|
|
},
|
|
{
|
|
key: 'percent',
|
|
colProps: { span: 8 },
|
|
title: '分佣比例%(0为自动计算)',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
]}
|
|
/>
|
|
);
|
|
}
|