Commit a9045c0b authored by XieZhiXiong's avatar XieZhiXiong
parents d2f58f38 ee14f26e
......@@ -774,7 +774,7 @@ export const PurchaseOrderInsideWorkStateTexts = {
2: '一级审核订单',
3: '二级审核订单',
4: '提交订单',
5: '提交订单完成',
5: '待确认电子合同',
6: '提交一级审核订单不通过',
7: '提交二级审核订单不通过',
8: '确认电子合同',
......@@ -788,7 +788,7 @@ export const PurchaseOrderInsideWorkStateTexts = {
// 销售订单内部显示文案
export const SaleOrderInsideWorkStateTexts = {
1: '提交审核订单',
1: '审核订单',
2: '一级审核订单',
3: '二级审核订单',
4: '确认订单',
......
......@@ -177,7 +177,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
console.log(typeof(id))
let title = id === 0 ? '新建' : '编辑'
history.location.query.page_type == '1' ? setHeaderTitle(`${title}发货地址`) : setHeaderTitle(`${title}收货地址`)
PublicApi.getManageGetTelCode().then(res => {
PublicApi.getManageCountryAreaGetTelCode().then(res => {
res.data.forEach((item,index) => {
TelCodeList.push({ label: item, value: (index).toString() })
})
......
......@@ -97,7 +97,7 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
useEffect(() => {
PublicApi.getManageGetTelCode().then(res => {
PublicApi.getManageCountryAreaGetTelCode().then(res => {
res.data.forEach((item, index) => {
TelCodeList.push({ label: item, value: (index).toString() })
})
......
......@@ -61,7 +61,7 @@ const Corporate: React.FC<queryProps> = (props) => {
useEffect(() => {
CheckPayWay(1);
PublicApi.getManageGetTelCode().then(res => {
PublicApi.getManageCountryAreaGetTelCode().then(res => {
setOptions(res.data)
})
}, [])
......
......@@ -50,7 +50,7 @@ const Test:React.FC<queryProps> = (props) => {
actionRef.current = userAction;
}
}
PublicApi.getManageGetTelCode().then(res => {
PublicApi.getManageCountryAreaGetTelCode().then(res => {
setOptions(res.data)
})
}, [])
......
......@@ -23,7 +23,7 @@ const titleMaps = {
const addressSchemaAction = createFormActions()
// 获取手机区号
const fetchTelCode = async () => {
const { data } = await PublicApi.getManageGetTelCode()
const { data } = await PublicApi.getManageCountryAreaGetTelCode()
return data
}
......
......@@ -136,10 +136,12 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
const fetchProductList = (values) => {
const modelType = schemaAction.getFieldValue('orderModel')
const supplyMembersId = schemaAction.getFieldValue('supplyMembersId')
const params = {
...values,
shopType: orderProductShopTypeMaps[modelType],
environment: 1,
memberId: supplyMembersId,
// 手工下单/合并订单下单时,查询现货价格商品
priceTypeList: modelType === (OrderModalType.CONSOLIDATED_ORDER || OrderModalType.HAND_ORDER) ? [1] : undefined
}
......
import React, { useRef, useMemo, useState } from 'react'
import { ISchemaFormActions, ISchemaFormAsyncActions, createControllerBox, useFormSpy } from '@formily/antd';
import { Button, Row, Col } from 'antd';
import { Button, Row, Col, message } from 'antd';
import { productInfoColumns } from '../constant';
import ProductTableCell, { ProductEditableRow } from '../components/productTableCell';
import { useModalTable } from './useModalTable';
......@@ -53,7 +53,16 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
return productInfoColumns
})
const productAddButton = <Button onClick={() => productRef.current.setVisible(true)} block type='default' style={{margin: '24px auto'}}>选择订单商品</Button>
const handleShowProduct = () => {
const supplyMembersId = ctx.getFieldValue('supplyMembersId')
if (supplyMembersId) {
productRef.current.setVisible(true)
} else {
message.error('请先选择供应会员')
}
}
const productAddButton = <Button onClick={handleShowProduct} block type='default' style={{margin: '24px auto'}}>选择订单商品</Button>
const productComponents = {
body: {
row: ProductEditableRow,
......
import React, { useState, useEffect, useContext, useRef } from 'react'
import React, { useState, useEffect, useContext, useRef, useCallback } from 'react'
import OrderDetailHeader from '../../components/OrderDetailHeader'
import { Button, Row, Col } from 'antd'
import { Link, history } from 'umi'
......@@ -20,14 +20,16 @@ import ModalForm from '@/components/ModalForm'
import { createFormActions } from '@formily/antd'
import OrderPayModal from './components/orderPayModal'
import OrderDeleveRecord from './components/orderDeleveRecord'
import { PurchaseOrderInsideWorkState } from '@/constants'
export interface CommonOrderDetailProps {}
const approvedActions = createFormActions()
const btnApprovedTitles = [PURCHASE_ORDER_STATUS.ONE_LEVEL_APPROVED_ORDER, PURCHASE_ORDER_STATUS.TWO_LEVEL_APPROVED_ORDER, PURCHASE_ORDER_STATUS.READY_SUBMIT_ORDER]
const btnApprovedTitles = [PURCHASE_ORDER_STATUS.ONE_LEVEL_APPROVED_ORDER, PURCHASE_ORDER_STATUS.TWO_LEVEL_APPROVED_ORDER]
const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
const [btnLoading, setBtnLoading] = useState<boolean>(false)
const [formData, setFormData] = useState<any>(null)
const [payList, setPaylist] = useState<any[]>([])
let { id, pageStatus, page_type = PURCHASE_ORDER_STATUS.PREVIEW_ORDER } = usePageStatus()
......@@ -64,6 +66,7 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
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 = {
......@@ -94,11 +97,12 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
}
case PURCHASE_ORDER_STATUS.READY_CONFIRM_ELECTRON_ORDER: {
const params = {
id: parseInt(id),
state: 1
}
result = await PublicApi.postOrderElectronicContractsAffirm(params)
console.log('确认')
// const params = {
// id: parseInt(id),
// state: 1
// }
// result = await PublicApi.postOrderElectronicContractsAffirm(params)
break;
}
......@@ -134,6 +138,7 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
approvedRef.current.setVisible(false)
history.goBack()
}
setBtnLoading(false)
}
const handleStartApply = () => {
......@@ -162,19 +167,37 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
}
}
const extraRight = formData && pageStatus !== PageStatus.PREVIEW && <div>
<Button type='primary' onClick={handleStartApply}>
{btnApprovedTitles.includes(page_type) ? '提交审核' : '提交'}
</Button>
{
page_type === PURCHASE_ORDER_STATUS.READY_PAY_ORDER &&
<div style={{textAlign: 'right'}}>
<p style={{marginTop: 12, fontSize: 12, color: '#6B778C'}}>本次需支付</p>
<p>{formData.sumPrice}</p>
</div>
const extraRight = useCallback(() => {
if (!formData || page_type === PURCHASE_ORDER_STATUS.PREVIEW_ORDER) {
return null
}
let text = ''
switch(page_type) {
case PURCHASE_ORDER_STATUS.READY_CONFIRM_ELECTRON_ORDER: {
text = '确认电子合同'
break;
}
default: {
text = '提交审核'
break;
}
}
return <>
<Button type='primary' onClick={handleStartApply} loading={btnLoading}>
{text}
</Button>
{
page_type === PURCHASE_ORDER_STATUS.READY_PAY_ORDER &&
<div style={{textAlign: 'right'}}>
<p style={{marginTop: 12, fontSize: 12, color: '#6B778C'}}>本次需支付</p>
<p>{formData.sumPrice}</p>
</div>
}
</>
}, [formData])
</div>
const detailList = [
{ label: '对应报价单号', name: 'quotationNo', span: 8, render: text => <Link to={'/'}>{text}</Link> },
{ label: '订单摘要', name: 'orderThe', span: 8 },
......@@ -199,7 +222,7 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
return formData ? (
<div>
<OrderDetailContext.Provider value={formContext}>
<OrderDetailHeader headerTitle={headerTiTle} detailList={detailList} detailData={formData} extraRight={extraRight}/>
<OrderDetailHeader headerTitle={headerTiTle} detailList={detailList} detailData={formData} extraRight={extraRight()}/>
<OrderDetailWrapper>
<div className='gray-wrap'>
{/* 工作流进度 */}
......
import React from 'react'
import React, { useEffect, useState } from 'react'
import { history } from 'umi'
import { Button } from 'antd'
import { Button, Popconfirm } from 'antd'
import { baseOrderListColumns } from '../../constant'
import { PublicApi } from '@/services/api'
// 业务hooks, 待新增订单
export const useSelfTable = () => {
const [isSign, setIsSign] = useState(false)
const handleConfirm = async (record) => {
//@todo 是否签约电子签章, 如果没有,需跳转至签约页面
const { data } = await PublicApi.getOrderSignatureAuthAuthState()
const flag = true
if (flag || data.state === 1) {
if (isSign) {
history.push(`/memberCenter/tranactionAbility/purchaseOrder/orderPreview?page_type=4&id=${record.id}&preview=0`)
} else {
// 未认证
console.log('未认证电子合同')
}
}
useEffect(() => {
PublicApi.getOrderSignatureAuthAuthState().then(({data}) => {
setIsSign(data.state === 1)
})
}, [])
const secondColumns: any[] = baseOrderListColumns.concat([
{
title: '操作',
......@@ -23,7 +29,9 @@ export const useSelfTable = () => {
dataIndex: 'ctl',
key: 'ctl',
render: (text, record) => <>
<Button type='link' onClick={() => handleConfirm(record)}>确认电子合同</Button>
<Popconfirm title='您未申请电子签章是否需要立即前往?'>
<Button type='link' onClick={() => handleConfirm(record)}>确认电子合同</Button>
</Popconfirm>
</>
}
])
......
......@@ -13,7 +13,7 @@ export const baseOrderListColumns: any[] = [
key: 'orderNo',
render: (text, record) => {
// 查看订单, 需根据状态显示不同schema
return <EyePreview url={`/memberCenter/tranactionAbility/purchaseOrder/orderPreview?page_type=-1&id=${record.id}&preview=1`}>
return <EyePreview url={`/memberCenter/tranactionAbility/saleOrder/orderPreview?page_type=-1&id=${record.id}&preview=1`}>
{text}
</EyePreview>
}
......
import React, { useContext, useState, useRef, useEffect } from 'react'
import React, { useContext, useState, useRef, useEffect, useCallback } from 'react'
import { StandardTable } from 'god'
import { Card, Table, Form, Input, Row, Col, Button, Modal } from 'antd'
import { OrderDetailContext } from '../../context'
......@@ -11,6 +11,8 @@ import { createFormActions } from '@formily/antd'
import MellowCard from '@/components/MellowCard'
import { SALE_ORDER_STATUS } from '../../constant'
import { usePageStatus } from '@/hooks/usePageStatus'
import ModalTable from '@/components/ModalTable'
import { formatTimeString } from '@/utils'
export interface OrderProductTableProps {}
......@@ -39,6 +41,45 @@ const RowStyle = styled(props => <Row style={{marginTop: 12}} justify='end' {...
}
`
const warehouseColumns: any[] = [
{
dataIndex: 'freightSpaceId',
key: 'freightSpaceId',
title: '仓位ID',
align: 'center'
},
{
dataIndex: 'freightSpaceName',
key: 'freightSpaceName',
title: '仓位名称',
align: 'center'
},
{
dataIndex: 'warehouseName',
key: 'warehouseName',
title: '对应仓库',
align: 'center'
},
{
dataIndex: 'goodsName',
key: 'goodsName',
title: '对应货品',
align: 'center'
},
{
dataIndex: 'reductionInventory',
key: 'reductionInventory',
title: '扣减仓位库存',
align: 'center'
},
{
dataIndex: 'createTime',
key: 'createTime',
title: '扣减时间',
align: 'center',
render: text => formatTimeString(text)
}
]
const modalPriceActions = createFormActions()
// 总计金额联动框
export const MoneyTotalBox = ({ dataSource, isEditData }) => {
......@@ -211,6 +252,11 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const { ctl, data } = useContext(OrderDetailContext)
const { page_type } = usePageStatus()
const { orderProductRequests = [] } = data || {}
const [warehouseVisible, setWarehouseVisible] = useState(false)
const [checkProductId, setCheckProductId] = useState(0) // 选中的商品id
const warehouseRef = useRef<any>({})
// 判断是否可操作当前表格
const isEditData = SALE_ORDER_STATUS.READY_APPROVED_ORDER === parseInt(page_type)
const productComponents = {
......@@ -265,6 +311,11 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
})
};
const handlePreviewWarehouse = (record) => {
setCheckProductId(record.id)
setWarehouseVisible(true)
}
const productInfoColumns: any[] = [
{
title: 'ID',
......@@ -274,21 +325,21 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
},
{
title: '商品名称',
dataIndex: 'name',
dataIndex: 'productName',
align: 'center',
key: 'name',
key: 'productName',
},
{
title: '品类',
dataIndex: 'customerCategoryName',
dataIndex: 'category',
align: 'center',
key: 'customerCategoryName',
key: 'category',
},
{
title: '品牌',
dataIndex: 'brandName',
dataIndex: 'brand',
align: 'center',
key: 'brandName',
key: 'brand',
},
{
title: '单位',
......@@ -343,11 +394,14 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
align: 'center',
key: 'record',
// @todo 尚未实现, 需UI设计
render: text => <Button type='link'>查看(未实现)</Button>
render: (_, record) => <Button type='link' onClick={() => handlePreviewWarehouse(record)}>查看</Button>
},
]
const fetchWarehouseData = useCallback(async (params) => {
const { data } = await PublicApi.getWarehousePositionDeductionRecordList({...params, productId: String(checkProductId)})
return data
}, [checkProductId])
const columns = productInfoColumns.map(col => {
if (!col.editable) {
......@@ -374,6 +428,16 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
pagination={false}
/>
<MoneyTotalBox dataSource={data} isEditData={isEditData}/>
<ModalTable
columns={warehouseColumns}
modalTitle='仓位库存扣减记录'
visible={warehouseVisible}
cancel={() => setWarehouseVisible(false)}
currentRef={warehouseRef}
confirm={() => setWarehouseVisible(false)}
fetchTableData={params => fetchWarehouseData(params)}
/>
</MellowCard>
)
}
......
......@@ -24,6 +24,7 @@ import OrderDeleveRecord from './components/orderDeleveRecord'
export interface CommonOrderDetailProps {}
const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
const [btnLoading, setBtnLoading] = useState<boolean>(false)
const [formData, setFormData] = useState<any>(null)
let { id, pageStatus, page_type = SALE_ORDER_STATUS.READY_APPROVED_ORDER, orderDeliveryDetailsId } = usePageStatus()
page_type = Number(page_type)
......@@ -52,6 +53,8 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
const handleSubmit = async () => {
let result: any = {}
const caseData = typeof page_type === 'string' ? parseInt(page_type) : page_type
setBtnLoading(true)
switch(caseData) {
case SALE_ORDER_STATUS.READY_APPROVED_ORDER: {
//@todo 暂时写死
......@@ -133,6 +136,7 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
if (result.code === 1000) {
history.goBack()
}
setBtnLoading(false)
}
const startPush = () => {
......@@ -145,26 +149,35 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
}
const renderExtra = () => {
if (!formData) {
if (!formData || page_type === SALE_ORDER_STATUS.PREVIEW_ORDER) {
return null
}
let text = ''
switch(formData.purchaseOrderInteriorState) {
case SaleOrderInsideWorkState.CONFIRM_ORDER: {
text = '确认提交'
break;
}
case SaleOrderInsideWorkState.CONFIRM_DELIVERY_ORDER: {
return <Button type='primary' onClick={startPush}>确认全部已发货</Button>
text = '确认全部已发货'
break;
}
case SaleOrderInsideWorkState.CONFIRM_RECEIPT: {
return <Button type='primary' onClick={startPush}>确认全部已回单</Button>
text = '确认全部已回单'
break;
}
default: {
return <Button type='primary' onClick={startPush}>提交审核</Button>
text = '提交审核'
break;
}
}
return <Button type='primary' onClick={startPush} loading={btnLoading}>{text}</Button>
}
const detailList = [
{ label: '对应报价单号', name: 'quotationNo', span: 8, render: text => <Link to={'/'}>{text}</Link> },
{ label: '订单摘要', name: 'orderThe', span: 8 },
{ label: '供应会员', name: 'supplyMembersName', span: 8, render: text => <Link to={'/'}>{text}</Link> },
{ label: '供应会员', name: 'supplyMembersName', span: 8 },
{ label: '下单模式', name: 'orderModel', span: 8, render: text => GlobalConfig.web.orderMode[text].label },
{ label: '订单类型', name: 'type', span: 8, render: text => orderTypeLabel[text] },
{ label: '下单时间', name: 'createTime', span: 8, render: text => formatTimeString(text) },
......
......@@ -68,7 +68,7 @@ const AddWarehouse: React.FC<{}> = (props: any) => {
// 获取手机code
const fetchTelCode = async () => {
const { data } = await PublicApi.getManageGetTelCode();
const { data } = await PublicApi.getManageCountryAreaGetTelCode();
return data;
};
......
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