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

280 lines
7.6 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  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="getWidthdraw()">提取佣金</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 class='imagePathBox' v-if="maskHidden == true" @click="maskHidden = false ">
  69. <image :src="widthdrawImg" mode="aspectFill" class='shengcheng'></image>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data() {
  76. return {
  77. current: 0,
  78. pageSize: 10,
  79. isRefresher: false, // scroll-view下拉刷新状态,当前默认没有触发
  80. tab_list: [{
  81. name: '佣金记录',
  82. list: [],
  83. page: 1,
  84. isPage: false,
  85. loadingClass: false,
  86. loadingText: '已加载全部数据'
  87. },{
  88. name: '提取记录',
  89. list: [],
  90. page: 1,
  91. isPage: false,
  92. loadingClass: true,
  93. loadingText: '正在加载中'
  94. }],
  95. windowHeight: 0,
  96. walletBalance: 0,
  97. widthdrawImg: '',
  98. maskHidden: false
  99. }
  100. },
  101. onLoad(){
  102. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  103. this.getIncomeList()
  104. },
  105. methods: {
  106. getWidthdraw() {
  107. let userInfo = uni.getStorageSync('userinfo') || {};
  108. this.$http(this.API.API_WIDTHDRAWIMG, {
  109. token: userInfo.token
  110. }).then(res => {
  111. this.widthdrawImg = res.data.img.url
  112. console.log(this.widthdrawImg)
  113. if(this.widthdrawImg) {
  114. this.maskHidden = true
  115. }
  116. })
  117. },
  118. changeTab(index) {
  119. if(this.current == index) {
  120. return
  121. }else {
  122. this.current = index
  123. if(index == 0) {
  124. this.getIncomeList()
  125. }else {
  126. this.getWidthList()
  127. }
  128. }
  129. },
  130. //提取记录
  131. getWidthList() {
  132. let per_page = this.pageSize;
  133. let tab_item = this.tab_list[this.current];
  134. this.$http(this.API.API_EXTRACTLIST, {
  135. page: tab_item.page,
  136. limit: per_page
  137. }).then(res => {
  138. this.isRefresher = false;
  139. let isPage = res.data.has_more_page;
  140. tab_item.isPage = isPage;
  141. if(!isPage){
  142. tab_item.loadingClass = false;
  143. tab_item.loadingText = '没有更多数据啦~';
  144. }
  145. if(tab_item.page == 1){
  146. tab_item.list = res.data.items;
  147. }else{
  148. tab_item.list.push(...res.data.items);
  149. }
  150. })
  151. },
  152. //佣金记录
  153. getIncomeList() {
  154. let per_page = this.pageSize;
  155. let tab_item = this.tab_list[this.current];
  156. this.$http(this.API.API_INCOMELIST, {
  157. page: tab_item.page,
  158. limit: per_page
  159. }).then(res => {
  160. this.isRefresher = false;
  161. this.walletBalance = res.data.income || 0
  162. let isPage = res.data.has_more_page;
  163. tab_item.isPage = isPage;
  164. if(!isPage){
  165. tab_item.loadingClass = false;
  166. tab_item.loadingText = '没有更多数据啦~';
  167. }
  168. if(tab_item.page == 1){
  169. tab_item.list = res.data.items;
  170. }else{
  171. tab_item.list.push(...res.data.items);
  172. }
  173. })
  174. },
  175. // 页面触底,加载下一页
  176. onScrolltolower(){
  177. let tab_item = this.tab_list[this.current];
  178. if(tab_item.isPage){
  179. tab_item.page = tab_item.page + 1;
  180. this.getIncomeList()
  181. }
  182. console.log('加载下一页')
  183. },
  184. // scroll-view 下拉刷新
  185. onRefresherrefresh(){
  186. this.isRefresher = true;
  187. if(this.current == 0) {
  188. this.getIncomeList()
  189. }else {
  190. this.getWidthList()
  191. }
  192. }
  193. }
  194. }
  195. </script>
  196. <style scoped lang="scss">
  197. .imagePathBox {
  198. width: 100%;
  199. height: 100%;
  200. background: rgba(0, 0, 0, 0.7);
  201. position: fixed;
  202. top: 0;
  203. left: 0;
  204. right: 0;
  205. bottom: 0;
  206. z-index: 10;
  207. }
  208. .shengcheng {
  209. width: 80%;
  210. height: 80%;
  211. position: fixed;
  212. top: 136rpx;
  213. left: 50%;
  214. margin-left: -40%;
  215. z-index: 10;
  216. }
  217. .baocun {
  218. display: block;
  219. width: 80%;
  220. height: 80rpx;
  221. padding: 0;
  222. line-height: 80rpx;
  223. text-align: center;
  224. position: fixed;
  225. bottom: 50rpx;
  226. left: 10%;
  227. background: #ffe200;
  228. color: #333;
  229. font-size: 32rpx;
  230. border-radius: 44rpx;
  231. }
  232. button[class="baocun"]::after {
  233. border: 0;
  234. }
  235. .tab-item{
  236. font-size: 32rpx;
  237. width: 50%;
  238. box-sizing: border-box;
  239. &:first-child{
  240. border-right: 2rpx solid rgba(0, 0, 0, 0.1);
  241. }
  242. }
  243. .com {
  244. height: 900rpx;
  245. }
  246. .wallet-top {
  247. height: 404rpx;
  248. width: 100%;
  249. padding: 28rpx 32rpx;
  250. background-color: #FE9903;
  251. }
  252. .wallet-wraptop {
  253. width: 100%;
  254. height: 100%;
  255. border-radius: 10rpx;
  256. padding: 46rpx 0 44rpx 0;
  257. }
  258. .btn{
  259. margin: 0;
  260. padding: 0;
  261. width: 320rpx;
  262. height: 84rpx;
  263. background-color: #FE9903;
  264. color: #FFFFFF;
  265. line-height: 84rpx;
  266. font-size: 32rpx;
  267. border-radius: 42rpx;
  268. }
  269. .scroll-view{
  270. padding-bottom: constant(safe-area-inset-bottom);
  271. padding-bottom: env(safe-area-inset-bottom);
  272. }
  273. </style>