时空网前端
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.

217 lines
6.3 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 - 530rpx)'}"
  23. class="scroll-view"
  24. :scroll-y="true" :refresher-enabled="true"
  25. :refresher-triggered="isRefresher"
  26. @scrolltolower="onScrolltolower"
  27. @refresherrefresh="onRefresherrefresh">
  28. <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">
  29. <view class="flex align-center text-center justify-between">
  30. <view class="lf-font-36 lf-color-price">+¥{{item.add_price || 0}}</view>
  31. <view class="lf-font-32 text-black1">结余 ¥{{item.final_price || 0}}</view>
  32. </view>
  33. <view class="flex align-center text-center justify-between lf-m-t-10">
  34. <view class="lf-font-24 lf-color-999">{{item.reffer || 0}}</view>
  35. <view class="lf-font-24 lf-color-999">{{item.created_at || 0}}</view>
  36. </view>
  37. </view>
  38. <!-- 空数据的情况 -->
  39. <view class="loading-more">
  40. <text v-if="tab_list[0].list.length" :class="{'loading-more-text': tab_list[0].loadingClass}">{{ tab_list[0].loadingText }}</text>
  41. <my-nocontent v-else></my-nocontent>
  42. </view>
  43. </scroll-view>
  44. </block>
  45. <block v-else>
  46. <scroll-view :style="{height: 'calc('+ windowHeight +'px - 524rpx)'}"
  47. :scroll-y="true" :refresher-enabled="true"
  48. :refresher-triggered="isRefresher"
  49. @scrolltolower="onScrolltolower"
  50. @refresherrefresh="onRefresherrefresh">
  51. <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">
  52. <view class="flex align-center text-center justify-between">
  53. <view class="lf-font-36 lf-color-price">+¥{{item.extract_price || 0}}</view>
  54. <view class="lf-font-28 text-orange">{{item.state || 0}}</view>
  55. </view>
  56. <view class="flex align-center text-center justify-between lf-m-t-10">
  57. <view class="lf-font-24 lf-color-999">流水号 {{item.order_no || 0}}</view>
  58. <view class="lf-font-24 lf-color-999">{{item.created_at || 0}}</view>
  59. </view>
  60. </view>
  61. <!-- 空数据的情况 -->
  62. <view class="loading-more">
  63. <text v-if="tab_list[1].list.length" :class="{'loading-more-text': tab_list[1].loadingClass}">{{ tab_list[1].loadingText }}</text>
  64. <my-nocontent v-else></my-nocontent>
  65. </view>
  66. </scroll-view>
  67. </block>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. current: 0,
  75. pageSize: 10,
  76. isRefresher: false, // scroll-view下拉刷新状态,当前默认没有触发
  77. tab_list: [{
  78. name: '佣金记录',
  79. list: [],
  80. page: 1,
  81. isPage: false,
  82. loadingClass: false,
  83. loadingText: '已加载全部数据'
  84. },{
  85. name: '提取记录',
  86. list: [],
  87. page: 1,
  88. isPage: false,
  89. loadingClass: true,
  90. loadingText: '正在加载中'
  91. }],
  92. windowHeight: 0,
  93. walletBalance: 0
  94. }
  95. },
  96. onLoad(){
  97. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  98. this.getIncomeList()
  99. },
  100. methods: {
  101. changeTab(index) {
  102. if(this.current == index) {
  103. return
  104. }else {
  105. this.current = index
  106. if(index == 0) {
  107. this.getIncomeList()
  108. }else {
  109. this.getWidthList()
  110. }
  111. }
  112. },
  113. //提取记录
  114. getWidthList() {
  115. let per_page = this.pageSize;
  116. let tab_item = this.tab_list[this.current];
  117. this.$http(this.API.API_EXTRACTLIST, {
  118. page: tab_item.page,
  119. limit: per_page
  120. }).then(res => {
  121. this.isRefresher = false;
  122. let isPage = res.data.has_more_page;
  123. tab_item.isPage = isPage;
  124. if(!isPage){
  125. tab_item.loadingClass = false;
  126. tab_item.loadingText = '没有更多数据啦~';
  127. }
  128. if(tab_item.page == 1){
  129. tab_item.list = res.data.items;
  130. }else{
  131. tab_item.list.push(...res.data.items);
  132. }
  133. })
  134. },
  135. //佣金记录
  136. getIncomeList() {
  137. let per_page = this.pageSize;
  138. let tab_item = this.tab_list[this.current];
  139. this.$http(this.API.API_INCOMELIST, {
  140. page: tab_item.page,
  141. limit: per_page
  142. }).then(res => {
  143. this.isRefresher = false;
  144. this.walletBalance = res.data.income || 0
  145. let isPage = res.data.has_more_page;
  146. tab_item.isPage = isPage;
  147. if(!isPage){
  148. tab_item.loadingClass = false;
  149. tab_item.loadingText = '没有更多数据啦~';
  150. }
  151. if(tab_item.page == 1){
  152. tab_item.list = res.data.items;
  153. }else{
  154. tab_item.list.push(...res.data.items);
  155. }
  156. })
  157. },
  158. // 页面触底,加载下一页
  159. onScrolltolower(){
  160. let tab_item = this.tab_list[this.current];
  161. if(tab_item.isPage){
  162. tab_item.page = tab_item.page + 1;
  163. this.getIncomeList()
  164. }
  165. console.log('加载下一页')
  166. },
  167. // scroll-view 下拉刷新
  168. onRefresherrefresh(){
  169. this.isRefresher = true;
  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. .scroll-view{
  211. padding-bottom: constant(safe-area-inset-bottom);
  212. padding-bottom: env(safe-area-inset-bottom);
  213. }
  214. </style>