index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view class="service-detail-page">
  3. <nav-bar title="服务详情" bgColor="transparent" color="#fff"></nav-bar>
  4. <!-- 顶部主图区域 -->
  5. <view class="hero-section">
  6. <image :src="serviceData.heroImg" class="hero-img" mode="aspectFill"></image>
  7. <view class="hero-overlay"></view>
  8. <view class="hero-title-box">
  9. <text class="hero-main-title">{{ serviceData.heroTitle }}</text>
  10. <text class="hero-sub-title">{{ serviceData.heroSubTitle }}</text>
  11. </view>
  12. </view>
  13. <!-- 购买数据 -->
  14. <view class="info-section card">
  15. <view class="service-price-row">
  16. <view class="price-box">
  17. <text class="price-label">订单服务费:</text>
  18. <text class="price-symbol">¥</text>
  19. <text class="price-num">{{ serviceData.price }}</text>
  20. <text class="price-unit">{{ serviceData.unit }}</text>
  21. </view>
  22. <text class="bought-count">{{ serviceData.booked }}</text>
  23. </view>
  24. <text class="service-name-text">{{ serviceData.title }}</text>
  25. </view>
  26. <!-- 详情选项卡 -->
  27. <view class="tab-section card">
  28. <view class="tab-header">
  29. <view :class="['tab-btn', { active: activeTab === 'intro' }]" @click="activeTab = 'intro'">
  30. <text>服务介绍</text>
  31. </view>
  32. <view :class="['tab-btn', { active: activeTab === 'notice' }]" @click="activeTab = 'notice'">
  33. <text>下单须知</text>
  34. </view>
  35. </view>
  36. <view class="tab-content" v-if="activeTab === 'intro'">
  37. <text class="content-title">服务介绍</text>
  38. <rich-text :nodes="serviceData.intro" class="content-text"></rich-text>
  39. <view class="intro-images" v-if="serviceData.introImages && serviceData.introImages.length">
  40. <image v-for="(img, idx) in serviceData.introImages" :key="idx" :src="img" class="intro-img"
  41. mode="widthFix"></image>
  42. </view>
  43. </view>
  44. <view class="tab-content" v-if="activeTab === 'notice'">
  45. <text class="content-title">下单须知</text>
  46. <rich-text :nodes="serviceData.notice" class="content-text"></rich-text>
  47. </view>
  48. </view>
  49. <!-- 底部操作栏 -->
  50. <view class="footer-bar safe-bottom">
  51. <button class="buy-btn" @click="goToOrderApply">立即预约</button>
  52. </view>
  53. </view>
  54. </template>
  55. <script setup>
  56. import { ref, computed } from 'vue'
  57. import navBar from '@/components/nav-bar/index.vue'
  58. import { onLoad } from '@dcloudio/uni-app'
  59. const activeTab = ref('intro')
  60. const serviceKey = ref('接送')
  61. const serviceConfigs = {
  62. '接送': {
  63. type: 'transport',
  64. title: '宠物接送',
  65. heroTitle: '专业宠物托运',
  66. heroSubTitle: '专业速度快 安全服务好',
  67. heroImg: 'https://images.unsplash.com/photo-1544568100-847a948585b9?q=80&w=600&auto=format&fit=crop',
  68. price: '40',
  69. unit: '起',
  70. booked: '158+ 人已约',
  71. intro: '宠物接送对于有出行需求的宠物主们来说,是解决距离难题的最佳选择。<br><br>✨ <b>服务特色:</b><br>专车专送、不拼车、无应激,配有专业航空箱,全天候接单响应。',
  72. introImages: ['/static/images/transport-guide.png'],
  73. notice: '<div style="background:#fdfaf5;border:1px solid #f9ecec;border-radius:10px;padding:14px;margin-bottom:16px;"><b>📜 服务细节</b><br>1. 请提前至少一天预约出行时间。<br>2. 接送期间发送状态视频及定位。<br>3. 价格按实际公里数计算。</div><div style="background:#fdfaf5;border:1px solid #f9ecec;border-radius:10px;padding:14px;"><b>⚠️ 禁忌项</b><br>1. 孕期宠物严禁长途颠簸。<br>2. 传染病宠物谢绝托运。<br>3. 出发前4小时内请勿大量喂食。</div>'
  74. },
  75. '托运': {
  76. type: 'transport',
  77. title: '跨区托运',
  78. heroTitle: '跨区宠物托运',
  79. heroSubTitle: '全国直达 安全高效',
  80. heroImg: 'https://images.unsplash.com/photo-1544568100-847a948585b9?q=80&w=600&auto=format&fit=crop',
  81. price: '199',
  82. unit: '起',
  83. booked: '286+ 人已约',
  84. intro: '宠物长途托运包含汽车、航空等多种方式可选。一站式服务。<br><br>✨ <b>服务特色:</b><br>恒温车厢保障、到达后专属客服报平安。',
  85. introImages: ['/static/images/transport-guide.png'],
  86. notice: '<div style="background:#fdfaf5;border:1px solid #f9ecec;border-radius:10px;padding:14px;margin-bottom:16px;"><b>📜 服务细节</b><br>1. 长途托运需提前3天预约。<br>2. 提供加固航空箱。<br>3. 客服1对1跟踪行程。</div>'
  87. },
  88. '喂养': {
  89. type: 'feed',
  90. title: '上门喂遛',
  91. heroTitle: '贴心上门喂遛',
  92. heroSubTitle: '解放双手 贴心陪伴',
  93. heroImg: 'https://images.unsplash.com/photo-1548247416-ec66f4900b2e?q=80&w=600&auto=format&fit=crop',
  94. price: '35',
  95. unit: ' / 次起',
  96. booked: '1240+ 人已约',
  97. intro: '专业宠托师上门喂食、铲屎及陪玩/遛狗服务。<br><br>✨ <b>服务特色:</b><br>每次服务30~60分钟,提供手机直播或录像。',
  98. introImages: ['https://images.unsplash.com/photo-1583511655857-d19b40a7a54e?w=600&q=80'],
  99. notice: '<div style="background:#fdfaf5;border:1px solid #f9ecec;border-radius:10px;padding:14px;"><b>📜 服务细节</b><br>1. 确认入户方式。<br>2. 离场提供照片及视频汇报单。</div>'
  100. },
  101. '洗护': {
  102. type: 'wash',
  103. title: '上门洗护SPA',
  104. heroTitle: '高端上门洗护',
  105. heroSubTitle: '足不出户 尊享SPA',
  106. heroImg: 'https://images.unsplash.com/photo-1516734212186-a967f81ad0d7?q=80&w=600&auto=format&fit=crop',
  107. price: '98',
  108. unit: ' / 次起',
  109. booked: '842+ 人已约',
  110. intro: '宠物美容师带全套设备上门,提供洗沐、剪甲、清耳道等全方位护理。<br><br>✨ <b>服务特色:</b><br>纯手工精细揉搓洗浴,低敏无泪植物配方。',
  111. introImages: ['https://images.unsplash.com/photo-1516734212186-a967f81ad0d7?w=600&q=80'],
  112. notice: '<div style="background:#fdfaf5;border:1px solid #f9ecec;border-radius:10px;padding:14px;"><b>📜 服务细节</b><br>1. 请确保家中有热水及洗浴空间。<br>2. 费用依宠物体型及毛长而定。</div>'
  113. }
  114. }
  115. onLoad((options) => {
  116. if (options && options.service) {
  117. serviceKey.value = decodeURIComponent(options.service)
  118. }
  119. })
  120. const serviceData = computed(() => {
  121. const key = Object.keys(serviceConfigs).find(k => serviceKey.value.includes(k)) || '接送'
  122. return serviceConfigs[key]
  123. })
  124. const goToOrderApply = () => {
  125. uni.navigateTo({
  126. url: `/pages/order/apply/index?service=${serviceData.value.type}`
  127. })
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .service-detail-page {
  132. background-color: #f5f5f5;
  133. min-height: 100vh;
  134. padding-bottom: 160rpx;
  135. }
  136. .hero-section {
  137. position: relative;
  138. width: 100%;
  139. height: 640rpx;
  140. overflow: hidden;
  141. margin-top: calc(-44px - var(--status-bar-height, 44px));
  142. }
  143. .hero-img {
  144. width: 100%;
  145. height: 100%;
  146. }
  147. .hero-overlay {
  148. position: absolute;
  149. top: 0;
  150. left: 0;
  151. right: 0;
  152. bottom: 0;
  153. background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.4) 80%, rgba(0, 0, 0, 0.7) 100%);
  154. }
  155. .hero-title-box {
  156. position: absolute;
  157. bottom: 48rpx;
  158. left: 40rpx;
  159. right: 40rpx;
  160. z-index: 2;
  161. }
  162. .hero-main-title {
  163. display: block;
  164. font-size: 52rpx;
  165. font-weight: 900;
  166. color: #fff;
  167. margin-bottom: 12rpx;
  168. }
  169. .hero-sub-title {
  170. display: block;
  171. font-size: 28rpx;
  172. color: rgba(255, 255, 255, 0.9);
  173. font-weight: 600;
  174. }
  175. .card {
  176. background-color: #fff;
  177. margin-bottom: 20rpx;
  178. }
  179. .info-section {
  180. padding: 32rpx 40rpx;
  181. position: relative;
  182. z-index: 3;
  183. border-radius: 24rpx 24rpx 0 0;
  184. margin-top: -24rpx;
  185. }
  186. .service-price-row {
  187. display: flex;
  188. justify-content: space-between;
  189. align-items: flex-end;
  190. margin-bottom: 20rpx;
  191. }
  192. .price-box {
  193. display: flex;
  194. align-items: baseline;
  195. color: #f44336;
  196. }
  197. .price-label {
  198. font-size: 26rpx;
  199. color: #333;
  200. font-weight: bold;
  201. margin-right: 12rpx;
  202. }
  203. .price-symbol {
  204. font-size: 28rpx;
  205. font-weight: bold;
  206. }
  207. .price-num {
  208. font-size: 56rpx;
  209. font-weight: 900;
  210. line-height: 1;
  211. }
  212. .price-unit {
  213. font-size: 24rpx;
  214. color: #999;
  215. margin-left: 4rpx;
  216. }
  217. .bought-count {
  218. font-size: 24rpx;
  219. color: #999;
  220. background: #f5f5f5;
  221. padding: 4rpx 16rpx;
  222. border-radius: 20rpx;
  223. }
  224. .service-name-text {
  225. font-size: 32rpx;
  226. color: #111;
  227. font-weight: bold;
  228. }
  229. .tab-section {
  230. padding: 0;
  231. }
  232. .tab-header {
  233. display: flex;
  234. border-bottom: 1rpx solid #f0f0f0;
  235. }
  236. .tab-btn {
  237. flex: 1;
  238. text-align: center;
  239. padding: 24rpx 0;
  240. font-size: 28rpx;
  241. color: #666;
  242. position: relative;
  243. }
  244. .tab-btn.active {
  245. color: #fcd53f;
  246. font-weight: bold;
  247. }
  248. .tab-btn.active::after {
  249. content: '';
  250. position: absolute;
  251. bottom: 0;
  252. left: 50%;
  253. transform: translateX(-50%);
  254. width: 60rpx;
  255. height: 6rpx;
  256. background: #fcd53f;
  257. border-radius: 6rpx;
  258. }
  259. .tab-content {
  260. padding: 40rpx 32rpx;
  261. }
  262. .content-title {
  263. display: block;
  264. font-size: 32rpx;
  265. color: #333;
  266. font-weight: 900;
  267. margin-bottom: 24rpx;
  268. padding-left: 20rpx;
  269. position: relative;
  270. }
  271. .content-title::before {
  272. content: '';
  273. position: absolute;
  274. left: 0;
  275. top: 4rpx;
  276. bottom: 4rpx;
  277. width: 8rpx;
  278. background: #fcd53f;
  279. border-radius: 4rpx;
  280. }
  281. .content-text {
  282. font-size: 28rpx;
  283. color: #555;
  284. line-height: 1.8;
  285. }
  286. .intro-images {
  287. margin-top: 32rpx;
  288. display: flex;
  289. flex-direction: column;
  290. gap: 24rpx;
  291. }
  292. .intro-img {
  293. width: 100%;
  294. border-radius: 20rpx;
  295. }
  296. .footer-bar {
  297. position: fixed;
  298. bottom: 0;
  299. left: 0;
  300. right: 0;
  301. padding: 20rpx 32rpx 40rpx;
  302. background-color: #fff;
  303. z-index: 10;
  304. box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
  305. }
  306. .buy-btn {
  307. width: 100%;
  308. height: 92rpx;
  309. font-size: 32rpx;
  310. font-weight: bold;
  311. color: #333;
  312. background: linear-gradient(90deg, #ffd53f, #ff9500);
  313. border: none;
  314. border-radius: 46rpx;
  315. line-height: 92rpx;
  316. }
  317. </style>