goodsDetails.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068
  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. // 如果是钱包支付
  656. if (paymentMethod.value === 1) {
  657. uni.showToast({
  658. title: '支付成功',
  659. icon: 'success',
  660. duration: 1500,
  661. mask: true,
  662. })
  663. setTimeout(() => {
  664. uni.reLaunch({
  665. url: '/pages/classify'
  666. })
  667. }, 1500)
  668. }
  669. } catch (error) {
  670. console.error('支付失败:', error)
  671. uni.showToast({
  672. title: '支付失败余额不足',
  673. icon: 'error',
  674. duration: 1500,
  675. mask: true,
  676. })
  677. }
  678. }
  679. // 修改支付方式
  680. const handlePaymentMethodChange = (value) => {
  681. if (value === '钱包支付') {
  682. paymentMethod.value = 1
  683. } else if (value === '微信支付') {
  684. paymentMethod.value = 2
  685. }
  686. }
  687. onMounted(async () => {
  688. await getListTime()
  689. })
  690. </script>
  691. <style scoped>
  692. /* 添加卡片样式 */
  693. .card-container {
  694. display: flex;
  695. padding: 20rpx;
  696. margin: 10rpx;
  697. background-color: #fff;
  698. border-radius: 10rpx;
  699. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
  700. }
  701. .card-image {
  702. width: 120rpx;
  703. height: 120rpx;
  704. border-radius: 10rpx;
  705. margin-right: 20rpx;
  706. }
  707. .card-content {
  708. flex: 1;
  709. display: flex;
  710. flex-direction: column;
  711. justify-content: space-between;
  712. }
  713. .info-item,
  714. .Telephone,
  715. .date,
  716. .time {
  717. font-size: 26rpx;
  718. margin-bottom: 8rpx;
  719. }
  720. .box {
  721. height: 100vh;
  722. width: 100vw;
  723. position: fixed;
  724. top: 0;
  725. left: 0;
  726. z-index: 999999;
  727. background: red;
  728. }
  729. .card-container {
  730. display: flex;
  731. position: relative;
  732. padding: 20rpx;
  733. align-items: flex-start;
  734. background-color: #fff;
  735. border-radius: 12rpx;
  736. }
  737. /* 左侧图片 */
  738. .card-image {
  739. width: 240rpx;
  740. height: 340rpx;
  741. border-radius: 12rpx;
  742. margin-right: 30rpx;
  743. flex-shrink: 0;
  744. }
  745. /* 中间信息区域 */
  746. .card-info {
  747. flex: 1;
  748. padding-right: 100rpx;
  749. }
  750. .Telephone {
  751. white-space: nowrap;
  752. margin-bottom: 24rpx;
  753. font-size: 28rpx;
  754. line-height: 1.6;
  755. color: #333;
  756. }
  757. .info-item {
  758. margin-bottom: 24rpx;
  759. font-size: 28rpx;
  760. line-height: 1.6;
  761. color: #333;
  762. }
  763. /* 右上角评分 */
  764. .card-rating {
  765. position: absolute;
  766. top: 20rpx;
  767. right: 20rpx;
  768. background-color: #f8f8f8;
  769. padding: 6rpx 16rpx;
  770. border-radius: 20rpx;
  771. font-size: 24rpx;
  772. color: #ff9900;
  773. font-weight: bold;
  774. }
  775. /* 固定在页面底部 */
  776. .Wrap-btn {
  777. /* display: flex; */
  778. /* justify-content: flex-end; */
  779. /* align-items: center; */
  780. position: fixed;
  781. bottom: 0;
  782. width: 100%;
  783. background-color: white;
  784. padding: 40rpx 20rpx;
  785. box-shadow: -2rpx 5rpx rgba(0, 0, 0, 0.1);
  786. }
  787. .Wrapper {
  788. display: flex;
  789. align-items: center;
  790. gap: 10rpx;
  791. margin-top: 10rpx;
  792. }
  793. .Wrapper-img {
  794. width: 50rpx;
  795. height: 50rpx;
  796. margin-left: 10rpx;
  797. }
  798. .Wrapper-content {
  799. color: rgba(16, 16, 16, 1);
  800. font-size: 25rpx;
  801. font-family: PingFangSC-regular;
  802. line-height: 20rpx;
  803. }
  804. .Wrap-content1 {
  805. display: flex;
  806. justify-content: flex-start;
  807. margin-left: 10rpx;
  808. margin-top: 10rpx;
  809. }
  810. .Wrap-info {
  811. display: flex;
  812. justify-content: flex-start;
  813. margin-left: 10rpx;
  814. margin-top: 25rpx;
  815. }
  816. .Wrap-content3 {
  817. margin-top: 25rpx;
  818. }
  819. .Wrap-content4 {
  820. margin-top: 25rpx;
  821. }
  822. .Wrap-content5 {
  823. display: flex;
  824. justify-content: flex-start;
  825. margin-left: 10rpx;
  826. margin-top: 25rpx;
  827. }
  828. .Wrap-content6 {
  829. margin-top: 25rpx;
  830. }
  831. .Wrap-detils-btn {
  832. display: flex;
  833. justify-content: flex-end;
  834. align-items: center;
  835. margin-top: 25rpx;
  836. /* position: fixed;
  837. bottom: 0;
  838. width: 100%;
  839. background-color: white;
  840. padding: 40rpx 20rpx;
  841. box-shadow: -2rpx 5rpx rgba(0, 0, 0, 0.1); */
  842. }
  843. .Wrap-Payment {
  844. padding: 30rpx;
  845. background-color: #fff;
  846. }
  847. .payment-header {
  848. display: flex;
  849. justify-content: space-between;
  850. align-items: center;
  851. padding: 20rpx 0;
  852. }
  853. .payment-title {
  854. font-size: 32rpx;
  855. font-weight: bold;
  856. }
  857. .payment-amount {
  858. font-size: 36rpx;
  859. color: #ff4d4f;
  860. font-weight: bold;
  861. }
  862. .payment-option {
  863. display: flex;
  864. justify-content: space-between;
  865. align-items: center;
  866. padding: 30rpx 0;
  867. }
  868. .option-left {
  869. display: flex;
  870. align-items: center;
  871. }
  872. .payment-icon {
  873. width: 80rpx;
  874. height: 80rpx;
  875. margin-right: 20rpx;
  876. }
  877. .option-text {
  878. font-size: 30rpx;
  879. font-weight: bold;
  880. }
  881. .other-payment {
  882. padding: 30rpx 0;
  883. color: #1890ff;
  884. font-size: 28rpx;
  885. }
  886. .terms-of-service {
  887. padding: 30rpx 0;
  888. font-size: 24rpx;
  889. color: #999;
  890. line-height: 1.5;
  891. }
  892. .confirm-button {
  893. margin-top: 40rpx;
  894. }
  895. .certificate {
  896. display: flex;
  897. flex-direction: column;
  898. }
  899. .certificate-img {
  900. margin-bottom: 24rpx;
  901. }
  902. /* 第二层弹框 */
  903. .card-container {
  904. display: flex;
  905. flex-direction: row;
  906. align-items: flex-start;
  907. padding: 10px;
  908. }
  909. .card-image {
  910. width: 100px;
  911. /* Adjust as needed */
  912. height: 100px;
  913. /* Adjust as needed */
  914. border-radius: 8px;
  915. margin-right: 15px;
  916. object-fit: cover;
  917. }
  918. .card-content {
  919. flex: 1;
  920. display: flex;
  921. flex-direction: column;
  922. }
  923. .info-item,
  924. .Telephone,
  925. .date,
  926. .time {
  927. margin-bottom: 5px;
  928. font-size: 14px;
  929. color: #333;
  930. }
  931. .time span {
  932. margin-right: 8px;
  933. }
  934. .address-line {
  935. font-size: 14px;
  936. line-height: 20rpx;
  937. /* 行高20rpx */
  938. color: #333;
  939. /* 深色文字 */
  940. display: block;
  941. /* 确保独占一行 */
  942. margin-bottom: 30rpx;
  943. /* 下边距30rpx */
  944. }
  945. /* 联系人信息容器 */
  946. .contact-info {
  947. display: flex;
  948. gap: 20rpx;
  949. /* 姓名和电话之间的间距 */
  950. }
  951. /* 姓名样式 */
  952. .contact-name {
  953. font-size: 12px;
  954. color: #999;
  955. /* 灰色文字 */
  956. line-height: 20rpx;
  957. }
  958. /* 电话样式 */
  959. .contact-phone {
  960. font-size: 12px;
  961. color: #999;
  962. /* 灰色文字 */
  963. line-height: 20rpx;
  964. }
  965. </style>