appraiseDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <template>
  2. <view class="container" v-if="info">
  3. <!-- 评价信息区域 -->
  4. <view class="header">
  5. <!-- 用户信息区域 -->
  6. <view class="header_info">
  7. <img mode="aspectFill" :src="info.headPhoto" />
  8. <view class="info_msg">
  9. <view class="msg_name">{{ info.name }}</view>
  10. <view class="msg_star">
  11. <uni-rate readonly activeColor="#FFC300" :size="16" :value="info.score" />
  12. </view>
  13. </view>
  14. <view class="info_time">{{ info.commentTime }}</view>
  15. </view>
  16. <!-- 入住时间区域 -->
  17. <view class="header_time">{{ info.liveTime }}入住,{{ info.commentTime }}发表 | {{ info.houseName }}</view>
  18. <!-- 评价内容区域 -->
  19. <view class="header_content">{{ info.content }}</view>
  20. <!-- 图片列表区域 -->
  21. <view class="header_img">
  22. <img
  23. v-for="(ele, index) in info.url"
  24. :key="index"
  25. mode="aspectFill"
  26. v-if="ele.indexOf('jpg') !== -1 || ele.indexOf('png') !== -1"
  27. :src="ele"
  28. @click="handleLookImg(ele, index)"
  29. />
  30. <video
  31. id="myVideo"
  32. class="video"
  33. :show-fullscreen-btn="false"
  34. :show-play-btn="false"
  35. v-for="(video, index2) in info.url"
  36. :key="index2"
  37. v-if="video.indexOf('mp4') !== -1"
  38. :src="video"
  39. @fullscreenchange="fullscreenchange"
  40. @click="handleClickVideo"
  41. ></video>
  42. </view>
  43. </view>
  44. <!-- 民宿信息区域 -->
  45. <view class="hotel" @click="handleGoDetail">
  46. <img mode="aspectFill" :src="info.houseUrl[0]" />
  47. <view class="hotel_info">
  48. <view class="info_name">{{ info.hotelName }}</view>
  49. <!-- <view class="info_star">
  50. <uni-rate readonly activeColor="#FFC300" :size="12" :value="info.hotelScore * 1" />
  51. <view class="star_num">{{ info.hotelScore }}</view>
  52. </view> -->
  53. <!-- <view class="info_tags">
  54. <view class="tag_item">{{ info.hotelTownship }}</view>
  55. <view class="tag_item">{{ info.hotelType }}</view>
  56. </view> -->
  57. <view class="info_tags">{{ info.houseOrderNumber }}间,{{ info.houseName }}</view>
  58. <view class="info_tags">{{ info.liveTime }} - {{ info.checkOutTime }}</view>
  59. <view class="info_tags">总价:¥{{ info.payAccount }}</view>
  60. </view>
  61. </view>
  62. <!-- 评论回复区域 -->
  63. <view class="reply">
  64. <!-- 评论总条数区域 -->
  65. <view class="reply_title">
  66. <img src="../../static/index/comment.png" />
  67. 评论({{ infoList.length }})
  68. </view>
  69. <!-- 评论列表区域 -->
  70. <view class="reply_box" v-if="infoList.length">
  71. <!-- 每一条评论区域 -->
  72. <view class="box_item" v-for="item in infoList" :key="item.id">
  73. <!-- 用户区域 -->
  74. <view class="item_user" @click="handleComment(item)">
  75. <img mode="aspectFill" :src="item.headPhoto" />
  76. <view class="user_info">
  77. <view class="info_top">{{ item.userName }}</view>
  78. <view class="info_bottom">{{ item.dateTime }}</view>
  79. </view>
  80. </view>
  81. <!-- 评价内容区域 -->
  82. <view class="item_content" @click="handleComment(item)">{{ item.content }}</view>
  83. <!-- 二级评论区域 -->
  84. <view class="item_child">
  85. <CommentChild v-if="item.commentVoList" :list="item.commentVoList" :commentParentId="info.id" />
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 输入框区域 -->
  90. <view class="reply_input">
  91. <input type="text" confirm-type="send" placeholder="说点什么吧..." v-model="inputValue" @confirm="handleConfirm" />
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. var dayjs = require('dayjs')
  98. import CommentChild from '@/components/commentChild.vue'
  99. export default {
  100. components: { CommentChild },
  101. data() {
  102. return {
  103. // 评价详情信息
  104. info: null,
  105. // 评价列表信息
  106. infoList: [],
  107. id: null,
  108. inputValue: '',
  109. videoContext: null,
  110. // 是否是全屏状态
  111. isFullScreen: false
  112. }
  113. },
  114. onReady() {
  115. this.videoContext = uni.createVideoContext('myVideo')
  116. },
  117. onLoad(options) {
  118. // console.log(options)
  119. this.id = options.id
  120. this.getData()
  121. uni.$on('getData', this.getData)
  122. },
  123. methods: {
  124. handleGoDetail() {
  125. uni.navigateTo({
  126. url: `/pages/orderDetail/orderDetail?id=${this.info.bookingId}`
  127. })
  128. },
  129. // 进入全屏和退出全屏时触发的回调
  130. fullscreenchange(e) {
  131. this.isFullScreen = e.detail.fullScreen
  132. },
  133. // 点击视频控件时触发的回调
  134. handleClickVideo() {
  135. if (this.isFullScreen) {
  136. this.videoContext.stop()
  137. this.videoContext.exitFullScreen()
  138. } else {
  139. this.videoContext.requestFullScreen()
  140. this.videoContext.play()
  141. }
  142. },
  143. handleComment(item) {
  144. uni.showModal({
  145. title: '请输入评论',
  146. editable: true,
  147. success: async (res) => {
  148. if (res.confirm) {
  149. const result = res.content
  150. if (!res.content) {
  151. uni.showToast({
  152. title: '评论内容不能为空',
  153. icon: 'none',
  154. mask: true
  155. })
  156. setTimeout(() => {
  157. this.handleComment()
  158. }, 1500)
  159. } else {
  160. let time = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
  161. const res = await this.$myRequest({
  162. url: '/mhotel/abcareplyComment.action',
  163. data: {
  164. commentId: item.id,
  165. commentParentId: this.info.id,
  166. commentName: item.userName,
  167. content: result,
  168. commentStatus: 1,
  169. createId: uni.getStorageSync('userInfo').id,
  170. createUsername: uni.getStorageSync('userInfo').user_name,
  171. createDate: time,
  172. modifyDate: time
  173. }
  174. })
  175. // console.log(res);
  176. if (res.code === 200) {
  177. uni.showToast({
  178. title: '评论成功,审核通过后展示',
  179. icon: 'none',
  180. mask: true
  181. })
  182. setTimeout(() => {
  183. this.getData()
  184. }, 1500)
  185. }
  186. }
  187. }
  188. }
  189. })
  190. },
  191. // 获取详情数据
  192. async getData() {
  193. const res = await this.$myRequest({
  194. url: '/mhotel/abcapersonageDetails.action',
  195. data: {
  196. bookingCommentId: this.id
  197. }
  198. })
  199. // console.log(res)
  200. if (res.code === 200) {
  201. this.info = res.commentDetails
  202. this.infoList = res.comment || []
  203. }
  204. },
  205. async handleConfirm() {
  206. if (!this.inputValue) {
  207. return
  208. }
  209. let time = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
  210. const res = await this.$myRequest({
  211. url: '/mhotel/abcareplyComment.action',
  212. data: {
  213. commentId: this.info.id,
  214. commentParentId: this.info.id,
  215. commentName: this.info.name,
  216. content: this.inputValue,
  217. commentStatus: 1,
  218. createId: uni.getStorageSync('userInfo').id,
  219. createUsername: uni.getStorageSync('userInfo').user_name,
  220. createDate: time,
  221. modifyDate: time
  222. }
  223. })
  224. // console.log(res);
  225. if (res.code === 200) {
  226. uni.showToast({
  227. title: '评论成功,审核通过后展示',
  228. icon: 'success',
  229. mask: true
  230. })
  231. this.inputValue = ''
  232. setTimeout(() => {
  233. this.getData()
  234. }, 1500)
  235. }
  236. },
  237. // 点击图片回调
  238. handleLookImg(url, current) {
  239. this.videoContext.stop()
  240. uni.previewImage({
  241. urls: [url],
  242. current
  243. })
  244. }
  245. }
  246. }
  247. </script>
  248. <style lang="scss" scoped>
  249. .container {
  250. display: flex;
  251. flex-direction: column;
  252. min-height: 100vh;
  253. background-color: #f2f3f5;
  254. .header {
  255. margin-top: 1rpx;
  256. padding: 0 20rpx;
  257. background-color: #fff;
  258. .header_info {
  259. display: flex;
  260. align-items: center;
  261. height: 115rpx;
  262. img {
  263. width: 70rpx;
  264. height: 70rpx;
  265. border-radius: 50%;
  266. }
  267. .info_msg {
  268. margin-left: 18rpx;
  269. .msg_name {
  270. font-size: 28rpx;
  271. }
  272. .msg_star {
  273. margin-left: -5rpx;
  274. margin-top: 5rpx;
  275. }
  276. }
  277. .info_time {
  278. margin-top: 25rpx;
  279. margin-left: auto;
  280. color: #a6a6a6;
  281. font-size: 24rpx;
  282. }
  283. }
  284. .header_time {
  285. color: #a6a6a6;
  286. font-size: 24rpx;
  287. }
  288. .header_content {
  289. margin-top: 18rpx;
  290. font-size: 24rpx;
  291. }
  292. .header_img {
  293. display: grid;
  294. grid-template-columns: 1fr 1fr 1fr;
  295. grid-auto-rows: auto;
  296. padding: 20rpx 20rpx 40rpx;
  297. gap: 10rpx;
  298. img {
  299. width: 216rpx;
  300. height: 216rpx;
  301. border-radius: 20rpx;
  302. }
  303. .video {
  304. width: 216rpx;
  305. height: 216rpx;
  306. border-radius: 20rpx;
  307. }
  308. }
  309. }
  310. .hotel {
  311. display: flex;
  312. align-items: center;
  313. padding: 20rpx 0;
  314. margin-top: 20rpx;
  315. // height: 160rpx;
  316. background-color: #fff;
  317. img {
  318. margin-left: 20rpx;
  319. width: 120rpx;
  320. height: 170rpx;
  321. border-radius: 7rpx;
  322. }
  323. .hotel_info {
  324. display: flex;
  325. flex-direction: column;
  326. justify-content: space-between;
  327. margin-left: 20rpx;
  328. height: 170rpx;
  329. .info_name {
  330. font-size: 32rpx;
  331. }
  332. .info_star {
  333. display: flex;
  334. align-items: center;
  335. .star_num {
  336. margin-left: 10rpx;
  337. color: #ffc300;
  338. font-size: 24rpx;
  339. }
  340. }
  341. .info_tags {
  342. display: flex;
  343. color: #a6a6a6;
  344. font-size: 24rpx;
  345. .tag_item {
  346. margin-right: 20rpx;
  347. }
  348. }
  349. }
  350. }
  351. .reply {
  352. margin-top: 20rpx;
  353. background-color: #fff;
  354. .reply_title {
  355. display: flex;
  356. justify-content: flex-end;
  357. align-items: center;
  358. padding-right: 35rpx;
  359. height: 90rpx;
  360. font-size: 24rpx;
  361. border-bottom: 1rpx solid #e6e6e6;
  362. img {
  363. margin-right: 12rpx;
  364. width: 25rpx;
  365. height: 21rpx;
  366. }
  367. }
  368. .reply_box {
  369. padding: 0 20rpx 30rpx;
  370. .box_item {
  371. margin-bottom: 10rpx;
  372. padding-bottom: 10rpx;
  373. border-bottom: 1rpx solid #e6e6e6;
  374. .item_user {
  375. display: flex;
  376. align-items: center;
  377. height: 120rpx;
  378. img {
  379. width: 70rpx;
  380. height: 70rpx;
  381. border-radius: 50%;
  382. }
  383. .user_info {
  384. display: flex;
  385. flex-direction: column;
  386. justify-content: space-between;
  387. margin-left: 18rpx;
  388. height: 70rpx;
  389. .info_top {
  390. font-size: 28rpx;
  391. }
  392. .info_bottom {
  393. color: #a6a6a6;
  394. font-size: 24rpx;
  395. }
  396. }
  397. }
  398. .item_content {
  399. font-size: 24rpx;
  400. .content_key {
  401. color: #808080;
  402. }
  403. }
  404. .item_child {
  405. margin-left: 50rpx;
  406. }
  407. }
  408. }
  409. .reply_input {
  410. display: flex;
  411. align-items: center;
  412. box-sizing: border-box;
  413. padding: 0 33rpx;
  414. margin: 15rpx auto 54rpx;
  415. width: 710rpx;
  416. height: 78rpx;
  417. font-size: 24rpx;
  418. border-radius: 44rpx;
  419. background-color: #e6e6e6;
  420. input {
  421. width: 100%;
  422. }
  423. }
  424. }
  425. }
  426. </style>