evaluate.vue 12 KB

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