This commit is contained in:
Tony 2024-07-16 17:18:44 +08:00
parent 9fa8c96910
commit 92d9c530d0
10 changed files with 79 additions and 35 deletions

View File

@ -43,6 +43,10 @@ export default function AdoptionRule() {
className={`w-[50%] text-center ${selectedType === '1' ? 'selected-tab' : ''}`} className={`w-[50%] text-center ${selectedType === '1' ? 'selected-tab' : ''}`}
onClick={() => setSelectedType('1')} onClick={() => setSelectedType('1')}
></View> ></View>
<View
className={`w-[50%] text-center ${selectedType === '2' ? 'selected-tab' : ''}`}
onClick={() => setSelectedType('2')}
></View>
</View> </View>
<ScrollView <ScrollView
type="nested" type="nested"

View File

@ -2,22 +2,35 @@ import { View, Image } from "@tarojs/components"
import { APP_TITLE_HEIGHT, IMG_BASE_URL } from "../../config"; import { APP_TITLE_HEIGHT, IMG_BASE_URL } from "../../config";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
const arrowImg = IMG_BASE_URL + 'arrow.png' const arrowImg = IMG_BASE_URL + 'arrow.png'
const homeImg = IMG_BASE_URL + 'home.png'
const HeaderNation = (props) => { const HeaderNation = (props) => {
const { title = '', height = APP_TITLE_HEIGHT, background = 'white' } = props 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 ( return (
<View <View
className="w-full flex justify-between items-center px-3 relative z-[3]" className="w-full flex justify-between items-center px-3 relative z-[3]"
style={{ height, background }} style={{ height, background }}
> >
<View className="w-[4rem]" onClick={() => { {
Taro.navigateBack() hiddenBack ? <>
<View className="h-full w-[3rem] pl-[.4rem] flex items-center" style={{
visibility: currentPages[0].route === 'pagesHome/index' ? 'hidden' : 'visible'
}} onClick={() => {
if (currentPages[0].route === 'pagesHome/index') return
Taro.redirectTo({ url: '/pagesHome/index' })
}}> }}>
{ hiddenBack ? '' : <Image src={arrowImg} className="w-[13px] h-[23px]" /> } <Image src={homeImg} className="w-[28px] h-[28px]" />
</View> </View>
</> : <>
<View className="h-full w-[3rem] pl-[.4rem] flex items-center" onClick={() => Taro.navigateBack()}>
<Image src={arrowImg} className="w-[15px] h-[23px]" />
</View>
</>
}
<View>{ title }</View> <View>{ title }</View>
<View className="w-[4rem]"></View> <View className="w-[3rem] h-full"></View>
</View> </View>
) )
} }

View File

@ -43,7 +43,7 @@ export default function InviteFriends() {
useShareAppMessage(async (res) => { useShareAppMessage(async (res) => {
const userOpenId = Taro.getStorageSync("USER_OPEN_ID") const userOpenId = Taro.getStorageSync("USER_OPEN_ID")
const { data } = await adoptionGiveOther({ const { data } = await adoptionGiveOther({
originalOrderNumber: id, orderId: id,
openId: userOpenId openId: userOpenId
}) })
console.log("赠送接口返回", data); console.log("赠送接口返回", data);

View File

@ -43,7 +43,7 @@ export default function MyOrder() {
openId openId
}) })
console.log("orderPage", data); console.log("orderPage", data);
if (!data) return;
const { list } = data const { list } = data
if (Array.isArray(list)) setDataList(list) if (Array.isArray(list)) setDataList(list)
} }
@ -75,7 +75,10 @@ export default function MyOrder() {
style={{ display: item.isPresented === '1' ? 'none' : 'block' }} style={{ display: item.isPresented === '1' ? 'none' : 'block' }}
onClick={() => { onClick={() => {
if (item.status === '0') Taro.navigateTo({ url: '/userInfo/confirmOrder/index?id=' + item.id }) // 未付款 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] OperationMap[item.status]

View File

@ -61,7 +61,7 @@ export default function AdoptionCircle() {
useShareAppMessage(() => { useShareAppMessage(() => {
return { return {
title: '大闸蟹认养小程序', // 分享卡片的title title: '大闸蟹认养小程序', // 分享卡片的title
path: 'pages/login/index', // 分享卡片的小程序路径 path: 'pages/adoptionCircle/index', // 分享卡片的小程序路径
imageUrl: imgBg // 分享卡片的图片链接 imageUrl: imgBg // 分享卡片的图片链接
}; };
}) })

View File

@ -9,6 +9,11 @@ import useStore from "../../storage/index"
const loginBg = IMG_BASE_URL + 'pages/bg.png' const loginBg = IMG_BASE_URL + 'pages/bg.png'
const Login = () => { const Login = () => {
const userOpenId = Taro.getStorageSync("USER_OPEN_ID")
if (userOpenId) {
Taro.redirectTo({ url: '/pagesHome/index' })
return null
}
const { router } = getCurrentInstance() const { router } = getCurrentInstance()
// 通过分享链接打开此页面, shareId 其实是 orderNumber // 通过分享链接打开此页面, shareId 其实是 orderNumber
const shareId = router && router.params && router.params.shareId const shareId = router && router.params && router.params.shareId
@ -19,7 +24,6 @@ const Login = () => {
const setUserName = useStore((store:any) => store.setUserName) const setUserName = useStore((store:any) => store.setUserName)
const checkUserStatus = async () => { const checkUserStatus = async () => {
try { try {
const userOpenId = Taro.getStorageSync("USER_OPEN_ID")
if (userOpenId) return Taro.redirectTo({ url: '/pagesHome/index' }) if (userOpenId) return Taro.redirectTo({ url: '/pagesHome/index' })
} catch (e) {} } catch (e) {}
const { code, data } = await getPlan({ serialNumber: 'JHLS202407012565376' }) const { code, data } = await getPlan({ serialNumber: 'JHLS202407012565376' })

View File

@ -94,10 +94,10 @@ export default function Adoption() {
const [amountCount, setAmountCount] = useState('0') const [amountCount, setAmountCount] = useState('0')
useEffect(() => { useEffect(() => {
let count = 0 let count = 0
ruleList.forEach(item => { // ruleList.forEach(item => {
if (item.value) count += item.value // if (item.value) count += item.value
}) // })
setAmountCount(count.toString()) // setAmountCount(count.toString())
}, [ruleList]) }, [ruleList])
useEffect(() => { getAdoptionRuleList() }, [selectType]) useEffect(() => { getAdoptionRuleList() }, [selectType])
const { router } = getCurrentInstance() const { router } = getCurrentInstance()

View File

@ -21,8 +21,13 @@ export default function AddAddress() {
return false return false
}) })
console.log("addressItem", addressItem); console.log("addressItem", addressItem);
if (!addressItem) return
const { const {
contact, phoneNumber, areaInfo, fullAddress, isDefault contact = '',
phoneNumber = '',
areaInfo = '',
fullAddress = '',
isDefault = false
} = addressItem } = addressItem
setUserName(contact) setUserName(contact)
setTelNumber(phoneNumber) setTelNumber(phoneNumber)
@ -130,7 +135,7 @@ export default function AddAddress() {
const regionArr = (e.target as any).value const regionArr = (e.target as any).value
setRegionSelected(regionArr.join('/')) setRegionSelected(regionArr.join('/'))
}}> }}>
<Input value={regionSelected} className='area' placeholder='请选择就业地区' placeholderClass="text-right" /> <Input disabled value={regionSelected} className='area' placeholder='请选择收货地区' placeholderClass="text-right" />
</Picker> </Picker>
</View> </View>
<Divider /> <Divider />

View File

@ -53,7 +53,18 @@ export default function Address() {
</View> </View>
<View className="text-[26px] mt-1 text-[#666666]">{item.fullAddress}</View> <View className="text-[26px] mt-1 text-[#666666]">{item.fullAddress}</View>
</View> </View>
<Image src={arrow} className="w-[14px] h-[20px] rotate-180"/> <View className="p-[6px]" onClick={(e) => {
if (orderId) {
// 如果是在选择地址,阻止冒泡,进入修改地址页面
e.stopPropagation()
Taro.navigateTo({ url: '/userInfo/addAddress/index?edit=true&id=' + item.id })
}
}}>
<Image
src={arrow}
className="w-[14px] h-[20px] rotate-180"
/>
</View>
</View> </View>
</View> </View>
) )
@ -96,7 +107,7 @@ export default function Address() {
className="bg-[#f5f5f5] p-2 flex items-start pt-3 justify-evenly w-full" className="bg-[#f5f5f5] p-2 flex items-start pt-3 justify-evenly w-full"
> >
{ {
orderId ? <> !orderId ? <>
<View className="default-btn w-[45%]" onClick={() => { <View className="default-btn w-[45%]" onClick={() => {
Taro.chooseAddress({ Taro.chooseAddress({
success: async (e) => { success: async (e) => {

View File

@ -101,7 +101,13 @@ export default function ConfirmOrder() {
orderInfo?.orderId ? ( orderInfo?.orderId ? (
<> <>
{ {
orderInfo?.addressInfo?.id ? <View className="bg-white p-4 px-5 flex items-center rounded-xl shadow-md flex"> orderInfo?.addressInfo?.id ? <>
<View
className="bg-white p-4 px-5 flex items-center rounded-xl shadow-md flex"
onClick={() => {
Taro.navigateTo({ url: '/userInfo/address/index?orderId=' + OrderId })
}}
>
<View className="grow"> <View className="grow">
<View className="text-[30px]"> <View className="text-[30px]">
<Text>{orderInfo.addressInfo.contact}</Text> <Text>{orderInfo.addressInfo.contact}</Text>
@ -112,10 +118,9 @@ export default function ConfirmOrder() {
<Text className="pl-2">{orderInfo.addressInfo.fullAddress}</Text> <Text className="pl-2">{orderInfo.addressInfo.fullAddress}</Text>
</View> </View>
</View> </View>
<Image src={arrow} className="w-[14px] h-[20px]" onClick={() => { <Image src={arrow} className="w-[14px] h-[20px]"/>
Taro.navigateTo({ url: '/userInfo/address/index?orderId=' + OrderId }) </View>
}} /> </> : <View
</View> : <View
className="text-[1.1rem] bg-white p-4 px-5 flex items-center justify-center rounded-xl shadow-md flex" className="text-[1.1rem] bg-white p-4 px-5 flex items-center justify-center rounded-xl shadow-md flex"
onClick={() => { onClick={() => {
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); console.log("data", data);
if (code === 0) { if (code === 0) {
Taro.navigateBack() Taro.redirectTo({ url: '/pageMe/myCertificate/index' })
Taro.navigateTo({ url: '/pageMe/myCertificate/index' })
} else Taro.showToast({ } else Taro.showToast({
title: msg, title: msg,
icon: 'error', icon: 'error',