paihangbang.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view>
  3. <!-- 背景图 -->
  4. <view class="topBg">
  5. <image :src="image" mode="aspectFill"></image>
  6. </view>
  7. <view class="listBox">
  8. <view class="listBox-search">
  9. <u-tabs :list="currentList" :is-scroll="false" :current="current" @change="change"></u-tabs>
  10. </view>
  11. <view class="listBox-cont flex align-center justify-center">
  12. <view class="listBox-contb">
  13. <u-table style="width: 100%" border-color="#ffffff">
  14. <u-tr>
  15. <u-th>排名</u-th>
  16. <u-th>师傅头像</u-th>
  17. <u-th>师傅昵称</u-th>
  18. <u-th>接单量</u-th>
  19. <u-th>收益</u-th>
  20. </u-tr>
  21. </u-table>
  22. <scroll-view @scrolltolower="scrolltolower" scroll-y="true" class="listBox-conts">
  23. <u-table style="width: 100%;height: 100%;" border-color="#ffffff">
  24. <u-tr v-for="(item,index) in list" :key="index">
  25. <u-td>
  26. <image class="icons" v-if="index == 0" src="../static/one.png" mode="">
  27. </image>
  28. <image class="icons" v-else-if="index == 1" src="../static/two.png" mode="">
  29. </image>
  30. <image class="icons" v-else-if="index == 2" src="../static/three.png" mode="">
  31. </image>
  32. <text v-else>{{index+1}}</text>
  33. </u-td>
  34. <u-td>
  35. <image class="icons" style="border-radius: 50%;"
  36. :src="item.avatar?item.avatar:'../../static/logo.png'" mode="">
  37. </image>
  38. </u-td>
  39. <u-td>{{item.nick_name}}</u-td>
  40. <u-td>{{item.indentCount}}</u-td>
  41. <u-td>{{item.money}}</u-td>
  42. </u-tr>
  43. <empty v-if="list.length == 0"></empty>
  44. </u-table>
  45. </scroll-view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import empty from '../../components/empty.vue'
  53. export default {
  54. components: {
  55. empty
  56. },
  57. data() {
  58. return {
  59. current: 1,
  60. currentList: [{
  61. name: '昨日',
  62. time: '',
  63. flag: 1
  64. }, {
  65. name: '今日',
  66. time: '',
  67. flag: 1
  68. }, {
  69. name: '本月',
  70. time: '',
  71. flag: 2
  72. }],
  73. page: 1,
  74. size: 10,
  75. list: [],
  76. pages: 1,
  77. image: 'https://douyin.xianmaxiong.com/img/20221021/e786a266d4c34608ad79a7a04bfed1fa.png',
  78. };
  79. },
  80. onLoad() {
  81. this.currentList[0].time = this.getDate(true)
  82. this.currentList[1].time = this.getDate(false)
  83. this.currentList[2].time = this.getDate(false)
  84. this.getlist()
  85. },
  86. onShow() {
  87. },
  88. methods: {
  89. scrolltolower() {
  90. if (this.page < this.pages) {
  91. this.page += 1
  92. this.getlist()
  93. }
  94. },
  95. getDate(type) {
  96. const today = new Date();
  97. const yesterday = new Date(today);
  98. if (type === true) {
  99. yesterday.setDate(yesterday.getDate() - 1);
  100. }
  101. const year = today.getFullYear();
  102. const month = ('0' + (today.getMonth() + 1)).slice(-2);
  103. const day = ('0' + today.getDate()).slice(-2);
  104. const formattedToday = `${year}-${month}-${day}`;
  105. const formattedYesterday = (`${year}-${month}-${day}`).replace(today.getDate(), yesterday.getDate());
  106. return type === true ? formattedYesterday : formattedToday;
  107. },
  108. change(index) {
  109. this.current = index
  110. this.page = 1
  111. this.getlist()
  112. },
  113. getlist() {
  114. let data = {
  115. page: this.page,
  116. limit: this.size,
  117. time: this.currentList[this.current].time,
  118. flag: this.currentList[this.current].flag
  119. }
  120. this.$Request.get('/app/indent/getProfitList', data).then(res => {
  121. uni.stopPullDownRefresh()
  122. uni.hideLoading();
  123. this.pages = res.data.pages
  124. if (this.page == 1) {
  125. this.list = res.data.records; //如果是第一页需手动制空列表
  126. } else {
  127. this.list = [...this.list, ...res.data.records]; //追加新数据
  128. }
  129. })
  130. }
  131. },
  132. onPullDownRefresh: function() {
  133. this.page = 1;
  134. this.getlist()
  135. },
  136. }
  137. </script>
  138. <style lang="scss">
  139. ::v-deep .u-th {
  140. background-color: #ffffff !important;
  141. color: #999999 !important;
  142. font-weight: 400 !important;
  143. }
  144. ::v-deep .u-td {
  145. height: 75rpx;
  146. position: relative;
  147. margin-bottom: 40rpx;
  148. color: #303133;
  149. font-size: 28rpx;
  150. }
  151. .icons {
  152. width: 75rpx;
  153. height: 75rpx;
  154. position: absolute;
  155. top:40rpx;
  156. left: 50%;
  157. transform: translate(-50%, -50%);
  158. }
  159. </style>
  160. <style lang="scss" scoped>
  161. page {
  162. background-color: #ffffff;
  163. }
  164. .topBg {
  165. width: 100%;
  166. height: 360rpx;
  167. position: fixed;
  168. /* #ifdef H5 */
  169. top: 80rpx;
  170. /* #endif */
  171. /* #ifndef H5 */
  172. top: 0;
  173. /* #endif */
  174. image {
  175. width: 100%;
  176. height: 100%;
  177. }
  178. }
  179. .listBox {
  180. width: 100%;
  181. height: calc(100vh - 340rpx);
  182. border-radius: 32rpx 32rpx 0 0;
  183. background-color: #ffffff;
  184. position: fixed;
  185. top: 340rpx;
  186. }
  187. .listBox-search {
  188. margin-top: 20rpx;
  189. }
  190. .listBox-cont {
  191. width: 100%;
  192. height: calc(100% - 120rpx);
  193. background-color: #ffffff;
  194. margin-top: 20rpx;
  195. }
  196. .listBox-contb {
  197. width: 710rpx;
  198. height: 100%;
  199. }
  200. .listBox-conts {
  201. width: 100%;
  202. height: calc(100% - 60rpx);
  203. background-color: #ffffff;
  204. }
  205. </style>