Commit 7d6d2496 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

feat: 二次询价

parent d8ca1d03
......@@ -37,6 +37,14 @@ export default [
hideInMenu: true,
noMargin: true,
},
{
/** 二次询价 */
path: '/memberCenter/tranactionAbility/productInquiry/waitAddInquiry/two',
name: '二次询价',
hideInMenu: true,
noMargin: true,
component: '@/pages/transaction/dealAbility/productInquiry/waitAddInquiry/two'
},
// 立即询价 - 从商城跳转而来;
{
path: '/memberCenter/tranactionAbility/productInquiry/waitAddInquiry/rfq',
......
......@@ -8,12 +8,13 @@
// import MemberRoute from './memberRoute' // 会员能力路由
// import ShopRoute from './shopRoute' // 店铺能力路由
// import ChannelRoute from './channelRoute' // 渠道能力路由
import TranactionRoute from './tranactionRoute' // 交易能力路由
// import TranactionRoute from './tranactionRoute' // 交易能力路由
// import LogisticsRoute from './logisticsRoutes' // 物流能力路由
import PayandSettleRoute from './payandSettle' //支付与结算
// import PayandSettleRoute from './payandSettle' //支付与结算
// import AuthConfigRoute from './authConfigRoute'
// import AfterService from './afterServiceRoute' // 售后
// import HandlingRoute from './handlingRoute'; // 加工能力
import DealAbilityRoute from './dealAbilityRoute'; //
import asyncRoutes from '../router.config.json';
// import ProcurementRoute from './procurementRoute';
// import { callForBidsRoute } from './procurementRoute/callForBids';
......@@ -79,6 +80,7 @@ const memberCenterRoute = {
// HandlingRoute,
// PayandSettleRoute,
// marketingRoute,
DealAbilityRoute,
...asyncRoutes,
{
path: '/memberCenter/noAuth',
......
This diff is collapsed.
......@@ -29,7 +29,7 @@ const InquirySearch = () => {
setAuth(res.data);
setRouters(res.data.urls);
setTimeout(() => {
window.location.replace(`/memberCenter/tranactionAbility/productInquiry/waitAddInquiry/add?id=${id}`);
window.location.replace(`/memberCenter/tranactionAbility/productInquiry/waitAddInquiry/two?id=${id}`);
}, 800);
}).catch(err => {})
}
......@@ -84,7 +84,7 @@ const InquirySearch = () => {
{record.isShowQuote && (
<Button onClick={() => history.push(`/memberCenter/tranactionAbility/inquiryOffer/waitAddOffer/offer?id=${record.id}`)} type='link'>报价</Button>
)}
{record.isShowSecondInquiry && (
{(record.isShowSecondInquiry) && (
<Button type='link' onClick={() => secondInquiry(record.id)}>二次询价</Button>
)}
</>
......
import React, { useState, Fragment, useEffect } from "react";
import React, { useState, Fragment, useEffect, useCallback } from "react";
import { Form, Button, message } from "antd";
import { history, Prompt } from 'umi';
import moment from 'moment';
......@@ -10,6 +10,7 @@ import { SaveOutlined } from "@ant-design/icons";
import AttachLayout from "./components/attach";
import { getCookie } from '@/utils/cookie'
import { PublicApi } from "@/services/api";
import { isEmpty } from "lodash";
const layout: any = {
colon: false,
......@@ -28,10 +29,12 @@ interface AddedFormLayoutProps {
spam?: string,
/** 标题 */
title?: string,
/** 二次询价 */
two?: boolean,
}
const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
const { isEdit, id, fetchRequest, spam, title } = props;
const { isEdit, id, fetchRequest, spam, title, two } = props;
const [form] = Form.useForm();
const [loading, setLoading] = useState<boolean>(false)
const [unsaved, setUnsaved] = useState<boolean>(false);
......@@ -61,8 +64,8 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
otherRequire: res.otherRequire,
enclosureUrls: res.enclosureUrls,
inquiryListProductRequests: res.inquiryListProductRequests,
contacts: res.contacts,
contactsPhone: res.contactsPhone,
contactName: res.contactName,
contactPhone: res.contactPhone,
phoneCode: res.phoneCode,
shopId: res.shopId,
}
......@@ -100,7 +103,6 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
}
const getFullAddress = (info) => {
console.log(info)
const address = {
fullAddress: `${info.name} ${info.fullAddress} ${info.phone}`,
fullAddressId: info.id,
......@@ -141,60 +143,96 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
const getContacts = (value) => {
form.setFieldsValue({
"contacts": value.name,
'contactsPhone': value.phone,
'phoneCode': 86,
"contactName": value.name,
'contactPhone': value.phone,
'phoneCode': value.phoneCode,
});
}
const init = async () => {
if (isEdit && spam) {
// const data: any = JSON.parse(sessionStorage.getItem(spam));
const data: any = await getCacheOrderInfoByKey(spam)
if (!data) return
/** B端跳来询价 */
const handleB2B = async () => {
const data: any = await getCacheOrderInfoByKey(spam)
if (!data) return
const inquiryListProductRequests: any[] = [];
inquiryListProductRequests.push({
commodityId: id,
productId: data.id,
imgUrl: data.imgUrl,
productName: data.name,
category: data.category,
brand: data.brand.name,
unit: data.unitName,
purchaseCount: 1,
logistics: data.logistics,
memberId: data.memberId,
memberRoleId: data.memberRoleId,
taxRate: data.taxRate,
})
setMenberInfo({
memberId: data.memberId,
roleId: data.memberRoleId,
roleName: data.memberName,
})
form.setFieldsValue({
...data,
logistics: '',
"inquiryListProductRequests": inquiryListProductRequests
})
setInquiryProduct(inquiryListProductRequests)
}
/** 二次询价 */
const handleInquiry = async () => {
await PublicApi.getTransactionInquiryListDetails({ id }).then(res => {
if (res.code !== 1000) {
return
}
const { data } = res;
const inquiryListProductRequests: any[] = [];
inquiryListProductRequests.push({
commodityId: id,
productId: data.id,
imgUrl: data.imgUrl,
productName: data.name,
category: data.category,
brand: data.brand.name,
unit: data.unitName,
purchaseCount: 1,
logistics: data.logistics,
memberId: data.memberId,
memberRoleId: data.memberRoleId,
taxRate: data.taxRate,
})
setMenberInfo({
memberId: data.memberId,
roleId: data.memberRoleId,
roleName: data.memberName,
})
form.setFieldsValue({
...data,
logistics: '',
"inquiryListProductRequests": inquiryListProductRequests
})
setInquiryProduct(inquiryListProductRequests)
} else if (isEdit) {
PublicApi.getTransactionInquiryListDetails({ id }).then(res => {
if (res.code !== 1000) {
return
}
const { data } = res;
setEnclosureUrls(data.enclosureUrls)
setFullAddress()
if (two) {
PublicApi.getTransactionInquiryGetUpperMemberCommodity({ inquiryId: id }).then(res => {
if (res.code !== 1000) {
return
}
res.data.commodityList.forEach(item => {
inquiryListProductRequests.push({
commodityId: item.commodityId,
productId: item.goodsId,
imgUrl: item.mainPic,
productName: item.name,
category: item.customerCategoryName,
brand: item.brandName,
unit: item.unitName,
purchaseCount: 1,
logistics: '',
memberId: item.memberId,
memberRoleId: item.memberRoleId,
taxRate: item.taxRate
})
})
setMenberInfo({
memberId: res.data.memberId,
roleId: res.data.memberRoleId,
roleName: res.data.memberName,
})
setInquiryProduct(inquiryListProductRequests)
})
form.setFieldsValue({
...data,
deliveryTime: moment(data.deliveryTime),
quotationAsTime: moment(data.quotationAsTime),
"inquiryListProductRequests": inquiryListProductRequests,
"enclosureUrls": data.enclosureUrls,
})
} else {
setMenberInfo({
memberId: data.memberId,
roleId: data.memberRoleId,
roleName: data.memberName,
})
setFullAddress({
fullAddress: data.fullAddress,
fullAddressId: data.fullAddressId,
})
setInquiryProduct(data.inquiryListProductRequests)
setEnclosureUrls(data.enclosureUrls)
form.setFieldsValue({
...res.data,
deliveryTime: moment(data.deliveryTime),
......@@ -202,14 +240,21 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
"inquiryListProductRequests": data.inquiryListProductRequests,
"enclosureUrls": data.enclosureUrls,
})
}).catch(error => {
console.warn(error)
})
}
}
})
}
/** 回显数据 */
const handleEcho = useCallback(async () => {
if (isEdit && spam) {
handleB2B();
} else if (isEdit) {
handleInquiry()
}
}, [isEdit])
useEffect(() => {
init()
handleEcho()
}, [isEdit])
return (
......@@ -244,7 +289,7 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
}
}}
>
<BasicInfoLatyout getMemberInfo={getMemberInfo} memb={memberInfo} isEdit={spam} />
<BasicInfoLatyout getMemberInfo={getMemberInfo} memb={memberInfo} isEdit={spam || two} />
<InquiryProductLayout getInquiryProduct={getInquiryProduct} member={memberInfo} setInquiryProduct={inquiryProduct} />
<TradeTermsLayout getFullAddress={getFullAddress} getContacts={getContacts} fullAddress={fullAddress} />
<AttachLayout enclosureUrls={enclosureUrls} getEnclosureUrls={getEnclosureUrls} removeEnclosureUrls={removeEnclosureUrls} />
......
......@@ -58,7 +58,6 @@ const BasicInfoLayout: React.FC<BasicInfoLayoutProps> = (props: any) => {
let shopList = GlobalConfig.web.shopInfo.filter(v => (v.type == 1 && v.environment == 1)).map(
v => v
)
console.log(shopList, 962039)
setStoreList(shopList)
}, [])
......@@ -94,7 +93,6 @@ const BasicInfoLayout: React.FC<BasicInfoLayoutProps> = (props: any) => {
useEffect(() => {
if (!isEmpty(memb)) {
console.log(memb, 'memb')
setMember(memb)
}
}, [memb])
......
......@@ -85,6 +85,10 @@ const TradeTermsLayout: React.FC<TradeTermsLayoutProps> = (props: any) => {
}
useEffect(() => {
fetchTelCode()
}, [])
useEffect(() => {
if (!isEmpty(fullAddress)) {
setaddress({
id: fullAddress.fullAddressId,
......@@ -133,10 +137,11 @@ const TradeTermsLayout: React.FC<TradeTermsLayoutProps> = (props: any) => {
<Form.Item
name='phoneCode'
rules={[{ required: true, message: '请选择' }]}
initialValue={telCode[0]}
>
<Select>
{telCode.map(item => (
<Select.Option value={item}>{item}</Select.Option>
<Select.Option key={item} value={item}>{item}</Select.Option>
))}
</Select>
</Form.Item>
......
import React, { useCallback, useEffect, useState } from 'react';
import AddForm from './addForm';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { isEmpty } from 'lodash';
const RfqEnquiryOrder = (props: any) => {
const { id } = history.location.query;
const [spam, setSpam] = useState<any>({});
const handleGetSpam = useCallback(async () => {
await PublicApi.getTransactionInquiryGetUpperMemberCommodity({ inquiryId: id }).then(res => {
if (res.code !== 1000) {
return
}
setSpam(res.data)
})
}, [])
useEffect(() => {
handleGetSpam()
}, [])
return (
<AddForm
id={id}
isEdit
title={props.route.name}
fetchRequest={PublicApi.postTransactionInquiryListAdd}
two
/>
)
}
export default RfqEnquiryOrder;
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