🎈 perf(优化商城):
This commit is contained in:
parent
c9b4dbdec3
commit
513bb1fc28
@ -8,7 +8,7 @@ import Qs from 'qs'
|
||||
* @param type false 跳转普通页面,true 跳转tabbar页面
|
||||
*/
|
||||
type ParamLink = 'navigateTo' | 'switchTab' | 'reLaunch' | 'redirectTo'
|
||||
export const goLink = (path: string = '', params = null, way: ParamLink = 'navigateTo') => {
|
||||
export const goLink = (path: string = '', params: object | null = null, way: ParamLink = 'navigateTo') => {
|
||||
if (path) {
|
||||
// let params_str = Qs_.stringify(params || {}, { encode: false })
|
||||
// path = params_str ? path + '?' + params_str : path
|
||||
|
||||
@ -13,21 +13,35 @@
|
||||
color: transparent;
|
||||
}
|
||||
.sideBar_select_title {
|
||||
height: 100px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-size: $font_size;
|
||||
margin: 13px 0;
|
||||
// padding: 13px 0;
|
||||
box-sizing: border-box;
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 400;
|
||||
&:nth-child(1) {
|
||||
margin: 0;
|
||||
}
|
||||
&:nth-last-child(1) {
|
||||
margin: 0;
|
||||
}
|
||||
.title_con {
|
||||
padding: 0 20px;
|
||||
text-align: center;
|
||||
// width: 74px;
|
||||
@include common_ellipsis($params: 4);
|
||||
}
|
||||
.sideBar_select_title_item {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-size: $font_size;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
.sideBar_select_title_select {
|
||||
background-color: #007aff;
|
||||
|
||||
@ -30,7 +30,7 @@ export default memo(
|
||||
height = '100vh',
|
||||
sideBarOnClick,
|
||||
children,
|
||||
heightItem = 100,
|
||||
heightItem = 108,
|
||||
refresherTriggered = false,
|
||||
selfOnRefresherRefresh,
|
||||
selfOnScrolltolower,
|
||||
@ -121,13 +121,12 @@ export default memo(
|
||||
<ScrollView scrollWithAnimation={true} style={{ height }} className={styles.sideBar_select} scrollY scrollIntoView={`tab_${tabId}`}>
|
||||
{list?.map((item, index) => {
|
||||
return (
|
||||
<View
|
||||
className={classnames(styles.sideBar_select_title, { [styles.sideBar_select_title_select]: selected == item.id })}
|
||||
onClick={() => clickEvent({ item, index })}
|
||||
id={`tab_${item.id}`}
|
||||
key={item.id}
|
||||
style={{ height: heightItem + 'rpx' }}>
|
||||
<View className={styles.title_con}>{item.name}</View>
|
||||
<View className={styles.sideBar_select_title} id={`tab_${item.id}`} key={item.id} style={{ height: `${heightItem}rpx` }}>
|
||||
<View
|
||||
className={classnames(styles.sideBar_select_title_item, { [styles.sideBar_select_title_select]: selected == item.id })}
|
||||
onClick={() => clickEvent({ item, index })}>
|
||||
<View className={styles.title_con}>{item.name}</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})}
|
||||
|
||||
@ -35,13 +35,13 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
||||
])
|
||||
const [selectIndex, setSelectIndex] = useState(0)
|
||||
const selectProduct = (index: number) => {
|
||||
condition.current.code_or_name = null
|
||||
getColorList()
|
||||
setSelectIndex(() => index)
|
||||
}
|
||||
|
||||
//重置数据
|
||||
useEffect(() => {
|
||||
condition.current.code_or_name = null
|
||||
getColorList()
|
||||
setSearchShow(false)
|
||||
}, [selectIndex])
|
||||
|
||||
@ -257,19 +257,22 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
||||
})
|
||||
|
||||
const [virtualHeight, setVirtualheight] = useState(400)
|
||||
const getHeight = () => {
|
||||
let query = Taro.createSelectorQuery()
|
||||
query
|
||||
.select('#product_color_con')
|
||||
.boundingClientRect((rect) => {
|
||||
console.log('rect::', rect)
|
||||
let clientHeight = rect.height
|
||||
setVirtualheight(() => clientHeight)
|
||||
})
|
||||
.exec()
|
||||
}
|
||||
useEffect(() => {
|
||||
if (!show) return
|
||||
setTimeout(() => {
|
||||
Taro.nextTick(() => {
|
||||
let query = Taro.createSelectorQuery()
|
||||
query
|
||||
.select('#product_color_con')
|
||||
.boundingClientRect((rect) => {
|
||||
console.log('rect::', rect)
|
||||
let clientHeight = rect.height
|
||||
setVirtualheight(() => clientHeight)
|
||||
})
|
||||
.exec()
|
||||
getHeight()
|
||||
})
|
||||
}, 100)
|
||||
}, [show])
|
||||
@ -318,7 +321,7 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
||||
height={virtualHeight} /* 列表的高度 */
|
||||
width='100%' /* 列表的宽度 */
|
||||
itemData={list} /* 渲染列表的数据 */
|
||||
itemCount={list.length} /* 渲染列表的长度 */
|
||||
itemCount={searchShow ? list.length + 1 : list.length} /* 渲染列表的长度 */
|
||||
itemSize={100} /* 列表单项的高度 */
|
||||
overscanCount={1}>
|
||||
{Rows}
|
||||
|
||||
@ -115,7 +115,7 @@ export default () => {
|
||||
statusMore={statusMore}
|
||||
selfOnScrolltolower={getScrolltolower}
|
||||
sideBarOnClick={getProductKindId}
|
||||
heightItem={150}
|
||||
heightItem={82}
|
||||
refresherTriggered={refresherTriggeredStatus}
|
||||
selectClass={getSelectClassId}
|
||||
selfOnRefresherRefresh={() => getRefresherRefresh()}>
|
||||
|
||||
@ -91,7 +91,7 @@ export default memo(({ show = true, onClose, company, orderInfo }: Param) => {
|
||||
show_actual_amount: orderInfo.actual_amount > 0 && orderInfo.is_display_price,
|
||||
wait_pay_amount: formatPriceDiv(orderInfo.wait_pay_amount).toString(),
|
||||
show_wait_pay_amount: orderInfo.wait_pay_amount > 0 && orderInfo.is_display_price,
|
||||
show_barcode: false,
|
||||
show_barcode: true,
|
||||
order_total_weight_error: formatWeightDiv(orderInfo.total_weight_error).toString(), //总空差重量
|
||||
show_total_price: orderInfo.is_display_price,
|
||||
show_sale_price: orderInfo.is_display_price,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Image, ScrollView, Text, View } from '@tarojs/components'
|
||||
import { memo, useEffect, useRef, useState } from 'react'
|
||||
import { memo, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import Popup from '@/components/popup'
|
||||
@ -42,10 +42,14 @@ export default memo(({ show = true, onClose, orderInfo }: Param) => {
|
||||
}
|
||||
}, [show, detail])
|
||||
|
||||
const product_list = useMemo(() => {
|
||||
return orderInfo?.is_quality_check ? orderInfo?.quality_check_pass_product : orderInfo?.product_list
|
||||
}, [orderInfo])
|
||||
|
||||
useEffect(() => {
|
||||
if (orderInfo) {
|
||||
let lists: ListParam[] = []
|
||||
orderInfo.product_list?.map((pitem) => {
|
||||
product_list?.map((pitem) => {
|
||||
pitem?.product_colors?.map((citem) => {
|
||||
lists.push({
|
||||
product_code: formatRemoveHashTag(pitem.code),
|
||||
|
||||
@ -145,7 +145,12 @@ export default memo(({ value, onClickBtn }: Param) => {
|
||||
</View>
|
||||
<View className={styles.color_count_num}>
|
||||
<Text>{numText}</Text>
|
||||
{/* {ReturnStageReturned.value == value?.stage && <Text className={styles.refund_amount}><Text>¥</Text>{formatPriceDiv(value?.refund_amount, 100, true)}</Text>} */}
|
||||
{ReturnStageReturned.value == value?.stage && (
|
||||
<Text className={styles.refund_amount}>
|
||||
<Text>¥</Text>
|
||||
{formatPriceDiv(value?.refund_amount, 100, true)}
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
<View className={styles.order_number}>
|
||||
<Text>{value?.type == ReturnApplyOrderTypeReturnForRefund.value ? '已申请退货' : '已申请退款'}</Text>
|
||||
|
||||
@ -120,7 +120,10 @@ export default () => {
|
||||
const { fetchData: fetchDataShortCode } = GetShortCodeApi()
|
||||
const getShortCode = async (user_id) => {
|
||||
const { data: resPage } = await fetchDataShortCode({ share_user_id: user_id, type: SharePage.value })
|
||||
setSortCode({ ...userInfo.sort_code, shareShortPage: { title: '打造面料爆品 专注客户服务', code: resPage.md5_key, img: IMG_CND_Prefix + '/mall/share_img_01.png' } })
|
||||
setSortCode({
|
||||
...userInfo.sort_code,
|
||||
shareShortPage: { title: '打造面料爆品 专注客户服务', code: resPage.md5_key, img: IMG_CND_Prefix + '/mall/share_img_01.png' },
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user