award.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar"><!-- 这里是状态栏 --></view>
  5. <view class="body-title">
  6. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view>
  7. <view class="header">我的奖金</view>
  8. </view>
  9. <view class="content-bg"><image src="../../static/img/tg-bg.png" mode=""></image></view>
  10. <view class="money-box">
  11. <view class="money">{{ yj || 0 }}</view>
  12. <view>我的奖金</view>
  13. </view>
  14. <view class="moneybtn-box">
  15. <view class="money-btn"></view>
  16. <view class="money-btn" @click="navto('/pages/user/withdrawal')">奖金提现</view>
  17. <!-- <view class="money-btn"></view> -->
  18. </view>
  19. </view>
  20. <view class="info-box flex">
  21. <view class="info-item">
  22. <view class="info-font">累计收入</view>
  23. <view class="info-num">{{ sr || '0' }}</view>
  24. </view>
  25. <view class="shu"></view>
  26. <view class="info-item">
  27. <view class="info-font">累计支出</view>
  28. <view class="info-num">{{ zc || '0' }}</view>
  29. </view>
  30. </view>
  31. <view class="navbar">
  32. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  33. </view>
  34. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" @change="changeTab">
  35. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  36. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
  37. <!-- 空白页 -->
  38. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  39. <!-- 订单列表 -->
  40. <view>
  41. <view class="order-item flex" v-for="(item, index) in tabItem.orderList" :key="index">
  42. <view class="title-box">
  43. <view class="title">
  44. <text>{{ item.title }}</text>
  45. </view>
  46. <view class="time">
  47. <text>{{ item.status == 1 ? item.add_time: '待发放' }}</text>
  48. </view>
  49. </view>
  50. <view class="money">
  51. <view>{{ (item.pm == 0 ? '-' : '+') + item.number }}</view>
  52. </view>
  53. </view>
  54. </view>
  55. <uni-load-more :status="tabItem.loadingType" v-if="!(tabItem.orderList.length == 0 && tabItem.loaded)"></uni-load-more>
  56. </scroll-view>
  57. </swiper-item>
  58. </swiper>
  59. </view>
  60. </template>
  61. <script>
  62. import { mapState, mapMutations } from 'vuex';
  63. import { getCommissionInfo, getUser, brokerageList } from '@/api/user.js';
  64. import { getMoneyStyle } from '@/utils/rocessor.js';
  65. import { mapGetters } from 'vuex';
  66. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  67. import empty from '@/components/empty';
  68. import { spreadCommission, userBalance, extractBank } from '@/api/wallet.js';
  69. export default {
  70. filters: {
  71. getMoneyStyle
  72. },
  73. components: {
  74. empty,
  75. uniLoadMore
  76. },
  77. onReady(res) {
  78. var _this = this;
  79. uni.getSystemInfo({
  80. success: resu => {
  81. const query = uni.createSelectorQuery();
  82. query.select('.swiper-box').boundingClientRect();
  83. query.exec(function(res) {
  84. _this.height = resu.windowHeight - res[0].top + 'px';
  85. console.log('打印页面的剩余高度', _this.height);
  86. });
  87. },
  88. fail: res => {}
  89. });
  90. },
  91. data() {
  92. return {
  93. userInfo: {},
  94. sr: '',
  95. zc: '',
  96. yj: '',
  97. height: '',
  98. // 头部图高度
  99. maxheight: '',
  100. tabCurrentIndex: 0,
  101. orderStatusSum: 0,
  102. recharge: 0,
  103. navList: [
  104. // {
  105. // state: 0,
  106. // text: '全部',
  107. // loadingType: 'more',
  108. // orderList: [],
  109. // page: 1, //当前页数
  110. // limit: 10 //每次信息条数
  111. // },
  112. {
  113. state: 0,
  114. text: '支出',
  115. loadingType: 'more',
  116. orderList: [],
  117. page: 1, //当前页数
  118. limit: 10 //每次信息条数
  119. },
  120. {
  121. state: 1,
  122. text: '收入',
  123. loadingType: 'more',
  124. orderList: [],
  125. page: 1, //当前页数
  126. limit: 10 //每次信息条数
  127. }
  128. ],
  129. money: ''
  130. };
  131. },
  132. onLoad(options) {},
  133. onShow() {
  134. this.extractBank();
  135. this.getUserInfo();
  136. },
  137. methods: {
  138. getUserInfo() {
  139. getUser({}).then(({ data }) => {
  140. console.log(data, 'data');
  141. this.userInfo = data;
  142. this.loadData();
  143. });
  144. },
  145. extractBank() {
  146. extractBank().then(res => {
  147. console.log(res);
  148. this.yj = res.data.brokerage_price;
  149. });
  150. },
  151. toBack() {
  152. uni.switchTab({
  153. url: '/pages/user/user'
  154. });
  155. },
  156. // 页面跳转
  157. navto(e) {
  158. uni.navigateTo({
  159. url: e
  160. });
  161. },
  162. //获取收入支出信息
  163. async loadData(source) {
  164. let obj = this;
  165. //这里是将订单挂载到tab列表下
  166. let index = this.tabCurrentIndex;
  167. let navItem = this.navList[index];
  168. let state = navItem.state;
  169. if (source === 'tabChange' && navItem.loaded == true) {
  170. //tab切换只有第一次需要加载数据
  171. return;
  172. }
  173. if (navItem.loadingType == 'loading' || navItem.loadingType == 'noMore') {
  174. //防止重复加载
  175. return;
  176. }
  177. // 修改当前对象状态为加载中
  178. navItem.loadingType = 'loading';
  179. // alert(obj.userInfo.vip)
  180. console.log(obj.userInfo);
  181. brokerageList(
  182. {
  183. page: navItem.page,
  184. limit: navItem.limit,
  185. uid: obj.userInfo.uid
  186. },
  187. state
  188. )
  189. .then(({ data }) => {
  190. obj.sr = data.general_expend;
  191. obj.zc = data.general_income;
  192. navItem.orderList = navItem.orderList.concat(data.list);
  193. navItem.page++
  194. //判断是否还有数据, 有改为more, 没有改为noMore
  195. if (navItem.limit == data.list.length) {
  196. navItem.loadingType = 'more';
  197. } else {
  198. navItem.loadingType = 'noMore';
  199. }
  200. this.$set(navItem, 'loaded', true);
  201. })
  202. .catch(e => {
  203. console.log(e);
  204. });
  205. },
  206. //swiper 切换
  207. changeTab(e) {
  208. this.tabCurrentIndex = e.target.current;
  209. this.loadData('tabChange');
  210. },
  211. //顶部tab点击
  212. tabClick(index) {
  213. this.tabCurrentIndex = index;
  214. }
  215. }
  216. };
  217. </script>
  218. <style lang="scss">
  219. page {
  220. background: #f1f1f1;
  221. height: 100%;
  222. }
  223. .status_bar {
  224. height: var(--status-bar-height);
  225. width: 100%;
  226. }
  227. .content-money {
  228. position: relative;
  229. height: 480rpx;
  230. .content-bg {
  231. position: absolute;
  232. top: 0;
  233. left: 0;
  234. right: 0;
  235. width: 750rpx;
  236. height: 480rpx;
  237. image {
  238. width: 100%;
  239. height: 100%;
  240. }
  241. }
  242. .body-title {
  243. height: 80rpx;
  244. text-align: center;
  245. font-size: 35rpx;
  246. position: relative;
  247. .header {
  248. position: absolute;
  249. left: 0;
  250. top: 0;
  251. width: 100%;
  252. font-size: 36rpx;
  253. font-family: PingFang SC;
  254. font-weight: bold;
  255. color: #fffeff;
  256. height: 80rpx;
  257. font-size: 36rpx;
  258. font-weight: 700;
  259. z-index: 9;
  260. display: flex;
  261. justify-content: center;
  262. align-items: center;
  263. }
  264. .goback-box {
  265. position: absolute;
  266. left: 18rpx;
  267. top: 0;
  268. height: 80rpx;
  269. display: flex;
  270. align-items: center;
  271. }
  272. .goback {
  273. z-index: 100;
  274. width: 34rpx;
  275. height: 34rpx;
  276. }
  277. }
  278. }
  279. .info-box {
  280. width: 670rpx;
  281. height: 186rpx;
  282. background: #ffffff;
  283. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  284. border-radius: 20rpx;
  285. margin: -100rpx auto 0;
  286. position: relative;
  287. z-index: 2;
  288. .info-item {
  289. width: 50%;
  290. display: flex;
  291. flex-direction: column;
  292. align-items: center;
  293. line-height: 1;
  294. .info-font {
  295. font-size: 30rpx;
  296. font-family: PingFang SC;
  297. font-weight: bold;
  298. color: #999999;
  299. }
  300. .info-num {
  301. margin-top: 30rpx;
  302. font-size: 30rpx;
  303. font-family: PingFang SC;
  304. font-weight: bold;
  305. color: #181818;
  306. }
  307. }
  308. .shu {
  309. width: 2rpx;
  310. height: 74rpx;
  311. background: #dcdfe6;
  312. }
  313. }
  314. .money-box {
  315. position: relative;
  316. z-index: 2;
  317. /* #ifdef H5 */
  318. padding-top: 90rpx;
  319. /* #endif */
  320. color: #ffffff;
  321. text-align: center;
  322. /* #ifdef APP-PLUS */
  323. height: 200rpx;
  324. display: flex;
  325. flex-direction: column;
  326. justify-content: center;
  327. /* #endif */
  328. /* #ifdef MP-WEIXIN */
  329. padding-top: 40rpx;
  330. /* #endif */
  331. .money {
  332. font-size: 72rpx;
  333. font-family: PingFang SC;
  334. font-weight: bold;
  335. color: #ffffff;
  336. }
  337. .text {
  338. font-size: 30rpx;
  339. }
  340. }
  341. .moneybtn-box {
  342. display: flex;
  343. justify-content: space-between;
  344. position: relative;
  345. z-index: 2;
  346. color: #ffffff;
  347. padding: 0rpx 50rpx;
  348. font-size: 30rpx;
  349. font-family: PingFang SC;
  350. font-weight: bold;
  351. color: #ffffff;
  352. }
  353. .navbar {
  354. margin-top: 20rpx;
  355. display: flex;
  356. height: 88rpx;
  357. padding: 0 5px;
  358. background: #fff;
  359. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  360. position: relative;
  361. z-index: 10;
  362. .nav-item {
  363. flex: 1;
  364. display: flex;
  365. justify-content: center;
  366. align-items: center;
  367. height: 100%;
  368. font-size: 15px;
  369. color: #999999;
  370. position: relative;
  371. &.current {
  372. color: #000;
  373. &:after {
  374. content: '';
  375. position: absolute;
  376. left: 50%;
  377. bottom: 0;
  378. transform: translateX(-50%);
  379. width: 44px;
  380. height: 0;
  381. border-bottom: 2px solid #fe5b38;
  382. }
  383. }
  384. }
  385. }
  386. //列表
  387. .swiper-box {
  388. .order-item:last-child {
  389. margin-bottom: 60rpx;
  390. }
  391. .order-item {
  392. padding: 20rpx 30rpx;
  393. line-height: 1.5;
  394. .title-box {
  395. .title {
  396. font-size: $font-lg;
  397. color: $font-color-base;
  398. }
  399. .time {
  400. font-size: $font-base;
  401. color: $font-color-light;
  402. }
  403. }
  404. .money {
  405. color: #fd5b23;
  406. font-size: $font-lg;
  407. text-align: right;
  408. .status {
  409. color: $font-color-light;
  410. }
  411. }
  412. }
  413. }
  414. .list-scroll-content {
  415. background: #ffffff;
  416. height: 100%;
  417. }
  418. .content {
  419. height: 100%;
  420. .empty-content {
  421. background-color: #ffffff;
  422. }
  423. }
  424. .btn-box {
  425. width: 674rpx;
  426. height: 88rpx;
  427. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  428. border-radius: 44rpx;
  429. font-size: 36rpx;
  430. font-family: PingFang SC;
  431. font-weight: 500;
  432. color: #ffffff;
  433. text-align: center;
  434. line-height: 88rpx;
  435. position: fixed;
  436. bottom: 48rpx;
  437. left: 0;
  438. right: 0;
  439. margin: 0 auto;
  440. }
  441. </style>