Commit a39cf9fd authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理SRM订单收发货

parent da0f5612
......@@ -600,13 +600,13 @@ const evaluationNeedInfo: ISchema = {
},
title: '{{help("是否在线评标", "在线进行评标打分")}}',
default: true,
"x-linkages": [
{
type: 'value:visible',
target: 'templateId',
condition: "{{!!$value}}"
}
]
// "x-linkages": [
// {
// type: 'value:visible',
// target: 'templateId',
// condition: "{{!!$value}}"
// }
// ]
},
templateId: {
type: 'number',
......
......@@ -53,6 +53,7 @@ export const useOrderDetail = (options: OrderDetailHookProps) => {
// 根据type类型 调用不同的详情接口
const getDetailsApi = (type) => {
let api = null;
console.log(type, 'type')
switch (type) {
case 'purchaseOrder': api = PublicApi.getOrderBuyerDetail;
break;
......
......@@ -5,7 +5,7 @@ import { formatTimeString } from '@/utils'
import { OrderDetailContext } from '../../_public/order/context'
import MellowCard from '@/components/MellowCard'
import NestTable from '@/components/NestTable'
import { DeliverySideState } from '@/constants/order'
import { DeliverySideState, OrderKindType } from '@/constants/order'
import { PublicApi } from '@/services/api'
import { history } from 'umi'
......@@ -25,7 +25,8 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
const [disabled, setDisabled] = useState<boolean>(false)
const { data, reloadFormData } = useContext(OrderDetailContext)
const { deliveries, deliveryDetails, orderModel } = data
const { deliveries, deliveryDetails, orderModel, orderKind } = data
const contractOrder = (orderKind === OrderKindType.SRM_ORDER)
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
const outOrderCols: any[] = [
......@@ -110,6 +111,103 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
},
]
const outerMaterialCols: any[] = [
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
key: 'productId',
className: 'commonHide'
},
{
title: '物料编号',
dataIndex: 'productNo',
align: 'center',
key: 'productNo',
},
{
title: '物料名称/规格',
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: '关联报价商品ID/名称/规格/品类/品牌',
dataIndex: 'quotedSkuId',
align: 'center',
key: 'quotedSkuId',
render: (t, r) => `${t}/${r.quotedName || ''}/${r.quotedCategory || ''}/${r.quotedBrand || ''}`
},
{
title: '单价',
dataIndex: 'price',
align: 'center',
key: 'price',
},
{
title: '采购数量',
dataIndex: 'quantity',
align: 'center',
key: 'quantity',
},
{
title: '含税',
dataIndex: 'tax',
align: 'center',
key: 'tax',
render: (text) => text ? '是' : '否'
},
{
title: '金额',
dataIndex: 'amount',
align: 'center',
key: 'amount',
},
{
title: '已发货',
dataIndex: 'delivered',
align: 'center',
key: 'delivered',
},
{
title: '未发货',
dataIndex: 'leftCount',
align: 'center',
key: 'leftCount',
},
{
title: '已收货',
dataIndex: 'received',
align: 'center',
key: 'received',
},
{
title: '差异数量',
dataIndex: 'differCount',
align: 'center',
key: 'differCount',
},
]
const sideChildrenCols: any[] = [
{
......@@ -168,6 +266,83 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
},
]
const sideChildrenMaterialCols: any[] = [
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
key: 'productId',
className: 'commonHide'
},
{
title: '物料编号',
dataIndex: 'productNo',
align: 'center',
key: 'productNo',
},
{
title: '物料名称/规格',
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: '关联报价商品ID/名称/规格/品类/品牌',
dataIndex: 'quotedSkuId',
align: 'center',
key: 'quotedSkuId',
render: (t, r) => `${t}/${r.quotedName || ''}/${r.quotedCategory || ''}/${r.quotedBrand || ''}`
},
{
title: '单价',
dataIndex: 'price',
align: 'center',
key: 'price',
},
{
title: '采购数量',
dataIndex: 'quantity',
align: 'center',
key: 'quantity',
},
{
title: '发货数量',
dataIndex: 'delivered',
align: 'center',
key: 'delivered',
},
{
title: '收货数量',
dataIndex: 'received',
align: 'center',
key: 'received',
},
{
title: '差异数量',
dataIndex: 'differCount',
align: 'center',
key: 'differCount',
},
]
const sideOrderCols: any[] = [
{
title: '发货批次',
......@@ -226,7 +401,6 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
key: 'ctl',
render: (text, record) => <>
{ !isPreview && isReturn && !dataRef.current.includes(record.id) && <Button type='link' disabled={disabled} onClick={() => handleReturn(record)}>确认回单</Button> }
{/* { !isPreview && isReceived && !dataRef.current.includes(record.id) && <Button type='link' disabled={disabled} onClick={() => handleConfirm(record)}>确认收货</Button> } */}
{ !isPreview && isReceived && record.showReceive && <Button type='link' disabled={disabled} onClick={() => handleConfirm(record)}>确认收货</Button> }
</>
},
......@@ -275,7 +449,7 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
{
deliveries?.length > 0 && <Tabs.TabPane tab='订单收发货统计' key="1">
<Table
columns={outOrderCols}
columns={contractOrder ? outerMaterialCols : outOrderCols}
dataSource={deliveries}
pagination={false}
rowKey="skuId"
......@@ -285,7 +459,7 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
{
deliveryDetails?.length > 0 && <Tabs.TabPane tab='订单收发货明细' key="2">
<NestTable
NestColumns={[sideOrderCols, sideChildrenCols]}
NestColumns={[sideOrderCols, contractOrder ? sideChildrenMaterialCols : sideChildrenCols]}
rowKey='batchNo'
childrenDataKey='products'
dataSource={deliveryDetails}
......
......@@ -38,8 +38,14 @@ const OrderHandDeleveModal:React.FC<OrderHandDeleveModalProps> = (props) => {
useEffect(() => {
if(visible) {
const { deliveries } = data
schemaActions.setFieldValue('products', deliveries.map(item => ({ ...item, deliveryCount: item['leftCount'] })))
const { orderId } = data
PublicApi.getOrderVendorValidateDeliveryProduct({orderId, deliveryNo: null}).then(res => {
const { code, data }: any = res
if(code === 1000) {
schemaActions.setFieldValue('products', data.map(item => ({ ...item, deliveryCount: item['leftCount'] })))
}
})
// schemaActions.setFieldValue('products', deliveries.map(item => ({ ...item, deliveryCount: item['leftCount'] })))
}
}, [visible])
......
......@@ -5,7 +5,7 @@ import { formatTimeString } from '@/utils'
import { OrderDetailContext } from '../../_public/order/context'
import MellowCard from '@/components/MellowCard'
import NestTable from '@/components/NestTable'
import { DeliverySideState } from '@/constants/order'
import { OrderKindType } from '@/constants/order'
import { PublicApi } from '@/services/api'
import { history } from 'umi'
import { ExclamationCircleOutlined } from '@ant-design/icons'
......@@ -29,8 +29,10 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => {
// 用于储存已经修改过的订单id
const dataRef = useRef<any>([])
const { data, reloadFormData } = useContext(OrderDetailContext)
const { deliveries, deliveryDetails, orderModel, externalState } = data
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
const { deliveries, deliveryDetails, orderModel, externalState, orderKind } = data
const contractOrder = (orderKind === OrderKindType.SRM_ORDER)
const creditsCommodity = (orderModel === 24 || orderModel === 25) // @todo 积分或渠道积分下单模式
const outOrderCols: any[] = [
{
......@@ -114,6 +116,102 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => {
},
]
const outerMaterialCols: any[] = [
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
key: 'productId',
className: 'commonHide'
},
{
title: '物料编号',
dataIndex: 'productNo',
align: 'center',
key: 'productNo',
},
{
title: '物料名称/规格',
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: '关联报价商品ID/名称/规格/品类/品牌',
dataIndex: 'quotedSkuId',
align: 'center',
key: 'quotedSkuId',
render: (t, r) => `${t}/${r.quotedName || ''}/${r.quotedCategory || ''}/${r.quotedBrand || ''}`
},
{
title: '单价',
dataIndex: 'price',
align: 'center',
key: 'price',
},
{
title: '采购数量',
dataIndex: 'quantity',
align: 'center',
key: 'quantity',
},
{
title: '含税',
dataIndex: 'tax',
align: 'center',
key: 'tax',
render: (text) => text ? '是' : '否'
},
{
title: '金额',
dataIndex: 'amount',
align: 'center',
key: 'amount',
},
{
title: '已发货',
dataIndex: 'delivered',
align: 'center',
key: 'delivered',
},
{
title: '未发货',
dataIndex: 'leftCount',
align: 'center',
key: 'leftCount',
},
{
title: '已收货',
dataIndex: 'received',
align: 'center',
key: 'received',
},
{
title: '差异数量',
dataIndex: 'differCount',
align: 'center',
key: 'differCount',
},
]
const sideChildrenCols: any[] = [
{
......@@ -172,6 +270,83 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => {
},
]
const sideChildrenMaterialCols: any[] = [
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
key: 'productId',
className: 'commonHide'
},
{
title: '物料编号',
dataIndex: 'productNo',
align: 'center',
key: 'productNo',
},
{
title: '物料名称/规格',
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: '关联报价商品ID/名称/规格/品类/品牌',
dataIndex: 'quotedSkuId',
align: 'center',
key: 'quotedSkuId',
render: (t, r) => `${t}/${r.quotedName || ''}/${r.quotedCategory || ''}/${r.quotedBrand || ''}`
},
{
title: '单价',
dataIndex: 'price',
align: 'center',
key: 'price',
},
{
title: '采购数量',
dataIndex: 'quantity',
align: 'center',
key: 'quantity',
},
{
title: '发货数量',
dataIndex: 'delivered',
align: 'center',
key: 'delivered',
},
{
title: '收货数量',
dataIndex: 'received',
align: 'center',
key: 'received',
},
{
title: '差异数量',
dataIndex: 'differCount',
align: 'center',
key: 'differCount',
},
]
const sideOrderCols: any[] = [
{
title: '发货批次',
......@@ -340,7 +515,7 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => {
{
deliveries?.length > 0 && <Tabs.TabPane tab='订单收发货统计' key="1">
<Table
columns={outOrderCols}
columns={contractOrder ? outerMaterialCols : outOrderCols}
dataSource={deliveries}
pagination={false}
rowKey="skuId"
......@@ -350,7 +525,7 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => {
{
deliveryDetails?.length > 0 && <Tabs.TabPane tab='订单收发货明细' key="2">
<NestTable
NestColumns={[sideOrderCols, sideChildrenCols]}
NestColumns={[sideOrderCols, contractOrder ? sideChildrenMaterialCols : sideChildrenCols]}
rowKey='batchNo'
childrenDataKey='products'
dataSource={deliveryDetails}
......
......@@ -143,7 +143,8 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
}
const fetchMaterialList = (values) => {
const contractId = schemaAction.getFieldValue('contract')['contractId']
const contract = schemaAction.getFieldValue('contract')
const contractId = contract['id'] || contract['contractId']
const params = {
...values,
contractId,
......
......@@ -42,7 +42,7 @@ const ReadyReceiveOrderDetail: React.FC = () => {
<div>
<OrderDetailContext.Provider value={formContext}>
<OrderDetailHeader detailList={detailList} detailData={formContext.data} extraRight={
formContext.data?.receiveDone && <Button type='primary' onClick={handleClick}>
formContext.data && !formContext.data.receiveDone && <Button type='primary' onClick={handleClick}>
{isHeadReceipt ? '手工收货' : '去确认收货'}
</Button>
} />
......
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