🐞 fix(提货列表): 去掉筛选弹框内部的输入框

This commit is contained in:
xuan 2022-09-27 18:22:27 +08:00
parent 9cac816810
commit d6e9107276

View File

@ -14,7 +14,6 @@ import Taro from '@tarojs/taro'
interface SearchFilter { interface SearchFilter {
take_goods_order_type?: number take_goods_order_type?: number
timeKey?: string timeKey?: string
take_goods_order_no?: string
} }
export interface SearchField extends Omit<SearchFilter, 'timeKey'> { export interface SearchField extends Omit<SearchFilter, 'timeKey'> {
@ -77,7 +76,6 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
const [searchFilter, setSearchFilter] = useState<SearchFilter>({ const [searchFilter, setSearchFilter] = useState<SearchFilter>({
take_goods_order_type: undefined, take_goods_order_type: undefined,
timeKey: '0', timeKey: '0',
take_goods_order_no: '',
}) })
const handleSelectedType = (type: string | number) => { const handleSelectedType = (type: string | number) => {
console.log('type==>', type) console.log('type==>', type)
@ -89,10 +87,6 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
} }
const handleSearchBarChange = useCallback((searchValue: string) => {
console.log('searchValue==>', searchValue)
setSearchFilter((prevProps) => ({ ...prevProps, take_goods_order_no: searchValue }))
}, [])
const typeList = useMemo<{ id: number; name: string }[]>(() => { const typeList = useMemo<{ id: number; name: string }[]>(() => {
return state.data.list return state.data.list
@ -130,13 +124,12 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
} }
const handleReset = () => { const handleReset = () => {
setSearchFilter({ take_goods_order_type: undefined, timeKey: '0', take_goods_order_no: '' }) setSearchFilter({ take_goods_order_type: undefined, timeKey: '0'})
onReset?.() onReset?.()
} }
const handleConfirm = () => { const handleConfirm = () => {
const changedField = { const changedField = {
take_goods_order_type: searchFilter.take_goods_order_type, take_goods_order_type: searchFilter.take_goods_order_type,
take_goods_order_no: searchFilter.take_goods_order_no,
date_min: customTime.date_min, date_min: customTime.date_min,
date_max: customTime.date_max, date_max: customTime.date_max,
} }
@ -144,40 +137,9 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
onConfirm?.(changedField, searchFilter.timeKey) onConfirm?.(changedField, searchFilter.timeKey)
} }
const scanIcon = () => {
// 扫描
const handleScan = () => {
Taro.scanCode({
success(res) {
setSearchFilter((prevProps) => ({ ...prevProps, take_goods_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 ( 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.take_goods_order_no}
customRightSlot={scanIcon()}></Search>
</View>
</View>
<View className={styles.filterItem}> <View className={styles.filterItem}>
<View className={styles['filterItem--title']}></View> <View className={styles['filterItem--title']}></View>
<View className={classnames(styles['filterItem--wrapper'], styles['filter--type'])}> <View className={classnames(styles['filterItem--wrapper'], styles['filter--type'])}>