Commit 578e3fe8 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

🐞fix: 修复待确认物流单bug

parent 8df1e773
import React, { useEffect, useState, ReactNode, useRef } from 'react'; import React, { useEffect, useState, ReactNode, useRef } from 'react';
import { Row, Col, Table, Input, Button, Tag, Badge, Steps, message } from 'antd' import { Row, Col, Table, Input, Button, Tag, Badge, Steps, message, Form, Typography } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { CheckSquareOutlined } from '@ant-design/icons' import { CheckSquareOutlined } from '@ant-design/icons'
import { ColumnType } from 'antd/lib/table/interface' import { ColumnType } from 'antd/lib/table/interface'
...@@ -8,11 +8,19 @@ import { history } from 'umi' ...@@ -8,11 +8,19 @@ import { history } from 'umi'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import moment from 'moment' import moment from 'moment'
import style from './index.less' import style from './index.less'
import statuStyle from '../colorTag' import statuStyle from '../colorTag';
const { Step } = Steps const { Step } = Steps
const layout: any = {
colon: false,
labelCol: { style: { width: '150px' } },
wrapperCol: { style: { width: '500px' } },
labelAlign: "left"
}
const detailInfo: React.FC<{}> = () => { const detailInfo: React.FC<{}> = () => {
const ref = useRef<any>({}) const ref = useRef<any>({})
const [form] = Form.useForm();
const [freightPrice, setfreightPrice] = useState<any>(null); const [freightPrice, setfreightPrice] = useState<any>(null);
let [isextraOption, setIsextraOption] = useState(false) let [isextraOption, setIsextraOption] = useState(false)
let [dataInfo, setdataInfo] = useState<any>({ let [dataInfo, setdataInfo] = useState<any>({
...@@ -75,7 +83,7 @@ const detailInfo: React.FC<{}> = () => { ...@@ -75,7 +83,7 @@ const detailInfo: React.FC<{}> = () => {
title: '运费', title: '运费',
leftElem: [ leftElem: [
{ title: '运费:', key: 'freight', value: dataInfo.freightPrice || '' }, { title: '运费:', key: 'freight', value: dataInfo.freightPrice || '' },
{ title: '结算方式:', key: '', value: dataInfo.settlementWay || '' } { title: '结算方式:', key: 'settlement', value: dataInfo.settlementWay || '' }
] ]
} }
} }
...@@ -246,11 +254,13 @@ const detailInfo: React.FC<{}> = () => { ...@@ -246,11 +254,13 @@ const detailInfo: React.FC<{}> = () => {
setfreightPrice(value); setfreightPrice(value);
} }
const handleAudit = () => { const handleAudit = async () => {
if (freightPrice) { try {
setvisible(true) const value = await form.validateFields();
} else { setfreightPrice(value.freight);
message.error('请输入运费') setvisible(true);
} catch {
message.error('请下拉到运费模块输入运费!')
} }
} }
...@@ -420,35 +430,43 @@ const detailInfo: React.FC<{}> = () => { ...@@ -420,35 +430,43 @@ const detailInfo: React.FC<{}> = () => {
{infoTem['freight'].leftElem.map( {infoTem['freight'].leftElem.map(
(item: any, index: number) => { (item: any, index: number) => {
return ( return (
<div className={style['cols-main']} key={`freight${index + 1}`}> <Form {...layout} form={form}>
<div className={style['cols-main-options']}> {item.key === 'freight' &&
{item.title} <>
</div> {type === 'option' ? (
{ <Form.Item
item.key === 'freight' ? label={item.title}
<> name={item.key}
{type === 'option' ? rules={[
<div className={style['cols-main-options']}> {
<Input required: true,
value={freightPrice} message: '请正确输入运费',
addonBefore="¥" },
onChange={inputOnchange} {
type='number' pattern: /^\d+(\.\d{1,2})?$/,
maxLength={25} message: '运费数值小数点后仅限两位',
style={{ width: '300px' }} }
/> ]}
</div> >
: <Input
<div className={style['cols-main-options']}> type='number'
{dataInfo.status < 3 ? '未报价' : item.value} addonBefore="¥"
</div> maxLength={25}
} style={{ width: '300px' }}
</> />
: <div className={style['cols-main-options']}> </Form.Item>
{item.value} ) : (
</div> <Form.Item label={item.title} name={item.key} rules={[{ required: true, message: '请输入运费' }]}>
{dataInfo.status < 3 ? <Typography.Text>未报价</Typography.Text> : <Typography.Text>{item.value && `¥${(item.value).toFixed(2)}`}</Typography.Text>}
</Form.Item>
)}
</>
} }
</div> {item.key === 'settlement' &&
<Form.Item label={item.title} name={item.key}>
<span>{item.value}</span>
</Form.Item>}
</Form>
); );
}, },
)} )}
......
...@@ -196,7 +196,7 @@ const company: React.FC<parmas> = (props) => { ...@@ -196,7 +196,7 @@ const company: React.FC<parmas> = (props) => {
backIcon={<ReutrnEle description="返回" />} backIcon={<ReutrnEle description="返回" />}
title={headerTitle} title={headerTitle}
> >
<Row gutter={[36, 36]}> <Row>
<Col span={24}> <Col span={24}>
<Card> <Card>
{ {
......
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