Commit 127ae768 authored by XieZhiXiong's avatar XieZhiXiong

完善待新增销售发货单 -》进销存

parent 86719b31
...@@ -9,10 +9,14 @@ const RowStyleLayout = styled(props => <div {...props} />)` ...@@ -9,10 +9,14 @@ const RowStyleLayout = styled(props => <div {...props} />)`
width: 100%; width: 100%;
.relevance { .relevance {
border-color: #6b778c; background: #6b778c;
background-color: #6b778c; border: none;
border-radius: 0; border-radius: 0;
height: 100%; height: 100%;
&[disabled] {
background: #f5f5f5;
}
} }
.ant-input-group-addon { .ant-input-group-addon {
...@@ -38,6 +42,7 @@ const Relevance = props => { ...@@ -38,6 +42,7 @@ const Relevance = props => {
fetchTableData, fetchTableData,
title = '选择', title = '选择',
tip = '', // 点击按钮前的提示,用于前提需要提示的场景 tip = '', // 点击按钮前的提示,用于前提需要提示的场景
disabled = false,
} = props.props['x-component-props']; } = props.props['x-component-props'];
const tableRowKey = tableProps.rowKey || 'id'; const tableRowKey = tableProps.rowKey || 'id';
...@@ -50,6 +55,7 @@ const Relevance = props => { ...@@ -50,6 +55,7 @@ const Relevance = props => {
// Table 只能缓存 keys // Table 只能缓存 keys
const rowKeys = value.map(item => item[tableRowKey]); const rowKeys = value.map(item => item[tableRowKey]);
rowCtl.setSelectedRowKeys(rowKeys); rowCtl.setSelectedRowKeys(rowKeys);
rowCtl.setSelectRow(value);
}, [props.value, tableProps.rowKey]); }, [props.value, tableProps.rowKey]);
const handleConfirm = () => { const handleConfirm = () => {
...@@ -89,6 +95,7 @@ const Relevance = props => { ...@@ -89,6 +95,7 @@ const Relevance = props => {
className="relevance" className="relevance"
icon={<LinkOutlined />} icon={<LinkOutlined />}
onClick={handleModalVisible} onClick={handleModalVisible}
disabled={disabled}
block block
> >
{title} {title}
......
...@@ -4,7 +4,7 @@ import { Button, Row, Col } from 'antd' ...@@ -4,7 +4,7 @@ import { Button, Row, Col } from 'antd'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils' import { formatTimeString } from '@/utils'
import { ORDER_TYPE, PurchaseOrderInsideWorkState, SaleOrderInsideWorkState } from '@/constants' import { ORDER_TYPE, PurchaseOrderInsideWorkState, SaleOrderInsideWorkState, DOC_TYPE_SALES_INVOICE } from '@/constants'
import StatusColors from '@/pages/transaction/components/StatusColors' import StatusColors from '@/pages/transaction/components/StatusColors'
import { FieldTimeOutlined } from '@ant-design/icons' import { FieldTimeOutlined } from '@ant-design/icons'
import { import {
...@@ -98,6 +98,7 @@ export const useSelfTable = () => { ...@@ -98,6 +98,7 @@ export const useSelfTable = () => {
{ record.purchaseOrderInteriorState === SaleOrderInsideWorkState.SALE_CREATE_DELIVED_ORDER && { record.purchaseOrderInteriorState === SaleOrderInsideWorkState.SALE_CREATE_DELIVED_ORDER &&
<Button type='link' onClick={() => handleAdd(record)}>新增发货单</Button> <Button type='link' onClick={() => handleAdd(record)}>新增发货单</Button>
} }
<Button type='link' onClick={() => handleAdd(record)}>新增发货单</Button>
</> </>
} }
] ]
...@@ -107,7 +108,7 @@ export const useSelfTable = () => { ...@@ -107,7 +108,7 @@ export const useSelfTable = () => {
} }
const handleAdd = async (record) => { const handleAdd = async (record) => {
history.push(`/memberCenter/tranactionAbility/stockSellStorage/addBills?orderNo=${record.orderNo}&deliveryAddresId=${record.deliveryAddresId}&relevanceInvoicesId=${record.id}&invoicesTypeId=S002&relevanceInvoices=1`) history.push(`/memberCenter/tranactionAbility/stockSellStorage/addBills?relevanceInvoicesId=${record.id}&invoicesTypeId=${DOC_TYPE_SALES_INVOICE}&relevanceInvoices=1`)
} }
return { return {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47 * @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-24 20:11:39 * @LastEditTime: 2020-09-25 11:31:15
* @Description: 联动逻辑相关 * @Description: 联动逻辑相关
*/ */
import { FormEffectHooks, FormPath } from '@formily/antd'; import { FormEffectHooks, FormPath } from '@formily/antd';
...@@ -314,9 +314,10 @@ export const useBusinessEffects = (context, actions) => { ...@@ -314,9 +314,10 @@ export const useBusinessEffects = (context, actions) => {
onFieldValueChange$('orderNo').subscribe(fieldState => { onFieldValueChange$('orderNo').subscribe(fieldState => {
const relevanceInvoicesVal = getFieldValue('relevanceInvoices'); const relevanceInvoicesVal = getFieldValue('relevanceInvoices');
const first = fieldState.value && fieldState.value[0]; const first = fieldState.value && fieldState.value[0];
console.log('first', first) console.log('first', first)
setFieldValue('memberName', first ? first.memberName : ''); setFieldValue('memberName', first ? first.supplyMembersName : '');
setFieldValue('relevanceInvoicesId', first ? first.id : null); setFieldValue('relevanceInvoicesId', first ? first.id : null);
setFieldValue('deliveryAddresId', first ? first.deliveryAddresId : null); setFieldValue('deliveryAddresId', first ? first.deliveryAddresId : null);
setFieldValue('address', first ? `${first.fullAddress} ${first.receiverName}/${first.phone}` : ''); setFieldValue('address', first ? `${first.fullAddress} ${first.receiverName}/${first.phone}` : '');
......
...@@ -46,11 +46,9 @@ const AddBills: React.FC<{}> = (props: any) => { ...@@ -46,11 +46,9 @@ const AddBills: React.FC<{}> = (props: any) => {
pageStatus, pageStatus,
preview, preview,
id, id,
invoicesTypeId, invoicesTypeId, // 单据类型编码
relevanceInvoices, relevanceInvoices, // 对应单据
orderNo, relevanceInvoicesId, // 单据id,可能是待新增销售发货单,待新增采购入库单跳转过来的
deliveryAddresId,
relevanceInvoicesId,
} = usePageStatus(); } = usePageStatus();
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [productRowSelection, productRowCtl] = useRowSelectionTable({ type: 'checkbox' }); const [productRowSelection, productRowCtl] = useRowSelectionTable({ type: 'checkbox' });
...@@ -138,6 +136,121 @@ const AddBills: React.FC<{}> = (props: any) => { ...@@ -138,6 +136,121 @@ const AddBills: React.FC<{}> = (props: any) => {
}); });
}; };
// 获取待新增单据(销售发货单,采购入库单)详情
// 填充对应单据、关联单据、会员名称、收货地址、物流方式等信息
const getOrderDetailed = () => {
if (!invoicesTypeId) {
return;
}
switch (invoicesTypeId) {
// 采购入库单
case DOC_TYPE_PURCHASE_RECEIPT: {
break;
}
// 销售发货单
case DOC_TYPE_SALES_INVOICE: {
setInfoLoading(true);
PublicApi.getOrderPurchaseOrderDetails({
id: relevanceInvoicesId,
}).then(res => {
if (res.code !== 1000) {
return;
}
const {
supplyMembersName,
deliveryType,
deliveryAddresId,
orderNo,
province,
city,
area,
addres,
addresName,
tel,
} = res.data;
addSchemaAction.setFieldState(
'*(invoicesTypeId,orderNo)',
state => {
state.props['x-component-props'].disabled = true;
}
);
setBillInfo({
invoicesTypeId,
relevanceInvoices: +relevanceInvoices,
orderNo:
orderNo ?
[
{
orderNo,
id: +relevanceInvoicesId,
deliveryAddresId: +deliveryAddresId,
supplyMembersName,
fullAddress: `${province || ''}${city || ''}${area || ''}${addres || ''}`,
receiverName: addresName || '',
phone: tel || '',
deliveryType,
}
] :
[]
,
});
}).finally(() => {
setInfoLoading(false);
});
break;
}
// 加工入库单
case DOC_TYPE_PROCESS_RECEIPT: {
break;
}
// 加工发货单
case DOC_TYPE_PROCESS_INVOICE: {
break;
}
// 退货发货单
case DOC_TYPE_RETURN_INVOICE: {
break;
}
// 退货入库单
case DOC_TYPE_RETURN_RECEIPT: {
break;
}
// 换货发货单
case DOC_TYPE_EXCHANGE_INVOICE: {
break;
}
// 换货入库单
case DOC_TYPE_EXCHANGE_RECEIPT: {
break;
}
default: {
break;
}
}
};
useEffect(() => {
getBillInfo();
getOrderDetailed();
}, []);
// 弹出单据明细 // 弹出单据明细
const handleAdd = () => { const handleAdd = () => {
const orderNoVal = addSchemaAction.getFieldValue('orderNo'); const orderNoVal = addSchemaAction.getFieldValue('orderNo');
...@@ -160,19 +273,6 @@ const AddBills: React.FC<{}> = (props: any) => { ...@@ -160,19 +273,6 @@ const AddBills: React.FC<{}> = (props: any) => {
</Button> </Button>
); );
useEffect(() => {
if (invoicesTypeId && relevanceInvoices && orderNo && deliveryAddresId && relevanceInvoicesId) {
setBillInfo({
invoicesTypeId,
relevanceInvoices: +relevanceInvoices,
orderNo: orderNo ? [{ orderNo, id: +relevanceInvoicesId }] : [],
deliveryAddresId: +deliveryAddresId,
});
}
getBillInfo();
}, []);
const handleSubmit = value => { const handleSubmit = value => {
const { const {
invoicesTypeId, invoicesTypeId,
...@@ -198,7 +298,7 @@ const AddBills: React.FC<{}> = (props: any) => { ...@@ -198,7 +298,7 @@ const AddBills: React.FC<{}> = (props: any) => {
setSubmitLoading(true); setSubmitLoading(true);
switch (invoicesTypeId) { switch (invoicesTypeId) {
// 采购入库单只能选择 订单 // 采购入库单
case DOC_TYPE_PURCHASE_RECEIPT: { case DOC_TYPE_PURCHASE_RECEIPT: {
if (!id) { if (!id) {
PublicApi.postOrderPurchaseReceiptAdd(payload) PublicApi.postOrderPurchaseReceiptAdd(payload)
......
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