🐳 chore(eslint): 修正所有文件的eslint 错误❌
This commit is contained in:
@@ -6,7 +6,7 @@ interface PropsType {
|
||||
onChangeStatus?: (data: { id: number; name: string }) => void
|
||||
}
|
||||
|
||||
const DeliveryStatusList = memo<PropsType>((props) => {
|
||||
const DeliveryStatusList = (props: PropsType) => {
|
||||
const { onChangeStatus } = props
|
||||
const { fetchData } = EnumSaleorderStatus()
|
||||
const [statusList, setStatusList] = useState([
|
||||
@@ -38,5 +38,5 @@ const DeliveryStatusList = memo<PropsType>((props) => {
|
||||
[onChangeStatus],
|
||||
)
|
||||
return <SegmentedControl list={statusList} onSelect={changeStatus} defaultId={statusList[0].id} />
|
||||
})
|
||||
export default DeliveryStatusList
|
||||
}
|
||||
export default memo<PropsType>(DeliveryStatusList)
|
||||
|
||||
@@ -12,6 +12,23 @@ import IconFont from '@/components/iconfont/iconfont'
|
||||
import { EnumDeliveryNoticeTypeList } from '@/api/index'
|
||||
import { getFilterData } from '@/common/util'
|
||||
|
||||
interface ButtonPropsType {
|
||||
isActive: boolean
|
||||
onClick?: Function
|
||||
children?: React.ReactNode
|
||||
customClassName?: string
|
||||
}
|
||||
const FilterButton: FC<ButtonPropsType> = (props) => {
|
||||
const { onClick, children, isActive = false, customClassName } = props
|
||||
const handleClick = () => {
|
||||
onClick?.()
|
||||
}
|
||||
return (
|
||||
<View className={classnames(styles.filterButton, isActive && styles['filterButton--active'], customClassName)} onClick={handleClick}>
|
||||
<View className={classnames(styles['filterButton--text'])}>{children}</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
interface SearchFilter {
|
||||
type?: number
|
||||
timeKey?: string
|
||||
@@ -29,13 +46,6 @@ interface DeliveryPropsType {
|
||||
onReset?: () => void
|
||||
}
|
||||
|
||||
interface ButtonPropsType {
|
||||
isActive: boolean
|
||||
onClick?: Function
|
||||
children?: React.ReactNode
|
||||
customClassName?: string
|
||||
}
|
||||
|
||||
export const filterTimeOptions = {
|
||||
0: {
|
||||
name: '不限',
|
||||
@@ -69,7 +79,7 @@ export const filterTimeOptions = {
|
||||
},
|
||||
} as const
|
||||
|
||||
const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
const DeliveryFilter = (props: DeliveryPropsType) => {
|
||||
const { onSearchTime, onConfirm, onCancal, onReset } = props
|
||||
|
||||
const { fetchData, state } = EnumDeliveryNoticeTypeList()
|
||||
@@ -92,17 +102,15 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
return state.data.list
|
||||
}, [state])
|
||||
|
||||
const getEnumData = async() => {
|
||||
await fetchData()
|
||||
}
|
||||
useEffect(() => {
|
||||
if (!typeList?.length) {
|
||||
getEnumData()
|
||||
console.log('getEnumData')
|
||||
}
|
||||
}, [typeList])
|
||||
|
||||
const getEnumData = async() => {
|
||||
await fetchData()
|
||||
}
|
||||
|
||||
const [customTime, setCustomTime] = useState({
|
||||
date_min: undefined,
|
||||
date_max: undefined,
|
||||
@@ -144,9 +152,9 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
不限
|
||||
</FilterButton>
|
||||
{!!typeList?.length
|
||||
&& typeList?.map((item) => {
|
||||
&& typeList?.map((item, key) => {
|
||||
return (
|
||||
<FilterButton isActive={searchFilter.type === item?.id} onClick={() => handleSelectedType(item?.id)}>
|
||||
<FilterButton key={key} isActive={searchFilter.type === item?.id} onClick={() => handleSelectedType(item?.id)}>
|
||||
{item.name}
|
||||
</FilterButton>
|
||||
)
|
||||
@@ -157,9 +165,9 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
<View className={styles.filterItem}>
|
||||
<View className={styles['filterItem--title']}>查询日期</View>
|
||||
<View className={classnames(styles['filterItem--wrapper'], styles['filter--time'])}>
|
||||
{Object.entries(filterTimeOptions).map(([key, value]) => {
|
||||
{Object.entries(filterTimeOptions).map(([key, value], index) => {
|
||||
return (
|
||||
<FilterButton isActive={searchFilter.timeKey === key} onClick={() => handleSelectedTime(key)}>
|
||||
<FilterButton key={index} isActive={searchFilter.timeKey === key} onClick={() => handleSelectedTime(key)}>
|
||||
{value.name}
|
||||
</FilterButton>
|
||||
)
|
||||
@@ -179,18 +187,6 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
})
|
||||
|
||||
const FilterButton: FC<ButtonPropsType> = (props) => {
|
||||
const { onClick, children, isActive = false, customClassName } = props
|
||||
const handleClick = () => {
|
||||
onClick?.()
|
||||
}
|
||||
return (
|
||||
<View className={classnames(styles.filterButton, isActive && styles['filterButton--active'], customClassName)} onClick={handleClick}>
|
||||
<View className={classnames(styles['filterButton--text'])}>{children}</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default DeliveryFilter
|
||||
export default memo<DeliveryPropsType>(DeliveryFilter)
|
||||
|
||||
@@ -51,16 +51,6 @@ const Delivery: FC = () => {
|
||||
console.log('searchValue==>', searchValue)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!isFirst.current) {
|
||||
getData()
|
||||
}
|
||||
}, [search])
|
||||
|
||||
useDidShow(() => {
|
||||
getData()
|
||||
})
|
||||
|
||||
// 上拉加载数据
|
||||
const pageNum = useRef({ size: search.size, page: search.page })
|
||||
|
||||
@@ -173,11 +163,19 @@ const Delivery: FC = () => {
|
||||
</View>
|
||||
)
|
||||
}
|
||||
useEffect(() => {
|
||||
if (!isFirst.current) {
|
||||
getData()
|
||||
}
|
||||
}, [search])
|
||||
|
||||
useDidShow(() => {
|
||||
getData()
|
||||
})
|
||||
return (
|
||||
<View className={styles.delivery}>
|
||||
<View className={styles.searchBox}>
|
||||
<Search placeholder="请输入或扫描条形码" showBtn={false} changeOnSearch={getSearchData} debounceTime={300} customRightSlot={scanIcon()}>
|
||||
<Search placeholder="请输入或扫描条形码" showBtn={false} changeOnSearch={getSearchData} customRightSlot={scanIcon()}>
|
||||
<View onClick={onShowFilter} className={styles.icon__filter}>
|
||||
<IconText svg iconName="icon-shaixuan" text="筛选" customClass={styles['icon--filter']} />
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user