details.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. <template>
  2. <view class="details">
  3. <view class="detail-content">
  4. <view class="swiper_cont">
  5. <!-- <template> -->
  6. <zg-swiper :list="swipeList" mode="solt" :autoplay="false" class="custom-swiper">
  7. </zg-swiper>
  8. <!-- </template> -->
  9. <text class="Tips">图片仅供参考</text>
  10. </view>
  11. <view class="qin">
  12. <view class="nameCollect">
  13. <view class="name"><text class="line"></text> {{details.cNickName}} <text>/{{details.cNickName}}</text></view>
  14. <view class="collect" v-if="details.isCollection" @click="cancleCollect(details.id)">
  15. <image src="../../static/identify/collect2.png" mode="" /> 取消收藏
  16. </view>
  17. <!-- <view class="collect" v-else @click="addCollect(details.id)">
  18. <image src="../../static/identify/collect1.png" mode="" />
  19. 加入收藏
  20. </view> -->
  21. <view class="jieshao">{{details.cJianjie}}</view>
  22. </view>
  23. </view>
  24. <view class="service">
  25. 服务履约保障
  26. </view>
  27. <view class="three">
  28. <view>
  29. <image src="../../static/identify/approve.png" mode=""></image>实名认证
  30. </view>
  31. <view>
  32. <image src="../../static/identify/approve.png" mode="">爽约包赔
  33. </view>
  34. <view @click="goApprove(details.id)">
  35. <image src="../../static/identify/approve.png" mode="">商户认证
  36. <!-- <image src="../../static/identify/more.png" mode=""></image> -->
  37. </view>
  38. </view>
  39. </view>
  40. <view class="server">
  41. <view class="tab">
  42. <text class="Tips" :class=" checkedIndex === 0 ? 'active' : '' " @click="switchTab(0)">服务内容</text>
  43. <text class="Tips" :class=" checkedIndex === 1 ? 'active' : '' " @click="switchTab(1)">顾客评价</text>
  44. </view>
  45. <view class="tab_content">
  46. <view class="tab-pane" :class="checkedIndex === 0 ? 'active' : ''">
  47. <view class="lists" v-for="(item,index) in projects" :key="index">
  48. <view class="imgs">
  49. <image :src="$globalData.publicUrl + item.cCover" mode="" />
  50. </view>
  51. <view class="right">
  52. <view class="list_title">
  53. <!-- {{item.cTitle}} -->
  54. <view class="name"> {{item.cTitle}} </view>
  55. <!-- <view class="time">{{item.nMinute}}分钟</view> -->
  56. <view class="price">
  57. <span>¥</span>{{item.dPrice}}
  58. </view>
  59. </view>
  60. <view class="num">
  61. {{item.cLdList}}
  62. <span>超{{item.nSaleNumber}}人选择</span>
  63. </view>
  64. <view class="time">
  65. <view class="money">{{item.nMinute}}分钟</view>
  66. <view class="counter">
  67. <!-- <view @click="decrease(item,index)">-</view> -->
  68. <view class="minus" @click="decrease(index)">
  69. <image src="../../static/identify/minus.png" mode="" />
  70. </view>
  71. <text>{{item.number}}</text>
  72. <view class="minus" @click="increase(index)">
  73. <image src="../../static/identify/add.png" mode="" />
  74. </view>
  75. <!-- <view @click="increase(index)">+</view> -->
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="tab-pane " :class="checkedIndex === 1 ? 'active' : ''">
  82. <view v-if="comList < 1" style="text-align: center;padding:50rpx 0;font-size: 28rpx;color: #ccc;">暂无评价
  83. </view>
  84. <view v-else>
  85. <view class="commentList" v-for="(item,index) in comList" :key="index">
  86. <view class="cTitile">
  87. <view class="tt">{{item.cNickName}}
  88. </view>
  89. <view class="time">{{item.dTime.substring(0,10)}} {{item.dTime.substring(11,19)}}</view>
  90. </view>
  91. <view class="img">
  92. <image src="../../static/identify/collect2.png" mode=""></image>
  93. <image src="../../static/identify/collect2.png" mode=""></image>
  94. <image src="../../static/identify/collect2.png" mode=""></image>
  95. <image src="../../static/identify/collect2.png" mode=""></image>
  96. <image src="../../static/identify/collect2.png" mode=""></image>
  97. </view>
  98. <view class="cText">{{item.cText}}</view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. <view class="reserved">
  105. <view @click="nowYuyue(details.id,details.nStatus)">立即预约</view>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. import ZgSwiper from '@/components/zhuge-swiper/zhuge-swiper'
  111. import {
  112. engineerDetails,
  113. addOrder,
  114. addCollect,
  115. cancleCollect
  116. } from '../../api/index.js'
  117. export default {
  118. components: {
  119. ZgSwiper,
  120. },
  121. data() {
  122. return {
  123. details: '',
  124. indicatorDots: true,
  125. autoplay: true,
  126. projects: [],
  127. collectShow: true,
  128. checkedIndex: 0,
  129. comList: [],
  130. public: this.$globalData.publicUrl, //图片前缀
  131. swiper: [],
  132. swipeList: []
  133. }
  134. },
  135. methods: {
  136. switchTab(index) {
  137. if (this.checkedIndex === index) {
  138. return false;
  139. } else {
  140. this.checkedIndex = index
  141. }
  142. },
  143. //查看认证信息
  144. goApprove(id) {
  145. uni.navigateTo({
  146. url: './approve_data?id=' + id
  147. })
  148. },
  149. //立即预约
  150. nowYuyue(id, nStatus) {
  151. if (nStatus === 1) {
  152. uni.showToast({
  153. title: '该商户不可预约!',
  154. icon: 'none'
  155. })
  156. return
  157. } else {
  158. const allCountsZero = this.projects.every(item => item.number === 0);
  159. if (allCountsZero) {
  160. uni.showToast({
  161. title: '请先选择项目!',
  162. duration: 1000,
  163. icon: 'none',
  164. })
  165. return
  166. } else {
  167. // console.log(this.data.projects,"project")
  168. var list = []
  169. this.projects.forEach(element => {
  170. if (element.number > 0) {
  171. element.sum = element.number * element.dPrice
  172. list.push(element)
  173. }
  174. });
  175. var total = 0
  176. for (let i = 0; i < list.length; i++) {
  177. total += list[i].sum;
  178. }
  179. var data = {
  180. cJsId: this.details.id,
  181. cGoods: list,
  182. cOpenId: uni.getStorageSync('wx_copenid'),
  183. dTotalMoney: total,
  184. }
  185. addOrder(data).then(res => {
  186. if (res.data.code == 200) {
  187. uni.navigateTo({
  188. url: './pay_order?orderNo=' + res.data.data.orderNo,
  189. })
  190. } else {
  191. uni.showModal({
  192. title: '提示',
  193. content: '你还没有添加地址哦!是否去添加?',
  194. confirmText: '确定', // 确定按钮的文字
  195. cancelText: '取消', // 取消按钮的文字
  196. success(res) {
  197. if (res.confirm) {
  198. setTimeout(() => {
  199. uni.navigateTo({
  200. url: '../my/add_address?type=1'
  201. })
  202. }, 100)
  203. // 用户点击确定按钮后的操作
  204. } else if (res.cancel) {
  205. console.log('用户点击取消');
  206. }
  207. }
  208. })
  209. }
  210. })
  211. }
  212. }
  213. },
  214. getDetails(cid) {
  215. this.swiper = []
  216. const cId = {
  217. id: cid,
  218. cOpenId: uni.getStorageSync('wx_copenid')
  219. }
  220. engineerDetails(cId).then(res => {
  221. if (res.data.data) {
  222. if(res.data.data.cVideo){
  223. this.swiper.push(res.data.data.cVideo)
  224. }
  225. res.data.data.cImgList.forEach(item => {
  226. this.swiper.push(this.public + item)
  227. })
  228. console.log(this.swiper)
  229. if(this.swiper){
  230. this.swipeList = this.swiper.map(item => {
  231. const isVideo = item.endsWith('.mp4');
  232. return {
  233. // image: isVideo ? '' : item, // 图片直接使用
  234. // video: isVideo ? item : '', // 视频链接
  235. src: item,
  236. poster: isVideo ?this.public +res.data.data.cImgList[0]: item.image, // 视频封面(需替换)
  237. type: isVideo ? 'video' : 'image'
  238. };
  239. });
  240. }
  241. var prolist = res.data.data.projects
  242. prolist.forEach(element => {
  243. element.number = 0
  244. });
  245. this.details = res.data.data
  246. this.projects = prolist
  247. if (res.data.data.comments) {
  248. this.comList = res.data.data.comments.slice(0, 3)
  249. } else {
  250. this.comList = []
  251. }
  252. }
  253. })
  254. },
  255. // 添加收藏
  256. addCollect(id) {
  257. var data = {
  258. cJsId: id,
  259. cWxOpenId: uni.getStorageSync('wx_copenid')
  260. }
  261. addCollect(data).then(res => {
  262. if (res.data.code == 200) {
  263. wx.showToast({
  264. title: '收藏成功!',
  265. icon: 'none'
  266. })
  267. this.getDetails(id);
  268. } else {
  269. uni.showToast({
  270. title: res.data.msg,
  271. icon: 'none'
  272. })
  273. }
  274. })
  275. },
  276. // 取消收藏
  277. cancleCollect(id) {
  278. var data = {
  279. cJsId: id,
  280. cWxOpenId: wx.getStorageSync('wx_copenid')
  281. }
  282. cancleCollect(data).then(res => {
  283. if (res.data.code == 200) {
  284. wx.showToast({
  285. title: '取消成功!',
  286. icon: 'none'
  287. })
  288. this.getDetails(id);
  289. } else {
  290. wx.showToast({
  291. title: res.data.msg,
  292. icon: 'none'
  293. })
  294. }
  295. })
  296. },
  297. increase(idx) {
  298. this.projects[idx].number++;
  299. },
  300. decrease(idx) {
  301. if (this.projects[idx].number > 0) this.projects[idx].number--;
  302. else return;
  303. },
  304. },
  305. onLoad(options) {
  306. this.getDetails(options.id)
  307. }
  308. }
  309. </script>
  310. <style lang="scss" scoped>
  311. ::v-deep .u-swiper-wrap {
  312. height: 100% !important;
  313. uni-swiper {
  314. height: 100% !important;
  315. }
  316. }
  317. .custom-swiper {
  318. height: 100px; /* 或者你需要的具体高度 */
  319. }
  320. .swiper-image {
  321. width: 100%;
  322. height: 100%;
  323. object-fit: cover; /* 保持宽高比并填充整个容器 */
  324. /* 或者使用 object-fit: contain; 保持完整图片显示 */
  325. }
  326. .details {
  327. background-color: #F7FFFF;
  328. padding: 24rpx;
  329. }
  330. .title {
  331. position: fixed;
  332. top: 0;
  333. left: 0;
  334. width: 100%;
  335. background-color: #2cb8d4;
  336. .titles {
  337. text-align: center;
  338. color: #fff;
  339. font-size: 28rpx;
  340. padding: 10rpx 0;
  341. }
  342. .back {
  343. position: absolute;
  344. left: 30rpx;
  345. width: 80rpx;
  346. height: 35rpx;
  347. image {
  348. width: 18rpx;
  349. height: 100%;
  350. }
  351. }
  352. }
  353. .detail-content {
  354. // height: 100vh;
  355. overflow-y: scroll;
  356. padding: 24rpx;
  357. background-color: #fff;
  358. swiper {
  359. height: 600rpx;
  360. }
  361. .swiper_cont {
  362. width: 100%;
  363. height: 638rpx;
  364. // background-color: rgb(233, 231, 231);
  365. position: relative;
  366. .swiper-item {
  367. display: flex;
  368. justify-content: center;
  369. align-items: center;
  370. height: 600rpx !important;
  371. image {
  372. max-width: 100%;
  373. max-height: 100%;
  374. display: block;
  375. height: 600rpx;
  376. }
  377. }
  378. .Tips {
  379. position: absolute;
  380. top: 10px;
  381. left: 10px;
  382. font-size: 18rpx;
  383. color: #808080;
  384. }
  385. }
  386. .qin {
  387. width: 100%;
  388. margin-top: 24rpx;
  389. .nameCollect {
  390. width: 100%;
  391. empty-cells: 100%;
  392. .name {
  393. width: 100%;
  394. font-size: 32rpx;
  395. font-weight: bold;
  396. margin-bottom: 15rpx;
  397. color: #2F3437;
  398. .line {
  399. display: inline-block;
  400. width: 6rpx;
  401. height: 34rpx;
  402. background: #20CBC2;
  403. margin-right: 24rpx;
  404. }
  405. text {
  406. font-weight: normal;
  407. font-size: 28rpx;
  408. color: #2F3437;
  409. margin-left: 8rpx;
  410. }
  411. }
  412. .collect {
  413. display: flex;
  414. align-items: center;
  415. image {
  416. width: 40rpx;
  417. height: 40rpx;
  418. vertical-align: sub;
  419. }
  420. }
  421. .jieshao {
  422. width: 100%;
  423. background: #F8F8F8;
  424. border-radius: 16rpx;
  425. padding: 20rpx 12rpx;
  426. font-size: 28rpx;
  427. color: #2F3437;
  428. line-height: 33rpx;
  429. box-sizing: border-box;
  430. }
  431. }
  432. }
  433. .service {
  434. font-size: 28rpx;
  435. color: #2F3437;
  436. line-height: 33rpx;
  437. margin: 24rpx 0;
  438. }
  439. .three {
  440. width: 100%;
  441. height: 80rpx;
  442. display: flex;
  443. justify-content: space-around;
  444. align-items: center;
  445. font-size: 28rpx;
  446. color: #2F3437;
  447. padding: 20rpx 0;
  448. background-color: #F8F8F8;
  449. box-sizing: border-box;
  450. border-radius: 16rpx;
  451. view {
  452. display: flex;
  453. align-items: center;
  454. image {
  455. width: 40rpx;
  456. height: 40rpx;
  457. margin-right: 8rpx;
  458. }
  459. }
  460. }
  461. }
  462. .server {
  463. padding-bottom: 160rpx;
  464. .tab {
  465. font-size: 30rpx;
  466. color: #333;
  467. .Tips {
  468. margin-right: 30rpx;
  469. height: 42rpx;
  470. box-sizing: border-box;
  471. }
  472. .active {
  473. box-sizing: border-box;
  474. width: 100%;
  475. font-weight: bold;
  476. border-bottom: 6rpx solid #2BDAD1;
  477. }
  478. }
  479. .tab-pane {
  480. display: none;
  481. }
  482. .tab-pane.active {
  483. display: block;
  484. }
  485. .commentList {
  486. padding: 24rpx;
  487. border-bottom: 1px solid #f3f2f2;
  488. background: #FFFFFF;
  489. box-shadow: 0px 4rpx 12rpx 0px rgba(88, 209, 187, 0.1);
  490. border-radius: 24rpx;
  491. margin-bottom: 24rpx;
  492. .cTitile {
  493. display: flex;
  494. justify-content: space-between;
  495. font-size: 24rpx;
  496. align-items: center;
  497. .tt {
  498. font-size: 30rpx;
  499. color: #6a6a6a;
  500. font-weight: bolder;
  501. text {
  502. color: #ff5656;
  503. }
  504. }
  505. .time {
  506. font-size: 30rpx;
  507. color: #666666;
  508. }
  509. }
  510. .img {
  511. margin-top: 16rpx;
  512. image {
  513. width: 24rpx;
  514. height: 24rpx;
  515. margin-right: 6rpx;
  516. }
  517. }
  518. .cText {
  519. font-size: 28rpx;
  520. margin-top: 16rpx;
  521. }
  522. }
  523. .lists {
  524. background-color: #fff;
  525. margin-bottom: 20rpx;
  526. display: flex;
  527. justify-content: space-between;
  528. padding: 24rpx 32rpx;
  529. border-radius: 24rpx;
  530. .imgs {
  531. width: 160rpx;
  532. height: 160rpx;
  533. border-radius: 16rpx;
  534. overflow: hidden;
  535. image {
  536. width: 100%;
  537. height: 100%;
  538. }
  539. }
  540. .right {
  541. flex: 1;
  542. padding-left: 30rpx;
  543. display: flex;
  544. flex-direction: column;
  545. justify-content: space-between;
  546. .list_title {
  547. width: 100%;
  548. display: flex;
  549. justify-content: space-between;
  550. align-items: start;
  551. .name {}
  552. .price {
  553. font-size: 48rpx;
  554. color: #F53E54;
  555. display: flex;
  556. align-items: center;
  557. padding: 0;
  558. span {
  559. font-size: 24rpx
  560. }
  561. }
  562. }
  563. .num {
  564. display: flex;
  565. align-items: center;
  566. justify-content: space-between;
  567. font-size: 24rpx;
  568. color: #888888;
  569. }
  570. .time {
  571. // padding-top: 50rpx;
  572. display: flex;
  573. align-items: center;
  574. justify-content: space-between;
  575. .money {
  576. font-size: 26rpx;
  577. color: #666666;
  578. font-weight: bold;
  579. }
  580. .counter {
  581. display: flex;
  582. align-items: center;
  583. .minus {
  584. image {
  585. width: 36rpx;
  586. height: 36rpx;
  587. }
  588. }
  589. text {
  590. line-height: 24rpx;
  591. font-size: 28rpx;
  592. margin: 0px 24rpx;
  593. }
  594. }
  595. }
  596. }
  597. }
  598. }
  599. .reserved {
  600. width: 100%;
  601. height: 116rpx;
  602. background: #FFFFFF;
  603. position: fixed;
  604. bottom: 0;
  605. left: 0;
  606. width: 100%;
  607. padding: 20rpx 40rpx;
  608. text-align: center;
  609. box-shadow: 0 0 30rpx #ece9e9;
  610. background-color: #fff;
  611. box-sizing: border-box;
  612. view {
  613. background: linear-gradient(90deg, #1AD7CE 0%, #21C9C1 100%);
  614. color: #fff;
  615. width: 100%;
  616. height: 76rpx;
  617. display: flex;
  618. align-items: center;
  619. justify-content: center;
  620. border-radius: 106rpx;
  621. font-weight: bold;
  622. font-size: 32rpx;
  623. }
  624. }
  625. </style>