You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1422 lines
43 KiB

2 months ago
  1. <template>
  2. <view class="service-new container">
  3. <view style="background-color: #FFF4E5; margin: 10px; padding: 10px; border-radius: 8rpx;">
  4. <view style="display: flex;">
  5. <image style="width: 40rpx; height: 40rpx;" slot='cover' src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/OrderIcon.png">
  6. </image>
  7. <text style="color: #A94F20; font-size: 28rpx; font-weight: 500;">
  8. 下单方式
  9. <text v-if="orderMethod">指定喂养员 - {{orderName}}</text>
  10. <text v-else>系统派单</text>
  11. </text>
  12. </view>
  13. <view style="margin-top: 10rpx;">
  14. <text v-if="orderMethod" style="color: #A94F20; font-size: 24rpx; font-weight: 400;">
  15. (若伴宠师1小时内无响应或拒绝接单则系统派单)
  16. </text>
  17. </view>
  18. </view>
  19. <view>
  20. <uni-card padding=0 :is-shadow="false">
  21. <view class="service-new-title" slot="title">
  22. <view class="service-new-title-left">
  23. <view class="service-new-flag"></view>
  24. <view>爱宠选择</view>
  25. </view>
  26. </view>
  27. <view class="split-line"></view>
  28. <view class="service-new-pet-content">
  29. <scroll-view scroll-x class="scroll-view">
  30. <view class="scroll-content">
  31. <view v-for="item in currentPets" :key="item.id" class="service-new-pet-item ellipsis"
  32. :class="{'pet-selected': item.id === currentPetId, 'pet-unselect': item.id !== currentPetId}"
  33. @click="selectPet(item)">
  34. {{ item.name }}
  35. </view>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. </uni-card>
  40. </view>
  41. <view>
  42. <uni-card padding=0 :is-shadow="false">
  43. <view class="service-new-title" slot="title">
  44. <view class="service-new-title-left">
  45. <view class="service-new-flag"></view>
  46. <view>服务日期</view>
  47. </view>
  48. </view>
  49. <view class="split-line"></view>
  50. <view class="service-new-pet-content">
  51. <scroll-view scroll-y class="scroll-view-vertical">
  52. <view v-for="(month, monthIndex) in sortedGroupedDates" :key="monthIndex" class="month-group">
  53. <view class="month-title">{{ month.monthLabel }}</view>
  54. <scroll-view scroll-x class="scroll-view-horizontal">
  55. <view class="dates-wrapper">
  56. <view v-for="(day, dayIndex) in month.dates" :key="dayIndex" class="calendar-day"
  57. :class="{'day-selected': isDateSelected(day)}" @click="selectDate(day)">
  58. <image :src="isDateSelected(day) ?
  59. 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/newOrder/updated.png' :
  60. 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/newOrder/update_un.png'"
  61. class="calendar-bg"/>
  62. <text class="day-text" :class="{'day-highlighted': isCurrentSelected(day) ,'day-normal': !isCurrentSelected(day)} ">
  63. {{ day.date < 10 ? '0' + day.date : day.date }}</text>
  64. </view>
  65. </view>
  66. </scroll-view>
  67. </view>
  68. </scroll-view>
  69. </view>
  70. </uni-card>
  71. </view>
  72. <view>
  73. <uni-card padding=0 :is-shadow="false">
  74. <view class="service-new-title" slot="title">
  75. <view class="service-new-title-left">
  76. <view class="service-new-flag"></view>
  77. <view>期望时间 <span class="time-slot-time-tip">*请勾选您可以接受的上门时间段</span></view>
  78. </view>
  79. </view>
  80. <view class="split-line"></view>
  81. <view class="service-new-pet-content">
  82. <view class="time-slots">
  83. <view v-for="slot in timeSlots" :key="slot.id" class="time-slot-item"
  84. @click="selectTimeSlot(slot.id)">
  85. <image :src="slot.selected ? slot.activeIcon : slot.inactiveIcon" class="time-slot-icon" />
  86. <view class="time-slot-info">
  87. <text class="time-slot-time">{{ slot.time }}</text>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. </uni-card>
  93. </view>
  94. <view>
  95. <uni-card padding=0 :is-shadow="false">
  96. <view class="service-new-title" slot="title">
  97. <view class="service-new-title-left">
  98. <view class="service-new-flag"></view>
  99. <view>服务选择</view>
  100. </view>
  101. <view style="display: flex; justify-content: flex-end; align-items: center; ">
  102. <view style="margin-right: 10rpx;color: #AAAAAA;">爱宠{{currentPetId && getCurrentPetName()}} 全日期保持一致</view>
  103. <u-switch
  104. space="2" :value="isAllSame" activeColor="#f9ae3d" size="18"
  105. @change="isAllSameChange"
  106. inactiveColor="rgb(230, 230, 230)">
  107. </u-switch>
  108. </view>
  109. </view>
  110. <view class="split-line"></view>
  111. <view class="service-new-pet-content">
  112. <view class="service-item">
  113. <view class="service-item-header">
  114. <image src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/newOrder/service.png"
  115. class="service-icon"></image>
  116. <text class="service-title">基础服务</text>
  117. </view>
  118. <view class="service-list">
  119. <!-- <view style="border-radius: 8rpx" :style="{'background-color': needFeed.length > 0 ? '#FFFCF2' : '#F9F9F9', 'border': needFeed.length > 0 ? '1px solid #FFBF60' : 'none'}" >
  120. <view style="padding: 30rpx 0; margin: 0 20rpx; ">
  121. <u-checkbox-group
  122. v-model="needFeed"
  123. iconPlacement="right"
  124. placement="column">
  125. <u-checkbox activeColor="#FFBF60" label="专业喂养" shape="circle"></u-checkbox>
  126. </u-checkbox-group>
  127. </view>
  128. </view> -->
  129. <view class="service-list" style="border-radius: 8rpx;margin-top: 28rpx;">
  130. <view class="service-row" style="background-color: #FFECCD">
  131. <view class="service-row-content"
  132. :style="{'border-bottom': feedCount > 1 ? '1rpx solid #ECBFA8' : 'none'}">
  133. <text class="service-name" style="color: #A94F20;">一天多次</text>
  134. <view class="service-price">
  135. <u-number-box
  136. slot="right-icon"
  137. :value="feedCount"
  138. @change="feedCountChange"
  139. step="1"
  140. :min="1"
  141. :max="3"
  142. >
  143. <view slot="minus" class="minus">
  144. <u-icon name="minus-circle-fill" size="20" color="#FFBF60"></u-icon>
  145. </view>
  146. <text slot="input" style="width: 40rpx;text-align: center;"
  147. class="input">{{feedCount}}</text>
  148. <view slot="plus" class="plus">
  149. <u-icon name="plus-circle-fill" color="#FFBF60" size="20"></u-icon>
  150. </view>
  151. </u-number-box>
  152. </view>
  153. </view>
  154. </view>
  155. <view v-if="feedCount > 1" class="service-row" style="background-color: #FFECCD">
  156. <view class="service-row-content">
  157. <text class="service-name" style="color: #A94F20;">额外服务费</text>
  158. <view class="service-price" style="color:#A94F20">
  159. ¥{{ feedCount >2? 130 : 45}}
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. </view>
  165. </view>
  166. <view class="service-item">
  167. <view class="service-item-header">
  168. <image src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/newOrder/love.png"
  169. class="service-icon"></image>
  170. <text class="service-title">定制服务</text>
  171. </view>
  172. <view class="service-list" style="border-radius: 8rpx;">
  173. <view class="service-row" v-for="(item, index) in customServices" :key="item.skuId">
  174. <view class="service-row-content" :style="{'border-bottom': index !== customServices.length-1 ? '1rpx solid #EFEFEF' : 'none'}">
  175. <text class="service-name" style="">{{item.name}}</text>
  176. <view class="service-price">
  177. <text style="font-size: 32rpx; color: #FFBF60; margin-right: 20rpx;">¥{{item.price}}/</text>
  178. <u-number-box
  179. slot="right-icon"
  180. :value="item.quantity"
  181. :name="item.name"
  182. @change="customServiceCountChange"
  183. step="1"
  184. :min="0"
  185. :max="10"
  186. >
  187. <view slot="minus" class="minus">
  188. <u-icon name="minus-circle-fill" size="20" color="#FFBF60"></u-icon>
  189. </view>
  190. <text
  191. slot="input"
  192. style="width: 40rpx;text-align: center;"
  193. class="input"
  194. >{{item.quantity}}</text>
  195. <view slot="plus" class="plus">
  196. <u-icon name="plus-circle-fill" color="#FFBF60" size="20"></u-icon>
  197. </view>
  198. </u-number-box>
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. </view>
  204. </view>
  205. </uni-card>
  206. </view>
  207. <view v-if="!showPriceDetails" class="details-subscribe">
  208. <view style="display: flex;justify-content: space-between;">
  209. <view style="height: 80rpx;">
  210. <view>
  211. <text style="color: #333333;">订单总价 </text>
  212. <text style="color: #FF530A; font-size: 40rpx;">¥{{ totalPrice }} <text style="font-size: 32rpx;">.00</text></text>
  213. </view>
  214. <view style="display: flex; justify-content: flex-end;" @click="togglePriceDetails">
  215. <text v-if="currentDayPrice" style="color:#FF530A; font-size: 22rpx;"> 当日价格¥{{ currentDayPrice }}.00 |</text>
  216. <text style="color:#FF530A; font-size: 22rpx;margin-left: 10rpx;">明细</text>
  217. <u-icon name="arrow-up" color="#FF530A" size="10"></u-icon>
  218. </view>
  219. </view>
  220. <view style="display: flex;">
  221. <u-button color="#FFF4E4" customStyle="width: 200rpx; color: #FFAA48; margin-right: 20rpx;" text="上一步" @click="goBack"></u-button>
  222. <u-button color="#FFBF60" customStyle="width: 200rpx; color: #FFF;" text="确认下单" @click="goNext"></u-button>
  223. </view>
  224. </view>
  225. </view>
  226. <!-- 遮罩层 -->
  227. <view v-if="showPriceDetails" class="price-details-overlay">
  228. <view class="price-details">
  229. <view class="price-details-header">
  230. <text
  231. style="text-align: center; width: 100%; font-size: 32rpx; font-weight: 500; color: #333333;">价格明细</text>
  232. <u-icon name="close" @click="togglePriceDetails"></u-icon>
  233. </view>
  234. <view style="text-align: center; width: 100%; font-size: 28rpx; color: #AAAAAA; margin: 20rpx 0;">
  235. 实际支付金额以确认下单页为准</view>
  236. <view class="split-line"></view>
  237. <scroll-view class="price-details-body" scroll-y>
  238. <view v-for="(item, index) in priceDetails" :key="index">
  239. <view class="price-details-item">
  240. <view v-if="showName(item)" style="font-size: 28rpx; color: #333333;">{{ item.name }}</view>
  241. <view class="price-details-item-price-total">
  242. <view style="display: flex;" v-for="(item2, index) in item.item" :key="index">
  243. <view style="display: flex; align-items: center;">
  244. <view v-if="item2.date && item2.quantity"
  245. class="price-details-item-price-total-item">{{ item2.date }}</view>
  246. <view v-if="item2.itemName != item.name && item2.quantity"
  247. class="price-details-item-price-total-item">{{ item2.itemName }}</view>
  248. <view v-if="item2.quantity" class="price-details-item-price-total-item">
  249. ¥{{ item2.price }} × {{ item2.quantity }} {{ item2.unit }}</view>
  250. </view>
  251. <view v-if="item2.quantity"
  252. style="color: #333333; margin-left: 20rpx; margin: auto 0; width: 100rpx; text-align: right; font-size: 28rpx;">
  253. ¥{{ item2.price * item2.quantity }}</view>
  254. </view>
  255. </view>
  256. </view>
  257. </view>
  258. </scroll-view>
  259. <view style="position: absolute; bottom: 0; left: 0; right: 0; padding: 20rpx;">
  260. <view class="split-line"></view>
  261. <view class="price-details-item" style="margin: 20rpx 0;">
  262. <view style="font-size: 32rpx; color: #333333; font-weight: 500;">合计</view>
  263. <view style="font-size: 32rpx; color: #333333; font-weight: 500;">¥{{ totalPrice }}</view>
  264. </view>
  265. <view class="split-line"></view>
  266. </view>
  267. </view>
  268. <view class="details-subscribe">
  269. <view style="display: flex;justify-content: space-between;">
  270. <view style="height: 80rpx;">
  271. <view>
  272. <text style="color: #333333;">订单总价 </text>
  273. <text style="color: #FF530A; font-size: 40rpx;">¥{{ totalPrice }} <text style="font-size: 32rpx;">.00</text></text>
  274. </view>
  275. <view style="display: flex; justify-content: flex-end;" @click="togglePriceDetails">
  276. <text v-if="currentDayPrice" style="color:#FF530A; font-size: 22rpx;"> 当日价格¥{{ currentDayPrice }}.00 |</text>
  277. <text style="color:#FF530A; font-size: 22rpx;margin-left: 10rpx;">明细</text>
  278. <u-icon name="arrow-up" color="#FF530A" size="10"></u-icon>
  279. </view>
  280. </view>
  281. <view style="display: flex;">
  282. <u-button color="#FFF4E4" customStyle="width: 200rpx; color: #FFAA48; margin-right: 20rpx;" text="上一步" @click="goBack"></u-button>
  283. <u-button color="#FFBF60" customStyle="width: 200rpx; color: #FFF;" text="确认下单" @click="goNext"></u-button>
  284. </view>
  285. </view>
  286. </view>
  287. </view>
  288. </view>
  289. </template>
  290. <script>
  291. import {
  292. getProductList,
  293. getOpenId
  294. } from "@/api/system/user"
  295. import { setToken,setOpenIdKey } from '@/utils/auth'
  296. export default {
  297. data() {
  298. return {
  299. basePrice:75,
  300. baseProduct:'专业喂养',
  301. currentPets: [],
  302. currentPetId: '',
  303. currentMonthDay: {},
  304. selectedDates: [],
  305. groupedDates: [],
  306. timeSlots: [
  307. {
  308. id: 'MORNING',
  309. name: '早上',
  310. time: '08:00-12:00',
  311. selected: false,
  312. activeIcon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/newOrder/morning.png',
  313. inactiveIcon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/newOrder/morning_un.png'
  314. },
  315. {
  316. id: 'AFTERNOON',
  317. name: '午后',
  318. time: '12:00-18:00',
  319. selected: false,
  320. activeIcon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/newOrder/noon.png',
  321. inactiveIcon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/newOrder/noon_un.png'
  322. },
  323. {
  324. id: 'EVENING',
  325. name: '晚间',
  326. time: '18:00-22:00',
  327. selected: false,
  328. activeIcon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/newOrder/night.png',
  329. inactiveIcon: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/newOrder/night_un.png'
  330. }
  331. ],
  332. feedCount:1,
  333. // customServices原始值
  334. customServicesStr:'',
  335. customServices: [
  336. { name: '陪玩(20分钟)', price: 20, quantity: 0 },
  337. { name: '活动区吸毛', price: 20, quantity: 0 },
  338. { name: '毛发梳理', price: 15, quantity: 0 },
  339. { name: '身体清洁(如眼、耳、鼻等)', price: 5, quantity: 0 },
  340. { name: '指甲修剪', price: 10, quantity: 0 },
  341. { name: '会员深度清洁', price: 20, quantity: 0 },
  342. { name: '喂药', price: 15, quantity: 0 },
  343. { name: '上药', price: 25, quantity: 0 }
  344. ],
  345. showPriceDetails: false, // 控制价格明细的显示
  346. priceDetails: [],
  347. totalPrice: 0,
  348. isAllSame: false,
  349. newOrderData: [],
  350. // 提前熟悉费用
  351. needPreFamiliarizeCost: 0,
  352. // 基础服务总费用
  353. baseServiceTotalCost: 0,
  354. // 额外宠物总费用
  355. additionalTotalCost: 0,
  356. // 多次服务总费用
  357. multServicesTotalCost: 0,
  358. // 定制服务总费用
  359. customServicesTotalCost: 0,
  360. // 一天两次日期
  361. oneDayTwoTimesDates: [],
  362. // 一天三次日期
  363. oneDayThreeTimesDates: [],
  364. // 宠物类型次数统计
  365. petTypeCounts: [],
  366. // 定制服务单项总次数统计
  367. customServiceItemCount:[],
  368. // 当日价格
  369. currentDayPrice:0
  370. }
  371. },
  372. onLoad: function(option) {
  373. if (option.userName) {
  374. this.orderMethod = true
  375. this.orderName = option.userName;
  376. this.servicerId = option.servicerId;
  377. }
  378. },
  379. mounted() {
  380. this.currentPets = this.$globalData.newOrderData.currentPets;
  381. if(this.currentPets.length<1){
  382. uni.reLaunch({
  383. url: '/pages/index'
  384. });
  385. }
  386. if(this.$globalData.mainSku&&this.$globalData.mainSku[0]){
  387. this.basePrice = this.$globalData.mainSku[0].price
  388. this.baseProduct = this.$globalData.mainSku[0].name
  389. }
  390. this.getProductList()
  391. },
  392. watch: {
  393. currentPetId: {
  394. immediate: true,
  395. handler(newId) {
  396. if (newId) {
  397. this.updateGroupedDates()
  398. }
  399. }
  400. }
  401. },
  402. methods: {
  403. initNewOrderData(){
  404. const needPreFamiliarize=this.$globalData.newOrderData.needPreFamiliarize.length>0
  405. const pets=[]
  406. // 初始化当前宠物全日期保持一致
  407. this.currentPets = this.currentPets.map(pet=>{
  408. pet.isAllSame = false
  409. return pet
  410. })
  411. this.currentPets.map(pet=>{
  412. // 单个宠物服务日期列表
  413. const serviceDateList = pet.selectedDate.map(item => item.date)
  414. serviceDateList.forEach(date => {
  415. pets.push({
  416. petId: pet.id,
  417. serviceDate: date,
  418. name: pet.name,
  419. gender: pet.gender,
  420. petType: pet.petType,
  421. bodyType:pet.bodyType,
  422. photo: pet.photo,
  423. feedCount: 1,
  424. selectedTimeSlots: [],
  425. customServices: [],
  426. //额外费用
  427. additionalCost: 0
  428. })
  429. })
  430. })
  431. this.newOrderData = {
  432. needPreFamiliarize: needPreFamiliarize, // 是否需要提前熟悉 40元/次 参与计算
  433. pets: pets
  434. }
  435. // 默认选择第一个宠物
  436. this.selectPet(this.currentPets[0])
  437. this.calculateTotalPrice()
  438. },
  439. // 选择宠物
  440. selectPet(pet) {
  441. this.currentPetId = pet.id
  442. // 默认选择当前宠物的最小日期
  443. if (pet.selectedDate?.length > 1) {
  444. const minDate = pet.selectedDate.reduce((min, date) => {
  445. const currentDate = new Date(date.date);
  446. const minDate = new Date(min.date);
  447. return currentDate < minDate ? date : min;
  448. }, pet.selectedDate[0]);
  449. // 当前选择日期
  450. this.currentMonthDay = {
  451. petId: this.currentPetId,
  452. date: new Date(minDate.date).getDate(),
  453. fullDate: minDate.date
  454. }
  455. } else {
  456. this.currentMonthDay = {
  457. petId: this.currentPetId,
  458. date: new Date(pet.selectedDate[0].date).getDate(),
  459. fullDate: pet.selectedDate[0].date
  460. }
  461. }
  462. this.getCurrentPetIsAllSame()
  463. this.selectDate(this.currentMonthDay)
  464. },
  465. selectDate(day) {
  466. // 当前选择日期
  467. this.currentMonthDay = day
  468. const selectedDay = this.selectedDates?.find(item => item.fullDate === day.fullDate && item
  469. .currentPetId === day.petId)
  470. if (!selectedDay) {
  471. this.selectedDates.push(day)
  472. }
  473. // 还原当前选择日期是否已选择期望时间
  474. const pets = this.newOrderData?.pets
  475. const selectedPet = pets.find(pet => pet.petId === this.currentPetId && pet.serviceDate === this
  476. .currentMonthDay.fullDate);
  477. const selectedTimeSlots = selectedPet ? selectedPet.selectedTimeSlots : [];
  478. if(selectedTimeSlots.length > 0){
  479. this.timeSlots.forEach(slot=>{
  480. if(selectedTimeSlots.includes(slot.id)){
  481. slot.selected = true
  482. } else {
  483. slot.selected = false
  484. }
  485. })
  486. } else {
  487. this.timeSlots.forEach(slot => {
  488. slot.selected = false
  489. })
  490. }
  491. // 还原当前选择日期喂食次数
  492. this.feedCount = selectedPet ? selectedPet.feedCount : 1
  493. // 还原当前选择日期是否已选择定制服务
  494. this.customServices = selectedPet.customServices.length > 0 ? selectedPet.customServices : JSON.parse(this.customServicesStr)
  495. this.getCurrentDayPrice(this.currentMonthDay.fullDate)
  496. },
  497. isDateSelected(day) {
  498. const selectedDay = this.selectedDates.find(item => item.fullDate === day.fullDate && this.currentPetId ===
  499. item.petId)
  500. if (selectedDay) {
  501. return true
  502. }
  503. return false
  504. },
  505. isCurrentSelected(day){
  506. return this.currentMonthDay.fullDate === day.fullDate && this.currentPetId === day.petId
  507. },
  508. updateGroupedDates() {
  509. const currentPet = this.currentPets.find(pet => pet.id === this.currentPetId)
  510. if (!currentPet) return
  511. // 按月份分组日期
  512. const grouped = currentPet.selectedDate.reduce((acc, dateObj) => {
  513. const date = new Date(dateObj.date)
  514. const monthKey = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`
  515. const monthLabel = `${date.getFullYear()}${date.getMonth() + 1}`
  516. if (!acc[monthKey]) {
  517. acc[monthKey] = {
  518. monthLabel,
  519. dates: []
  520. }
  521. }
  522. acc[monthKey].dates.push({
  523. petId: currentPet.id,
  524. date: date.getDate(),
  525. fullDate: dateObj.date
  526. })
  527. return acc
  528. }, {})
  529. // 转换为数组并排序
  530. this.groupedDates = Object.values(grouped).sort((a, b) => {
  531. return a.monthLabel.localeCompare(b.monthLabel)
  532. })
  533. },
  534. selectTimeSlot(slotId) {
  535. const slot = this.timeSlots.find(slot => slot.id === slotId)
  536. if (slot) {
  537. slot.selected = !slot.selected
  538. }
  539. // 将期望时间添加到当前宠物
  540. const selectedTimeSlots = this.timeSlots.filter(slot => slot.selected)
  541. if(this.isAllSame){
  542. // 如果保持一致,则更新该宠物所有期望时间
  543. this.newOrderData.pets.forEach(pet=>{
  544. pet.selectedTimeSlots=selectedTimeSlots.map(item => item.id)
  545. })
  546. } else{
  547. const currentPetIndex = this.newOrderData.pets.findIndex(pet => pet.petId === this.currentPetId
  548. && pet.serviceDate === this.currentMonthDay.fullDate)
  549. if (currentPetIndex !== -1) {
  550. this.newOrderData.pets[currentPetIndex].selectedTimeSlots = selectedTimeSlots.map(item => item.id)
  551. }
  552. }
  553. },
  554. feedCountChange(e){
  555. this.feedCount = e.value
  556. if(this.isAllSame){
  557. // 如果保持一致,则更新该宠物的喂食次数
  558. this.newOrderData.pets.forEach(pet=>{
  559. if(pet.petId === this.currentPetId){
  560. pet.feedCount=this.feedCount
  561. }
  562. })
  563. } else {
  564. const pets = this.newOrderData.pets
  565. const currentPetIndex = pets.findIndex(pet => pet.petId === this.currentPetId && pet.serviceDate ===
  566. this.currentMonthDay.fullDate)
  567. if (currentPetIndex !== -1) {
  568. this.newOrderData.pets[currentPetIndex].feedCount = this.feedCount
  569. }
  570. }
  571. this.calculateTotalPrice()
  572. },
  573. customServiceCountChange(val) {
  574. console.log(val)
  575. this.customServices.forEach(item=>{
  576. if(item.name === val.name){
  577. item.quantity = val.value
  578. }
  579. })
  580. if(this.isAllSame){
  581. // 如果保持一致,则更新当前宠物的定制服务次数
  582. this.newOrderData.pets.forEach(pet=>{
  583. if(pet.petId === this.currentPetId){
  584. pet.customServices= JSON.parse(JSON.stringify(this.customServices))
  585. }
  586. })
  587. } else {
  588. const pets = this.newOrderData.pets
  589. const currentPetIndex = pets.findIndex(pet => pet.petId === this.currentPetId && pet.serviceDate ===
  590. this.currentMonthDay.fullDate)
  591. if (currentPetIndex !== -1) {
  592. this.newOrderData.pets[currentPetIndex].customServices = JSON.parse(JSON.stringify(this
  593. .customServices))
  594. }
  595. }
  596. this.calculateTotalPrice()
  597. },
  598. togglePriceDetails() {
  599. this.showPriceDetails = !this.showPriceDetails; // 切换价格明细的显示状态
  600. if (this.showPriceDetails) {
  601. this.priceDetailDate()
  602. }
  603. },
  604. calculateTotalPrice() {
  605. // 1. 订单维度:是否需要提前熟悉
  606. if(this.$globalData.newOrderData.needPreFamiliarize && this.$globalData.newOrderData.needPreFamiliarize.length>0){
  607. this.needPreFamiliarizeCost = 40
  608. }else{
  609. this.needPreFamiliarizeCost = 0
  610. }
  611. // 2. 日期维度
  612. // 2.1 基础服务费用
  613. const uniqueDates = new Set(this.newOrderData.pets.map(item => item.serviceDate)); // 去重日期
  614. this.baseServiceTotalCost = uniqueDates.size * this.basePrice; // 每个唯一日期75元
  615. // 2.2 额外宠物费用
  616. // petType为dog 且bodyType包含 '大型' 则为大型犬,40元/次
  617. // petType为dog 且bodyType包含 '中型' 则为中型犬,30元/次
  618. // petType为dog 且bodyType包含 '小型' 则为小型犬,15元/次
  619. // petType为cat 则为猫,10元/次
  620. this.newOrderData.pets.forEach(pet => {
  621. if (pet.petType === 'dog' && pet.bodyType.includes('大型')) {
  622. pet.additionalCost = 40
  623. } else if (pet.petType === 'dog' && pet.bodyType.includes('中型')) {
  624. pet.additionalCost = 30
  625. } else if (pet.petType === 'dog' && pet.bodyType.includes('小型')) {
  626. pet.additionalCost = 15
  627. } else if (pet.petType === 'cat') {
  628. pet.additionalCost = 10
  629. }
  630. })
  631. // const largeDogArray = this.newOrderData.pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('大型'));
  632. // this.additionalTotalCost = this.additionalTotalCost + (largeDogArray.length * 40)
  633. // // 非大型犬
  634. // const otherPets = this.newOrderData.pets.filter(pet => pet.petType !== 'dog' && !pet.bodyType.includes('大型'));
  635. // 宠物日期分组
  636. const dailyPets = [];
  637. // 按日期分组宠物
  638. this.newOrderData.pets.forEach(pet => {
  639. const serviceDate = pet.serviceDate;
  640. if (!dailyPets[serviceDate]) {
  641. dailyPets[serviceDate] = [];
  642. }
  643. dailyPets[serviceDate].push(pet);
  644. });
  645. const petTypeCounts = []
  646. let additionalTotalCost = 0
  647. // 计算每日额外宠物费用
  648. for (const date in dailyPets) {
  649. const pets = dailyPets[date];
  650. const largeDogCount = pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('大型')).length;
  651. let mediumDogCount = pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('中型')).length;
  652. let smallDogCount = pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('小型')).length;
  653. let catCount = pets.filter(pet => pet.petType === 'cat').length;
  654. let additionalCost = 0
  655. // 总宠物费用
  656. let totalPetCost = pets.reduce((acc, pet) => {
  657. return acc + this.calculatePetCost(pet);
  658. }, 0);
  659. // 如果总宠物费用>30
  660. if (totalPetCost > 30) {
  661. // 如果猫数量>=3
  662. if (catCount >= 3) {
  663. additionalCost = totalPetCost - 30
  664. catCount = catCount - 3
  665. } else if (smallDogCount >= 2) {
  666. additionalCost = totalPetCost - 30
  667. smallDogCount = smallDogCount - 2
  668. } else if (mediumDogCount >= 1) {
  669. additionalCost = totalPetCost - 30
  670. mediumDogCount = mediumDogCount - 1
  671. } else {
  672. additionalCost = totalPetCost - 25
  673. catCount = catCount - 1
  674. smallDogCount = smallDogCount - 1
  675. }
  676. petTypeCounts.push({
  677. date,
  678. largeDogCount,
  679. mediumDogCount,
  680. smallDogCount,
  681. catCount
  682. })
  683. }
  684. // 如果有大型犬,额外费用为40元/只
  685. if (largeDogCount > 0) {
  686. additionalCost += (40 * largeDogCount)
  687. }
  688. // 如果有额外费用,添加到总额外费用
  689. if (additionalCost > 0) {
  690. additionalTotalCost += additionalCost;
  691. }
  692. }
  693. this.additionalTotalCost = additionalTotalCost
  694. this.petTypeCounts = petTypeCounts
  695. // 2.3 当日多次服务总价
  696. // 计算每日多次服务次数费用
  697. let multServicesTotalCost = 0
  698. let oneDayTwoTimesDates = []
  699. let oneDayThreeTimesDates = []
  700. for (const date in dailyPets) {
  701. const maxFeedCount = Math.max(...dailyPets[date].map(pet => pet.feedCount));
  702. if (maxFeedCount === 2) {
  703. multServicesTotalCost += 45; // 1天2次
  704. oneDayTwoTimesDates.push(date)
  705. } else if (maxFeedCount === 3) {
  706. multServicesTotalCost += 130; // 1天3次
  707. oneDayThreeTimesDates.push(date)
  708. }
  709. }
  710. this.oneDayTwoTimesDates = oneDayTwoTimesDates
  711. this.oneDayThreeTimesDates = oneDayThreeTimesDates
  712. this.multServicesTotalCost = multServicesTotalCost
  713. // 3. 定制服务
  714. //定制服务单项总次数统计
  715. const customServiceItemCount = JSON.parse(this.customServicesStr)
  716. let customServicesTotalCost = 0
  717. this.newOrderData.pets.forEach(pet => {
  718. const customServices = pet.customServices
  719. // 定制服务费用
  720. customServices.forEach(service=>{
  721. const itemIndex = customServiceItemCount.findIndex(item=>item.name === service.name)
  722. if(itemIndex !== -1){
  723. customServiceItemCount[itemIndex].quantity += service.quantity
  724. }
  725. customServicesTotalCost += service.price * service.quantity;
  726. })
  727. });
  728. this.customServiceItemCount = customServiceItemCount
  729. this.customServicesTotalCost = customServicesTotalCost
  730. this.totalPrice = this.needPreFamiliarizeCost
  731. + this.baseServiceTotalCost
  732. + this.additionalTotalCost
  733. + this.multServicesTotalCost
  734. + this.customServicesTotalCost; // 更新总价
  735. this.getCurrentDayPrice(this.currentMonthDay.fullDate)
  736. },
  737. calculatePetCost(pet) {
  738. // 宠物额外费用 不计算大型犬
  739. let petCost = 0;
  740. if (pet.petType === 'cat') {
  741. petCost += 10; // 猫额外费用
  742. } else if (pet.petType === 'dog' && pet.bodyType.includes('小型')) {
  743. petCost += 15; // 小型犬额外费用
  744. } else if (pet.petType === 'dog' && pet.bodyType.includes('中型')) {
  745. petCost += 30; // 中型犬额外费用
  746. }
  747. return petCost;
  748. },
  749. goNext() {
  750. this.calculateTotalPrice(); // 计算总价
  751. this.showPriceDetails = false;
  752. this.$globalData.newOrderData.currentPetsByDay = this.newOrderData.pets
  753. this.$globalData.newOrderData.totalPrice = this.totalPrice
  754. uni.navigateTo({
  755. url: '/pages/newOrder/confirmOrder'
  756. });
  757. },
  758. goBack() {
  759. this.showPriceDetails = false
  760. let len = getCurrentPages().length;
  761. this.loading = false
  762. if (len >= 2) {
  763. uni.navigateBack();
  764. } else {
  765. uni.redirectTo({
  766. url: '/pages/newOrder/serviceNew'
  767. });
  768. }
  769. },
  770. // 价格明细数据
  771. priceDetailDate() {
  772. const priceDetails = []
  773. if (this.newOrderData.needPreFamiliarize) {
  774. priceDetails.push({
  775. name: '提前熟悉',
  776. item: [{
  777. itemName: '提前熟悉',
  778. price: 40,
  779. quantity: this.newOrderData.needPreFamiliarize ? 1 : 0,
  780. unit: '次'
  781. }, ]
  782. })
  783. }
  784. const uniqueDateCount = new Set(this.newOrderData.pets.map(item => item.serviceDate)).size; // 去重日期
  785. if(uniqueDateCount>1){
  786. priceDetails.push({ name: this.baseProduct, item: [
  787. { itemName: this.baseProduct, price:this.basePrice, quantity: uniqueDateCount, unit: '天' },
  788. ]})
  789. }
  790. if (this.oneDayTwoTimesDates.length > 0 || this.oneDayThreeTimesDates.length > 0) {
  791. priceDetails.push({
  792. name: '上门次数',
  793. item: [{
  794. itemName: '1天2次',
  795. price: 45,
  796. quantity: this.oneDayTwoTimesDates.length,
  797. unit: '天'
  798. },
  799. {
  800. itemName: '1天3次',
  801. price: 130,
  802. quantity: this.oneDayThreeTimesDates.length,
  803. unit: '天'
  804. },
  805. ]
  806. })
  807. }
  808. // 过滤宠物类型数量>0的数组
  809. const additionalCostItem = []
  810. const petTypeArr = this.petTypeCounts.filter(item => item.largeDogCount > 0 || item.mediumDogCount > 0 ||
  811. item.smallDogCount > 0 || item.catCount > 0)
  812. // 假设largeDogCount=1 mediumDogCount=2 smallDogCount=3 catCount=4 则生成4条数据
  813. petTypeArr.forEach(item => {
  814. if (item.largeDogCount > 0) {
  815. additionalCostItem.push({
  816. itemName: '大型犬',
  817. price: 40,
  818. quantity: item.largeDogCount,
  819. unit: '只',
  820. date: item.date
  821. })
  822. }
  823. if (item.mediumDogCount > 0) {
  824. additionalCostItem.push({
  825. itemName: '中型犬',
  826. price: 30,
  827. quantity: item.mediumDogCount,
  828. unit: '只',
  829. date: item.date
  830. })
  831. }
  832. if (item.smallDogCount > 0) {
  833. additionalCostItem.push({
  834. itemName: '小型犬',
  835. price: 15,
  836. quantity: item.smallDogCount,
  837. unit: '只',
  838. date: item.date
  839. })
  840. }
  841. if (item.catCount > 0) {
  842. additionalCostItem.push({
  843. itemName: '猫猫',
  844. price: 10,
  845. quantity: item.catCount,
  846. unit: '只',
  847. date: item.date
  848. })
  849. }
  850. })
  851. // 按日期先后顺序排序
  852. additionalCostItem.sort((a, b) => new Date(a.date) - new Date(b.date))
  853. if (additionalCostItem.length > 0) {
  854. priceDetails.push({
  855. name: '额外宠物费用',
  856. item: additionalCostItem
  857. })
  858. }
  859. const customServiceItem = this.customServiceItemCount.filter(item=>item.quantity>0).map(service=>{
  860. return { itemName: service.name, price: service.price, quantity: service.quantity, unit: '次' }
  861. })
  862. if (customServiceItem.length > 0) {
  863. priceDetails.push({
  864. name: '定制服务',
  865. item: customServiceItem
  866. })
  867. }
  868. this.priceDetails = priceDetails
  869. this.calculateTotalPrice()
  870. },
  871. showName(item) {
  872. return item.item.some(item2 => item2.quantity > 0)
  873. },
  874. isAllSameChange(e) {
  875. if (e) {
  876. this.isAllSame = true
  877. this.setCurrentPetIsAllSame()
  878. // 当前宠物全日期保持一致
  879. this.newOrderData.pets.forEach(pet=>{
  880. if(pet.petId === this.currentPetId){
  881. pet.selectedTimeSlots = this.timeSlots.filter(slot => slot.selected).map(item => item.id)
  882. pet.feedCount = this.feedCount
  883. pet.customServices = this.customServices
  884. }
  885. })
  886. this.calculateTotalPrice()
  887. } else {
  888. this.isAllSame = false
  889. this.setCurrentPetIsAllSame()
  890. }
  891. },
  892. getProductList() {
  893. getProductList({
  894. "publishStatus": 1,
  895. "categoryId": 78,
  896. "needSku": true
  897. }).then(response => {
  898. if (response && response.content && response.content.length > 0) {
  899. this.customServices = response.content.map(item=>{
  900. const skus = item.skus
  901. if(skus && skus.length>0){
  902. let productSku = {
  903. "skuId": skus[0].id,
  904. "price":skus[0].price,
  905. "name":item.name,
  906. "quantity": 0,
  907. "isMainProduct":false
  908. }
  909. return productSku
  910. }
  911. })
  912. this.customServicesStr = JSON.stringify(this.customServices)
  913. // 初始化新订单数据
  914. this.initNewOrderData()
  915. }else {
  916. uni.showToast('获取主产品失败,请联系管理员')
  917. }
  918. console.log(response);
  919. })
  920. },
  921. login() {
  922. uni.login({
  923. provider: 'weixin',
  924. success: (loginRes) => {
  925. this.getOpenId(loginRes.code)
  926. },
  927. fail: function(error) {
  928. // 授权失败处理
  929. uni.showToast('授权失败,请授权后再试')
  930. }
  931. });
  932. },
  933. getOpenId(code) {
  934. getOpenId(code).then(res => {
  935. if (res.code == 200 && res.data) {
  936. let resData = JSON.parse(res.data)
  937. let token = resData.token;
  938. let openId = resData.openId;
  939. setOpenIdKey(openId)
  940. if(token){
  941. setToken(token)
  942. }
  943. }
  944. })
  945. },
  946. getCurrentDayPrice(currentDay){
  947. const currentDayPets = this.newOrderData.pets.filter(pet => pet.serviceDate === currentDay)
  948. // 基础服务
  949. const baseServiceCost = this.basePrice
  950. const largeDogCount = currentDayPets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('大型')).length;
  951. let mediumDogCount = currentDayPets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('中型')).length;
  952. let smallDogCount = currentDayPets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('小型')).length;
  953. let catCount = currentDayPets.filter(pet => pet.petType === 'cat').length;
  954. const additionalCostItem = []
  955. let additionalCost = 0
  956. // 单天总宠物费用
  957. let totalPetCost = currentDayPets.reduce((acc, pet) => {
  958. return acc + this.calculatePetCost(pet);
  959. }, 0);
  960. // 如果总宠物费用>30
  961. if(totalPetCost>30){
  962. // 如果猫数量>=3,则免3只猫
  963. if (catCount >= 3) {
  964. additionalCost = totalPetCost - 30
  965. catCount = catCount-3
  966. }else if (smallDogCount >= 2) { // 如果小型犬数量>=2,则免2只小型犬
  967. additionalCost = totalPetCost - 30
  968. smallDogCount = smallDogCount-2
  969. }else if(mediumDogCount >= 1) { // 如果中型犬数量>=1,则免1只中型犬
  970. additionalCost = totalPetCost - 30
  971. mediumDogCount = mediumDogCount-1
  972. }else{
  973. additionalCost = totalPetCost - 25
  974. catCount = catCount - 1
  975. smallDogCount = smallDogCount - 1
  976. }
  977. if(largeDogCount>0){
  978. additionalCostItem.push({ itemName: '大型犬', price: 40, quantity: largeDogCount, unit: '只'})
  979. }
  980. if(mediumDogCount>0){
  981. additionalCostItem.push({ itemName: '中型犬', price: 30, quantity: mediumDogCount, unit: '只'})
  982. }
  983. if(smallDogCount>0){
  984. additionalCostItem.push({ itemName: '小型犬', price: 15, quantity: smallDogCount, unit: '只'})
  985. }
  986. if(catCount>0){
  987. additionalCostItem.push({ itemName: '猫猫', price: 10, quantity: catCount, unit: '只'})
  988. }
  989. }
  990. // 如果有大型犬,额外费用为40元/只
  991. if (largeDogCount > 0) {
  992. additionalCost +=(40 * largeDogCount)
  993. }
  994. // 当日多次服务次数
  995. let multServicesTotalCost = 0
  996. const maxFeedCount = Math.max(...currentDayPets.map(pet => pet.feedCount));
  997. if (maxFeedCount === 2) {
  998. multServicesTotalCost += 45; // 1天2次
  999. } else if (maxFeedCount === 3) {
  1000. multServicesTotalCost += 130; // 1天3次
  1001. }
  1002. // 所有宠物定制服务费用
  1003. const customServiceCost = currentDayPets.reduce((acc, pet) => acc + this.calculatePetCustomServiceCost(pet), 0)
  1004. const totalCost = baseServiceCost + additionalCost + multServicesTotalCost + customServiceCost
  1005. this.currentDayPrice = totalCost
  1006. },
  1007. calculatePetCustomServiceCost(pet) {
  1008. const customServiceCost = pet.customServices.reduce((acc, item) => acc + item.price * item.quantity, 0)
  1009. return customServiceCost
  1010. },
  1011. getCurrentPetName(){
  1012. const currentPet = this.currentPets.find(pet=>pet.id === this.currentPetId)
  1013. return currentPet.name
  1014. },
  1015. setCurrentPetIsAllSame(){
  1016. const currentPet = this.currentPets.find(pet=>pet.id === this.currentPetId)
  1017. currentPet.isAllSame=this.isAllSame
  1018. },
  1019. getCurrentPetIsAllSame(){
  1020. const currentPet = this.currentPets.find(pet=>pet.id === this.currentPetId)
  1021. this.isAllSame = currentPet.isAllSame
  1022. },
  1023. },
  1024. computed: {
  1025. sortedGroupedDates() {
  1026. return this.groupedDates.sort((a, b) => {
  1027. const dateA = new Date(a.monthLabel.replace('年', '-').replace('月', '-01'))
  1028. const dateB = new Date(b.monthLabel.replace('年', '-').replace('月', '-01'))
  1029. return dateA - dateB
  1030. })
  1031. }
  1032. }
  1033. }
  1034. </script>
  1035. <style scoped lang="less">
  1036. .container {
  1037. position: relative;
  1038. height: 100%;
  1039. padding-bottom: 160rpx;
  1040. .details-subscribe {
  1041. background-color: #FFFFFF;
  1042. padding: 10px;
  1043. width: 100%;
  1044. height: 160rpx;
  1045. position: fixed;
  1046. bottom: 0;
  1047. z-index: 100;
  1048. .details-btn {
  1049. width: 100%;
  1050. border-radius: 6px;
  1051. background: #FFB13F;
  1052. font-size: 16px;
  1053. color: #FFFFFF;
  1054. }
  1055. }
  1056. }
  1057. .service-new {
  1058. .service-new-flag {
  1059. width: 8rpx;
  1060. height: 32rpx;
  1061. background: #FFBF60;
  1062. border-radius: 30rpx 30rpx 30rpx 30rpx;
  1063. margin-right: 10rpx;
  1064. }
  1065. .split-line {
  1066. width: 100%;
  1067. height: 1rpx;
  1068. background: #EFEFEF;
  1069. }
  1070. .service-new-title {
  1071. display: flex;
  1072. font-weight: 500;
  1073. font-size: 28rpx;
  1074. color: #333333;
  1075. line-height: 33rpx;
  1076. margin: 42rpx 0 30rpx;
  1077. justify-content: space-between;
  1078. .service-new-title-left {
  1079. display: flex;
  1080. align-items: center;
  1081. }
  1082. }
  1083. .service-new-pet-content{
  1084. padding: 20rpx 0;
  1085. }
  1086. .service-new-pet-item {
  1087. height: 96rpx;
  1088. width: 184rpx;
  1089. border-radius: 8rpx;
  1090. padding: 0 20rpx;
  1091. margin-right: 40rpx;
  1092. display: flex;
  1093. align-items: center;
  1094. justify-content: center;
  1095. font-size: 28rpx;
  1096. flex-shrink: 0;
  1097. }
  1098. .scroll-content {
  1099. display: inline-flex;
  1100. }
  1101. .scroll-view {
  1102. width: 100%;
  1103. white-space: nowrap;
  1104. }
  1105. .pet-selected {
  1106. background: #FFBF60;
  1107. color: #FFFFFF;
  1108. }
  1109. .pet-unselect {
  1110. background: #F5F5F7;
  1111. color: #7D8196;
  1112. }
  1113. }
  1114. .calendar-wrapper {
  1115. display: flex;
  1116. gap: 20rpx;
  1117. padding: 20rpx;
  1118. }
  1119. .scroll-view {
  1120. width: 100%;
  1121. white-space: nowrap;
  1122. }
  1123. .calendar-day {
  1124. position: relative;
  1125. width: 80rpx;
  1126. height: 80rpx;
  1127. display: flex;
  1128. align-items: center;
  1129. justify-content: center;
  1130. cursor: pointer;
  1131. margin-right: 20rpx;
  1132. flex-shrink: 0;
  1133. }
  1134. .calendar-bg {
  1135. position: absolute;
  1136. width: 88rpx;
  1137. height: 78rpx;
  1138. z-index: 1;
  1139. }
  1140. .day-text {
  1141. position: relative;
  1142. z-index: 2;
  1143. top: 5rpx;
  1144. }
  1145. .day-highlighted {
  1146. font-size: 38rpx;
  1147. font-weight: bold;
  1148. color: #FFBF60;
  1149. }
  1150. .day-normal {
  1151. color: #3E3A39;
  1152. font-size: 32rpx;
  1153. }
  1154. .month-group {
  1155. margin-bottom: 30rpx;
  1156. .month-title {
  1157. font-size: 32rpx;
  1158. color: #666;
  1159. margin-bottom: 20rpx;
  1160. }
  1161. .dates-wrapper {
  1162. display: inline-flex;
  1163. }
  1164. }
  1165. .scroll-view-vertical {
  1166. height: 100%;
  1167. }
  1168. .scroll-view-horizontal {
  1169. width: 100%;
  1170. white-space: nowrap;
  1171. }
  1172. .time-slots {
  1173. display: flex;
  1174. justify-content: space-around;
  1175. }
  1176. .time-slot-item {
  1177. display: flex;
  1178. flex-direction: column;
  1179. align-items: center;
  1180. width: 200rpx;
  1181. cursor: pointer;
  1182. }
  1183. .time-slot-icon {
  1184. width: 160rpx;
  1185. height: 160rpx;
  1186. margin-bottom: 10rpx;
  1187. }
  1188. .time-slot-info {
  1189. display: flex;
  1190. flex-direction: column;
  1191. align-items: center;
  1192. }
  1193. .time-slot-name {
  1194. font-size: 28rpx;
  1195. color: #333;
  1196. margin-bottom: 8rpx;
  1197. }
  1198. .time-slot-time {
  1199. font-size: 24rpx;
  1200. color: #666;
  1201. }
  1202. .time-slot-time-tip {
  1203. background-color: #FFECCD;
  1204. color: #A94F20;
  1205. margin-left: 10rpx;
  1206. padding: 5rpx 10rpx;
  1207. font-size: 20rpx;
  1208. }
  1209. .service-item {
  1210. margin-bottom: 20rpx;
  1211. /* 每个服务项之间的间距 */
  1212. }
  1213. .service-item-header {
  1214. display: flex;
  1215. align-items: center;
  1216. margin-bottom: 10rpx;
  1217. /* 标题与服务列表之间的间距 */
  1218. }
  1219. .service-icon {
  1220. width: 40rpx;
  1221. /* 图标大小 */
  1222. height: 40rpx;
  1223. /* 图标大小 */
  1224. margin-right: 10rpx;
  1225. /* 图标与标题之间的间距 */
  1226. }
  1227. .service-title {
  1228. font-size: 28rpx; /* 服务标题字体大小 */
  1229. font-weight: bold; /* 服务标题加粗 */
  1230. }
  1231. .service-row {
  1232. display: flex;
  1233. align-items: center;
  1234. /* 垂直居中对齐 */
  1235. flex-wrap: wrap;
  1236. background-color: #F9F9F9;
  1237. }
  1238. .service-row-content {
  1239. display: flex;
  1240. justify-content: space-between;
  1241. /* 每行的上下内边距 */
  1242. width: 100%;
  1243. padding: 32rpx 0rpx;
  1244. margin: 0 20rpx;
  1245. }
  1246. .service-name {
  1247. width: 50%;
  1248. white-space: nowrap;
  1249. overflow: hidden;
  1250. text-overflow: ellipsis;
  1251. font-size: 28rpx;
  1252. color: #333;
  1253. /* 服务名称颜色 */
  1254. }
  1255. .service-price {
  1256. display: flex;
  1257. align-items: center;
  1258. /* 垂直居中对齐 */
  1259. }
  1260. .service-count {
  1261. display: flex;
  1262. align-items: center;
  1263. /* 垂直居中对齐 */
  1264. margin-left: 10rpx;
  1265. /* 价格数量之间的间距 */
  1266. }
  1267. .price-details {
  1268. position: fixed;
  1269. /* 固定位置 */
  1270. bottom: 160rpx;
  1271. /* 根据需要调整位置 */
  1272. left: 0;
  1273. right: 0;
  1274. background: #FFF;
  1275. /* 背景颜色 */
  1276. padding: 10px 10px 0 10px;
  1277. /* 内边距 */
  1278. border-radius: 8rpx 8rpx 0 0;
  1279. /* 圆角 */
  1280. z-index: 1000;
  1281. /* 确保在其他元素之上 */
  1282. min-height: 600rpx;
  1283. /* 固定高度 */
  1284. overflow: hidden;
  1285. /* 隐藏超出部分 */
  1286. }
  1287. .price-details-header {
  1288. display: flex;
  1289. justify-content: space-between;
  1290. align-items: center;
  1291. }
  1292. .price-details-body {
  1293. margin-top: 10px;
  1294. max-height: 300rpx;
  1295. /* 留出头部空间 */
  1296. overflow-y: auto;
  1297. /* 允许上下滚动 */
  1298. }
  1299. .price-details-overlay {
  1300. position: fixed;
  1301. /* 固定位置 */
  1302. top: 0;
  1303. left: 0;
  1304. right: 0;
  1305. bottom: 0;
  1306. background: rgba(0, 0, 0, 0.5);
  1307. /* 半透明背景 */
  1308. z-index: 999;
  1309. /* 确保在其他元素之上 */
  1310. display: flex;
  1311. justify-content: center;
  1312. align-items: center;
  1313. }
  1314. .price-details-item {
  1315. display: flex;
  1316. justify-content: space-between;
  1317. margin-bottom: 20rpx;
  1318. .price-details-item-price-total {
  1319. display: flex;
  1320. width: 70%;
  1321. justify-content: flex-end;
  1322. flex-wrap: wrap;
  1323. }
  1324. .price-details-item-price-total-item {
  1325. color: #999999;
  1326. text-align: right;
  1327. font-size: 28rpx;
  1328. margin-right: 20rpx;
  1329. }
  1330. }
  1331. </style>