myEvaluate.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <template>
  2. <view class="container">
  3. <!-- 分段器区域 -->
  4. <view class="segmented">
  5. <uni-segmented-control :current="activeCurrent" :values="headerList" style-type="text" active-color="#096562" @clickItem="onClickItem" />
  6. </view>
  7. <!-- 列表区域 -->
  8. <scroll-view class="body" scroll-y @scrolltolower="handlePull">
  9. <!-- 每一个盒子区域 -->
  10. <view class="box" v-for="(item, index) in list" :key="index" @click="handleGoDetail(item)">
  11. <!-- 头部区域 -->
  12. <view class="box_top" v-if="activeCurrent === 0">
  13. <img mode="aspectFill" src="../../static/my/hotel.png" />
  14. <view class="top_name">{{ item.hotelName }}</view>
  15. <view class="box_type">已消费</view>
  16. </view>
  17. <!-- 房间信息区域 -->
  18. <view class="box_center" v-if="activeCurrent === 0">
  19. <img mode="aspectFill" :src="item.url" />
  20. <view class="center_info">
  21. <view>{{ item.houseOrderNumber }}间,{{ item.houseName }}</view>
  22. <view v-if="item.checkOutTime">{{ item.checkOutTime.slice(0, 10) }} - {{ item.checkOutTime.slice(0, 10) }}</view>
  23. <view>总价:¥{{ item.payAccount }}</view>
  24. </view>
  25. </view>
  26. <!-- 按钮区域 -->
  27. <view class="box_btn" v-if="activeCurrent === 0">
  28. <view class="btn_eva" @click.stop="handleGoPage(item)">去评价</view>
  29. </view>
  30. <!-- 审核中 已驳回 已评价 样式区域 -->
  31. <view class="box_top2" v-if="activeCurrent !== 0">
  32. <view class="top_name">{{ item.subTime }}发表</view>
  33. <view class="box_type color" v-if="activeCurrent === 1">审核中</view>
  34. <view class="box_type color2" v-if="activeCurrent === 2">已驳回</view>
  35. </view>
  36. <view class="box_rate" v-if="activeCurrent !== 0">
  37. 评分:
  38. <uni-rate readonly activeColor="#FFC300" :size="16" :value="item.score" />
  39. </view>
  40. <view class="box_content" v-if="activeCurrent !== 0">
  41. 审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中审核中
  42. </view>
  43. <!-- 图片列表区域 -->
  44. <view class="box_img" v-if="activeCurrent !== 0">
  45. <img
  46. v-for="(ele, index) in item.urls"
  47. :key="index"
  48. mode="aspectFill"
  49. v-if="ele.indexOf('jpg') !== -1 || ele.indexOf('png') !== -1"
  50. :src="ele"
  51. @click.stop="handleLookImg(ele, index)"
  52. />
  53. <video
  54. :id="item.id + index2"
  55. class="video"
  56. :show-fullscreen-btn="false"
  57. :show-play-btn="false"
  58. v-for="(video, index2) in item.urls"
  59. :key="index2"
  60. v-if="video.indexOf('mp4') !== -1"
  61. :src="video"
  62. @fullscreenchange="fullscreenchange"
  63. @click.stop="handleClickVideo(item.id + index2)"
  64. ></video>
  65. </view>
  66. <!-- 民宿信息区域 -->
  67. <view class="box_hotel" v-if="activeCurrent !== 0" @click.stop="">
  68. <img mode="aspectFill" :src="item.urls[0]" />
  69. <view class="hotel_info">
  70. <view class="info_name">{{ item.hotelName }}</view>
  71. <view class="info_tags">{{ item.houseOrderNumber }}间,{{ item.houseName }}</view>
  72. <view class="info_tags">{{ item.liveTime.slice(0, 10) }} - {{ item.checkOutTime.slice(0, 10) }}</view>
  73. <view class="info_tags">总价:¥{{ item.payAccount }}</view>
  74. </view>
  75. </view>
  76. <view class="box_desc" v-if="activeCurrent === 2">
  77. <view class="desc_key">备注:</view>
  78. <view class="desc_value">{{ item.desc }}</view>
  79. </view>
  80. </view>
  81. <view class="noData" v-if="list.length === 0">
  82. <img lazy-load :lazy-load-margin="0" src="../../static/images/noData.png" />
  83. {{ noDataMsg }}
  84. </view>
  85. </scroll-view>
  86. </view>
  87. </template>
  88. <script>
  89. export default {
  90. data() {
  91. return {
  92. // 分段器当前激活索引
  93. activeCurrent: 0,
  94. // 分段器数组
  95. headerList: ['待评价', '审核中', '已驳回', '已评价'],
  96. // 列表数据
  97. list: [
  98. {
  99. id: 1,
  100. hotelName: '民宿名称',
  101. url: 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg',
  102. houseOrderNumber: 1,
  103. houseName: '单间',
  104. payAccount: 229,
  105. subTime: '2023-09-22 16:54:20',
  106. liveTime: '2023-09-22 16:54:20',
  107. checkOutTime: '2023-09-22 16:54:20',
  108. score: 5,
  109. urls: [
  110. 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg',
  111. 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg',
  112. 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg',
  113. 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg'
  114. ],
  115. desc: '内容不实,驳回评价'
  116. },
  117. {
  118. id: 2,
  119. hotelName: '民宿名称',
  120. url: 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg',
  121. houseOrderNumber: 1,
  122. houseName: '单间',
  123. payAccount: 229,
  124. subTime: '2023-09-22 16:54:20',
  125. liveTime: '2023-09-22 16:54:20',
  126. checkOutTime: '2023-09-22 16:54:20',
  127. score: 5,
  128. urls: [
  129. 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg',
  130. 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg'
  131. ],
  132. desc: '内容不实,驳回评价'
  133. }
  134. ],
  135. noDataMsg: '暂无待评价数据',
  136. // 当前页
  137. page: 1,
  138. // 每页多少条
  139. rows: 6,
  140. // 总条数
  141. total: null,
  142. status: null,
  143. // 是否是全屏状态
  144. videoContext: null,
  145. isFullScreen: false
  146. }
  147. },
  148. onLoad() {
  149. // this.getData()
  150. },
  151. methods: {
  152. async getData() {
  153. const res = await this.$myRequest({
  154. url: '/mhotel/abcapersonageComment.action',
  155. data: {
  156. usersId: uni.getStorageSync('userInfo').id,
  157. status: this.status,
  158. page: this.page,
  159. rows: this.rows
  160. }
  161. })
  162. // console.log(res)
  163. if (res.code === 200 && res.page.pageList) {
  164. this.list = [...this.list, ...res.page.pageList]
  165. this.total = res.total
  166. this.headerList = [`待评价(${res.data.waitingCount})`, `审核中(${res.data.auditCount})`, `已驳回(${res.data.refuseAuditCount})`, `已评价(${res.data.ratedCount})`]
  167. }
  168. },
  169. // 切换分段器回调
  170. onClickItem(e) {
  171. this.activeCurrent = e.currentIndex
  172. if (e.currentIndex === 0) {
  173. this.noDataMsg = '暂无待评价数据'
  174. this.status = 0
  175. } else if (e.currentIndex === 1) {
  176. this.noDataMsg = '暂无审核中数据'
  177. this.status = 2
  178. } else if (e.currentIndex === 2) {
  179. this.noDataMsg = '暂无已驳回数据'
  180. this.status = 3
  181. } else if (e.currentIndex === 3) {
  182. this.noDataMsg = '暂无已评价数据'
  183. this.status = 1
  184. }
  185. // this.list = []
  186. // this.page = 1
  187. // this.getData()
  188. },
  189. // 列表下拉到底部回调
  190. handlePull() {
  191. if (this.list.length < this.total) {
  192. this.page++
  193. this.getData()
  194. } else {
  195. uni.showToast({
  196. title: '没有更多数据了',
  197. icon: 'none'
  198. })
  199. }
  200. },
  201. //去评价按钮回调
  202. handleGoPage(item) {
  203. uni.navigateTo({
  204. url: `/pages/evaluate/evaluate?bookingId=${item.id}&hotelId=${item.hotelId}&houseId=${item.houseId}`
  205. })
  206. },
  207. // 点击每一个评价订单的回调
  208. handleGoDetail(item) {
  209. if (this.activeCurrent === 1) {
  210. uni.navigateTo({
  211. url: `/pages/appraiseDetail/appraiseDetail?id=${item.bookingCommentId}`
  212. })
  213. } else {
  214. uni.navigateTo({
  215. url: `/pages/orderDetail/orderDetail?id=${item.id}`
  216. })
  217. }
  218. },
  219. // 点击图片回调
  220. handleLookImg(url, current) {
  221. this.videoContext.stop()
  222. uni.previewImage({
  223. urls: [url],
  224. current
  225. })
  226. },
  227. // 点击视频控件时触发的回调
  228. handleClickVideo(id) {
  229. this.videoContext = uni.createVideoContext(id)
  230. if (this.isFullScreen) {
  231. this.videoContext.stop()
  232. this.videoContext.exitFullScreen()
  233. } else {
  234. this.videoContext.requestFullScreen()
  235. this.videoContext.play()
  236. }
  237. },
  238. // 进入全屏和退出全屏时触发的回调
  239. fullscreenchange(e) {
  240. this.isFullScreen = e.detail.fullScreen
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang="scss" scoped>
  246. .container {
  247. height: 100vh;
  248. background-color: #f2f3f5;
  249. overflow: hidden;
  250. .segmented {
  251. box-sizing: border-box;
  252. padding: 0 50rpx;
  253. height: 100rpx;
  254. background-color: #fff;
  255. }
  256. .body {
  257. box-sizing: border-box;
  258. padding: 20rpx 0;
  259. height: calc(100vh - 100rpx);
  260. overflow-y: auto;
  261. .box {
  262. padding: 0 20rpx 20rpx;
  263. margin-bottom: 20rpx;
  264. background-color: #fff;
  265. .box_top {
  266. display: flex;
  267. align-items: center;
  268. height: 94rpx;
  269. img {
  270. width: 47rpx;
  271. height: 47rpx;
  272. border-radius: 50%;
  273. }
  274. .top_name {
  275. margin-left: 18rpx;
  276. font-size: 32rpx;
  277. font-weight: bold;
  278. }
  279. .box_type {
  280. margin-left: auto;
  281. color: #808080;
  282. font-size: 28rpx;
  283. }
  284. }
  285. .box_top2 {
  286. display: flex;
  287. align-items: center;
  288. height: 80rpx;
  289. border-bottom: 1rpx solid #e5e5e5;
  290. img {
  291. width: 47rpx;
  292. height: 47rpx;
  293. border-radius: 50%;
  294. }
  295. .top_name {
  296. font-size: 28rpx;
  297. font-weight: bold;
  298. }
  299. .box_type {
  300. margin-left: auto;
  301. color: #808080;
  302. font-size: 28rpx;
  303. }
  304. .color {
  305. color: #e6a23c;
  306. }
  307. .color2 {
  308. color: #f56c6c;
  309. }
  310. }
  311. .box_center {
  312. display: flex;
  313. img {
  314. width: 100rpx;
  315. height: 100rpx;
  316. border-radius: 10rpx;
  317. }
  318. .center_info {
  319. margin-top: -5rpx;
  320. margin-left: 18rpx;
  321. color: #808080;
  322. font-size: 28rpx;
  323. }
  324. }
  325. .box_btn {
  326. display: flex;
  327. justify-content: flex-end;
  328. margin-top: 35rpx;
  329. .btn_eva {
  330. display: flex;
  331. justify-content: center;
  332. align-items: center;
  333. margin-left: 20rpx;
  334. width: 178rpx;
  335. height: 68rpx;
  336. color: #808080;
  337. font-size: 28rpx;
  338. border-radius: 64rpx;
  339. border: 1rpx solid #808080;
  340. }
  341. }
  342. .box_rate {
  343. display: flex;
  344. align-items: center;
  345. height: 70rpx;
  346. color: #808080;
  347. font-size: 28rpx;
  348. }
  349. .box_content {
  350. font-size: 24rpx;
  351. }
  352. .box_img {
  353. display: grid;
  354. grid-template-columns: 1fr 1fr 1fr;
  355. grid-auto-rows: auto;
  356. padding: 20rpx 0 40rpx;
  357. gap: 10rpx;
  358. img {
  359. width: 216rpx;
  360. height: 216rpx;
  361. border-radius: 20rpx;
  362. }
  363. .video {
  364. width: 216rpx;
  365. height: 216rpx;
  366. border-radius: 20rpx;
  367. }
  368. }
  369. .box_hotel {
  370. display: flex;
  371. align-items: center;
  372. padding: 20rpx 0;
  373. border-top: 1rpx solid #e6e6e6;
  374. background-color: #fff;
  375. img {
  376. width: 120rpx;
  377. height: 170rpx;
  378. border-radius: 7rpx;
  379. }
  380. .hotel_info {
  381. display: flex;
  382. flex-direction: column;
  383. justify-content: space-between;
  384. margin-left: 20rpx;
  385. height: 170rpx;
  386. .info_name {
  387. font-size: 32rpx;
  388. font-weight: bold;
  389. }
  390. .info_star {
  391. display: flex;
  392. align-items: center;
  393. .star_num {
  394. margin-left: 10rpx;
  395. color: #ffc300;
  396. font-size: 24rpx;
  397. }
  398. }
  399. .info_tags {
  400. display: flex;
  401. color: #a6a6a6;
  402. font-size: 24rpx;
  403. .tag_item {
  404. margin-right: 20rpx;
  405. }
  406. }
  407. }
  408. }
  409. .box_desc {
  410. display: flex;
  411. padding-top: 15rpx;
  412. font-size: 28rpx;
  413. border-top: 1rpx solid #e6e6e6;
  414. .desc_key {
  415. }
  416. .desc_value {
  417. flex: 1;
  418. color: #808080;
  419. }
  420. }
  421. }
  422. .noData {
  423. display: flex;
  424. flex-direction: column;
  425. justify-content: center;
  426. align-items: center;
  427. padding-bottom: 20rpx;
  428. img {
  429. margin-top: 160rpx;
  430. width: 600rpx;
  431. height: 600rpx;
  432. }
  433. }
  434. }
  435. }
  436. </style>