Commit 852f5cfb authored by 前端-许佳敏's avatar 前端-许佳敏

修复订单流程

parent 158b6bbd
......@@ -27,9 +27,10 @@ const NestTable:React.FC<NestTableProps> = (props) => {
const childRenderTable = useCallback((record) => {
return <Table
columns={childColumns}
dataSource={dataSource[childrenDataKey] || []}
dataSource={record[childrenDataKey] || []}
rowKey='id'
/>
}, [childColumns, dataSource])
}, [childColumns, childrenDataKey])
return (
<Table
......@@ -39,9 +40,9 @@ const NestTable:React.FC<NestTableProps> = (props) => {
expandedRowRender: childRenderTable,
expandIcon: ({ expanded, onExpand, record }) =>
expanded ? (
<CaretRightOutlined onClick={e => onExpand(record, e)} />
) : (
<CaretDownOutlined onClick={e => onExpand(record, e)} />
) : (
<CaretRightOutlined onClick={e => onExpand(record, e)} />
)
}}
pagination={false}
......
......@@ -726,7 +726,7 @@ export enum DeliverySideState {
ADD_SALE_INVOICE_ORDER = 1,
/**
* 新增物流单
* 订单待发货(物流单审核通过)
*/
ADD_LOGISTICS_ORDER,
......@@ -736,17 +736,17 @@ export enum DeliverySideState {
CONFIRM_DELIVERY_ORDER,
/**
* 新增采购入库
* 待收货订
*/
WAREHOUSE_ORDER,
/**
* 确认订单收货
* 确认订单收货(待回单订单)
*/
CONFIRM_RECEIPT_ORDER,
/**
* 待确认回
* 已回单订
*/
CONFIRM_RETURN_ORDER
}
......@@ -822,12 +822,12 @@ export const PayOutWorkStateTexts = {
4: '确认未到账'
}
// 发货内部状态文案
// 收货/发货内部状态文案
export const DeliverySideStateTexts = {
1: '新增销售发货单',
2: '新增物流单',
3: '订单发货确认',
4: '新增采购入库单',
5: '确认订单收货',
6: '待确认回单',
2: '待确认发货订单',
3: '待新增入库单', // 采购-新增入库单
4: '待确认收货订单',
5: '待回单订单',
6: '回单',
}
......@@ -39,7 +39,7 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => {
if (item.children) {
return (
<SubMenu
key={item.key}
key={item.key || item.path}
title={item.name}
>
{getMenus(item.children, true)}
......
......@@ -110,6 +110,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const inquiryRef = useRef<any>({})
const demandRef = useRef<any>({})
const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false)
const update = useUpdate()
const [productSumPrice, setProductSumPrice] = useState<number>(0)
const [initFormValue, setInitFormValue] = useState<any>(null)
......@@ -165,58 +166,17 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
theInvoiceId: value.theInvoiceId ? value.theInvoiceId.id : undefined,
theInvoiceInfo: value.theInvoiceId || null
}
setBtnLoading(true)
fnResult = id ? await PublicApi.postOrderProcurementOrderUpdate({...params, id}) : await PublicApi.postOrderProcurementOrderAddReinsurancePolicy(params)
break;
}
case '1': {
// 一级审核提交
const params = {
id: Number(id),
state: value.state,
cause: value.cause
}
fnResult = await PublicApi.postOrderProcurementOrderReviewed(params)
break;
}
case '2': {
// 二级审核提交
const params = {
id: Number(id),
state: value.state,
cause: value.cause
}
fnResult = await PublicApi.postOrderProcurementOrderReviewedTwo(params)
break;
}
case '3': {
// 提交订单
const params = {
id: Number(id)
}
//@ts-ignore
fnResult = await PublicApi.postOrderProcurementOrderSubmit(params)
break;
}
case '4': {
// 确认电子合同
const params = {
id: Number(id)
}
fnResult = await PublicApi.postOrderElectronicContractsAffirm(params)
break;
}
case '5': {
// 订单支付
break;
}
}
if (fnResult.code === 1000) {
history.goBack()
}
setBtnLoading(false)
} catch (error) {
setBtnLoading(false)
console.log(error)
}
}
......@@ -288,7 +248,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
backIcon={<ReutrnEle description="返回"/>}
title={changeRouterTitleByStatus()}
extra={[
<Button key="1" onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
<Button key="1" onClick={() => addSchemaAction.submit()} loading={btnLoading} type="primary" icon={<SaveOutlined />}>
保存
</Button>,
]}
......
......@@ -5,7 +5,7 @@ import { formatTimeString } from '@/utils'
import { OrderDetailContext } from '../../context'
import MellowCard from '@/components/MellowCard'
import NestTable from '@/components/NestTable'
import { SaleOrderInsideWorkState } from '@/constants'
import { SaleOrderInsideWorkState, DeliverySideState } from '@/constants'
import { PublicApi } from '@/services/api'
export interface OrderDeleveRecordProps {}
......@@ -151,7 +151,7 @@ const sideChildrenCols: any[] = [
]
// 订单发货记录
const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
const { data } = useContext(OrderDetailContext)
const { data, reloadFormData } = useContext(OrderDetailContext)
const { orderReceivingStatisticsResponses, orderDeliveryDetailsResponses } = data
const sideOrderCols: any[] = [
{
......@@ -212,8 +212,8 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
key: 'ctl',
render: (text, record) => <>
{/* todo 需根据内部状态判断显示哪个按钮 */}
{ data.purchaseOrderInteriorState === SaleOrderInsideWorkState.CONFIRM_RECEIPT && <Button type='link' onClick={() => handleReturn(record)}>确认回单</Button> }
{ data.purchaseOrderInteriorState === SaleOrderInsideWorkState.CONFIRM_DELIVERY_ORDER && <Button type='link' onClick={() => handleConfirm(record)}>确认收货</Button> }
{ 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> }
</>
},
]
......@@ -226,6 +226,7 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
}
await PublicApi.postOrderConfirmReceipt(params)
reloadFormData && reloadFormData()
}
// 确认回单
......@@ -236,10 +237,12 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
}
await PublicApi.postOrderReceiptOrderConfirmed(params)
reloadFormData && reloadFormData()
}
return (
<MellowCard style={{marginTop: 24}} bordered={false}>
<Tabs defaultActiveKey="1" animated={false}>
<MellowCard style={{marginTop: 24}} bordered={false} id='deleveBox'>
<Tabs defaultActiveKey="2" animated={false}>
<Tabs.TabPane tab='订单收货统计' key="1">
<Table
columns={outOrderCols}
......
......@@ -67,35 +67,35 @@
}
}
:global {
span.ant-radio + * {
display: block;
width: 100%;
}
// :global {
// span.ant-radio + * {
// display: block;
// width: 100%;
// }
.ant-radio-wrapper {
display: flex;
width: 100%;
align-items: center;
height: 72px;
background-color: #fafafa;
margin: 10px;
padding-left: 16px;
}
// .ant-radio-wrapper {
// display: flex;
// width: 100%;
// align-items: center;
// height: 72px;
// background-color: #fafafa;
// margin: 10px;
// padding-left: 16px;
// }
.ant-radio-wrapper.ant-radio-wrapper-checked {
border: 1px solid @main-color;
// .ant-radio-wrapper.ant-radio-wrapper-checked {
// border: 1px solid @main-color;
&::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-bottom: 12px solid @main-color;
border-left: 12px solid transparent;
bottom: 0;
right: 0;
z-index: 5;
}
}
}
// &::after {
// content: '';
// position: absolute;
// width: 0;
// height: 0;
// border-bottom: 12px solid @main-color;
// border-left: 12px solid transparent;
// bottom: 0;
// right: 0;
// z-index: 5;
// }
// }
// }
......@@ -40,13 +40,8 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
const payRef = useRef<any>({})
const electronRef = useRef<any>({})
useEffect(() => {
reloadFormData()
if (id) {
PublicApi.getOrderProcurementOrderDetails({ id }).then(({ data, code }) => {
if (code === 1000) {
setFormData(data)
}
})
PublicApi.getPayPayWayList().then(res => {
const { code, data } = res
if (code === 1000) {
......@@ -56,20 +51,30 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
}
}, [])
const reloadFormData = () => {
if (id) {
PublicApi.getOrderProcurementOrderDetails({ id }).then(({ data, code }) => {
if (code === 1000) {
setFormData(data)
}
})
}
}
const formContext = {
preview: pageStatus === PageStatus.PREVIEW,
data: formData,
payList,
ctl: {
setData: setFormData
}
},
reloadFormData
}
const handleSubmit = async (values) => {
let result: any = {}
const caseData = typeof page_type === 'string' ? parseInt(page_type) : page_type
setBtnLoading(true)
switch (caseData) {
case PURCHASE_ORDER_STATUS.ONE_LEVEL_APPROVED_ORDER: {
const params = {
......@@ -122,15 +127,12 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
break;
}
// 确认收货
// case PURCHASE_ORDER_STATUS.READY_DELEVED_ORDER: {
// const params = {
// id: parseInt(id),
// state: 1
// }
// result = await PublicApi.postOrderConfirmedPaymentResultsOrder(params)
// break;
// }
//确认收货
case PURCHASE_ORDER_STATUS.READY_DELEVED_ORDER: {
const deleveBox = document.querySelector('#deleveBox') as any
window.scrollTo(0, deleveBox.offsetTop)
break;
}
}
if (result.code === 1000) {
......@@ -141,17 +143,18 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
}
const handleStartApply = () => {
// 无需弹窗, 直接提交
if (page_type === PURCHASE_ORDER_STATUS.READY_SUBMIT_ORDER || page_type === PURCHASE_ORDER_STATUS.READY_DELEVED_ORDER || page_type === PURCHASE_ORDER_STATUS.READY_RETURN_DOCUMENT) {
handleSubmit({})
setBtnLoading(true)
return ;
}
if (page_type === PURCHASE_ORDER_STATUS.ONE_LEVEL_APPROVED_ORDER ||
page_type === PURCHASE_ORDER_STATUS.TWO_LEVEL_APPROVED_ORDER
) {
approvedRef.current.setVisible(true)
}
// 提交订单状态时 无需用户选择
if (page_type === PURCHASE_ORDER_STATUS.READY_SUBMIT_ORDER) {
handleSubmit({})
}
if (page_type === PURCHASE_ORDER_STATUS.READY_PAY_ORDER) {
payRef.current.setVisible(true)
}
......@@ -164,10 +167,6 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
}
electronRef.current.setVisible(true)
}
if (page_type === PURCHASE_ORDER_STATUS.READY_RETURN_DOCUMENT) {
handleSubmit({})
}
}
......@@ -185,6 +184,15 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
text = '去支付'
break;
}
case PURCHASE_ORDER_STATUS.READY_DELEVED_ORDER: {
text = '去确认收货'
break;
}
case PURCHASE_ORDER_STATUS.READY_RETURN_DOCUMENT: {
text = '确认归档'
break
}
default: {
text = '提交审核'
break;
......
......@@ -5,7 +5,7 @@ import { formatTimeString } from '@/utils'
import { OrderDetailContext } from '../../context'
import MellowCard from '@/components/MellowCard'
import NestTable from '@/components/NestTable'
import { SaleOrderInsideWorkState } from '@/constants'
import { SaleOrderInsideWorkState, DeliverySideState } from '@/constants'
import { PublicApi } from '@/services/api'
export interface OrderDeleveRecordProps {}
......@@ -151,7 +151,7 @@ const sideChildrenCols: any[] = [
]
// 订单发货记录
const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
const { data } = useContext(OrderDetailContext)
const { data, reloadFormData } = useContext(OrderDetailContext)
const { orderReceivingStatisticsResponses, orderDeliveryDetailsResponses } = data
const sideOrderCols: any[] = [
{
......@@ -211,9 +211,8 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
align: 'center',
key: 'ctl',
render: (text, record) => <>
{/* todo 需根据内部状态判断显示哪个按钮 */}
{ data.purchaseOrderInteriorState === SaleOrderInsideWorkState.CONFIRM_RECEIPT && <Button type='link' onClick={() => handleReturn(record)}>确认回单</Button> }
{ data.purchaseOrderInteriorState === SaleOrderInsideWorkState.CONFIRM_DELIVERY_ORDER && <Button type='link' onClick={() => handleConfirm(record)}>确认发货</Button> }
{ record.interiorState === DeliverySideState.CONFIRM_RECEIPT_ORDER && <Button type='link' onClick={() => handleReturn(record)}>确认回单</Button> }
{ record.interiorState === DeliverySideState.ADD_LOGISTICS_ORDER && <Button type='link' onClick={() => handleConfirm(record)}>确认发货</Button> }
</>
},
]
......@@ -226,6 +225,7 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
}
await PublicApi.postOrderConfirmShipmentOrder(params)
reloadFormData && reloadFormData()
}
// 确认回单
......@@ -236,10 +236,11 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
}
await PublicApi.postOrderReceiptOrderConfirmed(params)
reloadFormData && reloadFormData()
}
return (
<MellowCard style={{marginTop: 24}} bordered={false}>
<Tabs defaultActiveKey="1" animated={false}>
<MellowCard style={{marginTop: 24}} bordered={false} id='deleveBox'>
<Tabs defaultActiveKey="2" animated={false}>
<Tabs.TabPane tab='订单发货统计' key="1">
<Table
columns={outOrderCols}
......
......@@ -71,35 +71,38 @@
}
}
:global {
span.ant-radio + * {
display: block;
width: 100%;
}
.ant-radio-wrapper {
display: flex;
width: 100%;
align-items: center;
height: 72px;
background-color: #fafafa;
margin: 10px;
padding-left: 16px;
}
.ant-radio-wrapper.ant-radio-wrapper-checked {
border: 1px solid @main-color;
&::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-bottom: 12px solid @main-color;
border-left: 12px solid transparent;
bottom: 0;
right: 0;
z-index: 5;
.sale_order_modal {
:global {
span.ant-radio + * {
display: block;
width: 100%;
}
.ant-radio-wrapper {
display: flex;
width: 100%;
align-items: center;
height: 72px;
background-color: #fafafa;
margin: 10px;
padding-left: 16px;
}
.ant-radio-wrapper.ant-radio-wrapper-checked {
border: 1px solid @main-color;
&::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-bottom: 12px solid @main-color;
border-left: 12px solid transparent;
bottom: 0;
right: 0;
z-index: 5;
}
}
}
}
}
\ No newline at end of file
......@@ -39,6 +39,10 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
const electronRef = useRef<any>({})
const [payResultType, setPayResultType] = useState<'default' | 'preview'>('default')
useEffect(() => {
reloadFormData()
}, [])
const reloadFormData = () => {
if (id) {
PublicApi.getOrderPurchaseOrderDetails({id}).then(({data, code}) => {
if (code === 1000) {
......@@ -46,7 +50,7 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
}
})
}
}, [])
}
const handleConfirmApproved = () => {
approvedActions.submit()
......@@ -57,6 +61,7 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
payResultType,
setPayResultType,
payResultVisible,
reloadFormData,
ctl: {
setData: setFormData
}
......@@ -115,12 +120,14 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
}
case SALE_ORDER_STATUS.CONFIRM_DELIVE_GOODS_ORDER: {
const params = {
orderId: parseInt(id),
// 订单发货明细id(发货单ID)
id: parseInt(orderDeliveryDetailsId)
}
result = await PublicApi.postOrderConfirmShipmentOrder(params)
// const params = {
// orderId: parseInt(id),
// // 订单发货明细id(发货单ID)
// id: parseInt(orderDeliveryDetailsId)
// }
// result = await PublicApi.postOrderConfirmShipmentOrder(params)
const deleveBox = document.querySelector('#deleveBox') as any
window.scrollTo(0, deleveBox.offsetTop)
break;
}
......@@ -171,7 +178,7 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
}
const renderExtra = () => {
if (!formData || page_type === SALE_ORDER_STATUS.PREVIEW_ORDER || page_type === SALE_ORDER_STATUS.CONFIRM_DELIVE_GOODS_ORDER) {
if (!formData || page_type === SALE_ORDER_STATUS.PREVIEW_ORDER) {
return null
}
let text = ''
......@@ -188,6 +195,16 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
text = '确认全部已回单'
break;
}
case SaleOrderInsideWorkState.CONFIRM_DELIVERY_ORDER: {
text = '去确认发货'
break;
}
case SaleOrderInsideWorkState.FILLING_ORDER: {
text = '确认归档'
break
}
default: {
text = '提交审核'
break;
......
......@@ -25,7 +25,7 @@ export const useSelfTable = () => {
render: (text, record) => <>
{
record.purchaseOrderInteriorState === SaleOrderInsideWorkState.FILLING_ORDER &&
<Button type='link' onClick={() => handleSubmit(record)}>提交审核</Button>
<Button type='link' onClick={() => handleSubmit(record)}>归档</Button>
}
</>
}
......
......@@ -39,6 +39,7 @@ const errorMessage: httpStatus = {
};
const errorHandler = (error: ResponseError): IRequestError => {
console.log(error)
const { response } = error
// http状态码非200的错误处理
const messageText = response?.status ? errorMessage[response.status] : ''
......
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