From c90b69140cef63f2e9a5141ee16c295bdc3f7849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Sun, 1 Mar 2026 13:37:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(find):=20=E5=B0=86=E5=8F=91=E7=8E=B0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84=E4=B8=BA=E7=BD=91=E7=82=B9?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改页面标题为"网点"并设置导航栏样式 - 替换原有文章列表功能为网点搜索和展示功能 - 添加搜索框组件支持城市名称查询 - 实现网点卡片布局显示城市、地址、电话等信息 - 集成模拟数据展示网点列表 - 添加距离计算和导航功能 - 优化页面样式和用户体验 --- src/pages/find/find.config.ts | 5 +- src/pages/find/find.scss | 144 +++++++++++++++++++++++++- src/pages/find/find.tsx | 188 +++++++++++++++++++++------------- 3 files changed, 263 insertions(+), 74 deletions(-) diff --git a/src/pages/find/find.config.ts b/src/pages/find/find.config.ts index 24c0aaf..01d07dd 100644 --- a/src/pages/find/find.config.ts +++ b/src/pages/find/find.config.ts @@ -1,4 +1,5 @@ export default definePageConfig({ - navigationBarTitleText: '发现', - navigationStyle: 'custom', + navigationBarTitleText: '网点', + navigationBarTextStyle: 'black', + navigationBarBackgroundColor: '#ffffff' }) diff --git a/src/pages/find/find.scss b/src/pages/find/find.scss index 1c8a071..f9171b6 100644 --- a/src/pages/find/find.scss +++ b/src/pages/find/find.scss @@ -1,4 +1,144 @@ page { - background: linear-gradient(to bottom, #e9fff2, #f9fafb); - background-size: 100%; + background: #f7f7f7; +} + +.sitePage { + min-height: 100vh; + background: linear-gradient(180deg, #fde8ea 0%, #f7f7f7 320rpx, #f7f7f7 100%); + padding-bottom: calc(40rpx + env(safe-area-inset-bottom)); +} + +.searchArea { + padding: 22rpx 24rpx 18rpx; +} + +.searchBox { + height: 86rpx; + background: #fff; + border: 2rpx solid #b51616; + border-radius: 12rpx; + display: flex; + align-items: center; + overflow: hidden; +} + +.searchInput { + flex: 1; + height: 86rpx; + padding: 0 20rpx; + font-size: 30rpx; + color: #222; +} + +.searchPlaceholder { + color: #9e9e9e; + font-size: 30rpx; +} + +.searchIconWrap { + width: 88rpx; + height: 86rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.siteList { + padding: 0 24rpx 24rpx; +} + +.siteCard { + background: #fff; + border-radius: 18rpx; + padding: 22rpx 22rpx 18rpx; + margin-top: 18rpx; + box-shadow: 0 10rpx 24rpx rgba(0, 0, 0, 0.04); +} + +.siteCardInner { + display: flex; + align-items: stretch; +} + +.siteInfo { + flex: 1; + padding-right: 10rpx; +} + +.siteRow { + display: flex; + align-items: flex-start; + padding: 10rpx 0; +} + +.siteRowTop { + padding-top: 2rpx; + padding-bottom: 14rpx; +} + +.siteLabel { + width: 170rpx; + flex: 0 0 170rpx; + color: #9a9a9a; + font-size: 30rpx; + line-height: 1.6; +} + +.siteValue { + flex: 1; + color: #222; + font-size: 30rpx; + line-height: 1.6; + word-break: break-all; +} + +.siteValueStrong { + font-weight: 700; +} + +.siteDivider { + height: 2rpx; + background: #ededed; +} + +.siteSide { + width: 160rpx; + flex: 0 0 160rpx; + display: flex; + flex-direction: column; + align-items: flex-end; + justify-content: center; + padding-left: 12rpx; +} + +.navArrow { + width: 34rpx; + height: 34rpx; + border-top: 8rpx solid #e60012; + border-right: 8rpx solid #e60012; + border-radius: 4rpx; + transform: rotate(45deg); + margin-right: 8rpx; +} + +.distanceText { + margin-top: 18rpx; + font-size: 28rpx; + color: #e60012; + font-weight: 700; +} + +.emptyWrap { + padding: 40rpx 0; + display: flex; + justify-content: center; +} + +.emptyText { + font-size: 28rpx; + color: #9a9a9a; +} + +.bottomSafe { + height: 20rpx; } diff --git a/src/pages/find/find.tsx b/src/pages/find/find.tsx index b5f8b66..8d9184f 100644 --- a/src/pages/find/find.tsx +++ b/src/pages/find/find.tsx @@ -1,82 +1,130 @@ -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, Cell} from '@nutui/nutui-react-taro'; -import {Text} from '@tarojs/components'; -import {ArrowRight, ImageRectangle, Coupon, Follow} from '@nutui/icons-react-taro' +import {useMemo, useState} from 'react' +import Taro from '@tarojs/taro' +import {Input, Text, View} from '@tarojs/components' +import {Search} from '@nutui/icons-react-taro' import './find.scss' -import navTo from "@/utils/common"; -/** - * 文章终极列表 - * @constructor - */ +type SiteItem = { + id: string + cityName: string + address: string + phone: string + contact: string + distanceMeter: number +} + +const MOCK_SITES: SiteItem[] = [ + { + id: '1', + cityName: '北京朝阳区网点', + address: '地安门西大街(南门)', + phone: '15878179339', + contact: '刘先生', + distanceMeter: 100 + }, + { + id: '2', + cityName: '兰州某某区网点', + address: '地安门西大街(南门)', + phone: '15878179339', + contact: '黄先生', + distanceMeter: 150 + }, + { + id: '3', + cityName: '合肥市某某区网点', + address: '地安门西大街(南门)', + phone: '15878179339', + contact: '黄先生', + distanceMeter: 250 + }, + { + id: '4', + cityName: '南宁市某某区网点', + address: '广西壮族自治区南宁市良庆区五象新区五象大道403号富雅国际金融中心G1栋高层6006', + phone: '15878179339', + contact: '柳先生', + distanceMeter: 1250 + } +] + const Find = () => { - const [statusBarHeight, setStatusBarHeight] = useState() - const [loading, setLoading] = useState(false) - const [list, setList] = useState() + const [keyword, setKeyword] = useState('') - const reload = async () => { - setLoading(true) - const article = await pageCmsArticle({categoryId: 4289, status: 0}) - if (article) { - setList(article?.list) - setLoading(false) - } + const filtered = useMemo(() => { + const key = keyword.trim() + if (!key) return MOCK_SITES + return MOCK_SITES.filter((it) => it.cityName.includes(key)) + }, [keyword]) + + const onNavigate = (item: SiteItem) => { + Taro.showToast({title: `导航至:${item.cityName}(示例)`, icon: 'none'}) } - useEffect(() => { - Taro.getSystemInfo({ - success: (res) => { - setStatusBarHeight(res.statusBarHeight) - }, - }) - reload().then(() => { - console.log('初始化完成') - }) - }, []) + const onSearch = () => { + Taro.showToast({title: '查询(示例)', icon: 'none'}) + } return ( - <> - {loading && (
暂无数据
)} - { - }} - > - 发现 - - {list && ( - <> - - - 好物推荐 - - } extra={}/> - - - 权益中心 - - } - extra={} - onClick={() => { - navTo('/shop/shopArticle/index', true) - }} + + + + setKeyword(e.detail.value)} + onConfirm={onSearch} /> - - - 我的收藏 - - } extra={}/> - - )} - + + + + + + + + {filtered.map((item) => ( + + + + + 城市名称: + {item.cityName} + + + + 网点地址: + {item.address} + + + 联系电话: + {item.phone} + + + 联系人: + {item.contact} + + + + onNavigate(item)}> + + 距离{item.distanceMeter}米 + + + + ))} + + {filtered.length === 0 && ( + + 暂无网点 + + )} + + + + ) } export default Find