Commit 71f6a580 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

修改商品询价BUG

parent 04493318
......@@ -27,6 +27,13 @@ export default [
name: 'addEnquiryOrder',
component: '@/pages/transaction/goodsOffer/addEnquiryOrder'
},
// 立即询价 - 从商城跳转而来;
{
path: '/memberCenter/tranactionAbility/goodsOffer/addEnquiryOrder/rfq',
name: 'rfq',
hideInMenu: true,
component: '@/pages/transaction/goodsOffer/addEnquiryOrder/rfq'
},
// 新建询价单
{
path: '/memberCenter/tranactionAbility/goodsOffer/addEnquiryOrder/add',
......@@ -39,7 +46,7 @@ export default [
path: '/memberCenter/tranactionAbility/goodsOffer/addEnquiryOrder/edit',
name: 'edit',
hideInMenu: true,
component: '@/pages/transaction/goodsOffer/addEnquiryOrder/add'
component: '@/pages/transaction/goodsOffer/addEnquiryOrder/edit'
},
// 待新增询价单详情
{
......
......@@ -171,6 +171,7 @@ export default {
'menu.tranactionAbility.goodsOffer.enquiryOrder': '询价单查询',
'menu.tranactionAbility.goodsOffer.enquiryOrderDetails': '询价单查询详情',
'menu.tranactionAbility.goodsOffer.addEnquiryOrder': '待新增询价单',
'menu.tranactionAbility.goodsOffer.rfq': '立即询价',
'menu.tranactionAbility.goodsOffer.add': '新建询价单',
'menu.tranactionAbility.goodsOffer.edit': '编辑询价单',
'menu.tranactionAbility.goodsOffer.addEnquiryOrderDetails': '待新增询价详情',
......
......@@ -501,7 +501,7 @@ const CommodityDetail = (props) => {
}
const handleInquiry = () => {
window.location.href = `/memberCenter/tranactionAbility/goodsOffer/addEnquiryOrder/add?id=${id}&memberId=${memberId}`
window.location.href = `/memberCenter/tranactionAbility/goodsOffer/addEnquiryOrder/rfq?id=${id}&memberId=${memberId}`
}
/**
......
import React, { useState, useRef, useEffect } from 'react';
import React from 'react';
import AddForm from './addForm';
import { history } from 'umi';
import { Button, Card, Tabs, message } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ReutrnEle from '@/components/ReturnEle';
import BasicInfo from './components/basicInfo'; // 基本信息
import EnquiryGoods from './components/enquiryGoods'; // 询价商品
import TradingConditions from './components/tradingConditions'; // 交易条件
import Attached from './components/attached'; // 附件
import FlowRecord from './components/flowRecord'; // 流转记录
import { PublicApi } from '@/services/api'
const { TabPane } = Tabs;
const AddQuotes: React.FC<{}> = () => {
const { id } = history.location.query;
const [count, setCount] = useState<string>('1');
const [memberList, setmemberList] = useState([]); //存放用户信息
const [goodsList, setgoodsList] = useState([]); //存放商品
const basicInfoRef = useRef<any>({});
const tradingConditionsRef = useRef<any>({});
const [editData, setEditData] = useState<any>({});
const [address, setaddress] = useState<any>({});
const [enclosureUrls, setenclosureUrls] = useState<any>([]);
const handleGetDetails = async () => {
await PublicApi.getOrderInquiryListDetails({ id }).then(res => {
if (res.code === 1000) {
setgoodsList(res.data.inquiryListProductRequests);
setEditData(res.data)
}
})
}
useEffect(() => {
console.log(history.location)
if (id) {
handleGetDetails();
setCount('3');
}
}, [])
//提交
const onSumbit = async (params: any) => {
const basicInfo = await basicInfoRef.current.validateFields();
if (count === '3') {
const tradingConditions = await tradingConditionsRef.current.validateFields();
const basicInfoData = basicInfo.data;
const tradingConditionsData = tradingConditions.data;
if (basicInfo.state && tradingConditions.state) {
const parmas = {
inquiryListProductRequests: goodsList, // 商品列表 ,InquiryListProductRequest
...basicInfoData,
...tradingConditionsData,
...address,
enclosureUrls,
memberName: memberList[0].name,
memberId: memberList[0].memberId
}
if (id) {
parmas.id = editData.id;
parmas.interiorInquiryListLogResponses = editData.interiorInquiryListLogResponses;
parmas.externalInquiryListLogResponses = editData.externalInquiryListLogResponses;
await PublicApi.postOrderInquiryListUpdate(parmas).then(res => {
if (res.code === 1000) {
history.goBack();
}
})
} else {
await PublicApi.postOrderInquiryListAdd(parmas).then(res => {
if (res.code === 1000) {
history.goBack();
}
})
}
} else {
message.error('有必填字段没选择,请检查!');
}
}else {
message.error('有必填字段没选择,请检查!');
}
}
// 获取到会员信息
const getMemberList = (list: any) => {
setmemberList(list);
}
// 获取添加的商品列表
const getGoodsList = (list: any) => {
setgoodsList(list)
}
const handleClick = (key: string) => {
if (key === '3') {
setCount(key)
}
}
// 地址回调
const handleGetAddress = (value: any) => {
setaddress({
fullAddress: value.children,
fullAddressId: value.value
})
}
// 附件回调
const handleGetEnclosureUrls = (data: any) => {
setenclosureUrls(data)
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
extra={
<Button type="primary" onClick={onSumbit}> 保存</Button>
}
>
<Card>
<Tabs onTabClick={handleClick}>
<TabPane tab="基本信息" key="1">
<BasicInfo
currentRef={basicInfoRef}
getMemberList={getMemberList}
editData={editData}
/>
</TabPane>
<TabPane tab="询价商品" key="2">
<EnquiryGoods
memberList={memberList}
getGoodsList={getGoodsList}
editData={editData}
/>
</TabPane>
<TabPane tab="交易条件" key="3">
<TradingConditions
currentRef={tradingConditionsRef}
editData={editData}
getAddress={handleGetAddress}
/>
</TabPane>
<TabPane tab="附件" key="4">
<Attached
editData={editData}
handleGetEnclosureUrls={handleGetEnclosureUrls}
/>
</TabPane>
<TabPane tab="流转记录" key="5">
<FlowRecord
editData={editData}
/>
</TabPane>
</Tabs>
</Card>
</PageHeaderWrapper>
const AddEnquiryOrder:React.FC<{}> = () => {
return(
<AddForm
type={1}
/>
)
}
export default AddQuotes
\ No newline at end of file
export default AddEnquiryOrder;
\ No newline at end of file
import React, { useState, useRef, useEffect } from 'react';
import { history } from 'umi';
import { Button, Card, Tabs, message } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ReutrnEle from '@/components/ReturnEle';
import BasicInfo from './components/basicInfo'; // 基本信息
import EnquiryGoods from './components/enquiryGoods'; // 询价商品
import TradingConditions from './components/tradingConditions'; // 交易条件
import Attached from './components/attached'; // 附件
import FlowRecord from './components/flowRecord'; // 流转记录
import { PublicApi } from '@/services/api'
const { TabPane } = Tabs;
export interface parmas {
id?: any,
type?: any, // 1. 新增, 2.编辑, 3.立即询价
}
const AddQuotes: React.FC<parmas> = (props) => {
const {id, type} = props
const [count, setCount] = useState<string>('1');
const [member, setmember] = useState<any>({}); //存放用户信息
const [goodsList, setgoodsList] = useState([]); //存放商品
const basicInfoRef = useRef<any>({});
const tradingConditionsRef = useRef<any>({});
const [editData, setEditData] = useState<any>({});
const [address, setaddress] = useState<any>({});
const [enclosureUrls, setenclosureUrls] = useState<any>([]);
const handleGetDetails = async () => {
await PublicApi.getOrderInquiryListDetails({ id }).then(res => {
if (res.code === 1000) {
setgoodsList(res.data.inquiryListProductRequests);
setEditData(res.data)
}
})
}
useEffect(() => {
if (id && type === 2) {
handleGetDetails();
setCount('3');
}
}, [])
//提交
const onSumbit = async (params: any) => {
const basicInfo = await basicInfoRef.current.validateFields();
if (count === '3') {
const tradingConditions = await tradingConditionsRef.current.validateFields();
const basicInfoData = basicInfo.data;
const tradingConditionsData = tradingConditions.data;
if (basicInfo.state && tradingConditions.state) {
const parmas = {
inquiryListProductRequests: goodsList, // 商品列表 ,InquiryListProductRequest
...basicInfoData,
...tradingConditionsData,
...address,
enclosureUrls,
memberName: member.name,
memberId: member.memberId
}
if (id && type === 2) {
parmas.id = editData.id;
parmas.interiorInquiryListLogResponses = editData.interiorInquiryListLogResponses;
parmas.externalInquiryListLogResponses = editData.externalInquiryListLogResponses;
await PublicApi.postOrderInquiryListUpdate(parmas).then(res => {
if (res.code === 1000) {
history.goBack();
}
})
} else {
await PublicApi.postOrderInquiryListAdd(parmas).then(res => {
if (res.code === 1000) {
history.goBack();
}
})
}
} else {
message.error('有必填字段没选择,请检查!');
}
}else {
message.error('有必填字段没选择,请检查!');
}
}
// 获取到会员信息
const getMemberList = (list: any) => {
setmember(list);
}
// 获取添加的商品列表
const getGoodsList = (list: any) => {
setgoodsList(list)
}
const handleClick = (key: string) => {
if (key === '3') {
setCount(key)
}
}
// 地址回调
const handleGetAddress = (value: any) => {
setaddress({
fullAddress: value.children,
fullAddressId: value.value
})
}
// 附件回调
const handleGetEnclosureUrls = (data: any) => {
setenclosureUrls([...enclosureUrls,...data]);
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
extra={
<Button type="primary" onClick={onSumbit}> 保存</Button>
}
>
<Card>
<Tabs onTabClick={handleClick}>
<TabPane tab="基本信息" key="1" forceRender>
<BasicInfo
currentRef={basicInfoRef}
getMemberList={getMemberList}
editData={editData}
/>
</TabPane>
<TabPane tab="询价商品" key="2" forceRender>
<EnquiryGoods
member={member}
getGoodsList={getGoodsList}
editData={editData}
/>
</TabPane>
<TabPane tab="交易条件" key="3" forceRender>
<TradingConditions
currentRef={tradingConditionsRef}
editData={editData}
getAddress={handleGetAddress}
/>
</TabPane>
<TabPane tab="附件" key="4" forceRender>
<Attached
editData={editData}
handleGetEnclosureUrls={handleGetEnclosureUrls}
/>
</TabPane>
<TabPane tab="流转记录" key="5" forceRender>
<FlowRecord
editData={editData}
/>
</TabPane>
</Tabs>
</Card>
</PageHeaderWrapper>
)
}
export default AddQuotes
\ No newline at end of file
......@@ -19,6 +19,7 @@ export interface parmas {
const Attached: React.FC<parmas> = (props) => {
const { handleGetEnclosureUrls, editData } = props;
const [files, setFiles] = useState([]);
const [loading, setloading] = useState(false);
/**判断文件类型和大小 */
const beforeDocUpload = (file: UploadFile) => {
const isLt20M = file.size / 1024 / 1024 < 20;
......@@ -28,19 +29,19 @@ const Attached: React.FC<parmas> = (props) => {
return isLt20M;
}
// 上传回调
const handleChange = ({ fileList }) => {
const handleChange = ({ file }) => {
const arr: any = [];
fileList.forEach(v => {
if (v.response) {
if (v.response.code === 1000) {
arr.push({
name: v.name,
url: v.response.data
})
}
setloading(true);
if (file.response) {
if (file.response.code === 1000) {
arr.push({
name: file.name,
url: file.response.data
})
setloading(false);
}
})
setFiles(arr)
}
setFiles([...files, ...arr])
handleGetEnclosureUrls(arr);
}
// 删除附件
......@@ -51,7 +52,7 @@ const Attached: React.FC<parmas> = (props) => {
handleGetEnclosureUrls(arr);
}
useEffect(() => {
if(Object.keys(editData).length > 0) {
if (Object.keys(editData).length > 0) {
setFiles(editData.enclosureUrls)
}
}, [editData])
......@@ -83,7 +84,7 @@ const Attached: React.FC<parmas> = (props) => {
beforeUpload={beforeDocUpload}
onChange={handleChange}
>
<Button icon={<UploadOutlined />}>上传文件</Button>
<Button loading={loading} icon={<UploadOutlined />}>上传文件</Button>
<div style={{ marginTop: '8px' }}>一次上传一个文件,每个附件大小不能超过 20M</div>
</Upload>
</Form.Item>
......
......@@ -27,13 +27,18 @@ const BasicInfo: React.FC<queryProps> = (props) => {
const { getMemberList, currentRef, editData } = props;
// 会员添加弹窗控制
const [visibleChannelMember, setVisibleChannelMember] = useState(false);
const [memberList, setmemberList] = useState([]);
const [memberName, setmemberName] = useState<any>();
const [memberId, setmemberId] = useState<any>();
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'memberId', type: 'radio' });
const handleOkAddMember = () => {
setVisibleChannelMember(false)
console.log(memberRowCtl.selectRow)
setmemberList(memberRowCtl.selectRow);
getMemberList(memberRowCtl.selectRow); // 回传给父级
const memberInfo = {
name: memberRowCtl.selectRow[0].name,
memberId: memberRowCtl.selectRow[0].memberId
}
setmemberId(memberRowCtl.selectRow[0].memberId)
setmemberName(memberRowCtl.selectRow[0].name);
getMemberList(memberInfo); // 回传给父级
}
const handleCancelAddMember = () => {
setVisibleChannelMember(false)
......@@ -77,44 +82,21 @@ const BasicInfo: React.FC<queryProps> = (props) => {
}
}
}
// 模拟数据
// const data = {
// totalCount: 2,
// data: [{
// memberId: 6,
// name: '测试会员数据',
// roleId: 5,
// roleName: '可可西',
// memberTypeName: '超级会员',
// level: 1,
// levelTag: '倔强铂金'
// },{
// memberId: 7,
// name: '测试会员数据',
// roleId: 5,
// roleName: '可可西',
// memberTypeName: '超级会员',
// level: 1,
// levelTag: '倔强铂金'
// }]
// }
// 请求
const fetchMemberList = async (params) => {
console.log(params)
return new Promise((resolve, reject) => {
PublicApi.getMemberManagePlatformProviderPage({...params}).then(res => {
resolve(res.data)
})
// setTimeout(() => {
// resolve(data);
// }, 500);
});
}
// 选择会员弹框结束
useEffect(() => {
if(memberList.length > 0) {
basicform.setFieldsValue({'memberName': memberList[0].name ? memberList[0].name : undefined})
if(memberName) {
basicform.setFieldsValue({'memberId': memberId ? 14 : undefined})
}
},[memberList])
},[memberName])
/************* 页面的一些操作start *************/
// 拿到表单数据
......@@ -125,7 +107,7 @@ const BasicInfo: React.FC<queryProps> = (props) => {
state: true,
data: {
details: values.details,
memberName: values.memberName,
memberId: values.memberId,
}
})
}).catch(errorInfo => {
......@@ -149,8 +131,10 @@ const BasicInfo: React.FC<queryProps> = (props) => {
useEffect(() => {
if(Object.keys(editData).length > 0) {
console.log(12131)
basicform.setFieldsValue({
details: editData.details
details: editData.details,
memberId: 14
})
}
}, [editData])
......@@ -166,9 +150,9 @@ const BasicInfo: React.FC<queryProps> = (props) => {
<Form.Item label='询价单摘要' name='details' rules={[{ required: true, message: '请输入询价单摘要' }]}>
<Input />
</Form.Item>
<Form.Item label='被询价会员' name='memberName' rules={[{ required: true, message: '请选择被询价会员' }]}>
<Search value={memberList.length > 0 ? memberList[0].name : undefined} readOnly enterButton={<><LinkOutlined /> 选择</>} onSearch={()=>setVisibleChannelMember(true)} />
{memberList.length > 0 && <Button type='link'>查看会员详情</Button>}
<Form.Item label='被询价会员' name='memberId' rules={[{ required: true, message: '请选择被询价会员' }]}>
<Search value={memberName ? memberName : undefined} readOnly enterButton={<><LinkOutlined /> 选择</>} onSearch={()=>setVisibleChannelMember(true)} />
{memberName && <Button type='link'>查看会员详情</Button>}
</Form.Item>
<Form.Item label='询价单号' name='orderNumber'>
<span>{Object.keys(editData).length > 0 ? editData.inquiryListNo : '-'}</span>
......
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Button, message, Input, Table, Form } from 'antd';
import { Button, message, InputNumber, Table, Form } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import { PlusOutlined } from '@ant-design/icons';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
......@@ -14,14 +14,14 @@ import Search from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit'
interface queryProps extends ModalTableProps {
memberList?: any,
member?: any,
schemaAction?: ISchemaFormActions | ISchemaFormAsyncActions,
getGoodsList: Function,
editData: any
}
const EnquiryGoods: React.FC<queryProps> = (props) => {
const { memberList, schemaAction, getGoodsList, editData, ...restProps } = props
const { member, schemaAction, getGoodsList, editData, ...restProps } = props
const [value, setValue] = useState<any>('')
const productFormActions = createAsyncFormActions()
const onChange = (value) => {
......@@ -31,7 +31,9 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
const [visibleChannelMember, setVisibleChannelMember] = useState(false);
const [goodsList, setgoodsList] = useState([]);
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'id' });
const [customerCategory, setcustomerCategory] = useState([]);
const [brand, setbrand] = useState([]);
const handleOkAddMember = () => {
setVisibleChannelMember(false);
const arr: any[] = []
......@@ -42,7 +44,7 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
inquiryListNo: v.customerCategoryName,
brand: v.brandName,
nuit: v.unitName,
purchaseQuantity: 0
purchaseQuantity: 1
})
setgoodsList(arr)
......@@ -99,17 +101,37 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
},
},
properties: {
customerCategoryName: {
customerCategoryId: {
type: 'string',
"x-component-props": {
placeholder: '请输入品类',
}
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '请选择品类',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px', lineHeight: '32px' },
searchValue: null,
dataoption: []
},
enum: customerCategory
},
brandName: {
brandId: {
type: 'string',
"x-component-props": {
placeholder: '请输入品牌',
}
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '请选择品牌',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px', lineHeight: '32px' },
searchValue: null,
dataoption: []
},
enum: brand
},
submit: {
"x-component": 'Submit',
......@@ -126,9 +148,9 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
}
/**输入框输入 */
const inputOnchange = (id, e) => {
const {value} = e.target
const { value } = e.target
goodsList.forEach(v => {
if(v.productId === id) {
if (v.productId === id) {
v.purchaseQuantity = value
}
})
......@@ -156,9 +178,9 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
dataIndex: 'purchaseQuantity',
render: (text: any, record: any) => (
<Form.Item name={record.productId} noStyle initialValue={record.purchaseQuantity}>
<Input
<InputNumber
onBlur={(e) => inputOnchange(record.productId, e)}
type='number'
min={1}
maxLength={25}
/>
</Form.Item>
......@@ -168,11 +190,11 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
dataIndex: 'operation',
render: (text: any, record: any) => <Button type='link' onClick={() => handleDelete(record)}>删除</Button>
}]
const fetchGoodsList = (params) => {
return new Promise((resolve, reject) => {
PublicApi.getProductCommodityCommonGetCommodityListByBuyer({...params,priceTypeList: 2,memberId:memberList[0].memberId, shopType: 1 }).then(res => {
if(res.code === 1000) {
PublicApi.getProductCommodityCommonGetCommodityListByBuyer({ ...params, priceTypeList: 2, memberId: member.memberId, shopType: 1 }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
......@@ -181,14 +203,15 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
// 选择会员弹框结束
useEffect(() => {
console.log(member)
// 重选会员清掉已选择的商品
setgoodsList([]);
memberRowCtl.setSelectRow(goodsList)
memberRowCtl.setSelectedRowKeys(goodsList.map(v => v.productId))
}, [memberList])
}, [member])
// 添加商品
const addGoods = () => {
if (memberList.length > 0 && memberList[0].memberId) {
if (member.name && member.memberId) {
setVisibleChannelMember(true);
} else {
message.error('请选择被询价会员')
......@@ -208,11 +231,26 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
// 编辑时回显的数据
useEffect(() => {
if(Object.keys(editData).length > 0) {
if (Object.keys(editData).length > 0) {
setgoodsList(editData.inquiryListProductRequests);
}
}, [])
useEffect(() => {
if (visibleChannelMember) {
PublicApi.getProductSelectGetSelectCustomerCategory({ name }).then(res => {
if (res.code === 1000) {
setcustomerCategory(res.data)
}
})
PublicApi.getProductSelectGetSelectBrand({ name }).then(res => {
if (res.code === 1000) {
setbrand(res.data)
}
})
}
}, [visibleChannelMember])
return (
<div className={styles.revise_style}>
<Button block type='dashed' onClick={addGoods}><PlusOutlined />添加商品</Button>
......
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import moment from 'moment';
import { Form, Input, Select, Row, Col, DatePicker } from 'antd';
import { Form, Input, Select, Row, Col, DatePicker, message } from 'antd';
import { PublicApi } from '@/services/api';
interface queryProps {
......@@ -26,18 +26,18 @@ const TradingConditions: React.FC<queryProps> = (props) => {
resolve({
state: true,
data: {
deliveryTime: moment(values.deliveryTime).unix(),
quotationAsTime: moment(values.quotationAsTime).unix(),
deliveryTime: moment(values.deliveryTime).format('x'),
quotationAsTime: moment(values.quotationAsTime).format('x'),
offer: values.offer,
paymentType: values.paymentType,
taxes: values.taxes,
logistics: values.logistics,
packRequire: values.logistics,
otherRequire: values.logistics,
packRequire: values.packRequire,
otherRequire: values.otherRequire,
}
})
}).catch(errorInfo => {
console.log(errorInfo)
message.error('有必填字段没选择,请检查!');
})
})
}
......@@ -66,8 +66,8 @@ const TradingConditions: React.FC<queryProps> = (props) => {
packRequire: editData.packRequire,
otherRequire: editData.otherRequire,
offer: editData.offer,
quotationAsTime: moment(editData.quotationAsTime).format("x"),
deliveryTime: moment(editData.deliveryTime).format("x"),
quotationAsTime: moment(editData.quotationAsTime),
deliveryTime: moment(editData.deliveryTime),
fullAddressId: editData.fullAddressId,
})
}
......
import React from 'react';
import AddForm from './addForm';
import { history } from 'umi';
const EditEnquiryOrder:React.FC<{}> = () => {
const { id } = history.location.query;
console.log(id)
return(
<AddForm
id={id}
type={2}
/>
)
}
export default EditEnquiryOrder;
\ No newline at end of file
import React from 'react';
import AddForm from './addForm';
import { history } from 'umi';
const RfqEnquiryOrder:React.FC<{}> = () => {
const { id } = history.location.query;
console.log(id)
return(
<AddForm
id={id}
type={3}
/>
)
}
export default RfqEnquiryOrder;
\ No newline at end of file
......@@ -86,62 +86,7 @@ const Details: React.FC<parmas> = (props) => {
}
})
// 模拟数据
const [data, setdata] = useState<any>({
id: 91,
inquiryListNo: 'SD2015PPLJ',
quotationNo: 'BPTY12',
details: '阿珍爱上阿强',
memberName: 'wutiaoren',
deliveryTime: '2020-10-14 15:37:00',
quotationAsTime: '2020-10-13 15:37:00',
voucherTime: '2020-10-13 15:37:00',
externalState: 1,
interiorState: 2,
fullAddress: '东莞市石龙镇西葫芦53号',
offer: '报价要求',
paymentType: '付款方式',
taxes: '税费要求',
logistics: '物流要求',
packRequire: '包装要求',
otherRequire: '其他要求',
minimumOrder: 1000,
inquiryListProductRequests: [{
id: 1,
productId: 10,
productName: 'APPLE Pro Max 12',
inquiryListNo: '智能手机',
brand: 'APPLE',
nuit: '台',
purchaseQuantity: 1,
productQuotationId: 20,
money: 8699,
pric: 8699
}],
externalInquiryListLogResponses: [{
id: 200,
inquiryListId: 63,
roleName: '管理员',
state: 1,
operation: '操作',
operationTime: '2020-10-13 15:37:00',
auditOpinion: '通过'
}],
interiorInquiryListLogResponses: [{
id: 200,
inquiryListId: 63,
roleName: '管理员',
state: 1,
operation: '操作',
operationTime: '2020-10-13 15:37:00',
auditOpinion: '通过',
department: '销售部',
position: '经理'
}],
enclosureUrls: [{
name: '我是附件.doc',
url: 'http://www.hao123.com'
}]
});
const [data, setdata] = useState<any>({});
// 询价商品
const inquiryGoods: ColumnType<any>[] = [{
title: 'ID',
......@@ -205,6 +150,16 @@ const Details: React.FC<parmas> = (props) => {
],
},
}
// 详情请求
useEffect(() => {
new Promise((resolve, reject) => {
PublicApi.getOrderInquiryListDetails({ id }).then(res => {
if (res.code === 1000) {
setdata(res.data)
}
})
})
}, [])
// 外部流转记录&内部流转记录
const flowRecord = {
external: [{
......@@ -219,6 +174,7 @@ const Details: React.FC<parmas> = (props) => {
title: '状态',
key: 'state',
dataIndex: 'state',
render: (text: any, record: any) => externalTextState(text)
}, {
title: '操作',
key: 'operation',
......@@ -252,6 +208,7 @@ const Details: React.FC<parmas> = (props) => {
title: '状态',
key: 'state',
dataIndex: 'state',
render: (text: any, record: any) => interiorTextState(text)
}, {
title: '操作',
key: 'operation',
......@@ -266,15 +223,7 @@ const Details: React.FC<parmas> = (props) => {
dataIndex: 'auditOpinion',
}],
}
// 详情请求
useEffect(() => {
PublicApi.getOrderInquiryListDetails({ id }).then(res => {
if (res.code === 1000) {
setdata(res.data)
}
})
}, [])
// 添加商品数据组合
useEffect(() => {
if (Object.keys(data).length > 0) {
// 组合数据
......@@ -301,6 +250,37 @@ const Details: React.FC<parmas> = (props) => {
}, 1000)
}
/**
* @description: 外部流转记录
* @param {type}
* @return {type}
*/
const externalTextState = (text) => {
let name = ''
console.log(data)
data.externalRequisitionFormStateResponses.forEach(element => {
if (element.state === text) {
name = element.operationalProcess
}
})
return <>{name}</>
}
/**
* @description: 内部流转记录
* @param {type}
* @return {type}
*/
const interiorTextState = (text) => {
let name = ''
data.interiorRequisitionFormStateResponses.forEach(element => {
if (element.state === text) {
name = element.operationalProcess
}
})
return <>{name}</>
}
return (
<PageHeaderWrapper
className={style.header}
......@@ -321,7 +301,7 @@ const Details: React.FC<parmas> = (props) => {
{
((Number(page_type) === 2 || Number(page_type) === 3) && (data.interiorState === 2 || data.interiorState === 4)) &&
<>
<Button type='primary' className={style['saveBtn']} onClick={() => {setvisible(true)}}>
<Button type='primary' className={style['saveBtn']} onClick={() => { setvisible(true) }}>
<CheckSquareOutlined />单据审核
</Button>
</>
......@@ -348,8 +328,8 @@ const Details: React.FC<parmas> = (props) => {
{item.name === 'externalState' ?
inquiryQuoteOuterState(item.value) :
item.name === 'interiorState' ?
quoteOrderInternalState(item.value) :
item.value}
quoteOrderInternalState(item.value) :
item.value}
</div>
</div>
))}
......@@ -357,13 +337,13 @@ const Details: React.FC<parmas> = (props) => {
</div >
}
>
<Card className={style.item_wrap}>
<div className={style.item_wrap}>
<Tabs>
<TabPane tab="外部流转" key="1">
<Steps
style={{ padding: '20px 0' }}
progressDot
current={1}
current={Number(data.externalState - 1)}
>
{detailData.externalStateStep.items.map((item, index) => {
return (
......@@ -380,7 +360,7 @@ const Details: React.FC<parmas> = (props) => {
<Steps
style={{ padding: '20px 0' }}
progressDot
current={0}
current={Number(data.interiorState - 1)}
>
{detailData.interiorStateStep.items.map((item, index) => {
return (
......@@ -394,12 +374,12 @@ const Details: React.FC<parmas> = (props) => {
</Steps>
</TabPane>
</Tabs>
</Card>
<Card className={style.item_wrap}>
</div>
<div className={style.item_wrap}>
<div className={style.mainCol_title}>询价商品</div>
<Table columns={inquiryGoods} pagination={false} rowKey='id' dataSource={data.inquiryListProductRequests} />
</Card>
<Card className={style.item_wrap}>
</div>
<div className={style.item_wrap}>
<div className={style.mainCol_title}>{infoTem[(Number(page_type) === 1 || Number(page_type) === 5) ? 'freight' : 'base'].title}</div>
<div className={style['mainCol-rows']}>
<div className={style['mainCol-rows-cols']}>
......@@ -449,13 +429,13 @@ const Details: React.FC<parmas> = (props) => {
)}
</div>
</div>
</Card>
<Card className={style.item_wrap}>
</div>
<div className={style.item_wrap}>
<div className={style.mainCol_title}>附件</div>
{/* <div className={style.upload_data}>
<div className={style.upload_data}>
{
data.enclosureUrls &&
data.enclosureUrls.map((v,i) => (
data.enclosureUrls.map((v, i) => (
<div key={i} className={style.upload_item}>
<div className={style.upload_left}>
<LinkOutlined />
......@@ -464,9 +444,9 @@ const Details: React.FC<parmas> = (props) => {
</div>
))
}
</div> */}
</Card>
<Card className={style.item_wrap}>
</div>
</div>
<div className={style.item_wrap}>
<Tabs>
<TabPane tab="外部流转记录" key="1">
<Table columns={flowRecord.external} rowKey='id' pagination={false} dataSource={data.externalInquiryListLogResponses} />
......@@ -475,7 +455,7 @@ const Details: React.FC<parmas> = (props) => {
<Table columns={flowRecord.interior} rowKey='id' pagination={false} dataSource={data.interiorInquiryListLogResponses} />
</TabPane>
</Tabs>
</Card>
</div>
<AuditModal
id={id}
type={page_type}
......
......@@ -2,6 +2,7 @@
margin-bottom: 24px;
background-color: #FFF;
border-radius: 8px;
padding: 24px;
&:last-child {
margin-bottom: 0px;
......
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