商城测试版v5

This commit is contained in:
czm 2022-07-13 11:16:30 +08:00
parent 575799b713
commit e770e7a61b
3 changed files with 37 additions and 16 deletions

View File

@ -2,14 +2,27 @@
height: 50vh; height: 50vh;
.reason_title{ .reason_title{
padding: 10px 20px 0 20px; padding: 10px 20px 0 20px;
height: 60px;
border-bottom: 1PX solid #F3F3F3; border-bottom: 1PX solid #F3F3F3;
box-sizing: border-box; box-sizing: border-box;
Text{ text{
margin-right: 15px;
font-size: 27px;
display: inline-block;
}
.selectName{
font-size: 26px; font-size: 26px;
border-bottom: 3px solid #000;
padding: 10px; padding: 10px;
font-weight: 400; font-weight: 400;
color: #ABABAB;
}
.tips{
color: #ABABAB;
border-bottom: 0;
padding: 10px;
}
.select_bottom {
border-bottom: 3px solid #007AFF;
color: #000;
} }
} }

View File

@ -13,10 +13,11 @@ type ReasonInfoParam = {
title?: string, //标题 title?: string, //标题
list?: {id:number, name:string, typle?:number}[], //数据列表 list?: {id:number, name:string, typle?:number}[], //数据列表
onSelect?: (val: object) => void, //选择 onSelect?: (val: object) => void, //选择
onHeaderSelect?: (val: object) => void, //点击头部标题
defaultValue?: number, //默认选中 defaultValue?: number, //默认选中
dataLength?: number, //可显示的数据列数 dataLength?: number, //可显示的数据列数
} }
export default memo(({show = false, onClose, title = '', list = [], onSelect, defaultValue, dataLength = 2}: ReasonInfoParam) => { export default memo(({show = false, onClose, title = '', list = [], onSelect, onHeaderSelect, defaultValue, dataLength = 2}: ReasonInfoParam) => {
const [initList, setInitList] = useState([]) const [initList, setInitList] = useState([])
//退货原因 //退货原因
@ -36,22 +37,27 @@ export default memo(({show = false, onClose, title = '', list = [], onSelect, de
let res = await fetchDataReturnExplain({return_reason: idRef.current}) let res = await fetchDataReturnExplain({return_reason: idRef.current})
setInitList(res.data?.list||[]) setInitList(res.data?.list||[])
} }
const [selectIndex, setSelectIndex] = useState(1)
const [headerList, setHeaderList] = useState<{id: number, name: string}[]>([]) const [headerList, setHeaderList] = useState<{id: number, name: string}[]>([])
const onSelectData = (item) => { const onSelectData = (item) => {
if(headerList.length <= dataLength) { if(selectIndex <= dataLength) {
idRef.current = item.id idRef.current = item.id
if(headerList.length < dataLength - 1) getReturnExplain() if(selectIndex < dataLength) getReturnExplain()
headerList[headerList.length == dataLength?(dataLength - 1):headerList.length] = {id:item.id, name:item.name} headerList[selectIndex - 1] = {id:item.id, name:item.name}
setSelectIndex(selectIndex == dataLength?dataLength:selectIndex + 1)
setHeaderList((e) => [...e]) setHeaderList((e) => [...e])
console.log('headerList.length',headerList.length) if(selectIndex == dataLength) onSelect?.(headerList)
}
} }
} const onHeaderClick = ({val, index}) => {
const onHeaderClick = (index) => {
let list = headerList.slice(0, index + 1) let list = headerList.slice(0, index + 1)
setSelectIndex(index + 1)
setHeaderList(list)
onHeaderSelect?.({val, index})
if(index == 0) {
getReturnReason()
}
} }
@ -60,9 +66,9 @@ export default memo(({show = false, onClose, title = '', list = [], onSelect, de
<View className={styles.reason_return_con}> <View className={styles.reason_return_con}>
<View className={styles.reason_title}> <View className={styles.reason_title}>
{headerList.map((item, index) => { {headerList.map((item, index) => {
return <Text key={item.id} onClick={() => onHeaderClick(index)}>{item.name}</Text> return <Text key={item.id} onClick={() => onHeaderClick({val:item, index})} className={classnames(styles.selectName, (headerList.length == index + 1)&&styles.select_bottom)}>{item.name}</Text>
})} })}
{dataLength > headerList.length&&<Text></Text>} {dataLength > headerList.length&&<Text className={styles.tips}></Text>}
</View> </View>
<ScrollView scrollY className={styles.reason_scroll}> <ScrollView scrollY className={styles.reason_scroll}>
<View className={styles.reason_list}> <View className={styles.reason_list}>

View File

@ -42,8 +42,10 @@ export default memo(({order, comfirm = false}:Param) => {
//数量格式 //数量格式
const numText = useMemo(() => { const numText = useMemo(() => {
if(order) if(order) {
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` let total_number = order?.sale_mode == 0?order?.total_number:(order?.total_number/100)
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${total_number}${order?.unit}`
}
}, [order]) }, [order])
//售后单状态枚举 //售后单状态枚举