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.

1418 lines
43 KiB

1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week 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="buyInfo.teacher">指定喂养员 - {{buyInfo.teacher.userName}}</text>
  10. <text v-else>系统派单</text>
  11. </text>
  12. </view>
  13. <view style="margin-top: 10rpx;">
  14. <text v-if="buyInfo.teacher" 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. },
  374. mounted() {
  375. this.currentPets = this.$globalData.newOrderData.currentPets;
  376. if(this.currentPets.length<1){
  377. uni.reLaunch({
  378. url: '/pages/index'
  379. });
  380. return
  381. }
  382. if(this.$globalData.mainSku&&this.$globalData.mainSku[0]){
  383. this.basePrice = this.$globalData.mainSku[0].price
  384. this.baseProduct = this.$globalData.mainSku[0].name
  385. }
  386. this.getProductList()
  387. },
  388. watch: {
  389. currentPetId: {
  390. immediate: true,
  391. handler(newId) {
  392. if (newId) {
  393. this.updateGroupedDates()
  394. }
  395. }
  396. }
  397. },
  398. methods: {
  399. initNewOrderData(){
  400. const needPreFamiliarize=this.$globalData.newOrderData.needPreFamiliarize.length>0
  401. const pets=[]
  402. // 初始化当前宠物全日期保持一致
  403. this.currentPets = this.currentPets.map(pet=>{
  404. pet.isAllSame = false
  405. return pet
  406. })
  407. this.currentPets.map(pet=>{
  408. // 单个宠物服务日期列表
  409. const serviceDateList = pet.selectedDate.map(item => item.date)
  410. serviceDateList.forEach(date => {
  411. pets.push({
  412. petId: pet.id,
  413. serviceDate: date,
  414. name: pet.name,
  415. gender: pet.gender,
  416. petType: pet.petType,
  417. bodyType:pet.bodyType,
  418. photo: pet.photo,
  419. feedCount: 1,
  420. selectedTimeSlots: [],
  421. customServices: [],
  422. //额外费用
  423. additionalCost: 0
  424. })
  425. })
  426. })
  427. this.newOrderData = {
  428. needPreFamiliarize: needPreFamiliarize, // 是否需要提前熟悉 40元/次 参与计算
  429. pets: pets
  430. }
  431. // 默认选择第一个宠物
  432. this.selectPet(this.currentPets[0] || {})
  433. this.calculateTotalPrice()
  434. },
  435. // 选择宠物
  436. selectPet(pet) {
  437. this.currentPetId = pet.id
  438. // 默认选择当前宠物的最小日期
  439. if (pet.selectedDate?.length > 1) {
  440. const minDate = pet.selectedDate.reduce((min, date) => {
  441. const currentDate = new Date(date.date);
  442. const minDate = new Date(min.date);
  443. return currentDate < minDate ? date : min;
  444. }, pet.selectedDate[0]);
  445. // 当前选择日期
  446. this.currentMonthDay = {
  447. petId: this.currentPetId,
  448. date: new Date(minDate.date).getDate(),
  449. fullDate: minDate.date
  450. }
  451. } else {
  452. this.currentMonthDay = {
  453. petId: this.currentPetId,
  454. date: new Date(pet.selectedDate[0].date).getDate(),
  455. fullDate: pet.selectedDate[0].date
  456. }
  457. }
  458. this.getCurrentPetIsAllSame()
  459. this.selectDate(this.currentMonthDay)
  460. },
  461. selectDate(day) {
  462. // 当前选择日期
  463. this.currentMonthDay = day
  464. const selectedDay = this.selectedDates?.find(item => item.fullDate === day.fullDate && item
  465. .currentPetId === day.petId)
  466. if (!selectedDay) {
  467. this.selectedDates.push(day)
  468. }
  469. // 还原当前选择日期是否已选择期望时间
  470. const pets = this.newOrderData?.pets
  471. const selectedPet = pets.find(pet => pet.petId === this.currentPetId && pet.serviceDate === this
  472. .currentMonthDay.fullDate);
  473. const selectedTimeSlots = selectedPet ? selectedPet.selectedTimeSlots : [];
  474. if(selectedTimeSlots.length > 0){
  475. this.timeSlots.forEach(slot=>{
  476. if(selectedTimeSlots.includes(slot.id)){
  477. slot.selected = true
  478. } else {
  479. slot.selected = false
  480. }
  481. })
  482. } else {
  483. this.timeSlots.forEach(slot => {
  484. slot.selected = false
  485. })
  486. }
  487. // 还原当前选择日期喂食次数
  488. this.feedCount = selectedPet ? selectedPet.feedCount : 1
  489. // 还原当前选择日期是否已选择定制服务
  490. this.customServices = selectedPet.customServices.length > 0 ? selectedPet.customServices : JSON.parse(this.customServicesStr)
  491. this.getCurrentDayPrice(this.currentMonthDay.fullDate)
  492. },
  493. isDateSelected(day) {
  494. const selectedDay = this.selectedDates.find(item => item.fullDate === day.fullDate && this.currentPetId ===
  495. item.petId)
  496. if (selectedDay) {
  497. return true
  498. }
  499. return false
  500. },
  501. isCurrentSelected(day){
  502. return this.currentMonthDay.fullDate === day.fullDate && this.currentPetId === day.petId
  503. },
  504. updateGroupedDates() {
  505. const currentPet = this.currentPets.find(pet => pet.id === this.currentPetId)
  506. if (!currentPet) return
  507. // 按月份分组日期
  508. const grouped = currentPet.selectedDate.reduce((acc, dateObj) => {
  509. const date = new Date(dateObj.date)
  510. const monthKey = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`
  511. const monthLabel = `${date.getFullYear()}${date.getMonth() + 1}`
  512. if (!acc[monthKey]) {
  513. acc[monthKey] = {
  514. monthLabel,
  515. dates: []
  516. }
  517. }
  518. acc[monthKey].dates.push({
  519. petId: currentPet.id,
  520. date: date.getDate(),
  521. fullDate: dateObj.date
  522. })
  523. return acc
  524. }, {})
  525. // 转换为数组并排序
  526. this.groupedDates = Object.values(grouped).sort((a, b) => {
  527. return a.monthLabel.localeCompare(b.monthLabel)
  528. })
  529. },
  530. selectTimeSlot(slotId) {
  531. const slot = this.timeSlots.find(slot => slot.id === slotId)
  532. if (slot) {
  533. slot.selected = !slot.selected
  534. }
  535. // 将期望时间添加到当前宠物
  536. const selectedTimeSlots = this.timeSlots.filter(slot => slot.selected)
  537. if(this.isAllSame){
  538. // 如果保持一致,则更新该宠物所有期望时间
  539. this.newOrderData.pets.forEach(pet=>{
  540. pet.selectedTimeSlots=selectedTimeSlots.map(item => item.id)
  541. })
  542. } else{
  543. const currentPetIndex = this.newOrderData.pets.findIndex(pet => pet.petId === this.currentPetId
  544. && pet.serviceDate === this.currentMonthDay.fullDate)
  545. if (currentPetIndex !== -1) {
  546. this.newOrderData.pets[currentPetIndex].selectedTimeSlots = selectedTimeSlots.map(item => item.id)
  547. }
  548. }
  549. },
  550. feedCountChange(e){
  551. this.feedCount = e.value
  552. if(this.isAllSame){
  553. // 如果保持一致,则更新该宠物的喂食次数
  554. this.newOrderData.pets.forEach(pet=>{
  555. if(pet.petId === this.currentPetId){
  556. pet.feedCount=this.feedCount
  557. }
  558. })
  559. } else {
  560. const pets = this.newOrderData.pets
  561. const currentPetIndex = pets.findIndex(pet => pet.petId === this.currentPetId && pet.serviceDate ===
  562. this.currentMonthDay.fullDate)
  563. if (currentPetIndex !== -1) {
  564. this.newOrderData.pets[currentPetIndex].feedCount = this.feedCount
  565. }
  566. }
  567. this.calculateTotalPrice()
  568. },
  569. customServiceCountChange(val) {
  570. console.log(val)
  571. this.customServices.forEach(item=>{
  572. if(item.name === val.name){
  573. item.quantity = val.value
  574. }
  575. })
  576. if(this.isAllSame){
  577. // 如果保持一致,则更新当前宠物的定制服务次数
  578. this.newOrderData.pets.forEach(pet=>{
  579. if(pet.petId === this.currentPetId){
  580. pet.customServices= JSON.parse(JSON.stringify(this.customServices))
  581. }
  582. })
  583. } else {
  584. const pets = this.newOrderData.pets
  585. const currentPetIndex = pets.findIndex(pet => pet.petId === this.currentPetId && pet.serviceDate ===
  586. this.currentMonthDay.fullDate)
  587. if (currentPetIndex !== -1) {
  588. this.newOrderData.pets[currentPetIndex].customServices = JSON.parse(JSON.stringify(this
  589. .customServices))
  590. }
  591. }
  592. this.calculateTotalPrice()
  593. },
  594. togglePriceDetails() {
  595. this.showPriceDetails = !this.showPriceDetails; // 切换价格明细的显示状态
  596. if (this.showPriceDetails) {
  597. this.priceDetailDate()
  598. }
  599. },
  600. calculateTotalPrice() {
  601. // 1. 订单维度:是否需要提前熟悉
  602. if(this.$globalData.newOrderData.needPreFamiliarize && this.$globalData.newOrderData.needPreFamiliarize.length>0){
  603. this.needPreFamiliarizeCost = 40
  604. }else{
  605. this.needPreFamiliarizeCost = 0
  606. }
  607. // 2. 日期维度
  608. // 2.1 基础服务费用
  609. const uniqueDates = new Set(this.newOrderData.pets.map(item => item.serviceDate)); // 去重日期
  610. this.baseServiceTotalCost = uniqueDates.size * this.basePrice; // 每个唯一日期75元
  611. // 2.2 额外宠物费用
  612. // petType为dog 且bodyType包含 '大型' 则为大型犬,40元/次
  613. // petType为dog 且bodyType包含 '中型' 则为中型犬,30元/次
  614. // petType为dog 且bodyType包含 '小型' 则为小型犬,15元/次
  615. // petType为cat 则为猫,10元/次
  616. this.newOrderData.pets.forEach(pet => {
  617. if (pet.petType === 'dog' && pet.bodyType.includes('大型')) {
  618. pet.additionalCost = 40
  619. } else if (pet.petType === 'dog' && pet.bodyType.includes('中型')) {
  620. pet.additionalCost = 30
  621. } else if (pet.petType === 'dog' && pet.bodyType.includes('小型')) {
  622. pet.additionalCost = 15
  623. } else if (pet.petType === 'cat') {
  624. pet.additionalCost = 10
  625. }
  626. })
  627. // const largeDogArray = this.newOrderData.pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('大型'));
  628. // this.additionalTotalCost = this.additionalTotalCost + (largeDogArray.length * 40)
  629. // // 非大型犬
  630. // const otherPets = this.newOrderData.pets.filter(pet => pet.petType !== 'dog' && !pet.bodyType.includes('大型'));
  631. // 宠物日期分组
  632. const dailyPets = [];
  633. // 按日期分组宠物
  634. this.newOrderData.pets.forEach(pet => {
  635. const serviceDate = pet.serviceDate;
  636. if (!dailyPets[serviceDate]) {
  637. dailyPets[serviceDate] = [];
  638. }
  639. dailyPets[serviceDate].push(pet);
  640. });
  641. const petTypeCounts = []
  642. let additionalTotalCost = 0
  643. // 计算每日额外宠物费用
  644. for (const date in dailyPets) {
  645. const pets = dailyPets[date];
  646. const largeDogCount = pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('大型')).length;
  647. let mediumDogCount = pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('中型')).length;
  648. let smallDogCount = pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('小型')).length;
  649. let catCount = pets.filter(pet => pet.petType === 'cat').length;
  650. let additionalCost = 0
  651. // 总宠物费用
  652. let totalPetCost = pets.reduce((acc, pet) => {
  653. return acc + this.calculatePetCost(pet);
  654. }, 0);
  655. // 如果总宠物费用>30
  656. if (totalPetCost > 30) {
  657. // 如果猫数量>=3
  658. if (catCount >= 3) {
  659. additionalCost = totalPetCost - 30
  660. catCount = catCount - 3
  661. } else if (smallDogCount >= 2) {
  662. additionalCost = totalPetCost - 30
  663. smallDogCount = smallDogCount - 2
  664. } else if (mediumDogCount >= 1) {
  665. additionalCost = totalPetCost - 30
  666. mediumDogCount = mediumDogCount - 1
  667. } else {
  668. additionalCost = totalPetCost - 25
  669. catCount = catCount - 1
  670. smallDogCount = smallDogCount - 1
  671. }
  672. petTypeCounts.push({
  673. date,
  674. largeDogCount,
  675. mediumDogCount,
  676. smallDogCount,
  677. catCount
  678. })
  679. }
  680. // 如果有大型犬,额外费用为40元/只
  681. if (largeDogCount > 0) {
  682. additionalCost += (40 * largeDogCount)
  683. }
  684. // 如果有额外费用,添加到总额外费用
  685. if (additionalCost > 0) {
  686. additionalTotalCost += additionalCost;
  687. }
  688. }
  689. this.additionalTotalCost = additionalTotalCost
  690. this.petTypeCounts = petTypeCounts
  691. // 2.3 当日多次服务总价
  692. // 计算每日多次服务次数费用
  693. let multServicesTotalCost = 0
  694. let oneDayTwoTimesDates = []
  695. let oneDayThreeTimesDates = []
  696. for (const date in dailyPets) {
  697. const maxFeedCount = Math.max(...dailyPets[date].map(pet => pet.feedCount));
  698. if (maxFeedCount === 2) {
  699. multServicesTotalCost += 45; // 1天2次
  700. oneDayTwoTimesDates.push(date)
  701. } else if (maxFeedCount === 3) {
  702. multServicesTotalCost += 130; // 1天3次
  703. oneDayThreeTimesDates.push(date)
  704. }
  705. }
  706. this.oneDayTwoTimesDates = oneDayTwoTimesDates
  707. this.oneDayThreeTimesDates = oneDayThreeTimesDates
  708. this.multServicesTotalCost = multServicesTotalCost
  709. // 3. 定制服务
  710. //定制服务单项总次数统计
  711. const customServiceItemCount = JSON.parse(this.customServicesStr)
  712. let customServicesTotalCost = 0
  713. this.newOrderData.pets.forEach(pet => {
  714. const customServices = pet.customServices
  715. // 定制服务费用
  716. customServices.forEach(service=>{
  717. const itemIndex = customServiceItemCount.findIndex(item=>item.name === service.name)
  718. if(itemIndex !== -1){
  719. customServiceItemCount[itemIndex].quantity += service.quantity
  720. }
  721. customServicesTotalCost += service.price * service.quantity;
  722. })
  723. });
  724. this.customServiceItemCount = customServiceItemCount
  725. this.customServicesTotalCost = customServicesTotalCost
  726. this.totalPrice = this.needPreFamiliarizeCost
  727. + this.baseServiceTotalCost
  728. + this.additionalTotalCost
  729. + this.multServicesTotalCost
  730. + this.customServicesTotalCost; // 更新总价
  731. this.getCurrentDayPrice(this.currentMonthDay.fullDate)
  732. },
  733. calculatePetCost(pet) {
  734. // 宠物额外费用 不计算大型犬
  735. let petCost = 0;
  736. if (pet.petType === 'cat') {
  737. petCost += 10; // 猫额外费用
  738. } else if (pet.petType === 'dog' && pet.bodyType.includes('小型')) {
  739. petCost += 15; // 小型犬额外费用
  740. } else if (pet.petType === 'dog' && pet.bodyType.includes('中型')) {
  741. petCost += 30; // 中型犬额外费用
  742. }
  743. return petCost;
  744. },
  745. goNext() {
  746. this.calculateTotalPrice(); // 计算总价
  747. this.showPriceDetails = false;
  748. this.$globalData.newOrderData.currentPetsByDay = this.newOrderData.pets
  749. this.$globalData.newOrderData.totalPrice = this.totalPrice
  750. uni.navigateTo({
  751. url: '/pages/newOrder/confirmOrder'
  752. });
  753. },
  754. goBack() {
  755. this.showPriceDetails = false
  756. let len = getCurrentPages().length;
  757. this.loading = false
  758. if (len >= 2) {
  759. uni.navigateBack();
  760. } else {
  761. uni.redirectTo({
  762. url: '/pages/newOrder/serviceNew'
  763. });
  764. }
  765. },
  766. // 价格明细数据
  767. priceDetailDate() {
  768. const priceDetails = []
  769. if (this.newOrderData.needPreFamiliarize) {
  770. priceDetails.push({
  771. name: '提前熟悉',
  772. item: [{
  773. itemName: '提前熟悉',
  774. price: 40,
  775. quantity: this.newOrderData.needPreFamiliarize ? 1 : 0,
  776. unit: '次'
  777. }, ]
  778. })
  779. }
  780. const uniqueDateCount = new Set(this.newOrderData.pets.map(item => item.serviceDate)).size; // 去重日期
  781. if(uniqueDateCount>1){
  782. priceDetails.push({ name: this.baseProduct, item: [
  783. { itemName: this.baseProduct, price:this.basePrice, quantity: uniqueDateCount, unit: '天' },
  784. ]})
  785. }
  786. if (this.oneDayTwoTimesDates.length > 0 || this.oneDayThreeTimesDates.length > 0) {
  787. priceDetails.push({
  788. name: '上门次数',
  789. item: [{
  790. itemName: '1天2次',
  791. price: 45,
  792. quantity: this.oneDayTwoTimesDates.length,
  793. unit: '天'
  794. },
  795. {
  796. itemName: '1天3次',
  797. price: 130,
  798. quantity: this.oneDayThreeTimesDates.length,
  799. unit: '天'
  800. },
  801. ]
  802. })
  803. }
  804. // 过滤宠物类型数量>0的数组
  805. const additionalCostItem = []
  806. const petTypeArr = this.petTypeCounts.filter(item => item.largeDogCount > 0 || item.mediumDogCount > 0 ||
  807. item.smallDogCount > 0 || item.catCount > 0)
  808. // 假设largeDogCount=1 mediumDogCount=2 smallDogCount=3 catCount=4 则生成4条数据
  809. petTypeArr.forEach(item => {
  810. if (item.largeDogCount > 0) {
  811. additionalCostItem.push({
  812. itemName: '大型犬',
  813. price: 40,
  814. quantity: item.largeDogCount,
  815. unit: '只',
  816. date: item.date
  817. })
  818. }
  819. if (item.mediumDogCount > 0) {
  820. additionalCostItem.push({
  821. itemName: '中型犬',
  822. price: 30,
  823. quantity: item.mediumDogCount,
  824. unit: '只',
  825. date: item.date
  826. })
  827. }
  828. if (item.smallDogCount > 0) {
  829. additionalCostItem.push({
  830. itemName: '小型犬',
  831. price: 15,
  832. quantity: item.smallDogCount,
  833. unit: '只',
  834. date: item.date
  835. })
  836. }
  837. if (item.catCount > 0) {
  838. additionalCostItem.push({
  839. itemName: '猫猫',
  840. price: 10,
  841. quantity: item.catCount,
  842. unit: '只',
  843. date: item.date
  844. })
  845. }
  846. })
  847. // 按日期先后顺序排序
  848. additionalCostItem.sort((a, b) => new Date(a.date) - new Date(b.date))
  849. if (additionalCostItem.length > 0) {
  850. priceDetails.push({
  851. name: '额外宠物费用',
  852. item: additionalCostItem
  853. })
  854. }
  855. const customServiceItem = this.customServiceItemCount.filter(item=>item.quantity>0).map(service=>{
  856. return { itemName: service.name, price: service.price, quantity: service.quantity, unit: '次' }
  857. })
  858. if (customServiceItem.length > 0) {
  859. priceDetails.push({
  860. name: '定制服务',
  861. item: customServiceItem
  862. })
  863. }
  864. this.priceDetails = priceDetails
  865. this.calculateTotalPrice()
  866. },
  867. showName(item) {
  868. return item.item.some(item2 => item2.quantity > 0)
  869. },
  870. isAllSameChange(e) {
  871. if (e) {
  872. this.isAllSame = true
  873. this.setCurrentPetIsAllSame()
  874. // 当前宠物全日期保持一致
  875. this.newOrderData.pets.forEach(pet=>{
  876. if(pet.petId === this.currentPetId){
  877. pet.selectedTimeSlots = this.timeSlots.filter(slot => slot.selected).map(item => item.id)
  878. pet.feedCount = this.feedCount
  879. pet.customServices = this.customServices
  880. }
  881. })
  882. this.calculateTotalPrice()
  883. } else {
  884. this.isAllSame = false
  885. this.setCurrentPetIsAllSame()
  886. }
  887. },
  888. getProductList() {
  889. getProductList({
  890. "publishStatus": 1,
  891. "categoryId": 78,
  892. "needSku": true
  893. }).then(response => {
  894. if (response && response.content && response.content.length > 0) {
  895. this.customServices = response.content.map(item=>{
  896. const skus = item.skus
  897. if(skus && skus.length>0){
  898. let productSku = {
  899. "skuId": skus[0].id,
  900. "price":skus[0].price,
  901. "name":item.name,
  902. "quantity": 0,
  903. "isMainProduct":false
  904. }
  905. return productSku
  906. }
  907. })
  908. this.customServicesStr = JSON.stringify(this.customServices)
  909. // 初始化新订单数据
  910. this.initNewOrderData()
  911. }else {
  912. uni.showToast('获取主产品失败,请联系管理员')
  913. }
  914. console.log(response);
  915. })
  916. },
  917. login() {
  918. uni.login({
  919. provider: 'weixin',
  920. success: (loginRes) => {
  921. this.getOpenId(loginRes.code)
  922. },
  923. fail: function(error) {
  924. // 授权失败处理
  925. uni.showToast('授权失败,请授权后再试')
  926. }
  927. });
  928. },
  929. getOpenId(code) {
  930. getOpenId(code).then(res => {
  931. if (res.code == 200 && res.data) {
  932. let resData = JSON.parse(res.data)
  933. let token = resData.token;
  934. let openId = resData.openId;
  935. setOpenIdKey(openId)
  936. if(token){
  937. setToken(token)
  938. }
  939. }
  940. })
  941. },
  942. getCurrentDayPrice(currentDay){
  943. const currentDayPets = this.newOrderData.pets.filter(pet => pet.serviceDate === currentDay)
  944. // 基础服务
  945. const baseServiceCost = this.basePrice
  946. const largeDogCount = currentDayPets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('大型')).length;
  947. let mediumDogCount = currentDayPets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('中型')).length;
  948. let smallDogCount = currentDayPets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('小型')).length;
  949. let catCount = currentDayPets.filter(pet => pet.petType === 'cat').length;
  950. const additionalCostItem = []
  951. let additionalCost = 0
  952. // 单天总宠物费用
  953. let totalPetCost = currentDayPets.reduce((acc, pet) => {
  954. return acc + this.calculatePetCost(pet);
  955. }, 0);
  956. // 如果总宠物费用>30
  957. if(totalPetCost>30){
  958. // 如果猫数量>=3,则免3只猫
  959. if (catCount >= 3) {
  960. additionalCost = totalPetCost - 30
  961. catCount = catCount-3
  962. }else if (smallDogCount >= 2) { // 如果小型犬数量>=2,则免2只小型犬
  963. additionalCost = totalPetCost - 30
  964. smallDogCount = smallDogCount-2
  965. }else if(mediumDogCount >= 1) { // 如果中型犬数量>=1,则免1只中型犬
  966. additionalCost = totalPetCost - 30
  967. mediumDogCount = mediumDogCount-1
  968. }else{
  969. additionalCost = totalPetCost - 25
  970. catCount = catCount - 1
  971. smallDogCount = smallDogCount - 1
  972. }
  973. if(largeDogCount>0){
  974. additionalCostItem.push({ itemName: '大型犬', price: 40, quantity: largeDogCount, unit: '只'})
  975. }
  976. if(mediumDogCount>0){
  977. additionalCostItem.push({ itemName: '中型犬', price: 30, quantity: mediumDogCount, unit: '只'})
  978. }
  979. if(smallDogCount>0){
  980. additionalCostItem.push({ itemName: '小型犬', price: 15, quantity: smallDogCount, unit: '只'})
  981. }
  982. if(catCount>0){
  983. additionalCostItem.push({ itemName: '猫猫', price: 10, quantity: catCount, unit: '只'})
  984. }
  985. }
  986. // 如果有大型犬,额外费用为40元/只
  987. if (largeDogCount > 0) {
  988. additionalCost +=(40 * largeDogCount)
  989. }
  990. // 当日多次服务次数
  991. let multServicesTotalCost = 0
  992. const maxFeedCount = Math.max(...currentDayPets.map(pet => pet.feedCount));
  993. if (maxFeedCount === 2) {
  994. multServicesTotalCost += 45; // 1天2次
  995. } else if (maxFeedCount === 3) {
  996. multServicesTotalCost += 130; // 1天3次
  997. }
  998. // 所有宠物定制服务费用
  999. const customServiceCost = currentDayPets.reduce((acc, pet) => acc + this.calculatePetCustomServiceCost(pet), 0)
  1000. const totalCost = baseServiceCost + additionalCost + multServicesTotalCost + customServiceCost
  1001. this.currentDayPrice = totalCost
  1002. },
  1003. calculatePetCustomServiceCost(pet) {
  1004. const customServiceCost = pet.customServices.reduce((acc, item) => acc + item.price * item.quantity, 0)
  1005. return customServiceCost
  1006. },
  1007. getCurrentPetName(){
  1008. const currentPet = this.currentPets.find(pet=>pet.id === this.currentPetId)
  1009. return currentPet.name
  1010. },
  1011. setCurrentPetIsAllSame(){
  1012. const currentPet = this.currentPets.find(pet=>pet.id === this.currentPetId)
  1013. currentPet.isAllSame=this.isAllSame
  1014. },
  1015. getCurrentPetIsAllSame(){
  1016. const currentPet = this.currentPets.find(pet=>pet.id === this.currentPetId)
  1017. this.isAllSame = currentPet.isAllSame
  1018. },
  1019. },
  1020. computed: {
  1021. sortedGroupedDates() {
  1022. return this.groupedDates.sort((a, b) => {
  1023. const dateA = new Date(a.monthLabel.replace('年', '-').replace('月', '-01'))
  1024. const dateB = new Date(b.monthLabel.replace('年', '-').replace('月', '-01'))
  1025. return dateA - dateB
  1026. })
  1027. }
  1028. }
  1029. }
  1030. </script>
  1031. <style scoped lang="less">
  1032. .container {
  1033. position: relative;
  1034. height: 100%;
  1035. padding-bottom: 160rpx;
  1036. .details-subscribe {
  1037. background-color: #FFFFFF;
  1038. padding: 10px;
  1039. width: 100%;
  1040. height: 160rpx;
  1041. position: fixed;
  1042. bottom: 0;
  1043. z-index: 100;
  1044. .details-btn {
  1045. width: 100%;
  1046. border-radius: 6px;
  1047. background: #FFB13F;
  1048. font-size: 16px;
  1049. color: #FFFFFF;
  1050. }
  1051. }
  1052. }
  1053. .service-new {
  1054. .service-new-flag {
  1055. width: 8rpx;
  1056. height: 32rpx;
  1057. background: #FFBF60;
  1058. border-radius: 30rpx 30rpx 30rpx 30rpx;
  1059. margin-right: 10rpx;
  1060. }
  1061. .split-line {
  1062. width: 100%;
  1063. height: 1rpx;
  1064. background: #EFEFEF;
  1065. }
  1066. .service-new-title {
  1067. display: flex;
  1068. font-weight: 500;
  1069. font-size: 28rpx;
  1070. color: #333333;
  1071. line-height: 33rpx;
  1072. margin: 42rpx 0 30rpx;
  1073. justify-content: space-between;
  1074. .service-new-title-left {
  1075. display: flex;
  1076. align-items: center;
  1077. }
  1078. }
  1079. .service-new-pet-content{
  1080. padding: 20rpx 0;
  1081. }
  1082. .service-new-pet-item {
  1083. height: 96rpx;
  1084. width: 184rpx;
  1085. border-radius: 8rpx;
  1086. padding: 0 20rpx;
  1087. margin-right: 40rpx;
  1088. display: flex;
  1089. align-items: center;
  1090. justify-content: center;
  1091. font-size: 28rpx;
  1092. flex-shrink: 0;
  1093. }
  1094. .scroll-content {
  1095. display: inline-flex;
  1096. }
  1097. .scroll-view {
  1098. width: 100%;
  1099. white-space: nowrap;
  1100. }
  1101. .pet-selected {
  1102. background: #FFBF60;
  1103. color: #FFFFFF;
  1104. }
  1105. .pet-unselect {
  1106. background: #F5F5F7;
  1107. color: #7D8196;
  1108. }
  1109. }
  1110. .calendar-wrapper {
  1111. display: flex;
  1112. gap: 20rpx;
  1113. padding: 20rpx;
  1114. }
  1115. .scroll-view {
  1116. width: 100%;
  1117. white-space: nowrap;
  1118. }
  1119. .calendar-day {
  1120. position: relative;
  1121. width: 80rpx;
  1122. height: 80rpx;
  1123. display: flex;
  1124. align-items: center;
  1125. justify-content: center;
  1126. cursor: pointer;
  1127. margin-right: 20rpx;
  1128. flex-shrink: 0;
  1129. }
  1130. .calendar-bg {
  1131. position: absolute;
  1132. width: 88rpx;
  1133. height: 78rpx;
  1134. z-index: 1;
  1135. }
  1136. .day-text {
  1137. position: relative;
  1138. z-index: 2;
  1139. top: 5rpx;
  1140. }
  1141. .day-highlighted {
  1142. font-size: 38rpx;
  1143. font-weight: bold;
  1144. color: #FFBF60;
  1145. }
  1146. .day-normal {
  1147. color: #3E3A39;
  1148. font-size: 32rpx;
  1149. }
  1150. .month-group {
  1151. margin-bottom: 30rpx;
  1152. .month-title {
  1153. font-size: 32rpx;
  1154. color: #666;
  1155. margin-bottom: 20rpx;
  1156. }
  1157. .dates-wrapper {
  1158. display: inline-flex;
  1159. }
  1160. }
  1161. .scroll-view-vertical {
  1162. height: 100%;
  1163. }
  1164. .scroll-view-horizontal {
  1165. width: 100%;
  1166. white-space: nowrap;
  1167. }
  1168. .time-slots {
  1169. display: flex;
  1170. justify-content: space-around;
  1171. }
  1172. .time-slot-item {
  1173. display: flex;
  1174. flex-direction: column;
  1175. align-items: center;
  1176. width: 200rpx;
  1177. cursor: pointer;
  1178. }
  1179. .time-slot-icon {
  1180. width: 160rpx;
  1181. height: 160rpx;
  1182. margin-bottom: 10rpx;
  1183. }
  1184. .time-slot-info {
  1185. display: flex;
  1186. flex-direction: column;
  1187. align-items: center;
  1188. }
  1189. .time-slot-name {
  1190. font-size: 28rpx;
  1191. color: #333;
  1192. margin-bottom: 8rpx;
  1193. }
  1194. .time-slot-time {
  1195. font-size: 24rpx;
  1196. color: #666;
  1197. }
  1198. .time-slot-time-tip {
  1199. background-color: #FFECCD;
  1200. color: #A94F20;
  1201. margin-left: 10rpx;
  1202. padding: 5rpx 10rpx;
  1203. font-size: 20rpx;
  1204. }
  1205. .service-item {
  1206. margin-bottom: 20rpx;
  1207. /* 每个服务项之间的间距 */
  1208. }
  1209. .service-item-header {
  1210. display: flex;
  1211. align-items: center;
  1212. margin-bottom: 10rpx;
  1213. /* 标题与服务列表之间的间距 */
  1214. }
  1215. .service-icon {
  1216. width: 40rpx;
  1217. /* 图标大小 */
  1218. height: 40rpx;
  1219. /* 图标大小 */
  1220. margin-right: 10rpx;
  1221. /* 图标与标题之间的间距 */
  1222. }
  1223. .service-title {
  1224. font-size: 28rpx; /* 服务标题字体大小 */
  1225. font-weight: bold; /* 服务标题加粗 */
  1226. }
  1227. .service-row {
  1228. display: flex;
  1229. align-items: center;
  1230. /* 垂直居中对齐 */
  1231. flex-wrap: wrap;
  1232. background-color: #F9F9F9;
  1233. }
  1234. .service-row-content {
  1235. display: flex;
  1236. justify-content: space-between;
  1237. /* 每行的上下内边距 */
  1238. width: 100%;
  1239. padding: 32rpx 0rpx;
  1240. margin: 0 20rpx;
  1241. }
  1242. .service-name {
  1243. width: 50%;
  1244. white-space: nowrap;
  1245. overflow: hidden;
  1246. text-overflow: ellipsis;
  1247. font-size: 28rpx;
  1248. color: #333;
  1249. /* 服务名称颜色 */
  1250. }
  1251. .service-price {
  1252. display: flex;
  1253. align-items: center;
  1254. /* 垂直居中对齐 */
  1255. }
  1256. .service-count {
  1257. display: flex;
  1258. align-items: center;
  1259. /* 垂直居中对齐 */
  1260. margin-left: 10rpx;
  1261. /* 价格数量之间的间距 */
  1262. }
  1263. .price-details {
  1264. position: fixed;
  1265. /* 固定位置 */
  1266. bottom: 160rpx;
  1267. /* 根据需要调整位置 */
  1268. left: 0;
  1269. right: 0;
  1270. background: #FFF;
  1271. /* 背景颜色 */
  1272. padding: 10px 10px 0 10px;
  1273. /* 内边距 */
  1274. border-radius: 8rpx 8rpx 0 0;
  1275. /* 圆角 */
  1276. z-index: 1000;
  1277. /* 确保在其他元素之上 */
  1278. min-height: 600rpx;
  1279. /* 固定高度 */
  1280. overflow: hidden;
  1281. /* 隐藏超出部分 */
  1282. }
  1283. .price-details-header {
  1284. display: flex;
  1285. justify-content: space-between;
  1286. align-items: center;
  1287. }
  1288. .price-details-body {
  1289. margin-top: 10px;
  1290. max-height: 300rpx;
  1291. /* 留出头部空间 */
  1292. overflow-y: auto;
  1293. /* 允许上下滚动 */
  1294. }
  1295. .price-details-overlay {
  1296. position: fixed;
  1297. /* 固定位置 */
  1298. top: 0;
  1299. left: 0;
  1300. right: 0;
  1301. bottom: 0;
  1302. background: rgba(0, 0, 0, 0.5);
  1303. /* 半透明背景 */
  1304. z-index: 999;
  1305. /* 确保在其他元素之上 */
  1306. display: flex;
  1307. justify-content: center;
  1308. align-items: center;
  1309. }
  1310. .price-details-item {
  1311. display: flex;
  1312. justify-content: space-between;
  1313. margin-bottom: 20rpx;
  1314. .price-details-item-price-total {
  1315. display: flex;
  1316. width: 70%;
  1317. justify-content: flex-end;
  1318. flex-wrap: wrap;
  1319. }
  1320. .price-details-item-price-total-item {
  1321. color: #999999;
  1322. text-align: right;
  1323. font-size: 28rpx;
  1324. margin-right: 20rpx;
  1325. }
  1326. }
  1327. </style>