Commit 5d7c1441 authored by GuanHua's avatar GuanHua

feat:1.未登录下库存的显示;2.商品详情交易评价和交易记录修改

parent f7bd6623
.interested {
border: 1px solid rgba(245, 245, 245, 1);
width: 190px;
margin-bottom: 24px;
.interested_title {
font-size: 14px;
......
......@@ -18,7 +18,7 @@ interface CommentPropsType {
const Comment: React.FC<CommentPropsType> = (props) => {
const { productIds, setCount } = props
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
const [pageSize] = useState<number>(4)
const [totalCount, setTotalCount] = useState<number>(0)
const [summaryInfo, setSummaryInfo] = useState<GetMemberCommentMallTradeSummaryResponse>()
const [commentList, setCommentList] = useState<GetMemberCommentMallTradeHistoryPageResponseDetail[]>([])
......@@ -128,8 +128,10 @@ const Comment: React.FC<CommentPropsType> = (props) => {
}]
setCommentCountList(result)
setCount(allCount)
if (goodCount > 0) {
setGoodRate(Math.floor((goodCount / allCount) * 100))
}
}
const handleFilterCommentType = (type: string) => {
setCommentType(type)
......@@ -171,7 +173,9 @@ const Comment: React.FC<CommentPropsType> = (props) => {
<img src={defaultAvatar} />
</div>
<div className={styles.user_name}>{item.memberName}</div>
<div className={styles.user_type}>{item.levelTag}</div>
{
item.levelTag && <div className={styles.user_type}>{item.levelTag}</div>
}
</div>
<div className={styles.comment_list_item_right}>
<Rate className={styles.comment_rate} value={item.star} disabled />
......@@ -188,7 +192,7 @@ const Comment: React.FC<CommentPropsType> = (props) => {
{
totalCount > 0 && (
<div className={styles.pagination_wrap}>
<Pagination showQuickJumper={false} showSizeChanger={false} onChange={handlePageChange} current={1} pageSize={pageSize} total={totalCount} />
<Pagination showQuickJumper={false} showSizeChanger={false} onChange={handlePageChange} current={current} pageSize={pageSize} total={totalCount} />
</div>
)
}
......
......@@ -14,7 +14,7 @@ interface TradeRecordPropsType {
const TradeRecord: React.FC<TradeRecordPropsType> = (props) => {
const { productIds, setCount } = props
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
const [pageSize] = useState<number>(4)
const [totalCount, setTotalCount] = useState<number>(0)
const [recordList, setRecordList] = useState<GetOrderTransactionRecordsListResponseDetail[]>([])
......@@ -24,6 +24,12 @@ const TradeRecord: React.FC<TradeRecordPropsType> = (props) => {
}
}, [productIds])
useEffect(() => {
if (productIds && !isEmpty(productIds)) {
fetchRecordsList()
}
}, [current])
const fetchRecordsList = () => {
let param = {
current,
......@@ -48,7 +54,9 @@ const TradeRecord: React.FC<TradeRecordPropsType> = (props) => {
return (
<div className={styles.columns_item}>
<div className={styles.columns_item_name}>{record.memberName}</div>
<div className={styles.columns_item_member}>VIP会员</div>
{
record.levelTag && <div className={styles.columns_item_member}>{record.levelTag}</div>
}
</div>
)
}
......@@ -65,6 +73,10 @@ const TradeRecord: React.FC<TradeRecordPropsType> = (props) => {
render: (tradingTime) => moment(tradingTime).format('YYYY-MM-DD HH:mm')
},
]
const handleChange = (pagination) => {
const { current } = pagination
setCurrent(current)
}
return (
<div id="trade_record" className={styles.trade_record}>
......@@ -77,6 +89,12 @@ const TradeRecord: React.FC<TradeRecordPropsType> = (props) => {
columns={columns}
dataSource={recordList}
locale={{ emptyText: '暂无交易记录' }}
onChange={handleChange}
pagination={{
current: current,
pageSize: pageSize,
total: totalCount
}}
/>
</div>
</div>
......
......@@ -902,7 +902,7 @@ const CommodityDetail = (props) => {
<div className={styles.product_info_line}>
<div className={styles.product_info_line_label}>库存数量</div>
<div className={styles.product_info_line_brief}>
<span className={styles.text}>{numFormat(stockCount)}{commodityDetail?.unitName}</span>
<span className={styles.text}>{getAuth() ? `${numFormat(stockCount)}${commodityDetail?.unitName || ''}` : '仅会员可见'}</span>
</div>
</div>
) : (
......@@ -911,7 +911,7 @@ const CommodityDetail = (props) => {
<div className={cx(styles.product_info_line_brief, styles.row)}>
<InputNumber disabled={stockCount === 0} value={buyCount} min={commodityDetail?.priceType === COMMODITY_TYPE.prompt ? commodityDetail?.minOrder : 1} max={stockCount} onChange={(value) => setBuyCount(value)} />
<span className={cx(styles.text, styles.mar_left_10)}>{commodityDetail?.unitName}</span>
<span className={cx(styles.text, styles.mar_left_10)}>(库存{numFormat(stockCount)}{commodityDetail?.unitName})</span>
<span className={cx(styles.text, styles.mar_left_10)}>{getAuth() ? `(库存${numFormat(stockCount)}${commodityDetail?.unitName || ''})` : '(仅会员可见)'}</span>
</div>
</div>
)
......
......@@ -20,6 +20,8 @@ const NewTrade: React.FC = () => {
}, [])
const autoPlayList = (maxLenght) => {
const new_trade_list = document.getElementById("new_trade_list")
if (new_trade_list) {
const autoPlaySpeed = 5000
const unitDistance = 79
if (maxLenght > 4) {
......@@ -27,7 +29,7 @@ const NewTrade: React.FC = () => {
timer = setInterval(() => {
distance += unitDistance
if (distance < maxDistance) {
const new_trade_list = document.getElementById("new_trade_list")
//@ts-ignore
new_trade_list.style = `transform: translateY(${-distance}px);`
} else {
......@@ -39,6 +41,7 @@ const NewTrade: React.FC = () => {
}, autoPlaySpeed)
}
}
}
useEffect(() => {
fetchData()
}, [current])
......
......@@ -6,45 +6,6 @@ import './index.less'
const FindMore: React.FC = () => {
const buy_dynamic_list = [
{
title: '黑色头层牛皮自然摔纹',
state: 0,
content: '2000平方英尺',
date: '09/09 09:00'
},
{
title: '黑色头层牛皮自然摔纹',
state: 0,
content: '2000平方英尺',
date: '09/09 09:00'
},
{
title: '黑色头层牛皮自然摔纹',
state: 0,
content: '2000平方英尺',
date: '09/09 09:00'
},
{
title: '黑色头层牛皮自然摔纹',
state: 1,
content: '2000平方英尺',
date: '09/09 09:00'
},
{
title: '黑色头层牛皮自然摔纹',
state: 1,
content: '2000平方英尺',
date: '09/09 09:00'
},
{
title: '黑色头层牛皮自然摔纹',
state: 1,
content: '2000平方英尺',
date: '09/09 09:00'
},
]
return (
<div className="find_more" id="find_more">
<div className="find_more_container">
......
......@@ -29,7 +29,7 @@ const ShopList: React.FC<ShopListPropsType> = (props) => {
const [shopList, setShopList] = useState<GetTemplateShopFindShopListResponseDetail[]>([])
const [totalCount, setTotalCount] = useState<number>(0)
//FILTER_TYPE.activeStores,
const filterConfig = [FILTER_TYPE.category, FILTER_TYPE.useArea, FILTER_TYPE.newJoin]
const filterConfig = [FILTER_TYPE.category, FILTER_TYPE.useArea, FILTER_TYPE.activeStores, FILTER_TYPE.newJoin]
useEffect(() => {
setCurrent(1)
......
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