Commit 9953b0cc authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 对接新增请购单/请购单列表查询

parent 2355c86a
......@@ -3,17 +3,17 @@ import { createContext } from 'react';
// 招标详情 Context
export const BidDetailContext = createContext<any>({})
// 待新增招标 详情
export const ReadyAddBidDetailContext = createContext<any>({})
// // 待新增招标 详情
// export const ReadyAddBidDetailContext = createContext<any>({})
// 专家评标详情
export const RemarkDetailContext = createContext<any>({})
// // 专家评标详情
// export const RemarkDetailContext = createContext<any>({})
// 待提交评标报告详情
export const ReportDetailContext = createContext<any>({})
// // 待提交评标报告详情
// export const ReportDetailContext = createContext<any>({})
// 待定标(审核定标、确认定标)详情
export const ReadyConfirmBidContext = createContext<any>({})
// // 待定标(审核定标、确认定标)详情
// export const ReadyConfirmBidContext = createContext<any>({})
// 待发中标公示
export const ReadySendBidNoticeContext = createContext<any>({})
// // 待发中标公示
// export const ReadySendBidNoticeContext = createContext<any>({})
import React, { useRef } from 'react'
import { useCallback, useState, useEffect } from 'react'
import { usePageStatus } from '@/hooks/usePageStatus'
import { PublicApi } from '@/services/api'
import { Link } from 'umi'
import { formatTimeString } from '@/utils'
import StatusColors from '../../../components/statusColors'
import { message } from 'antd'
import { history } from 'umi'
......@@ -20,45 +16,12 @@ interface BillDetailHookProps {
// 请购单详情
export const useBillDetail = (options: BillDetailHookProps) => {
// 订单详情内容
// 详情数据
const [formData, setFormData] = useState<any>(null)
// 当前的支付信息id 默认第一个
const [currentPayInfoId, setCurrentPayInfoId] = useState<any>(null)
// 支付信息列表
const [payList, setPaylist] = useState<any[]>([])
const { id } = usePageStatus()
const { orderNo } = history.location.query
const { requisitionNo } = history.location.query
const { type = 'requestBill' } = options
const dataRef = useRef<any>([
{ label: '对应报价单号', name: 'quoteNo', span: 8, render: (text, record) => <Link
to={type[0] === 's' ? `/memberCenter/tranactionAbility/inquiryOffer/offerSearch/offer/preview?id=${record?.quoteId}` : `/memberCenter/tranactionAbility/confirmOffer/offerSearch/offer/preview?id=${record?.quoteId}`}>
{text}
</Link>
},
{ label: '订单摘要', name: 'digest', span: 8 },
{ label: type[0] === 's' ? '采购会员' : '供应会员', name: type[0] === 's' ? 'buyerMemberName' : 'vendorMemberName', span: 8 },
{ label: '下单模式', name: 'orderModeName', span: 8 },
{ label: '订单类型', name: 'orderTypeName', span: 8 },
{ label: '下单时间', name: 'createTime', span: 8, render: text => formatTimeString(text) },
{
label: '外部状态',
name: 'outerStatusName',
span: 8,
render: (text, record) => <StatusColors type='out' status={text} text={record.outerStatusName} />
},
{
label: '内部状态',
name: 'innerStatusName',
span: 8,
// render: (text, record) => <StatusColors type={type} status={text} text={record.innerStatusName} />
},
{
label: '来源商城',
name: 'shopName',
span: 8,
},
])
useEffect(() => {
reloadFormData()
......@@ -67,42 +30,24 @@ export const useBillDetail = (options: BillDetailHookProps) => {
// 根据type类型 调用不同的详情接口
const getDetailsApi = (type) => {
let api = null;
console.log(type, 'type')
switch (type) {
case 'purchaseOrder': api = PublicApi.getOrderBuyerDetail;
break;
case 'saleOrder': api = PublicApi.getOrderVendorDetail;
break;
case 'p_readyReceiveOrder': api = PublicApi.getOrderBuyerValidateReceiveDetail;
break;
case 's_readyConfirmDelevedOrder': api = PublicApi.getOrderVendorValidateDeliveryDetail;
break;
case 'p_readyPayOrder': api = PublicApi.getOrderBuyerValidatePayDetail;
break;
case 's_readyPayResult': api = PublicApi.getOrderVendorValidatePayConfirmDetail;
case 'requestBill': api = PublicApi.getPurchaseRequisitionDetail;
default:
api = PublicApi.getOrderBuyerDetail;
api = PublicApi.getPurchaseRequisitionDetail;
}
return api;
}
const reloadFormData = useCallback(() => {
if (id || orderNo) {
if (id || requisitionNo) {
const fn = getDetailsApi(type)
// @ts-ignore
fn( id ? { orderId: id } : { orderNo }, { ctlType: "none" }).then(res => {
fn( id ? { id } : { requisitionNo }, { ctlType: "none" }).then(res => {
const { code, data, message: msg } = res
if (code === 1000) {
setFormData(data)
// // 待支付订单获取所有支付方式
// if(type === 'p_readyPayOrder') {
// reloadPayList(id)
// }
if(data.payments.length > 0){
// 过滤出未支付的 第一个
const payObj = data.payments.filter(item => item.showPayment)[0]
setCurrentPayInfoId(payObj?.paymentId ? payObj.paymentId : data.payments[0].paymentId)
}
} else {
message.error(msg)
}
......@@ -110,31 +55,17 @@ export const useBillDetail = (options: BillDetailHookProps) => {
}
}, [id])
const reloadPayList = (orderId) => {
PublicApi.getOrderBuyerValidatePayType({orderId}).then(res => {
const { code, data } = res
if (code === 1000) {
setPaylist(data)
}
})
}
// 需共享的状态
const formContext = {
data: formData,
currentPayInfoId,
payList,
ctl: {
setData: setFormData,
setPayId: setCurrentPayInfoId,
},
reloadFormData
}
return {
formContext,
id,
detailList: dataRef.current
}
}
......@@ -63,8 +63,8 @@ const ReadyAddRequisitionOrder:React.FC<ReadyAddRequisitionOrderProps> = () => {
}
const clickAdd = () => {
// srm 采购合同下单
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddSrmOrder/add`)
// 采购请购下单
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddRequisitionOrder/add`)
}
return <PageHeaderWrapper>
......
......@@ -21,7 +21,7 @@ export const useSelfTable = () => {
}
const handleEdit = (record: any) => {
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddSrmOrder/edit?id=${record.orderId}`)
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddRequisitionOrder/edit?id=${record.orderId}`)
}
/** 参照后台数据生成 */
......
......@@ -7,12 +7,12 @@ import BillDetailHeader from '../components/billDetailHeader';
import BillDetailSection from '../components/billDetailSection';
const OrderPreview: React.FC = () => {
const { formContext, detailList } = useBillDetail({type: 'requestBill'})
const { formContext } = useBillDetail({type: 'requestBill'})
const anchorTitleList = [
{ title: '流转进度', id: 'transferProcess', componentName: "TransferProcess" },
{ title: '基本信息', id: 'baseicInfo', type: "basicInfo" },
{ title: '招标物料', id: 'billMaterial', componentName: "BillMaterial" },
{ title: '请购物料', id: 'billMaterial', componentName: "BillMaterial" },
{ title: '流转记录', id: 'transferRecord', componentName: "TransformRecord" },
]
......
......@@ -79,7 +79,7 @@ const BillDetailHeader: React.FC<BillDetailHeaderProps> = ({
<ArrowLeftOutlined onClick={() => backLink ? history.push(backLink) : history.goBack()} />
</Col>
<Col>
<div className={style.titleAvatorText}>{formContext.data.orderNo}</div>
<div className={style.titleAvatorText}>{formContext.data.requisitionNo}</div>
</Col>
</Row>
<Row>
......
......@@ -5,6 +5,7 @@ import DescriptionsInfo from '../descriptionsInfo'
import BillMaterial from '../billMaterial'
import TransferProcess from '../transferProcess'
import TransformRecord from '../transferRecord'
import AuditProcess from '@/components/AuditProcess'
export interface BillDetailSectionProps {
formContext: any,
type: 'requestBill'
......@@ -41,33 +42,32 @@ const BillDetailSection:React.FC<BillDetailSectionProps> = ({
const RenderCertainContent = ({ title, type = null, componentName = null }) => {
let RcDom: any = null;
switch(componentName) {
//@todo 需另外调用接口获取数据
case 'TransferProcess':
RcDom = (<TransferProcess
cardTitle={title}
customTitleKey='name'
customKey='id'
outerVerifyCurrent={findLastIndexFlowState(formContext.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formContext.interiorWorkflowFlowRecordLogResponses)}
RcDom = (<AuditProcess
customTitleKey='stepName'
customKey='step'
initRadioValue='inner'
outerVerifyCurrent={formContext.data.currentOuterStep}
innerVerifyCurrent={formContext.data.currentInnerStep}
outerVerifySteps={
formContext.externalWorkflowFlowRecordLogResponses ?
formContext.externalWorkflowFlowRecordLogResponses.map(item => ({
formContext.data.outerSteps ?
formContext.data.outerSteps.map(item => ({
...item,
status: item.isActive ? 'finish' : 'wait',
status: (item.step <= formContext.data.currentOuterStep) ? 'finish' : 'wait',
})) :
[]
null
}
innerVerifySteps={
formContext.interiorWorkflowFlowRecordLogResponses ?
formContext.interiorWorkflowFlowRecordLogResponses.map(item => ({
formContext.data.innerSteps ?
formContext.data.innerSteps.map(item => ({
...item,
status: item.isActive ? 'finish' : 'wait',
status: (item.step <= formContext.data.currentInnerStep) ? 'finish' : 'wait',
})) :
[]
null
}
></TransferProcess>)
></AuditProcess>)
break;
case "BiillMaterial":
case "BillMaterial":
RcDom = (<BillMaterial cardTitle={title} />)
break;
case "TransformRecord":
......
.card-list {
font-size: 12px;
line-height: 20px;
margin-top: 24px;
}
.card-list_title {
font-size: 12px;
color: #909399;
}
import React, { useContext } from 'react'
import { Table, Button, Switch, Tooltip, Row, Col } from 'antd'
import { Table } from 'antd'
import MellowCard from '@/components/MellowCard'
import { BidDetailContext } from '@/pages/procurement/_public/bid/context';
import { QuestionCircleOutlined } from '@ant-design/icons';
import style from './index.less'
import { CALLFORBID_TYPE } from '@/constants/procurement';
import { ENTERPRISE_CENTER_URL } from '@/constants'
import { BillDetailContext } from '@/pages/transaction/_public/bill/effects/context';
/**
* 请购单 请购物料
......@@ -16,58 +12,64 @@ export interface BidMethodProps {
}
const BidMethod: React.FC<BidMethodProps> = ({cardTitle}) => {
const bidDetailContext = useContext(BidDetailContext)
const { data: _data, ctl, apiType } = bidDetailContext
// 处理和投标有关的数据格式
const data = apiType === 'callForBid' ? _data : _data.inviteTender
const bidDetailContext = useContext(BillDetailContext)
const { data } = bidDetailContext
const columns = [
{
title: '序号',
dataIndex: 'id',
key: 'id',
render: (t, r, i) => ++i
title: '物料编号',
dataIndex: 'productNo',
key: 'productNo',
},
{
title: '物料名称',
dataIndex: 'name',
key: 'name',
},
{
title: '规格型号',
dataIndex: 'spec',
key: 'spec',
},
{
title: '会员名称',
dataIndex: 'memberName',
key: 'memberName',
title: '品类',
dataIndex: 'category',
key: 'category',
},
{
title: '会员类型',
dataIndex: 'memberTypeName',
key: 'memberTypeName',
title: '品牌',
dataIndex: 'brand',
key: 'brand',
},
{
title: '会员角色',
title: '单位',
dataIndex: 'memberRoleName',
key: 'memberRoleName',
},
{
title: '是否归属会员',
dataIndex: 'isSubMember',
key: 'isSubMember',
render: (t, r) => t ? '是' : '否',
title: '预估单价',
dataIndex: 'price',
key: 'price',
render: t => t ? `¥${t}` : null
},
{
title: '数量',
dataIndex: 'quantity',
key: 'quantity',
},
{
title: <>状态<Tooltip title="打开开关,审核通过后,将招标发至对应的会员"><span>&nbsp;<QuestionCircleOutlined /></span></Tooltip></>,
dataIndex: 'isSend',
key: 'isSend',
render: (text, record) => <Switch disabled defaultChecked={text} onChange={() => onChange(record)} />
title: '预估金额',
dataIndex: 'amount',
key: 'amount',
render: t => t ? `¥${t}` : null
},
{
title: '操作',
dataIndex: 'ctl',
key: 'ctl',
render: (text, record) => <Button type="link" target="blank" href={`${ENTERPRISE_CENTER_URL}/shop/${record.memberId}_${record.roleId}`}>进入店铺</Button>
title: '已转订单数量',
dataIndex: 'transferQuantity',
key: 'transferQuantity',
}
];
const onChange = (record) => {
console.log(record)
}
return (
<MellowCard
title={cardTitle}
......@@ -75,13 +77,7 @@ const BidMethod: React.FC<BidMethodProps> = ({cardTitle}) => {
bordered={false}
fullHeight
>
<div className={style['card-list']}>
<Row>
<Col span={2}><p className={style['card-list_title']}>招标方式</p></Col>
<Col><p>{CALLFORBID_TYPE[data.inviteTenderType]}</p></Col>
</Row>
</div>
<Table dataSource={data.memberList} columns={columns} pagination={{size: "small"}} />
<Table dataSource={data.product.products} columns={columns} pagination={{size: "small"}} />
</MellowCard>)
}
......
import React, { useContext } from 'react'
import { Row, Col } from 'antd'
import MellowCard from '@/components/MellowCard'
import { BidDetailContext } from '@/pages/procurement/_public/bid/context';
import { formatTimeString } from '@/utils'
import style from './index.less'
import { BillDetailContext } from '@/pages/transaction/_public/bill/effects/context';
/**
* 描述信息列表
......@@ -19,8 +19,8 @@ export interface BasicInfoProps {
}
const DescriptionsInfo: React.FC<BasicInfoProps> = ({cardTitle, type}) => {
const bidDetailContext = useContext(BidDetailContext)
const { data: _data, address, ctl, apiType } = bidDetailContext
const bidDetailContext = useContext(BillDetailContext)
const { data: _data } = bidDetailContext
// 基本信息——请购单
......@@ -28,19 +28,19 @@ const DescriptionsInfo: React.FC<BasicInfoProps> = ({cardTitle, type}) => {
{
span: 8,
fieldList: [
{ title: '招标编号:', name: 'code' },
{ title: '外部状态:', name: 'inviteTenderOutStatusValue', render: () => _data['submitTenderOutStatusValue']},
{ title: '内部状态:', name: 'inviteTenderInStatusValue', render: () => _data['submitTenderInStatusValue']},
{ title: '发布时间:', name: 'createTime', render: (text) => formatTimeString(text) },
{ title: '请款单号:', name: 'requisitionNo' },
{ title: '请购单摘要:', name: 'digest' },
{ title: '创建人:', name: 'creator' },
{ title: '单据时间:', name: 'createTime' },
]
},
{
span: 8,
fieldList: [
{
title: '适用地址:',
name: 'inviteTenderAreaList',
},
{ title: '预交日期:', name: 'deliverTime' },
{ title: '请购部门:', name: 'department' },
{ title: '请购用途:', name: 'purpose' },
{ title: '供应会员:', name: 'vendorMemberName' },
]
}
]
......
import React, { useContext, useEffect, useState } from 'react'
import { Table, Radio } from 'antd'
import { formatTimeString } from '@/utils'
import { BidDetailContext } from '@/pages/procurement/_public/bid/context';
import MellowCard from '@/components/MellowCard'
import { TransferEnum } from '../transferProcess';
import style from './index.less'
import { BillDetailContext } from '@/pages/transaction/_public/bill/effects/context';
/**
* 请购订单流转记录
......@@ -15,18 +15,27 @@ export interface BidTransformRecordProps {
}
const BidTransformRecord:React.FC<BidTransformRecordProps> = ({cardTitle}) => {
const { data, externalProcurementOrderLogResponses, interiorProcurementOrderLogResponses, apiType } = useContext(BidDetailContext)
// 根据模式选择对应的状态映射
const insideModel = apiType.indexOf('ender') !== -1 ? 'tenderInside' : 'inside';
const { data } = useContext(BillDetailContext)
const {innerHistories: interiorProcurementOrderLogResponses, externalProcurementOrderLogResponses = []} = data
const [transferRadio, setTransferRadio] = useState<TransferEnum>(TransferEnum.Outer)
// createTime: "2021-10-30 16:38:35"
// department: ""
// id: 6
// jobTitle: "超级管理员"
// operation: "新增订单"
// operator: "133"
// remark: ""
// statusName: "待提交审核"
const outReocrdCols: any[] = [
{
title: '流转顺序号',
dataIndex: 'no',
dataIndex: 'id',
align: 'center',
key: 'no',
key: 'id',
render: (_, __, index: number) => index + 1
},
{
......@@ -64,34 +73,34 @@ const BidTransformRecord:React.FC<BidTransformRecordProps> = ({cardTitle}) => {
const insideRecordCols: any[] = [
{
title: '流转记录',
dataIndex: 'no',
dataIndex: 'id',
align: 'center',
key: 'no',
key: 'id',
render: (_, __, index: number) => index + 1
},
{
title: '操作人',
dataIndex: 'userName',
dataIndex: 'operator',
align: 'center',
key: 'userName',
key: 'operator',
},
{
title: '部门',
dataIndex: 'userOrgName',
dataIndex: 'department',
align: 'center',
key: 'userOrgName',
key: 'department',
},
{
title: '职位',
dataIndex: 'userJobTitle',
dataIndex: 'jobTitle',
align: 'center',
key: 'userJobTitle',
key: 'jobTitle',
},
{
title: '状态',
dataIndex: 'statusValue',
dataIndex: 'statusName',
align: 'center',
key: 'statusValue',
key: 'statusName',
},
{
title: '操作',
......@@ -108,9 +117,9 @@ const BidTransformRecord:React.FC<BidTransformRecordProps> = ({cardTitle}) => {
},
{
title: '审核意见',
dataIndex: 'checkRemark',
dataIndex: 'remark',
align: 'center',
key: 'checkRemark',
key: 'remark',
},
]
......@@ -136,7 +145,7 @@ const BidTransformRecord:React.FC<BidTransformRecordProps> = ({cardTitle}) => {
extra={
<Radio.Group value={transferRadio} buttonStyle="solid" size="small" onChange={handleChangeType}>
{externalProcurementOrderLogResponses?.length ? <Radio.Button value={TransferEnum.Outer}>外部流转</Radio.Button> : null}
{interiorProcurementOrderLogResponses?.length && apiType!=='tenderInCallForBid' && apiType!=='callForBidInTender' ? <Radio.Button value={TransferEnum.Interior}>内部流转</Radio.Button> : null}
{interiorProcurementOrderLogResponses?.length ? <Radio.Button value={TransferEnum.Interior}>内部流转</Radio.Button> : null}
</Radio.Group>
}
className={style.cardWrap}
......
......@@ -165,11 +165,11 @@ export const baseOrderListColumns: any = () => {
{
title: '请购单号',
align: 'center',
dataIndex: 'orderNo',
key: 'orderNo',
dataIndex: 'requisitionNo',
key: 'requisitionNo',
render: (text, record) => {
return (
<EyePreview url={`${history.location.pathname}/preview?id=${record.orderId}`}>
<EyePreview url={`${history.location.pathname}/preview?id=${record.id}`}>
{text}
</EyePreview>
)
......@@ -184,46 +184,45 @@ export const baseOrderListColumns: any = () => {
{
title: '供应会员',
align: 'center',
dataIndex: 'memberName',
key: 'memberName',
render: (t, r) => r.memberName ? t : r.buyerMemberName
dataIndex: 'vendorMemberName',
key: 'vendorMemberName',
},
{
title: '交付日期',
align: 'center',
dataIndex: 'createTime',
key: 'createTime',
dataIndex: 'deliverTime',
key: 'deliverTime',
render: (text) => formatTimeString(text)
},
{
title: '请购部门',
align: 'center',
dataIndex: 'digest',
key: 'digest',
dataIndex: 'department',
key: 'department',
},
{
title: '请购用途',
align: 'center',
dataIndex: 'digest',
key: 'digest',
dataIndex: 'purpose',
key: 'purpose',
},
{
title: '请购数量',
align: 'center',
dataIndex: 'amount',
key: 'amount',
dataIndex: 'quantity',
key: 'quantity',
},
{
title: '已转订单数量',
align: 'center',
dataIndex: 'amount',
key: 'amount',
dataIndex: 'transferQuantity',
key: 'transferQuantity',
},
{
title: '单据时间',
align: 'center',
dataIndex: 'orderTypeName',
key: 'orderTypeName',
dataIndex: 'createTime',
key: 'createTime',
},
{
title: '内部状态',
......
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