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

fix: 请购单修改

parent 66c3f0db
import React, { useContext, useRef, useState } from 'react'
import React, { useCallback, useContext, useRef, useState } from 'react'
import { Tabs, Table, Button } from 'antd'
import StatusColors from '@/pages/transaction/components/statusColors'
import { formatTimeString } from '@/utils'
......@@ -8,9 +8,15 @@ import NestTable from '@/components/NestTable'
import { DeliverySideState, OrderKindType } from '@/constants/order'
import { PublicApi } from '@/services/api'
import { history } from 'umi'
import ModalForm from '@/components/ModalForm'
import { createFormActions } from '@formily/antd'
import { getAuth } from '@/utils/auth'
import { UPLOAD_TYPE } from '@/constants'
export interface OrderDeleveRecordProps {}
const receiveActions = createFormActions()
// 订单发货记录
const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
......@@ -22,7 +28,10 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
const isReturn = pathname.indexOf('readyConfirmReturnOrder') !== -1
// 用于储存已经修改过的订单id
const dataRef = useRef<any>([])
const receiveRef = useRef<any>({})
const [disabled, setDisabled] = useState<boolean>(false)
const [loading, setLoading] = useState<boolean>(false)
const { token } = getAuth() || {}
const { data, reloadFormData } = useContext(OrderDetailContext)
const { deliveries, deliveryDetails, orderMode, orderKind } = data
......@@ -204,8 +213,6 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
},
]
const sideChildrenCols: any[] = [
{
title: '商品ID',
......@@ -399,20 +406,44 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
// 确认收货
const handleConfirm = async (record) => {
const params = {
orderId: data.orderId,
batchNo: record.batchNo
}
// const params = {
// orderId: data.orderId,
// batchNo: record.batchNo
// }
setDisabled(true)
const { code } = await PublicApi.postOrderBuyerValidateReceiveConfirm(params)
if (code === 1000) {
dataRef.current.push(record.id)
// const { code } = await PublicApi.postOrderBuyerValidateReceiveConfirm(params)
// if (code === 1000) {
// dataRef.current.push(record.id)
// reloadFormData && reloadFormData()
// setDisabled(false)
// } else {
// setDisabled(false)
// }
receiveActions.setFieldValue('orderId', data.orderId)
receiveActions.setFieldValue('batchNo', record.batchNo)
receiveRef.current.setVisible(true)
}
// 提交凭证
const handleSubmit = useCallback(() => {
setLoading(true)
receiveActions.submit().then(async ({values}: any) => {
const result = await PublicApi.postOrderBuyerValidateReceiveConfirm(values)
if (result.code === 1000) {
receiveActions.reset()
setLoading(false)
receiveRef.current.setVisible(false)
setTimeout(() => {
reloadFormData && reloadFormData()
setDisabled(false)
}, 800)
} else {
setLoading(false)
setDisabled(false)
}
}
})
}, [])
// 确认回单
const handleReturn = async (record) => {
......@@ -460,6 +491,50 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
</Tabs>
</MellowCard>
}
<ModalForm
modalTitle='确认收货'
currentRef={receiveRef}
confirm={handleSubmit}
actions={receiveActions}
schema={{
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelAlign: 'top',
},
properties: {
orderId: {
type: 'number',
title: '当前id',
visible: false,
},
batchNo: {
type: 'number',
title: '收货批次',
visible: false,
},
url: {
title: '收货回单',
'x-component': 'Upload',
'x-component-props': {
listType: 'text',
maxCount: 1,
action: "/api/file/file/upload",
data: { fileType: UPLOAD_TYPE },
headers: {
token
}
}
}
}
}
}
}}
modalProps={{confirmLoading: loading}}
/>
</>
)
}
......
......@@ -41,8 +41,8 @@ export const procurmentRenderInit = (initValue: any) => {
digest: initValue.digest,
deliverDate: initValue.consignee.deliverDate,
theInvoiceId: initValue.invoice?.invoiceId || null,
requisitionNo: initValue.requisitionNo,
requisitionId: initValue.requisitionId,
requisitionNo: initValue.quoteNo,
requisitionId: initValue.quoteId,
}
}
......
......@@ -64,10 +64,10 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
<div>合计金额</div>
<div>{`¥${sum.toFixed(2)}`}</div>
</Col>
<Col span={2}>
{/* <Col span={2}>
<div>总计金额</div>
<div>{`¥${(sum + freePrice).toFixed(2)}`}</div>
</Col>
</Col> */}
</RowStyle>
})
......@@ -126,7 +126,7 @@ const AddRequisitionOrder:React.FC<AddRequisitionOrderProps> = (props) => {
}, [])
const getJumpQuoteProducts = async () => {
// 查询询价单详情
// 查询请购单详情
const { code, data: requisitionData } = await PublicApi.getPurchaseRequisitionTransferPurchaseDetail({ id: requisitionId })
if(code === 1000) {
const {
......
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