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

fix:

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