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 { Tabs, Table, Button } from 'antd'
import StatusColors from '@/pages/transaction/components/statusColors' import StatusColors from '@/pages/transaction/components/statusColors'
import { formatTimeString } from '@/utils' import { formatTimeString } from '@/utils'
...@@ -8,9 +8,15 @@ import NestTable from '@/components/NestTable' ...@@ -8,9 +8,15 @@ import NestTable from '@/components/NestTable'
import { DeliverySideState, OrderKindType } from '@/constants/order' import { DeliverySideState, OrderKindType } from '@/constants/order'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { history } from 'umi' 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 {} export interface OrderDeleveRecordProps {}
const receiveActions = createFormActions()
// 订单发货记录 // 订单发货记录
const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => { const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
...@@ -22,7 +28,10 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => { ...@@ -22,7 +28,10 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
const isReturn = pathname.indexOf('readyConfirmReturnOrder') !== -1 const isReturn = pathname.indexOf('readyConfirmReturnOrder') !== -1
// 用于储存已经修改过的订单id // 用于储存已经修改过的订单id
const dataRef = useRef<any>([]) const dataRef = useRef<any>([])
const receiveRef = useRef<any>({})
const [disabled, setDisabled] = useState<boolean>(false) const [disabled, setDisabled] = useState<boolean>(false)
const [loading, setLoading] = useState<boolean>(false)
const { token } = getAuth() || {}
const { data, reloadFormData } = useContext(OrderDetailContext) const { data, reloadFormData } = useContext(OrderDetailContext)
const { deliveries, deliveryDetails, orderMode, orderKind } = data const { deliveries, deliveryDetails, orderMode, orderKind } = data
...@@ -204,8 +213,6 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => { ...@@ -204,8 +213,6 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
}, },
] ]
const sideChildrenCols: any[] = [ const sideChildrenCols: any[] = [
{ {
title: '商品ID', title: '商品ID',
...@@ -399,21 +406,45 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => { ...@@ -399,21 +406,45 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
// 确认收货 // 确认收货
const handleConfirm = async (record) => { const handleConfirm = async (record) => {
const params = { // const params = {
orderId: data.orderId, // orderId: data.orderId,
batchNo: record.batchNo // batchNo: record.batchNo
} // }
setDisabled(true) setDisabled(true)
const { code } = await PublicApi.postOrderBuyerValidateReceiveConfirm(params) // const { code } = await PublicApi.postOrderBuyerValidateReceiveConfirm(params)
if (code === 1000) { // if (code === 1000) {
dataRef.current.push(record.id) // dataRef.current.push(record.id)
reloadFormData && reloadFormData() // reloadFormData && reloadFormData()
setDisabled(false) // setDisabled(false)
} else { // } else {
setDisabled(false) // 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) => { const handleReturn = async (record) => {
const params = { const params = {
...@@ -460,6 +491,50 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => { ...@@ -460,6 +491,50 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
</Tabs> </Tabs>
</MellowCard> </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) => { ...@@ -41,8 +41,8 @@ export const procurmentRenderInit = (initValue: any) => {
digest: initValue.digest, digest: initValue.digest,
deliverDate: initValue.consignee.deliverDate, deliverDate: initValue.consignee.deliverDate,
theInvoiceId: initValue.invoice?.invoiceId || null, theInvoiceId: initValue.invoice?.invoiceId || null,
requisitionNo: initValue.requisitionNo, requisitionNo: initValue.quoteNo,
requisitionId: initValue.requisitionId, requisitionId: initValue.quoteId,
} }
} }
......
...@@ -64,10 +64,10 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => { ...@@ -64,10 +64,10 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
<div>合计金额</div> <div>合计金额</div>
<div>{`¥${sum.toFixed(2)}`}</div> <div>{`¥${sum.toFixed(2)}`}</div>
</Col> </Col>
<Col span={2}> {/* <Col span={2}>
<div>总计金额</div> <div>总计金额</div>
<div>{`¥${(sum + freePrice).toFixed(2)}`}</div> <div>{`¥${(sum + freePrice).toFixed(2)}`}</div>
</Col> </Col> */}
</RowStyle> </RowStyle>
}) })
...@@ -126,7 +126,7 @@ const AddRequisitionOrder:React.FC<AddRequisitionOrderProps> = (props) => { ...@@ -126,7 +126,7 @@ const AddRequisitionOrder:React.FC<AddRequisitionOrderProps> = (props) => {
}, []) }, [])
const getJumpQuoteProducts = async () => { const getJumpQuoteProducts = async () => {
// 查询询价单详情 // 查询请购单详情
const { code, data: requisitionData } = await PublicApi.getPurchaseRequisitionTransferPurchaseDetail({ id: requisitionId }) const { code, data: requisitionData } = await PublicApi.getPurchaseRequisitionTransferPurchaseDetail({ id: requisitionId })
if(code === 1000) { if(code === 1000) {
const { 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