scoreAccumulate.vue 10 KB

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