Merge branch 'dev' of ssh://git.online.zzfzyc.com:10022/mp/spider_cloud_warehouse into 订单页
This commit is contained in:
commit
6b59d688db
@ -1,5 +1,6 @@
|
||||
import { View, Text } from "@tarojs/components"
|
||||
import { memo } from "react"
|
||||
import IconFont from "../iconfont/iconfont"
|
||||
import style from "./index.module.scss"
|
||||
|
||||
type Params = {
|
||||
@ -9,12 +10,10 @@ type Params = {
|
||||
|
||||
export default memo(({onClose, styleObj = {}}:Params) => {
|
||||
return (
|
||||
<View
|
||||
style={styleObj}
|
||||
className={style.icon_a_cuowuwrong_self}
|
||||
onClick={onClose}
|
||||
>
|
||||
<Text className={`iconfont icon-guanbi ${style.icon_a_btn}`}></Text>
|
||||
<View style={styleObj} className={style.icon_a_cuowuwrong_self} onClick={onClose}>
|
||||
<View className={style.icon_a_btn}>
|
||||
<IconFont name='icon-guanbi' size={30} color='#ccc'></IconFont>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
@ -19,7 +19,6 @@
|
||||
height: 60px;
|
||||
flex: 1 1 auto;
|
||||
padding-left: 60px;
|
||||
padding-right: 30px;
|
||||
background: #eee;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
|
@ -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'])}>
|
||||
|
@ -59,12 +59,17 @@ const ShoppingCartContainer: FC<InternalContainer> = () => {
|
||||
|
||||
const { fetchData, state } = ShoppingCartListApi()
|
||||
|
||||
const [searchOptions, setSearchOptions] = useState({
|
||||
short_name_or_phone: '',
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
fetchData(searchOptions)
|
||||
}, [searchOptions])
|
||||
|
||||
// 输入了搜索关键字
|
||||
const getSearchData = useCallback(e => {
|
||||
fetchData({ short_name_or_phone: e })
|
||||
// pageNum.current.page = 1
|
||||
// setOrderData(() => ({ list: [], total: 0 }))
|
||||
// setSearchField((val) => ({ ...val, name: e, size: 10 }))
|
||||
setSearchOptions(prev => ({ ...prev, short_name_or_phone: e }))
|
||||
}, [])
|
||||
|
||||
const [shoppingCartData, setShoppingCartData] = useState<{ list: ShoppingCartData[]; total: number }>({ list: [], total: 0 })
|
||||
@ -153,6 +158,24 @@ const ShoppingCartContainer: FC<InternalContainer> = () => {
|
||||
setColorStore(() => tempObject)
|
||||
}
|
||||
|
||||
// 加载刷新数据
|
||||
const [refreshStatus, setRefreshStatus] = useState(false)
|
||||
|
||||
// 下拉刷新
|
||||
const handleRefresh = async () => {
|
||||
setRefreshStatus(true)
|
||||
const res = await fetchData(searchOptions)
|
||||
if (res.success) {
|
||||
console.log('请求 成功')
|
||||
setRefreshStatus(false)
|
||||
Taro.showToast({ title: '刷新成功', icon: 'success' })
|
||||
} else {
|
||||
console.log('请求 失败')
|
||||
Taro.showToast({ title: '刷新失败', icon: 'error' })
|
||||
setRefreshStatus(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={classnames('flex-col', styles.shopping)} id='shoppingContainer'>
|
||||
<View className={styles['shopping--topBar']} id='topBar'>
|
||||
@ -168,7 +191,11 @@ const ShoppingCartContainer: FC<InternalContainer> = () => {
|
||||
</View>
|
||||
<View className={classnames('flex-item', 'flex-col', styles['shopping--context'])}>
|
||||
<View className={classnames(styles.shopping__list__container, 'flex-item')} style={{ height: listHeight }}>
|
||||
<InfiniteScroll statusMore={statusMore}>
|
||||
<InfiniteScroll
|
||||
statusMore={statusMore}
|
||||
refresherEnabled={true}
|
||||
selfOnRefresherRefresh={handleRefresh}
|
||||
refresherTriggered={refreshStatus}>
|
||||
{!!shoppingCartData?.list?.length &&
|
||||
shoppingCartData?.list?.map((item, index) => {
|
||||
return <ItemList itemData={item} key={index}></ItemList>
|
||||
|
@ -14,7 +14,6 @@ import Taro from '@tarojs/taro'
|
||||
interface SearchFilter {
|
||||
take_goods_order_type?: number
|
||||
timeKey?: string
|
||||
take_goods_order_no?: string
|
||||
}
|
||||
|
||||
export interface SearchField extends Omit<SearchFilter, 'timeKey'> {
|
||||
@ -77,7 +76,6 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
const [searchFilter, setSearchFilter] = useState<SearchFilter>({
|
||||
take_goods_order_type: undefined,
|
||||
timeKey: '0',
|
||||
take_goods_order_no: '',
|
||||
})
|
||||
const handleSelectedType = (type: string | number) => {
|
||||
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 }[]>(() => {
|
||||
return state.data.list
|
||||
@ -130,13 +124,12 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
setSearchFilter({ take_goods_order_type: undefined, timeKey: '0', take_goods_order_no: '' })
|
||||
setSearchFilter({ take_goods_order_type: undefined, timeKey: '0'})
|
||||
onReset?.()
|
||||
}
|
||||
const handleConfirm = () => {
|
||||
const changedField = {
|
||||
take_goods_order_type: searchFilter.take_goods_order_type,
|
||||
take_goods_order_no: searchFilter.take_goods_order_no,
|
||||
date_min: customTime.date_min,
|
||||
date_max: customTime.date_max,
|
||||
}
|
||||
@ -144,40 +137,9 @@ const DeliveryFilter = memo<DeliveryPropsType>((props) => {
|
||||
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 (
|
||||
<>
|
||||
<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--title']}>提货类型</View>
|
||||
<View className={classnames(styles['filterItem--wrapper'], styles['filter--type'])}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user