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' : ''}`}
onClick={() => setSelectedType('1')}
></View>
<View
className={`w-[50%] text-center ${selectedType === '2' ? 'selected-tab' : ''}`}
onClick={() => setSelectedType('2')}
></View>
</View>
<ScrollView
type="nested"

View File

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

View File

@ -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);

View File

@ -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]

View File

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

View File

@ -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' })

View File

@ -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()

View File

@ -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('/'))
}}>
<Input value={regionSelected} className='area' placeholder='请选择就业地区' placeholderClass="text-right" />
<Input disabled value={regionSelected} className='area' placeholder='请选择收货地区' placeholderClass="text-right" />
</Picker>
</View>
<Divider />

View File

@ -53,7 +53,18 @@ export default function Address() {
</View>
<View className="text-[26px] mt-1 text-[#666666]">{item.fullAddress}</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>
)
@ -96,7 +107,7 @@ export default function Address() {
className="bg-[#f5f5f5] p-2 flex items-start pt-3 justify-evenly w-full"
>
{
orderId ? <>
!orderId ? <>
<View className="default-btn w-[45%]" onClick={() => {
Taro.chooseAddress({
success: async (e) => {

View File

@ -101,21 +101,26 @@ export default function ConfirmOrder() {
orderInfo?.orderId ? (
<>
{
orderInfo?.addressInfo?.id ? <View className="bg-white p-4 px-5 flex items-center rounded-xl shadow-md flex">
<View className="grow">
<View className="text-[30px]">
<Text>{orderInfo.addressInfo.contact}</Text>
<Text className="pl-[.4rem]">{orderInfo.addressInfo.phoneNumber}</Text>
</View>
<View className="text-[26px] mt-1">
<Text>{orderInfo.addressInfo.areaInfo}</Text>
<Text className="pl-2">{orderInfo.addressInfo.fullAddress}</Text>
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="text-[30px]">
<Text>{orderInfo.addressInfo.contact}</Text>
<Text className="pl-[.4rem]">{orderInfo.addressInfo.phoneNumber}</Text>
</View>
<View className="text-[26px] mt-1">
<Text>{orderInfo.addressInfo.areaInfo}</Text>
<Text className="pl-2">{orderInfo.addressInfo.fullAddress}</Text>
</View>
</View>
<Image src={arrow} className="w-[14px] h-[20px]"/>
</View>
<Image src={arrow} className="w-[14px] h-[20px]" onClick={() => {
Taro.navigateTo({ url: '/userInfo/address/index?orderId=' + OrderId })
}} />
</View> : <View
</> : <View
className="text-[1.1rem] bg-white p-4 px-5 flex items-center justify-center rounded-xl shadow-md flex"
onClick={() => {
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',