evaluate.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <view class="evaluate">
  3. <view class="top"></view>
  4. <view class="head">
  5. <span class="cuIcon-back" @click="back"></span>
  6. <view class="case">
  7. 客户评价
  8. </view>
  9. </view>
  10. <view class="center">
  11. <view class="score">
  12. <view class="picture">
  13. <view class="left">
  14. <view class="mark">
  15. {{statistics.grade}}
  16. </view>
  17. <view class="num">
  18. <u-rate :count="count" v-model="statistics.grade" active-icon="heart-fill" inactive-icon="heart"
  19. size="20"></u-rate>
  20. <span>{{statistics.sum}}条评价</span>
  21. </view>
  22. </view>
  23. <view class="separate"></view>
  24. <view class="right">
  25. <view class="line" v-for="(item,index) in statistics.commentAppSumVos" :key="index">
  26. <span>{{item.name}}</span><u-line-progress :percent="item.percent" active-color="#FF5D39"
  27. style="width: 230rpx;margin-right:5rpx"></u-line-progress>{{item.percent}}%
  28. </view>
  29. </view>
  30. </view>
  31. <view class="people_num">
  32. <view class="statis" v-for="(item,index) in statistics.commentAppSumVos" :key="index">
  33. {{item.value}}人{{item.name}}<span></span>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="appraise">
  38. <view class="select">
  39. <view class="type" :class="curremtIndex == index?'active':''" v-for="(item,index) in typeList" :key="index"
  40. @click="change(item,index)">
  41. {{item.name}}
  42. </view>
  43. <view style="width: 144rpx;"></view>
  44. </view>
  45. <mescroll-uni class="list" :fixed="false" ref="mescrollRef" @up="getcommentList" @init="mescrollInit"
  46. style="height: 64vh;" :use="false">
  47. <view class="item" v-for=" (item,index) in appraiseList" :key="index">
  48. <view class=" headr">
  49. <view class="left">
  50. <view class="img">
  51. <image :src="item.userAvatar" mode="" v-if="item.userAvatar"></image>
  52. <image src="/static/avatar_boy.png" mode="" v-else></image>
  53. </view>
  54. <view class="name">
  55. {{item.userName}}<br />
  56. <span>{{item.commentTime}}发布</span>
  57. </view>
  58. </view>
  59. <view class="right">
  60. <u-rate :count="count" v-model="item.commentGrade" active-icon="heart-fill" size="20" :disabled="true"
  61. inactive-icon="heart"></u-rate><span>{{item.grade}}</span>
  62. </view>
  63. </view>
  64. <view class="product">
  65. {{item.productName}}
  66. </view>
  67. <view class="content">
  68. {{item.commentContent}}
  69. </view>
  70. <view class="image" v-if="item.imagesList">
  71. <view class="img" v-for="(row,index) in item.imagesList" :key="index">
  72. <image :src="row" mode=""></image>
  73. </view>
  74. </view>
  75. <view class="recover" v-if="item.commentsReply">
  76. 商家回复:{{item.commentsReply[0].commentContent}}
  77. </view>
  78. <!-- <view class="remove" v-if="item.commentsReply">
  79. {{item.time}}{{item.commentContent}}
  80. <view class="btn">删除回复</view>
  81. </view> -->
  82. <view class="reply">
  83. <input v-model="item.reply" placeholder="回复..." style="height: 36rpx;" @confirm="replyUser(item)" />
  84. </view>
  85. </view>
  86. </mescroll-uni>
  87. </view>
  88. </view>
  89. </view>
  90. </template>
  91. <script>
  92. // import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  93. export default {
  94. // mixins: [MescrollMixin], // 使用mixin
  95. data() {
  96. return {
  97. merchantId: '',
  98. statistics: {},
  99. curremtIndex: 0,
  100. timestamp: 86400,
  101. checked: true,
  102. count: 5,
  103. value: 3,
  104. icons: ['thumb-down-fill', 'thumb-down-fill', 'thumb-up-fill', 'thumb-up-fill'],
  105. typeList: [{
  106. name: '全部',
  107. commentGrade: 0
  108. },
  109. {
  110. name: '推荐',
  111. commentGrade: 1
  112. },
  113. {
  114. name: '一般',
  115. commentGrade: 2
  116. },
  117. {
  118. name: '差评',
  119. commentGrade: 3
  120. },
  121. {
  122. name: '未回复',
  123. commentGrade: 4
  124. },
  125. {
  126. name: '有文字',
  127. commentGrade: 5
  128. },
  129. {
  130. name: '图/视频',
  131. commentGrade: 6
  132. },
  133. ],
  134. appraiseList: [],
  135. reply: '',
  136. commentGrade: 0,
  137. upOption: {
  138. page: {
  139. num: 0,
  140. size: 10 // 每页数据的数量,默认10
  141. },
  142. noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  143. empty: {
  144. tip: '暂无相关数据'
  145. }
  146. },
  147. };
  148. },
  149. mounted() {
  150. this.getcomment()
  151. this.mescroll.optDown.use = false
  152. // this.getcommentList()
  153. },
  154. methods: {
  155. mescrollInit(mescroll) {
  156. this.mescroll = mescroll;
  157. },
  158. //返回
  159. back() {
  160. uni.navigateBack({
  161. delta: 1
  162. });
  163. },
  164. //切换条件
  165. change(item, index) {
  166. this.curremtIndex = index
  167. this.commentGrade = item.commentGrade
  168. let page = {
  169. num: 1,
  170. size: 10
  171. }
  172. this.appraiseList = []
  173. this.getcommentList(page)
  174. },
  175. //获取用户评论数据
  176. getcomment() {
  177. this.$http.get("/app/comments/statistics?merchantId=" + this.merchantId).then(res => {
  178. if (res.data.code == 200) {
  179. this.statistics = res.data.result
  180. }
  181. })
  182. },
  183. //获取用户评论列表
  184. getcommentList(page) {
  185. console.log(page)
  186. this.$http.get("/app/comments/list?merchantId=" + this.merchantId + '&commentGrade=' + this.commentGrade +
  187. '&pageNo=' + page.num + '&pageSize=' + page.size).then(
  188. res => {
  189. if (res.data.code == 200) {
  190. console.log(res)
  191. this.appraiseList = this.appraiseList.concat(res.data.result.records)
  192. this.mescroll.endSuccess(res.data.result.records.length, res.data.result.total);; // 结束下拉刷新状态
  193. console.log(this.appraiseList)
  194. }
  195. }).catch(() => {
  196. this.mescroll.endErr()
  197. })
  198. },
  199. replyUser(item){
  200. let data = {
  201. commentContent:item.reply,
  202. commentId:item.commentId
  203. }
  204. this.$http.post('/app/comments/reply',data).then(res =>{
  205. console.log(res)
  206. if(res.data.code == 200){
  207. // item.reply = ''
  208. uni.showToast({
  209. icon:'none',
  210. title:'回复成功'
  211. })
  212. this.$router.go(0)
  213. // this.appraiseList = []
  214. // let page = {
  215. // num: 1,
  216. // size: 10
  217. // }
  218. // this.getcommentList(page)
  219. }else{
  220. uni.showToast({
  221. icon:'none',
  222. title:res.message
  223. })
  224. }
  225. })
  226. }
  227. },
  228. onShow() {
  229. let that = this
  230. uni.getStorage({
  231. key: 'login_user_info',
  232. success: function(res) {
  233. that.merchantId = res.data.merchantId
  234. }
  235. })
  236. }
  237. };
  238. </script>
  239. <style lang="scss" scoped>
  240. .evaluate {
  241. width: 100vw;
  242. height: 100vh;
  243. background: #F7F8FC;
  244. display: flex;
  245. flex-direction: column;
  246. overflow: hidden;
  247. /*#ifdef APP-PLUS*/
  248. .top {
  249. width: 100%;
  250. height: var(--status-bar-height);
  251. background: linear-gradient(90deg, #DCF0FF 4%, #FFE3CE 67%, #FFFCE6 100%), linear-gradient(0, #F7F8FC 0%, rgba(247, 248, 252, 0) 100%);
  252. }
  253. /*#endif*/
  254. .head {
  255. width: 100%;
  256. height: 112rpx;
  257. padding: 20rpx;
  258. display: flex;
  259. align-items: center;
  260. background: linear-gradient(90deg, #DCF0FF 4%, #FFE3CE 67%, #FFFCE6 100%), linear-gradient(0, #F7F8FC 0%, rgba(247, 248, 252, 0) 100%);
  261. position: relative;
  262. .cuIcon-back {
  263. font-size: 40rpx;
  264. margin-right: 40rpx;
  265. }
  266. .case {
  267. position: absolute;
  268. left: 50%;
  269. transform: translateX(-50%);
  270. font-size: 36rpx;
  271. font-weight: 600;
  272. }
  273. }
  274. /*#ifdef APP-PLUS*/
  275. .head {
  276. width: 100%;
  277. height: var(--status-bar-height);
  278. background: linear-gradient(90deg, #DCF0FF 4%, #FFE3CE 67%, #FFFCE6 100%), linear-gradient(0, #F7F8FC 0%, rgba(247, 248, 252, 0) 100%);
  279. }
  280. /*#endif*/
  281. .center {
  282. flex: 1;
  283. padding: 0px 22rpx 10rpx;
  284. overflow-y: auto;
  285. .score {
  286. width: 100%;
  287. margin: 20rpx auto 0px;
  288. background: #FFFFFF;
  289. border-radius: 16rpx;
  290. padding: 16rpx;
  291. .picture {
  292. display: flex;
  293. justify-content: space-between;
  294. border-bottom: 1px solid #eeeeee;
  295. padding-bottom: 10rpx;
  296. .left {
  297. width: 225rpx;
  298. height: 93rpx;
  299. display: flex;
  300. align-items: center;
  301. .mark {
  302. flex: 1;
  303. font-size: 64rpx;
  304. font-weight: 600;
  305. margin-right: 16rpx;
  306. }
  307. .num {
  308. font-size: 22rpx;
  309. color: #999999;
  310. span {
  311. display: block;
  312. margin-top: 8rpx;
  313. }
  314. }
  315. }
  316. .separate {
  317. width: 1px;
  318. height: 92rpx;
  319. background-color: #eeeeee;
  320. }
  321. .right {
  322. width: 354rpx;
  323. // padding: 20rpx;
  324. display: flex;
  325. flex-direction: column;
  326. // align-items: center;
  327. justify-content: space-between;
  328. font-size: 20rpx;
  329. color: #999999;
  330. .line {
  331. width: 100%;
  332. display: flex;
  333. align-items: center;
  334. span {
  335. margin-right: 10rpx;
  336. }
  337. }
  338. }
  339. }
  340. .people_num {
  341. width: 100%;
  342. display: flex;
  343. align-items: center;
  344. font-size: 22rpx;
  345. color: #999999;
  346. margin-top: 10rpx;
  347. .statis {
  348. display: flex;
  349. align-items: center;
  350. span {
  351. display: block;
  352. width: 1rpx;
  353. height: 22rpx;
  354. background-color: #999999;
  355. margin: 0px 16rpx;
  356. }
  357. }
  358. }
  359. }
  360. .appraise {
  361. width: 100%;
  362. margin-top: 20rpx;
  363. .select {
  364. width: 100%;
  365. display: flex;
  366. justify-content: space-between;
  367. flex-wrap: wrap;
  368. gap: 33rpx;
  369. margin-bottom: 10rpx;
  370. .type {
  371. width: 144rpx;
  372. height: 52rpx;
  373. display: flex;
  374. align-items: center;
  375. justify-content: center;
  376. background-color: #ccc;
  377. // margin-right: 20rpx;
  378. // margin-bottom: 20rpx;
  379. background: #FFFFFF;
  380. border-radius: 4rpx;
  381. }
  382. .active {
  383. background: rgba(68, 154, 255, 0.1);
  384. border: 1px solid #449AFF;
  385. color: #2983EC;
  386. }
  387. }
  388. .list {
  389. .item {
  390. margin-top: 20rpx;
  391. background: #ffffff;
  392. padding: 16rpx;
  393. border-radius: 16rpx;
  394. box-shadow: 0px 2px 8px 0px rgba(214, 225, 237, 0.1);
  395. }
  396. .headr {
  397. display: flex;
  398. justify-content: space-between;
  399. .left {
  400. display: flex;
  401. .img {
  402. width: 70rpx;
  403. height: 70rpx;
  404. border-radius: 8rpx;
  405. overflow: hidden;
  406. margin-right: 12rpx;
  407. image {
  408. width: 100%;
  409. height: 100%;
  410. }
  411. }
  412. }
  413. .name {
  414. font-size: 24rpx;
  415. color: #000000;
  416. span {
  417. font-size: 22rpx;
  418. color: #999999;
  419. }
  420. }
  421. .right {
  422. width: 200rpx;
  423. display: flex;
  424. align-items: center;
  425. justify-content: space-between;
  426. font-size: 24rpx;
  427. color: #FF2848;
  428. span {
  429. display: block;
  430. }
  431. }
  432. }
  433. .product {
  434. width: 50%;
  435. height: 36rpx;
  436. background: #F4F4F4;
  437. border-radius: 4rpx;
  438. font-size: 22rpx;
  439. color: #666666;
  440. display: flex;
  441. align-items: center;
  442. padding: 0 12rpx;
  443. margin: 10rpx 0px;
  444. }
  445. .type {
  446. margin-top: 20rpx;
  447. }
  448. .content {
  449. margin-top: 20rpx;
  450. }
  451. .recover {
  452. background: #F7F8FC;
  453. border-radius: 4rpx;
  454. padding: 12rpx;
  455. margin: 16rpx 0px 10rpx;
  456. }
  457. .image {
  458. display: flex;
  459. align-items: center;
  460. margin: 10rpx 0px 16rpx;
  461. .img {
  462. width: 156rpx;
  463. height: 156rpx;
  464. border-radius: 4rpx;
  465. overflow: hidden;
  466. margin-right: 7rpx;
  467. }
  468. .img:nth-child(4n) {
  469. margin: 0;
  470. }
  471. image {
  472. width: 156rpx;
  473. height: 156rpx;
  474. }
  475. }
  476. .time {
  477. margin-top: 20rpx;
  478. }
  479. .reply {
  480. height: 60rpx;
  481. background: #F7F8FC;
  482. margin-top: 16rpx;
  483. padding: 12rpx;
  484. font-size: 24rpx;
  485. display: flex;
  486. align-items: center;
  487. input {
  488. width: 80%;
  489. font-size: 22rpx;
  490. }
  491. }
  492. .remove {
  493. display: flex;
  494. align-items: center;
  495. justify-content: space-between;
  496. font-size: 22rpx;
  497. color: #999999;
  498. .btn {
  499. margin-top: 10rpx;
  500. width: 144rpx;
  501. height: 47rpx;
  502. border-radius: 47rpx;
  503. border: 1px solid #449AFF;
  504. font-size: 24rpx;
  505. color: #449AFF;
  506. display: flex;
  507. align-items: center;
  508. justify-content: center;
  509. }
  510. }
  511. }
  512. }
  513. }
  514. }
  515. ::v-deep.u-iconfont {
  516. font-size: 20rpx;
  517. width: 20rpx;
  518. height: 20rpx;
  519. }
  520. ::v-deep.u-progress {
  521. height: 12rpx !important;
  522. border-radius: 53rpx;
  523. }
  524. </style>