Commit 9d9ed2bc authored by XieZhiXiong's avatar XieZhiXiong
parents 83b81095 d56f35f3
...@@ -219,12 +219,12 @@ const LogisticsForm: React.FC<Iprops> = (props) => { ...@@ -219,12 +219,12 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
deliveryType !== 3 && <Form.Item deliveryType !== 3 && <Form.Item
name="sendAddress" name="sendAddress"
label="发货地址" label="发货地址"
// rules={[ rules={[
// { {
// required: true, required: true,
// message: '请选择发货地址' message: '请选择发货地址'
// }, },
// ]} ]}
> >
<Select <Select
placeholder="请选择发货地址" placeholder="请选择发货地址"
......
...@@ -59,6 +59,7 @@ const ModifyDirectChannel:React.FC<{}> = () => { ...@@ -59,6 +59,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
const priceTypeRef = useRef<number>() const priceTypeRef = useRef<number>()
const [originHasIds, setOriginHasIds] = useState<number[]>([]) const [originHasIds, setOriginHasIds] = useState<number[]>([])
const [loading, setLoading] = useState<boolean>(false) const [loading, setLoading] = useState<boolean>(false)
const [clickTabIndex, setClickTabIndex] = useState<string[]>(['1'])
const [logisticsCompanyLists, setLogisticsCompanyLists] = useState<GetLogisticsSelectListCompanyResponse>() const [logisticsCompanyLists, setLogisticsCompanyLists] = useState<GetLogisticsSelectListCompanyResponse>()
const [logisticsAddressList, setLogisticsAddressList] = useState<GetLogisticsSelectListShipperAddressResponse>() const [logisticsAddressList, setLogisticsAddressList] = useState<GetLogisticsSelectListShipperAddressResponse>()
...@@ -68,6 +69,7 @@ const ModifyDirectChannel:React.FC<{}> = () => { ...@@ -68,6 +69,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
const [carriageType, setCarriageType] = useState<number>() const [carriageType, setCarriageType] = useState<number>()
const [banCarriageType, setBanCarriageType] = useState(false) const [banCarriageType, setBanCarriageType] = useState(false)
const [template, setTemplate] = useState(false) // 是否必填运费模板 const [template, setTemplate] = useState(false) // 是否必填运费模板
const [isTax, setIsTax] = useState<boolean>(true) // 是否含税
useEffect(() => { useEffect(() => {
...@@ -79,7 +81,7 @@ const ModifyDirectChannel:React.FC<{}> = () => { ...@@ -79,7 +81,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
if(res.code === 1000){ if(res.code === 1000){
setChannelDetails(data) setChannelDetails(data)
priceTypeRef.current = data.channelCommodity.commodity.priceType priceTypeRef.current = data.channelCommodity.commodity.priceType
formPrice.setFieldsValue({isMemberPrice: data?.isMemberPrice}) formPrice.setFieldsValue({isMemberPrice: data?.isMemberPrice, taxRate: data?.taxRate})
const { deliveryType, carriageType, useTemplate } = data.logistics const { deliveryType, carriageType, useTemplate } = data.logistics
setDeliveryType(deliveryType) setDeliveryType(deliveryType)
setCarriageType(carriageType) setCarriageType(carriageType)
...@@ -378,6 +380,16 @@ const ModifyDirectChannel:React.FC<{}> = () => { ...@@ -378,6 +380,16 @@ const ModifyDirectChannel:React.FC<{}> = () => {
}), }),
logistics: logistics, logistics: logistics,
} }
// 处理不点击tab表单无数据 接口数据直接填充
if (clickTabIndex.indexOf("2") === -1) {
// 商品规格
params.isMemberPrice = channelDetails.isMemberPrice
params.unitPriceAndPicList = channelDetails.unitPriceAndPicList
}
if (clickTabIndex.indexOf("3") === -1) {
// 物流
params.logistics = channelDetails.logistics
}
PublicApi.postProductChannelCommodityUpdatePriceChannelCommodity(params).then(res => { PublicApi.postProductChannelCommodityUpdatePriceChannelCommodity(params).then(res => {
setIsDisabledSave(false) setIsDisabledSave(false)
if(res.code === 1000) if(res.code === 1000)
...@@ -412,6 +424,11 @@ const ModifyDirectChannel:React.FC<{}> = () => { ...@@ -412,6 +424,11 @@ const ModifyDirectChannel:React.FC<{}> = () => {
} }
} }
// 判断是否点击过对应tab
const callback = (key: any) => {
setClickTabIndex([...clickTabIndex, key])
}
return (<PageHeaderWrapper return (<PageHeaderWrapper
onBack={() => history.goBack()} onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>} backIcon={<ReutrnEle description="返回"/>}
...@@ -423,7 +440,7 @@ const ModifyDirectChannel:React.FC<{}> = () => { ...@@ -423,7 +440,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
]} ]}
> >
<Card> <Card>
<Tabs type="card"> <Tabs type="card" onChange={callback}>
<TabPane tab="基本信息" key="1"> <TabPane tab="基本信息" key="1">
<Form <Form
{...layout} {...layout}
...@@ -461,6 +478,34 @@ const ModifyDirectChannel:React.FC<{}> = () => { ...@@ -461,6 +478,34 @@ const ModifyDirectChannel:React.FC<{}> = () => {
> >
<Checkbox disabled={priceTypeRef.current === 3}>允许使用会员折扣价购买</Checkbox> <Checkbox disabled={priceTypeRef.current === 3}>允许使用会员折扣价购买</Checkbox>
</Form.Item> </Form.Item>
<Form.Item
name="isTax"
label="是否含税"
valuePropName="checked"
initialValue={true}
>
<Checkbox onChange={(e)=>setIsTax(e.target.checked)}></Checkbox>
</Form.Item>
{
isTax ?
<Form.Item
name="taxRate"
label="税率"
rules={[
{
required: true,
message: '税率必须填写',
},
{
pattern: /^\d+(\.\d{1,2})?$/,
message: '税率仅限两位小数',
},
]}
>
<Input suffix="%" />
</Form.Item>
: null
}
</Form> </Form>
<Button onClick={()=>setVisibleAddSpec(true)} style={{width:'100%', marginBottom: 24, backgroundColor: '#fafbfc'}}> <Button onClick={()=>setVisibleAddSpec(true)} style={{width:'100%', marginBottom: 24, backgroundColor: '#fafbfc'}}>
<PlusOutlined /> 选择商品规格 <PlusOutlined /> 选择商品规格
......
import React, { useEffect } from 'react' import React from 'react'
import { EnvironmentOutlined } from '@ant-design/icons' import { EnvironmentOutlined } from '@ant-design/icons'
import { Popover, Row, Space } from 'antd' import { Popover, Row, Space } from 'antd'
export const AddressPop = (props) => { export const AddressPop = (props) => {
const { pickInfo = null, children } = props const { pickInfo = null, children } = props
return pickInfo && pickInfo.deliveryType === 2 ? <Space> return pickInfo && pickInfo.deliverType === 2 ? <Space>
<EnvironmentOutlined style={{marginRight: 8}}/> <EnvironmentOutlined style={{marginRight: 8}}/>
<Popover content={ <Popover content={
<Row> <Row>
......
...@@ -219,9 +219,9 @@ const ApprovedOrderModal:React.FC<ApprovedOrderModalProps> = (props) => { ...@@ -219,9 +219,9 @@ const ApprovedOrderModal:React.FC<ApprovedOrderModalProps> = (props) => {
} }
}) })
// 上级审核不通过 // 上级审核不通过
if(data && (data.purchaseOrderInteriorState === 6 || data.purchaseOrderInteriorState === 7 || data.purchaseOrderInteriorState === 8)) { if(data && (data.innerStatusName === '提交审核不通过')) {
ctx.setFieldValue("state", 0) ctx.setFieldValue("agree", 0)
ctx.setFieldState("state", state => { ctx.setFieldState("agree", state => {
state.props["x-component-props"] = { state.props["x-component-props"] = {
disabled: true disabled: true
} }
......
...@@ -41,6 +41,7 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => { ...@@ -41,6 +41,7 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
dataIndex: 'name', dataIndex: 'name',
align: 'center', align: 'center',
key: 'name', key: 'name',
render: (t, r) => `${t}/${r.spec}`
}, },
{ {
title: '品类', title: '品类',
......
import React, { useContext, useEffect, useState } from 'react' import React, { useContext, useEffect, useRef, useState } from 'react'
import style from './index.less' import { Row, Col, Modal, List, Table, Button, Form, Input } from 'antd'
import { Tabs, Row, Col, Modal, List, Tooltip } from 'antd'
import { OrderDetailContext } from '../../_public/order/context' import { OrderDetailContext } from '../../_public/order/context'
import MellowCard from '@/components/MellowCard' import MellowCard from '@/components/MellowCard'
import StatusColors from '../statusColors'
import moment from 'moment'
import { PayOutWorkState } from '@/constants/order'
import OverflowText from '@/components/OverflowText' import OverflowText from '@/components/OverflowText'
import { QuestionCircleOutlined } from '@ant-design/icons' import { EditOutlined } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
// table编辑控件
const EditableContext = React.createContext<any>({});
interface EditableRowProps {
index: number;
}
const EditableRow: React.FC<EditableRowProps> = ({ index, ...props }) => {
const [form] = Form.useForm();
return (
<Form form={form} component={false}>
<EditableContext.Provider value={form}>
<tr {...props} />
</EditableContext.Provider>
</Form>
);
};
interface EditableCellProps {
title: React.ReactNode;
editable: boolean;
children: React.ReactNode;
dataIndex: string;
record: any;
handleSave: (record: any) => void;
}
const EditableCell: React.FC<EditableCellProps> = ({
title,
editable,
children,
dataIndex,
record,
handleSave,
...restProps
}) => {
const [editing, setEditing] = useState(false);
const inputRef = useRef<any>({});
const form = useContext(EditableContext);
useEffect(() => {
if (editing) {
inputRef.current.focus();
}
}, [editing]);
const toggleEdit = () => {
setEditing(!editing);
form.setFieldsValue({ [dataIndex]: record[dataIndex] });
};
const save = async () => {
try {
const values = await form.validateFields();
toggleEdit();
handleSave({ ...record, ...values });
} catch (errInfo) {
console.log('Save failed:', errInfo);
}
};
let childNode = children;
if (editable) {
childNode = editing ? (
<Form.Item
style={{ margin: 0, width: 140 }}
name={dataIndex}
rules={[
{
required: true,
message: `此项为必填项`,
},
{
pattern: /^\d+(\.\d{1,2})?$/,
message: `支付比例仅限两位小数`,
}
]}
>
<Input type='number' ref={inputRef} onBlur={save} onPressEnter={save}/>
</Form.Item>
) : (
<div className="editable-cell-value-wrap" style={{ paddingRight: 24 }} onClick={toggleEdit}>
{children}
<EditOutlined/>
</div>
);
}
return <td {...restProps}>{childNode}</td>;
};
/** /**
* 展示 支付比例和简单流程的发货信息 * 展示 支付比例和简单流程的发货信息
...@@ -15,15 +101,13 @@ import { QuestionCircleOutlined } from '@ant-design/icons' ...@@ -15,15 +101,13 @@ import { QuestionCircleOutlined } from '@ant-design/icons'
export interface OrderPayTabsProps {} export interface OrderPayTabsProps {}
const TabPane = Tabs.TabPane
const OrderPayTabs:React.FC<OrderPayTabsProps> = () => { const OrderPayTabs:React.FC<OrderPayTabsProps> = () => {
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const { data, ctl } = useContext(OrderDetailContext) const [urlsDatas, setUrlsDatas] = useState([])
const { data, ctl, reloadFormData } = useContext(OrderDetailContext)
// 简单流程为24 // 简单流程为24
const processEnum = data.processEnum const processEnum = data.processEnum
const payments = data.payments.sort((a, b) => a.batchNo - b.batchNo) const payments = data.payments.sort((a, b) => a.batchNo - b.batchNo)
useEffect(() => { useEffect(() => {
...@@ -36,63 +120,136 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = () => { ...@@ -36,63 +120,136 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = () => {
} }
}, []) }, [])
const TabHeader = ({dataSource}) => { const handlePreivew = (batch) => {
return <Row justify='space-between' style={{minWidth: 216}}> setVisible(true)
<Col> const canCtlData = payments.find(v => v.batchNo === batch)
<div className={style.fontGray}>支付比例</div> const urlsDatas = canCtlData.vouchers || []
<div className={style.bignumber}>{dataSource.payRate}%</div> setUrlsDatas(urlsDatas)
<div className={style.smallnumber}>
{dataSource.payChannel !== 0 && '¥'}
{dataSource.payAmount || 0}
{
dataSource.refundPrice ? <>&nbsp;
<Tooltip title={`本次实际支付金额(¥${dataSource.payAmount})=本次订单待支付金额(¥${dataSource.payAmount+dataSource.refundPrice})-售后待退款金额(¥${dataSource.refundPrice})`}>
<QuestionCircleOutlined />
</Tooltip>
</> : null
}
</div>
</Col>
<Col>
<StatusColors status={dataSource.outerStatus} text={dataSource.outerStatusName} type='payOut'/>
{ dataSource.vouchers.length ? <p className={style.look} onClick={()=>setVisible(true)}>查看 &gt;</p> : null}
</Col>
</Row>
} }
const handleSave = row => {
const newData = [...payments];
const index = newData.findIndex(item => row.batchNo === item.batchNo);
const item = newData[index];
newData.splice(index, 1, {
...item,
...row,
});
// 执行修改订单价格
PublicApi.postOrderVendorValidateSubmitPaymentUpdate({
orderId: data.orderId,
payRates: newData.map(item => ({ batchNo: item.batchNo, payRate: item.payRate }))
}).then(res=>{
if(res.code === 1000) {
reloadFormData()
}
})
ctl.setData({
...data,
payments: newData.sort((a, b) => a.batchNo - b.batchNo)
})
};
// const canCtlData = data.payments.find(v => v.showView) || {} //@todo 需后端提供showView字段支持 const columns: any[] = [
{
title: 'ID',
dataIndex: 'paymentId',
align: 'center',
key: 'paymentId',
className: 'commonHide',
},
{
title: '支付次数',
dataIndex: 'batchNo',
align: 'center',
key: 'batchNo',
},
{
title: '支付环节',
dataIndex: 'payNode',
align: 'center',
key: 'payNode',
},
{
title: '外部状态',
dataIndex: 'outerStatusName',
align: 'center',
key: 'outerStatusName',
},
{
title: '支付比例',
key: 'payRate',
dataIndex: 'payRate',
formItem: 'input',
editable: data.innerStatusName === '待提交审核',
width: 80,
formItemProps: {
suffix: '%',
},
},
{
title: '支付金额',
dataIndex: 'payAmount',
align: 'center',
key: 'payAmount',
render: (t, r) => `¥${t}`
},
{
title: '支付方式',
dataIndex: 'payTypeName',
align: 'center',
key: 'payTypeName',
},
{
title: '支付渠道',
dataIndex: 'payChannelName',
align: 'center',
key: 'payChannelName',
},
{
title: '支付结果',
dataIndex: 'operation',
align: 'center',
key: 'operation',
render: (t, r) => r.showView && <Button type="link" onClick={()=>handlePreivew(r.batchNo)}>查看凭证</Button>
}
]
const canCtlData = payments.find(v => v.vouchers.length) || {} const paymentComponents = {
const urlsDatas = canCtlData.vouchers || [] body: {
row: EditableRow,
cell: EditableCell
}
}
const editColumns = columns.map(col => {
if (!col.editable) {
return col;
}
return {
...col,
onCell: record => ({
record,
editable: col.editable,
dataIndex: col.dataIndex,
title: col.title,
handleSave: handleSave,
}),
};
});
return ( return (
<> <>
<Row gutter={24} style={{marginTop: 24}}> <Row gutter={24} style={{marginTop: 24, marginBottom: 24}}>
<Col span={processEnum === 24 ? 12 : 24}> <Col span={processEnum === 24 ? 12 : 24}>
<MellowCard bordered={false} fullHeight> <MellowCard title="支付信息" bordered={false} fullHeight>
<Tabs defaultActiveKey='1'> <Table
{ columns={editColumns}
payments.length dataSource={payments}
? components={paymentComponents}
payments.map(v => <TabPane key={v.paymentId} tab={<TabHeader dataSource={v}/>}> rowKey='paymentId'
<Row> pagination={false}
<Col className={style.fontGray} span={4}>支付环节: </Col> />
<Col>{v.payNode}</Col>
</Row>
<Row>
<Col className={style.fontGray} span={4}>支付方式: </Col>
<Col>{v.payTypeName}</Col>
</Row>
<Row>
<Col className={style.fontGray} span={4}>支付渠道: </Col>
<Col>{v.payChannelName}</Col>
</Row>
</TabPane>)
:
null
}
</Tabs>
</MellowCard> </MellowCard>
</Col> </Col>
{/* @todo 简单流程的发货信息 显示 */} {/* @todo 简单流程的发货信息 显示 */}
...@@ -124,7 +281,6 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = () => { ...@@ -124,7 +281,6 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = () => {
title='查看支付结果' title='查看支付结果'
visible={visible} visible={visible}
onCancel={()=>setVisible(false)} onCancel={()=>setVisible(false)}
// onOk={()=>setVisible(false)}
footer={null} footer={null}
> >
<List <List
......
...@@ -230,6 +230,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => { ...@@ -230,6 +230,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
dataIndex: 'name', dataIndex: 'name',
align: 'center', align: 'center',
key: 'name', key: 'name',
render: (t, r) => `${t}/${r.spec}`
}, },
{ {
title: '品类', title: '品类',
......
...@@ -46,6 +46,7 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => { ...@@ -46,6 +46,7 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => {
dataIndex: 'name', dataIndex: 'name',
align: 'center', align: 'center',
key: 'name', key: 'name',
render: (t, r) => `${t}/${r.spec}`
}, },
{ {
title: '品类', title: '品类',
......
...@@ -110,7 +110,7 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => { ...@@ -110,7 +110,7 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
let free = modalPriceActions.getFieldValue('freePrice') let free = modalPriceActions.getFieldValue('freePrice')
setFreePrice(Number(free || 0)) setFreePrice(Number(free || 0))
// 执行修改订单运费 // 执行修改订单运费
PublicApi.postOrderProductPriceUpdate({orderId: dataSource.orderId, price: free, type: 2}).then(res => { PublicApi.postOrderVendorValidateSubmitFreightUpdate({orderId: dataSource.orderId, freight: free}).then(res => {
if(res.code === 1000) { if(res.code === 1000) {
modelRef.current.setVisible(false) modelRef.current.setVisible(false)
reloadFormData() reloadFormData()
...@@ -259,11 +259,6 @@ const EditableCell: React.FC<EditableCellProps> = ({ ...@@ -259,11 +259,6 @@ const EditableCell: React.FC<EditableCellProps> = ({
} }
}; };
const cancel = () => {
console.log('cancel')
setEditing(false)
}
let childNode = children; let childNode = children;
if (editable) { if (editable) {
...@@ -307,7 +302,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -307,7 +302,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const warehouseRef = useRef<any>({}) const warehouseRef = useRef<any>({})
// 判断是否可操作当前表格 // 判断是否可操作当前表格
const isEditData = true const isEditData = data.innerStatusName === '待提交审核'
const productComponents = { const productComponents = {
body: { body: {
...@@ -351,21 +346,24 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -351,21 +346,24 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const handleSave = row => { const handleSave = row => {
const newData = [...product.products]; const newData = [...product.products];
const index = newData.findIndex(item => row.id === item.id); const index = newData.findIndex(item => row.orderProductId === item.orderProductId);
const item = newData[index]; const item = newData[index];
newData.splice(index, 1, { newData.splice(index, 1, {
...item, ...item,
...row, ...row,
}); });
// 执行修改订单价格 // 执行修改订单价格
PublicApi.postOrderProductPriceUpdate({orderId: data.orderId, orderDetailsId: row.id, price: row.price, type: 1}).then(res => { PublicApi.postOrderVendorValidateSubmitFreightUpdate({orderId: data.orderId, prices: [{ orderProductId: row.orderProductId, price: row.price }]}).then(res=>{
if(res.code === 1000) { if(res.code === 1000) {
reloadFormData() reloadFormData()
} }
}) })
ctl.setData({ ctl.setData({
...data, ...data,
orderProductRequests: newData.sort((a, b) => a.id - b.id) product: {
...data.product,
products: newData.sort((a, b) => a.orderProductId - b.orderProductId)
},
}) })
}; };
...@@ -387,6 +385,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -387,6 +385,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
dataIndex: 'name', dataIndex: 'name',
align: 'center', align: 'center',
key: 'name', key: 'name',
render: (t, r) => `${t}/${r.spec}`
}, },
{ {
title: '品类', title: '品类',
......
...@@ -70,7 +70,7 @@ const OfferSearch = () => { ...@@ -70,7 +70,7 @@ const OfferSearch = () => {
title: '操作', title: '操作',
key: 'operate', key: 'operate',
dataIndex: 'operate', dataIndex: 'operate',
render: (_, record) => record.isShowPurchaseOrder && <Button type='link' onClick={() => history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/b2b/add?modelType=3&quotationNo=${record.quotationNo}&id=${record.id}`)}>创建采购订单</Button> render: (_, record) => record.isShowPurchaseOrder && <Button type='link' onClick={() => history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/b2b/add?modelType=3&quotationId=${record.id}`)}>创建采购订单</Button>
} }
]; ];
......
...@@ -24,6 +24,8 @@ const InquirySearch = () => { ...@@ -24,6 +24,8 @@ const InquirySearch = () => {
const [isModalVisible, setVisible] = useState<boolean>(false); const [isModalVisible, setVisible] = useState<boolean>(false);
const [orderId, setOrderId] = useState<string>(''); const [orderId, setOrderId] = useState<string>('');
const [isId, setIsId] = useState<number>() const [isId, setIsId] = useState<number>()
const [memberRoleName, setMemberRoleName] = useState<string>('');
const format = (text, fmt?: string) => { const format = (text, fmt?: string) => {
return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</> return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</>
...@@ -49,6 +51,7 @@ const InquirySearch = () => { ...@@ -49,6 +51,7 @@ const InquirySearch = () => {
const userInfo: any = getAuth() || {}; const userInfo: any = getAuth() || {};
const roles = userInfo.roles.filter(_item => _item.roleType === 2); const roles = userInfo.roles.filter(_item => _item.roleType === 2);
setRole(roles); setRole(roles);
setMemberRoleName(roles[0].memberRoleName)
setOrderId(orderId); setOrderId(orderId);
setIsId(id) setIsId(id)
if (!isEmpty(roles)) { if (!isEmpty(roles)) {
...@@ -175,7 +178,7 @@ const InquirySearch = () => { ...@@ -175,7 +178,7 @@ const InquirySearch = () => {
layout='vertical' layout='vertical'
> >
<Form.Item> <Form.Item>
当前询价单<Typography.Text type='danger'>{orderId}</Typography.Text>二次询价生成的询价单可通过会员角色:<Typography.Text type='danger'>{role[0].memberRoleName}</Typography.Text>进行查看。 当前询价单<Typography.Text type='danger'>{orderId}</Typography.Text>二次询价生成的询价单可通过会员角色:<Typography.Text type='danger'>{memberRoleName}</Typography.Text>进行查看。
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='会员角色' label='会员角色'
...@@ -183,7 +186,7 @@ const InquirySearch = () => { ...@@ -183,7 +186,7 @@ const InquirySearch = () => {
name='memberRoleId' name='memberRoleId'
rules={[{ required: true, message: '请选择会员角色' }]} rules={[{ required: true, message: '请选择会员角色' }]}
> >
<Select> <Select onChange={(_e, option: any) => setMemberRoleName(option.children)}>
{role.map((_item, _i) => ( {role.map((_item, _i) => (
<Select.Option key={`role${_i}`} value={_item.memberRoleId}>{_item.memberRoleName}</Select.Option> <Select.Option key={`role${_i}`} value={_item.memberRoleId}>{_item.memberRoleName}</Select.Option>
))} ))}
......
...@@ -36,11 +36,12 @@ const DateModalLayout: React.FC<DateModalProps> = (props: any) => { ...@@ -36,11 +36,12 @@ const DateModalLayout: React.FC<DateModalProps> = (props: any) => {
return return
} }
onSubmit(); onSubmit();
setLoading(false)
form.resetFields();
}).catch(err => { }).catch(err => {
setLoading(false) setLoading(false)
}) })
}) })
form.resetFields();
}, [id]) }, [id])
return ( return (
......
...@@ -33,7 +33,9 @@ const InquiryModalTable:React.FC<InquiryModalTableProps> = (props) => { ...@@ -33,7 +33,9 @@ const InquiryModalTable:React.FC<InquiryModalTableProps> = (props) => {
if(visible) { if(visible) {
const quoteId = schemaAction.getFieldValue('quoteId') const quoteId = schemaAction.getFieldValue('quoteId')
if(quoteId) { if(quoteId) {
rowSelectionCtl.setSelectedRowKeys([quoteId]) setTimeout(() => {
rowSelectionCtl.setSelectedRowKeys([Number(quoteId)])
}, 500)
} }
} }
}, [visible]) }, [visible])
...@@ -42,7 +44,7 @@ const InquiryModalTable:React.FC<InquiryModalTableProps> = (props) => { ...@@ -42,7 +44,7 @@ const InquiryModalTable:React.FC<InquiryModalTableProps> = (props) => {
const item = rowSelectionCtl.selectRow[0] const item = rowSelectionCtl.selectRow[0]
if (item) { if (item) {
schemaAction.setFieldValue('quoteNo', item.quotationNo) schemaAction.setFieldValue('quoteNo', item.quotationNo)
schemaAction.setFieldValue('quoteId', item.id) schemaAction.setFieldValue('quoteId', item.inquiryListId)
const data = await fetchOrderApi.getProductListByQuotationOrderId({ const data = await fetchOrderApi.getProductListByQuotationOrderId({
id: item.inquiryListId id: item.inquiryListId
}) })
......
...@@ -11,7 +11,7 @@ import { mergeAllSchemas } from './schema' ...@@ -11,7 +11,7 @@ import { mergeAllSchemas } from './schema'
import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useProductTableChangeForPay } from './effects' import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useProductTableChangeForPay } from './effects'
import { orderCombination, orderTypeLabelMap, procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant' import { orderCombination, orderTypeLabelMap, procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant'
import { OrderModalType } from '@/constants/order' import { OrderModalType } from '@/constants/order'
import ProductModalTable from './components/productModalTable' import ProductModalTable, { filterProductDataById } from './components/productModalTable'
import InquiryModalTable from './components/inquiryModalTable' import InquiryModalTable from './components/inquiryModalTable'
import CirculationRecord from '../components/circulationRecord' import CirculationRecord from '../components/circulationRecord'
import SelectAddress from './components/selectAddress' import SelectAddress from './components/selectAddress'
...@@ -27,6 +27,7 @@ import { ReadyAddOrderDetailContext } from '../context' ...@@ -27,6 +27,7 @@ import { ReadyAddOrderDetailContext } from '../context'
import { help } from '../../common' import { help } from '../../common'
import styles from './index.less' import styles from './index.less'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect' import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { fetchOrderApi } from './apis'
export interface PurchaseOrderDetailProps {} export interface PurchaseOrderDetailProps {}
...@@ -125,7 +126,13 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -125,7 +126,13 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const [btnLoading, setBtnLoading] = useState(false) const [btnLoading, setBtnLoading] = useState(false)
const update = useUpdate() const update = useUpdate()
const productSumPriceRef = useRef<any>(0) const productSumPriceRef = useRef<any>(0)
const { pageStatus, id, page_type = '0', modelType } = usePageStatus() const {
pageStatus,
id,
page_type = '0',
modelType,
quotationId = null,
} = usePageStatus()
const [initFormSchema, setInitFormSchema] = useState<any>(() => ({...mergeAllSchemas[page_type]})) const [initFormSchema, setInitFormSchema] = useState<any>(() => ({...mergeAllSchemas[page_type]}))
const [initFormValue, setInitFormValue] = useState<any>(() => { const [initFormValue, setInitFormValue] = useState<any>(() => {
let resultState = {} let resultState = {}
...@@ -166,8 +173,38 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -166,8 +173,38 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
shopDataRef.current.orderMode = parseInt(modelType) shopDataRef.current.orderMode = parseInt(modelType)
} }
// 参数存在quotationId 说明是报价跳转
if(quotationId) {
getJumpQuoteProducts()
}
}, []) }, [])
const getJumpQuoteProducts = async () => {
// 查询询价单详情
const { code, data: quotationData } = await PublicApi.getTransactionNotarizeEnquiryProductQuotationDetails({ id: quotationId })
if(code === 1000) {
const { quotationNo, details, shopId, supplyMembersName, supplyMembersId, supplyMembersRoleId, inquiryListId } = quotationData
addSchemaAction.setFieldValue('quoteId', quotationId)
addSchemaAction.setFieldValue('quoteNo', quotationNo)
addSchemaAction.setFieldValue('shopId', shopId)
addSchemaAction.setFieldValue('digest', details)
addSchemaAction.setFieldValue('vendorMemberName', supplyMembersName)
addSchemaAction.setFieldValue('vendorMemberId', supplyMembersId)
addSchemaAction.setFieldValue('vendorRoleId', supplyMembersRoleId)
// 查询商品
const data = await fetchOrderApi.getProductListByQuotationOrderId({
id: inquiryListId
})
let newData = data.map((v: any) => {
v.orderMode = modelType
v.shopId = shopId
return v
})
addSchemaAction.setFieldValue('products', await filterProductDataById([], newData))
}
}
const handleSubmit = async (value) => { const handleSubmit = async (value) => {
try { try {
let fnResult = null let fnResult = null
...@@ -414,12 +451,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -414,12 +451,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
state.visible = true state.visible = true
state.props.enum = enumList.filter(item => item.type === 1 && item.environment === 1) state.props.enum = enumList.filter(item => item.type === 1 && item.environment === 1)
}) })
ctx.setFieldState('quoteNo', state => {
state.props.title = '对应报价单号'
})
ctx.setFieldState('payInfo', state => {
state.visible = true
})
} }
}) })
useOrderFormInitEffect(ctx) useOrderFormInitEffect(ctx)
...@@ -456,9 +487,9 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -456,9 +487,9 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
} }
}) })
// 新增下 切换商城 清空受影响的字段 // 新增下并且不是采购跳转 切换商城 清空受影响的字段
$('onFieldValueChange', 'shopId').subscribe(state => { $('onFieldValueChange', 'shopId').subscribe(state => {
pageStatus === PageStatus.ADD && ctx.reset({ pageStatus === PageStatus.ADD && !quotationId && ctx.reset({
validate: false, validate: false,
selector: '*(quoteNo,quoteId,vendorMemberName,vendorMemberId,vendorRoleId,products,payments)' selector: '*(quoteNo,quoteId,vendorMemberName,vendorMemberId,vendorRoleId,products,payments)'
}) })
......
...@@ -24,7 +24,8 @@ export const useSelfTable = () => { ...@@ -24,7 +24,8 @@ export const useSelfTable = () => {
const handleEdit = (record: any) => { const handleEdit = (record: any) => {
const { orderType } = record const { orderType } = record
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/${orderType === 1 ? 'b2b' : 'srm'}/edit?id=${record.orderId}`) // orderType 询价报价/现货采购跳转b2b修改
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/${(orderType === 1 || orderType === 3) ? 'b2b' : 'srm'}/edit?id=${record.orderId}`)
} }
/** 参照后台数据生成 */ /** 参照后台数据生成 */
......
...@@ -135,7 +135,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => { ...@@ -135,7 +135,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
startTime: item['effectTime'], startTime: item['effectTime'],
endTime: item['expireTime'], endTime: item['expireTime'],
partyBName: item['partyB'], partyBName: item['partyB'],
freeAmount: item['amount'], totalAmount: item['amount'],
sourceType: item['contractType'], sourceType: item['contractType'],
sourceNo: item['receiptNo'], sourceNo: item['receiptNo'],
})) : contractLists.map((item) => ({ })) : contractLists.map((item) => ({
...@@ -145,7 +145,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => { ...@@ -145,7 +145,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
effectTime: item['startTime'], effectTime: item['startTime'],
expireTime: item['endTime'], expireTime: item['endTime'],
partyB: item['partyBName'], partyB: item['partyBName'],
amount: item['freeAmount'], amount: item['totalAmount'],
contractType: item['sourceType'], contractType: item['sourceType'],
receiptNo: item['sourceNo'], receiptNo: item['sourceNo'],
})) }))
......
...@@ -131,6 +131,12 @@ export const baseOrderListColumns: any = () => { ...@@ -131,6 +131,12 @@ export const baseOrderListColumns: any = () => {
key: 'orderTypeName', key: 'orderTypeName',
}, },
{ {
title: '转单订单号',
align: 'center',
dataIndex: 'relationNo',
key: 'relationNo'
},
{
title: '外部状态', title: '外部状态',
align: 'center', align: 'center',
dataIndex: 'outerStatusName', dataIndex: 'outerStatusName',
...@@ -196,6 +202,11 @@ export const useTransformOrderTable = (ctx: ISchemaFormActions | ISchemaFormAsyn ...@@ -196,6 +202,11 @@ export const useTransformOrderTable = (ctx: ISchemaFormActions | ISchemaFormAsyn
ellipsis: true, ellipsis: true,
render: (t) => `¥${t}` render: (t) => `¥${t}`
}, },
{
title: '操作',
key: 'operation',
dataIndex: 'operation',
}
] ]
// 渲染操作 // 渲染操作
orderInfoColumns[orderInfoColumns.length - 1].render = (text, record) => <Button type='link' size="small" onClick={() => handleDelete(record)}>删除</Button> orderInfoColumns[orderInfoColumns.length - 1].render = (text, record) => <Button type='link' size="small" onClick={() => handleDelete(record)}>删除</Button>
......
...@@ -46,13 +46,9 @@ export const usePaymentTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction ...@@ -46,13 +46,9 @@ export const usePaymentTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const handleSave = row => { const handleSave = row => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('payments')] const newData = [...ctx.getFieldValue('payments')]
console.log(newData, row)
const paymentIndex = newData.findIndex(item => row.serialNo === item.serialNo ) const paymentIndex = newData.findIndex(item => row.serialNo === item.serialNo )
console.log(paymentIndex)
const nodeItem = newData[paymentIndex]['nodes'] const nodeItem = newData[paymentIndex]['nodes']
console.log(nodeItem)
const nodeIndex = nodeItem.findIndex(item => row.batchNo === item.batchNo) const nodeIndex = nodeItem.findIndex(item => row.batchNo === item.batchNo)
console.log(nodeIndex)
nodeItem.splice(nodeIndex, 1, { nodeItem.splice(nodeIndex, 1, {
...nodeItem[nodeIndex], ...nodeItem[nodeIndex],
...row, ...row,
......
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