Commit 15f1c1df authored by 卢均锐's avatar 卢均锐

Merge branch 'v2' of http://10.0.0.22:3000/lingxi/lingxi-business-paltform into v2

* 'v2' of http://10.0.0.22:3000/lingxi/lingxi-business-paltform: fix: 修改结算策略结算支付方式根据pass平台修改而修改,以及部分类型问题
parents 2d0b42d2 f262b256
......@@ -71,7 +71,7 @@
"@linkseeks/design-core": "^1.0.0",
"@linkseeks/design-react": "^1.0.0",
"@linkseeks/design-react-web": "^1.0.0",
"@linkseeks/design-ui": "^1.0.5",
"@linkseeks/design-ui": "1.0.5",
"@linkseeks/god": "^1.0.0",
"@linkseeks/umi-plugin-yapi": "1.0.1",
"@turf/turf": "^6.4.0",
......
......@@ -3,12 +3,29 @@
flex-direction: row;
}
.period {
.flexRow();
margin-bottom: 20px;
.radiosContainer {
display: flex;
flex-direction: row;
.dayRadio {
margin-right: 20px
}
}
.values {
.days {
.flexRow();
margin-left: 25px;
// margin-left: 25px;
margin-top: 25px;
}
}
\ No newline at end of file
}
// .period {
// .flexRow();
// margin-bottom: 20px;
// .days {
// .flexRow();
// margin-left: 25px;
// }
// }
\ No newline at end of file
......@@ -5,6 +5,9 @@ import { Radio, Input, Tooltip } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import styles from './index.less';
import { registerValidationRules } from '@formily/antd' // 或者 @formily/next
import SettleMethod, { SettleActiveType } from './settleMethod';
type SettleMethodProps = React.ComponentProps<typeof SettleMethod>;
const DAY = 1;
const MONTH = 2;
......@@ -12,106 +15,52 @@ const MONTH = 2;
registerValidationRules({
settleMethodRule: value => {
const { active, otherValues } = value;
const isNumber = /^\d+$/; // 数字
const pattern = /[0-9]+\.[0-9]*/;
if (active == MONTH) {
return (otherValues[1] < 0 || otherValues[1] > 31) || pattern.test(otherValues[1]) ? getIntl().formatMessage({ id: 'balance.components.settleMethod.registerValidationRules.1' }) : ''
} else {
return !isNumber.test(otherValues[0]) || pattern.test(otherValues[0]) ? getIntl().formatMessage({ id: 'balance.components.settleMethod.registerValidationRules.2' }) : ""
}
return !isNumber.test(otherValues[1]) || ((otherValues[1] < 0 || otherValues[1] > 31) || pattern.test(otherValues[1])) ? getIntl().formatMessage({ id: 'balance.components.settleMethod.registerValidationRules.1' }) : ''
}
return !isNumber.test(otherValues[0]) || pattern.test(otherValues[0]) ? getIntl().formatMessage({ id: 'balance.components.settleMethod.registerValidationRules.2' }) : ""
}
})
const SettleMethod = (props) => {
const { active = DAY, otherValues = [30, 1] } = props.value || {};
const { daysVisible, monthVisible } = props;
const intl = useIntl();
const handleChange = (e, type) => {
if (active == type) {
return;
}
const previewValue = otherValues
// setActive(type)
props.onChange({
active: type,
otherValues: previewValue
})
}
type XcomponenetProps = {
options: {
days: boolean,
month: boolean
},
default: any
}
const handleInputChange = (value, type) => {
const target = type - 1;
const temp = [...otherValues];
temp[target] = value;
props.onChange({
active: type,
otherValues: temp
})
interface Iprops {
/** 编辑状态 */
editable: boolean,
initialValue?: SettleMethodProps['value'],
value: SettleMethodProps['value'],
props: {
['x-component-props']: XcomponenetProps
}
if (!monthVisible && !daysVisible) {
return null
mutators: {
change: (value: any) => void
}
return (
<div>
{
daysVisible
? (
<div className={styles.period}>
<div>
<Radio name="method" checked={active == DAY} onChange={(e) => handleChange(e, DAY)}>{intl.formatMessage({ id: 'balance.components.settleMethod.method.1' })}</Radio>
<Tooltip title={intl.formatMessage({ id: 'balance.components.settleMethod.method.1.tooltip' })}>
<QuestionCircleOutlined />
</Tooltip>
</div>
<div className={styles.days}>
<div style={{ margin: '0 20px 0 12px' }}>{intl.formatMessage({ id: 'balance.components.settleMethod.days.1' })}</div>
<div>
<Input
addonAfter={intl.formatMessage({ id: 'balance.components.settleMethod.days.1.addonAfter' })}
value={otherValues[DAY - 1]}
onChange={(e) => handleInputChange(e.target.value, DAY)}
disabled={active !== DAY}
style={{ width: '160px' }}
/></div>
</div>
</div>
)
: null
}
{
monthVisible
? <div className={styles.period}>
<div >
<Radio name="method" checked={active == MONTH} onChange={(e) => handleChange(e, MONTH)}>{intl.formatMessage({ id: 'balance.components.settleMethod.method.2' })}</Radio>
<Tooltip title={intl.formatMessage({ id: 'balance.components.settleMethod.method.2.tooltip' })}>
<QuestionCircleOutlined />
</Tooltip>
</div>
<div className={styles.days}>
<div style={{ marginRight: '20px' }}>{intl.formatMessage({ id: 'balance.components.settleMethod.days.2' })}</div>
<div><Input addonAfter={intl.formatMessage({ id: 'balance.components.settleMethod.days.2.addonAfter' })} style={{ width: '160px' }} value={otherValues[MONTH - 1]} onChange={(e) => handleInputChange(e.target.value, MONTH)} disabled={active !== MONTH} /></div> </div>
</div>
: null
}
</div>
)
}
const Index = (props) => {
const Index: React.FC<Iprops> & { isFieldComponent: boolean } = (props: Iprops) => {
const editable = props.editable;
const value = props.value || { active: 0, otherValues: [30, 1] };
const componentProps = props.props['x-component-props'] || {};
const options = componentProps.options || {};
const value = props.value || { active: 1, otherValues: [30, 1] };
const componentProps = props.props['x-component-props'] || {} as XcomponenetProps;
const options = componentProps.options || ({} as XcomponenetProps['options']);
const intl = useIntl();
// 默认选择
useEffect(() => {
// const componentProps = props.props['x-component-props'] || {};
const defaultValue = componentProps.default || {};
if (!options.days && !options.month) {
if (!options?.days && !options?.month) {
return
}
if (typeof props.initialValue == 'undefined') {
......@@ -127,15 +76,19 @@ const Index = (props) => {
}
if (!editable) {
return value.active == 1 ? intl.formatMessage({ id: 'balance.components.settleMethod.index.1' }, { data: value.otherValues[0] }) : intl.formatMessage({ id: 'balance.components.settleMethod.index.2' }, { data: value.otherValues[1] })
return (
<div>
{value.active == DAY ? intl.formatMessage({ id: 'balance.components.settleMethod.index.1' }, { data: value.otherValues[0] }) : intl.formatMessage({ id: 'balance.components.settleMethod.index.2' }, { data: value.otherValues[1] })}
</div>
)
}
return (
<div>
<SettleMethod
value={value}
daysVisible={options.days}
monthVisible={options.month}
daysVisible={options?.days || false}
monthVisible={options.month || false}
onChange={onChange}
/>
</div>
......
import { QuestionCircleOutlined } from "@ant-design/icons";
import { Input, Radio, Tooltip } from "antd";
import { useIntl } from "umi";
import styles from './index.less';
const DAY = 1;
const MONTH = 2;
/** 1 => 账期,2 => 月结 */
export type SettleActiveType = 1 | 2;
interface Iprops {
value: {
active: SettleActiveType,
/** 账期天数, 每月结算日 */
otherValues: [number, number]
},
onChange: (params: {active: 1 | 2, otherValues: [number, number]}) => void,
/** 是否显示账期结算 */
daysVisible: boolean,
/** 是否显示月结 */
monthVisible: boolean
}
const SettleMethod: React.FC<Iprops> = (props: Iprops) => {
const { value, daysVisible, monthVisible, onChange } = props;
const { active = DAY, otherValues = [30, 1] } = value || {};
const intl = useIntl();
const handleChange = (e, type: SettleActiveType) => {
if (active == type) {
return;
}
const previewValue = otherValues
// setActive(type)
onChange({
active: type,
otherValues: previewValue
})
}
const handleInputChange = (value: string, type: SettleActiveType) => {
const target = type - 1;
const temp = [...otherValues];
temp[target] = value as unknown as number;
props.onChange({
active: type,
otherValues: temp as [number, number]
})
}
if (!monthVisible && !daysVisible) {
return null
}
return (
<div>
<div>
<div className={styles.radiosContainer}>
{
daysVisible && (
<div className={styles.dayRadio}>
<Radio name="method" checked={active == DAY} onChange={(e) => handleChange(e, DAY)}>{intl.formatMessage({ id: 'balance.components.settleMethod.method.1' })}</Radio>
<Tooltip title={intl.formatMessage({ id: 'balance.components.settleMethod.method.1.tooltip' })}>
<QuestionCircleOutlined />
</Tooltip>
</div>
) || null
}
{
monthVisible && (
<div>
<Radio name="method" checked={active == MONTH} onChange={(e) => handleChange(e, MONTH)}>{intl.formatMessage({ id: 'balance.components.settleMethod.method.2' })}</Radio>
<Tooltip title={intl.formatMessage({ id: 'balance.components.settleMethod.method.2.tooltip' })}>
<QuestionCircleOutlined />
</Tooltip>
</div>
) || null
}
</div>
<div className={styles.values}>
{
active === DAY
? <div className={styles.days}>
<div style={{margin: '0 20px 0 0px'}}>{intl.formatMessage({ id: 'balance.components.settleMethod.days.1' })}</div>
<div>
<Input
addonAfter={intl.formatMessage({ id: 'balance.components.settleMethod.days.1.addonAfter' })}
value={otherValues[0]}
onChange={(e) => handleInputChange(e.target.value, DAY)}
disabled={active !== DAY}
style={{width: '160px'}}
/></div>
</div>
: <div className={styles.days}>
<div style={{marginRight: '20px'}}>{intl.formatMessage({ id: 'balance.components.settleMethod.days.2' })}</div>
<div>
<Input
// addonAfter={"号"}
addonAfter={intl.formatMessage({ id: 'balance.components.settleMethod.days.2.addonAfter' })}
style={{width: '160px'}}
value={otherValues[1]}
onChange={(e) => handleInputChange(e.target.value, MONTH)}
disabled={active !== MONTH}
/>
</div>
</div>
}
</div>
</div>
</div>
)
}
export default SettleMethod
\ No newline at end of file
......@@ -32,7 +32,7 @@ import {
} from '@/services/SettleV2Api';
import { getMemberManageLowerPageBynamerole, getMemberManageRoleSubList, getMemberManageUpperPage } from '@/services/MemberV2Api';
import { getManageRuleConfigurationList } from '@/services/ManageV2Api';
import { getOrderPlatformSettlementTypeList } from '@/services/OrderNewV2Api';
import { getOrderPlatformSettlementCategoryList, getOrderPlatformSettlementTypeList } from '@/services/OrderNewV2Api';
const formActions = createFormActions();
......@@ -92,7 +92,7 @@ const MemberSettleAdd: React.FC = () => {
title: intl.formatMessage({ id: 'balance.settleRules.memberSettle.info.columns.operation' }),
render: (text, record) => {
return (
<div onClick={() => handleRemove(record.uniqueId)}>{intl.formatMessage({ id: 'balance.settleRules.memberSettle.info.columns.operation.button' })}</div>
<a onClick={() => handleRemove(record.uniqueId)}>{intl.formatMessage({ id: 'balance.settleRules.memberSettle.info.columns.operation.button' })}</a>
)
}
}
......@@ -110,12 +110,21 @@ const MemberSettleAdd: React.FC = () => {
// 从PAAS平台--规则配置--平台规则配置取已勾选的结算方式决定是否显示结算方式
const fetchBalancedMethods = async () => {
const { data } = await getManageRuleConfigurationList({ platformType: '5' });
const length = data.length
return {
days: length > 0 && data[0].check,
month: length > 1 && data[1].check
};
const { data, code } = await getOrderPlatformSettlementCategoryList();
// const length = data.length
let config = {
days: false,
month: false,
}
if (code !== 1000) {
return config
}
const codeToMap = ["", "days", "month"]
data.forEach((_item) => {
config[codeToMap[_item.methodCode]] = true
})
return config
}
// 获取适用会员
......
......@@ -82,6 +82,10 @@ export const addSchema = {
type: 'string',
'x-rules': [
{ required: true, message: intl.formatMessage({ id: 'balance.settleRules.memberSettle.info.schema.addSchema.basicTab.name.message' }) },
{
limitByte: true,
maxByte: 48,
}
]
},
settlementWay: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment