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

fix: srm订单详情

parent d11d0b2f
import React, { useContext } from 'react'
import { Tabs, Table, Button } from 'antd'
import StatusColors from '../../../components/StatusColors'
import { Tabs, Table } from 'antd'
import { formatTimeString } from '@/utils'
import { OrderDetailContext } from '../../context'
import MellowCard from '@/components/MellowCard'
import NestTable from '@/components/NestTable'
import { SaleOrderInsideWorkState, DeliverySideState } from '@/constants'
import { PublicApi } from '@/services/api'
import { OrderKindType } from '../../constant'
export interface OrderDeleveRecordProps {}
......@@ -92,6 +91,96 @@ const outOrderCols: any[] = [
},
]
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 ? `${t}/${r.quotedName || ''}/${r.quotedCategory || ''}/${r.quotedBrand || ''}` : ''
},
{
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[] = [
{
......@@ -149,10 +238,86 @@ const sideChildrenCols: any[] = [
key: 'differCount',
},
]
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 ? `${t}/${r.quotedName || ''}/${r.quotedCategory || ''}/${r.quotedBrand || ''}` : ''
},
{
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 OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
const { data, reloadFormData } = useContext(OrderDetailContext)
const { deliveries, deliveryDetails } = data
const { deliveries, deliveryDetails, orderKind } = data
// 合同下单模式
const contractOrder = (orderKind === OrderKindType.SRM_ORDER)
const sideOrderCols: any[] = [
{
title: '收货批次',
......@@ -215,7 +380,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="productId"
......@@ -225,7 +390,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}
......
import React, { useContext, useState, useRef, useEffect, useCallback } from 'react'
import { StandardTable } from 'god'
import { Card, Table, Form, Input, Row, Col, Button, Modal, Space, Popover } from 'antd'
import { Table, Form, Input, Row, Col, Button, Modal, Space, Popover } from 'antd'
import { OrderDetailContext } from '../../context'
import { EditOutlined, EnvironmentOutlined, SettingOutlined } from '@ant-design/icons'
import style from './index.less'
import { PublicApi } from '@/services/api'
import styled from 'styled-components'
import ModalForm from '@/components/ModalForm'
import { createFormActions } from '@formily/antd'
import MellowCard from '@/components/MellowCard'
import { SALE_ORDER_STATUS } from '../../constant'
import { usePageStatus } from '@/hooks/usePageStatus'
import { OrderKindType } from '../../constant'
import ModalTable from '@/components/ModalTable'
import { formatTimeString } from '@/utils'
import { DELIVERY_TYPE } from '@/constants'
export interface OrderProductTableProps {}
......@@ -84,8 +80,8 @@ const warehouseColumns: any[] = [
const modalPriceActions = createFormActions()
// 总计金额联动框
export const MoneyTotalBox = ({ dataSource, isEditData }) => {
const { product, orderModel, sumPrice, amount } = dataSource || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
const { product, orderModel, sumPrice, amount, orderKind } = dataSource || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // @todo 积分或渠道积分下单模式
const sum = amount || product.products.reduce((prev, next) => prev + Number((next.price || 0)), 0)
const modelRef = useRef<any>({})
......@@ -275,9 +271,10 @@ const EditableCell: React.FC<EditableCellProps> = ({
const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const { ctl, data } = useContext(OrderDetailContext)
const { product, orderModel } = data || {}
const { product, orderModel, orderKind } = data || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
// 合同下单模式
const contractOrder = (orderKind === OrderKindType.SRM_ORDER)
const [warehouseVisible, setWarehouseVisible] = useState(false)
const [checkProductId, setCheckProductId] = useState(0) // 选中的商品id
const warehouseRef = useRef<any>({})
......@@ -424,6 +421,101 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
},
]
// 订单物料
const materialInfo: any[] = [
{
title: 'ID',
dataIndex: 'skuId',
align: 'center',
key: 'skuId',
className: 'commonHide'
},
{
title: '物料编号',
dataIndex: 'productNo',
align: 'center',
key: 'productNo',
},
{
title: '物料名称/规格',
dataIndex: 'name',
align: 'center',
key: 'name',
render: (t, r) => <>{t}/{r.spec}</>
},
{
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 ? `${t}/${r.quotedName}/${r.quotedCategory}/${r.quotedBrand}` : ''
},
{
title: '单价(元)',
dataIndex: 'price',
align: 'left',
key: 'price',
},
{
title: '供方库存',
dataIndex: 'stock',
align: 'center',
key: 'stock',
},
{
title: '采购数量',
dataIndex: 'quantity',
align: 'center',
key: 'quantity',
},
{
title: '含税',
dataIndex: 'tax',
align: 'center',
key: 'tax',
render: (t, r) => t ? '是' : '否'
},
{
title: '税率',
dataIndex: 'taxRate',
align: 'center',
key: 'taxRate',
render: (t, r) => t ? `${t}%` : null
},
{
title: '金额',
dataIndex: 'amount',
align: 'center',
key: 'amount',
},
{
title: '配送方式',
dataIndex: 'deliverType',
align: 'center',
key: 'deliverType',
render: (text, record) => (text && text === 2) ?
<AddressPop pickInfo={record}>{record.deliverTypeName}</AddressPop> : record.deliverTypeName
}
]
const fetchWarehouseData = useCallback(async (params) => {
const { data } = await PublicApi.getProductPlatformPositionDeductionRecordList({...params, productId: String(checkProductId)})
return data
......@@ -445,9 +537,9 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
};
});
return (
<MellowCard title='订单商品' style={{marginTop: 24}} bordered={false}>
<MellowCard title={contractOrder ? '订单物料' : '订单商品'} style={{marginTop: 24}} bordered={false}>
<Table
columns={columns}
columns={contractOrder ? materialInfo : columns}
dataSource={product.products}
components={productComponents}
rowKey='productId'
......
......@@ -86,7 +86,7 @@ export const orderCombination = {
]
}
export const orderTypeLabel = ['',
export const orderTypeLabel = ['',
'询价采购',
'需求采购',
'现货采购',
......@@ -97,6 +97,25 @@ export const orderTypeLabel = ['',
'渠道积分兑换'
]
// 订单种类 *NEW
export enum OrderKindType {
/**
* 采购订单
*/
PURCHASE_ORDER = 1,
/**
* SRM订单
*/
SRM_ORDER = 2,
/**
* B2B订单
*/
B2B_ORDER = 3,
}
// 支付方式
export const payTypeLabel = [
{
......@@ -367,4 +386,4 @@ export const mergeOrderColumns: any[] = [
align: 'center',
key: 'none',
}
]
\ No newline at end of file
]
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