🎈 perf(发货列表): 去掉筛选框内部的输入框

This commit is contained in:
xuan 2022-09-27 18:13:51 +08:00
parent 7362e5bca6
commit 9cac816810

View File

@ -14,7 +14,6 @@ import Taro from '@tarojs/taro'
interface SearchFilter {
type?: number
timeKey?: string
delivery_notice_order_no?: string
}
export interface SearchField extends Omit<SearchFilter, 'timeKey'> {
@ -77,7 +76,6 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
const [searchFilter, setSearchFilter] = useState<SearchFilter>({
type: undefined,
timeKey: '0',
delivery_notice_order_no: '',
})
const handleSelectedType = (type: string | number) => {
console.log('type==>', type)
@ -89,11 +87,6 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
}
const handleSearchBarChange = useCallback((searchValue: string) => {
console.log('searchValue==>', searchValue)
setSearchFilter((prevProps) => ({ ...prevProps, delivery_notice_order_no: searchValue }))
}, [])
const typeList = useMemo<{ id: number; name: string }[]>(() => {
return state.data.list
}, [state])
@ -130,13 +123,12 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
}
const handleReset = () => {
setSearchFilter({ type: undefined, timeKey: '0', delivery_notice_order_no: '' })
setSearchFilter({ type: undefined, timeKey: '0' })
onReset?.()
}
const handleConfirm = () => {
const changedField = {
type: searchFilter.type,
delivery_notice_order_no: searchFilter.delivery_notice_order_no,
date_min: customTime.date_min,
date_max: customTime.date_max,
}
@ -144,40 +136,8 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
onConfirm?.(changedField, searchFilter.timeKey)
}
const scanIcon = () => {
// 扫描
const handleScan = () => {
Taro.scanCode({
success(res) {
setSearchFilter((prevProps) => ({ ...prevProps, delivery_notice_order_no: res.result }))
},
fail(res) {
console.log(res)
},
})
}
return (
<View onClick={handleScan} className={styles.scanHandler}>
<IconFont name='icon-saomiao' size={40}></IconFont>
</View>
)
}
return (
<>
<View className={styles.filterItem}>
<View className={styles['filterItem--title']}></View>
<View className={classnames(styles['filterItem--wrapper'], styles['filter--inputBar'])}>
<Search
placeholder='请输入或扫描条形码'
showBtn={false}
adjustPosition={true}
changeOnSearch={handleSearchBarChange}
debounceTime={300}
defaultValue={searchFilter.delivery_notice_order_no}
customRightSlot={scanIcon()}></Search>
</View>
</View>
<View className={styles.filterItem}>
<View className={styles['filterItem--title']}></View>
<View className={classnames(styles['filterItem--wrapper'], styles['filter--type'])}>