index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <view class="home-page">
  3. <!-- 搜索栏 -->
  4. <view class="search-wrapper">
  5. <view class="location-box" @click="onLocationClick">
  6. <text class="location-text">昆明市</text>
  7. <uni-icons type="bottom" size="10" color="#fff"></uni-icons>
  8. </view>
  9. <view class="search-bar" @click="onSearchClick">
  10. <uni-icons type="search" size="16" color="#999"></uni-icons>
  11. <text class="search-placeholder">搜索宠物名/主人</text>
  12. </view>
  13. </view>
  14. <!-- 轮播图 -->
  15. <view class="banner-swipe-wrapper">
  16. <swiper class="my-swipe" :autoplay="true" :interval="3000" :circular="true" indicator-dots
  17. indicator-active-color="#ffffff" indicator-color="rgba(255,255,255,0.5)">
  18. <swiper-item v-for="(image, index) in bannerImages" :key="index">
  19. <image :src="image" class="swipe-img" mode="aspectFill"></image>
  20. </swiper-item>
  21. </swiper>
  22. </view>
  23. <!-- 系统通知栏 -->
  24. <view class="notice-section">
  25. <view class="notice-bar">
  26. <uni-icons type="sound" size="14" color="#ed6a0c"></uni-icons>
  27. <scroll-view scroll-x class="notice-scroll" :show-scrollbar="false">
  28. <text class="notice-text">【重要通知】尊敬的用户,由于近期接送需求激增,请各位宠主尽量提前24小时进行服务预约,感谢您的理解与配合!</text>
  29. </scroll-view>
  30. </view>
  31. </view>
  32. <!-- 服务分类卡片 -->
  33. <view class="service-grid">
  34. <!-- 左侧大块:宠物托运 -->
  35. <view class="grid-item item-transport-large" @click="goToDetail('托运')">
  36. <view class="text-info">
  37. <text class="grid-title">宠物托运</text>
  38. <text class="grid-desc">专车接送 · 全程监护</text>
  39. </view>
  40. <image src="/static/images/transport-3d.png" class="large-3d-icon" mode="aspectFit"></image>
  41. </view>
  42. <!-- 右侧两个小块 -->
  43. <view class="grid-right">
  44. <view class="grid-item item-wash-small" @click="goToDetail('洗护')">
  45. <view class="text-info">
  46. <text class="grid-title">宠物洗护</text>
  47. <text class="sub-text">深度清洁</text>
  48. </view>
  49. <image src="/static/images/wash-3d.png" class="small-3d-icon" mode="aspectFit"></image>
  50. </view>
  51. <view class="grid-item item-feed-small" @click="goToDetail('喂养')">
  52. <view class="text-info">
  53. <text class="grid-title">宠物喂养</text>
  54. <text class="sub-text">贴心陪伴</text>
  55. </view>
  56. <image src="/static/images/feed-3d.png" class="small-3d-icon" mode="aspectFit"></image>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 全部服务列表 -->
  61. <view class="section-header">
  62. <text class="section-title">全部服务</text>
  63. <view class="more-link" @click="goToServices">
  64. <text>查看全部</text>
  65. <uni-icons type="right" size="12" color="#999"></uni-icons>
  66. </view>
  67. </view>
  68. <view class="recommend-list">
  69. <view class="recommend-card" v-for="(item, index) in services" :key="index" @click="goToDetail(item.title)">
  70. <image :src="item.image" class="item-img" mode="aspectFill"></image>
  71. <view class="item-info">
  72. <view class="item-header">
  73. <text class="item-title">{{ item.title }}</text>
  74. <text class="booked">{{ item.booked }}</text>
  75. </view>
  76. <text class="item-desc">{{ item.desc }}</text>
  77. <view class="item-bottom">
  78. <text class="tag" v-for="tag in item.tags" :key="tag">{{ tag }}</text>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <custom-tabbar></custom-tabbar>
  84. </view>
  85. </template>
  86. <script setup>
  87. import { ref } from 'vue'
  88. import customTabbar from '@/components/custom-tabbar/index.vue'
  89. import mockData from '@/mock/index.json'
  90. const bannerImages = mockData.bannerImages
  91. const services = ref(mockData.services)
  92. const onLocationClick = () => {
  93. uni.showToast({ title: '城市选择功能即将上线', icon: 'none' })
  94. }
  95. const onSearchClick = () => {
  96. // 跳转搜索页(预留)
  97. }
  98. const goToServices = () => {
  99. uni.reLaunch({ url: '/pages/service/all/index' })
  100. }
  101. const goToDetail = (type) => {
  102. if (type === '托运') {
  103. uni.reLaunch({ url: '/pages/service/all/index' })
  104. return
  105. }
  106. uni.navigateTo({
  107. url: `/pages/service/detail/index?service=${type}`
  108. })
  109. }
  110. </script>
  111. <style lang="scss" scoped>
  112. .home-page {
  113. background-image: linear-gradient(to bottom, #f7ca3e 0%, #f7ca3e 440rpx, #f2f2f2 440rpx, #f2f2f2 100%);
  114. min-height: 100vh;
  115. padding-bottom: 120rpx;
  116. }
  117. .search-wrapper {
  118. padding: 24rpx 32rpx;
  119. padding-top: calc(var(--status-bar-height, 44px) + 20rpx);
  120. display: flex;
  121. align-items: center;
  122. gap: 16rpx;
  123. }
  124. .location-box {
  125. display: flex;
  126. align-items: center;
  127. gap: 6rpx;
  128. flex-shrink: 0;
  129. }
  130. .location-text {
  131. font-size: 28rpx;
  132. color: #fff;
  133. font-weight: bold;
  134. }
  135. .search-bar {
  136. flex: 1;
  137. display: flex;
  138. align-items: center;
  139. background: rgba(255, 255, 255, 0.85);
  140. border-radius: 40rpx;
  141. padding: 16rpx 24rpx;
  142. gap: 12rpx;
  143. }
  144. .search-placeholder {
  145. font-size: 26rpx;
  146. color: #999;
  147. }
  148. .banner-swipe-wrapper {
  149. padding: 0 32rpx 24rpx;
  150. }
  151. .my-swipe {
  152. border-radius: 32rpx;
  153. overflow: hidden;
  154. height: 320rpx;
  155. }
  156. .swipe-img {
  157. width: 100%;
  158. height: 320rpx;
  159. }
  160. .notice-section {
  161. padding: 0 32rpx 24rpx;
  162. }
  163. .notice-bar {
  164. display: flex;
  165. align-items: center;
  166. background: #fffbe8;
  167. border-radius: 16rpx;
  168. padding: 12rpx 20rpx;
  169. gap: 12rpx;
  170. height: 64rpx;
  171. overflow: hidden;
  172. }
  173. .notice-scroll {
  174. flex: 1;
  175. white-space: nowrap;
  176. }
  177. .notice-text {
  178. font-size: 24rpx;
  179. color: #ed6a0c;
  180. }
  181. .service-grid {
  182. padding: 0 32rpx;
  183. display: flex;
  184. gap: 24rpx;
  185. margin-bottom: 32rpx;
  186. }
  187. .grid-item {
  188. border-radius: 24rpx;
  189. padding: 32rpx;
  190. position: relative;
  191. overflow: hidden;
  192. }
  193. .item-transport-large {
  194. flex: 1.2;
  195. background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
  196. height: 360rpx;
  197. }
  198. .grid-right {
  199. flex: 1;
  200. display: flex;
  201. flex-direction: column;
  202. gap: 24rpx;
  203. }
  204. .item-wash-small {
  205. background: linear-gradient(135deg, #55efc4 0%, #00b894 100%);
  206. height: 168rpx;
  207. }
  208. .item-feed-small {
  209. background: linear-gradient(135deg, #fab1a0 0%, #e17055 100%);
  210. height: 168rpx;
  211. }
  212. .grid-title {
  213. display: block;
  214. font-size: 32rpx;
  215. color: #fff;
  216. font-weight: 800;
  217. }
  218. .grid-desc {
  219. display: block;
  220. margin-top: 8rpx;
  221. font-size: 22rpx;
  222. color: rgba(255, 255, 255, 0.9);
  223. }
  224. .sub-text {
  225. display: block;
  226. font-size: 20rpx;
  227. color: rgba(255, 255, 255, 0.8);
  228. margin-top: 4rpx;
  229. }
  230. .large-3d-icon {
  231. position: absolute;
  232. right: -10rpx;
  233. bottom: -10rpx;
  234. width: 260rpx;
  235. height: 260rpx;
  236. }
  237. .small-3d-icon {
  238. position: absolute;
  239. right: -10rpx;
  240. bottom: -10rpx;
  241. width: 150rpx;
  242. height: 150rpx;
  243. }
  244. .section-header {
  245. padding: 50rpx 32rpx 20rpx;
  246. display: flex;
  247. justify-content: space-between;
  248. align-items: center;
  249. }
  250. .section-title {
  251. font-size: 36rpx;
  252. font-weight: bold;
  253. color: #333;
  254. }
  255. .more-link {
  256. display: flex;
  257. align-items: center;
  258. gap: 4rpx;
  259. font-size: 26rpx;
  260. color: #999;
  261. }
  262. .recommend-list {
  263. padding: 20rpx 32rpx 40rpx;
  264. }
  265. .recommend-card {
  266. background: #fff;
  267. border-radius: 24rpx;
  268. padding: 24rpx;
  269. display: flex;
  270. gap: 24rpx;
  271. margin-bottom: 24rpx;
  272. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
  273. }
  274. .item-img {
  275. width: 180rpx;
  276. height: 180rpx;
  277. border-radius: 16rpx;
  278. }
  279. .item-info {
  280. flex: 1;
  281. display: flex;
  282. flex-direction: column;
  283. justify-content: space-between;
  284. }
  285. .item-header {
  286. display: flex;
  287. justify-content: space-between;
  288. align-items: center;
  289. }
  290. .item-title {
  291. font-size: 32rpx;
  292. color: #333;
  293. font-weight: bold;
  294. }
  295. .booked {
  296. font-size: 24rpx;
  297. color: #999;
  298. }
  299. .item-desc {
  300. font-size: 26rpx;
  301. color: #666;
  302. margin: 12rpx 0;
  303. }
  304. .item-bottom {
  305. display: flex;
  306. align-items: center;
  307. }
  308. .tag {
  309. background-color: #e3f2fd;
  310. color: #2196f3;
  311. font-size: 22rpx;
  312. padding: 6rpx 16rpx;
  313. border-radius: 8rpx;
  314. }
  315. </style>