my-appraise.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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 in itemTwo.images" :src="imgUrl" mode="aspectFill"
  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. del(id) {
  128. commentDel({id: id}).then((res) => {
  129. if(res.code == 1) {
  130. tools.success(res.msg)
  131. this.getListData()
  132. }else {
  133. tools.error(res.msg)
  134. }
  135. })
  136. },
  137. tabStitle(index) {
  138. if (this.tabNum == index) {
  139. return
  140. }
  141. this.tabNum = index
  142. this.getListData()
  143. },
  144. getListData() {
  145. this.itemData = []
  146. this.page = 1
  147. if (this.tabNum == 0) {
  148. this.commentWait()
  149. } else {
  150. this.commentMyList()
  151. }
  152. },
  153. scrolltolower() {
  154. console.log('触底');
  155. },
  156. goToUrl(item) {
  157. uni.navigateTo({
  158. url: `/pages-my/appraise?orderId=` + item.order_id + '&shopName=' + item.shop_name + '&shopLogo=' + item.shop_logo
  159. })
  160. },
  161. commentWait() {
  162. // 获取待评价列表
  163. commentWait({
  164. page: this.page
  165. }).then((res) => {
  166. if (res.code == 1) {
  167. if (res.data.items.length > 0) {
  168. this.itemData.push(...res.data.items)
  169. }
  170. }
  171. })
  172. },
  173. commentMyList() {
  174. commentMyList({
  175. page: this.page
  176. }).then((res) => {
  177. if (res.code == 1) {
  178. if (res.data.items.length > 0) {
  179. this.itemData.push(...res.data.items)
  180. }
  181. }
  182. })
  183. }
  184. },
  185. }
  186. </script>
  187. <style lang="scss" scoped>
  188. .tab-box {
  189. padding: 22rpx 0 4rpx 0;
  190. }
  191. .tab-hr {
  192. width: 40rpx;
  193. height: 4rpx;
  194. border-radius: 2rpx;
  195. }
  196. .list-box {
  197. padding: 24rpx;
  198. box-sizing: border-box;
  199. }
  200. .item-box {
  201. padding: 24rpx;
  202. box-sizing: border-box;
  203. }
  204. .goods-img {
  205. width: 100rpx;
  206. height: 100rpx;
  207. border-radius: 8rpx;
  208. }
  209. .item-but {
  210. width: 152rpx;
  211. height: 56rpx;
  212. line-height: 56rpx;
  213. text-align: center;
  214. border: 2rpx solid #41ABF5;
  215. border-radius: 200rpx;
  216. }
  217. .item-head-img {
  218. width: 80rpx;
  219. height: 80rpx;
  220. }
  221. .item-name-t {
  222. max-width: 348rpx;
  223. }
  224. .item-img-box {
  225. width: calc(100% + 6rpx);
  226. }
  227. .item-img-one {
  228. width: 360rpx;
  229. height: 360rpx;
  230. }
  231. .item-img-two {
  232. width: 276rpx;
  233. height: 276rpx;
  234. margin: 0 6rpx 0 0;
  235. }
  236. .item-img-three {
  237. width: 182rpx;
  238. height: 182rpx;
  239. margin: 0 6rpx 6rpx 0;
  240. }
  241. .but-box{
  242. padding: 24rpx 0 0 0;
  243. border-top: 2rpx solid #F9F9F9;
  244. }
  245. </style>