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