appraiseDetail.vue 9.6 KB

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