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

Merge branch 'featStrategies' into dev

parents 8a48b04b 8eaec48a
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1019,8 +1019,8 @@ export const PurchaseOrderOutWorkStateTexts = {
9: '待新增采购入库单',
10: '订单收货待确认',
11: '待确认回单',
12: '订单归档供应商',
13: '订单归档采购商',
12: '待归档',
13: '待归档',
14: '完成订单',
20: '不接受订单',
21: '确认没到账',
......@@ -1060,7 +1060,7 @@ export const SaleOrderInsideWorkStateTexts = {
2: '待审核订单(一级)',
3: '待审核订单(二级)',
4: '待确认订单',
5: '接受订单',
5: '接受订单',
6: '不接受订单',
7: '提交审核订单不通过(一级)',
8: '提交审核订单不通过(二级)',
......@@ -1069,7 +1069,7 @@ export const SaleOrderInsideWorkStateTexts = {
16: '支付结果确认到账',
17: '支付结果没到账',
18: '待审核销售发货单',
18: '待新增销售发货单',
19: '待新增物流单',
20: '订单发货待确认',
23: '待确认回单',
......
import React from 'react'
import AuditProcess from '@/components/AuditProcess'
import { findLastIndexFlowState } from '@/utils'
import OrderProductTable from '../../components/orderProductTable'
import SaleOrderProductTable from '../../components/saleOrderProductTable'
import OrderPayTabs from '../../components/orderPayTabs'
import OrderMergeInfo from '../../components/orderMergeInfo'
import OrderDeleveRecord from '../../components/orderDeleveRecord'
import OrderTransformRecord from '../../components/orderTransformRecord'
import OrderSaleRecord from '../orderSaleRecord'
export interface OrderDetailSectionProps {
formContext: any,
type?: 'purchaseOrder' | 'saleOrder',
}
const OrderDetailSection:React.FC<OrderDetailSectionProps> = ({formContext, type = 'purchaseOrder'}) => {
return (
formContext.data && <div className='gray-wrap'>
<AuditProcess
customTitleKey='operationalProcess'
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(formContext.data.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formContext.data.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={
formContext.data.externalWorkflowFlowRecordLogResponses ?
formContext.data.externalWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
innerVerifySteps={
formContext.data.interiorWorkflowFlowRecordLogResponses ?
formContext.data.interiorWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
></AuditProcess>
{ type === 'saleOrder' ? <SaleOrderProductTable/> : <OrderProductTable editable /> }
<OrderPayTabs />
<OrderMergeInfo />
{ type === 'saleOrder' ? <OrderSaleRecord /> : <OrderDeleveRecord /> }
<OrderTransformRecord type={type}/>
</div>
)
}
OrderDetailSection.defaultProps = {}
export default OrderDetailSection
\ No newline at end of file
import React from 'react'
import AuditProcess from '@/components/AuditProcess'
import { findLastIndexFlowState } from '@/utils'
import OrderProductTable from '../../components/orderProductTable'
import SaleOrderProductTable from '../../components/saleOrderProductTable'
import OrderPayTabs from '../../components/orderPayTabs'
import OrderMergeInfo from '../../components/orderMergeInfo'
import OrderDeleveRecord from '../../components/orderDeleveRecord'
import OrderTransformRecord from '../../components/orderTransformRecord'
import OrderSaleRecord from '../orderSaleRecord'
export interface OrderDetailSectionProps {
formContext: any,
type?: 'purchaseOrder' | 'saleOrder',
}
const OrderDetailSection:React.FC<OrderDetailSectionProps> = ({formContext, type = 'purchaseOrder'}) => {
return (
formContext.data && <div className='gray-wrap'>
<AuditProcess
customTitleKey='operationalProcess'
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(formContext.data.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formContext.data.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={
formContext.data.externalWorkflowFlowRecordLogResponses ?
formContext.data.externalWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
innerVerifySteps={
formContext.data.interiorWorkflowFlowRecordLogResponses ?
formContext.data.interiorWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
></AuditProcess>
{ type === 'saleOrder' ? <SaleOrderProductTable/> : <OrderProductTable editable /> }
<OrderPayTabs />
<OrderMergeInfo />
{ type === 'saleOrder' ? <OrderSaleRecord /> : <OrderDeleveRecord /> }
<OrderTransformRecord type={type}/>
</div>
)
}
OrderDetailSection.defaultProps = {}
export default OrderDetailSection
import React, { useContext, useEffect, useState } from 'react'
import style from './index.less'
import { Tabs, Row, Col, Modal, List } from 'antd'
import { Tabs, Row, Col, Modal, List, Tooltip } from 'antd'
import { OrderDetailContext } from '../../_public/order/context'
import MellowCard from '@/components/MellowCard'
import StatusColors from '../StatusColors'
import moment from 'moment'
import { PayOutWorkState } from '@/constants'
import OverflowText from '@/components/OverflowText'
import { isTemplateExpression } from 'typescript'
import { QuestionCircleOutlined } from '@ant-design/icons'
/**
* 展示 支付比例和简单流程的发货信息
......@@ -56,6 +56,12 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = (props) => {
<div className={style.smallnumber}>
{dataSource.channel !== 0 && '¥'}
{dataSource.payPrice || 0}
{
dataSource.refundPrice &&
<Tooltip title={`本次实际支付金额(¥${data.payPrice})=本次订单待支付金额(¥${data.payPrice+data.refundPrice})-售后待退款金额(¥${data.refundPrice})`}>
<QuestionCircleOutlined />
</Tooltip>
}
</div>
</Col>
<Col>
......
......@@ -71,4 +71,10 @@ export const fetchOrderApi = {
return data
},
// 获取合并订单列表
async getMergeOrderList(params) {
const { data } = await PublicApi.getOrderMergeOrderList(params)
return data
},
}
.order {
display: flex;
flex-direction: column;
height: 100%;
&-head {
flex-shrink: 0;
}
&-body {
flex: 1;
overflow: auto;
}
&-foot {
flex-shrink: 0;
margin-top: 32px;
text-align: right;
}
}
import { ISchema } from "@formily/antd";
import { PATTERN_MAPS } from '@/constants/regExp';
import { PublicApi } from '@/services/api';
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const mergeSearchSchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
orderNo: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '输入订单号搜索',
align: 'flex-left',
// tip: '输入 订单号 进行搜索',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 6,
},
properties: {
orderThe: {
type: 'string',
'x-component-props': {
placeholder: '订单摘要',
allowClear: true,
},
},
membersName: {
type: 'string',
'x-component-props': {
placeholder: '采购商',
allowClear: true,
},
},
activityName: {
type: 'string',
'x-component-props': {
placeholder: '活动名称',
allowClear: true,
},
},
'[startCreateTime, endCreateTime]': {
type: 'string',
default: '',
'x-component': 'dateSelect',
'x-component-props': {
placeholder: '下单时间(全部)',
allowClear: true,
},
},
'[startActivityTime, endActivityTime]': {
type: 'string',
default: '',
'x-component': 'dateSelect',
'x-component-props': {
placeholder: '活动时间(全部)',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
......@@ -44,7 +44,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
formItemProps={},
...restProps
}) => {
const formItemRef = useRef<any>();
// const formItemRef = useRef<any>();
const { form } = useContext(EditableContext);
const save = async e => {
try {
......@@ -56,10 +56,23 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
}
};
const chooseFormItem = (type) => {
const chooseFormItem = (type, v) => {
switch(type) {
case 'input': {
return <Input style={{width: 140}} type='number' ref={formItemRef} onChange={save} {...formItemProps} id={dataIndex + record.id}/>
// 用于合并订单采购数量回显
let keyValue = {}
keyValue[dataIndex] = v
form.setFieldsValue(keyValue)
return <Input
style={{width: 140}}
type='number'
// ref={formItemRef}
onChange={save}
{...formItemProps}
id={dataIndex + record.id}
className="purchase_amount_input"
/>
}
}
}
......@@ -82,7 +95,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
},
]}
>
{chooseFormItem(formItem)}
{chooseFormItem(formItem, record[dataIndex] || '')}
</Form.Item>
}
......
......@@ -337,7 +337,8 @@ export const productInfoColumns: any[] = [
},
]
export const mergeOrderColumns: any[] = [
// 合并订单父级表格列
export const mergeParentTableColumns: any[] = [
{
title: '订单号',
dataIndex: 'orderNo',
......@@ -375,3 +376,56 @@ export const mergeOrderColumns: any[] = [
key: 'none',
}
]
// 合并订单子级表格列
export const mergeChildrenTableColumns: any[] = [
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
key: 'productId',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
key: 'productName',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: '单价',
dataIndex: 'price',
align: 'center',
key: 'price',
},
{
title: '原订单数量',
dataIndex: 'purchaseCount',
align: 'center',
key: 'purchaseCount',
},
{
title: '原订单金额',
dataIndex: 'id',
align: 'center',
key: 'id',
render: (t, r) => `¥${(r.purchaseCount*100) * (r.price*100) / 10000}`
}
]
......@@ -5,14 +5,12 @@ import { useLinkageUtils } from '@/utils/formEffectUtils';
import { orderCombination } from '../constant';
import { history } from 'umi';
import { fetchOrderApi } from '../apis';
import { useUpdate } from '@umijs/hooks';
import { PublicApi } from '@/services/api';
import { filterProductDataById } from '../components/productModalTable'
import { getUnitPriceTotal } from '../model/useProductTable';
import moment from 'moment';
import { OrderModalType } from '@/constants';
let updateFlag = false
// 异步填充表格字段
const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, productValue: any) => {
......@@ -101,13 +99,13 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
// if (payInfoData && payInfoData.length > 0) {
// } else
const orderModel = ctx.getFieldValue('orderModel')
if (value && value.length > 0 && !state.loading){ // 添加loading判断避免二次调用
// 请求一次并复制给支付信息
const productItem = value[0]
if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现
} else if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数
const orderModel = ctx.getFieldValue('orderModel')
fetchOrderApi.getPayInfoList({
productId: orderModel === OrderModalType["HAND_ORDER"] ? productItem.id : productItem.productId,
memberId: productItem?.memberId || ctx.getFieldValue('supplyMembersId'),
......@@ -124,6 +122,23 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
// 确认后 需根据商品id请求会员折扣接口, 以及配送方式
// 由于商品存在多个, 需对接口做一定缓存
asyncPadDataForProduct(ctx, state)
// 下单模式为合并订单 禁用编辑采购数量
if(orderModel === OrderModalType["CONSOLIDATED_ORDER"]) {
let numberInputs = document.getElementsByClassName("purchase_amount_input")
if(numberInputs?.length) {
for(let i = 0; i < numberInputs.length; i++) {
numberInputs[i].setAttribute("disabled", "true")
}
}
} else {
let numberInputs = document.getElementsByClassName("purchase_amount_input")
if(numberInputs?.length) {
for(let i = 0; i < numberInputs.length; i++) {
numberInputs[i].removeAttribute("disabled")
}
}
}
})
}
......@@ -178,7 +193,6 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
ctx.setFieldValue('supplyMembersName', initValue.supplyMembersName)
initValue.idList && ctx.setFieldValue('idList', initValue.idList)
initValue.productType && ctx.setFieldValue('productType', initValue.productType)
ctx.setFieldValue('orderProductRequests', await filterProductDataById([], productInfo.map(v => {
return {
...v,
......@@ -194,6 +208,7 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
memberRoleId: initValue.supplyMembersRoleId,
commodityId: v.id, // 添加commodityId用于判断是商品价格是使用price字段还是unitPrice字段(也可判断是报价订单还是其他)
memberPrice: v.memberDiscount !== 1 ? v.memberDiscount : 1, // 添加会员折扣
name: v.attribute?.length ? v.name + '/' + v.attribute.map(item => item.customerAttributeValue.value).join('/') : v.name,
}
})
))
......@@ -296,7 +311,7 @@ export const useOrderUpdateChangeOther = (ctx: ISchemaFormActions | ISchemaFormA
PublicApi.postOrderProcurementOrderUpdate({
...values,
deliveryTime: moment(values.deliveryTime).valueOf(),
theInvoiceId: value.id,
theInvoiceId: value.id || null,
needTheInvoice: Number(values.needTheInvoice),
deliveryAddresId: values.deliveryAddresId,
id,
......
......@@ -33,6 +33,7 @@ import AuditProcess from '@/components/AuditProcess'
import styles from './index.less'
import SimpleElectronModal from './components/simpleElectronModal'
import { fetchOrderApi } from './apis'
import MergeOrderModalTable from './components/mergeOrderModalTable'
export interface PurchaseOrderDetailProps {}
......@@ -126,6 +127,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const inquiryRef = useRef<any>({})
const demandRef = useRef<any>({})
const contractRef = useRef<any>({})
const mergeRef = useRef<any>({})
const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false)
const update = useUpdate()
......@@ -154,7 +156,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
addSchemaAction.getFieldValue('supplyMembersRoleId'),
pageStatus === PageStatus.ADD ? addSchemaAction.getFieldValue('orderProductRequests') : initFormValue.orderProductRequests
)
const { productAddButton, productRef, productColumns, productComponents, ...sectionProps } = useProductTable(addSchemaAction)
const { productAddButton, productRef, productColumns, productComponents, ...sectionProps } = useProductTable(addSchemaAction, mergeRef)
let timerSignature = null
// 页面进入时, 当前所处的下单模式
......@@ -192,7 +194,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}, [])
const handleSubmit = async (value) => {
// console.log(value, 'value')
console.log(value, 'value', addSchemaAction.getFieldValue("orderProductRequests"))
let _orderProductRequests = JSON.parse(JSON.stringify(value.orderProductRequests))
let processEnum = value['processEnum']
let usingElectronicContracts = value['usingElectronicContracts']
......@@ -328,7 +330,16 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}
})
setBtnLoading(true)
fnResult = id ? await PublicApi.postOrderProcurementOrderUpdate({...params, id}) : await PublicApi.postOrderProcurementOrderAddReinsurancePolicy(params)
fnResult = id ?
await PublicApi.postOrderProcurementOrderUpdate({...params, id})
:
(params.orderModel===9 ?
await PublicApi.postOrderProcurementOrderAddMerge({
...params,
ordeProducts: addSchemaAction.getFieldValue("ordeProducts")
})
:
await PublicApi.postOrderProcurementOrderAddReinsurancePolicy(params))
break;
}
}
......@@ -542,31 +553,33 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// 商品信息的改动 驱动支付信息变化
useProductTableChangeForPay(ctx, update)
//编辑 地址和发票信息变动 触发订单更新
// 编辑 地址和发票信息变动 触发订单更新
useOrderUpdateChangeOther(ctx)
// address初始下只有id change后为object
// $('onFieldValueChange', 'NO_SUBMIT_TABS.*.*.*(theInvoiceId, needTheInvoice, deliveryAddresId)').subscribe(state => {
// const { value, path } = state
// if(pageStatus === PageStatus.EDIT){
// if(state?.dataSource?.length && state.loading) {
// ctx.submit((values) => {
// console.log(value, path)
// if(values){
// PublicApi.postOrderProcurementOrderUpdate({
// ...values,
// deliveryTime: moment(values.deliveryTime).valueOf(),
// theInvoiceId: value.id,
// needTheInvoice: Number(values.needTheInvoice),
// deliveryAddresId: path.indexOf("deliveryAddresId") !== -1 ? ( value?.id ? value.id : value ) : values.deliveryAddresId,
// id,
// }, { ctlType: "none" })
// }
// })
// } else {
// ctx.setFieldState(path, _state => _state.loading = true)
// }
// }
// })
// 合并订单模式下 只选择供应会员 出现选择商品按钮
$('onFieldValueChange', 'supplyMembersName').subscribe(state => {
const quotationOrderValue = ctx.getFieldValue('quotationNo')
const modelType = ctx.getFieldValue('orderModel')
if(state.value && !quotationOrderValue && modelType === 9) {
addSchemaAction.setFieldState('orderProductRequests', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
prefix: productAddButton,
}
})
}
})
$('onFieldValueChange', 'quotationNo').subscribe(state => {
const modelType = ctx.getFieldValue('orderModel')
if(state.value && modelType === 9) {
addSchemaAction.setFieldState('orderProductRequests', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
prefix: "",
}
})
}
})
}}
expressionScope={{
......@@ -598,6 +611,15 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
{/* 简单流程签合同弹窗 */}
<SimpleElectronModal currentRef={contractRef} schemaAction={addSchemaAction}/>
{/* 选择待合并订单弹窗 */}
<MergeOrderModalTable
title="选择待合并订单"
currentRef={mergeRef}
schemaAction={addSchemaAction}
handleUpdate={update}
// confirmModal
/>
</ReadyAddOrderDetailContext.Provider>
</PageHeaderWrapper>
)
......
......@@ -53,10 +53,16 @@ export const getUnitPriceTotal = (record) => {
return Number((unitPrice * purchaseCount).toFixed(2))
}
}
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
/**
* @param ctx schemaAction
* @param mergeRef 操作合并订单的ref
*/
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, mergeRef: any) => {
const productRef = useRef<any>({})
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox'})
const { pageStatus } = usePageStatus()
const handleDelete = (record) => {
const newData = [...ctx.getFieldValue('orderProductRequests')]
// 删除formvalue
......@@ -81,12 +87,22 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
// ctx.setFieldValue('paymentInformationResponses', paymentInfo)
}
}
const clickMergeButton = (recrod) => {
mergeRef.current.setVisible(true)
mergeRef.current.setCurrentClickRow(recrod)
}
const [productColumns, setProductColumns] = useState(() => {
if (pageStatus === PageStatus.ADD) {
productInfoColumns[productInfoColumns.length - 1].render = (text, record) => {
const orderModel = ctx.getFieldValue('orderModel')
return <>
{
// 合并下单
orderModel === 9 && <Button type='link' onClick={() => clickMergeButton(record)}>选择合并订单</Button>
}
<Button type='link' onClick={() => handleDelete(record)}>删除</Button>
{/* <Button type='link'>选择合并订单</Button> */}
</>
}
} else {
......
......@@ -232,7 +232,12 @@ const orderProduct: ISchema = {
columns: "{{productColumns}}",
components: "{{productComponents}}",
},
// default: [{id: 904}]
},
// 仅合并下单时备用参数数据
ordeProducts: {
type: 'array',
title: '合并下单记录',
visible: false
},
NO_SUBMIT_SPY: {
type: 'object',
......
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