team.vue 10 KB

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