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

fix: 对接新订单列表和详情

parent 9f4d21ab
import React, { useRef, useState } from 'react'
import { Card, Button, Modal } from 'antd'
import React, { useRef } from 'react'
import { Card, Button } from 'antd'
import { StandardTable } from 'god'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils'
import { ORDER_TYPE, PurchaseOrderOutWorkStateTexts, PurchaseOrderInsideWorkStateTexts } from '@/constants'
import { ORDER_TYPE } from '@/constants'
import StatusColors from './components/StatusColors'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { createFormActions, ISchema } from '@formily/antd'
......@@ -19,24 +18,6 @@ const formActions = createFormActions();
const tableListSchema: ISchema = {
type: 'object',
properties: {
// orderNo: {
// type: 'string',
// "x-component": 'SearchFilter',
// 'x-component-props': {
// placeholder: '请输入订单编号',
// align: 'flex-end',
// },
// },
// [FORM_FILTER_PATH]: {
// type: 'object',
// 'x-component': 'flex-layout',
// 'x-component-props': {
// inline: true,
// colStyle: {
// marginLeft: 20
// }
// },
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
......@@ -78,27 +59,26 @@ const tableListSchema: ISchema = {
},
properties: {
orderThe: {
digest: {
type: 'string',
'x-component-props': {
placeholder: '请输入订单摘要',
}
},
"supplyMembersName": {
"vendorMemberName": {
type: 'string',
"x-component-props": {
placeholder: '请输入供应会员名称'
}
},
"memberName": {
"buyerMemberName": {
type: 'string',
"x-component-props": {
placeholder: '请输入采购会员名称'
}
},
"[startCreateTime,endCreateTime]": {
type: 'array',
"x-component": 'DateRangePickerUnix',
"[startDate,endDate]": {
type: 'daterange',
'x-component-props': {
placeholder: ['开始时间','结束时间'],
},
......@@ -120,30 +100,27 @@ export const baseOrderListColumns: any[] = [
align: 'center',
dataIndex: 'orderNo',
key: 'orderNo',
render: (text, record) => {
// 查看订单, 需根据状态显示不同schema
return <EyePreview url={`/orderSystem/detail?id=${record.id}`}>
render: (text, record) => <EyePreview url={`/orderSystem/detail?id=${record.orderId}`}>
{text}
</EyePreview>
}
</EyePreview>
},
{
title: '订单摘要',
align: 'center',
dataIndex: 'orderThe',
key: 'orderThe',
dataIndex: 'digest',
key: 'digest',
},
{
title: '采购会员',
align: 'center',
dataIndex: 'memberName',
key: 'memberName',
dataIndex: 'buyerMemberName',
key: 'buyerMemberName',
},
{
title: '供应会员',
align: 'center',
dataIndex: 'supplyMembersName',
key: 'supplyMembersName',
dataIndex: 'vendorMemberName',
key: 'vendorMemberName',
},
{
title: '下单时间',
......@@ -155,65 +132,37 @@ export const baseOrderListColumns: any[] = [
{
title: '订单总额',
align: 'center',
dataIndex: 'sumPrice',
key: 'sumPrice',
render: (t, r) => (r.type === 7 || r.type === 8) ? t : '¥' + t
dataIndex: 'amount',
key: 'amount',
render: (t, r) => (r.orderType === 7 || r.orderType === 8) ? t : '¥' + t
},
{
title: '订单类型',
align: 'center',
dataIndex: 'type',
key: 'type',
render: (text) => ORDER_TYPE[text],
// 1.询价采购2.需求采购3.现货采购4.集采5.渠道直采6.渠道现货7.积分兑换8.渠道积分兑换
filters: [
{text: '询价采购', value: 1},
{text: '需求采购', value: 2},
{text: '现货采购', value: 3},
{text: '集采', value: 4},
{text: '渠道直采', value: 5},
{text: '渠道现货', value: 6},
{text: '积分兑换', value: 7},
{text: '渠道积分兑换', value: 8},
],
onFilter: (value, record) => value === record.type,
dataIndex: 'orderTypeName',
key: 'orderTypeName',
},
{
title: '外部状态',
align: 'center',
dataIndex: 'externalState',
key: 'externalState',
render: text => <StatusColors status={text} type='out'/>,
filters: Object.entries(PurchaseOrderOutWorkStateTexts).map(([key, value]) => ({text: value, value: Number(key)})),
onFilter: (value, record) => value === record.externalState,
dataIndex: 'outerStatusName',
key: 'outerStatusName',
},
// {
// title: '内部状态',
// align: 'center',
// dataIndex: 'interiorState',
// key: 'interiorState',
// render: (text) => <StatusColors status={text} type='inside'/>,
// filters: Object.entries(PurchaseOrderInsideWorkStateTexts).map(([key, value]) => ({text: value, value: Number(key)})),
// onFilter: (value, record) => value === record.interiorState,
// },
]
// 销售订单查询
export interface SaleOrderProps { }
const fetchTableData = async (params) => {
const { data } = await PublicApi.getOrderPlatformOrderList(params)
const { data } = await PublicApi.getOrderPlatformManagePage(params)
return data
}
// 最后一步开始调试 TODO
const SaleOrder: React.FC<SaleOrderProps> = (props) => {
const ref = useRef<any>({})
const secondColumns: any[] = baseOrderListColumns.concat([
])
const secondColumns: any[] = baseOrderListColumns.concat([])
const controllerBtns = <Button style={{width: 140}} onClick={() => {}} type='default'>导出</Button>
......@@ -244,38 +193,6 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
}}
/>
}
// formilyLayouts={{
// justify: 'space-between'
// }}
// formilyChilds={{
// layouts: {
// order: 2
// },
// children: <Button style={{width: 140}} onClick={() => {}} type='default'>导出</Button>
// }}
// formilyProps={{
// ctx: {
// inline: false,
// schema: tableListSchema,
// effects: ($, actions) => {
// useStateFilterSearchLinkageEffect(
// $,
// actions,
// 'orderNo',
// FORM_FILTER_PATH,
// );
// },
// components: {
// DateRangePicker: DatePicker.RangePicker,
// DateRangePickerUnix,
// Submit
// }
// },
// layouts: {
// order: 3,
// span: 16
// }
// }}
/>
</Card>
}
......
......@@ -19,9 +19,9 @@ const outOrderCols: any[] = [
},
{
title: '商品名称',
dataIndex: 'productName',
dataIndex: 'name',
align: 'center',
key: 'productName',
key: 'name',
},
{
title: '品类',
......@@ -43,28 +43,28 @@ const outOrderCols: any[] = [
},
{
title: '单价',
dataIndex: 'unitPrice',
dataIndex: 'price',
align: 'center',
key: 'unitPrice',
key: 'price',
},
{
title: '采购数量',
dataIndex: 'purchaseCount',
dataIndex: 'quantity',
align: 'center',
key: 'purchaseCount',
key: 'quantity',
},
{
title: '含税',
dataIndex: 'no',
dataIndex: 'tax',
align: 'center',
key: 'no',
render: () => '是'
key: 'tax',
render: (t) => t ? '是' : '否'
},
{
title: '金额',
dataIndex: 'price',
dataIndex: 'amount',
align: 'center',
key: 'price',
key: 'amount',
},
{
title: '已发货',
......@@ -74,21 +74,21 @@ const outOrderCols: any[] = [
},
{
title: '未发货',
dataIndex: 'notDelivered',
dataIndex: 'leftCount',
align: 'center',
key: 'notDelivered',
key: 'leftCount',
},
{
title: '已收货',
dataIndex: 'goodsReceived',
dataIndex: 'received',
align: 'center',
key: 'goodsReceived',
key: 'received',
},
{
title: '差异数量',
dataIndex: 'differenceCount',
dataIndex: 'differCount',
align: 'center',
key: 'differenceCount',
key: 'differCount',
},
]
......@@ -102,9 +102,9 @@ const sideChildrenCols: any[] = [
},
{
title: '商品名称',
dataIndex: 'productName',
dataIndex: 'name',
align: 'center',
key: 'productName',
key: 'name',
},
{
title: '品类',
......@@ -126,51 +126,51 @@ const sideChildrenCols: any[] = [
},
{
title: '采购数量',
dataIndex: 'purchaseCount',
dataIndex: 'quantity',
align: 'center',
key: 'purchaseCount',
key: 'quantity',
},
{
title: '发货数量',
dataIndex: 'deliverGoodsCount',
dataIndex: 'delivered',
align: 'center',
key: 'deliverGoodsCount',
key: 'delivered',
},
{
title: '入库数量',
dataIndex: 'storageCount',
title: '收货数量',
dataIndex: 'received',
align: 'center',
key: 'storageCount',
key: 'received',
},
{
title: '差异数量',
dataIndex: 'differenceCount',
dataIndex: 'differCount',
align: 'center',
key: 'differenceCount',
key: 'differCount',
},
]
// 订单发货记录
const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
const { data, reloadFormData } = useContext(OrderDetailContext)
const { orderReceivingStatisticsResponses, orderDeliveryDetailsResponses } = data
const { deliveries, deliveryDetails } = data
const sideOrderCols: any[] = [
{
title: '收货批次',
dataIndex: 'deliveryBatch',
dataIndex: 'batchNo',
align: 'center',
key: 'deliveryBatch'
key: 'batchNo'
},
{
title: '收货单号',
dataIndex: 'deliveryNo',
dataIndex: 'receiptNo',
align: 'center',
key: 'deliveryNo',
key: 'receiptNo',
},
{
title: '收货时间',
dataIndex: 'deliveryTime',
dataIndex: 'receiptTime',
align: 'center',
key: 'deliveryTime',
key: 'receiptTime',
render: text => formatTimeString(text)
},
{
......@@ -181,88 +181,54 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
},
{
title: '物流公司',
dataIndex: 'logisticsCompanyName',
dataIndex: 'company',
align: 'center',
key: 'logisticsCompanyName'
key: 'company'
},
{
title: '入库单号',
dataIndex: 'storageNo',
title: '发货单号',
dataIndex: 'deliveryNo',
align: 'center',
key: 'storageNo',
key: 'deliveryNo',
},
{
title: '入库时间',
dataIndex: 'storageTime',
title: '发货时间',
dataIndex: 'createTime',
align: 'center',
key: 'storageTime',
key: 'createTime',
render: text => formatTimeString(text)
},
{
title: '内部状态',
dataIndex: 'interiorState',
align: 'center',
key: 'interiorState',
render: text => <StatusColors type='deliveInside' status={text}/>
},
{
title: '操作',
dataIndex: 'ctl',
dataIndex: 'innerStatusName',
align: 'center',
key: 'ctl',
render: (text, record) => <>
{/* todo 需根据内部状态判断显示哪个按钮 */}
{ record.interiorState === DeliverySideState.CONFIRM_RECEIPT_ORDER && <Button type='link' onClick={() => handleReturn(record)}>确认回单</Button> }
{ record.interiorState === DeliverySideState.WAREHOUSE_ORDER && <Button type='link' onClick={() => handleConfirm(record)}>确认收货</Button> }
</>
key: 'innerStatusName',
},
]
// 确认收货
const handleConfirm = async (record) => {
const params = {
orderId: record.orderId,
id: record.id
}
await PublicApi.postOrderConfirmReceipt(params)
reloadFormData && reloadFormData()
}
// 确认回单
const handleReturn = async (record) => {
const params = {
orderId: record.orderId,
id: record.id
}
await PublicApi.postOrderReceiptOrderConfirmed(params)
reloadFormData && reloadFormData()
}
return (
<>
{
(orderReceivingStatisticsResponses?.length > 0 || orderDeliveryDetailsResponses?.length > 0) &&
(deliveries?.length > 0 || deliveryDetails?.length > 0) &&
<MellowCard style={{marginTop: 24}} bordered={false} id='deleveBox'>
<Tabs defaultActiveKey="2" animated={false}>
{
orderReceivingStatisticsResponses?.length > 0 && <Tabs.TabPane tab='订单收货统计' key="1">
deliveries?.length > 0 && <Tabs.TabPane tab='订单收货统计' key="1">
<Table
columns={outOrderCols}
dataSource={orderReceivingStatisticsResponses}
dataSource={deliveries}
pagination={false}
rowKey="productId"
/>
</Tabs.TabPane>
}
{
orderDeliveryDetailsResponses?.length > 0 && <Tabs.TabPane tab='订单收货明细' key="2">
deliveryDetails?.length > 0 && <Tabs.TabPane tab='订单收货明细' key="2">
<NestTable
NestColumns={[sideOrderCols, sideChildrenCols]}
rowKey='id'
childrenDataKey='orderDeliveryProducts'
dataSource={orderDeliveryDetailsResponses}
rowKey='batchNo'
childrenDataKey='productId'
dataSource={deliveryDetails}
/>
</Tabs.TabPane>
}
......@@ -275,4 +241,4 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
OrderDeleveRecord.defaultProps = {}
export default OrderDeleveRecord
\ No newline at end of file
export default OrderDeleveRecord
......@@ -11,22 +11,22 @@ import cx from 'classnames'
export interface OrderMergeInfoProps { }
const payInfo = [
{ title: '交付日期', name: 'deliveryTime', render: (text) => formatTimeString(text) },
{ title: '交付日期', name: 'deliverDate', render: (text) => formatTimeString(text) },
{
title: '交付地址', name: 'deliveryAddressInfo', render: (_, record) =>
title: '交付地址', name: 'address', render: (_, record) =>
<div>
<Row>
<Col>{record.receiverName}</Col>
<Col>{record.consignee}</Col>
<Col> / </Col>
<Col>{record.phone}</Col>
{record.isDefault && <Col style={{ marginLeft: 6 }}><Tag color='default'>默认</Tag></Col>}
{record.defaultConsignee && <Col style={{ marginLeft: 6 }}><Tag color='default'>默认</Tag></Col>}
</Row>
<div style={{ color: '#909399' }}>{record.fullAddress}</div>
<div style={{ color: '#909399' }}>{record.areaName + '' + record.address}</div>
</div>
},
{ title: '提货方式', name: 'deliveryType', render: (text) => DELIVERY_TYPE[text] },
{ title: '自提地址', name: 'pickUpAddress' },
{ title: '运费', name: 'freight' }
// { title: '提货方式', name: 'deliveryType', render: (text) => DELIVERY_TYPE[text] },
// { title: '自提地址', name: 'pickUpAddress' },
// { title: '运费', name: 'freight' }
]
......@@ -42,19 +42,15 @@ const RenderCard = ({ infoList, dataSource }) => infoList.map(v => dataSource[v.
const OrderMergeInfo: React.FC<OrderMergeInfoProps> = (props) => {
const orderDetailCtx = useContext(OrderDetailContext)
const [isModalVisible, setIsModalVisible] = useState(false)
// const address = useMemo(async () => {
// const { data } = await PublicApi.getLogisticsSelectListReceiverAddress()
// return data
// }, [])
const { data, ctl } = orderDetailCtx
const {theInvoiceInfo} = data
const { invoice } = data
const otherInfo = [
{ title: '发票', name: 'theInvoiceInfo', render: item => <div className={style.invoice_list_item}>
{ title: '发票', name: 'invoice', render: item => <div className={style.invoice_list_item}>
<div className={style.invoice_list_item_content}>
<div className={cx(style.invoice_list_item_content_tag, item.kind !== 1 ? style.special : '')}>{item.kind === 1 ? '增值税普通发票' : '增值税专用发票'}</div>
<div className={cx(style.invoice_list_item_content_tag, item.invoiceType !== 1 ? style.special : '')}>{item.invoiceType === 1 ? '增值税普通发票' : '增值税专用发票'}</div>
<div className={style.invoice_list_item_content_name}>
<div>{item.invoiceTitle}</div>
<div>{item.title}</div>
<div>{item.taxNo}</div>
</div>
</div>
......@@ -69,27 +65,12 @@ const OrderMergeInfo: React.FC<OrderMergeInfoProps> = (props) => {
{ title: '其他要求', name: 'restsRequire' },
]
// useEffect(() => {
// if (data.deliveryAddresId && !data.receiverName) {
// asyncSetAddress()
// }
// }, [data, address])
// const asyncSetAddress = async () => {
// const res = await address
// debugger
// ctl.setData({
// ...data,
// ...(res.find(v => v.id === data.deliveryAddresId) || {})
// })
// }
return (
<>
<Row style={{ marginTop: 24 }} gutter={24}>
<Col span={data.orderModel > 30 ? 15: 12}>
<MellowCard title='交易信息' fullHeight>
<RenderCard infoList={payInfo} dataSource={data} />
<RenderCard infoList={payInfo} dataSource={data.consignee} />
</MellowCard>
</Col>
<Col span={data.orderModel > 30 ? 9: 6}>
......@@ -121,14 +102,14 @@ const OrderMergeInfo: React.FC<OrderMergeInfoProps> = (props) => {
</Row>
<Modal title="发票信息" visible={isModalVisible} onOk={()=>setIsModalVisible(false)} onCancel={()=>setIsModalVisible(false)}>
<Row gutter={[0 ,10]} style={{fontSize: 14}}>
<Col span={4}>开具类型:</Col><Col span={20}>{theInvoiceInfo?.type === 1 ? "企业" : "个人"}</Col>
<Col span={4}>发票种类:</Col><Col span={20}>{theInvoiceInfo?.kind === 1 ? "增值税普通发票" : "增值税专用发票"}</Col>
<Col span={4}>发票抬头:</Col><Col span={20}>{theInvoiceInfo?.invoiceTitle}</Col>
<Col span={4}>纳税号:</Col><Col span={20}>{theInvoiceInfo?.taxNo}</Col>
<Col span={4}>开户行:</Col><Col span={20}>{theInvoiceInfo?.bankOfDeposit}</Col>
<Col span={4}>账号:</Col><Col span={20}>{theInvoiceInfo?.account}</Col>
<Col span={4}>地址:</Col><Col span={20}>{theInvoiceInfo?.addres}</Col>
<Col span={4}>电话:</Col><Col span={20}>{theInvoiceInfo?.tel}</Col>
<Col span={4}>开具类型:</Col><Col span={20}>{invoice?.invoiceKind === 1 ? "企业" : "个人"}</Col>
<Col span={4}>发票种类:</Col><Col span={20}>{invoice?.invoiceType === 1 ? "增值税普通发票" : "增值税专用发票"}</Col>
<Col span={4}>发票抬头:</Col><Col span={20}>{invoice?.title}</Col>
<Col span={4}>纳税号:</Col><Col span={20}>{invoice?.taxNo}</Col>
<Col span={4}>开户行:</Col><Col span={20}>{invoice?.bank}</Col>
<Col span={4}>账号:</Col><Col span={20}>{invoice?.account}</Col>
<Col span={4}>地址:</Col><Col span={20}>{invoice?.addres}</Col>
<Col span={4}>电话:</Col><Col span={20}>{invoice?.phone}</Col>
</Row>
</Modal>
</>
......
......@@ -64,14 +64,14 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = (props) => {
// 简单流程为24
const processEnum = data.processEnum
useEffect(() => {
PublicApi.getPayPayWayList({memberId: data.supplyMembersId, memberRoleId: data.supplyMembersRoleId}).then(res => {
const { code, data } = res
if (code === 1000) {
setPaylist(data)
}
})
}, [])
// useEffect(() => {
// PublicApi.getPayPayWayList({memberId: data.supplyMembersId, memberRoleId: data.supplyMembersRoleId}).then(res => {
// const { code, data } = res
// if (code === 1000) {
// setPaylist(data)
// }
// })
// }, [])
return (
<Row gutter={24} style={{marginTop: 24}}>
......@@ -79,7 +79,7 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = (props) => {
<MellowCard bordered={false} fullHeight>
{/* <Row gutter={24}> */}
<Tabs defaultActiveKey='1'>
{ data.paymentInformationResponses && data.paymentInformationResponses.map(v => <TabPane key={v.id} tab={<TabHeader dataSource={v}/>}>
{ data.payments && data.payments.map(v => <TabPane key={v.id} tab={<TabHeader dataSource={v}/>}>
<Row>
<Col className={style.fontGray} span={4}>支付环节: </Col>
<Col>{v.payNode}</Col>
......
......@@ -84,10 +84,10 @@ const warehouseColumns: any[] = [
const modalPriceActions = createFormActions()
// 总计金额联动框
export const MoneyTotalBox = ({ dataSource, isEditData }) => {
const { orderProductRequests = [], receiverAddressId, orderModel, sumPrice, amount, freight } = dataSource || {}
const { product, orderModel, sumPrice, amount } = dataSource || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
const sum = amount || orderProductRequests.reduce((prev, next) => prev + Number((next.price || 0)), 0)
const sum = amount || product.products.reduce((prev, next) => prev + Number((next.price || 0)), 0)
const modelRef = useRef<any>({})
const [freePrice, setFreePrice] = useState<number>(0)
const handleSetting = () => {
......@@ -99,30 +99,33 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
modelRef.current.setVisible(false)
}
useEffect(() => {
// 存在商品 并且有选择收货地址,则开始计算运费
if (orderProductRequests && orderProductRequests.length > 0 && receiverAddressId) {
// 筛选配送方式为物流的商品并且使用了运费模板
const logsiticsDataMaps = orderProductRequests.filter(v => v.logistics && v.logistics.useTemplate && v.logistics.deliveryType === 1)
if (logsiticsDataMaps.length > 0) {
PublicApi.postLogisticsFreightRemoteAddDetail({
orderProductList: logsiticsDataMaps.map(v => ({
templateId: v.templateId,
weight: v.weight
})),
receiverAddressId
}, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => {
if (res.code === 1000) {
setFreePrice(res.data)
}
})
}
}
}, [orderProductRequests])
// useEffect(() => {
// // 存在商品 并且有选择收货地址,则开始计算运费
// if (orderProductRequests && orderProductRequests.length > 0 && receiverAddressId) {
// // 筛选配送方式为物流的商品并且使用了运费模板
// const logsiticsDataMaps = orderProductRequests.filter(v => v.logistics && v.logistics.useTemplate && v.logistics.deliveryType === 1)
// if (logsiticsDataMaps.length > 0) {
// PublicApi.postLogisticsFreightRemoteAddDetail({
// orderProductList: logsiticsDataMaps.map(v => ({
// templateId: v.templateId,
// weight: v.weight
// })),
// receiverAddressId
// }, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => {
// if (res.code === 1000) {
// setFreePrice(res.data)
// }
// })
// }
// }
// }, [orderProductRequests])
const { productAmount, totalAmount, freight } = product
return <RowStyle>
<Col span={2}>
<div>{creditsCommodity ? '合计所需积分' : '合计金额'}</div>
<div>{sum}</div>
<div>{productAmount}</div>
</Col>
<Col span={2}>
<div>运费 { isEditData && <SettingOutlined style={{marginLeft: 8}} onClick={handleSetting}/>}</div>
......@@ -130,7 +133,7 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
</Col>
<Col span={2}>
<div>{creditsCommodity ? '总计所需积分' : '总计金额'}</div>
<div>{sumPrice || sum + freePrice}</div>
<div>{totalAmount || sum + freePrice}</div>
</Col>
<ModalForm
modalTitle='设置运费'
......@@ -168,21 +171,14 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
// 自提地址框
export const AddressPop = (props) => {
const { pickInfo = null, children } = props
let receiveInfo = pickInfo?.render && JSON.parse(pickInfo.render)
return pickInfo && pickInfo.deliveryType === 2 ? <Space>
return pickInfo && pickInfo.deliverType === 2 ? <Space>
<EnvironmentOutlined style={{marginRight: 8}}/>
<Popover content={
<Row>
<div>
<h3><EnvironmentOutlined/> 自提地址</h3>
{/* <p>{pickInfo.receiverName} / {pickInfo.phone}</p>
<p>{pickInfo.fullAddress}</p> */}
{
receiveInfo && <>
<p>{receiveInfo.shipperName} / {receiveInfo.phone}</p>
<p>{receiveInfo.provinceName + receiveInfo.cityName + receiveInfo.districtName + receiveInfo.address}</p>
</>
}
<p>{pickInfo.receiver} / {pickInfo.phone}</p>
<p>{pickInfo.address}</p>
</div>
</Row>
}>
......@@ -279,8 +275,7 @@ const EditableCell: React.FC<EditableCellProps> = ({
const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const { ctl, data } = useContext(OrderDetailContext)
const { page_type } = usePageStatus()
const { orderProductRequests = [], orderModel } = data || {}
const { product, orderModel } = data || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
const [warehouseVisible, setWarehouseVisible] = useState(false)
......@@ -288,49 +283,48 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const warehouseRef = useRef<any>({})
// 判断是否可操作当前表格
const isEditData = SALE_ORDER_STATUS.READY_APPROVED_ORDER === parseInt(page_type)
const isEditData = false
const productComponents = {
body: {
row: EditableRow,
cell: EditableCell
}
}
const asyncGetMemberPrice = async (asyncData: any[]) => {
return await Promise.all(asyncData.filter(v => v.memberPrice === undefined).map(async v => {
const {code, data} = await PublicApi.getMemberManageUpperCreditParamGet({
parentMemberId: v.memberId,
parentMemberRoleId: v.memberRoleId
}, {ttl: 60 * 1000, useCache: true})
return code === 1000 ? { value: (data.parameter * 100) + '%', id: v.id } : { value: '', id: 0 }
}
))
}
useEffect(() => {
// 过滤 会员折扣不存在的列表
const hasPriceList = orderProductRequests.filter(v => !v.memberPrice)
if (hasPriceList.length > 0) {
asyncGetMemberPrice(hasPriceList).then((asyncData) => {
if (asyncData.length > 0) {
const newData = orderProductRequests.map((v, i) => {
if (!v.memberPrice) {
v.memberPrice = asyncData.find(j => j.id === v.id)?.value || 0
}
return v
})
ctl.setData({
...data,
orderProductRequests: newData
})
}
})
}
}, [orderProductRequests])
// const asyncGetMemberPrice = async (asyncData: any[]) => {
// return await Promise.all(asyncData.filter(v => v.memberPrice === undefined).map(async v => {
// const {code, data} = await PublicApi.getMemberManageUpperCreditParamGet({
// parentMemberId: v.memberId,
// parentMemberRoleId: v.memberRoleId
// }, {ttl: 60 * 1000, useCache: true})
// return code === 1000 ? { value: (data.parameter * 100) + '%', id: v.id } : { value: '', id: 0 }
// }
// ))
// }
// useEffect(() => {
// // 过滤 会员折扣不存在的列表
// const hasPriceList = orderProductRequests.filter(v => !v.memberPrice)
// if (hasPriceList.length > 0) {
// asyncGetMemberPrice(hasPriceList).then((asyncData) => {
// if (asyncData.length > 0) {
// const newData = orderProductRequests.map((v, i) => {
// if (!v.memberPrice) {
// v.memberPrice = asyncData.find(j => j.id === v.id)?.value || 0
// }
// return v
// })
// ctl.setData({
// ...data,
// orderProductRequests: newData
// })
// }
// })
// }
// }, [orderProductRequests])
const handleSave = row => {
const newData = [...orderProductRequests];
const newData = [...product.products];
const index = newData.findIndex(item => row.key === item.key);
const item = newData[index];
newData.splice(index, 1, {
......@@ -339,7 +333,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
});
ctl.setData({
...data,
orderProductRequests: newData
product: { products: newData }
})
};
......@@ -351,15 +345,15 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const productInfoColumns: any[] = [
{
title: 'ID',
dataIndex: 'id',
dataIndex: 'productId',
align: 'center',
key: 'id',
key: 'productId',
},
{
title: '商品名称',
dataIndex: 'productName',
dataIndex: 'name',
align: 'center',
key: 'productName',
key: 'name',
},
{
title: '品类',
......@@ -388,39 +382,37 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
},
{
title: '会员折扣',
dataIndex: 'memberPrice',
dataIndex: 'discount',
align: 'center',
key: 'memberPrice',
render: (text, record) => record.isMemberPrice ? (text * 10000 / 100 + '%') : null
key: 'discount',
render: (text, record) => (text + '%')
},
{
title: creditsCommodity ? '兑换数量' : '采购数量',
dataIndex: 'purchaseCount',
dataIndex: 'quantity',
align: 'center',
key: 'purchaseCount'
key: 'quantity'
},
{
title: '含税',
dataIndex: 'none',
dataIndex: 'tax',
align: 'center',
key: 'none',
render: () => '是'
key: 'tax',
render: (t) => t ? '是' : '否'
},
{
title: creditsCommodity ? '所需积分小计' : '金额',
dataIndex: 'money',
dataIndex: 'amount',
align: 'center',
key: 'money',
key: 'amount',
},
// 接口调用
{
title: '配送方式',
dataIndex: 'logistics',
dataIndex: 'deliverType',
align: 'center',
key: 'logistics',
// render: (text) => text && text.deliveryType && DELIVERY_TYPE[text.deliveryType]
render: (text) => (text && text.deliveryType && text.deliveryType === 2) ?
<AddressPop pickInfo={text}>{DELIVERY_TYPE[text.deliveryType]}</AddressPop> : DELIVERY_TYPE[text?.deliveryType]
key: 'deliverType',
render: (text, record) => (text && text === 2) ?
<AddressPop pickInfo={record}>{record.deliverTypeName}</AddressPop> : record.deliverTypeName
},
{
title: '仓位库存扣减记录',
......@@ -433,8 +425,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
]
const fetchWarehouseData = useCallback(async (params) => {
// const { data } = await PublicApi.getWarehousePositionDeductionRecordList({...params, productId: String(checkProductId)})
const { data } = await PublicApi.getWarehousePlatformPositionDeductionRecordList({...params, productId: String(checkProductId)})
const { data } = await PublicApi.getProductPlatformPositionDeductionRecordList({...params, productId: String(checkProductId)})
return data
}, [checkProductId])
......@@ -457,9 +448,9 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
<MellowCard title='订单商品' style={{marginTop: 24}} bordered={false}>
<Table
columns={columns}
dataSource={orderProductRequests}
dataSource={product.products}
components={productComponents}
rowKey='id'
rowKey='productId'
pagination={false}
/>
<MoneyTotalBox dataSource={data} isEditData={isEditData}/>
......
......@@ -17,17 +17,15 @@ const outOrderCols: any[] = [
},
{
title: '操作角色',
dataIndex: 'roleName',
dataIndex: 'operatorRoleName',
align: 'center',
key: 'roleName',
key: 'operatorRoleName',
},
{
title: '状态',
dataIndex: 'state',
dataIndex: 'statusName',
align: 'center',
key: 'state',
render: text => <StatusColors status={text} type='transformOut'/>
// @todo 需传递工作流状态重新render
key: 'statusName',
},
{
title: '操作',
......@@ -37,16 +35,16 @@ const outOrderCols: any[] = [
},
{
title: '操作时间',
dataIndex: 'operationTime',
dataIndex: 'createTime',
align: 'center',
key: 'operationTime',
key: 'createTime',
render: time => formatTimeString(time)
},
{
title: '审核意见',
dataIndex: 'auditOpinion',
dataIndex: 'remark',
align: 'center',
key: 'auditOpinion',
key: 'remark',
},
]
const sideOrderCols: any[] = [
......@@ -104,28 +102,28 @@ const sideOrderCols: any[] = [
// 订单流转记录
const OrderTransformRecord:React.FC<OrderTransformRecordProps> = (props) => {
const { data } = useContext(OrderDetailContext)
const { externalProcurementOrderLogResponses, interiorProcurementOrderLogResponses } = data
const { outerHistories, innerHistories } = data
return (
<>
{
(externalProcurementOrderLogResponses?.length>0 || interiorProcurementOrderLogResponses?.length>0) &&
(outerHistories?.length>0 || innerHistories?.length>0) &&
<MellowCard style={{marginTop: 24}} bordered={false}>
<Tabs defaultActiveKey="1" animated={false}>
{
externalProcurementOrderLogResponses?.length>0 && <Tabs.TabPane tab='外部订单流转记录' key="1">
outerHistories?.length>0 && <Tabs.TabPane tab='外部订单流转记录' key="1">
<Table
columns={outOrderCols}
dataSource={externalProcurementOrderLogResponses}
dataSource={outerHistories}
pagination={false}
rowKey="id"
/>
</Tabs.TabPane>
}
{
interiorProcurementOrderLogResponses?.length>0 && <Tabs.TabPane tab='内部订单流转记录' key="2">
innerHistories?.length>0 && <Tabs.TabPane tab='内部订单流转记录' key="2">
<Table
columns={sideOrderCols}
dataSource={interiorProcurementOrderLogResponses}
dataSource={innerHistories}
pagination={false}
rowKey="id"
/>
......
import React, { useState, useEffect, useContext, useRef } from 'react'
import React, { useState, useEffect, useRef } from 'react'
import OrderDetailHeader from '../components/OrderDetailHeader'
import { Link, history } from 'umi'
import { orderTypeLabel, SALE_ORDER_STATUS } from './constant'
import { Link } from 'umi'
import { formatTimeString } from '@/utils'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { PublicApi } from '@/services/api'
import AuditProcess from '@/components/AuditProcess'
import { findLastIndexFlowState } from '@/utils'
import OrderDetailWrapper from '../components/OrderDetailWrapper'
import { GlobalConfig } from '@/global/config'
import OrderProductTable from './components/orderProductTable'
import { OrderDetailContext } from './context'
import OrderMergeInfo from './components/orderMergeInfo'
import OrderTransformRecord from './components/orderTransformRecord'
import OrderPayTabs from './components/orderPayTabs'
import StatusColors from '../components/StatusColors'
import OrderDeleveRecord from './components/orderDeleveRecord'
export interface CommonOrderDetailProps {}
......@@ -22,8 +18,7 @@ export interface CommonOrderDetailProps {}
const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
const [formData, setFormData] = useState<any>(null)
let { id, pageStatus, page_type = SALE_ORDER_STATUS.READY_APPROVED_ORDER, orderNo } = usePageStatus()
page_type = Number(page_type)
let { id, pageStatus } = usePageStatus()
const payResultVisible = useRef<any>({})
const [payResultType, setPayResultType] = useState<'default' | 'preview'>('default')
useEffect(() => {
......@@ -31,8 +26,8 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
}, [])
const reloadFormData = () => {
if (id || orderNo) {
PublicApi.getOrderPlatformOrderDetails({ id, orderNo }).then(({data, code}) => {
if (id) {
PublicApi.getOrderPlatformManageDetail({ orderId: id }).then(({data, code}) => {
if (code === 1000) {
setFormData(data)
}
......@@ -52,14 +47,13 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
}
const detailList = [
{ label: '对应报价单号', name: 'quotationNo', span: 8, render: text => <Link to={'/'}>{text}</Link> },
{ label: '订单摘要', name: 'orderThe', span: 8 },
{ label: '供应会员', name: 'supplyMembersName', span: 8 },
{ label: '下单模式', name: 'orderModel', span: 8, render: text => GlobalConfig.web.orderMode.find(v => v.value === text)?.label || '' },
{ label: '订单类型', name: 'type', span: 8, render: text => orderTypeLabel[text] },
{ label: '对应报价单号', name: 'quoteNo', span: 8, render: text => <Link to={'/'}>{text}</Link> },
{ label: '订单摘要', name: 'digest', span: 8 },
{ label: '供应会员', name: 'vendorMemberName', span: 8 },
{ label: '下单模式', name: 'orderModeName', span: 8 },
{ label: '订单类型', name: 'orderTypeName', span: 8 },
{ label: '下单时间', name: 'createTime', span: 8, render: text => formatTimeString(text) },
{ label: '外部状态', name: 'externalState', span: 8, render: text => <StatusColors type='out' status={text}/> },
// { label: '内部状态', name: 'purchaseOrderInteriorState', span: 8, render: text => <StatusColors type='saleInside' status={text}/> },
{ label: '外部状态', name: 'outerStatusName', span: 8 },
]
const headerTiTle = formData ? {
picName: '单',
......@@ -74,13 +68,27 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
<OrderDetailWrapper>
<div className='gray-wrap'>
{/* 工作流进度 */}
{ pageStatus !== PageStatus.ADD && formData && formData.externalWorkflowFlowRecordLogResponses && <AuditProcess
customTitleKey='operationalProcess'
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(formData.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formData.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={formData.externalWorkflowFlowRecordLogResponses || null}
innerVerifySteps={formData.interiorWorkflowFlowRecordLogResponses || null}
{ pageStatus !== PageStatus.ADD && formData && formData.outerSteps && <AuditProcess
customTitleKey='stepName'
customKey='step'
outerVerifyCurrent={formData.currentOuterStep}
innerVerifyCurrent={formData.currentInnerStep}
outerVerifySteps={
formData.outerSteps ?
formData.outerSteps.map(item => ({
...item,
status: (item.step <= formData.currentOuterStep) ? 'finish' : 'wait',
})) :
null
}
innerVerifySteps={
formData.innerSteps ?
formData.innerSteps.map(item => ({
...item,
status: (item.step <= formData.currentInnerStep) ? 'finish' : 'wait',
})) :
null
}
></AuditProcess> }
{/* 商品列表 */}
......
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