diff --git a/src/pages/colorCardOrder/index.tsx b/src/pages/colorCardOrder/index.tsx index d5ed7f2..9d07d86 100644 --- a/src/pages/colorCardOrder/index.tsx +++ b/src/pages/colorCardOrder/index.tsx @@ -127,7 +127,7 @@ export default () => { const { fetchData: addressListFetchData, state } = addressListApi() const getAddressDefault = async() => { const res = await addressListFetchData() - let defaultInfo: AddressItem|null = null + let defaultInfo: AddressItem = {} as AddressItem res?.data.list?.map((item) => { if (item.is_default) { defaultInfo = { @@ -138,7 +138,7 @@ export default () => { } } }) - submitData.current.address_id = defaultInfo!.id + submitData.current.address_id = defaultInfo?.id setAddressInfo(defaultInfo!) } diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index 1f857bb..141628f 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -46,6 +46,7 @@ interface CurrentDialogDetail { last_bulk_price: number } const Details = (props: Params) => { + // const userInfo = useSelector(state => state.userInfo) const { getPhoneNumber, userInfo } = useLogin() // 获取参数(有两种参数:1.商品id, 2.页面分享) @@ -238,6 +239,9 @@ const Details = (props: Params) => { const { fetchData: colorCardFetchData } = GetColorCardOrderByProductApi() const getColorCardData = async() => { + if (!userInfo?.adminUserInfo?.phone) { + return goLink('/pages/login/index') + } const res = await colorCardFetchData({ product_id: productInfo.id }) if (res.data) { res.data.count = 1 @@ -250,6 +254,9 @@ const Details = (props: Params) => { const [showColorSelect, setShowColorSelect] = useState(false) const openColorSelect = () => { + if (!userInfo?.adminUserInfo?.phone) { + return goLink('/pages/login/index') + } setShowColorSelect(true) }