goodsDetails.vue 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  1. <template>
  2. <view>
  3. <view>
  4. <up-card
  5. title="志愿者介绍"
  6. :head-style="{ height: '80rpx', padding: '20rpx' }"
  7. >
  8. <template #body>
  9. <view class="card-container">
  10. <!-- 左侧图片 -->
  11. <image
  12. class="card-image"
  13. :src="listData.volunteerPicture"
  14. mode="aspectFill"
  15. ></image>
  16. <!-- 中间信息(姓名/类别等) -->
  17. <view class="card-info">
  18. <view class="info-item">姓名:{{ listData.name }}</view>
  19. <view class="info-item"
  20. >服务项目:{{ listData.businessTierName }}</view
  21. >
  22. <view v-if="serviceSubjectName != null" class="info-item"
  23. >类别:{{ listData.projectTypeName }}
  24. </view>
  25. <view class="Telephone"
  26. >服务时长:{{ listData.businessDuration }}</view
  27. >
  28. <view class="Telephone">电话:{{ listData.phonenumber }}</view>
  29. </view>
  30. <!-- 右上角评分 - 使用绝对定位 -->
  31. <view class="card-rating">4.5 评分</view>
  32. </view>
  33. </template>
  34. </up-card>
  35. <up-card
  36. title="技能介绍"
  37. :thumb="thumb"
  38. :head-style="{ height: '80rpx', padding: '20rpx' }"
  39. >
  40. <template #body>
  41. {{ listData.skillDescribe }}
  42. </template>
  43. </up-card>
  44. <up-card
  45. title="证书"
  46. :thumb="thumb"
  47. :head-style="{ height: '80rpx', padding: '20rpx' }"
  48. >
  49. <template #body>
  50. <view class="certificate">
  51. <image
  52. v-for="item in certificationPictures"
  53. :key="item"
  54. :src="item"
  55. mode=""
  56. style="width: 100%"
  57. class="certificate-img"
  58. ></image>
  59. </view>
  60. </template>
  61. </up-card>
  62. <!-- 固定底部按钮区 -->
  63. <view class="Wrap-btn">
  64. <uni-goods-nav
  65. :fill="true"
  66. :options="options"
  67. :buttonGroup="buttonGroup"
  68. @click="onClick"
  69. @buttonClick="buttonClick"
  70. />
  71. </view>
  72. </view>
  73. <!-- 底部第一层弹框 -->
  74. <view>
  75. <up-popup :show="show" @close="close" @open="open"> </up-popup>
  76. <up-popup v-model:show="show" @open="upPopupOpen">
  77. <view>
  78. <view class="Wrapper">
  79. <image src="/static/img/Location.png" class="Wrapper-img" />
  80. <span class="Wrapper-content">李四</span>
  81. <span class="Wrapper-content">重庆永川区</span>
  82. </view>
  83. <span style="margin-left: 15rpx; margin-top: 50rpx">重庆永川区</span>
  84. </view>
  85. <up-divider></up-divider>
  86. <view class="Wrap-content1">
  87. <up-avatar :src="src"></up-avatar>
  88. <text style="margin-top: 15rpx">¥{{ listData.businessPrice }}</text>
  89. </view>
  90. <view class="Wrap-info">
  91. <text style="margin-left: 10rpx">服务类别:</text>
  92. <up-text type="info" text="家庭教育"></up-text>
  93. </view>
  94. <view class="Wrap-content3">
  95. <text style="margin-left: 15rpx">服务周期:</text>
  96. <view style="margin-top: 25rpx">
  97. <uniDatetimePickerMy
  98. :modelValue="doorToDoorTime"
  99. :start="startDisabled"
  100. :end="endDisabled"
  101. type="daterange"
  102. ></uniDatetimePickerMy>
  103. </view>
  104. <view>
  105. <its-calendar
  106. v-if="show"
  107. :businessDuration="listData.businessDuration"
  108. :timeArr="doorToDoorTimeArr"
  109. :timeHostArr="timeHostArr"
  110. @getByDate="getByDate"
  111. @getByTime="getByTime"
  112. ></its-calendar>
  113. </view>
  114. </view>
  115. <view class="Wrap-content6">
  116. <text style="margin-left: 15rpx">备注:</text>
  117. <up-input
  118. placeholder="请输入内容"
  119. border="surround"
  120. v-model="remark"
  121. @change="change"
  122. ></up-input>
  123. </view>
  124. <view class="Wrap-detils-btn">
  125. <up-button
  126. type="primary"
  127. shape="circle"
  128. :customStyle="wrapqx"
  129. @click="handlCancel"
  130. >取消</up-button
  131. >
  132. <up-button
  133. type="error"
  134. shape="circle"
  135. :customStyle="wrapqx"
  136. @click="handleBuy"
  137. >
  138. 预约¥{{ computeMoney }}
  139. </up-button>
  140. </view>
  141. </up-popup>
  142. </view>
  143. <!-- 第二个弹框-->
  144. <up-popup v-model:show="showSecond">
  145. <view>
  146. <up-cell-group>
  147. <view
  148. @click="jumpToAddressSelect"
  149. style="display: flex; align-items: center; padding: 10px"
  150. >
  151. <up-icon name="more-dot-fill" size="16" />
  152. <view v-if="selectedAddress" style="margin-left: 8px; flex: 1">
  153. <view class="address-display">
  154. <text class="address-line">
  155. {{ selectedAddress.provinceName }}{{ selectedAddress.cityName
  156. }}{{ selectedAddress.districtName }}
  157. </text>
  158. <view class="contact-info">
  159. <text class="contact-name">{{ selectedAddress.name }}</text>
  160. <text class="contact-phone">{{
  161. selectedAddress.telephone
  162. }}</text>
  163. </view>
  164. </view>
  165. </view>
  166. <text v-else style="margin-left: 8px; font-size: 18px"
  167. >请选择服务地址</text
  168. >
  169. </view>
  170. <scroll-view scroll-y style="height: 460rpx">
  171. <view
  172. class="card-container"
  173. v-for="(item, index) in selectedTimes"
  174. :key="index"
  175. >
  176. <image
  177. class="card-image"
  178. :src="listData.volunteerPicture"
  179. mode="aspectFill"
  180. ></image>
  181. <view class="card-content">
  182. <view class="info-item"
  183. >服务项目:{{ listData.projectName }}</view
  184. >
  185. <view class="Telephone"
  186. >服务时长:{{ listData.businessDuration }}</view
  187. >
  188. <view class="date">日期:{{ item.date }}</view>
  189. <view class="time"> 时间:{{ item.time }} </view>
  190. </view>
  191. </view>
  192. </scroll-view>
  193. </up-cell-group>
  194. </view>
  195. <view class="Wrap-Payment">
  196. <!-- 支付金额 -->
  197. <view class="payment-header">
  198. <text class="payment-title">现在支付</text>
  199. <text class="payment-amount">¥{{ computeMoney }}</text>
  200. </view>
  201. <up-line></up-line>
  202. <!-- 钱包支付选项 -->
  203. <view class="payment-option">
  204. <view class="option-left">
  205. <image src="/static/钱包.png" class="payment-icon"></image>
  206. <text class="option-text">钱包</text>
  207. </view>
  208. <up-radio-group
  209. v-model="radiovalue1"
  210. placement="column"
  211. @change="handlePaymentMethodChange"
  212. >
  213. <up-radio
  214. :customStyle="{ marginLeft: 'auto' }"
  215. v-for="(item, index) in radiolist1"
  216. :key="index"
  217. :label="item.name"
  218. :name="item.name"
  219. ></up-radio>
  220. </up-radio-group>
  221. </view>
  222. <up-line></up-line>
  223. <!-- 微信支付选项 -->
  224. <view class="payment-option">
  225. <view class="option-left">
  226. <image src="/static/微信支付.png" class="payment-icon"></image>
  227. <text class="option-text">微信支付</text>
  228. </view>
  229. <up-radio-group
  230. v-model="radiovalue1"
  231. placement="column"
  232. @change="handlePaymentMethodChange"
  233. >
  234. <up-radio
  235. :customStyle="{ marginLeft: 'auto' }"
  236. v-for="(item, index) in radiolist2"
  237. :key="index"
  238. :label="item.name"
  239. :name="item.name"
  240. ></up-radio>
  241. </up-radio-group>
  242. </view>
  243. <up-line></up-line>
  244. <!-- 其他支付方式 -->
  245. <view class="other-payment"> 其他方式支付 > </view>
  246. <!-- 条款说明 -->
  247. <view class="terms-of-service">
  248. 我同意购买守则,取消政策和退款政策,我也同意支付以下所示的总金额(含服务费)。
  249. </view>
  250. </view>
  251. <view class="Wrap-detils-btn">
  252. <up-button
  253. type="primary"
  254. shape="circle"
  255. :customStyle="wrapqx"
  256. @click="closeSecond"
  257. >取消</up-button
  258. >
  259. <up-button
  260. type="error"
  261. shape="circle"
  262. :customStyle="wrapqx"
  263. @click="handlConfiRmpurchase"
  264. >
  265. 购买¥{{ computeMoney }}
  266. </up-button>
  267. </view>
  268. </up-popup>
  269. <view v-if="addressFlag" class="box">
  270. <addressComponent
  271. :modelValue="addressFlag"
  272. @update:modelValue="(val) => (addressFlag = val)"
  273. :addressInfo="addressInfo"
  274. @update:addressInfo="handleAddressUpdate"
  275. ></addressComponent>
  276. </view>
  277. </view>
  278. </template>
  279. <script setup>
  280. import { onLoad } from '@dcloudio/uni-app'
  281. import { onMounted, ref, reactive, computed } from 'vue'
  282. import {
  283. getDetailsvolunteerId,
  284. volunteerwork,
  285. volunteergetTimesByDate,
  286. ordersCreateOrder,
  287. coreUsersOrdersPayCancel,
  288. } from '@/api/volunteerDetailsApi/details.js'
  289. import itsCalendar from '@/components/its-calendar/its-calendar.vue'
  290. import uniDatetimePickerMy from '@/uni_modules/lic-uni-datetime-picker/components/lic-uni-datetime-picker/lic-uni-datetime-picker.vue'
  291. import addressComponent from '@/pages_home/components/volunteerSide/adresss.vue'
  292. const src = ref(
  293. 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg'
  294. )
  295. const businessPrice = ref() //价格
  296. const addressId = ref('') //用户下单地址
  297. const volunteerId = ref('') // 存储志愿者ID
  298. const serviceCategory = ref('') //存储大类别
  299. const businessManagementId = ref('') //具体分类id
  300. const doorToDoorTimeArr = ref([]) // 完整时间范围
  301. const doorToDoorTime = ref([]) // 只具备开始、结束 时间
  302. const timeHostArr = ref([]) // 时间段数组
  303. const currentDate = ref([]) // 点击过的年月日数组数据
  304. const currentTime = ref('') // 最后一次点击时间的时间节点
  305. const selectedTimes = ref([]) // 存储所有选择的时间对象
  306. const totalTimes = ref(0) // 时间点 点击的次数
  307. const startDisabled = ref('')
  308. const endDisabled = ref('')
  309. const time = ref('')
  310. const listData = ref({})
  311. const show = ref(false) //第一层弹框
  312. const showSecond = ref(false) //第二层弹框
  313. const showThird = ref(false) //第二层弹框
  314. const showSum = ref(false)
  315. const remark = ref('') //备注
  316. const radiovalue1 = ref('苹果')
  317. const selectedAddress = ref(null)
  318. const addressFlag = ref(false)
  319. const paymentMethod = ref(1) // Add payment method ref with default value 1 (wallet)
  320. const addressInfo = ref(null)
  321. // Radio 单选框数据
  322. const radiolist1 = reactive([
  323. {
  324. name: '钱包支付',
  325. disabled: false,
  326. },
  327. ])
  328. const radiolist2 = reactive([
  329. {
  330. name: '微信支付',
  331. disabled: false,
  332. },
  333. ])
  334. // 详情底部立即购买弹框
  335. const buttonClick = (e) => {
  336. show.value = true // 打开弹框
  337. }
  338. // 详情页第一层弹框
  339. function open() {
  340. show.value = true
  341. }
  342. // 第一层弹框取消
  343. function close() {
  344. // 关闭逻辑,设置 show 为 false
  345. show.value = false
  346. }
  347. // 第一个弹框逻辑
  348. const handleBuy = () => {
  349. show.value = false // 关闭第一个弹框
  350. showSecond.value = true // 打开第二个弹框
  351. }
  352. // 第二层弹框取消
  353. function closeSecond() {
  354. // 关闭逻辑,设置 show 为 false
  355. showSecond.value = false
  356. show.value = true // 打开第一个弹框
  357. }
  358. const handlCancel = () => {
  359. show.value = false // 关闭第一个弹框
  360. selectedTimes.value = [] // 清空已选时间
  361. totalTimes.value = 0 // 重置点击次数
  362. }
  363. const jumpToAddressSelect = () => {
  364. addressFlag.value = true
  365. }
  366. // 新增:处理子组件传回的地址数据
  367. const handleAddressUpdate = (newAddress) => {
  368. selectedAddress.value = newAddress
  369. addressFlag.value = false // 关闭选择器
  370. }
  371. // 详情底部底部数据
  372. const options = ref([
  373. {
  374. icon: 'headphones',
  375. text: '客服',
  376. },
  377. {
  378. icon: 'shop',
  379. text: '收藏',
  380. },
  381. ])
  382. // 详情底部立即购买样式
  383. const buttonGroup = ref([
  384. {
  385. text: '立即购买',
  386. backgroundColor: 'red',
  387. color: '#fff',
  388. },
  389. ])
  390. // 底部帮助客服方法
  391. const onClick = (e) => {
  392. uni.showToast({
  393. title: `点击${e.content.text}`,
  394. icon: 'none',
  395. })
  396. }
  397. // 修改详情页底部样式
  398. const customStyle = {
  399. height: '70rpx',
  400. paddingLeft: '30rpx',
  401. width: '540rpx',
  402. }
  403. const wrapqx = {
  404. // height: '70rpx',
  405. width: '240rpx',
  406. }
  407. // 获取传递的参数
  408. onLoad(async (options) => {
  409. const option = JSON.parse(decodeURIComponent(options.params))
  410. const {
  411. volunteerId: id,
  412. serviceCategory: categoy,
  413. businessManagementId: manage,
  414. } = option
  415. volunteerId.value = id
  416. serviceCategory.value = categoy
  417. businessManagementId.value = manage
  418. const res = await getDetailsvolunteerId({
  419. volunteerId: id,
  420. serviceCategory: categoy,
  421. businessManagementId: manage,
  422. })
  423. listData.value = res.data || {}
  424. businessPrice.value = listData.value.businessPrice || 0
  425. })
  426. // 选择日期
  427. const getListTime = async () => {
  428. const params = {
  429. volunteerId: Number(volunteerId.value),
  430. }
  431. const res = await volunteerwork(params)
  432. if (res.data && res.data.length > 0) {
  433. doorToDoorTimeArr.value = res.data
  434. const newRes = [res.data[0], res.data[res.data.length - 1]]
  435. doorToDoorTime.value = newRes
  436. startDisabled.value = doorToDoorTime.value[0]
  437. endDisabled.value = doorToDoorTime.value[1]
  438. // 默认加载第一个日期的排班时间
  439. getByDate(res.data[0])
  440. } else {
  441. console.error('接口返回的日期范围为空')
  442. doorToDoorTimeArr.value = []
  443. timeHostArr.value = [] // 清空时间段
  444. }
  445. }
  446. // 获取志愿者排班时间
  447. const getByDate = async (date = doorToDoorTimeArr.value[0]) => {
  448. // 检查日期是否为空
  449. if (!date) {
  450. coannsole.error('日期为空,跳过获取排班时间')
  451. return
  452. }
  453. if (!volunteerId.value) {
  454. console.error('volunteerId 为空')
  455. return
  456. }
  457. const params = {
  458. volunteerId: volunteerId.value,
  459. date,
  460. }
  461. try {
  462. const res = await volunteergetTimesByDate(params)
  463. const TArr = res.data.map((item) => {
  464. // 初始化disabled变量
  465. let disabled = false
  466. if (item.hasReservation === 1) disabled = true
  467. let itemTime =
  468. item.timeStamp > 9999999999 ? item.timeStamp : item.timeStamp * 1000
  469. if (new Date().getTime() > itemTime) disabled = true
  470. return {
  471. ...item,
  472. hours: item.reservationTime,
  473. timeStamp: new Date(`${date} ${item.reservationTime}`).getTime() / 1000,
  474. date: date,
  475. // checked: false, // 每次点击请求时间后,延续之前选中状态,不初始化选中
  476. disabled,
  477. }
  478. })
  479. // 如果 doorToDoorTimeArr.value 为空,直接返回
  480. if (!doorToDoorTimeArr.value.length) {
  481. console.error('可选的日期范围为空')
  482. return
  483. }
  484. // 填充时间段数组
  485. timeHostArr.value = Array(doorToDoorTimeArr.value.length).fill(TArr)
  486. } catch (error) {
  487. console.error('获取排班时间失败:', error)
  488. }
  489. }
  490. const getByTime = (timeObj) => {
  491. if (timeObj.clicked) {
  492. return
  493. }
  494. if (timeObj.checked) {
  495. // 选中 添加到已选时间数组
  496. selectedTimes.value.push({
  497. date: timeObj.date,
  498. time: timeObj.hours,
  499. timestamp: timeObj.timeStamp,
  500. })
  501. } else {
  502. // 取消选中
  503. const index = selectedTimes.value.findIndex(
  504. (item) => item.timestamp === timeObj.timeStamp
  505. )
  506. selectedTimes.value.splice(index, 1)
  507. }
  508. totalTimes.value = selectedTimes.value.length // 更新点击次数
  509. }
  510. // 立即购买显示时执行
  511. const upPopupOpen = () => {
  512. //显示时初始化预存储信息数据
  513. selectedTimes.value = []
  514. totalTimes.value = 0
  515. currentTime.value = ''
  516. currentDate.value = []
  517. // 初始化disabled/checked 数据状态
  518. getByDate()
  519. }
  520. const computeMoney = computed(() => {
  521. return totalTimes.value * businessPrice.value
  522. })
  523. // const computeClickTime = computed(() => {
  524. // let timeArr = []
  525. // let nyr = selectedTimes.value.map(item => {
  526. // return item.date
  527. // })
  528. // let nyrSet = Array.from(new Set(nyr)).map(item => {
  529. // return {
  530. // date: item,
  531. // timeArr: []
  532. // }
  533. // })
  534. // selectedTimes.value.forEach(item => {
  535. // nyrSet.forEach(i => {
  536. // if (item.date == i.date) i.timeArr.push(item.time)
  537. // })
  538. // })
  539. // return nyrSet
  540. // })
  541. const certificationPictures = computed(() => {
  542. if (listData.value.certificationPicture) {
  543. return listData.value.certificationPicture.split(',')
  544. }
  545. return []
  546. })
  547. // 确认购买
  548. const handlConfiRmpurchase = () => {
  549. if (!selectedAddress.value) {
  550. uni.showToast({
  551. title: '请选择服务地址',
  552. icon: 'none',
  553. duration: 2000,
  554. })
  555. return // 阻止购买
  556. }
  557. // 如果有地址,执行购买逻辑
  558. proceedToPayment()
  559. }
  560. const proceedToPayment = async () => {
  561. try {
  562. // 定义要发送的数据
  563. const orderData = {
  564. orders: {
  565. serviceOnePrice: businessPrice.value,
  566. serviceTotalPrice: computeMoney.value,
  567. serviceCategory: serviceCategory.value,
  568. totalTimes: totalTimes.value,
  569. serviceStartDate: '2025-04-18',
  570. startTime: '8:00',
  571. serviceDuration: 4,
  572. paymentMethod: paymentMethod.value,
  573. volunteerId: volunteerId.value,
  574. remark: remark.value,
  575. businessManagementId: businessManagementId.value,
  576. volunteerInfoId: listData.value.volunteerInfoId,
  577. addressId: selectedAddress.value.addressId,
  578. },
  579. workDateList: [],
  580. }
  581. // 转换所有选择的时间
  582. selectedTimes.value.forEach((item) => {
  583. orderData.workDateList.push({
  584. workDate: item.date,
  585. workStartTime: item.time,
  586. })
  587. })
  588. // 创建订单
  589. const res = await ordersCreateOrder(orderData)
  590. if (res.code !== 200) {
  591. throw new Error('创建订单失败')
  592. }
  593. // 保存订单号
  594. const mainOrderId = res.data.mainOrderId
  595. console.log('创建订单成功,订单号:', mainOrderId)
  596. // 如果是微信支付
  597. if (paymentMethod.value === 2) {
  598. return new Promise((resolve, reject) => {
  599. uni.requestPayment({
  600. ...res.data,
  601. package: res.data.packageValue,
  602. success: (payRes) => {
  603. console.log('支付成功:', payRes)
  604. if (payRes.errMsg === 'requestPayment:ok') {
  605. uni.showToast({
  606. title: '支付成功',
  607. icon: 'success',
  608. duration: 1500,
  609. mask: true,
  610. })
  611. setTimeout(() => {
  612. uni.reLaunch({
  613. url: '/pages/index',
  614. })
  615. }, 1500)
  616. resolve(payRes)
  617. }
  618. },
  619. fail: async (payRes) => {
  620. console.log('支付失败或取消:', payRes)
  621. try {
  622. // 调用取消支付接口
  623. const cancelRes = await coreUsersOrdersPayCancel({ mainOrderId })
  624. console.log('取消支付接口调用成功:', cancelRes)
  625. if (payRes.errMsg === 'requestPayment:fail cancel') {
  626. uni.showToast({
  627. title: '已取消支付',
  628. icon: 'none',
  629. duration: 1500,
  630. mask: true,
  631. })
  632. } else {
  633. uni.showToast({
  634. title: '支付失败',
  635. icon: 'error',
  636. duration: 1500,
  637. mask: true,
  638. })
  639. }
  640. reject(payRes)
  641. } catch (error) {
  642. console.error('取消支付接口调用失败:', error)
  643. uni.showToast({
  644. title: '取消支付失败',
  645. icon: 'error',
  646. duration: 1500,
  647. mask: true,
  648. })
  649. reject(error)
  650. }
  651. }
  652. })
  653. })
  654. }
  655. } catch (error) {
  656. console.error('支付失败:', error)
  657. uni.showToast({
  658. title: '支付失败余额不足',
  659. icon: 'error',
  660. duration: 1500,
  661. mask: true,
  662. })
  663. }
  664. }
  665. // 修改支付方式
  666. const handlePaymentMethodChange = (value) => {
  667. if (value === '钱包支付') {
  668. paymentMethod.value = 1
  669. } else if (value === '微信支付') {
  670. paymentMethod.value = 2
  671. }
  672. }
  673. onMounted(async () => {
  674. await getListTime()
  675. })
  676. </script>
  677. <style scoped>
  678. /* 添加卡片样式 */
  679. .card-container {
  680. display: flex;
  681. padding: 20rpx;
  682. margin: 10rpx;
  683. background-color: #fff;
  684. border-radius: 10rpx;
  685. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
  686. }
  687. .card-image {
  688. width: 120rpx;
  689. height: 120rpx;
  690. border-radius: 10rpx;
  691. margin-right: 20rpx;
  692. }
  693. .card-content {
  694. flex: 1;
  695. display: flex;
  696. flex-direction: column;
  697. justify-content: space-between;
  698. }
  699. .info-item,
  700. .Telephone,
  701. .date,
  702. .time {
  703. font-size: 26rpx;
  704. margin-bottom: 8rpx;
  705. }
  706. .box {
  707. height: 100vh;
  708. width: 100vw;
  709. position: fixed;
  710. top: 0;
  711. left: 0;
  712. z-index: 999999;
  713. background: red;
  714. }
  715. .card-container {
  716. display: flex;
  717. position: relative;
  718. padding: 20rpx;
  719. align-items: flex-start;
  720. background-color: #fff;
  721. border-radius: 12rpx;
  722. }
  723. /* 左侧图片 */
  724. .card-image {
  725. width: 240rpx;
  726. height: 340rpx;
  727. border-radius: 12rpx;
  728. margin-right: 30rpx;
  729. flex-shrink: 0;
  730. }
  731. /* 中间信息区域 */
  732. .card-info {
  733. flex: 1;
  734. padding-right: 100rpx;
  735. }
  736. .Telephone {
  737. white-space: nowrap;
  738. margin-bottom: 24rpx;
  739. font-size: 28rpx;
  740. line-height: 1.6;
  741. color: #333;
  742. }
  743. .info-item {
  744. margin-bottom: 24rpx;
  745. font-size: 28rpx;
  746. line-height: 1.6;
  747. color: #333;
  748. }
  749. /* 右上角评分 */
  750. .card-rating {
  751. position: absolute;
  752. top: 20rpx;
  753. right: 20rpx;
  754. background-color: #f8f8f8;
  755. padding: 6rpx 16rpx;
  756. border-radius: 20rpx;
  757. font-size: 24rpx;
  758. color: #ff9900;
  759. font-weight: bold;
  760. }
  761. /* 固定在页面底部 */
  762. .Wrap-btn {
  763. /* display: flex; */
  764. /* justify-content: flex-end; */
  765. /* align-items: center; */
  766. position: fixed;
  767. bottom: 0;
  768. width: 100%;
  769. background-color: white;
  770. padding: 40rpx 20rpx;
  771. box-shadow: -2rpx 5rpx rgba(0, 0, 0, 0.1);
  772. }
  773. .Wrapper {
  774. display: flex;
  775. align-items: center;
  776. gap: 10rpx;
  777. margin-top: 10rpx;
  778. }
  779. .Wrapper-img {
  780. width: 50rpx;
  781. height: 50rpx;
  782. margin-left: 10rpx;
  783. }
  784. .Wrapper-content {
  785. color: rgba(16, 16, 16, 1);
  786. font-size: 25rpx;
  787. font-family: PingFangSC-regular;
  788. line-height: 20rpx;
  789. }
  790. .Wrap-content1 {
  791. display: flex;
  792. justify-content: flex-start;
  793. margin-left: 10rpx;
  794. margin-top: 10rpx;
  795. }
  796. .Wrap-info {
  797. display: flex;
  798. justify-content: flex-start;
  799. margin-left: 10rpx;
  800. margin-top: 25rpx;
  801. }
  802. .Wrap-content3 {
  803. margin-top: 25rpx;
  804. }
  805. .Wrap-content4 {
  806. margin-top: 25rpx;
  807. }
  808. .Wrap-content5 {
  809. display: flex;
  810. justify-content: flex-start;
  811. margin-left: 10rpx;
  812. margin-top: 25rpx;
  813. }
  814. .Wrap-content6 {
  815. margin-top: 25rpx;
  816. }
  817. .Wrap-detils-btn {
  818. display: flex;
  819. justify-content: flex-end;
  820. align-items: center;
  821. margin-top: 25rpx;
  822. /* position: fixed;
  823. bottom: 0;
  824. width: 100%;
  825. background-color: white;
  826. padding: 40rpx 20rpx;
  827. box-shadow: -2rpx 5rpx rgba(0, 0, 0, 0.1); */
  828. }
  829. .Wrap-Payment {
  830. padding: 30rpx;
  831. background-color: #fff;
  832. }
  833. .payment-header {
  834. display: flex;
  835. justify-content: space-between;
  836. align-items: center;
  837. padding: 20rpx 0;
  838. }
  839. .payment-title {
  840. font-size: 32rpx;
  841. font-weight: bold;
  842. }
  843. .payment-amount {
  844. font-size: 36rpx;
  845. color: #ff4d4f;
  846. font-weight: bold;
  847. }
  848. .payment-option {
  849. display: flex;
  850. justify-content: space-between;
  851. align-items: center;
  852. padding: 30rpx 0;
  853. }
  854. .option-left {
  855. display: flex;
  856. align-items: center;
  857. }
  858. .payment-icon {
  859. width: 80rpx;
  860. height: 80rpx;
  861. margin-right: 20rpx;
  862. }
  863. .option-text {
  864. font-size: 30rpx;
  865. font-weight: bold;
  866. }
  867. .other-payment {
  868. padding: 30rpx 0;
  869. color: #1890ff;
  870. font-size: 28rpx;
  871. }
  872. .terms-of-service {
  873. padding: 30rpx 0;
  874. font-size: 24rpx;
  875. color: #999;
  876. line-height: 1.5;
  877. }
  878. .confirm-button {
  879. margin-top: 40rpx;
  880. }
  881. .certificate {
  882. display: flex;
  883. flex-direction: column;
  884. }
  885. .certificate-img {
  886. margin-bottom: 24rpx;
  887. }
  888. /* 第二层弹框 */
  889. .card-container {
  890. display: flex;
  891. flex-direction: row;
  892. align-items: flex-start;
  893. padding: 10px;
  894. }
  895. .card-image {
  896. width: 100px;
  897. /* Adjust as needed */
  898. height: 100px;
  899. /* Adjust as needed */
  900. border-radius: 8px;
  901. margin-right: 15px;
  902. object-fit: cover;
  903. }
  904. .card-content {
  905. flex: 1;
  906. display: flex;
  907. flex-direction: column;
  908. }
  909. .info-item,
  910. .Telephone,
  911. .date,
  912. .time {
  913. margin-bottom: 5px;
  914. font-size: 14px;
  915. color: #333;
  916. }
  917. .time span {
  918. margin-right: 8px;
  919. }
  920. .address-line {
  921. font-size: 14px;
  922. line-height: 20rpx;
  923. /* 行高20rpx */
  924. color: #333;
  925. /* 深色文字 */
  926. display: block;
  927. /* 确保独占一行 */
  928. margin-bottom: 30rpx;
  929. /* 下边距30rpx */
  930. }
  931. /* 联系人信息容器 */
  932. .contact-info {
  933. display: flex;
  934. gap: 20rpx;
  935. /* 姓名和电话之间的间距 */
  936. }
  937. /* 姓名样式 */
  938. .contact-name {
  939. font-size: 12px;
  940. color: #999;
  941. /* 灰色文字 */
  942. line-height: 20rpx;
  943. }
  944. /* 电话样式 */
  945. .contact-phone {
  946. font-size: 12px;
  947. color: #999;
  948. /* 灰色文字 */
  949. line-height: 20rpx;
  950. }
  951. </style>