Commit 78fe19a9 authored by 卢均锐's avatar 卢均锐

feat: 缓存业务对账相关

parent dc8b63c8
import React, { useEffect, useState, useMemo, useRef } from 'react'; import React, { useEffect, useState, useMemo, useRef } from 'react';
import { Form, Button, Row, Col, Input, Table, message } from 'antd'; import { Form, Button, Row, Col, Input, InputNumber, Table, message } from 'antd';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import { CheckCircleOutlined, PlusOutlined } from '@ant-design/icons'; import { CheckCircleOutlined, PlusOutlined } from '@ant-design/icons';
import { getIntl, history, Prompt } from 'umi'; import { getIntl, history, Prompt } from 'umi';
...@@ -155,7 +155,7 @@ const Add = () => { ...@@ -155,7 +155,7 @@ const Add = () => {
let _dataSource = [...tabelSource]; let _dataSource = [...tabelSource];
const _i = _dataSource.findIndex((item) => item.productId === record.productId); const _i = _dataSource.findIndex((item) => item.productId === record.productId);
let _item = { ..._dataSource[_i] }; let _item = { ..._dataSource[_i] };
_item.currentReconciliationQuantity = _val; _item.currentReconciliationQuantity = Number(_val);
_item.currentMoney = _val * Number(record.price); _item.currentMoney = _val * Number(record.price);
_dataSource[_i] = _item; _dataSource[_i] = _item;
setTabelSource(_dataSource); setTabelSource(_dataSource);
...@@ -251,10 +251,15 @@ const Add = () => { ...@@ -251,10 +251,15 @@ const Add = () => {
name={`currentReconciliationQuantity_${record.orderNo}_${record.productId}`} name={`currentReconciliationQuantity_${record.orderNo}_${record.productId}`}
style={{ margin: 0 }} style={{ margin: 0 }}
rules={[ rules={[
{ required: true, message: intl.formatMessage({ id: 'balance.qingshuruduizhangshuliang' }) } { required: true, message: intl.formatMessage({ id: 'balance.qingshuruduizhangshuliang' }) },
{
validator: (_, value) => {
return value > record.reconciliationQuantity ? Promise.reject(new Error('不能大于待对账数量')) : Promise.resolve()
}
},
]} ]}
> >
<Input type='number' max={record.reconciliationQuantity} value={record.currentReconciliationQuantity} onChange={(e) => { _changeNumbers(record, e.target.value) }} addonBefore="¥" /> <Input type='number' max={record.reconciliationQuantity} value={record.currentReconciliationQuantity} onChange={(e) => { _changeNumbers(record, e.target.value) }} />
</Form.Item> </Form.Item>
) : text ) : text
) )
......
import React, { useRef, useState } from 'react';
import { Drawer, Button } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import StandardTable from '@/components/StandardTable';
import { createFormActions } from '@formily/antd'
// import { getSettleAccountsBusinessReconciliationToReconciliationList } from '@/services/SettleV2Api'
import Submit from '@/components/NiceForm/components/Submit'
import NiceForm from '@/components/NiceForm'
import { getIntl } from 'umi';
interface MemberDrawerProps {
visible: boolean,
onClose?: () => void,
}
const intl = getIntl();
const formActions = createFormActions();
const MemberDrawer: React.FC<MemberDrawerProps> = (props: MemberDrawerProps) => {
const { visible, onClose } = props;
const ref = useRef<any>({})
const [selectedRowKeys, setSelectedRowKeys] = useState<any>([])
const loadingTableData = async (params) => {
const _params = { ...params }
const { data } = await getSettleAccountsBusinessReconciliationToReconciliationList(_params)
return data;
}
const columns: ColumnType<any>[] = [{
title: '会员Id',
key: 'memberId',
dataIndex: 'memberId',
}, {
title: '会员名称',
key: 'memberName',
dataIndex: 'memberName',
}, {
title: '会员类型',
key: 'memberType',
dataIndex: 'memberType',
}, {
title: '会员角色',
key: 'memberRole',
dataIndex: 'memberRole',
}, {
title: '会员等级',
key: 'memberLevel',
dataIndex: 'memberLevel',
}];
const handleSelectChange = (record, selected, selectedRow, nativeEvent) => {
setSelectedRowKeys([record.id]);
};
return (
<Drawer
title={'选择会员'}
placement={'right'}
onClose={onClose}
visible={visible}
key={'right'}
width={'50%'}
footer={
<div style={{ textAlign: 'right' }}>
<Button onClick={onClose} style={{ marginRight: 8 }}>
{intl.formatMessage({ id: 'balance.quxiao' })}
</Button>
<Button onClick={onClose} type="primary">
{'确定'}
</Button>
</div>
}
>
<StandardTable
keepAlive={false}
// fetchTableData={params => loadingTableData(params)}
columns={columns}
currentRef={ref}
rowKey="id"
rowSelection={{
type: 'radio',
selectedRowKeys: selectedRowKeys,
onSelect: handleSelectChange,
}}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
schema={{
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
"x-component-props": {
grid: true
},
properties: {
memberName: {
type: 'string',
"x-component": 'Search',
'x-component-props': {
placeholder: '请输入会员名称',
align: 'flex-start',
},
},
}
}
}
}}
components={{
Submit,
}}
/>
}
/>
</Drawer>
);
}
export default MemberDrawer;
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