From 9cac816810abddd11b2c6f3684adb8bb350fe05b Mon Sep 17 00:00:00 2001 From: xuan Date: Tue, 27 Sep 2022 18:13:51 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=8E=88=20perf(=E5=8F=91=E8=B4=A7?= =?UTF-8?q?=E5=88=97=E8=A1=A8):=20=E5=8E=BB=E6=8E=89=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E6=A1=86=E5=86=85=E9=83=A8=E7=9A=84=E8=BE=93=E5=85=A5=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../delivery/components/Filter/index.tsx | 42 +------------------ 1 file changed, 1 insertion(+), 41 deletions(-) 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 ( <> - - 发货单号 - - - - 发货类型 From d6e9107276595d6ebcdf77e99da1f4f01b59ebf1 Mon Sep 17 00:00:00 2001 From: xuan Date: Tue, 27 Sep 2022 18:22:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9E=20fix(=E6=8F=90=E8=B4=A7?= =?UTF-8?q?=E5=88=97=E8=A1=A8):=20=E5=8E=BB=E6=8E=89=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E5=86=85=E9=83=A8=E7=9A=84=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../takeDelivery/components/Filter/index.tsx | 40 +------------------ 1 file changed, 1 insertion(+), 39 deletions(-) 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 ( <> - - 提货单号 - - - - 提货类型 From 4f09a902ac4af01e01d3c2f101e6c7c64ed80d10 Mon Sep 17 00:00:00 2001 From: xuan Date: Wed, 28 Sep 2022 11:02:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=8E=88=20perf(=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2):=20=E6=96=B0=E5=A2=9E=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/closeBtn/index.tsx | 11 +++---- src/components/search/index.module.scss | 1 - src/pages/shopping/index.tsx | 41 ++++++++++++++++++++----- 3 files changed, 39 insertions(+), 14 deletions(-) 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/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