From 92d9c530d083dcdb6706b1efaec3369e861a3f7e Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 16 Jul 2024 17:18:44 +0800 Subject: [PATCH] fix: BUG --- src/adoptionManage/adoptionRule/index.tsx | 4 +++ src/components/HeaderNation/index.tsx | 27 +++++++++++++----- src/pageMe/inviteFriends/index.tsx | 2 +- src/pageMe/myOrder/index.tsx | 7 +++-- src/pages/adoptionCircle/index.tsx | 2 +- src/pages/login/index.tsx | 6 +++- src/pagesHome/adoption.tsx | 8 +++--- src/userInfo/addAddress/index.tsx | 9 ++++-- src/userInfo/address/index.tsx | 15 ++++++++-- src/userInfo/confirmOrder/index.tsx | 34 +++++++++++++---------- 10 files changed, 79 insertions(+), 35 deletions(-) diff --git a/src/adoptionManage/adoptionRule/index.tsx b/src/adoptionManage/adoptionRule/index.tsx index cfd31c2..0839445 100644 --- a/src/adoptionManage/adoptionRule/index.tsx +++ b/src/adoptionManage/adoptionRule/index.tsx @@ -43,6 +43,10 @@ export default function AdoptionRule() { className={`w-[50%] text-center ${selectedType === '1' ? 'selected-tab' : ''}`} onClick={() => setSelectedType('1')} >按亩认养 + setSelectedType('2')} + >全部认养 { const { title = '', height = APP_TITLE_HEIGHT, background = 'white' } = props - const hiddenBack = Taro.getCurrentPages().length === 1 + const currentPages = Taro.getCurrentPages() + const hiddenBack = currentPages.length === 1 return ( - { - Taro.navigateBack() - }}> - { hiddenBack ? '' : } - + { + hiddenBack ? <> + { + if (currentPages[0].route === 'pagesHome/index') return + Taro.redirectTo({ url: '/pagesHome/index' }) + }}> + + + : <> + Taro.navigateBack()}> + + + + } { title } - + ) } diff --git a/src/pageMe/inviteFriends/index.tsx b/src/pageMe/inviteFriends/index.tsx index 4407306..1cdd878 100644 --- a/src/pageMe/inviteFriends/index.tsx +++ b/src/pageMe/inviteFriends/index.tsx @@ -43,7 +43,7 @@ export default function InviteFriends() { useShareAppMessage(async (res) => { const userOpenId = Taro.getStorageSync("USER_OPEN_ID") const { data } = await adoptionGiveOther({ - originalOrderNumber: id, + orderId: id, openId: userOpenId }) console.log("赠送接口返回", data); diff --git a/src/pageMe/myOrder/index.tsx b/src/pageMe/myOrder/index.tsx index 275bd94..47ad806 100644 --- a/src/pageMe/myOrder/index.tsx +++ b/src/pageMe/myOrder/index.tsx @@ -43,7 +43,7 @@ export default function MyOrder() { openId }) console.log("orderPage", data); - + if (!data) return; const { list } = data if (Array.isArray(list)) setDataList(list) } @@ -75,7 +75,10 @@ export default function MyOrder() { style={{ display: item.isPresented === '1' ? 'none' : 'block' }} onClick={() => { if (item.status === '0') Taro.navigateTo({ url: '/userInfo/confirmOrder/index?id=' + item.id }) // 未付款 - if (item.status === '1') Taro.navigateTo({ url: '/pageMe/inviteFriends/index?id=' + item.orderNumber }) // 送好友 + if (item.status === '1') Taro.navigateTo({ url: '/pageMe/inviteFriends/index?id=' + item.id }) // 送好友 + if (item.status !== '0' && item.status !== '1') { + Taro.navigateTo({ url: '/pageMe/orderDetail/index?id=' + item.orderNumber }) + } }} >{ OperationMap[item.status] diff --git a/src/pages/adoptionCircle/index.tsx b/src/pages/adoptionCircle/index.tsx index e2e318f..0557187 100644 --- a/src/pages/adoptionCircle/index.tsx +++ b/src/pages/adoptionCircle/index.tsx @@ -61,7 +61,7 @@ export default function AdoptionCircle() { useShareAppMessage(() => { return { title: '大闸蟹认养小程序', // 分享卡片的title - path: 'pages/login/index', // 分享卡片的小程序路径 + path: 'pages/adoptionCircle/index', // 分享卡片的小程序路径 imageUrl: imgBg // 分享卡片的图片链接 }; }) diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index 6b7fcf1..c528d1d 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -9,6 +9,11 @@ import useStore from "../../storage/index" const loginBg = IMG_BASE_URL + 'pages/bg.png' const Login = () => { + const userOpenId = Taro.getStorageSync("USER_OPEN_ID") + if (userOpenId) { + Taro.redirectTo({ url: '/pagesHome/index' }) + return null + } const { router } = getCurrentInstance() // 通过分享链接打开此页面, shareId 其实是 orderNumber const shareId = router && router.params && router.params.shareId @@ -19,7 +24,6 @@ const Login = () => { const setUserName = useStore((store:any) => store.setUserName) const checkUserStatus = async () => { try { - const userOpenId = Taro.getStorageSync("USER_OPEN_ID") if (userOpenId) return Taro.redirectTo({ url: '/pagesHome/index' }) } catch (e) {} const { code, data } = await getPlan({ serialNumber: 'JHLS202407012565376' }) diff --git a/src/pagesHome/adoption.tsx b/src/pagesHome/adoption.tsx index 4766e4f..37976f9 100644 --- a/src/pagesHome/adoption.tsx +++ b/src/pagesHome/adoption.tsx @@ -94,10 +94,10 @@ export default function Adoption() { const [amountCount, setAmountCount] = useState('0') useEffect(() => { let count = 0 - ruleList.forEach(item => { - if (item.value) count += item.value - }) - setAmountCount(count.toString()) + // ruleList.forEach(item => { + // if (item.value) count += item.value + // }) + // setAmountCount(count.toString()) }, [ruleList]) useEffect(() => { getAdoptionRuleList() }, [selectType]) const { router } = getCurrentInstance() diff --git a/src/userInfo/addAddress/index.tsx b/src/userInfo/addAddress/index.tsx index a60a966..442d4c2 100644 --- a/src/userInfo/addAddress/index.tsx +++ b/src/userInfo/addAddress/index.tsx @@ -21,8 +21,13 @@ export default function AddAddress() { return false }) console.log("addressItem", addressItem); + if (!addressItem) return const { - contact, phoneNumber, areaInfo, fullAddress, isDefault + contact = '', + phoneNumber = '', + areaInfo = '', + fullAddress = '', + isDefault = false } = addressItem setUserName(contact) setTelNumber(phoneNumber) @@ -130,7 +135,7 @@ export default function AddAddress() { const regionArr = (e.target as any).value setRegionSelected(regionArr.join('/')) }}> - + diff --git a/src/userInfo/address/index.tsx b/src/userInfo/address/index.tsx index 8a850de..6e508bc 100644 --- a/src/userInfo/address/index.tsx +++ b/src/userInfo/address/index.tsx @@ -53,7 +53,18 @@ export default function Address() { {item.fullAddress} - + { + if (orderId) { + // 如果是在选择地址,阻止冒泡,进入修改地址页面 + e.stopPropagation() + Taro.navigateTo({ url: '/userInfo/addAddress/index?edit=true&id=' + item.id }) + } + }}> + + ) @@ -96,7 +107,7 @@ export default function Address() { className="bg-[#f5f5f5] p-2 flex items-start pt-3 justify-evenly w-full" > { - orderId ? <> + !orderId ? <> { Taro.chooseAddress({ success: async (e) => { diff --git a/src/userInfo/confirmOrder/index.tsx b/src/userInfo/confirmOrder/index.tsx index 1bfb647..c18b95f 100644 --- a/src/userInfo/confirmOrder/index.tsx +++ b/src/userInfo/confirmOrder/index.tsx @@ -101,21 +101,26 @@ export default function ConfirmOrder() { orderInfo?.orderId ? ( <> { - orderInfo?.addressInfo?.id ? - - - {orderInfo.addressInfo.contact} - {orderInfo.addressInfo.phoneNumber} - - - {orderInfo.addressInfo.areaInfo} - {orderInfo.addressInfo.fullAddress} + orderInfo?.addressInfo?.id ? <> + { + Taro.navigateTo({ url: '/userInfo/address/index?orderId=' + OrderId }) + }} + > + + + {orderInfo.addressInfo.contact} + {orderInfo.addressInfo.phoneNumber} + + + {orderInfo.addressInfo.areaInfo} + {orderInfo.addressInfo.fullAddress} + + - { - Taro.navigateTo({ url: '/userInfo/address/index?orderId=' + OrderId }) - }} /> - : : { Taro.navigateTo({ url: '/userInfo/address/index?orderId=' + OrderId }) @@ -191,8 +196,7 @@ export default function ConfirmOrder() { }) console.log("data", data); if (code === 0) { - Taro.navigateBack() - Taro.navigateTo({ url: '/pageMe/myCertificate/index' }) + Taro.redirectTo({ url: '/pageMe/myCertificate/index' }) } else Taro.showToast({ title: msg, icon: 'error',