evaluate.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  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.commentsReply" mode="" v-if="item.commentsReply"></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. }
  194. }).catch(() => {
  195. this.mescroll.endErr()
  196. })
  197. },
  198. replyUser(item){
  199. console.log(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. uni.showToast({
  208. icon:'none',
  209. title:'回复成功'
  210. })
  211. let page = {
  212. num: 1,
  213. size: 10
  214. }
  215. this.getcommentList(page)
  216. }
  217. })
  218. }
  219. },
  220. onShow() {
  221. let that = this
  222. uni.getStorage({
  223. key: 'login_user_info',
  224. success: function(res) {
  225. that.merchantId = res.data.merchantId
  226. }
  227. })
  228. }
  229. };
  230. </script>
  231. <style lang="scss" scoped>
  232. .evaluate {
  233. width: 100vw;
  234. height: 100vh;
  235. background: #F7F8FC;
  236. display: flex;
  237. flex-direction: column;
  238. overflow: hidden;
  239. /*#ifdef APP-PLUS*/
  240. .top {
  241. width: 100%;
  242. height: var(--status-bar-height);
  243. background: linear-gradient(90deg, #DCF0FF 4%, #FFE3CE 67%, #FFFCE6 100%), linear-gradient(0, #F7F8FC 0%, rgba(247, 248, 252, 0) 100%);
  244. }
  245. /*#endif*/
  246. .head {
  247. width: 100%;
  248. height: 112rpx;
  249. padding: 20rpx;
  250. display: flex;
  251. align-items: center;
  252. background: linear-gradient(90deg, #DCF0FF 4%, #FFE3CE 67%, #FFFCE6 100%), linear-gradient(0, #F7F8FC 0%, rgba(247, 248, 252, 0) 100%);
  253. position: relative;
  254. .cuIcon-back {
  255. font-size: 40rpx;
  256. margin-right: 40rpx;
  257. }
  258. .case {
  259. position: absolute;
  260. left: 50%;
  261. transform: translateX(-50%);
  262. font-size: 36rpx;
  263. font-weight: 600;
  264. }
  265. }
  266. /*#ifdef APP-PLUS*/
  267. .head {
  268. width: 100%;
  269. height: var(--status-bar-height);
  270. background: linear-gradient(90deg, #DCF0FF 4%, #FFE3CE 67%, #FFFCE6 100%), linear-gradient(0, #F7F8FC 0%, rgba(247, 248, 252, 0) 100%);
  271. }
  272. /*#endif*/
  273. .center {
  274. flex: 1;
  275. padding: 0px 22rpx 10rpx;
  276. overflow-y: auto;
  277. .score {
  278. width: 100%;
  279. margin: 20rpx auto 0px;
  280. background: #FFFFFF;
  281. border-radius: 16rpx;
  282. padding: 16rpx;
  283. .picture {
  284. display: flex;
  285. justify-content: space-between;
  286. border-bottom: 1px solid #eeeeee;
  287. padding-bottom: 10rpx;
  288. .left {
  289. width: 225rpx;
  290. height: 93rpx;
  291. display: flex;
  292. align-items: center;
  293. .mark {
  294. flex: 1;
  295. font-size: 64rpx;
  296. font-weight: 600;
  297. margin-right: 16rpx;
  298. }
  299. .num {
  300. font-size: 22rpx;
  301. color: #999999;
  302. span {
  303. display: block;
  304. margin-top: 8rpx;
  305. }
  306. }
  307. }
  308. .separate {
  309. width: 1px;
  310. height: 92rpx;
  311. background-color: #eeeeee;
  312. }
  313. .right {
  314. width: 354rpx;
  315. // padding: 20rpx;
  316. display: flex;
  317. flex-direction: column;
  318. // align-items: center;
  319. justify-content: space-between;
  320. font-size: 20rpx;
  321. color: #999999;
  322. .line {
  323. width: 100%;
  324. display: flex;
  325. align-items: center;
  326. span {
  327. margin-right: 10rpx;
  328. }
  329. }
  330. }
  331. }
  332. .people_num {
  333. width: 100%;
  334. display: flex;
  335. align-items: center;
  336. font-size: 22rpx;
  337. color: #999999;
  338. margin-top: 10rpx;
  339. .statis {
  340. display: flex;
  341. align-items: center;
  342. span {
  343. display: block;
  344. width: 1rpx;
  345. height: 22rpx;
  346. background-color: #999999;
  347. margin: 0px 16rpx;
  348. }
  349. }
  350. }
  351. }
  352. .appraise {
  353. width: 100%;
  354. margin-top: 20rpx;
  355. .select {
  356. width: 100%;
  357. display: flex;
  358. justify-content: space-between;
  359. flex-wrap: wrap;
  360. gap: 33rpx;
  361. margin-bottom: 10rpx;
  362. .type {
  363. width: 144rpx;
  364. height: 52rpx;
  365. display: flex;
  366. align-items: center;
  367. justify-content: center;
  368. background-color: #ccc;
  369. // margin-right: 20rpx;
  370. // margin-bottom: 20rpx;
  371. background: #FFFFFF;
  372. border-radius: 4rpx;
  373. }
  374. .active {
  375. background: rgba(68, 154, 255, 0.1);
  376. border: 1px solid #449AFF;
  377. color: #2983EC;
  378. }
  379. }
  380. .list {
  381. .item {
  382. margin-top: 20rpx;
  383. background: #ffffff;
  384. padding: 16rpx;
  385. border-radius: 16rpx;
  386. box-shadow: 0px 2px 8px 0px rgba(214, 225, 237, 0.1);
  387. }
  388. .headr {
  389. display: flex;
  390. justify-content: space-between;
  391. .left {
  392. display: flex;
  393. .img {
  394. width: 70rpx;
  395. height: 70rpx;
  396. border-radius: 8rpx;
  397. overflow: hidden;
  398. margin-right: 12rpx;
  399. image {
  400. width: 100%;
  401. height: 100%;
  402. }
  403. }
  404. }
  405. .name {
  406. font-size: 24rpx;
  407. color: #000000;
  408. span {
  409. font-size: 22rpx;
  410. color: #999999;
  411. }
  412. }
  413. .right {
  414. width: 200rpx;
  415. display: flex;
  416. align-items: center;
  417. justify-content: space-between;
  418. font-size: 24rpx;
  419. color: #FF2848;
  420. span {
  421. display: block;
  422. }
  423. }
  424. }
  425. .product {
  426. width: 50%;
  427. height: 36rpx;
  428. background: #F4F4F4;
  429. border-radius: 4rpx;
  430. font-size: 22rpx;
  431. color: #666666;
  432. display: flex;
  433. align-items: center;
  434. padding: 0 12rpx;
  435. margin: 10rpx 0px;
  436. }
  437. .type {
  438. margin-top: 20rpx;
  439. }
  440. .content {
  441. margin-top: 20rpx;
  442. }
  443. .recover {
  444. background: #F7F8FC;
  445. border-radius: 4rpx;
  446. padding: 12rpx;
  447. margin: 16rpx 0px 10rpx;
  448. }
  449. .image {
  450. display: flex;
  451. align-items: center;
  452. margin: 10rpx 0px 16rpx;
  453. .img {
  454. width: 156rpx;
  455. height: 156rpx;
  456. border-radius: 4rpx;
  457. overflow: hidden;
  458. margin-right: 7rpx;
  459. }
  460. .img:nth-child(4n) {
  461. margin: 0;
  462. }
  463. image {
  464. width: 156rpx;
  465. height: 156rpx;
  466. }
  467. }
  468. .time {
  469. margin-top: 20rpx;
  470. }
  471. .reply {
  472. height: 60rpx;
  473. background: #F7F8FC;
  474. margin-top: 16rpx;
  475. padding: 12rpx;
  476. font-size: 24rpx;
  477. display: flex;
  478. align-items: center;
  479. input {
  480. width: 80%;
  481. font-size: 22rpx;
  482. }
  483. }
  484. .remove {
  485. display: flex;
  486. align-items: center;
  487. justify-content: space-between;
  488. font-size: 22rpx;
  489. color: #999999;
  490. .btn {
  491. margin-top: 10rpx;
  492. width: 144rpx;
  493. height: 47rpx;
  494. border-radius: 47rpx;
  495. border: 1px solid #449AFF;
  496. font-size: 24rpx;
  497. color: #449AFF;
  498. display: flex;
  499. align-items: center;
  500. justify-content: center;
  501. }
  502. }
  503. }
  504. }
  505. }
  506. }
  507. ::v-deep.u-iconfont {
  508. font-size: 20rpx;
  509. width: 20rpx;
  510. height: 20rpx;
  511. }
  512. ::v-deep.u-progress {
  513. height: 12rpx !important;
  514. border-radius: 53rpx;
  515. }
  516. </style>