award.vue 9.8 KB

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