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>({})
......
...@@ -60,7 +60,7 @@ export const useSelfTable = () => { ...@@ -60,7 +60,7 @@ export const useSelfTable = () => {
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 收货单号跳转
......
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