From 513bb1fc2808d1decec7ee755a7dbce66013fb1b Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Thu, 1 Dec 2022 11:30:43 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20perf(=E4=BC=98=E5=8C=96=E5=95=86?= =?UTF-8?q?=E5=9F=8E):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/common.ts | 2 +- src/components/sideBar/index.module.scss | 28 ++++++++++++++----- src/components/sideBar/index.tsx | 15 +++++----- .../details/components/orderCount/index.tsx | 27 ++++++++++-------- src/pages/index/index.tsx | 2 +- .../order/components/scanPayCheck/index.tsx | 2 +- .../components/returnPayCheck/index.tsx | 8 ++++-- .../salesAfterList/components/order/index.tsx | 7 ++++- src/use/useLogin.ts | 5 +++- 9 files changed, 62 insertions(+), 34 deletions(-) diff --git a/src/common/common.ts b/src/common/common.ts index f55e596..4c57039 100644 --- a/src/common/common.ts +++ b/src/common/common.ts @@ -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 diff --git a/src/components/sideBar/index.module.scss b/src/components/sideBar/index.module.scss index cfd3a13..b2e4b8f 100644 --- a/src/components/sideBar/index.module.scss +++ b/src/components/sideBar/index.module.scss @@ -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; diff --git a/src/components/sideBar/index.tsx b/src/components/sideBar/index.tsx index 6d800bb..52ace65 100644 --- a/src/components/sideBar/index.tsx +++ b/src/components/sideBar/index.tsx @@ -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( {list?.map((item, index) => { return ( - clickEvent({ item, index })} - id={`tab_${item.id}`} - key={item.id} - style={{ height: heightItem + 'rpx' }}> - {item.name} + + clickEvent({ item, index })}> + {item.name} + ) })} diff --git a/src/pages/details/components/orderCount/index.tsx b/src/pages/details/components/orderCount/index.tsx index 4b44d6e..e858958 100644 --- a/src/pages/details/components/orderCount/index.tsx +++ b/src/pages/details/components/orderCount/index.tsx @@ -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} diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index b4ba402..3c64d4d 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -115,7 +115,7 @@ export default () => { statusMore={statusMore} selfOnScrolltolower={getScrolltolower} sideBarOnClick={getProductKindId} - heightItem={150} + heightItem={82} refresherTriggered={refresherTriggeredStatus} selectClass={getSelectClassId} selfOnRefresherRefresh={() => getRefresherRefresh()}> diff --git a/src/pages/order/components/scanPayCheck/index.tsx b/src/pages/order/components/scanPayCheck/index.tsx index 24213d7..51e6e51 100644 --- a/src/pages/order/components/scanPayCheck/index.tsx +++ b/src/pages/order/components/scanPayCheck/index.tsx @@ -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, diff --git a/src/pages/salesAfter/components/returnPayCheck/index.tsx b/src/pages/salesAfter/components/returnPayCheck/index.tsx index ff8a355..8b34840 100644 --- a/src/pages/salesAfter/components/returnPayCheck/index.tsx +++ b/src/pages/salesAfter/components/returnPayCheck/index.tsx @@ -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), diff --git a/src/pages/salesAfter/salesAfterList/components/order/index.tsx b/src/pages/salesAfter/salesAfterList/components/order/index.tsx index ae72476..ff08292 100644 --- a/src/pages/salesAfter/salesAfterList/components/order/index.tsx +++ b/src/pages/salesAfter/salesAfterList/components/order/index.tsx @@ -145,7 +145,12 @@ export default memo(({ value, onClickBtn }: Param) => { {numText} - {/* {ReturnStageReturned.value == value?.stage && ¥{formatPriceDiv(value?.refund_amount, 100, true)}} */} + {ReturnStageReturned.value == value?.stage && ( + + ¥ + {formatPriceDiv(value?.refund_amount, 100, true)} + + )} {value?.type == ReturnApplyOrderTypeReturnForRefund.value ? '已申请退货' : '已申请退款'} diff --git a/src/use/useLogin.ts b/src/use/useLogin.ts index c839260..af06029 100644 --- a/src/use/useLogin.ts +++ b/src/use/useLogin.ts @@ -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 {