Commit 2487be6b authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents e5a7a9d6 afdc8bf7
......@@ -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;
}
......
......@@ -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,
......
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