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

fix:处理采购下单首次选择数据后多次调用获取交易规则和合同签章接口,处理首次编辑订单支付渠道显示异常

parent e3b33a96
...@@ -314,7 +314,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => { ...@@ -314,7 +314,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
dataIndex: 'memberPrice', dataIndex: 'memberPrice',
align: 'center', align: 'center',
key: 'memberPrice', key: 'memberPrice',
render: (text, record) => record.isMemberPrice ? (text * 100 + '%') : null render: (text, record) => record.isMemberPrice ? (text * 10000 / 100 + '%') : null
}, },
{ {
title: creditsCommodity ? '兑换数量' : '采购数量', title: creditsCommodity ? '兑换数量' : '采购数量',
......
import React, { useState, useRef, useContext, useEffect } from 'react' import React, { useState, useRef, useContext, useEffect } from 'react'
import { Form, Input, Select } from 'antd'; import { Form, Input, Select } from 'antd';
import { history } from 'umi'
import styles from "../../index.less"
export interface PayInfoCellProps { export interface PayInfoCellProps {
title: React.ReactNode; title: React.ReactNode;
...@@ -65,6 +67,19 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({ ...@@ -65,6 +67,19 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({
}) => { }) => {
const formItemRef = useRef<any>(); const formItemRef = useRef<any>();
const { form, childOptions, setChildOptions, originOptions } = useContext(EditableContext); const { form, childOptions, setChildOptions, originOptions } = useContext(EditableContext);
// fix: 没有childOptions 导致第一次进入编辑页面无法显示支付渠道
let _childOptions = null;
if(history.location.query?.id && title === "支付渠道") {
let payList = originOptions.filter(item => item.payType === record.payWay) || []
if(payList.length) {
_childOptions = payList[0].payList.map(_item => ({
label: _item.way,
value: _item.wayId,
}))
}
}
const save = async e => { const save = async e => {
try { try {
const values = await form.validateFields(); const values = await form.validateFields();
...@@ -106,7 +121,7 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({ ...@@ -106,7 +121,7 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({
return <Select return <Select
ref={formItemRef} ref={formItemRef}
onChange={save} onChange={save}
options={childOptions} options={childOptions.length ? childOptions : _childOptions}
{...rest} {...rest}
id={formId} id={formId}
/> />
...@@ -139,7 +154,7 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({ ...@@ -139,7 +154,7 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({
); );
} }
return <td {...restProps}>{childNode}</td>; return <td {...restProps} style={{height: 90}}>{childNode}</td>;
} }
PayInfoCell.defaultProps = {} PayInfoCell.defaultProps = {}
......
...@@ -217,7 +217,7 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn ...@@ -217,7 +217,7 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
// 查询商品对应的工作流 获取电子合同 // 查询商品对应的工作流 获取电子合同
FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => { FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => {
if (state.value?.length) { if (state.value?.length && state.loading) {
useElectronicContract(ctx) useElectronicContract(ctx)
} }
}) })
...@@ -278,7 +278,7 @@ export const useElectronicContract = (ctx: ISchemaFormActions | ISchemaFormAsync ...@@ -278,7 +278,7 @@ export const useElectronicContract = (ctx: ISchemaFormActions | ISchemaFormAsync
ctx.setFieldState("usingElectronicContracts", state => { ctx.setFieldState("usingElectronicContracts", state => {
state.props["x-component-props"].contract = { contractTemplateId: data['electronicContractId'], ..._data, } state.props["x-component-props"].contract = { contractTemplateId: data['electronicContractId'], ..._data, }
}) })
ctx.setFieldValue("electronicContractName", _data.contractName) ctx.setFieldValue("electronicContractName", _data?.contractName)
}) })
} }
}) })
......
...@@ -3,7 +3,6 @@ import { PayInfoCell, EditableRow } from '../components/payInfoTableCell' ...@@ -3,7 +3,6 @@ import { PayInfoCell, EditableRow } from '../components/payInfoTableCell'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd' import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useEffect, useState, useRef, useContext } from 'react' import { useEffect, useState, useRef, useContext } from 'react'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { orderCombination } from '@/pages/transaction/saleOrder/readyApprovedOrder/constant'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, orderProducts: any): any => { export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, orderProducts: any): any => {
const paywayData = useRef<any>({}) const paywayData = useRef<any>({})
......
import React, { useRef } from 'react' import React, { useRef } from 'react'
import { history, Link } from 'umi' import { history, Link } from 'umi'
import { Button, Row, Col } from 'antd' import { Button, Row, Col } from 'antd'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils' import { formatTimeString } from '@/utils'
import { ORDER_TYPE, PurchaseOrderInsideWorkState, SaleOrderInsideWorkState } from '@/constants' import { ORDER_TYPE, PurchaseOrderInsideWorkState, SaleOrderInsideWorkState } from '@/constants'
import StatusColors from '@/pages/transaction/components/StatusColors' import StatusColors from '@/pages/transaction/components/StatusColors'
import { FieldTimeOutlined } from '@ant-design/icons' import { FieldTimeOutlined } from '@ant-design/icons'
import { import {
Chart, Chart,
Interval, Interval,
Axis, Axis,
Tooltip, Tooltip,
Coordinate, Coordinate,
Legend, Legend,
View, View,
Annotation, Annotation,
} from 'bizcharts'; } from 'bizcharts';
import DataSet from "@antv/data-set"; import DataSet from "@antv/data-set";
// 业务hooks // 业务hooks
export const useSelfTable = () => { export const useSelfTable = () => {
const ref = useRef<any>({}) const ref = useRef<any>({})
const customOrderColumns: any[] = [ const customOrderColumns: any[] = [
{ {
title: '订单号', title: '订单号',
align: 'center', align: 'center',
dataIndex: 'orderNo', dataIndex: 'orderNo',
key: 'orderNo', key: 'orderNo',
render: (text, record) => { render: (text, record) => {
// 查看订单, 需根据状态显示不同schema // 查看订单, 需根据状态显示不同schema
return ( return (
<EyePreview url={`/memberCenter/tranactionAbility/purchaseOrder/readyReceiveOrder/preview?id=${record.id}`}> <EyePreview url={`/memberCenter/tranactionAbility/purchaseOrder/readyReceiveOrder/preview?id=${record.id}`}>
{text} {text}
</EyePreview> </EyePreview>
) )
} }
}, },
{ {
title: '订单摘要/下单时间', title: '订单摘要/下单时间',
align: 'center', align: 'center',
dataIndex: 'orderThe', dataIndex: 'orderThe',
key: 'orderThe', key: 'orderThe',
render: (text, record) => <> render: (text, record) => <>
<div>{text}</div> <div>{text}</div>
<div><FieldTimeOutlined />{formatTimeString(record.createTime)}</div> <div><FieldTimeOutlined />{formatTimeString(record.createTime)}</div>
</>, </>,
width: 200 width: 200
}, },
{ {
title: '采购会员', title: '采购会员',
align: 'left', align: 'left',
dataIndex: 'supplyMembersName', dataIndex: 'supplyMembersName',
key: 'supplyMembersName', key: 'supplyMembersName',
}, },
{ {
title: '总金额', title: '总金额',
align: 'center', align: 'center',
dataIndex: 'sumPrice', dataIndex: 'sumPrice',
key: 'sumPrice', key: 'sumPrice',
render: text => '¥' + text render: (t, r) => r.type === 7 || r.type === 8 ? t : '¥' + t
}, },
{ title: '收货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => text ? `第${text}次` : '' }, { title: '收货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => text ? `第${text}次` : '' },
// @todo 收货单号跳转 // @todo 收货单号跳转
{ {
title: '入库单号', title: '入库单号',
align: 'center', align: 'center',
dataIndex: 'invoiceNumber', dataIndex: 'invoiceNumber',
key: 'invoiceNumber', key: 'invoiceNumber',
render: (t, r) => r.orderDeliveryDetailsId ? <Link to={`/memberCenter/tranactionAbility/stockSellStorage/bills/detail?id=${r.orderDeliveryDetailsId}&preview=1`}>{t}</Link> : <a href={`https://www.kuaidi100.com/chaxun?nu=${t}`} target="blank">{t}</a> render: (t, r) => r.orderDeliveryDetailsId ? <Link to={`/memberCenter/tranactionAbility/stockSellStorage/bills/detail?id=${r.orderDeliveryDetailsId}&preview=1`}>{t}</Link> : <a href={`https://www.kuaidi100.com/chaxun?nu=${t}`} target="blank">{t}</a>
}, },
{ {
title: '订单类型', title: '订单类型',
align: 'center', align: 'center',
dataIndex: 'type', dataIndex: 'type',
key: 'type', key: 'type',
render: (text) => ORDER_TYPE[text] render: (text) => ORDER_TYPE[text]
}, },
{ {
title: '外部状态', title: '外部状态',
align: 'center', align: 'center',
dataIndex: 'externalState', dataIndex: 'externalState',
key: 'externalState', key: 'externalState',
render: text => <StatusColors status={text} type='out'/> render: text => <StatusColors status={text} type='out'/>
}, },
{ {
title: '内部状态', title: '内部状态',
align: 'center', align: 'center',
dataIndex: 'interiorState', dataIndex: 'interiorState',
key: 'interiorState', key: 'interiorState',
render: (text) => <StatusColors status={text} type='inside'/> render: (text) => <StatusColors status={text} type='inside'/>
}, },
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
dataIndex: 'ctl', dataIndex: 'ctl',
key: 'ctl', key: 'ctl',
render: (text, record) => <> render: (text, record) => <>
{/* 支付结果确认到账= 待审核状态 */} {/* 支付结果确认到账= 待审核状态 */}
{ (record.interiorState === PurchaseOrderInsideWorkState.CONFIRM_RECEIPT || record.interiorState === PurchaseOrderInsideWorkState.HAND_RECEIPT_ORDER) && { (record.interiorState === PurchaseOrderInsideWorkState.CONFIRM_RECEIPT || record.interiorState === PurchaseOrderInsideWorkState.HAND_RECEIPT_ORDER) &&
<Button type='link' onClick={() => handleConfirm(record)}>确认收货</Button> <Button type='link' onClick={() => handleConfirm(record)}>确认收货</Button>
} }
</> </>
} }
] ]
const handleConfirm = async (record) => { const handleConfirm = async (record) => {
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyReceiveOrder/detail?id=${record.id}&orderDeliveryDetailsId=${record.orderDeliveryDetailsId}`); history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyReceiveOrder/detail?id=${record.id}&orderDeliveryDetailsId=${record.orderDeliveryDetailsId}`);
} }
return { return {
columns: customOrderColumns columns: customOrderColumns
} }
} }
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