Commit a4139c58 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复转单数据做了删除,再次切换角色无法请求回来订单数据的问题

parent c6293f42
......@@ -36,6 +36,7 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
const ref = useRef<any>({})
const destoryRef = useRef<any>({})
const pauseRef = useRef<any>({})
const orderIds = useRef<number[]>([])
const { run, loading } = useHttpRequest(PublicApi.postOrderVendorCancel)
const { run: runPause, loading: loadingEnd } = useHttpRequest(PublicApi.postOrderVendorTerminate)
const { transformRef, orderColumns } = useTransformOrderTable(transformActions)
......@@ -105,6 +106,7 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
return message.error('当前登录会员,无服务消费者角色,无法进行转单')
}
const firstRole = serversRoles[0];
orderIds.current = selectRef.current.length ? selectRef.current : (orderId ? [orderId] : []);
if(orderId) {
const { code, data } = await PublicApi.postOrderVendorTransferPreview({ roleId: firstRole.memberRoleId, orderIds: [orderId] }, { ctlType: 'none' })
if(code === 1000) {
......@@ -365,7 +367,7 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
"x-component": 'MultTable',
required: true,
"x-component-props": {
rowKey: 'id',
rowKey: 'orderId',
columns: "{{orderColumns}}",
pagination: false,
},
......@@ -374,18 +376,16 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
}}
effects={($, actions) => {
$('onFieldInputChange', 'roleId').subscribe(async (state) => {
const ordersValue = actions.getFieldValue('orders');
actions.setFieldState('roleId', (fieldState) => {
FormPath.setIn(fieldState, 'props.x-props.hasFeedback', true);
FormPath.setIn(fieldState, 'loading', true);
});
const { code, data } = await PublicApi.postOrderVendorTransferPreview({ roleId: state.value, orderIds: ordersValue.map((item) => item.orderId) }, { ctlType: 'none' })
const { code, data } = await PublicApi.postOrderVendorTransferPreview({ roleId: state.value, orderIds: orderIds.current }, { ctlType: 'none' })
if (code === 1000) {
actions.setFieldValue('orders', data)
actions.setFieldState('NOT_SUBMIT_TITLE', prevState => {
prevState.props['x-component-props'].number = ordersValue.length
prevState.props['x-component-props'].number = orderIds.current
})
}
......
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