From e770e7a61b3bf37a3bd15a7858136f54bcc035ab Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 13 Jul 2022 11:16:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=E6=B5=8B=E8=AF=95=E7=89=88v5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/reasonPopup/index.module.scss | 19 +++++++++++-- .../components/reasonPopup/index.tsx | 28 +++++++++++-------- .../salesAfter/components/kindList/index.tsx | 6 ++-- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/pages/applyAfterSales/components/reasonPopup/index.module.scss b/src/pages/applyAfterSales/components/reasonPopup/index.module.scss index 2d0f899..5e037ed 100644 --- a/src/pages/applyAfterSales/components/reasonPopup/index.module.scss +++ b/src/pages/applyAfterSales/components/reasonPopup/index.module.scss @@ -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; } } diff --git a/src/pages/applyAfterSales/components/reasonPopup/index.tsx b/src/pages/applyAfterSales/components/reasonPopup/index.tsx index 1008d91..f54c2a0 100644 --- a/src/pages/applyAfterSales/components/reasonPopup/index.tsx +++ b/src/pages/applyAfterSales/components/reasonPopup/index.tsx @@ -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 {headerList.map((item, index) => { - return onHeaderClick(index)}>{item.name} + return onHeaderClick({val:item, index})} className={classnames(styles.selectName, (headerList.length == index + 1)&&styles.select_bottom)}>{item.name} })} - {dataLength > headerList.length&&请选择} + {dataLength > headerList.length&&请选择} diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index e1e0308..d0d21a9 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -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]) //售后单状态枚举