team.vue 11 KB

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