Commit ad9c447f authored by XieZhiXiong's avatar XieZhiXiong
parents 8d44275a fc159cf6
......@@ -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.
import React, { useEffect, useState } from 'react'
import { Row, Col } from 'antd';
import styled from 'styled-components'
import { findItemAndDelete } from '@/utils'
import cx from 'classnames'
const RowStyleLayout = styled(props => <div {...props} />)`
.card-checkbox-item {
width: 130px;
height: 32px;
margin-right: 32px;
margin-bottom: 16px;
border:1px solid rgba(235,236,240,1);
padding: 0 16px;
display: flex;
align-items: center;
cursor: pointer;
}
.card-checkbox-item.active {
border-color: #00B382;
position: relative;
}
.card-checkbox-item.active::after {
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 0;
height: 0;
border: 6px solid transparent;
border-right: 6px solid #00B382;
border-bottom: 6px solid #00B382;
}
.card-logo {
display: block;
width: 20px;
height: 20px;
border-radius: 50%;
margin-right: 6px;
}
.card-checkbox-title {
font-size: 12px;
color: #606266;
}
`
interface IProps {
dataSource: any[],
cardChange: any,
name: string,
type?: string,
editable?: boolean,
}
const CardCheckBox = (props: IProps) => {
const { dataSource = [], type = 'checkbox', editable = true, cardChange, name } = props
const [value, setValue] = useState<any>([])
useEffect(() => {
let transport = {}
transport[name] = value[0]
cardChange(transport)
}, [value])
const handleChange = (id) => {
if (!editable) {
return false
}
if (value.includes(id)) {
const newValue = findItemAndDelete(value, id)
setValue(newValue)
} else {
// type === 'radio' ? props.mutators.change([id]) : props.mutators.change([...value, id])
type === 'radio' ? setValue([id]) : setValue([...value, id])
}
}
const isChecked = (id) => {
return value.includes(id)
}
return (
<RowStyleLayout>
<div className='card-checkbox'>
{
dataSource.map(({title, items}, index) => (
<Row key={index}>
<Col span={6}>
<p>{title}</p>
</Col>
<Col span={18}>
<Row>
{
items.length > 0 && items.map((v, i) =>
<Col key={v.id} className={cx('card-checkbox-item', isChecked(v.id) ? 'active' : '')} onClick={() => handleChange(v.id)}>
{v.logoUrl ? <img className='card-logo' src={v.logoUrl} /> : null}
<span className='card-checkbox-title'>{v.name}</span>
</Col>
)
}
</Row>
</Col>
</Row>
))
}
</div>
</RowStyleLayout>
)
}
CardCheckBox.defaultProps = {}
export default CardCheckBox
\ No newline at end of file
import React, {useEffect} from 'react'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useModalTable } from '../../model/useModalTable'
import ModalTable from '@/components/ModalTable'
import { columnsSetMember } from '../../constant'
import { PublicApi } from '@/services/api'
import {formSearch } from '../../schema'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import ModalSearch from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit'
import { PageStatus, usePageStatus } from '@/hooks/usePageStatus'
import { clearModalParams } from '@/utils'
export interface MemberModalProps {
type?: 'radio' | 'checkbox',
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any,
}
const MemberModal:React.FC<MemberModalProps> = (props) => {
const { type = "checkbox", schemaAction, currentRef, ...restProps } = props
const {
visible,
setVisible,
rowSelection,
rowSelectionCtl,
} = useModalTable({type, customKey: "memberId"})
const {
id,
preview,
pageStatus
} = usePageStatus()
useEffect(() => {
if (currentRef) {
currentRef.current = {
setVisible,
visible,
rowSelectionCtl
}
}
}, [])
// 添加会员
const handleOkAddMember = () => {
setVisible(false)
// let hasMember: any = schemaAction.setFieldValue('commodityMemberList') || []
// // schemaAction.setFieldValue('commodityMemberList', hasMember.concat(rowSelectionCtl.selectRow))
// schemaAction.setFieldValue('commodityMemberList', rowSelectionCtl.selectRow)
// // rowSelectionCtl.setSelectedRowKeys([])
if(pageStatus === PageStatus.EDIT) {
schemaAction.setFieldState('commodityMemberList', state => {
state.isDelete = true
})
let hasMember: any = schemaAction.getFieldValue('commodityMemberList') || []
schemaAction.setFieldValue('commodityMemberList', hasMember.concat(rowSelectionCtl.selectRow))
rowSelectionCtl.setSelectedRowKeys([])
rowSelectionCtl.setSelectRow([])
} else {
schemaAction.setFieldValue('commodityMemberList', rowSelectionCtl.selectRow)
schemaAction.setFieldState('commodityMemberList', state => {
state.dataSource = rowSelectionCtl.selectRow
})
}
clearModalParams()
}
const handleCancelAddMember = () => {
setVisible(false)
clearModalParams()
}
const fetchMemberList = async (params) => {
const excludeIds = await PublicApi.getProductCommodityGetStrategyMemberByCommodityId({commodityId: schemaAction.getFieldValue("productId")}, {ctlType: 'none'})
let checkedMember = schemaAction.getFieldValue('commodityMemberList')
if(schemaAction.getFieldState('commodityMemberList').isDelete) {
params.excludeList = checkedMember.map(item => ({
memberId: item.memberId,
roleId: item.roleId,
}))
} else {
params.excludeList = excludeIds.data.map(item => ({
memberId: item.memberId,
roleId: item.memberRoleId,
}))
}
const res = await PublicApi.postMemberManageLowerConsumerPage(params, {ctlType: 'none'});
return res.data
}
return (
<ModalTable
modalTitle='选择会员'
confirm={handleOkAddMember}
cancel={handleCancelAddMember}
visible={visible}
columns={columnsSetMember}
rowSelection={rowSelection}
fetchTableData={params => fetchMemberList(params)}
formilyProps={
{
ctx: {
schema: formSearch,
components: {
ModalSearch,
Submit,
},
effects: ($, actions) => {
actions.reset()
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
);
},
}
}
}
resetModal={{
destroyOnClose: true
}}
tableProps={{
rowKey: 'memberId'
}}
/>
)
}
MemberModal.defaultProps = {}
export default MemberModal
import React, {useState, useEffect, useRef} from 'react'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import {
PlusOutlined,
MinusOutlined,
} from '@ant-design/icons'
import { Button, Input, Modal, Form, Table, Checkbox, Row, Col, InputNumber } from 'antd'
import { useModalTable } from '../../model/useModalTable'
const layoutSetPrice = {
labelCol: { span: 24 },
wrapperCol: { span: 24 },
}
export interface PriceModalProps {
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any,
}
const PriceModal:React.FC<PriceModalProps> = (props) => {
const { schemaAction, currentRef, ...restProps } = props
const [setPriceForm] = Form.useForm()
const {
visible,
setVisible,
ladderPrice,
setLadderPrice,
isBatchSetting,
setIsBatchSetting,
curretSetPriceRow,
setCurrentSetPriceRow
} = useModalTable()
useEffect(() => {
if (currentRef) {
currentRef.current = {
setVisible,
visible,
ladderPrice,
setLadderPrice,
isBatchSetting,
setIsBatchSetting,
curretSetPriceRow,
setCurrentSetPriceRow
}
}
}, [])
useEffect(() => {
let record = {...curretSetPriceRow}
if(record && JSON.stringify(record)!=="{}" && record.id) {
setVisible(true)
setIsBatchSetting(false)
setPriceForm.resetFields()
// 0-0为 非阶梯
if(Object.keys(record['单价'])[0] === '0-0') {
setLadderPrice(false)
setPriceForm.setFieldsValue({ladderPrice: false, uniquePrice: Object.values(record['单价'])[0]})
} else if(JSON.stringify(record['单价']) === '{}') { // {} 为新增
setLadderPrice(false)
} else { // 编辑
setLadderPrice(true)
let numberArray = Object.keys(record['单价']).map(item => item.split('-').map(_ => Number(_)))
let priceArray = Object.values(record['单价'])
let tempArr = []
numberArray.map((_item, _index) => {
tempArr.push({ numberPrice: priceArray[_index], numberRange: { numberMin: _item[0], numberMax: _item[1] } })
})
setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr})
}
}
}, [curretSetPriceRow])
useEffect(() => {
if(isBatchSetting) {
setPriceForm.resetFields()
setPriceForm.setFields([{name: 'ladderPrice', value: false}])
currentRef.current.setLadderPrice(false)
}
}, [isBatchSetting])
const changeLadderPrice = (e: any) => {
setLadderPrice(e.target.checked)
setPriceForm.setFields([{name: 'ladderPrice', value: e.target.checked}])
}
const handlePriceOk = () => {
setPriceForm.validateFields().then(v => {
setVisible(false)
let memberUnitPriceList = schemaAction.getFieldValue("memberUnitPriceList")
const { ladderPrice, ladderRange } = v
let _priceRange = {}
if(ladderPrice) { // 判断阶梯价格
ladderRange.length>0 && ladderRange.map(item => {
_priceRange[`${item.numberRange.numberMin}-${item.numberRange.numberMax}`] = item.numberPrice
})
} else {
_priceRange['0-0'] = v.uniquePrice
}
let _row = { ...curretSetPriceRow, 单价: _priceRange }
let newTabeData = [...memberUnitPriceList]
if(isBatchSetting) { // 判断是否批量设置价格
newTabeData.map(item => item['单价'] = _priceRange)
} else {
newTabeData[curretSetPriceRow['索引']] = _row
}
schemaAction.setFieldValue("memberUnitPriceList", newTabeData)
})
}
// 校验阶梯范围
const validatorNumberRange = (rule, value, callback) => {
try {
if(Array.isArray(value)){
let range = value.map(item => {
if(item)
return Object.values(item.numberRange)
}).reduce(
function(a, b) {
return a.concat(b);
},
[]
)
let result = range.map(Number).reduce((a, b) => { if(a<b) return b })
if(!result) throw new Error('请正确输入阶梯数量范围');
if(Number(range[0]) !== schemaAction.getFieldValue("minOrder")) throw new Error('阶段的起始值必须为最小起订数');
callback()
}
} catch (err) {
callback(err)
}
}
return (
<Modal
title={currentRef.current.isBatchSetting ? "批量设置价格" : "设置价格"}
visible={visible}
onOk={handlePriceOk}
onCancel={() => setVisible(false)}
forceRender={true}
{...restProps}
>
<Form
{...layoutSetPrice}
name="settingPrice"
form={setPriceForm}
initialValues={{ladderPrice: false}}
>
<Form.Item
label=""
name="ladderPrice"
valuePropName="checked"
>
<Checkbox onChange={changeLadderPrice}>阶梯价格</Checkbox>
</Form.Item>
{
ladderPrice ? <Form.Item
name="ladderRange"
label=""
shouldUpdate={true}
rules={[
{
required: true,
message: '阶梯范围为必填项'
},
{
validator: validatorNumberRange
}
]}
>
<Form.List name="ladderRange">
{(fields, { add, remove }) => {
if (!fields.length) {
add()
}
return (
<div>
{fields.map(field => (
<Row key={Number(field.key) + 100} gutter={[0, 10]}>
<Col span={20} style={{ display: 'flex' }}>
<Form.Item
{...field}
name={[field.name, 'numberRange', 'numberMin']}
fieldKey={[field.fieldKey, 'numberRange', 'numberMin']}
rules={[
{ required: true, message: '阶梯最小数量为必填项' },
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '阶梯数值仅限三位小数',
}
]}
>
<Input placeholder="最小数量" />
</Form.Item>
<Input
style={{
width: 30,
height: 32,
borderLeft: 0,
borderRight: 0,
pointerEvents: 'none',
}}
placeholder="~"
disabled
/>
<Form.Item
{...field}
name={[field.name, 'numberRange', 'numberMax']}
fieldKey={[field.fieldKey, 'numberRange', 'numberMax']}
rules={[
{ required: true, message: '阶梯最大数量为必填项' },
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '阶梯数值仅限三位小数',
}
]}
>
<Input placeholder="最大数量" />
</Form.Item>
<Form.Item
{...field}
name={[field.name, 'numberPrice']}
fieldKey={[field.fieldKey, 'numberPrice']}
rules={[
{ required: true, message: '阶梯单价为必填项' },
{
pattern: /^\d+(\.\d{1,4})?$/,
message: '阶梯单价仅限四位小数',
}
]}
style={{marginLeft: 20}}
>
<Input placeholder="请输入单价" />
</Form.Item>
</Col>
<Col span={4}>
<Button size="small" onClick={() => add()} style={{ marginLeft: 20, marginRight: 8 }} icon={<PlusOutlined />} />
{field.key > 0 && (<Button size="small" onClick={() => remove(field.name)} icon={<MinusOutlined />} />)}
</Col>
</Row>)
)}
</div>
);
}}
</Form.List>
</Form.Item> : <Form.Item
label="单价"
name="uniquePrice"
rules={[
{
required: true,
type: 'number',
message: '请输入价格'
},
{
pattern: /^\d+(\.\d{1,4})?$/,
message: '小数点后仅限四位',
}
]}
>
<InputNumber min={0} style={{width: '100%'}} placeholder="请输入价格" />
</Form.Item>
}
</Form>
</Modal>
)
}
PriceModal.defaultProps = {}
export default PriceModal
import React, {useState, useEffect, useRef} from 'react'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useModalTable } from '../../model/useModalTable'
import ModalTable from '@/components/ModalTable'
import { columnsSetProduct } from '../../constant'
import { GlobalConfig } from '@/global/config'
import { PublicApi } from '@/services/api'
import { formProduct } from '../../schema'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import ModalSearch from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit'
import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch'
import SearchSelect from '@/components/NiceForm/components/SearchSelect'
import { clearModalParams } from '@/utils'
import { FormEffectHooks } from '@formily/antd'
import { searchCustomerCategoryOptionEffect } from '../../effect'
export interface ProductModalProps {
type?: 'radio' | 'checkbox',
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any,
}
const ProductModal:React.FC<ProductModalProps> = (props) => {
const { type = "radio" ,schemaAction, currentRef, ...restProps } = props
const {
visible,
setVisible,
rowSelection,
rowSelectionCtl,
} = useModalTable({type})
useEffect(() => {
if (currentRef) {
currentRef.current = {
setVisible,
visible,
rowSelectionCtl
}
}
}, [])
// 指定商品
const fetchProductList = async (params) => {
const shopId = schemaAction.getFieldValue('shopId')
let shopInfo: any = GlobalConfig.web.shopInfo.filter(item => item.id === shopId)
const res = await PublicApi.getProductCommodityGetStrategyCommodityList({
...params,
type: shopInfo[0]["type"],
environment: shopInfo[0].environment,
shopId,
// priceTypeList: [1, 2],
})
return res.data
}
// 商品添加弹窗控制
const handleOkAddProduct = async () => {
setVisible(false)
const selectResult = rowSelectionCtl.selectRow[0]
if (!selectResult) {
return null
}
schemaAction.setFieldValue('productName', selectResult.name)
schemaAction.setFieldValue('productId', selectResult.id)
schemaAction.setFieldValue('minOrder', selectResult.minOrder)
clearModalParams()
}
const handleCancel = () => {
setVisible(false)
clearModalParams()
}
return (
<ModalTable
modalTitle='选择商品'
confirm={handleOkAddProduct}
cancel={handleCancel}
visible={visible}
columns={columnsSetProduct}
rowSelection={rowSelection}
fetchTableData={params => fetchProductList(params)}
formilyProps={
{
ctx: {
schema: formProduct,
components: {
ModalSearch,
SearchSelect, Submit,
CustomCategorySearch
},
effects: ($, actions) => {
actions.reset()
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
);
FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state => {
searchCustomerCategoryOptionEffect(actions, 'customerCategoryId')
})
}
}
}
}
resetModal={{
destroyOnClose: true,
}}
tableProps={{
rowKey: 'id',
}}
/>
)
}
ProductModal.defaultProps = {}
export default ProductModal
This diff is collapsed.
@import '../../../../global/styles/utils.less';
.contractList {
padding: 0;
margin: 0;
&-item {
padding: 6px 8px;
background: #F4F5F7;
border-radius: 4px;
list-style: none;
> a {
display: flex;
align-items: center;
}
&-icon {
flex-shrink: 0;
margin-right: 4px;
color: #7178EA;
}
&-name {
flex: 1;
.textOverflow();
}
&:not(:last-child) {
margin-bottom: 8px;
}
}
}
.noData {
color: #909399;
}
\ No newline at end of file
import React from 'react';
import { FilePdfFilled, FileWordFilled, FileFilled } from '@ant-design/icons';
import { PublicApi } from '@/services/api'
import styles from './index.less';
interface ContractItem {
electronicContractUrl?: string;
electronicContractName?: string;
};
interface ContractList {
dataSource: ContractItem[];
};
const IconMap = {
'.pdf': <FilePdfFilled />,
'.doc': <FileWordFilled />,
'.doxc': <FileWordFilled />,
};
const ContractItem: React.FC<ContractItem> = ({
electronicContractUrl,
electronicContractName,
}) => {
const index1 = electronicContractUrl.lastIndexOf('.');
const suffix = electronicContractUrl.slice(index1);
const index2 = electronicContractUrl.lastIndexOf('/');
// 如果没有文件名,但是有链接就从链接截取文件名
const fileName = electronicContractName ? electronicContractName : electronicContractUrl.slice(index2 + 1);
const handleDownload = (name, url) => {
window.location.href = `/api/order/contractTemplate/downloadContract?contractName=${name}&contractUrl=${url}`;
};
return (
<li className={styles['contractList-item']} onClick={() => handleDownload(fileName, electronicContractUrl)}>
<a>
<div className={styles['contractList-item-icon']}>
{IconMap[suffix] || <FileFilled />}
</div>
<div
className={styles['contractList-item-name']}
title={fileName}
>
{fileName}
</div>
</a>
</li>
);
};
const ContractList: React.FC<ContractList> = ({ dataSource }) => {
if (!Array.isArray(dataSource)) {
return <div className={styles.noData}>没有相关数据~</div>;
}
return (
<ul className={styles.contractList}>
{dataSource.map((item, index) => (
<ContractItem
key={index}
electronicContractUrl={item.electronicContractUrl}
electronicContractName={item.electronicContractName}
/>
))}
</ul>
);
};
export default ContractList;
\ No newline at end of file
.titleAvator {
width:48px;
height:48px;
background:rgba(135,119,217,1);
border-radius:4px;
border:1px solid rgba(223,225,230,1);
line-height: 48px;
text-align: center;
color: #fff;
margin: 0 24px;
}
.titleAvatorText {
color: #303133;
font-size: 18px;
line-height: 20px;
}
.detailHeader {
background: #fff;
padding: 24px;
}
.detailCol {
display: flex;
margin-top: 20px;
color: #303133;
}
.colLabel {
color: #909399;
margin-right: 16px;
}
\ No newline at end of file
import React, { ReactNode } from 'react'
import { Row, Col, Skeleton } from 'antd'
import { history } from 'umi'
import { ArrowLeftOutlined } from '@ant-design/icons'
import style from './index.less'
export interface OrderDetailHeaderProps {
extraRight?: ReactNode,
detailList?: { label: string, name: string, render?(text, record?), [key: string]: any }[],
detailData?: any
}
/**
* 订单详情头部
*/
const OrderDetailHeader:React.FC<OrderDetailHeaderProps> = ({ extraRight, detailList = [], detailData}) => {
const isLoading = !!detailData
return (
<div className={style.detailHeader}>
{
isLoading ?
<Row>
{
<Col>
<Row align='middle'>
<Col>
<ArrowLeftOutlined onClick={() => history.goBack()}/>
</Col>
<Col className={style.titleAvator}></Col>
</Row>
</Col>
}
<Col style={{flex: 1}}>
<Row justify='space-between' align='middle' style={{paddingTop: 14}}>
<Col style={{flex: 1}}>
<div className={style.titleAvatorText}>订单号: {detailData.orderNo}</div>
<Row>
{detailList.map(v => {
const { label, render, name, ...colProps } = v
return (detailData[name] || detailData[name] === 0) ? <Col key={label} {...colProps} className={style.detailCol}>
<span className={style.colLabel}>{label}:</span>
{render ? render(detailData[name], detailData) : <span>{detailData[name]}</span>}
</Col> : null
})}
</Row>
</Col>
<Col>{extraRight}</Col>
</Row>
</Col>
</Row>
: <Skeleton avatar={{shape: 'square'}} active paragraph={{ rows: 3 }} />
}
</div>
)
}
OrderDetailHeader.defaultProps = {}
export default OrderDetailHeader
.wrapper {
padding: 24px;
}
\ No newline at end of file
import React from 'react'
import style from './index.less'
export interface OrderDetailWrapperProps {}
const OrderDetailWrapper:React.FC<OrderDetailWrapperProps> = (props) => {
return (
<div className={style.wrapper}>{props.children}</div>
)
}
OrderDetailWrapper.defaultProps = {}
export default OrderDetailWrapper
\ No newline at end of file
import React from 'react'
import { Tag } from 'antd'
export interface IStatusColor {
[key: string]: {
value: string | number,
color: string
}
}
// 用于标签状态控制
export interface StatusColorsProps {
status: number,
text?: string,
type: 'out' | 'inside' | 'saleInside' | 'payOut' | 'deliveInside' | 'inquiry' | 'transformOut' | 'transformInside' | 'transformSaleInside'
}
export enum ORDER_EXAMINE_ENUM {
/**
* 新增订单
*/
ADD_ORDER = 1,
/**
* 一级审核
*/
ONE_LEVEL_VALIDATE,
/**
* 二级审核
*/
TWO_LEVEL_VALIDATE,
/**
* 提交订单中
*/
SUBMIT_ORDER_PROCESS,
/**
* 提交订单成功
*/
SUBMIT_ORDER_SUCCESS,
/**
* 一级审核失败
*/
ONE_LEVEL_VALIDATE_ERROR,
/**
* 二级审核失败
*/
TWO_LEVEL_VALIDATE_ERROR
}
export const ORDER_EXAMINE_LIST = ['',
'新增订单',
'一级审核中',
'二级审核中',
'提交订单',
'提交成功',
'一级审核不通过',
'二级审核不通过'
]
// 状态颜色映射
export const StatusColorsMaps = {
ready: '#C0C4CC',
process: '#FFC400',
submit: '#6C9CEB',
success: '#41CC9E',
error: '#EF6260'
}
const matchStatusColor = (status: number): string => {
const maps = {
[ORDER_EXAMINE_ENUM.ADD_ORDER]: StatusColorsMaps.ready,
[ORDER_EXAMINE_ENUM.ONE_LEVEL_VALIDATE]: StatusColorsMaps.process,
[ORDER_EXAMINE_ENUM.TWO_LEVEL_VALIDATE]: StatusColorsMaps.process,
[ORDER_EXAMINE_ENUM.SUBMIT_ORDER_PROCESS]: StatusColorsMaps.submit,
[ORDER_EXAMINE_ENUM.SUBMIT_ORDER_SUCCESS]: StatusColorsMaps.success
}
// 默认返回错误的状态颜色
return maps[status] || StatusColorsMaps.error
}
// 订单内部状态显示
const StatusColors:React.FC<StatusColorsProps> = (props) => {
const { status, type, text = null } = props
const statusShowColor = matchStatusColor(status)
return (<Tag color={statusShowColor}>{text}</Tag>)
}
StatusColors.defaultProps = {}
export default StatusColors
......@@ -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