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

fix:

parent 0bfec93f
import React from 'react' import React from 'react'
import AuditProcess from '@/components/AuditProcess' import AuditProcess from '@/components/AuditProcess'
import { findLastIndexFlowState } from '@/utils' import { findLastIndexFlowState } from '@/utils'
import OrderProductTable from '../../components/orderProductTable' import OrderProductTable from '../../components/orderProductTable'
import SaleOrderProductTable from '../../components/saleOrderProductTable' import SaleOrderProductTable from '../../components/saleOrderProductTable'
import OrderPayTabs from '../../components/orderPayTabs' import OrderPayTabs from '../../components/orderPayTabs'
import OrderMergeInfo from '../../components/orderMergeInfo' import OrderMergeInfo from '../../components/orderMergeInfo'
import OrderDeleveRecord from '../../components/orderDeleveRecord' import OrderDeleveRecord from '../../components/orderDeleveRecord'
import OrderTransformRecord from '../../components/orderTransformRecord' import OrderTransformRecord from '../../components/orderTransformRecord'
import OrderSaleRecord from '../orderSaleRecord' import OrderSaleRecord from '../orderSaleRecord'
export interface OrderDetailSectionProps { export interface OrderDetailSectionProps {
formContext: any, formContext: any,
type?: 'purchaseOrder' | 'saleOrder', type?: 'purchaseOrder' | 'saleOrder',
} }
const OrderDetailSection:React.FC<OrderDetailSectionProps> = ({formContext, type = 'purchaseOrder'}) => { const OrderDetailSection:React.FC<OrderDetailSectionProps> = ({formContext, type = 'purchaseOrder'}) => {
return ( return (
formContext.data && <div className='gray-wrap'> formContext.data && <div className='gray-wrap'>
<AuditProcess <AuditProcess
customTitleKey='operationalProcess' customTitleKey='operationalProcess'
customKey='state' customKey='state'
outerVerifyCurrent={findLastIndexFlowState(formContext.data.externalWorkflowFlowRecordLogResponses)} outerVerifyCurrent={findLastIndexFlowState(formContext.data.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formContext.data.interiorWorkflowFlowRecordLogResponses)} innerVerifyCurrent={findLastIndexFlowState(formContext.data.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={ outerVerifySteps={
formContext.data.externalWorkflowFlowRecordLogResponses ? formContext.data.externalWorkflowFlowRecordLogResponses ?
formContext.data.externalWorkflowFlowRecordLogResponses.map(item => ({ formContext.data.externalWorkflowFlowRecordLogResponses.map(item => ({
...item, ...item,
status: item.isExecute ? 'finish' : 'wait', status: item.isExecute ? 'finish' : 'wait',
})) : })) :
[] []
} }
innerVerifySteps={ innerVerifySteps={
formContext.data.interiorWorkflowFlowRecordLogResponses ? formContext.data.interiorWorkflowFlowRecordLogResponses ?
formContext.data.interiorWorkflowFlowRecordLogResponses.map(item => ({ formContext.data.interiorWorkflowFlowRecordLogResponses.map(item => ({
...item, ...item,
status: item.isExecute ? 'finish' : 'wait', status: item.isExecute ? 'finish' : 'wait',
})) : })) :
[] []
} }
></AuditProcess> ></AuditProcess>
{ type === 'saleOrder' ? <SaleOrderProductTable/> : <OrderProductTable editable /> } { type === 'saleOrder' ? <SaleOrderProductTable/> : <OrderProductTable editable /> }
<OrderPayTabs /> <OrderPayTabs />
<OrderMergeInfo /> <OrderMergeInfo />
{ type === 'saleOrder' ? <OrderSaleRecord /> : <OrderDeleveRecord /> } { type === 'saleOrder' ? <OrderSaleRecord /> : <OrderDeleveRecord /> }
<OrderTransformRecord type={type}/> <OrderTransformRecord type={type}/>
</div> </div>
) )
} }
OrderDetailSection.defaultProps = {} OrderDetailSection.defaultProps = {}
export default OrderDetailSection export default OrderDetailSection
\ No newline at end of file
...@@ -7,7 +7,6 @@ import StatusColors from '../StatusColors' ...@@ -7,7 +7,6 @@ import StatusColors from '../StatusColors'
import moment from 'moment' import moment from 'moment'
import { PayOutWorkState } from '@/constants' import { PayOutWorkState } from '@/constants'
import OverflowText from '@/components/OverflowText' import OverflowText from '@/components/OverflowText'
import { isTemplateExpression } from 'typescript'
import { QuestionCircleOutlined } from '@ant-design/icons' import { QuestionCircleOutlined } from '@ant-design/icons'
/** /**
...@@ -59,7 +58,7 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = (props) => { ...@@ -59,7 +58,7 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = (props) => {
{dataSource.payPrice || 0} {dataSource.payPrice || 0}
{ {
dataSource.refundPrice && dataSource.refundPrice &&
<Tooltip title={`本次实际支付金额(¥${data.payPrice-data.refundPrice})=本次订单待支付金额(¥${data.payPrice})-售后待退款金额(¥${data.refundPrice})`}> <Tooltip title={`本次实际支付金额(¥${data.payPrice})=本次订单待支付金额(¥${data.payPrice+data.refundPrice})-售后待退款金额(¥${data.refundPrice})`}>
<QuestionCircleOutlined /> <QuestionCircleOutlined />
</Tooltip> </Tooltip>
} }
......
...@@ -71,4 +71,10 @@ export const fetchOrderApi = { ...@@ -71,4 +71,10 @@ export const fetchOrderApi = {
return data return data
}, },
// 获取合并订单列表
async getMergeOrderList(params) {
const { data } = await PublicApi.getOrderMergeOrderList(params)
return data
},
} }
import React, { useEffect } from 'react' import React, { useEffect } from 'react'
import ModalTable, { ModalTableProps } from '@/components/ModalTable' import ModalTable, { ModalTableProps } from '@/components/ModalTable'
import { fetchOrderApi } from '../../apis' import { fetchOrderApi } from '../../apis'
import { useModalTable } from '../../model/useModalTable' import { useModalTable } from '../../model/useModalTable'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd' import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { mergeOrderColumns } from '../../constant' import { mergeOrderColumns } from '../../constant'
export interface MergeOrderModalTableProps extends ModalTableProps { export interface MergeOrderModalTableProps extends ModalTableProps {
type?: 'radio' | 'checkbox', type?: 'radio' | 'checkbox',
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions, schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any, currentRef?: any,
confirmModal?() confirmModal?()
} }
// 报价单弹窗 // 报价单弹窗
const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => { const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
const { type = 'radio', schemaAction, confirmModal, currentRef, ...restProps } = props const { type = 'radio', schemaAction, confirmModal, currentRef, ...restProps } = props
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type}) const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type})
useEffect(() => { useEffect(() => {
if (currentRef) { if (currentRef) {
currentRef.current = { currentRef.current = {
setVisible, setVisible,
visible, visible,
rowSelectionCtl rowSelectionCtl
} }
} }
}, []) }, [])
const handleConfirm = async () => { const handleConfirm = async () => {
const item = rowSelectionCtl.selectRow[0] const item = rowSelectionCtl.selectRow[0]
confirmModal && confirmModal() confirmModal && confirmModal()
setVisible(false) setVisible(false)
} }
return ( return (
<ModalTable <ModalTable
modalTitle='选择合并订单' modalTitle='选择合并订单'
columns={mergeOrderColumns} columns={mergeOrderColumns}
visible={visible} visible={visible}
confirm={handleConfirm} confirm={handleConfirm}
cancel={() => setVisible(false)} cancel={() => setVisible(false)}
fetchTableData={(params) => fetchOrderApi.getQuotationList(params)} fetchTableData={(params) => fetchOrderApi.getMergeOrderList(params)}
rowSelection={rowSelection} rowSelection={rowSelection}
modalType='MergeOrderByDefault' modalType='MergeOrderByDefault'
tableProps={{ tableProps={{
rowKey: 'id' rowKey: 'id'
}} }}
{...restProps} {...restProps}
/> />
) )
} }
MergeOrderModalTable.defaultProps = {} MergeOrderModalTable.defaultProps = {}
export default MergeOrderModalTable export default MergeOrderModalTable
\ No newline at end of file
...@@ -33,6 +33,7 @@ import AuditProcess from '@/components/AuditProcess' ...@@ -33,6 +33,7 @@ import AuditProcess from '@/components/AuditProcess'
import styles from './index.less' import styles from './index.less'
import SimpleElectronModal from './components/simpleElectronModal' import SimpleElectronModal from './components/simpleElectronModal'
import { fetchOrderApi } from './apis' import { fetchOrderApi } from './apis'
import MergeOrderModalTable from './components/mergeOrderModalTable'
export interface PurchaseOrderDetailProps {} export interface PurchaseOrderDetailProps {}
...@@ -126,6 +127,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -126,6 +127,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const inquiryRef = useRef<any>({}) const inquiryRef = useRef<any>({})
const demandRef = useRef<any>({}) const demandRef = useRef<any>({})
const contractRef = useRef<any>({}) const contractRef = useRef<any>({})
const mergeRef = useRef<any>({})
const [formLoading, setFormLoading] = useState(false) const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false) const [btnLoading, setBtnLoading] = useState(false)
const update = useUpdate() const update = useUpdate()
...@@ -154,7 +156,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -154,7 +156,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
addSchemaAction.getFieldValue('supplyMembersRoleId'), addSchemaAction.getFieldValue('supplyMembersRoleId'),
pageStatus === PageStatus.ADD ? addSchemaAction.getFieldValue('orderProductRequests') : initFormValue.orderProductRequests pageStatus === PageStatus.ADD ? addSchemaAction.getFieldValue('orderProductRequests') : initFormValue.orderProductRequests
) )
const { productAddButton, productRef, productColumns, productComponents, ...sectionProps } = useProductTable(addSchemaAction) const { productAddButton, productRef, productColumns, productComponents, ...sectionProps } = useProductTable(addSchemaAction, mergeRef)
let timerSignature = null let timerSignature = null
// 页面进入时, 当前所处的下单模式 // 页面进入时, 当前所处的下单模式
...@@ -542,31 +544,33 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -542,31 +544,33 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// 商品信息的改动 驱动支付信息变化 // 商品信息的改动 驱动支付信息变化
useProductTableChangeForPay(ctx, update) useProductTableChangeForPay(ctx, update)
//编辑 地址和发票信息变动 触发订单更新 // 编辑 地址和发票信息变动 触发订单更新
useOrderUpdateChangeOther(ctx) useOrderUpdateChangeOther(ctx)
// address初始下只有id change后为object
// $('onFieldValueChange', 'NO_SUBMIT_TABS.*.*.*(theInvoiceId, needTheInvoice, deliveryAddresId)').subscribe(state => { // 合并订单模式下 只选择供应会员 出现选择商品按钮
// const { value, path } = state $('onFieldValueChange', 'supplyMembersName').subscribe(state => {
// if(pageStatus === PageStatus.EDIT){ const quotationOrderValue = ctx.getFieldValue('quotationNo')
// if(state?.dataSource?.length && state.loading) { const modelType = ctx.getFieldValue('orderModel')
// ctx.submit((values) => { if(state.value && !quotationOrderValue && modelType === 9) {
// console.log(value, path) addSchemaAction.setFieldState('orderProductRequests', productState => {
// if(values){ productState.props["x-component-props"] = {
// PublicApi.postOrderProcurementOrderUpdate({ ...productState.props["x-component-props"],
// ...values, prefix: productAddButton,
// deliveryTime: moment(values.deliveryTime).valueOf(), }
// theInvoiceId: value.id, })
// needTheInvoice: Number(values.needTheInvoice), }
// deliveryAddresId: path.indexOf("deliveryAddresId") !== -1 ? ( value?.id ? value.id : value ) : values.deliveryAddresId, })
// id, $('onFieldValueChange', 'quotationNo').subscribe(state => {
// }, { ctlType: "none" }) const modelType = ctx.getFieldValue('orderModel')
// } if(state.value && modelType === 9) {
// }) addSchemaAction.setFieldState('orderProductRequests', productState => {
// } else { productState.props["x-component-props"] = {
// ctx.setFieldState(path, _state => _state.loading = true) ...productState.props["x-component-props"],
// } prefix: "",
// } }
// }) })
}
})
}} }}
expressionScope={{ expressionScope={{
...@@ -598,6 +602,9 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -598,6 +602,9 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
{/* 简单流程签合同弹窗 */} {/* 简单流程签合同弹窗 */}
<SimpleElectronModal currentRef={contractRef} schemaAction={addSchemaAction}/> <SimpleElectronModal currentRef={contractRef} schemaAction={addSchemaAction}/>
{/* 选择待合并订单弹窗 */}
<MergeOrderModalTable currentRef={mergeRef} schemaAction={addSchemaAction} />
</ReadyAddOrderDetailContext.Provider> </ReadyAddOrderDetailContext.Provider>
</PageHeaderWrapper> </PageHeaderWrapper>
) )
......
...@@ -53,7 +53,12 @@ export const getUnitPriceTotal = (record) => { ...@@ -53,7 +53,12 @@ export const getUnitPriceTotal = (record) => {
return Number((unitPrice * purchaseCount).toFixed(2)) return Number((unitPrice * purchaseCount).toFixed(2))
} }
} }
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
/**
* @param ctx schemaAction
* @param mergeRef 操作合并订单的ref
*/
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, mergeRef: any) => {
const productRef = useRef<any>({}) const productRef = useRef<any>({})
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox'}) const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox'})
const { pageStatus } = usePageStatus() const { pageStatus } = usePageStatus()
...@@ -84,9 +89,13 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction ...@@ -84,9 +89,13 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const [productColumns, setProductColumns] = useState(() => { const [productColumns, setProductColumns] = useState(() => {
if (pageStatus === PageStatus.ADD) { if (pageStatus === PageStatus.ADD) {
productInfoColumns[productInfoColumns.length - 1].render = (text, record) => { productInfoColumns[productInfoColumns.length - 1].render = (text, record) => {
const orderModel = ctx.getFieldValue('orderModel')
return <> return <>
{
// 合并下单
orderModel === 9 && <Button type='link' onClick={() => mergeRef.current.setVisible(true)}>选择合并订单</Button>
}
<Button type='link' onClick={() => handleDelete(record)}>删除</Button> <Button type='link' onClick={() => handleDelete(record)}>删除</Button>
{/* <Button type='link'>选择合并订单</Button> */}
</> </>
} }
} else { } else {
......
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