时空网前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

213 lines
6.2 KiB

  1. <template>
  2. <view>
  3. <!-- 钱包余额信息 -->
  4. <view class="wallet-top">
  5. <view class="bg-white wallet-wraptop flex-direction flex justify-around align-center text-center">
  6. <view class="text-black1 text-price1" style="font-size: 72rpx;">{{walletBalance}}</view>
  7. <view class="text-gray lf-font-24 lf-m-b-20">佣金</view>
  8. <view>
  9. <button class="btn" @click="$url('/pages/center/widthdraw')">提取佣金</button>
  10. </view>
  11. </view>
  12. </view>
  13. <!-- tabs -->
  14. <view class="bg-white lf-p-t-40 lf-p-b-40 flex justify-around align-center text-center solid-bottom">
  15. <view class="tab-item" :class="current==index?'text-orange':'text-black1'"
  16. v-for="(item, index) in tab_list" :key="index"
  17. @click="changeTab(index)">{{ item.name }}
  18. </view>
  19. </view>
  20. <!-- scroll page -->
  21. <block v-if="current == 0">
  22. <scroll-view :style="{height: 'calc('+ windowHeight +'px - 524rpx)'}"
  23. :scroll-y="true" :refresher-enabled="true"
  24. :refresher-triggered="isRefresher"
  25. @scrolltolower="onScrolltolower"
  26. @refresherrefresh="onRefresherrefresh">
  27. <view class="flex flex-direction justify-between lf-p-t-20 lf-p-b-20 lf-p-l-32 lf-p-r-32 solid-bottom" v-for="(item, index) in tab_list[current].list" :key="item">
  28. <view class="flex align-center text-center justify-between">
  29. <view class="lf-font-36 lf-color-price">+¥{{item.add_price}}</view>
  30. <view class="lf-font-32 text-black1">结余 ¥{{item.final_price}}</view>
  31. </view>
  32. <view class="flex align-center text-center justify-between lf-m-t-10">
  33. <view class="lf-font-24 lf-color-999">{{item.reffer}}</view>
  34. <view class="lf-font-24 lf-color-999">{{item.created_at}}</view>
  35. </view>
  36. </view>
  37. <!-- 空数据的情况 -->
  38. <view class="loading-more">
  39. <text v-if="tab_list[0].list.length" :class="{'loading-more-text': tab_list[0].loadingClass}">{{ tab_list[0].loadingText }}</text>
  40. <my-nocontent v-else></my-nocontent>
  41. </view>
  42. </scroll-view>
  43. </block>
  44. <block v-else>
  45. <scroll-view :style="{height: 'calc('+ windowHeight +'px - 524rpx)'}"
  46. :scroll-y="true" :refresher-enabled="true"
  47. :refresher-triggered="isRefresher"
  48. @scrolltolower="onScrolltolower"
  49. @refresherrefresh="onRefresherrefresh">
  50. <view class="flex flex-direction justify-between lf-p-t-20 lf-p-b-20 lf-p-l-32 lf-p-r-32 solid-bottom" v-for="(item, index) in tab_list[current].list" :key="item">
  51. <view class="flex align-center text-center justify-between">
  52. <view class="lf-font-36 lf-color-price">+¥{{item.extract_price}}</view>
  53. <view class="lf-font-28 text-orange">{{item.state}}</view>
  54. </view>
  55. <view class="flex align-center text-center justify-between lf-m-t-10">
  56. <view class="lf-font-24 lf-color-999">流水号 {{item.order_no}}</view>
  57. <view class="lf-font-24 lf-color-999">{{item.created_at}}</view>
  58. </view>
  59. </view>
  60. <!-- 空数据的情况 -->
  61. <view class="loading-more">
  62. <text v-if="tab_list[1].list.length" :class="{'loading-more-text': tab_list[1].loadingClass}">{{ tab_list[1].loadingText }}</text>
  63. <my-nocontent v-else></my-nocontent>
  64. </view>
  65. </scroll-view>
  66. </block>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. current: 0,
  74. pageSize: 10,
  75. isRefresher: false, // scroll-view下拉刷新状态,当前默认没有触发
  76. tab_list: [{
  77. name: '佣金记录',
  78. list: [],
  79. page: 1,
  80. isPage: false,
  81. loadingClass: false,
  82. loadingText: '已加载全部数据'
  83. },{
  84. name: '提取记录',
  85. list: [],
  86. page: 1,
  87. isPage: false,
  88. loadingClass: true,
  89. loadingText: '正在加载中'
  90. }],
  91. windowHeight: 0,
  92. walletBalance: 0
  93. }
  94. },
  95. onLoad(){
  96. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  97. this.getIncomeList()
  98. },
  99. methods: {
  100. changeTab(index) {
  101. if(this.current == index) {
  102. return
  103. }else {
  104. this.current = index
  105. if(index == 0) {
  106. this.getIncomeList()
  107. }else {
  108. this.getWidthList()
  109. }
  110. }
  111. },
  112. //提取记录
  113. getWidthList() {
  114. let per_page = this.pageSize;
  115. let tab_item = this.tab_list[this.current];
  116. this.$http(this.API.API_EXTRACTLIST, {
  117. page: tab_item.page,
  118. limit: per_page
  119. }).then(res => {
  120. this.isRefresher = false;
  121. let isPage = res.data.has_more_page;
  122. tab_item.isPage = isPage;
  123. if(!isPage){
  124. tab_item.loadingClass = false;
  125. tab_item.loadingText = '没有更多数据啦~';
  126. }
  127. if(tab_item.page == 1){
  128. tab_item.list = res.data.items;
  129. }else{
  130. tab_item.list.push(...res.data.items);
  131. }
  132. })
  133. },
  134. //佣金记录
  135. getIncomeList() {
  136. let per_page = this.pageSize;
  137. let tab_item = this.tab_list[this.current];
  138. this.$http(this.API.API_INCOMELIST, {
  139. page: tab_item.page,
  140. limit: per_page
  141. }).then(res => {
  142. this.isRefresher = false;
  143. this.walletBalance = res.data.income
  144. let isPage = res.data.has_more_page;
  145. tab_item.isPage = isPage;
  146. if(!isPage){
  147. tab_item.loadingClass = false;
  148. tab_item.loadingText = '没有更多数据啦~';
  149. }
  150. if(tab_item.page == 1){
  151. tab_item.list = res.data.items;
  152. }else{
  153. tab_item.list.push(...res.data.items);
  154. }
  155. })
  156. },
  157. // 页面触底,加载下一页
  158. onScrolltolower(){
  159. let tab_item = this.tab_list[this.current];
  160. if(tab_item.isPage){
  161. tab_item.page = tab_item.page + 1;
  162. this.getIncomeList()
  163. }
  164. console.log('加载下一页')
  165. },
  166. // scroll-view 下拉刷新
  167. onRefresherrefresh(){
  168. this.isRefresher = true;
  169. console.log('下拉刷新')
  170. this.getIncomeList()
  171. }
  172. }
  173. }
  174. </script>
  175. <style scoped lang="scss">
  176. .tab-item{
  177. font-size: 32rpx;
  178. width: 50%;
  179. box-sizing: border-box;
  180. &:first-child{
  181. border-right: 2rpx solid rgba(0, 0, 0, 0.1);
  182. }
  183. }
  184. .com {
  185. height: 900rpx;
  186. }
  187. .wallet-top {
  188. height: 404rpx;
  189. width: 100%;
  190. padding: 28rpx 32rpx;
  191. background-color: #FE9903;
  192. }
  193. .wallet-wraptop {
  194. width: 100%;
  195. height: 100%;
  196. border-radius: 10rpx;
  197. padding: 46rpx 0 44rpx 0;
  198. }
  199. .btn{
  200. margin: 0;
  201. padding: 0;
  202. width: 320rpx;
  203. height: 84rpx;
  204. background-color: #FE9903;
  205. color: #FFFFFF;
  206. line-height: 84rpx;
  207. font-size: 32rpx;
  208. border-radius: 42rpx;
  209. }
  210. </style>