diff --git a/src/app.config.ts b/src/app.config.ts index 977a1ad..04fe247 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -1,9 +1,8 @@ export default defineAppConfig({ pages: [ 'pages/index/index', - 'pages/order/order', 'pages/cart/cart', - // 'pages/find/find', + 'pages/find/find', 'pages/user/user' ], "subpackages": [ @@ -28,6 +27,7 @@ export default defineAppConfig({ { "root": "user", "pages": [ + "order/order", "company/company", "profile/profile", "setting/setting", @@ -82,17 +82,17 @@ export default defineAppConfig({ selectedIconPath: "assets/tabbar/home-active.png", text: "首页", }, - // { - // pagePath: "pages/find/find", - // iconPath: "assets/tabbar/find.png", - // selectedIconPath: "assets/tabbar/find-active.png", - // text: "发现", - // }, { - pagePath: "pages/order/order", - iconPath: "assets/tabbar/order.png", - selectedIconPath: "assets/tabbar/order-active.png", - text: "订单", + pagePath: "pages/find/find", + iconPath: "assets/tabbar/find.png", + selectedIconPath: "assets/tabbar/find-active.png", + text: "发现", + }, + { + pagePath: "pages/cart/cart", + iconPath: "assets/tabbar/cart.png", + selectedIconPath: "assets/tabbar/cart-active.png", + text: "购物车", }, { pagePath: "pages/user/user", diff --git a/src/assets/tabbar/cart-active.png b/src/assets/tabbar/cart-active.png new file mode 100644 index 0000000..eaafc5e Binary files /dev/null and b/src/assets/tabbar/cart-active.png differ diff --git a/src/assets/tabbar/cart.png b/src/assets/tabbar/cart.png new file mode 100644 index 0000000..ce9dbbd Binary files /dev/null and b/src/assets/tabbar/cart.png differ diff --git a/src/assets/tabbar/order-active.png b/src/assets/tabbar/order-active.png deleted file mode 100644 index 1e533b8..0000000 Binary files a/src/assets/tabbar/order-active.png and /dev/null differ diff --git a/src/assets/tabbar/order.png b/src/assets/tabbar/order.png deleted file mode 100644 index 082dd34..0000000 Binary files a/src/assets/tabbar/order.png and /dev/null differ diff --git a/src/assets/tabbar/store-active.png b/src/assets/tabbar/store-active.png deleted file mode 100644 index 86948d8..0000000 Binary files a/src/assets/tabbar/store-active.png and /dev/null differ diff --git a/src/assets/tabbar/store.png b/src/assets/tabbar/store.png deleted file mode 100644 index 0c5ae1c..0000000 Binary files a/src/assets/tabbar/store.png and /dev/null differ diff --git a/src/pages/article/article.config.ts b/src/pages/article/article.config.ts deleted file mode 100644 index f4b4cdf..0000000 --- a/src/pages/article/article.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '学习' -}) diff --git a/src/pages/article/article.tsx b/src/pages/article/article.tsx deleted file mode 100644 index 913112e..0000000 --- a/src/pages/article/article.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import {useEffect, useState} from "react"; -import {ArrowRight} from '@nutui/icons-react-taro' -import {pageCmsArticle} from "@/api/cms/cmsArticle"; -import {CmsArticle} from "@/api/cms/cmsArticle/model"; -import Taro from '@tarojs/taro' - -/** - * 文章终极列表 - * @constructor - */ -const Article = () => { - // const {params} = useRouter(); - // const [categoryId, setCategoryId] = useState(3494) - const [list, setList] = useState([]) - - const reload = () => { - // if (params.id) { - // setCategoryId(Number(params.id)) - // } - pageCmsArticle({}).then(res => { - if (res?.list) { - setList(res?.list) - } - }) - } - - useEffect(() => { - reload() - }, []) - - return ( -
-
-
- { - list.map((item, index) => { - return ( -
Taro.navigateTo({url: `/cms/help?id=${item.articleId}`}) }> -
{item.title}
- -
- ) - }) - } -
-
-
- ) -} -export default Article diff --git a/src/pages/cart/cart.tsx b/src/pages/cart/cart.tsx index eccd816..0ee023d 100644 --- a/src/pages/cart/cart.tsx +++ b/src/pages/cart/cart.tsx @@ -7,7 +7,8 @@ import { InputNumber, Button, Empty, - Divider + Divider, + ConfigProvider } from '@nutui/nutui-react-taro'; import {ArrowLeft, Del, Shopping} from '@nutui/icons-react-taro'; import {View} from '@tarojs/components'; @@ -26,6 +27,16 @@ function Cart() { clearCart } = useCart(); + // InputNumber 主题配置 + const customTheme = { + nutuiInputnumberButtonWidth: '28px', + nutuiInputnumberButtonHeight: '28px', + nutuiInputnumberInputWidth: '40px', + nutuiInputnumberInputHeight: '28px', + nutuiInputnumberInputBorderRadius: '4px', + nutuiInputnumberButtonBorderRadius: '4px', + } + useShareTimeline(() => { return { title: '购物车 - 网宿小店' @@ -138,11 +149,52 @@ function Cart() { } }, [selectedItems, cartItems]); + if (cartItems.length === 0) { + return ( + <> + Taro.navigateBack()}/>} + right={ + cartItems.length > 0 && ( + + ) + } + > + 购物车({cartCount}) + + Taro.switchTab({ url: '/pages/index/index' })} + /> + + ) + } + return ( <> - + className="fixed z-10 top-0 w-full"> {item.price} - + handleQuantityChange(item.goodsId, Number(value))} - className="w-24" /> - handleRemoveItem(item.goodsId)}/> - + + handleRemoveItem(item.goodsId)}/> diff --git a/src/pages/find/find.tsx b/src/pages/find/find.tsx index 05518fc..4d6f16c 100644 --- a/src/pages/find/find.tsx +++ b/src/pages/find/find.tsx @@ -2,7 +2,9 @@ import {useEffect, useState} from "react"; import Taro from '@tarojs/taro'; import {pageCmsArticle} from "@/api/cms/cmsArticle"; import {CmsArticle} from "@/api/cms/cmsArticle/model"; -import {NavBar} from '@nutui/nutui-react-taro' +import {NavBar, Cell} from '@nutui/nutui-react-taro'; +import {Text} from '@tarojs/components'; +import {ArrowRight, ImageRectangle, Coupon, Follow} from '@nutui/icons-react-taro' import './find.scss' /** @@ -17,7 +19,7 @@ const Find = () => { const reload = async () => { setLoading(true) const article = await pageCmsArticle({categoryId: 4289, status: 0}) - if(article){ + if (article) { setList(article?.list) setLoading(false) } @@ -38,27 +40,33 @@ const Find = () => { <> {loading && (
暂无数据
)} { }} - left={ - <> -
- -
- {/**/} - {/*
*/} - {/* */} - {/*
筛选
*/} - {/*
*/} - - } > 发现
{list && ( <> + + + 好物推荐 + + } extra={}/> + + + 权益中心 + + } extra={}/> + + + 我的收藏 + + } extra={}/> )} diff --git a/src/pages/user/components/OrderIcon.tsx b/src/pages/user/components/OrderIcon.tsx deleted file mode 100644 index 9cc9a61..0000000 --- a/src/pages/user/components/OrderIcon.tsx +++ /dev/null @@ -1,211 +0,0 @@ -import {useEffect, useState} from 'react' -import {navigateTo} from '@tarojs/taro' -import Taro from '@tarojs/taro' -import {Button} from '@tarojs/components'; -import {Image} from '@nutui/nutui-react-taro' -import {getUserInfo, getWxOpenId} from "@/api/layout"; -import {TenantId} from "@/config/app"; -import {User} from "@/api/system/user/model"; -// import News from "./News"; -import {myPageBszxBm} from "@/api/bszx/bszxBm"; -import {listCmsNavigation} from "@/api/cms/cmsNavigation"; - -const OrderIcon = () => { - - const [loading, setLoading] = useState(true) - const [isLogin, setIsLogin] = useState(false) - const [userInfo, setUserInfo] = useState() - const [bmLogs, setBmLogs] = useState() - const [navItems, setNavItems] = useState([]) - - /* 获取用户手机号 */ - const handleGetPhoneNumber = ({detail}) => { - const {code, encryptedData, iv} = detail - Taro.login({ - success: function () { - if (code) { - Taro.request({ - url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone', - method: 'POST', - data: { - code, - encryptedData, - iv, - notVerifyPhone: true, - refereeId: 0, - sceneType: 'save_referee', - tenantId: TenantId - }, - header: { - 'content-type': 'application/json', - TenantId - }, - success: function (res) { - Taro.setStorageSync('access_token', res.data.data.access_token) - Taro.setStorageSync('UserId', res.data.data.user.userId) - setUserInfo(res.data.data.user) - Taro.setStorageSync('Phone', res.data.data.user.phone) - setIsLogin(true) - Taro.showToast({ - title: '登录成功', - icon: 'success' - }); - } - }) - } else { - console.log('登录失败!') - } - } - }) - } - - const onLogin = (item: any, index: number) => { - if(!isLogin){ - return navigateTo({url: `/pages/category/category?id=${item.navigationId}`}) - }else { - // 报名链接 - if(index == 0){ - console.log(bmLogs,'bmLogs') - if(bmLogs && bmLogs.length > 0){ - return navigateTo({url: `/bszx/bm-cert/bm-cert?id=${bmLogs[0].id}`}) - }else { - navigateTo({url: `/user/profile/profile`}) - } - } - // 善款明细 - if(item.navigationId == 4119){ - return navigateTo({url: `/bszx/pay-record/pay-record`}) - } - return navigateTo({url: `/pages/category/category?id=${item.navigationId}`}) - } - } - - const reload = () => { - // 读取栏目 - listCmsNavigation({parentId: 2828,hide: 0}).then(res => { - console.log(res,'9999') - setNavItems(res); - }) - Taro.getUserInfo({ - success: (res) => { - const avatar = res.userInfo.avatarUrl; - setUserInfo({ - avatar, - nickname: res.userInfo.nickName, - sexName: res.userInfo.gender == 1 ? '男' : '女' - }) - getUserInfo().then((data) => { - if (data) { - setUserInfo(data) - setIsLogin(true); - console.log(userInfo, 'userInfo...') - Taro.setStorageSync('UserId', data.userId) - // 获取openId - if (!data.openid) { - Taro.login({ - success: (res) => { - getWxOpenId({code: res.code}).then(() => { - }) - } - }) - } - } - }).catch(() => { - console.log('未登录') - }); - } - }); - // 报名日志 - myPageBszxBm({limit: 1}).then(res => { - if (res.list) { - setBmLogs(res.list); - } - }) - setLoading(false); - }; - - const showAuthModal = () => { - Taro.showModal({ - title: '授权提示', - content: '需要获取您的用户信息', - confirmText: '去授权', - cancelText: '取消', - success: (res) => { - if (res.confirm) { - // 用户点击确认,打开授权设置页面 - openSetting(); - } - } - }); - }; - - const openSetting = () => { - // Taro.openSetting:调起客户端小程序设置界面,返回用户设置的操作结果。设置界面只会出现小程序已经向用户请求过的权限。 - Taro.openSetting({ - success: (res) => { - if (res.authSetting['scope.userInfo']) { - // 用户授权成功,可以获取用户信息 - reload(); - } else { - // 用户拒绝授权,提示授权失败 - Taro.showToast({ - title: '授权失败', - icon: 'none' - }); - } - } - }); - }; - - useEffect(() => { - Taro.getSetting({ - success: (res) => { - if (res.authSetting['scope.userInfo']) { - // 用户已经授权过,可以直接获取用户信息 - console.log('用户已经授权过,可以直接获取用户信息') - reload(); - } else { - // 用户未授权,需要弹出授权窗口 - console.log('用户未授权,需要弹出授权窗口') - showAuthModal(); - } - } - }); - reload(); - }, []) - - return ( -
-
-
- { - navItems.map((item, index) => ( -
- { - isLogin && !loading ? -
{ - onLogin(item, index) - }}> - -
{item?.title}
-
- : - - } -
- )) - } -
-
- {/*倡议书*/} - {/**/} -
- ) -} -export default OrderIcon diff --git a/src/pages/user/components/UserCard.tsx b/src/pages/user/components/UserCard.tsx index 34b2ac7..2e3fedd 100644 --- a/src/pages/user/components/UserCard.tsx +++ b/src/pages/user/components/UserCard.tsx @@ -176,7 +176,7 @@ function UserCard() { } return ( -
+
@@ -200,7 +200,7 @@ function UserCard() { ) }
-
{IsLogin ? userInfo?.mobile : '请点击头像登录'}
+
{IsLogin ? userInfo?.nickname : '请点击头像登录'}
{IsLogin ? (
@@ -215,7 +215,7 @@ function UserCard() { {'个人资料'}
-
+
navTo('/user/wallet/wallet', true)}> 余额 ¥ {userInfo?.balance || '0.00'} diff --git a/src/pages/user/components/UserOrder.tsx b/src/pages/user/components/UserOrder.tsx new file mode 100644 index 0000000..fafba09 --- /dev/null +++ b/src/pages/user/components/UserOrder.tsx @@ -0,0 +1,69 @@ +import {useEffect} from "react"; +import navTo from "@/utils/common"; +import {View, Text} from '@tarojs/components'; +import {ArrowRight, Wallet, Comment, Transit, Refund, Package} from '@nutui/icons-react-taro'; + +function UserOrder() { + + const reload = () => { + + }; + + useEffect(() => { + reload() + }, []); + + return ( + <> + + + + 我的订单 + navTo('/user/order/order', true)}> + 全部订单 + + + + + navTo('/user/order/order?statusFilter=0', true)}> + + 待付款 + + navTo('/user/order/order?statusFilter=1', true)}> + + 待发货 + + navTo('/user/order/order?statusFilter=3', true)}> + + 待收货 + + navTo('/user/order/order?statusFilter=5', true)}> + + 待评价 + + navTo('/user/order/order?statusFilter=7', true)}> + + 退货/售后 + + + + + + + ) +} + +export default UserOrder; diff --git a/src/pages/user/user.tsx b/src/pages/user/user.tsx index 30d8672..a18bad0 100644 --- a/src/pages/user/user.tsx +++ b/src/pages/user/user.tsx @@ -1,5 +1,6 @@ import {useEffect} from 'react' import UserCard from "./components/UserCard"; +import UserOrder from "./components/UserOrder"; import UserCell from "./components/UserCell"; import './user.scss' import UserFooter from "./components/UserFooter"; @@ -13,6 +14,7 @@ function User() { background: 'linear-gradient(to bottom, #e9fff2, #f9fafb)' }}> +
diff --git a/src/shop/goodsDetail/index.tsx b/src/shop/goodsDetail/index.tsx index b5f4f35..5f07907 100644 --- a/src/shop/goodsDetail/index.tsx +++ b/src/shop/goodsDetail/index.tsx @@ -133,7 +133,7 @@ const GoodsDetail = () => { }); // 加载商品规格 - listShopGoodsSpec({ goodsId: Number(goodsId) } as any) + listShopGoodsSpec({goodsId: Number(goodsId)} as any) .then((data) => { setSpecs(data || []); }) @@ -142,7 +142,7 @@ const GoodsDetail = () => { }); // 加载商品SKU - listShopGoodsSku({ goodsId: Number(goodsId) } as any) + listShopGoodsSku({goodsId: Number(goodsId)} as any) .then((data) => { setSkus(data || []); }) @@ -217,7 +217,7 @@ const GoodsDetail = () => { top: "50px", right: "110px", }} - onClick={() => navTo(`/pages/cart/cart`, true)}> + onClick={() => Taro.switchTab({url: `/pages/cart/cart`})}>
diff --git a/src/shop/orderDetail/index.tsx b/src/shop/orderDetail/index.tsx index 391f946..379a8c1 100644 --- a/src/shop/orderDetail/index.tsx +++ b/src/shop/orderDetail/index.tsx @@ -24,7 +24,7 @@ const OrderDetail = () => { if (order.orderStatus === 7) return '客户端申请退款'; // 检查支付状态 (payStatus为boolean类型) - if (!order.payStatus || order.payStatus === false) return '待付款'; + if (!order.payStatus) return '待付款'; // 已付款后检查发货状态 if (order.deliveryStatus === 10) return '待发货'; @@ -109,8 +109,8 @@ const OrderDetail = () => {
- {order.payStatus === 0 && } - {order.payStatus === 0 && } + {!order.payStatus && } + {!order.payStatus && } {order.orderStatus === 1 && } {order.deliveryStatus === 20 && } diff --git a/src/pages/order/components/OrderList.tsx b/src/user/order/components/OrderList.tsx similarity index 100% rename from src/pages/order/components/OrderList.tsx rename to src/user/order/components/OrderList.tsx diff --git a/src/pages/order/components/OrderSearch.scss b/src/user/order/components/OrderSearch.scss similarity index 100% rename from src/pages/order/components/OrderSearch.scss rename to src/user/order/components/OrderSearch.scss diff --git a/src/pages/order/components/OrderSearch.tsx b/src/user/order/components/OrderSearch.tsx similarity index 100% rename from src/pages/order/components/OrderSearch.tsx rename to src/user/order/components/OrderSearch.tsx diff --git a/src/pages/order/order.config.ts b/src/user/order/order.config.ts similarity index 100% rename from src/pages/order/order.config.ts rename to src/user/order/order.config.ts diff --git a/src/pages/order/order.scss b/src/user/order/order.scss similarity index 100% rename from src/pages/order/order.scss rename to src/user/order/order.scss diff --git a/src/pages/order/order.tsx b/src/user/order/order.tsx similarity index 71% rename from src/pages/order/order.tsx rename to src/user/order/order.tsx index 1e7a112..2860672 100644 --- a/src/pages/order/order.tsx +++ b/src/user/order/order.tsx @@ -1,6 +1,6 @@ import {useState} from "react"; import Taro, {useDidShow} from '@tarojs/taro' -import {NavBar, Space, Empty, Button, ConfigProvider, Input} from '@nutui/nutui-react-taro' +import {Space, Empty, Button, ConfigProvider, Input} from '@nutui/nutui-react-taro' import {Search, Filter} from '@nutui/icons-react-taro' import { View } from '@tarojs/components'; import OrderList from "./components/OrderList"; @@ -10,7 +10,6 @@ import {pageShopOrder} from "@/api/shop/shopOrder"; import './order.scss' function Order() { - const [statusBarHeight, setStatusBarHeight] = useState() const [list, setList] = useState([]) const [searchParams, setSearchParams] = useState({}) const [showSearch, setShowSearch] = useState(false) @@ -40,55 +39,43 @@ function Order() { } useDidShow(() => { - Taro.getSystemInfo({ - success: (res) => { - setStatusBarHeight(res.statusBarHeight) - }, - }) + // 设置导航栏标题 + Taro.setNavigationBarTitle({ + title: '我的订单' + }); + + Taro.setNavigationBarColor({ + backgroundColor: '#ffffff', + frontColor: '#000000', + }); + reload().then() }); return ( - <> - - -
- - setShowSearch(!showSearch)} - /> - setShowSearch(!showSearch)} - /> - -
- - } - > - 我的订单 -
+ + {/* 搜索和筛选工具栏 */} + + + setShowSearch(!showSearch)} + /> + setShowSearch(!showSearch)} + /> + + + 共{list.length}个订单 + + {/* 搜索组件 */} {showSearch && ( - + ) } - + ); }