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

Merge branch 'dev-orderV2' into dev-srm

parents 1b5fbd68 f82ed487
......@@ -93,6 +93,8 @@ const Detail: React.FC<{}> = () => {
const [loading, setLoading] = useState<boolean>(false);
const [deliverAddressOption, setDeliverAddressOption] = useState([]);
const [activeAddress, setActiveAddress] = useState<string | null>(null)
const [activeKey, setActiveKey] = useState<string>("1");
const hasProductNoDelievery = useMemo(() => {
let res = false
if(pathname === `${PENDING_RECEIPT_PATH}/detail`) {
......@@ -140,6 +142,12 @@ const Detail: React.FC<{}> = () => {
}
}, [id]);
useEffect(() => {
if (info?.pnoReceiveDeliverDetailDOList?.length > 0) {
setActiveKey("2");
}
}, [info.pnoReceiveDeliverDetailDOList])
// 确认生产通知单 -> 待提交审核生产通知单时需要同时提交他的发货地址
useEffect(() => {
if(isSetDeliverAddress) {
......@@ -343,6 +351,14 @@ const Detail: React.FC<{}> = () => {
})
}
/**
* tab change
*/
const handleTabChange = (tabKey) => {
console.log(tabKey)
setActiveKey(tabKey);
}
return (
<PageHeaderWrapper
title={
......@@ -444,22 +460,26 @@ const Detail: React.FC<{}> = () => {
{
info && info.outerTaskType !== 29
? <div style={{marginTop: '20px'}}>
<ReceiptDeliveryDetailsCard defaultActiveKey="1">
<StatisticsTab tabKey="1" tab="收发货统计" columns={receiveColumns(info.source === SourceEnum.order ? 'order' : 'product')} dataSource={info.details}></StatisticsTab>
{
info.pnoReceiveDeliverDetailDOList &&
info.pnoReceiveDeliverDetailDOList.length > 0
? <DetailTab
tabKey="2"
tab="收发货明细"
columns={receiptAndDeliveryDetailsColumns}
dataSource={info.pnoReceiveDeliverDetailDOList}
handleConfirm={handleConfirm}
/>
: null
}
</ReceiptDeliveryDetailsCard>
<Card bodyStyle={{padding: '10px 24px 24px 24px'}}>
<Tabs activeKey={activeKey} onChange={handleTabChange}>
<TabPane key="1" tab="收发货统计">
<StatisticsTab columns={receiveColumns(info.source === SourceEnum.order ? 'order' : 'product')} dataSource={info.details}></StatisticsTab>
</TabPane>
{
info.pnoReceiveDeliverDetailDOList &&
info.pnoReceiveDeliverDetailDOList.length > 0
?
<TabPane key="2" tab="收发货明细">
<DetailTab
columns={receiptAndDeliveryDetailsColumns}
dataSource={info.pnoReceiveDeliverDetailDOList}
handleConfirm={handleConfirm}
/>
</TabPane>
: null
}
</Tabs>
</Card>
</div>
: null
}
......
......@@ -258,6 +258,7 @@ const Query: React.FC<{}> = (props) => {
service(params).then(({data, code}) => {
setBatchLoading(false);
if(code === 1000) {
selectRowFns.setSelectedRowKeys([]);
formActions.submit();
}
})
......
......@@ -7,10 +7,10 @@ import { history, Link } from 'umi'
import { ASSIGN_PENDING_RECEIVE_DETAIL, PENDING_DELIVERD_PATH, PENDING_RECEIPT_PATH } from '../../common';
interface Iprops {
tab: string,
// tab: string,
columns: ColumnsType<any>,
dataSource: any[],
tabKey: string,
// tabKey: string,
handleConfirm: (type: string, params: any) => void
}
......@@ -80,8 +80,8 @@ const DetailTab: React.FC<Iprops> = (props) => {
}
const sorted = dataSource && dataSource.sort((a, b) => a.deliveryBatch - b.deliveryBatch ) || []
return (
<div >
<div >
<div>
<div>
<Radio.Group value={activeBatch} onChange={handleOnChange}>
{
sorted.map((item, key) => {
......
import React from 'react';
import { Card, Tabs } from 'antd';
const TabPane = Tabs.TabPane
interface Iprops {
defaultActiveKey: string
};
const ReceiptDeliveryDetailsCard: React.FC<Iprops> = (props) => {
const newChildren = React.Children.map(props.children, (child: any, index) => {
if(child) {
return (
<TabPane tab={child.props.tab} key={child.props.tabKey.toString() || index.toString()}>
{child}
</TabPane>
)
} else {
return null
}
})
console.log(props.defaultActiveKey)
return (
<Card bodyStyle={{padding: '10px 24px 24px 24px'}}>
<Tabs defaultActiveKey={props.defaultActiveKey}>
{newChildren}
</Tabs>
</Card>
)
}
export default ReceiptDeliveryDetailsCard
......@@ -2,12 +2,14 @@ import React from 'react';
import { Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
interface Iprops {
tab: string,
// tab: string,
columns: ColumnsType<any>,
dataSource: any[],
tabKey: string,
// tabKey: string,
}
const StatisticsTab: React.FC<Iprops> = (props) => {
const { columns, dataSource } = props;
return (
......
import ReceiptDeliveryDetailsCard from './ReceiptDeliveryDetailsCard';
// import ReceiptDeliveryDetailsCard from './ReceiptDeliveryDetailsCard';
import DetailTab from './DetailTab';
import StatisticsTab from './StatisticsTab';
export {
ReceiptDeliveryDetailsCard,
// ReceiptDeliveryDetailsCard,
DetailTab,
StatisticsTab
}
\ No newline at end of file
}
......@@ -141,7 +141,9 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
}
setLoading(true)
let getFn;
let headers = {}
let headers = {
type: 1
}
switch (layoutType) {
case LAYOUT_TYPE.mall:
getFn = PublicApi.postSearchShopEnterpriseGetCommodityList
......
......@@ -95,6 +95,9 @@ const CommoditySearch: React.FC<CommodityPropsType> = (props) => {
}
setLoading(true)
let getFn;
const headers: { type: number } = {
type: 1
}
switch (layoutType) {
case LAYOUT_TYPE.mall:
getFn = PublicApi.postSearchShopEnterpriseGetCommodityList
......@@ -104,16 +107,18 @@ const CommoditySearch: React.FC<CommodityPropsType> = (props) => {
getFn = PublicApi.postSearchShopStoreGetCommodityList
break
case LAYOUT_TYPE.channel:
headers.type = 3
param.channelMemberId = memberId
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
headers.type = 4
param.channelMemberId = memberId
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
}
getFn && getFn(param).then(res => {
getFn && getFn(param, { headers }).then(res => {
setLoading(false)
if (res.code === 1000) {
message.destroy()
......
......@@ -31,12 +31,15 @@ const Interested: React.FC<InterestedPropsType> = (props) => {
current: 1,
pageSize: 5
}
const headers: any = {}
const headers: any = {
type: 1
}
switch (layoutType) {
case LAYOUT_TYPE.shop:
case LAYOUT_TYPE.mall:
param.storeId = shopInfo.id
if (priceType === COMMODITY_TYPE.integral) {
headers.type = 2
param.priceTypeList = [3]
getFn = PublicApi.postSearchShopScoreGetCommodityList
} else if (priceType === COMMODITY_TYPE.inquiry) {
......
......@@ -4,6 +4,7 @@ import { Rate, Pagination, Spin } from 'antd'
import ImageViewList from '../ImageViewList'
import defaultAvatar from '@/assets/imgs/default_avatar.png'
import { PublicApi } from '@/services/api'
import { LAYOUT_TYPE } from '@/constants'
import { GetMemberCommentMallTradeHistoryPageResponseDetail, GetMemberCommentMallTradeSummaryResponse } from '@/services/MemberApi'
import isEmpty from 'lodash/isEmpty'
import NoData from '@/components/NoData'
......@@ -13,11 +14,12 @@ import styles from './index.less'
interface CommentPropsType {
productIds: number[],
setCount: Function,
storeId: number,
memberId: number,
layoutType: LAYOUT_TYPE
}
const Comment: React.FC<CommentPropsType> = (props) => {
const { productIds, setCount, storeId } = props
const { productIds, setCount, memberId, layoutType } = props
const [current, setCurrent] = useState<number>(1)
const [pageSize] = useState<number>(10)
const [totalCount, setTotalCount] = useState<number>(0)
......@@ -46,8 +48,7 @@ const Comment: React.FC<CommentPropsType> = (props) => {
const param: any = {
current,
pageSize,
productIds: productIds.toString(), // '2339'
shopId: storeId,
productIds: productIds.toString(),
}
if (type === 'good') {
param.starLevel = 3
......@@ -56,6 +57,11 @@ const Comment: React.FC<CommentPropsType> = (props) => {
} else if (type === 'bad') {
param.starLevel = 1
}
if(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) {
param.channelMemberId = memberId
}
setSpinLoading(true)
PublicApi.getMemberCommentMallTradeHistoryPage(param).then(res => {
......@@ -70,7 +76,15 @@ const Comment: React.FC<CommentPropsType> = (props) => {
}
const fetchCommentSummary = () => {
PublicApi.getMemberCommentMallTradeSummary({ productIds: productIds.toString(), shopId: String(storeId) }).then(res => {
const param: any = {
productIds: productIds.toString()
}
if(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) {
param.channelMemberId = memberId
}
PublicApi.getMemberCommentMallTradeSummary(param).then(res => {
if (res.code === 1000) {
setSummaryInfo(res.data)
getCommentCountBySummary(res.data.rows)
......
......@@ -12,7 +12,7 @@ import Comment from './components/Comment'
import Introduction from './components/Introduction'
import TradeRecord from './components/TradeRecord'
import Recommand from './components/Recommand'
import { COMMODITY_TYPE } from '@/constants'
import { COMMODITY_TYPE, LAYOUT_TYPE } from '@/constants'
import { GetSearchShopStoreGetCommodityDetailResponse } from '@/services/SearchApi'
import cx from 'classnames'
import styles from './index.less'
......@@ -23,10 +23,12 @@ interface ProductDescriptionPropsType {
commodityDetail: GetSearchShopStoreGetCommodityDetailResponse,
dataList: any,
storeId: number,
memberId: number,
layoutType: LAYOUT_TYPE,
}
const ProductDescription: React.FC<ProductDescriptionPropsType> = (props) => {
const { commodityDetail, dataList, storeId } = props
const { commodityDetail, dataList, storeId, memberId, layoutType } = props
const [currentAnchor, setCurrentAnchor] = useState<string>("#introduction")
const [productIds, setProductIds] = useState<number[]>([])
const [tradeRecordCount, setTradeRecordCount] = useState<number>(0)
......@@ -79,7 +81,7 @@ const ProductDescription: React.FC<ProductDescriptionPropsType> = (props) => {
</Anchor>
<Introduction commodityDetail={commodityDetail} />
<TradeRecord productIds={productIds} storeId={storeId} setCount={(count) => setTradeRecordCount(count)} />
<Comment productIds={productIds} storeId={storeId} setCount={(count) => setCommentCount(count)} />
<Comment productIds={productIds} memberId={memberId} layoutType={layoutType} setCount={(count) => setCommentCount(count)} />
<Recommand dataList={dataList} {...props} />
</div>
)
......
......@@ -124,6 +124,9 @@ const CommodityDetail = (props) => {
switch (layoutType) {
case LAYOUT_TYPE.shop:
param.storeId = shopId
headers = {
type: 1
}
switch (priceType) {
case COMMODITY_TYPE.prompt:
param.priceTypeList = [1]
......@@ -134,6 +137,9 @@ const CommodityDetail = (props) => {
getListFn = PublicApi.postSearchShopStoreGetCommodityList
break
case COMMODITY_TYPE.integral:
headers = {
type: 2
}
param.priceTypeList = [3]
getListFn = PublicApi.postSearchShopScoreGetCommodityList
break
......@@ -219,6 +225,15 @@ const CommodityDetail = (props) => {
getDetailFn = PublicApi.getSearchShopChannelGetCommodityDetail
break
default:
if(type === "3") {
headers = {
type: 2
}
} else {
headers = {
type: 1
}
}
getDetailFn = PublicApi.getSearchShopStoreGetCommodityDetail
break
}
......
......@@ -37,7 +37,7 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
for (const id of categoryIds) {
const resList: any = await getListById(id)
result = [...result, ...resList]
if (result && result.length >= 5) {
if (result && result.length > 0) {
setList(result)
break
}
......@@ -66,24 +66,23 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
pageSize: 5,
customerCategoryId: categoryId,
}
let headers = {}
const headers: { type: number } = {
type: 1
}
let getListFn
switch (layoutType) {
case LAYOUT_TYPE.channel:
headers = {
type: 3
}
headers.type = 3
param.channelMemberId = memberId
getListFn = PublicApi.postSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
headers = {
type: 4
}
headers.type = 4
param.channelMemberId = memberId
getListFn = PublicApi.postSearchShopChannelGetCommodityList
break
default:
headers.type = 1
getListFn = PublicApi.postSearchShopEnterpriseGetCommodityList
break
}
......
......@@ -81,7 +81,9 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
param = Object.assign(param, filterParam)
}
setLoading(true)
let headers = {}
let headers = {
type: 2
}
let getFn
switch (layoutType) {
case LAYOUT_TYPE.channel:
......
......@@ -57,21 +57,20 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
*/
const fetchPurchaseList = () => {
let getFn
let headers = {}
const headers: { type: number} = {
type: 1
}
switch (layoutType) {
case LAYOUT_TYPE.channel:
headers = {
type: 3
}
headers.type = 3
getFn = PublicApi.getSearchShopPurchaseChannelGetPurchaseList
break;
case LAYOUT_TYPE.ichannel:
headers = {
type: 4
}
headers.type = 4
getFn = PublicApi.getSearchShopPurchaseChannelGetPurchaseList
break;
default:
headers.type = 1
getFn = PublicApi.getSearchShopPurchaseGetPurchaseList
break;
}
......
......@@ -253,6 +253,10 @@ export const formSchema: ISchema = {
required: true,
"x-rules": [
{
required: true,
message: '请填写详细地址',
},
{
limitByte: true,
maxByte: 100,
},
......
......@@ -46,6 +46,9 @@ const AddRepository:React.FC<{}> = (props) => {
params['warehouseName'] = prevState.props.enum.filter((item: any) => item.value === prevState.value)[0]['label']
}
})
addSchemaAction.getFieldState('shopIds', state => {
params['shopIds'] = state.value.map(item => state.props['x-component-props'].dataSource.filter(_ => _.id === item)[0])
})
let res = await PublicApi.postWarehouseFreightSpaceAdd(params)
if(res.code === 1000) {
setTimeout(() => {
......
This diff is collapsed.
......@@ -68,6 +68,11 @@ const Commodity: React.FC = () => {
break
}
el.target = '_blank';
el.id = detail.commodity.id
// 防止反复添加
if(!document.getElementById(detail.commodity.id)) {
document.body.appendChild(el);
}
el.click()
} else {
message.destroy()
......@@ -130,7 +135,7 @@ const Commodity: React.FC = () => {
PublicApi.postSearchShopCommodityCollectDeleteCommodityCollect(param).then(res => {
if (res.code === 1000) {
fetchCollectCommodityList()
resolve()
resolve(true)
} else {
reject()
}
......
import React, { useEffect, useState } from 'react'
import cx from 'classnames'
import { Pagination, message, Modal } from 'antd'
import { StarFilled, EyeOutlined, ClockCircleOutlined } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
import { numFormat } from '@/utils/numberFomat'
import moment from 'moment'
import styles from './index.less'
const Information: React.FC = () => {
const [list, setList] = useState([])
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
const [totalCount, setTotalCount] = useState<number>(0)
useEffect(() => {
fetchCollectInformationList()
}, [current])
/**
* 获取收藏的资讯列表
*/
const fetchCollectInformationList = () => {
let param = {
current,
pageSize
}
//@ts-ignore
PublicApi.getManageContentInformationCollectList(param).then(res => {
if (res.code === 1000) {
setList(res.data.data)
setTotalCount(res.data.totalCount)
}
})
}
const handleChange = (page) => {
setCurrent(page)
}
const linkToDetail = (detail) => {
if (detail.status === 2) {
let el = document.createElement('a')
el.href = `/infomation/detail?id=${detail.id}`;
el.target = '_blank';
el.click()
} else {
message.destroy()
message.info("该文章已下架")
}
}
const handleCancelCollect = (detail) => {
Modal.confirm({
centered: true,
className: styles.mallComfirm,
content: `是否要取消收藏?`,
onOk: () => {
return new Promise((resolve, reject) => {
let param = {
informationId: detail.id,
status: false
}
PublicApi.postManageContentInformationCollect(param).then(res => {
if (res.code === 1000) {
// fetchPurchaseList()
fetchCollectInformationList()
resolve()
} else {
reject()
}
}).catch(() => {
reject()
})
})
}
})
}
return (
<>
<div className={styles.information_list}>
{
list && list.map((item, index) => (
<div className={styles.information_list_item} key={`information_list_item_${index}`}>
<div className={cx(styles.information_list_item_item, styles.morehalf)}>
<div className={styles.information_header_info}>
<div className={styles.information_header_info_logo}>
<img src={item.imageUrl} />
</div>
<div className={styles.information_header_info_content}>
<div className={styles.information_header_info_content_name} onClick={() => linkToDetail(item)}>
<span>{item.title}</span>
</div>
<div className={styles.information_header_info_content_about}>
<div className={styles.information_header_info_content_about_item}>
<ClockCircleOutlined />
<span>{moment(item.createTime).format("YYYY-MM-DD HH:mm")}</span>
</div>
<div className={styles.information_header_info_content_about_item}>
<EyeOutlined />
<span>{numFormat(item.readCount)}</span>
</div>
</div>
</div>
</div>
</div>
<div className={cx(styles.information_list_item_item)}>
<span className={styles.date}>{moment(item.collectTime).format("YYYY-MM-DD HH:mm")}</span>
</div>
<div className={cx(styles.information_list_item_item)} onClick={() => handleCancelCollect(item)}>
<div className={cx(styles.collection_state)}>
<StarFilled />
<label>收藏</label>
</div>
</div>
</div>
))
}
</div>
{
totalCount > 0 && (
<div className={styles.pagination_wrap}>
<Pagination showSizeChanger={false} current={current} total={totalCount} pageSize={pageSize} onChange={handleChange} />
</div>
)
}
</>
)
}
export default Information
import React, { useEffect, useState } from 'react'
import cx from 'classnames'
import { Pagination, message, Modal } from 'antd'
import { StarFilled, EyeOutlined, ClockCircleOutlined } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
import { numFormat } from '@/utils/numberFomat'
import moment from 'moment'
import styles from './index.less'
const Information: React.FC = () => {
const [list, setList] = useState([])
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
const [totalCount, setTotalCount] = useState<number>(0)
useEffect(() => {
fetchCollectInformationList()
}, [current])
/**
* 获取收藏的资讯列表
*/
const fetchCollectInformationList = () => {
const param: any = {
current,
pageSize
}
PublicApi.getManageContentInformationCollectList(param).then(res => {
if (res.code === 1000) {
setList(res.data.data)
setTotalCount(res.data.totalCount)
}
})
}
const handleChange = (page) => {
setCurrent(page)
}
const linkToDetail = (detail) => {
if (detail.status === 2) {
const el = document.createElement('a')
el.href = `/infomation/detail?id=${detail.id}`;
el.target = '_blank';
el.id = detail.id
if(!document.getElementById(detail.id)) {
document.body.appendChild(el);
}
el.click()
} else {
message.destroy()
message.info("该文章已下架")
}
}
const handleCancelCollect = (detail) => {
Modal.confirm({
centered: true,
className: styles.mallComfirm,
content: `是否要取消收藏?`,
onOk: () => {
return new Promise((resolve, reject) => {
const param = {
informationId: detail.id,
status: false
}
PublicApi.postManageContentInformationCollect(param).then(res => {
if (res.code === 1000) {
// fetchPurchaseList()
fetchCollectInformationList()
resolve(true)
} else {
reject()
}
}).catch(() => {
reject()
})
})
}
})
}
return (
<>
<div className={styles.information_list}>
{
list && list.map((item, index) => (
<div className={styles.information_list_item} key={`information_list_item_${index}`}>
<div className={cx(styles.information_list_item_item, styles.morehalf)}>
<div className={styles.information_header_info}>
<div className={styles.information_header_info_logo}>
<img src={item.imageUrl} />
</div>
<div className={styles.information_header_info_content}>
<div className={styles.information_header_info_content_name} onClick={() => linkToDetail(item)}>
<span>{item.title}</span>
</div>
<div className={styles.information_header_info_content_about}>
<div className={styles.information_header_info_content_about_item}>
<ClockCircleOutlined />
<span>{moment(item.createTime).format("YYYY-MM-DD HH:mm")}</span>
</div>
<div className={styles.information_header_info_content_about_item}>
<EyeOutlined />
<span>{numFormat(item.readCount)}</span>
</div>
</div>
</div>
</div>
</div>
<div className={cx(styles.information_list_item_item)}>
<span className={styles.date}>{moment(item.collectTime).format("YYYY-MM-DD HH:mm")}</span>
</div>
<div className={cx(styles.information_list_item_item)} onClick={() => handleCancelCollect(item)}>
<div className={cx(styles.collection_state)}>
<StarFilled />
<label>收藏</label>
</div>
</div>
</div>
))
}
</div>
{
totalCount > 0 && (
<div className={styles.pagination_wrap}>
<Pagination showSizeChanger={false} current={current} total={totalCount} pageSize={pageSize} onChange={handleChange} />
</div>
)
}
</>
)
}
export default Information
......@@ -71,6 +71,10 @@ const Shops: React.FC = () => {
const el = document.createElement('a')
el.href = `/shop?shopId=${btoa(JSON.stringify({ shopId: detail.id, memberId: detail.memberId }))}`;
el.target = '_blank';
el.id = detail.id
if(!document.getElementById(detail.id)) {
document.body.appendChild(el);
}
el.click()
} else {
message.destroy()
......
......@@ -93,8 +93,8 @@ const Message: React.FC<{}> = () => {
className={styles.customList}
pagination={{
onChange: handlePaginationChange,
pageSize: 10,
size: "small",
pageSize: pagination.pageSize,
showSizeChanger: true,
showQuickJumper: true,
total: dataSource.totalCount,
showTotal: showTotal,
......
......@@ -96,42 +96,6 @@ export const AddressPop = (props) => {
</Space> : children
}
export const filterProductDataById = (data, targetData) => {
return targetData.reduce(async (prev: any[], next) => {
const { logistics } = next
// 由于自选商品和进货单商品字段不一致,需手动同步
next.brand = next.brand || next.brandName
next.category = next.category || next.customerCategoryName
next.unit = next.unit || next.unitName
next.productName = next.productName || next.name
if (logistics.deliveryType === 2 && logistics.sendAddress) {
const { code, data } = await PublicApi.getLogisticsShipperAddressGet({
id: logistics.sendAddress
}, { ttl: 60 * 1000, useCache: true })
logistics.render = data
} else {
logistics.render = DELIVERY_TYPE[logistics.deliveryType]
}
// 配送方式外置, 用于接口字段冗余
next.deliveryType = logistics.deliveryType
// id 存在集合中, 采用target中的数据, 否则采用data中的数据
const findResult = data.find(v => v.id === next.id)
// 由于迭代时,会出现promise的 已完成状态, 需转换一下,实现异步转同步化
if (!Array.isArray(prev)) {
prev = await prev
}
if (findResult) {
// 已经选中过这一项, 则需要采用原有的商品列表
prev.push(findResult)
} else {
prev.push(next)
}
return prev
}, [])
}
const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
const { type = 'checkbox', schemaAction, confirmModal, currentRef, sectionProps, ...restProps } = props
const { visible, setVisible, rowSelection, rowSelectionCtl } = sectionProps
......@@ -146,19 +110,55 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
}
}, [])
const addMaterialProcessField = (value, origin) => {
if(Array.isArray(value)) {
let processData = value.map(v => {
let temp: any = {};
temp.id = v.id;
temp.code = v.materielNo;
temp.name = v.materielName;
temp.type = v.type;
temp.category = v.category;
temp.brand = v.brand;
temp.unit = v.unit;
temp.relevanceProductId = v.associatedDataId;
temp.relevanceProductName = v.associatedGoods;
temp.relevanceProductNo = v.associatedMaterielNo;
temp.relevanceProductType = v.associatedType;
temp.relevanceProductCategory = v.associatedCategory;
temp.relevanceProductBrand = v.associatedBrand;
temp.price = v.price;
temp.inventory = v.bidCount;
temp.taxInclusive = v.isHasTax;
temp.taxRate = v.taxRate;
// @ 配送方式 默认物流
temp.logistics = 1
return temp
})
let originIds = origin.map(item => item.id)
processData.map(item => {
if(!originIds.includes(item.id)) {
origin.push(item)
}
})
return origin
}
}
const handleConfirm = async () => {
// 判断所选择的商品是否属于同一个工作流
console.log(rowSelectionCtl, 'rowSelectionCtl')
// @ts-ignore
const res = await PublicApi.postOrderIsWorkFlow({
memberId: rowSelectionCtl.selectRow[0].memberId,
memberRoleId: rowSelectionCtl.selectRow[0].memberRoleId,
productIds: rowSelectionCtl.selectedRowKeys,
memberId: schemaAction.getFieldValue('supplyMembersId'),
memberRoleId: schemaAction.getFieldValue('supplyMembersRoleId'),
productIds: rowSelectionCtl.selectRow.map(item => item.associatedDataId),
orderModel: schemaAction.getFieldValue('orderModel')
}, { ctlType: 'none' })
if (res.code === 1000) {
const productData = schemaAction.getFieldValue('orderProductRequests')
schemaAction.setFieldValue('orderProductRequests', await filterProductDataById(productData, rowSelectionCtl.selectRow))
schemaAction.setFieldValue('orderProductRequests', addMaterialProcessField(rowSelectionCtl.selectRow, productData))
confirmModal && confirmModal()
setVisible(false)
} else {
......@@ -172,7 +172,7 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
...values,
contractId,
}
return fetchOrderApi.getProductList(params)
return fetchOrderApi.getContractPurchaseMaterielList(params)
}
......@@ -186,7 +186,7 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
cancel={() => setVisible(false)}
fetchTableData={fetchMaterialList}
rowSelection={rowSelection}
resetModal={{destroyOnClose: true, forceRender: true}}
resetModal={{destroyOnClose: true}}
modalType='none'
tableProps={{
rowKey: 'id',
......
......@@ -25,12 +25,12 @@ export const PriceComp = (props) => {
</div>
}
// @采购合同下单 字段转换
/** 采购合同下单 字段转换 */
export const procurementProcessField = (value) => {
value.orderProductRequests = value.orderProductRequests.map(item => {
// @todo 查询商品对应的最小起订数
// const { data, code } = await PublicApi.getProductCommodityGetCommodity({id: item.relevanceProductId})
delete item.id
// delete item.id
return {
...item,
productId: item.relevanceProductId,
......
......@@ -74,6 +74,7 @@ export const useModelTypeChange = (callback) => {
const utils = useLinkageUtils()
// 下单模式发生改变时
FormEffectHooks.onFieldValueChange$('orderModel').subscribe(state => {
console.log(state.value, 'efffect')
callback(state)
})
}
......
......@@ -36,6 +36,7 @@ import { fetchOrderApi } from './apis'
import MergeOrderModalTable from './components/mergeOrderModalTable'
import { useMaterialTable } from './model/useMaterialTable'
import ContractModalTable from './components/contractModalTable'
import MaterialModalTable from './components/materialModalTable'
export interface PurchaseOrderDetailProps {}
......@@ -164,7 +165,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// 订单商品
const { productAddButton, productRef, productColumns, productComponents, ...sectionProps } = useProductTable(addSchemaAction, mergeRef)
// 订单物料
const { materialAddButton, materialRef, materialColumns, materialComponents, ...restProps } = useMaterialTable(addSchemaAction)
const { materialAddButton, materialRef, materialColumns, materialComponents, ...surplusProps } = useMaterialTable(addSchemaAction)
let timerSignature = null
// 页面进入时, 当前所处的下单模式
......@@ -618,29 +619,35 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
value === OrderModalType.CHANNEL_SPOT_MANUAL_ORDER ||
(value === OrderModalType.CONSOLIDATED_ORDER && quotationOrderValue)
) {
addSchemaAction.setFieldState('orderProductRequests', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
prefix: editable ? productAddButton : '',
}
})
setTimeout(() => {
addSchemaAction.setFieldState('orderProductRequests', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
prefix: editable ? productAddButton : '',
}
})
})
} else if (
value === OrderModalType.PURCHASE_ENQUIRY_CONTRACT_ORDER ||
value === OrderModalType.PURCHASE_BIDDING_CONTRACT_ORDER ||
value === OrderModalType.PURCHASE_TENDER_CONTRACT_ORDER
) {
addSchemaAction.setFieldState('orderProductRequests', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
prefix: editable ? materialAddButton : '',
}
})
setTimeout(() => {
addSchemaAction.setFieldState('orderProductRequests', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
prefix: editable ? materialAddButton : '',
}
})
}, 300)
} else {
addSchemaAction.setFieldState('orderProductRequests', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
prefix: '',
}
setTimeout(() => {
addSchemaAction.setFieldState('orderProductRequests', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
prefix: '',
}
})
})
}
// 选择某种类型时, 需显示对应的订单类型
......@@ -724,7 +731,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
<ContractModalTable currentRef={contractOrderRef} schemaAction={addSchemaAction}/>
{/* @todo 选择采购物料 */}
{/* <MaterialModalTable currentRef={materialRef} schemaAtion={addSchemaAction} /> */}
<MaterialModalTable currentRef={materialRef} schemaAction={addSchemaAction} sectionProps={surplusProps} />
......
......@@ -61,7 +61,7 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
const { value, mutators, editable } = props
useEffect(() => {
PublicApi.getOrderTradingRulesTransactionProcessList().then(res => {
PublicApi.getManagePurchaseProcesByMember().then(res => {
setFieldState({
dataSource: res.data,
showMore
......
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