team.vue 11 KB

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