diff --git a/src/api/order.ts b/src/api/order.ts
index 9de7525..90e7655 100644
--- a/src/api/order.ts
+++ b/src/api/order.ts
@@ -1,13 +1,5 @@
import { request } from './index'
-export const orderPage = (params) => {
- return request({
- url: 'wechat/v1/adoption-order/page',
- method: 'GET',
- params
- })
-}
-
export const adoptionOrderUpdate = (data) => {
return request({
url: 'wechat/v1/adoption-order/update',
diff --git a/src/components/NoData/index.tsx b/src/components/NoData/index.tsx
index 83473e6..314ee61 100644
--- a/src/components/NoData/index.tsx
+++ b/src/components/NoData/index.tsx
@@ -1,11 +1,14 @@
import { View, Image } from "@tarojs/components";
-import noData from './noData.png'
+import { IMG_BASE_URL } from "../../config";
+// import noData from './noData.png'
+
+const noData = IMG_BASE_URL + 'noData.png'
export default function NoData(props) {
const { info = '暂无数据' } = props
return (
-
+
{ info }
)
diff --git a/src/pageMe/myOrder/index.tsx b/src/pageMe/myOrder/index.tsx
index 098c85c..3a12d98 100644
--- a/src/pageMe/myOrder/index.tsx
+++ b/src/pageMe/myOrder/index.tsx
@@ -53,7 +53,9 @@ export default function MyOrder() {
{
dataList.map(item => (
-
+ {
+ Taro.navigateTo({ url: '/pageMe/orderDetail/index?id=' + item.id })
+ }}>
{item.planName}
{
+ onClick={(e) => {
+ e.stopPropagation()
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.id }) // 送好友
if (item.status !== '0' && item.status !== '1') {
- Taro.navigateTo({ url: '/pageMe/orderDetail/index?id=' + item.orderNumber })
+ Taro.navigateTo({ url: '/pageMe/orderDetail/index?id=' + item.id })
}
}}
>{
diff --git a/src/pageMe/orderDetail/index.tsx b/src/pageMe/orderDetail/index.tsx
index ba8cf6a..e151530 100644
--- a/src/pageMe/orderDetail/index.tsx
+++ b/src/pageMe/orderDetail/index.tsx
@@ -1,14 +1,43 @@
-import { View, ScrollView, Image } from "@tarojs/components";
+import { View, ScrollView, Image, Text } from "@tarojs/components";
import { APP_FULL_HEIGHT, IMG_BASE_URL } from "../../config";
import HeaderNation from "../../components/HeaderNation";
import OuterFrame from "../../components/OuterFrame";
import StatusBar from "../../components/StatusBar";
import Divider from "../../components/Divider";
+import { getOrderInfoById } from '../../api/order'
+import Taro, { getCurrentInstance } from "@tarojs/taro"
+import { useEffect, useState } from "react";
+import dayjs from "dayjs";
const arrow = IMG_BASE_URL + 'arrow.png'
+const ORDER_STATUS_MAP = {
+ "0": "未付款",
+ "1": "已付款",
+ "2": "已发货",
+ "3": "已签收",
+ "4": "已取消",
+ "5": "待提货",
+}
+
+const PRESENT_MAP = {
+ "0": "自己购买",
+ "1": "已赠送",
+ "2": "他人赠送"
+}
+
export default function OrderDetail() {
const bottomNavBarHeight = 80
+ const { router } = getCurrentInstance()
+ const id = router && router.params && router.params.id
+
+ const [orderDetail, setOrderDetail] = useState({})
+ const getOrderDetail = async (orderId) => {
+ const { data } = await getOrderInfoById({ orderId })
+ console.log("获取订单详情", data);
+ if (data && data.orderId) setOrderDetail(data)
+ }
+ useEffect(() => { getOrderDetail(id) }, [id])
return (
@@ -23,39 +52,66 @@ export default function OrderDetail() {
className="pb-1 box-border overflow-hidden box-border"
>
-
- 已赠送
- 该订单在2024年06月26日 15:37:00发起赠送,2024年06月26日 15:37:00被好友“悬崖上的人鱼姬”领取。
-
-
-
- 大鲨鱼 1855262222
- 这是一个地址
+ {
+ (orderDetail && orderDetail.orderId) ? <>
+
+ {ORDER_STATUS_MAP[orderDetail.orderStatus]}
+ 该订单在{orderDetail.orderExpectStart || '未知时间'}发起赠送,{orderDetail.orderExpectEnd || '未知时间'}被好友领取。
+
+
+ {
+ orderDetail.addressInfo ? <>
+
+
+ {orderDetail.addressInfo.contact} {orderDetail.addressInfo.phoneNumber}
+
+
+ {orderDetail.addressInfo.areaInfo}
+ {orderDetail.addressInfo.fullAddress}
+
+
+
+ > : null
+ }
+
-
-
-
-
- 认养一亩蟹计划2024季
-
- 1号蟹塘|已认养10只|自费购买
- ¥347.5
-
-
-
-
- 预计收获日期:
- 2024.09.01-2024.10.31
-
-
- 下单时间:
- 2024.06.09 12:00:08
-
-
-
+ {
+ Array.isArray(orderDetail.orderDetailList) ? <>
+ {
+ orderDetail.orderDetailList.map(item => (<>
+
+ {
+ item?.specs?.id ? <>
+ {item.specs.specsNumber}
+
+ {item.specs.specs}
+
+
+
+
+
+ 下单时间:
+ {dayjs(item.specs.createTime).format("YYYY-MM-DD HH:mm:ss")}
+
+
+ > : null
+ }
+
+ >))
+ }
+ > : null
+ }
+ > : null
+ }
-
+
赠送好友
diff --git a/src/pageMe/pickCard/index.tsx b/src/pageMe/pickCard/index.tsx
index 2194086..4e7330e 100644
--- a/src/pageMe/pickCard/index.tsx
+++ b/src/pageMe/pickCard/index.tsx
@@ -21,8 +21,8 @@ export default function PickCard() {
const [unuse, setUnUse] = useState(0)
const [used, setUsed] = useState(0)
const getTickPage = async () => {
- const userOpenId = Taro.getStorageSync("USER_OPEN_ID")
- const { data } = await tickPage({ openId: "111" })
+ const openId = Taro.getStorageSync("USER_OPEN_ID")
+ const { data } = await tickPage({ openId })
const { list } = data
if (Array.isArray(list)) {
setTickList(list)
diff --git a/src/pagesHome/home.tsx b/src/pagesHome/home.tsx
index c36059c..179a2a4 100644
--- a/src/pagesHome/home.tsx
+++ b/src/pagesHome/home.tsx
@@ -3,7 +3,9 @@ import { useEffect, useState } from "react";
import useStore from "../storage";
import { adoptionOrderPage, getPlan } from "../api/user";
import { APP_FULL_WIDTH, IMG_BASE_URL } from "../config";
+import Taro from "@tarojs/taro";
import './index.scss'
+import dayjs from "dayjs";
const homeBg = IMG_BASE_URL + '/pagesHome/homeBg.png'
const homeBigBg = IMG_BASE_URL + '/pagesHome/homeBigBg1.png'
@@ -41,6 +43,28 @@ export default function Home(props) {
}
}
+ const [myOrderList, setMyOrderList] = useState>([])
+ const getMyOrderList = async () => {
+ const openId = Taro.getStorageSync("USER_OPEN_ID")
+ const { data } = await adoptionOrderPage({
+ pageNo: 1,
+ pageSize: 100,
+ serialNumber: 'JHLS202407012565376',
+ openId
+ })
+ console.log("我的订单", data);
+
+ const { list } = data
+ if (Array.isArray(list)) {
+ setMyOrderList(list.filter(item => {
+ if (!item.expectEnd || !item.expectStart) return false
+ if (item.status === '1' || item.status === '2') return true;
+ return false
+ }))
+ }
+ }
+ useEffect(() => { getMyOrderList() }, [])
+
const setAdoptionPlan = useStore((store:any) => store.setAdoptionPlan)
const getAdoptionPlan = async () => {
const { data } = await getPlan({ serialNumber: 'JHLS202407012565376' })
@@ -53,50 +77,6 @@ export default function Home(props) {
}, [])
return (
-
-
- 我的大闸蟹
-
-
-
-
-
- 我的认养
- 10只
- 1亩
-
-
- 预计收货日期
- 2024.09.10-2024.10.10
- 2024.09.10-2024.10.10
-
-
-
-
-
-
-
-
-
- 蟹苗期
- 豆蟹期
- 扣蟹期
- 黄蟹期
- 成蟹期
-
-
-
- 赠送好友
- onAdoption()}
- >继续认养
-
-
-
-
-
-
- onAdoption()} className="!py-[27px] primary-btn w-[90%] ml-[5%] shadow-xl">我要认养
+ {
+ myOrderList.length > 0 ?
+
+ 我的大闸蟹
+
+
+
+
+
+ 我的认养
+ {
+ myOrderList.map(item => (
+ {item.productAmount} {item.orderType === '0' ? '只' : '亩'}
+ ))
+ }
+
+
+ 预计收货日期
+ {
+ myOrderList.map(item => (
+
+ {dayjs(item.expectStart).format("YYYY-MM-DD")}
+ --
+ {dayjs(item.expectEnd).format("YYYY-MM-DD")}
+
+ ))
+ }
+
+
+
+
+
+
+
+
+
+ 蟹苗期
+ 豆蟹期
+ 扣蟹期
+ 黄蟹期
+ 成蟹期
+
+
+
+ {
+ Taro.navigateTo({ url: '/pageMe/myOrder/index' })
+ }}>赠送好友
+ onAdoption()}
+ >继续认养
+
+
+ : <>
+
+
+
+ onAdoption()} className="!py-[27px] primary-btn w-[90%] ml-[5%] shadow-xl">我要认养
+ >
+ }
: activedTab === 'monitor'
- ? :
+ ? setActivedTab('adoption')} /> :
}
{
)
}
-export default function Monitor() {
+export default function Monitor({ onAdoption }) {
const userAvatar = useStore((store:any) => store.userAvatar)
const userName = useStore((store:any) => store.userName)
const plotList = useStore((store:any) => store.plotList)
@@ -242,7 +242,7 @@ export default function Monitor() {
{year}.{month}
- 本季认养:3亩
+ 本季认养:3亩
@@ -251,21 +251,26 @@ export default function Monitor() {
{
productList.length > 0 ? productList.map(item => (
{item.specs}共{item.servingAmount}只,共{item.productAmount}份
- )) :
+ )) : 0
}
-
- 预计收获日期:
-
- {
- adoptionPlan.id ?
- {dayjs(adoptionPlan.receivingStart).format('YYYY-MM-DD')}-
- {dayjs(adoptionPlan.receivingEnd).format('YYYY-MM-DD')}
- : '-------------'
- }
+
+
+ 预计收获日期:
+
+ {
+ adoptionPlan.id ?
+ {dayjs(adoptionPlan.receivingStart).format('YYYY-MM-DD')}-
+ {dayjs(adoptionPlan.receivingEnd).format('YYYY-MM-DD')}
+ : '暂未认养'
+ }
+
+ 0 ? 'hidden' : 'visible' }} onClick={() => {
+ onAdoption()
+ }}>去认养
-
-
-
- 2024季
-
-
-
-
-
- 24
- 2024.06
-
-
- 当前大闸蟹状态
- 蚤状幼体期
-
- {shareComponent()}
-
-
-
-
-
-
-
- 本季认养
-
- 3亩
-
-
-
- 预计产量
-
- 3两母蟹+4两公蟹25份,每份8只;
- 3.5两母蟹+4.5两公蟹16份,每份8只;
- 4两母蟹+5两公蟹12份,每份8只;
- 4.5两母蟹+5.5两公蟹9份,每份8只;
-
-
-
- 预计收获日期
-
- 2024.09.01-2024.10.01
-
-
-
)
}
\ No newline at end of file
diff --git a/src/userInfo/address/index.tsx b/src/userInfo/address/index.tsx
index 6e508bc..6c9e231 100644
--- a/src/userInfo/address/index.tsx
+++ b/src/userInfo/address/index.tsx
@@ -3,12 +3,13 @@ import HeaderNation from "../../components/HeaderNation";
import OuterFrame from "../../components/OuterFrame";
import { View, ScrollView, Image } from "@tarojs/components";
import { APP_FULL_HEIGHT, IMG_BASE_URL } from "../../config";
-import noData from './assets/noData.png'
-import { useEffect, useState } from "react";
+// import noData from './assets/noData.png'
+import { useState } from "react";
import Taro, { getCurrentInstance, useDidShow } from "@tarojs/taro";
import { addressCreate, addressPage, updateAddress } from "../../api/me";
const arrow = IMG_BASE_URL + 'arrow.png'
+const noData = IMG_BASE_URL + 'noData.png'
export default function Address() {
const bottomNavBarHeight = 80
@@ -17,7 +18,7 @@ export default function Address() {
const NoData = () => {
return (
-
+
暂无收货地址
)
@@ -106,41 +107,35 @@ export default function Address() {
style={{ height: bottomNavBarHeight + 'px' }}
className="bg-[#f5f5f5] p-2 flex items-start pt-3 justify-evenly w-full"
>
- {
- !orderId ? <>
- {
- Taro.chooseAddress({
- success: async (e) => {
- console.log("E", e);
- const userOpenId = Taro.getStorageSync("USER_OPEN_ID")
- const { data, code } = await addressCreate({
- openId: userOpenId,
- contact: e.userName,
- phoneNumber: e.telNumber,
- areaInfo: e.provinceName + '/' + e.cityName + '/' + e.countyName,
- fullAddress: e.detailInfo,
- zipCode: e.postalCode,
- isDefault: '1',
- remark: "",
- userId: "",
- deptId: "",
- tenant: "158"
- })
- if (code === 0) getAddressList()
- else Taro.showToast({
- title: '保存失败!',
- icon: 'error',
- duration: 1400
- })
- }
+ {
+ Taro.chooseAddress({
+ success: async (e) => {
+ const userOpenId = Taro.getStorageSync("USER_OPEN_ID")
+ const { data, code } = await addressCreate({
+ openId: userOpenId,
+ contact: e.userName,
+ phoneNumber: e.telNumber,
+ areaInfo: e.provinceName + '/' + e.cityName + '/' + e.countyName,
+ fullAddress: e.detailInfo,
+ zipCode: e.postalCode,
+ isDefault: '1',
+ remark: "",
+ userId: "",
+ deptId: "",
+ tenant: "158"
})
- }}>导入微信地址
- {
- Taro.navigateTo({ url: '/userInfo/addAddress/index' })
- }}>新增收货地址
- > : <>
- >
- }
+ if (code === 0) getAddressList()
+ else Taro.showToast({
+ title: '保存失败!',
+ icon: 'error',
+ duration: 1400
+ })
+ }
+ })
+ }}>导入微信地址
+ {
+ Taro.navigateTo({ url: '/userInfo/addAddress/index' })
+ }}>新增收货地址
)