equity.vue 10 KB

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