✨ feat:根据客户传递id接口获得商品价格

This commit is contained in:
Haiyi
2022-11-08 18:54:48 +08:00
parent eedc18db75
commit 3c18710b91
10 changed files with 64 additions and 27 deletions
@@ -7,7 +7,8 @@ import { alert } from '@/common/common'
import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format'
import IconFont from '@/components/iconfont/iconfont'
interface Props {
obj: any
obj: any,
sortId: number | string
}
export default memo((props: Props) => {
@@ -25,6 +26,21 @@ export default memo((props: Props) => {
})
}
const time = useMemo(() => {
if (props?.sortId == '') {
return props?.obj?.recent_order_time
}
if (props?.sortId == 1 || props?.sortId == -1) {
return props?.obj?.recent_order_time
}
if (props?.sortId == 2 || props?.sortId == -2) {
return props?.obj?.create_time
}
if (props?.sortId == 3 || props?.sortId == -3) {
return props?.obj?.update_time
}
}, [props?.sortId])
return (
<View className={styles.mainItem} onClick={() => handNav()}>
<View className={styles.itemTop}>
@@ -59,7 +75,7 @@ export default memo((props: Props) => {
<View className={styles.line}></View>
<View className={styles.flex_bottom}>
<View className={styles.flex_left}>{props.obj.default_address.province_name + props.obj.default_address.city_name + props.obj.default_address.district_name || '暂无'}</View>
<View className={styles.flex_right}>更新时间:{formatDateTime(props.obj.recent_order_time) || '暂无'}</View>
<View className={styles.flex_right}>更新时间:{formatDateTime(time) || '暂无'}</View>
</View>
</View >
)
@@ -32,14 +32,14 @@
.itemFont {
font-size: 28px;
font-family: Microsoft YaHei, Microsoft YaHei-Bold;
font-weight: 700;
font-weight: 400;
color: #000000;
}
.activeItems {
font-size: 28px;
font-family: Microsoft YaHei, Microsoft YaHei-Regular;
font-weight: 400;
font-weight: 700;
color: #337FFF;
}
+3 -1
View File
@@ -87,9 +87,11 @@ export default () => {
}
//选择排序
const sortRefRef = useRef<any>()
const handSort = useCallback((e: string) => {
pageNum.current.page = 1
setSearchField((val) => ({ ...val, size: 10, abstract_sort_key: e }))
sortRefRef.current = e
}, [])
const SortRef = useRef<any>()
@@ -153,7 +155,7 @@ export default () => {
selfOnRefresherRefresh={getRefresherRefresh}>
{orderData?.list?.map((item, index) => {
return (
<ItemLiist obj={item}></ItemLiist>
<ItemLiist sortId={sortRefRef.current} obj={item}></ItemLiist>
)
})}
</InfiniteScroll>