my-appraise.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="flex-common-css">
  3. <Nav title="我的评价" titleColor="#333" bgckgroundBox='#fff'></Nav>
  4. <view class="tab-box flex-justify-around bgc-f ">
  5. <view class="tab-but flex-1 flex-direction align-items-center" @click="tabStitle(index)"
  6. v-for="(item, index) in tabList" :key="index">
  7. <view class="fs-32 mb-18" :class="tabNum==index?'fc-41ABF5':'fc-3'">
  8. {{item}}
  9. </view>
  10. <view v-show="tabNum==index" class="tab-hr bgc-41ABF5"></view>
  11. </view>
  12. </view>
  13. <scroll-view :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  14. <view class="list-box" v-if="tabNum == 0">
  15. <view class="item-box bgc-f b-rad-20 mb-20" v-for="(item,index) in itemData" :key="index">
  16. <view class="fw-600 fs-32 fc-3 mb-16">
  17. {{item.shop_name}}
  18. </view>
  19. <view class="goods-box align-items-center mb-24">
  20. <image class="goods-img mr-16" :src="item.shop_logo" mode=""></image>
  21. <view class="">
  22. <view class="mb-8 fs-24 fc-6">
  23. {{item.created_date}} 下单
  24. </view>
  25. <view class="fc-FF7F00 fs-24">
  26. 你个这次外卖体验打多少分吗?
  27. </view>
  28. </view>
  29. </view>
  30. <view class="flex-justify-end">
  31. <view class="fc-41ABF5 fs-28 item-but" @click="goToUrl(item)">
  32. 评价
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="list-box" v-else>
  38. <view class="item-box bgc-f p-24 box-border-box display-flex b-rad-20 mb-20" v-for="(itemTwo,indexTwo) in itemData">
  39. <image class="item-head-img flex-shrink0 b-rad-12 mr-16" :src="itemTwo.shop_logo" mode="">
  40. </image>
  41. <view class="item-r-box flex-1">
  42. <view class="item-name align-items-center flex-justify-space mb-8">
  43. <view class="item-name-t fs-32 fc-3 fw-600 text-overflow-ellipsis-one">
  44. {{itemTwo.shop_name}}
  45. </view>
  46. <view class="fs-24 fc-9">
  47. {{itemTwo.created_date}}
  48. </view>
  49. </view>
  50. <view class="align-items-center mb-12">
  51. <view class="fs-24 fc-9">
  52. 商家:
  53. </view>
  54. <uni-rate class="mr-4" size="12" :value="itemTwo.grade" active-color="#FF7F00" />
  55. </view>
  56. <view class="text-overflow-ellipsis-t fs-28 fc-3 mb-20">
  57. {{itemTwo.content}}
  58. </view>
  59. <view class="item-img-box mb-20 align-items-center flex-wrap-wrap">
  60. <image class="b-rad-12" v-for="(imgUrl, imgIndex) in itemTwo.images" :src="imgUrl" mode="aspectFill" @click="lookImg(imgIndex,itemTwo.images)"
  61. :class="itemTwo.images.length==1?'item-img-one':itemTwo.images.length==2?'item-img-two':'item-img-three'">
  62. </image>
  63. </view>
  64. <view class="merchant-hf-box bgc-F3F4F6 p-20 box-border-box b-rad-16" v-if="itemTwo.shop_reply">
  65. <view class="align-items-center flex-justify-space mb-10">
  66. <view class="fs-24 fc-6">
  67. 商家回复
  68. </view>
  69. <view class="fs-20 fc-9">
  70. {{itemTwo.reply_time}}
  71. </view>
  72. </view>
  73. <view class="fs-24 fc-6">
  74. {{itemTwo.shop_reply}}
  75. </view>
  76. </view>
  77. <view class="but-box align-items-center flex-justify-end">
  78. <uni-icons class="fc-9 mr-10 fs-28" type="trash"></uni-icons>
  79. <view class="fs-28 fc-3 mr-10" @click="del(itemTwo.id)">
  80. 删除
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <EnBlank :customSrc='true' v-if="itemData.length <= 0">
  87. <template v-slot:blankImg>
  88. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  89. </template>
  90. </EnBlank>
  91. </scroll-view>
  92. </view>
  93. </template>
  94. <script>
  95. import {
  96. commentWait,
  97. commentMyList,
  98. commentDel
  99. } from '@/api/comment.js'
  100. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  101. import tools from '@/service/tools';
  102. export default {
  103. components: {
  104. EnBlank
  105. },
  106. data() {
  107. return {
  108. tabNum: 0,
  109. // tabOneNum: 0,
  110. // tabTwoNum: 0,
  111. tabList: ['待评价', '已评价'],
  112. itemData: [],
  113. page: 1
  114. };
  115. },
  116. computed: {
  117. // tabList() {
  118. // return ['待评价(' + this.tabOneNum + ')', '已评价(' + this.tabTwoNum + ')'];
  119. // }
  120. },
  121. onShow() {
  122. this.getListData()
  123. },
  124. onLoad(data) {},
  125. mounted() {},
  126. methods: {
  127. lookImg(i, item) {
  128. tools.lookBigImg(i, item)
  129. },
  130. del(id) {
  131. commentDel({id: id}).then((res) => {
  132. if(res.code == 1) {
  133. tools.success(res.msg)
  134. this.getListData()
  135. }else {
  136. tools.error(res.msg)
  137. }
  138. })
  139. },
  140. tabStitle(index) {
  141. if (this.tabNum == index) {
  142. return
  143. }
  144. this.tabNum = index
  145. this.getListData()
  146. },
  147. getListData() {
  148. this.itemData = []
  149. this.page = 1
  150. if (this.tabNum == 0) {
  151. this.commentWait()
  152. } else {
  153. this.commentMyList()
  154. }
  155. },
  156. scrolltolower() {
  157. console.log('触底');
  158. },
  159. goToUrl(item) {
  160. uni.navigateTo({
  161. url: `/pages-my/appraise?orderId=` + item.order_id + '&shopName=' + item.shop_name + '&shopLogo=' + item.shop_logo
  162. })
  163. },
  164. commentWait() {
  165. // 获取待评价列表
  166. commentWait({
  167. page: this.page
  168. }).then((res) => {
  169. if (res.code == 1) {
  170. if (res.data.items.length > 0) {
  171. this.itemData.push(...res.data.items)
  172. }
  173. }
  174. })
  175. },
  176. commentMyList() {
  177. commentMyList({
  178. page: this.page
  179. }).then((res) => {
  180. if (res.code == 1) {
  181. if (res.data.items.length > 0) {
  182. this.itemData.push(...res.data.items)
  183. }
  184. }
  185. })
  186. }
  187. },
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. .tab-box {
  192. padding: 22rpx 0 4rpx 0;
  193. }
  194. .tab-hr {
  195. width: 40rpx;
  196. height: 4rpx;
  197. border-radius: 2rpx;
  198. }
  199. .list-box {
  200. padding: 24rpx;
  201. box-sizing: border-box;
  202. }
  203. .item-box {
  204. padding: 24rpx;
  205. box-sizing: border-box;
  206. }
  207. .goods-img {
  208. width: 100rpx;
  209. height: 100rpx;
  210. border-radius: 8rpx;
  211. }
  212. .item-but {
  213. width: 152rpx;
  214. height: 56rpx;
  215. line-height: 56rpx;
  216. text-align: center;
  217. border: 2rpx solid #41ABF5;
  218. border-radius: 200rpx;
  219. }
  220. .item-head-img {
  221. width: 80rpx;
  222. height: 80rpx;
  223. }
  224. .item-name-t {
  225. max-width: 348rpx;
  226. }
  227. .item-img-box {
  228. width: calc(100% + 6rpx);
  229. }
  230. .item-img-one {
  231. width: 360rpx;
  232. height: 360rpx;
  233. }
  234. .item-img-two {
  235. width: 276rpx;
  236. height: 276rpx;
  237. margin: 0 6rpx 0 0;
  238. }
  239. .item-img-three {
  240. width: 182rpx;
  241. height: 182rpx;
  242. margin: 0 6rpx 6rpx 0;
  243. }
  244. .but-box{
  245. padding: 24rpx 0 0 0;
  246. border-top: 2rpx solid #F9F9F9;
  247. }
  248. </style>