diff --git a/src/components/bindSalesManDialog/index.tsx b/src/components/bindSalesManDialog/index.tsx index 85f0f84..1ca29f9 100644 --- a/src/components/bindSalesManDialog/index.tsx +++ b/src/components/bindSalesManDialog/index.tsx @@ -21,7 +21,7 @@ interface Param { invitation_code: string; name: string; phone: string } interface params { onSuccess?: () => void } -interface SalesManDialogRef { +export interface SalesManDialogRef { show: boolean handleChange: (show: boolean) => void } diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index aab5f31..aea22b5 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -1,9 +1,10 @@ import { Image, ScrollView, View } from '@tarojs/components' import Taro from '@tarojs/taro' import classnames from 'classnames' -import { useCallback, useEffect, useMemo, useRef, useState, useTransition } from 'react' +import { Ref, useCallback, useEffect, useMemo, useRef, useState, useTransition } from 'react' import Counter from '../counter' -import BindSalesmanPopup from '../bindSalesmanPopup' +import type { SalesManDialogRef } from '../bindSalesManDialog' +import BindSalesManDialog from '../bindSalesManDialog' import LabAndImgShow from '../LabAndImgShow' import LabAndImg from '../LabAndImg' import styles from './index.module.scss' @@ -44,7 +45,7 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod { value: 1, title: '剪板', unit: '米', eunit: 'm', step: 1, digits: 2, minNum: 0.5, maxNum: 9.99, defaultNum: 1 }, { value: 2, title: '散剪', unit: '米', eunit: 'kg', step: 1, digits: 2, minNum: 3, maxNum: 100000, defaultNum: 3 }, ] - + const bindSalesManDialogRef = useRef(null) const [isPending, startTransition] = useTransition() // 切换面料类型 @@ -121,8 +122,6 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod setList(() => ({ ...list })) } - // 绑定业务员和电话号码 - const [showBindSalesman, setShowBindSalesman] = useState(false) // 显示时展示数据 useEffect(() => { if (!show) { @@ -132,7 +131,8 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod else { setLoading(true) getShoppingCart() - setShowBindSalesman(() => false) + // setShowBindSalesman(() => false) + bindSalesManDialogRef.current?.handleChange(false) } }, [show]) @@ -265,7 +265,8 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod const res = await FetchData() if (res.data.order_access_status !== 3) { if (res.data.order_access_status == 1) { applyOrderAccessFetchData() } - setShowBindSalesman(() => true) + bindSalesManDialogRef.current?.handleChange(true) + // setShowBindSalesman(() => true) onClose?.() return false } @@ -372,7 +373,7 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod - setShowBindSalesman(false)} /> +