evaluate.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <view class="app-container">
  3. <view class="top-container" v-if="dataList.length">
  4. <view class="top">
  5. <view class="left">
  6. <text>综合评分</text
  7. ><uni-rate
  8. :size="18"
  9. :margin="4"
  10. :value="5"
  11. color="#fff"
  12. active-color="#FE781F"
  13. :readonly="true"
  14. />
  15. </view>
  16. <view class="right">{{ countDetail.goodRate }}%好评</view>
  17. </view>
  18. <view class="tabs">
  19. <view
  20. class="item"
  21. :class="currentTab === '' ? 'current' : ''"
  22. @tap="changeTabs('')"
  23. >全部</view
  24. >
  25. <block v-for="(item, index) in countDetail.tagCountList" :key="index">
  26. <view
  27. class="item"
  28. :class="currentTab === item.tag ? 'current' : ''"
  29. @tap="changeTabs(item.tag)"
  30. >{{ item.tag }}({{ item.total }})</view
  31. >
  32. </block>
  33. </view>
  34. </view>
  35. <view class="list-container">
  36. <view class="item" v-for="(item, index) in dataList" :key="index">
  37. <view class="top">
  38. <view class="user">
  39. <image
  40. :src="item.avatar"
  41. mode="aspectFill"
  42. v-if="item.avatar.indexOf('http') >= 0"
  43. ></image>
  44. <image
  45. :src="imageUrl + item.avatar"
  46. mode="aspectFill"
  47. v-else
  48. ></image>
  49. <view class="name ellipsis">{{ item.userName }}</view>
  50. </view>
  51. <view class="date">{{ item.createTime }}</view>
  52. </view>
  53. <view class="rate">
  54. <view class="it"
  55. ><text>商品质量</text
  56. ><uni-rate
  57. :size="14"
  58. :margin="4"
  59. :value="item.commentGoods"
  60. color="#fff"
  61. active-color="#FE781F"
  62. :readonly="true"
  63. /></view>
  64. <view class="it"
  65. ><text>服务质量</text
  66. ><uni-rate
  67. :size="14"
  68. :margin="4"
  69. :value="item.commentService"
  70. color="#fff"
  71. active-color="#FE781F"
  72. :readonly="true"
  73. /></view>
  74. <view class="it"
  75. ><text>配送质量</text
  76. ><uni-rate
  77. :size="14"
  78. :margin="4"
  79. :value="item.commentExpress"
  80. color="#fff"
  81. active-color="#FE781F"
  82. :readonly="true"
  83. /></view>
  84. </view>
  85. <view class="tags">
  86. <view class="it" v-for="(it, idx) in item.tags" :key="idx">{{
  87. it
  88. }}</view>
  89. </view>
  90. <!-- <view class="tagss">
  91. <view class="it" v-for="(it, idx) in item.tags">#{{it}}#</view>
  92. </view> -->
  93. <view class="content">{{ item.content }}</view>
  94. <view class="images" v-if="item.imgs && item.imgs.length > 0">
  95. <image
  96. v-for="(it, idx) in item.imgs"
  97. :key="idx"
  98. :src="it"
  99. @tap="previewEvaluateImage(it, item.imgs)"
  100. ></image>
  101. </view>
  102. </view>
  103. </view>
  104. <no-data v-if="!dataList.length" :showText="'暂无记录'"></no-data>
  105. <loading-text
  106. v-if="dataList.length"
  107. :loading="loading"
  108. :noMore="noMore"
  109. ></loading-text>
  110. </view>
  111. </template>
  112. <script>
  113. import { mapState } from 'vuex';
  114. export default {
  115. data() {
  116. return {
  117. imageUrl: this.$imageUrl,
  118. configInfo: uni.getStorageSync('configInfo'),
  119. goodsId: null,
  120. countDetail: {},
  121. dataList: [],
  122. total: 0,
  123. pageNum: 1,
  124. pageSize: 10,
  125. noMore: false,
  126. loading: false,
  127. currentTab: '',
  128. };
  129. },
  130. computed: {
  131. ...mapState(['userInfo', 'isLogin', 'userId']),
  132. },
  133. onLoad({ goodsId }) {
  134. this.goodsId = goodsId;
  135. this.getList();
  136. this.getCount();
  137. },
  138. // 下拉刷新
  139. onPullDownRefresh() {
  140. this.pageNum = 1;
  141. this.getList();
  142. this.getCount();
  143. },
  144. // 上拉加载
  145. onReachBottom() {
  146. this.getList(1);
  147. },
  148. methods: {
  149. // 获取统计
  150. getCount() {
  151. this.$axios({
  152. url: '/order/comment/goods/count',
  153. method: 'get',
  154. params: {
  155. goodsId: this.goodsId,
  156. },
  157. }).then((res) => {
  158. this.countDetail = res.data;
  159. });
  160. },
  161. // 获取列表
  162. getList(loadMore) {
  163. if (this.noMore && loadMore) return;
  164. this.noMore = false;
  165. if (!loadMore) {
  166. this.pageNum = 1;
  167. } else {
  168. this.loading = true;
  169. }
  170. this.$axios({
  171. url: '/order/comment/goods',
  172. method: 'get',
  173. params: {
  174. pageNo: this.pageNum,
  175. pageSize: this.pageSize,
  176. goodsId: this.goodsId,
  177. tag: this.currentTab,
  178. },
  179. isLoading: !loadMore,
  180. }).then((res) => {
  181. let _list = res.data.records;
  182. let pageTotal = res.data.pages;
  183. if (this.pageNum >= pageTotal) {
  184. this.noMore = true;
  185. }
  186. if (_list.length) {
  187. this.pageNum += 1;
  188. }
  189. if (loadMore) {
  190. this.dataList = this.dataList.concat(_list);
  191. this.loading = false;
  192. } else {
  193. this.dataList = _list;
  194. }
  195. this.total = res.data.total || 0;
  196. uni.stopPullDownRefresh();
  197. });
  198. },
  199. changeTabs(tag) {
  200. this.currentTab = tag;
  201. this.pageNum = 1;
  202. this.getList();
  203. },
  204. // 预览评价图片
  205. previewEvaluateImage(url, imgs) {
  206. uni.previewImage({
  207. urls: imgs,
  208. current: url,
  209. });
  210. },
  211. },
  212. };
  213. </script>
  214. <style lang="scss">
  215. .app-container {
  216. background: #f4f2f2;
  217. box-sizing: border-box;
  218. }
  219. .top-container {
  220. background: #ffffff;
  221. padding: 20rpx;
  222. margin-bottom: 20rpx;
  223. .top {
  224. display: flex;
  225. justify-content: space-between;
  226. align-items: center;
  227. .left {
  228. display: flex;
  229. align-items: center;
  230. font-size: 28rpx;
  231. color: #333333;
  232. margin-top: 5rpx;
  233. & > text {
  234. margin-right: 14rpx;
  235. }
  236. }
  237. .right {
  238. font-size: 24rpx;
  239. color: #666666;
  240. }
  241. }
  242. .tabs {
  243. display: flex;
  244. overflow-x: scroll;
  245. .item {
  246. flex-shrink: 0;
  247. height: 52rpx;
  248. line-height: 52rpx;
  249. border-radius: 52rpx;
  250. padding: 0 25rpx;
  251. border: 1px solid #eaeaea;
  252. color: #333333;
  253. font-size: 24rpx;
  254. margin-right: 16rpx;
  255. margin-top: 16rpx;
  256. &.current {
  257. border: 1px solid #fe781f;
  258. background: #fe781f;
  259. color: #ffffff;
  260. }
  261. }
  262. }
  263. }
  264. .list-container {
  265. padding: 0 20rpx;
  266. background: #ffffff;
  267. .item {
  268. padding: 20rpx 0;
  269. border-bottom: 1px solid #eaeaea;
  270. &:last-child {
  271. border-bottom: none;
  272. }
  273. .top {
  274. display: flex;
  275. justify-content: space-between;
  276. align-items: center;
  277. .user {
  278. display: flex;
  279. align-items: center;
  280. image {
  281. width: 80rpx;
  282. height: 80rpx;
  283. display: block;
  284. border-radius: 50%;
  285. margin-right: 20rpx;
  286. }
  287. .name {
  288. font-size: 28rpx;
  289. color: #333333;
  290. width: 300rpx;
  291. }
  292. }
  293. .date {
  294. font-size: 28rpx;
  295. color: #999999;
  296. }
  297. }
  298. .rate {
  299. margin-top: 14rpx;
  300. .it {
  301. display: flex;
  302. align-items: center;
  303. font-size: 24rpx;
  304. color: #666666;
  305. margin-top: 5rpx;
  306. & > text {
  307. margin-right: 10rpx;
  308. }
  309. }
  310. }
  311. .tags {
  312. display: flex;
  313. flex-wrap: wrap;
  314. .it {
  315. line-height: 44rpx;
  316. padding: 0 15rpx;
  317. border: 1px solid #eaeaea;
  318. border-radius: 44rpx;
  319. font-size: 24rpx;
  320. margin-right: 14rpx;
  321. margin-top: 14rpx;
  322. color: #666666;
  323. }
  324. }
  325. .tagss {
  326. display: flex;
  327. flex-wrap: wrap;
  328. margin-top: 14rpx;
  329. .it {
  330. font-size: 24rpx;
  331. color: #fe781f;
  332. margin-right: 6rpx;
  333. }
  334. }
  335. .content {
  336. font-size: 28rpx;
  337. color: #333333;
  338. margin-top: 14rpx;
  339. }
  340. .images {
  341. display: flex;
  342. flex-wrap: wrap;
  343. image {
  344. width: 140rpx;
  345. height: 140rpx;
  346. margin-right: 20rpx;
  347. margin-top: 20rpx;
  348. }
  349. }
  350. }
  351. }
  352. </style>