team.vue 11 KB

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