Commit 212f00dd authored by GuanHua's avatar GuanHua

fix: 商品详情评价接口修改传参

parent aea99fa1
......@@ -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>
)
......
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