Commit 5e3339df authored by 前端-许佳敏's avatar 前端-许佳敏

feat:手工下单收货

parent 9ba75b1d
......@@ -614,7 +614,12 @@ export enum PurchaseOrderInsideWorkState {
/**
* 待审核入库订单
*/
READY_WAREHOUSE_APPROVED_ORDER
READY_WAREHOUSE_APPROVED_ORDER,
/**
* 手工收货
*/
HAND_RECEIPT_ORDER
}
// 销售订单内部工作流状态
......@@ -707,7 +712,12 @@ export enum SaleOrderInsideWorkState {
/**
* 待审核物流单(新增物流单成功)
*/
DELIVERY_APPROVED_SUCCESS
DELIVERY_APPROVED_SUCCESS,
/**
* 手工发货
*/
HAND_DELEVED_ORDER,
}
// 支付外部状态
......@@ -788,7 +798,8 @@ export const PurchaseOrderInsideWorkStateTexts = {
12: '确认收货',
14: '订单入库',
15: '订单归档',
16: '订单入库待审核'
16: '订单入库待审核',
17: '手工收货'
}
// 销售订单内部显示文案
......@@ -812,7 +823,8 @@ export const SaleOrderInsideWorkStateTexts = {
23: '确认回单',
24: '订单归档',
25: '待审核发货单',
26: '待审核物流单'
26: '待审核物流单',
27: '手工发货'
}
export const PayOutWorkStateTexts = {
......
......@@ -13,7 +13,7 @@ export interface OrderMergeInfoProps { }
const payInfo = [
{ title: '交付日期', name: 'deliveryTime', render: (text) => formatTimeString(text) },
{
title: '交付地址', name: 'deliveryAddresId', render: (_, record) =>
title: '交付地址', name: 'deliveryAddressInfo', render: (_, record) =>
<div>
<Row>
<Col>{record.receiverName}</Col>
......@@ -60,10 +60,6 @@ const RenderCard = ({ infoList, dataSource }) => infoList.map(v => dataSource[v.
const OrderMergeInfo: React.FC<OrderMergeInfoProps> = (props) => {
const orderDetailCtx = useContext(OrderDetailContext)
const address = useMemo(async () => {
const { data } = await PublicApi.getLogisticsSelectListReceiverAddress()
return data
}, [])
const { data, ctl } = orderDetailCtx
return (
......
import React, { useState, useEffect, useContext, useRef, useCallback } from 'react'
import OrderDetailHeader from '../../components/OrderDetailHeader'
import { Button, Row, Col, message } from 'antd'
import { Button, Row, Col, message, Modal } from 'antd'
import { Link, history } from 'umi'
import { orderTypeLabel, SALE_ORDER_STATUS, PURCHASE_ORDER_STATUS } from './constant'
import { formatTimeString } from '@/utils'
......@@ -22,6 +22,7 @@ import OrderPayModal from './components/orderPayModal'
import OrderDeleveRecord from './components/orderDeleveRecord'
import { PurchaseOrderInsideWorkState } from '@/constants'
import OrderElectronModal from './components/orderElectronModal'
import moment from 'moment'
export interface CommonOrderDetailProps { }
......@@ -33,6 +34,8 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
const [btnLoading, setBtnLoading] = useState<boolean>(false)
const [formData, setFormData] = useState<any>(null)
const [payList, setPaylist] = useState<any[]>([])
// 手工收货时出现的弹窗
const [confirmVisible, setConfirmVisible] = useState(false)
let { id, pageStatus, page_type = PURCHASE_ORDER_STATUS.PREVIEW_ORDER } = usePageStatus()
page_type = parseInt(page_type)
......@@ -145,6 +148,12 @@ 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) {
// 确认手工收货
if (formData.interiorState === PurchaseOrderInsideWorkState.HAND_RECEIPT_ORDER) {
setConfirmVisible(true)
return ;
}
handleSubmit({})
setBtnLoading(true)
return ;
......@@ -159,6 +168,8 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
payRef.current.setVisible(true)
}
// 确认电子合同
if (page_type === PURCHASE_ORDER_STATUS.READY_CONFIRM_ELECTRON_ORDER) {
if (!formData.electronicContractUrl) {
......@@ -175,24 +186,29 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
return null
}
let text = ''
switch (page_type) {
case PURCHASE_ORDER_STATUS.READY_CONFIRM_ELECTRON_ORDER: {
switch (formData.interiorState) {
case PurchaseOrderInsideWorkState.SUBMIT_FINISH_ORDER: {
text = '确认电子合同'
break;
}
case PURCHASE_ORDER_STATUS.READY_PAY_ORDER: {
case PurchaseOrderInsideWorkState.CONFIRM_ELECTRONIC: {
text = '去支付'
break;
}
case PURCHASE_ORDER_STATUS.READY_DELEVED_ORDER: {
case PurchaseOrderInsideWorkState.CONFIRM_RECEIPT: {
text = '去确认收货'
break;
}
case PURCHASE_ORDER_STATUS.READY_RETURN_DOCUMENT: {
case PurchaseOrderInsideWorkState.FILLING_ORDER: {
text = '确认归档'
break
}
case PurchaseOrderInsideWorkState.HAND_RECEIPT_ORDER: {
text = '确认手工收货'
break
}
default: {
text = '提交审核'
break;
......@@ -233,6 +249,16 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
approvedActions.submit()
}
const handleConfirm = async () => {
console.log('确认收货')
const { code } = await PublicApi.postOrderManualConfirmReceipt({
orderId: formData.id
})
if (code === 1000) {
history.goBack()
}
}
const editableProductTable = pageStatus !== PageStatus.PREVIEW
return formData ? (
<div>
......@@ -328,6 +354,36 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
<OrderElectronModal
currentRef={electronRef}
/>
<Modal
title='收货信息'
onOk={handleConfirm}
onCancel={() => setConfirmVisible(false)}
visible={confirmVisible}
>
{
formData &&
<>
<Row>
<Col span={6}>发货地址: </Col>
<Col>{formData.name}</Col>
</Row>
<Row>
<Col span={6}>发货时间: </Col>
<Col>{moment(formData.deliverTime).format('YYYY-MM-DD')}</Col>
</Row>
<Row>
<Col span={6}>物流单号: </Col>
<Col>{formData.deliverNo}</Col>
</Row>
<Row>
<Col span={6}>物流公司: </Col>
<Col>{formData.logisticsCompany}</Col>
</Row>
</>
}
</Modal>
</OrderDetailContext.Provider>
</div>
) : null
......
......@@ -91,7 +91,7 @@ export const useSelfTable = () => {
key: 'ctl',
render: (text, record) => <>
{/* 支付结果确认到账= 待审核状态 */}
{ record.interiorState === PurchaseOrderInsideWorkState.CONFIRM_RECEIPT &&
{ (record.interiorState === PurchaseOrderInsideWorkState.CONFIRM_RECEIPT || record.interiorState === PurchaseOrderInsideWorkState.HAND_RECEIPT_ORDER) &&
<Button type='link' onClick={() => handleConfirm(record)}>确认收货</Button>
}
</>
......
import React, { useContext, useRef, useEffect } from 'react'
import { Modal, Button } from 'antd'
import NiceForm from '@/components/NiceForm'
import { createFormActions, ISchema } from '@formily/antd'
import ModalForm from '@/components/ModalForm'
import { history } from 'umi'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { PublicApi } from '@/services/api'
import { useHttpRequest } from '@/hooks/useHttpRequest'
import { OrderDetailContext } from '../../context'
import moment from 'moment'
export interface OrderHandDeleveModalProps {
currentRef: any
}
const schemaActions = createFormActions()
const schema: ISchema = {
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": "mega-layout",
"x-component-props": {
labelAlign: 'left',
labelCol: 6
},
properties: {
addresId: {
type: 'string',
enum: [],
title: '发货地址',
"x-rules": [
{
message: '请选择发货地址',
required: true
}
]
},
deliverTime: {
type: 'string',
"x-component": 'date',
title: '发货日期',
"x-rules": [
{
message: '请选择发货日期',
required: true
}
],
"x-mega-props": {
full: true
}
},
deliverNo: {
type: 'string',
title: '发货单号',
"x-rules": [
{
required: true,
message: '请输入发货单号'
},
{
limitByte: true,
maxByte: 20
},
]
},
logisticsCompanyId: {
type: 'string',
enum: [],
title: '物流公司',
"x-rules": [
{
message: '请选择物流公司',
required: true
}
]
},
name: {
type: 'string',
display: false
},
logisticsCompany: {
type: 'string',
display: false
}
}
}
}
}
const OrderHandDeleveModal:React.FC<OrderHandDeleveModalProps> = (props) => {
const { data } = useContext(OrderDetailContext)
const dataRef = useRef<any>({})
const handleSubmit = async (value) => {
const params = {
...value,
orderId: data.id,
deliverTime: moment(value.deliverTime).valueOf()
}
const { code } = await PublicApi.postOrderManualDelivery(params)
if (code === 1000) {
history.goBack()
}
}
const handleConfirm = () => {
schemaActions.submit()
}
return (
<ModalForm
modalTitle='手工发货'
previewPlaceholder=' '
currentRef={props.currentRef}
schema={schema}
actions={schemaActions}
onSubmit={handleSubmit}
confirm={handleConfirm}
initialValues={{
deliverTime: moment().format('YYYY-MM-DD')
}}
effects={($, actions) => {
useAsyncSelect('addresId', async () => (await PublicApi.getLogisticsSelectListShipperAddress()).data, ['fullAddress', 'id'])
useAsyncSelect('logisticsCompanyId', async () => (await PublicApi.getLogisticsSelectListCompany()).data, ['name', 'id'])
// 获取联动的select后续事件, 为了设置对应的name值
$('requestAsyncSelect').subscribe(({ name, payload }) => {
if (name === 'addresId') {
dataRef.current.addresId = payload
}
if (name === 'logisticsCompanyId') {
dataRef.current.logisticsCompanyId = payload
}
})
$('onFieldInputChange', 'addresId').subscribe(({value}) => {
actions.setFieldValue('name', dataRef.current.addresId.find(v => v.value === value)?.label || '')
})
$('onFieldInputChange', 'logisticsCompanyId').subscribe(({value}) => {
actions.setFieldValue('logisticsCompany', dataRef.current.logisticsCompanyId.find(v => v.value === value)?.label || '')
})
}}
/>
)
}
OrderHandDeleveModal.defaultProps = {}
export default OrderHandDeleveModal
\ No newline at end of file
......@@ -23,6 +23,7 @@ import OrderDeleveRecord from './components/orderDeleveRecord'
import OrderElectronModal from './components/orderElectronModal'
import ModalForm from '@/components/ModalForm'
import { createFormActions } from '@formily/antd'
import OrderHandDeleveModal from './components/orderHandDeleve'
export interface CommonOrderDetailProps {}
......@@ -37,6 +38,7 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
page_type = Number(page_type)
const payResultVisible = useRef<any>({})
const electronRef = useRef<any>({})
const handDelevedRef = useRef<any>({})
const [payResultType, setPayResultType] = useState<'default' | 'preview'>('default')
useEffect(() => {
reloadFormData()
......@@ -169,6 +171,12 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
return
}
// 手工发货,需弹窗确认
if (formData.purchaseOrderInteriorState === SaleOrderInsideWorkState.HAND_DELEVED_ORDER) {
handDelevedRef.current.setVisible(true)
return ;
}
// 一级审核, 二级审核, 确认订单 都需要通过弹窗确认后再提交
if (page_type === SALE_ORDER_STATUS.ONE_LEVEL_APPROVED_ORDER || page_type === SALE_ORDER_STATUS.TWO_LEVEL_APPROVED_ORDER || page_type === SALE_ORDER_STATUS.CONFIRM_ORDER) {
approvedRef.current.setVisible(true)
......@@ -205,6 +213,11 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
text = '确认归档'
break
}
case SaleOrderInsideWorkState.HAND_DELEVED_ORDER: {
text = '确认手工发货'
break
}
default: {
text = '提交审核'
break;
......@@ -229,7 +242,6 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
titleValue: formData.orderNo
} : null
console.log('123')
return formData ? (
<div>
<OrderDetailContext.Provider value={formContext}>
......@@ -265,6 +277,9 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
<OrderElectronModal
currentRef={electronRef}
/>
<OrderHandDeleveModal
currentRef={handDelevedRef}
/>
<OrderPayResultModal currentRef={payResultVisible} type={payResultType}/>
{/* 提交时触发的弹窗集合 */}
......
......@@ -91,7 +91,7 @@ export const useSelfTable = () => {
key: 'ctl',
render: (text, record) => <>
{/* 支付结果确认到账= 待审核状态 */}
{ record.purchaseOrderInteriorState === SaleOrderInsideWorkState.CONFIRM_DELIVERY_ORDER &&
{ (record.purchaseOrderInteriorState === SaleOrderInsideWorkState.CONFIRM_DELIVERY_ORDER || record.purchaseOrderInteriorState === SaleOrderInsideWorkState.HAND_DELEVED_ORDER) &&
<Button type='link' onClick={() => handleConfirm(record)}>确认发货</Button>
}
</>
......
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