🌈 style:修改样式

This commit is contained in:
Haiyi 2022-11-01 17:25:53 +08:00
parent 159e0b9d56
commit 15dfae35fa
10 changed files with 237 additions and 82 deletions

View File

@ -1,4 +1,5 @@
.flexBox { .flexBox {
width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;

View File

@ -1,5 +1,5 @@
import { View } from "@tarojs/components" import { View } from "@tarojs/components"
import { memo, useEffect, useState, useMemo } from "react" import { memo, useEffect, useState, useMemo, forwardRef, useImperativeHandle, useRef } from "react"
import style from "./index.module.scss" import style from "./index.module.scss"
interface prosObj { interface prosObj {
obj?: { obj?: {
@ -13,10 +13,13 @@ interface prosObj {
nextBuy?: (any) => void, nextBuy?: (any) => void,
toPay?: (any) => void, toPay?: (any) => void,
handSureGoods?: () => void, handSureGoods?: () => void,
showTuiGoods?: boolean showTuiGoods?: boolean,
handApplyGoods?: () => void,
handApplyMoney?: () => void,
showDetail?: boolean
} }
export default memo((props: prosObj) => { export default memo(forwardRef((props: prosObj, ref) => {
const { const {
obj = { obj = {
sale_mode: 0, sale_mode: 0,
@ -29,7 +32,10 @@ export default memo((props: prosObj) => {
cancle, cancle,
nextBuy, nextBuy,
toPay, toPay,
handSureGoods handSureGoods,
handApplyGoods,
handApplyMoney,
showDetail = false
} = props } = props
//判断显示取消订单 //判断显示取消订单
@ -97,8 +103,70 @@ export default memo((props: prosObj) => {
} else return false } else return false
}, [obj]) }, [obj])
//判断显示申请退货
const showTuihuo = useMemo(() => {
if (
(obj.sale_mode === 0 && obj.status == 9 && obj.collect_status == 0) ||
(obj.sale_mode === 0 && obj.status == 9 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status == 9 && obj.collect_status == 2) ||
(obj.sale_mode === 0 && obj.status == 9 && obj.settle_mode == 3) ||
(obj.sale_mode === 2 && obj.status == 9)
) {
return true
} else return false
}, [obj])
//判断显示申请退款
const showTuikuan = useMemo(() => {
if (
(obj.sale_mode === 0 && obj.status == 2 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status == 7 && obj.collect_status == 0) ||
(obj.sale_mode === 0 && obj.status == 11 && (obj.collect_status == 1 || obj.collect_status == 2)) ||
(obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 0) ||
(obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 2) ||
(obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 1) ||
(obj.sale_mode === 1 && obj.status == 0) ||
(obj.sale_mode === 1 && obj.status == 9) ||
(obj.sale_mode === 2 && obj.status == 0 && obj.collect_status == 1) ||
(obj.sale_mode === 2 && obj.status == 0 && obj.collect_status == 2)
) {
return true
} else return false
}, [obj])
//多的不显示别的按钮
// const currentNums = useRef<any>({ nums: 0 })
const itemNums = useMemo(() => {
let nums = 0
if (showTake) {
nums = nums + 1
}
if (showCancel) {
nums = nums + 1
}
if (canBuy) {
nums = nums + 1
}
return nums
}, [obj])
useImperativeHandle(ref, () => ({
itemNums
}))
return ( return (
<View className={style.flexBox}> <View className={style.flexBox}>
{
(showTuihuo && showDetail && itemNums === 0) && <View className={style.nextBuy} onClick={() => handApplyGoods?.()}>退</View>
}
{
(showTuikuan && showDetail && itemNums === 0) && <View className={style.nextBuy} onClick={() => handApplyMoney?.()}>退</View>
}
{ {
showTake && showTuiGoods && <View className={style.cancle} onClick={() => handSureGoods?.()}></View> showTake && showTuiGoods && <View className={style.cancle} onClick={() => handSureGoods?.()}></View>
} }
@ -114,4 +182,4 @@ export default memo((props: prosObj) => {
</View> </View>
) )
}) }))

View File

@ -104,8 +104,10 @@
width: 64px; width: 64px;
height: 64px; height: 64px;
display: flex; display: flex;
line-height: 64px;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column;
color: #000; color: #000;
font-size: 35px; font-size: 35px;
} }

View File

@ -1,42 +1,76 @@
.sideBar_main{ .sideBar_main {
display: flex; display: flex;
height: 100%; height: 100%;
.sideBar_select{
width: 150px; .sideBar_select {
width: 176px;
height: 100%; height: 100%;
background-color: #eaeaea; background-color: #f7f7f7;
border-radius: 0 10px 10px 0; border-top-right-radius: 16px;
// border-radius: 0 10px 10px 0;
::-webkit-scrollbar { ::-webkit-scrollbar {
display:none; display: none;
width:0; width: 0;
height:0; height: 0;
color:transparent; color: transparent;
} }
.sideBar_select_title{
.sideBar_select_title {
position: relative;
height: 100px; height: 100px;
width: 100%; width: 176px;
font-size: $font_size; font-size: $font_size;
color: #727272; color: #727272;
display: flex; display: flex;
flex-direction: column;
align-items: center; align-items: center;
flex-direction: column;
justify-content: center; justify-content: center;
font-weight: 400; font-weight: 400;
.title_con{ text-align: center;
width: 74px; // border-top-right-radius: 16px;
@include common_ellipsis($params:4); // border-bottom-right-radius: 16px;
background-color: #ffffff;
.shu {
top: 55px;
left: 0px;
position: absolute;
width: 8px;
height: 40px;
background: #4581FF;
border-radius: 0px 4px 4px 0px;
margin-right: 20px;
}
.title_con {
// width: 74px;
width: 112px;
// margin-left: 32px;
@include common_ellipsis($params: 4);
} }
} }
.sideBar_select_title_select{
background-color: #007AFF; .sideBar_select_title_select {
color: #fff; background-color: #f7f7f7;
border-radius: 0px 14px 14px 0px; color: #4581FF;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
// border-top-right-radius: 16px;
// border-radius: 0px 14px 14px 0px;
}
.indexBox {
background-color: red;
} }
} }
.sideBar_con{
.sideBar_con {
flex: 1; flex: 1;
.sideBar_con_scroll{
.sideBar_con_scroll {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }

View File

@ -1,29 +1,29 @@
import { ScrollView, View } from "@tarojs/components" import { ScrollView, View } from "@tarojs/components"
import React, { memo, ReactNode, useEffect, useRef, useState } from "react" import React, { memo, ReactNode, useEffect, useMemo, useRef, useState } from "react"
import styles from "./index.module.scss" import styles from "./index.module.scss"
import classnames from "classnames"; import classnames from "classnames";
import Taro, { useReady } from "@tarojs/taro"; import Taro, { useReady } from "@tarojs/taro";
import InfiniteScroll, {StatusParam} from "../infiniteScroll"; import InfiniteScroll, { StatusParam } from "../infiniteScroll";
import LoadingCard from "../loadingCard"; import LoadingCard from "../loadingCard";
type Params = { type Params = {
list?: any[], list?: any[],
defaultValue?: number|string, defaultValue?: number | string,
children?: ReactNode, children?: ReactNode,
height?: string, height?: string,
heightItem?: number, heightItem?: number,
sideBarOnClick?: (val:any) => void, sideBarOnClick?: (val: any) => void,
refresherTriggered?: true|false, refresherTriggered?: true | false,
selfOnRefresherRefresh?: () => void selfOnRefresherRefresh?: () => void
selfOnScrolltolower?: () => void, selfOnScrolltolower?: () => void,
hasMore?: true|false, hasMore?: true | false,
statusMore?: StatusParam statusMore?: StatusParam
} }
export default memo(({list = [], export default memo(({ list = [],
defaultValue = 0, defaultValue = 0,
height='100vh', height = '100vh',
sideBarOnClick, sideBarOnClick,
children, children,
heightItem = 100, heightItem = 100,
@ -47,19 +47,19 @@ export default memo(({list = [],
const index = list?.findIndex(item => { const index = list?.findIndex(item => {
return item.id == defaultValue return item.id == defaultValue
}) })
if(index !== -1) { if (index !== -1) {
computeSelectTab(index) computeSelectTab(index)
} }
} }
const clickEvent = ({item, index}: {item, index:number}) => { const clickEvent = ({ item, index }: { item, index: number }) => {
setSelected(item.id) setSelected(item.id)
sideBarOnClick?.(item) sideBarOnClick?.(item)
computeSelectTab(index) computeSelectTab(index)
} }
const computeSelectTab = (index) => { const computeSelectTab = (index) => {
if((index + 1) > num_half.current) { if ((index + 1) > num_half.current) {
let num = index + 1 - num_half.current let num = index + 1 - num_half.current
setTabId(list[num].id.toString()) setTabId(list[num].id.toString())
} else { } else {
@ -71,32 +71,44 @@ export default memo(({list = [],
useReady(() => { useReady(() => {
Taro.nextTick(() => { Taro.nextTick(() => {
let query = Taro.createSelectorQuery(); let query = Taro.createSelectorQuery();
query.select('.side_bar_select').boundingClientRect(rect=>{ query.select('.side_bar_select').boundingClientRect(rect => {
console.log('rect::',rect) console.log('rect::', rect)
let clientHeight = rect.height; let clientHeight = rect.height;
let clientWidth = rect.width; let clientWidth = rect.width;
let ratio = 750 / clientWidth; let ratio = 750 / clientWidth;
let height = clientHeight * ratio; let height = clientHeight * ratio;
num_half.current = Math.ceil(height/2/heightItem) num_half.current = Math.ceil(height / 2 / heightItem)
init() init()
}).exec(); }).exec();
}) })
}) })
const [currentIndex, setcurrentIndex] = useState(0)
useMemo(() => {
Taro.nextTick(() => {
let index = 0
index = list.findIndex(item => { return item.id == selected })
setcurrentIndex(currentIndex)
})
}, [selected])
return ( return (
<> <>
<View className={classnames(styles.sideBar_main,'side_bar_select')}> <View className={classnames(styles.sideBar_main, 'side_bar_select')}>
<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 <View
className={classnames(styles.sideBar_select_title, {[styles.sideBar_select_title_select]:(selected == item.id)})} className={classnames(styles.sideBar_select_title, { [styles.sideBar_select_title_select]: (selected == item.id) })}
onClick={() => clickEvent({item, index})} onClick={() => clickEvent({ item, index })}
id={`tab_${item.id}`} id={`tab_${item.id}`}
key={item.id} key={item.id}
style={{height:heightItem+'rpx'}} style={{ height: heightItem + 'rpx' }}
> >
{
selected == item.id && <View className={styles.shu}></View>
}
<View className={styles.title_con}> <View className={styles.title_con}>
{item.name} {item.name}
</View> </View>

View File

@ -320,15 +320,21 @@ page {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
padding-bottom: 24px; padding-bottom: 24px;
// position: relative;
.moreFont { // position: relative;
font-size: 28px; .moreFontBox {
font-weight: 400; width: 200px;
color: rgba(0, 0, 0, 0.8);
margin-left: 48px; .moreFont {
font-size: 28px;
font-weight: 400;
color: rgba(0, 0, 0, 0.8);
margin-left: 48px;
}
} }
.posssBox { .posssBox {
position: absolute; position: absolute;
left: 32px; left: 32px;

View File

@ -596,6 +596,21 @@ export default () => {
} }
}, [infoObj]) }, [infoObj])
const BottomBtnsRef = useRef<any>()
const [showOther, setshowOther] = useState(false)
const testOther = useMemo(() => {
Taro.nextTick(() => {
if (BottomBtnsRef.current?.itemNums >= 2) {
setshowOther(true)
return true
} else {
setshowOther(false)
return false
}
})
}, [infoObj])
return ( return (
<View className={styles.mainBox}> <View className={styles.mainBox}>
{(infoObj?.status != 10 && <OrderState orderInfo={infoObj} />)} {(infoObj?.status != 10 && <OrderState orderInfo={infoObj} />)}
@ -680,27 +695,38 @@ export default () => {
<View className={styles.safeBottom}></View> <View className={styles.safeBottom}></View>
<View className={styles.bottomBox}> <View className={styles.bottomBox}>
{ {
!showMore && <View className={styles.moreFont} onClick={() => setShowMore(true)}></View> showOther &&
} <>
{ {
showMore && <View className={styles.moreFont} onClick={() => setShowMore(false)}></View> !showMore && <View className={styles.moreFontBox}> <View className={styles.moreFont} onClick={() => setShowMore(true)}></View></View>
} }
{ {
showMore && <View className={styles.posssBox}> showMore && <View className={styles.moreFontBox}> <View className={styles.moreFont} onClick={() => setShowMore(false)}></View></View>
<BottomApply }
obj={infoObj} {
handApplyGoods={() => handApplyGood?.()} showMore && <View className={styles.posssBox}>
handApplyMoney={() => handApplyMoney?.()} <BottomApply
></BottomApply> obj={infoObj}
</View> handApplyGoods={() => handApplyGood?.()}
handApplyMoney={() => handApplyMoney?.()}
></BottomApply>
</View>
}
</>
} }
<BottomBtns <BottomBtns
ref={BottomBtnsRef}
showDetail
obj={infoObj} obj={infoObj}
showTuiGoods showTuiGoods
cancle={(e) => cancle?.(e, infoObj)} cancle={(e) => cancle?.(e, infoObj)}
nextBuy={(e) => nextBuy?.(e, infoObj)} nextBuy={(e) => nextBuy?.(e, infoObj)}
toPay={(e) => toPay?.(e, infoObj)} toPay={(e) => toPay?.(e, infoObj)}
handSureGoods={() => handSureGoods?.()} handSureGoods={() => handSureGoods?.()}
handApplyGoods={() => handApplyGood?.()}
handApplyMoney={() => handApplyMoney?.()}
></BottomBtns> ></BottomBtns>
</View> </View>
<PayPopup <PayPopup
@ -715,7 +741,7 @@ export default () => {
picUrl={picUrl} picUrl={picUrl}
></PayPopup> ></PayPopup>
<OfflinePay showKong={false} show={showOffline} onClose={() => setShowOffine(false)} offlineInfo={infoObj}></OfflinePay> <OfflinePay showKong={false} show={showOffline} onClose={() => setShowOffine(false)} offlineInfo={infoObj}></OfflinePay>
</View> </View >
) )
} }

View File

@ -6,7 +6,7 @@
flex-direction: column; flex-direction: column;
.pic { .pic {
width: 322px; width: 522px;
height: 322px; height: 322px;
background: #fff; background: #fff;
// opacity: 0.3; // opacity: 0.3;

View File

@ -5,6 +5,10 @@ page {
.main { .main {
background: #ffff; background: #ffff;
.topBox {
padding-left: 24px;
}
.cancelFont { .cancelFont {
width: 76px; width: 76px;
font-size: 28px; font-size: 28px;

View File

@ -350,9 +350,11 @@ export default memo(() => {
} }
return ( return (
<View className={styles.main}> <View className={styles.main}>
<Search placeholder='请输入搜索布料' defaultValue={defaultvalue} showBtn={false} changeOnSearch={getSearchData} debounceTime={300} > <View className={styles.topBox}>
<View className={styles.cancelFont} onClick={() => back()}></View> <Search placeholder='请输入搜索布料' defaultValue={defaultvalue} showBtn={false} changeOnSearch={getSearchData} debounceTime={300} >
</Search> <View className={styles.cancelFont} onClick={() => back()}></View>
</Search>
</View>
<View className={styles.line}></View> <View className={styles.line}></View>
{ {
!hasFonts && <> !hasFonts && <>