details.vue 14 KB

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