diff --git a/src/components/closeBtn/index.tsx b/src/components/closeBtn/index.tsx index 2cdb4b1..970e21b 100644 --- a/src/components/closeBtn/index.tsx +++ b/src/components/closeBtn/index.tsx @@ -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 ( - - + + + + ) }) diff --git a/src/components/search/index.module.scss b/src/components/search/index.module.scss index ea90ebd..d3c5664 100644 --- a/src/components/search/index.module.scss +++ b/src/components/search/index.module.scss @@ -19,7 +19,6 @@ height: 60px; flex: 1 1 auto; padding-left: 60px; - padding-right: 30px; background: #eee; box-sizing: border-box; display: flex; diff --git a/src/pages/delivery/components/Filter/index.tsx b/src/pages/delivery/components/Filter/index.tsx index e9c1b77..77dd386 100644 --- a/src/pages/delivery/components/Filter/index.tsx +++ b/src/pages/delivery/components/Filter/index.tsx @@ -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 { @@ -77,7 +76,6 @@ const DeliveryFilter = memo((props) => { const [searchFilter, setSearchFilter] = useState({ type: undefined, timeKey: '0', - delivery_notice_order_no: '', }) const handleSelectedType = (type: string | number) => { console.log('type==>', type) @@ -89,11 +87,6 @@ const DeliveryFilter = memo((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((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((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 ( - - - - ) - } - return ( <> - - 发货单号 - - - - 发货类型 diff --git a/src/pages/shopping/index.tsx b/src/pages/shopping/index.tsx index 3be3897..0b20dcf 100644 --- a/src/pages/shopping/index.tsx +++ b/src/pages/shopping/index.tsx @@ -45,7 +45,7 @@ export const Shopping: FC = memo(() => { ) }) -interface InternalContainer { } +interface InternalContainer {} const ShoppingCartContainer: FC = () => { const { isManageStatus, setManageStatus, selectedAmount, currentCheckedPurchaserId, currentCheckedSaleMode, colorStore, setColorStore } = useShoppingContext() @@ -59,12 +59,17 @@ const ShoppingCartContainer: FC = () => { 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 }) @@ -104,7 +109,7 @@ const ShoppingCartContainer: FC = () => { if (!targetGoodsKind) return Taro.showToast({ title: '请先选择客户', icon: 'error' }) const checkedGoodsKind = Object.values(targetGoodsKind).reduce((prev, item: Goods) => { if (item.checked) { - return [...prev,item.id] + return [...prev, item.id] } return prev }, []) @@ -153,6 +158,24 @@ const ShoppingCartContainer: FC = () => { 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 ( @@ -168,7 +191,11 @@ const ShoppingCartContainer: FC = () => { - + {!!shoppingCartData?.list?.length && shoppingCartData?.list?.map((item, index) => { return diff --git a/src/pages/takeDelivery/components/Filter/index.tsx b/src/pages/takeDelivery/components/Filter/index.tsx index 5091d41..79db167 100644 --- a/src/pages/takeDelivery/components/Filter/index.tsx +++ b/src/pages/takeDelivery/components/Filter/index.tsx @@ -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 { @@ -77,7 +76,6 @@ const DeliveryFilter = memo((props) => { const [searchFilter, setSearchFilter] = useState({ 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((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((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((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 ( - - - - ) - } return ( <> - - 提货单号 - - - - 提货类型