fix: BUG
This commit is contained in:
parent
92d9c530d0
commit
28079385a0
@ -42,3 +42,12 @@ export const adoptionGiveOther = (data) => {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 接受赠送
|
||||||
|
export const receiveGift = (data) => {
|
||||||
|
return request({
|
||||||
|
url: 'wechat/v1/adoption-order/receiveGift',
|
||||||
|
method: 'PUT',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
@ -25,7 +25,7 @@ export default function InviteFriends() {
|
|||||||
const { data } = await adoptionOrderPage({
|
const { data } = await adoptionOrderPage({
|
||||||
serialNumber: "JHLS202407012565376",
|
serialNumber: "JHLS202407012565376",
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 20,
|
pageSize: 100,
|
||||||
openId: userOpenId
|
openId: userOpenId
|
||||||
})
|
})
|
||||||
const { list } = data;
|
const { list } = data;
|
||||||
|
@ -4,8 +4,8 @@ import HeaderNation from "../../components/HeaderNation";
|
|||||||
import OuterFrame from "../../components/OuterFrame";
|
import OuterFrame from "../../components/OuterFrame";
|
||||||
import StatusBar from "../../components/StatusBar";
|
import StatusBar from "../../components/StatusBar";
|
||||||
import Divider from "../../components/Divider";
|
import Divider from "../../components/Divider";
|
||||||
import { orderPage } from "../../api/order";
|
import { adoptionOrderPage } from "../../api/user";
|
||||||
import { useEffect, useState } from "react";
|
import { useState } from "react";
|
||||||
import Taro, { useDidShow } from "@tarojs/taro";
|
import Taro, { useDidShow } from "@tarojs/taro";
|
||||||
import NoData from "../../components/NoData";
|
import NoData from "../../components/NoData";
|
||||||
import * as dayjs from 'dayjs'
|
import * as dayjs from 'dayjs'
|
||||||
@ -36,7 +36,7 @@ export default function MyOrder() {
|
|||||||
const openId = Taro.getStorageSync("USER_OPEN_ID")
|
const openId = Taro.getStorageSync("USER_OPEN_ID")
|
||||||
const [dataList, setDataList] = useState<Array<any>>([])
|
const [dataList, setDataList] = useState<Array<any>>([])
|
||||||
const getDataList = async () => {
|
const getDataList = async () => {
|
||||||
const { data } = await orderPage({
|
const { data } = await adoptionOrderPage({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
serialNumber: 'JHLS202407012565376',
|
serialNumber: 'JHLS202407012565376',
|
||||||
|
@ -4,20 +4,50 @@ import { useEffect, useState } from "react"
|
|||||||
import LoginForm from "../../components/LoginForm"
|
import LoginForm from "../../components/LoginForm"
|
||||||
import { supabase } from "../../api/supabaseClient"
|
import { supabase } from "../../api/supabaseClient"
|
||||||
import { createUser, getPlan, getUserByCode } from "../../api/user"
|
import { createUser, getPlan, getUserByCode } from "../../api/user"
|
||||||
|
import { receiveGift } from '../../api/order'
|
||||||
import { IMG_BASE_URL } from "../../config"
|
import { IMG_BASE_URL } from "../../config"
|
||||||
import useStore from "../../storage/index"
|
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 [showForm, setShowForm] = useState(true)
|
||||||
const userOpenId = Taro.getStorageSync("USER_OPEN_ID")
|
const userOpenId = Taro.getStorageSync("USER_OPEN_ID")
|
||||||
if (userOpenId) {
|
|
||||||
|
// 接受订单?
|
||||||
|
const acceptOrder = () => {
|
||||||
|
Taro.showModal({
|
||||||
|
title: '接受赠送订单',
|
||||||
|
content: '是否接受朋友赠送的订单?',
|
||||||
|
success: async (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
console.log('用户点击确定')
|
||||||
|
const { data } = await receiveGift({
|
||||||
|
orderId: shareId,
|
||||||
|
receivedId: userOpenId + '_' + new Date().valueOf().toString()
|
||||||
|
})
|
||||||
|
Taro.redirectTo({ url: '/pagesHome/index' })
|
||||||
|
} else if (res.cancel) {
|
||||||
Taro.redirectTo({ url: '/pagesHome/index' })
|
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
|
||||||
console.log("通过分享链接打开,shareId=", shareId);
|
console.log("通过分享链接打开,shareId=", shareId);
|
||||||
|
if (userOpenId) {
|
||||||
|
if (shareId) {
|
||||||
|
// 如果用户已经登录,但是有朋友赠送的订单
|
||||||
|
// 不显示设置头像昵称弹窗,显示是否接受赠送
|
||||||
|
setShowForm(false)
|
||||||
|
acceptOrder()
|
||||||
|
} else {
|
||||||
|
Taro.redirectTo({ url: '/pagesHome/index' })
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Taro.navigateTo({ url: '/pageMe/myCertificate/index' })
|
// Taro.navigateTo({ url: '/pageMe/myCertificate/index' })
|
||||||
const setUserAvatar = useStore((store:any) => store.setUserAvatar)
|
const setUserAvatar = useStore((store:any) => store.setUserAvatar)
|
||||||
@ -50,7 +80,7 @@ const Login = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
checkUserStatus()
|
checkUserStatus()
|
||||||
}, [])
|
}, [])
|
||||||
const [showForm, setShowForm] = useState(true)
|
|
||||||
return (
|
return (
|
||||||
<View className="w-full bg-slate-100 p-3 h-[100vh] flex justify-center items-center relative">
|
<View className="w-full bg-slate-100 p-3 h-[100vh] flex justify-center items-center relative">
|
||||||
<Image src={loginBg} className="w-full h-full absolute top-0 left-0 z-10" />
|
<Image src={loginBg} className="w-full h-full absolute top-0 left-0 z-10" />
|
||||||
@ -111,8 +141,12 @@ const Login = () => {
|
|||||||
if (_data.buyerImg) setUserAvatar(_data.buyerImg)
|
if (_data.buyerImg) setUserAvatar(_data.buyerImg)
|
||||||
if (_data.nickName) setUserName(_data.nickName)
|
if (_data.nickName) setUserName(_data.nickName)
|
||||||
Taro.setStorage({ key: 'USER_OPEN_ID', data: data1.openid })
|
Taro.setStorage({ key: 'USER_OPEN_ID', data: data1.openid })
|
||||||
|
if (shareId) {
|
||||||
|
acceptOrder()
|
||||||
|
} else {
|
||||||
Taro.redirectTo({ url: '/pagesHome/index' })
|
Taro.redirectTo({ url: '/pagesHome/index' })
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
@ -143,14 +143,18 @@ export default function Monitor() {
|
|||||||
const openId = Taro.getStorageSync("USER_OPEN_ID")
|
const openId = Taro.getStorageSync("USER_OPEN_ID")
|
||||||
const { data } = await adoptionOrderPage({
|
const { data } = await adoptionOrderPage({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 5,
|
pageSize: 100,
|
||||||
serialNumber: 'JHLS202407012565376',
|
serialNumber: 'JHLS202407012565376',
|
||||||
openId
|
openId
|
||||||
})
|
})
|
||||||
const { list } = data
|
const { list } = data
|
||||||
if (Array.isArray(list)) {
|
if (Array.isArray(list)) {
|
||||||
console.log("LIST", list);
|
console.log("LIST", list);
|
||||||
setAdoptionNum(list.length)
|
setAdoptionNum(list.filter(item => {
|
||||||
|
// TODO: 在这里把取消的订单和未付款的订单过滤掉
|
||||||
|
if (item.status === '0' || item.status === '4') return false;
|
||||||
|
return true
|
||||||
|
}).length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
useEffect(() => { getAdoptionOrderInfo() }, [])
|
useEffect(() => { getAdoptionOrderInfo() }, [])
|
||||||
@ -172,14 +176,18 @@ export default function Monitor() {
|
|||||||
const { data } = await adoptionOrderPage({
|
const { data } = await adoptionOrderPage({
|
||||||
serialNumber: 'JHLS202407012565376',
|
serialNumber: 'JHLS202407012565376',
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 100,
|
||||||
openId: userOpenId
|
openId: userOpenId
|
||||||
})
|
})
|
||||||
const { list } = data;
|
const { list } = data;
|
||||||
console.log("LIII", list);
|
console.log("LIII", list);
|
||||||
|
|
||||||
if (Array.isArray(list)) {
|
if (Array.isArray(list)) {
|
||||||
const details = list.map(item => (item.detail.specs))
|
const details = list.filter(item => {
|
||||||
|
if (!item.detail) return false
|
||||||
|
if (item.status === '0' || item.status === '4') return false;
|
||||||
|
return true
|
||||||
|
}).map(item => (item.detail.specs))
|
||||||
|
|
||||||
console.log("LIST111", details);
|
console.log("LIST111", details);
|
||||||
let specsArr:any = []
|
let specsArr:any = []
|
||||||
|
@ -161,19 +161,19 @@ export default function PlotSelector({ selected, onChange }) {
|
|||||||
const { data } = await adoptionOrderPage({
|
const { data } = await adoptionOrderPage({
|
||||||
openId: userOpenId,
|
openId: userOpenId,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 20,
|
pageSize: 100,
|
||||||
serialNumber: 'JHLS202407012565376'
|
serialNumber: 'JHLS202407012565376'
|
||||||
})
|
})
|
||||||
const { list } = data;
|
const { list } = data;
|
||||||
console.log("认养订单", list);
|
console.log("认养订单", list);
|
||||||
|
|
||||||
if (Array.isArray(list)) {
|
if (Array.isArray(list)) {
|
||||||
setMyOrderIdList(list.map(item => (item.plotId)))
|
// TODO: 把取消付款的过滤掉
|
||||||
console.log("list.map(item => (item.id))", list.map(item => (item.plotId)));
|
setMyOrderIdList(list.filter(item => {
|
||||||
|
if (item.status === '0' || item.status === '4') return false
|
||||||
|
return true
|
||||||
|
}).map(item => (item.plotId)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
useEffect(() => { getOrderList() }, [])
|
useEffect(() => { getOrderList() }, [])
|
||||||
|
|
||||||
|
@ -6,10 +6,9 @@ import { APP_FULL_HEIGHT, formatMoney, IMG_BASE_URL } from "../../config";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import arrow from './assets/arrow.png'
|
import arrow from './assets/arrow.png'
|
||||||
import Taro, { getCurrentInstance, useDidShow } from "@tarojs/taro"
|
import Taro, { getCurrentInstance, useDidShow } from "@tarojs/taro"
|
||||||
import { adoptionOrderUpdate, orderPage, getOrderInfoById } from "../../api/order";
|
import { adoptionOrderUpdate, getOrderInfoById } from "../../api/order";
|
||||||
import * as dayjs from 'dayjs'
|
import * as dayjs from 'dayjs'
|
||||||
import useStore from "../../storage";
|
import useStore from "../../storage";
|
||||||
import { addressPage } from "../../api/me";
|
|
||||||
|
|
||||||
const positionIcon = IMG_BASE_URL + 'position.png'
|
const positionIcon = IMG_BASE_URL + 'position.png'
|
||||||
|
|
||||||
@ -166,7 +165,7 @@ export default function ConfirmOrder() {
|
|||||||
<View className="py-2">
|
<View className="py-2">
|
||||||
<Text>倒计时:</Text>
|
<Text>倒计时:</Text>
|
||||||
<Text className="pl-1">
|
<Text className="pl-1">
|
||||||
<CalcLeftTime time={orderInfo.orderCreateTime + 1000 * 60 * 15} />
|
<CalcLeftTime time={orderInfo.orderCreateTime + 1000 * 60 * 14} />
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className="!py-[26px] px-[16px] text-center text-[#fff] rounded-full w-[85%]" style={{ backgroundColor: diabledPay() ? '#777777' : '#63c632' }} onClick={async () => {
|
<View className="!py-[26px] px-[16px] text-center text-[#fff] rounded-full w-[85%]" style={{ backgroundColor: diabledPay() ? '#777777' : '#63c632' }} onClick={async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user