appraiseDetail.vue 11 KB

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