商城测试版v5
This commit is contained in:
parent
575799b713
commit
e770e7a61b
@ -2,14 +2,27 @@
|
||||
height: 50vh;
|
||||
.reason_title{
|
||||
padding: 10px 20px 0 20px;
|
||||
height: 60px;
|
||||
border-bottom: 1PX solid #F3F3F3;
|
||||
box-sizing: border-box;
|
||||
Text{
|
||||
text{
|
||||
margin-right: 15px;
|
||||
font-size: 27px;
|
||||
display: inline-block;
|
||||
}
|
||||
.selectName{
|
||||
font-size: 26px;
|
||||
border-bottom: 3px solid #000;
|
||||
padding: 10px;
|
||||
font-weight: 400;
|
||||
color: #ABABAB;
|
||||
}
|
||||
.tips{
|
||||
color: #ABABAB;
|
||||
border-bottom: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
.select_bottom {
|
||||
border-bottom: 3px solid #007AFF;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,10 +13,11 @@ type ReasonInfoParam = {
|
||||
title?: string, //标题
|
||||
list?: {id:number, name:string, typle?:number}[], //数据列表
|
||||
onSelect?: (val: object) => void, //选择
|
||||
onHeaderSelect?: (val: object) => void, //点击头部标题
|
||||
defaultValue?: 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([])
|
||||
//退货原因
|
||||
@ -36,22 +37,27 @@ export default memo(({show = false, onClose, title = '', list = [], onSelect, de
|
||||
let res = await fetchDataReturnExplain({return_reason: idRef.current})
|
||||
setInitList(res.data?.list||[])
|
||||
}
|
||||
|
||||
const [selectIndex, setSelectIndex] = useState(1)
|
||||
const [headerList, setHeaderList] = useState<{id: number, name: string}[]>([])
|
||||
const onSelectData = (item) => {
|
||||
if(headerList.length <= dataLength) {
|
||||
if(selectIndex <= dataLength) {
|
||||
idRef.current = item.id
|
||||
if(headerList.length < dataLength - 1) getReturnExplain()
|
||||
headerList[headerList.length == dataLength?(dataLength - 1):headerList.length] = {id:item.id, name:item.name}
|
||||
if(selectIndex < dataLength) getReturnExplain()
|
||||
headerList[selectIndex - 1] = {id:item.id, name:item.name}
|
||||
setSelectIndex(selectIndex == dataLength?dataLength:selectIndex + 1)
|
||||
setHeaderList((e) => [...e])
|
||||
console.log('headerList.length',headerList.length)
|
||||
|
||||
if(selectIndex == dataLength) onSelect?.(headerList)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const onHeaderClick = (index) => {
|
||||
const onHeaderClick = ({val, index}) => {
|
||||
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_title}>
|
||||
{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>
|
||||
<ScrollView scrollY className={styles.reason_scroll}>
|
||||
<View className={styles.reason_list}>
|
||||
|
@ -42,8 +42,10 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
|
||||
//数量格式
|
||||
const numText = useMemo(() => {
|
||||
if(order)
|
||||
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
|
||||
if(order) {
|
||||
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])
|
||||
|
||||
//售后单状态枚举
|
||||
|
Loading…
x
Reference in New Issue
Block a user