myEvaluate.vue 9.9 KB

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