myjf.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar">
  5. <!-- 这里是状态栏 -->
  6. </view>
  7. <view class="body-title">
  8. <view class="goback-box" @click="toBack">
  9. <image class="goback" src="../../static/icon/fanhui.png" mode=""></image>
  10. </view>
  11. <view class="header">动态积分</view>
  12. </view>
  13. <view class="content-bg">
  14. <image src="../../static/img/jf-bg.png" mode=""></image>
  15. </view>
  16. <view class="money-box">
  17. <view class="money">{{ userInfo.contribution || '0' }}</view>
  18. <view>当前余额</view>
  19. </view>
  20. <view class="moneybtn-box">
  21. <view class="money-btn" @click="navto('/pages/user/withdrawal?jftype=2')">
  22. 动态积分提现
  23. </view>
  24. <view class="money-btn" @click="navto('/pages/user/xfjfzz?type=2')">
  25. 动态积分转账
  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">{{sr}}</view>
  33. </view>
  34. <view class="shu"></view>
  35. <view class="info-item">
  36. <view class="info-font">累计支出</view>
  37. <view class="info-num">{{zc}}</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: maxheight }" 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.mark }}</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 }}</view>
  63. <view v-if="item.status == 0" class="status">待发放</view>
  64. </view>
  65. </view>
  66. </view>
  67. <uni-load-more :status="tabItem.loadingType"
  68. v-if="!(tabItem.orderList.length == 0 && tabItem.loaded)"></uni-load-more>
  69. </scroll-view>
  70. </swiper-item>
  71. </swiper>
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. userBalance,
  77. getDynamicIntegralList
  78. } from '@/api/wallet.js';
  79. import {
  80. getMoneyStyle
  81. } from '@/utils/rocessor.js';
  82. import {
  83. mapState,
  84. mapMutations
  85. } from 'vuex';
  86. import uniLoadMore from '@/uview-ui/components/u-loadmore/u-loadmore.vue';
  87. import empty from '@/uview-ui/components/u-empty/u-empty.vue';
  88. export default {
  89. filters: {
  90. getMoneyStyle
  91. },
  92. computed: {
  93. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  94. },
  95. components: {
  96. empty,
  97. uniLoadMore
  98. },
  99. onReady(res) {
  100. var _this = this;
  101. uni.getSystemInfo({
  102. success: resu => {
  103. const query = uni.createSelectorQuery();
  104. query.select('.swiper-box').boundingClientRect();
  105. query.exec(function(res) {
  106. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  107. console.log('打印页面的剩余高度', _this.height);
  108. });
  109. },
  110. fail: res => {}
  111. });
  112. },
  113. data() {
  114. return {
  115. // 头部图高度
  116. maxheight: '',
  117. tabCurrentIndex: 0,
  118. sr: 0,
  119. zc: 0,
  120. navList: [{
  121. state: 1,
  122. text: '收入',
  123. loadingType: 'more',
  124. orderList: [],
  125. page: 1, //当前页数
  126. limit: 10, //每次信息条数
  127. loaded: false
  128. },
  129. {
  130. state: 0,
  131. text: '支出',
  132. loadingType: 'more',
  133. orderList: [],
  134. page: 1, //当前页数
  135. limit: 10, //每次信息条数
  136. loaded: false
  137. }
  138. ],
  139. money: ''
  140. };
  141. },
  142. onLoad(options) {},
  143. onShow() {
  144. this.loadData();
  145. },
  146. methods: {
  147. // 页面跳转
  148. navto(e) {
  149. uni.navigateTo({
  150. url: e
  151. });
  152. },
  153. // 点击返回 我的页面
  154. toBack() {
  155. uni.navigateBack({});
  156. },
  157. //获取收入支出信息
  158. async loadData(source) {
  159. let obj = this;
  160. //这里是将订单挂载到tab列表下
  161. let index = this.tabCurrentIndex;
  162. let navItem = this.navList[index];
  163. let state = navItem.state;
  164. if (source === 'tabChange' && navItem.loaded === true) {
  165. //tab切换只有第一次需要加载数据
  166. return;
  167. }
  168. if (navItem.loadingType == 'loading' || navItem.loadingType == 'noMore') {
  169. //防止重复加载
  170. return;
  171. }
  172. // 修改当前对象状态为加载中
  173. navItem.loadingType = 'loading';
  174. getDynamicIntegralList({
  175. page: navItem.page,
  176. limit: navItem.limit,
  177. pm: navItem.state
  178. })
  179. .then(({
  180. data
  181. }) => {
  182. obj.sr = data.sr
  183. obj.zc = data.zc
  184. navItem.orderList = navItem.orderList.concat(data.list)
  185. if(navItem.limit == data.list.length) {
  186. navItem.loadingType = 'more'
  187. }else {
  188. navItem.loadingType = 'noMore'
  189. }
  190. navItem.loaded = true
  191. })
  192. .catch(e => {
  193. console.log(e);
  194. });
  195. },
  196. //swiper 切换
  197. changeTab(e) {
  198. this.tabCurrentIndex = e.target.current;
  199. this.loadData('tabChange');
  200. },
  201. //顶部tab点击
  202. tabClick(index) {
  203. this.tabCurrentIndex = index;
  204. }
  205. }
  206. };
  207. </script>
  208. <style lang="scss">
  209. page {
  210. background: #f1f1f1;
  211. height: 100%;
  212. }
  213. .status_bar {
  214. height: var(--status-bar-height);
  215. width: 100%;
  216. }
  217. .content-money {
  218. position: relative;
  219. height: 480rpx;
  220. .content-bg {
  221. position: absolute;
  222. top: 0;
  223. left: 0;
  224. right: 0;
  225. width: 750rpx;
  226. height: 480rpx;
  227. image {
  228. width: 100%;
  229. height: 100%;
  230. }
  231. }
  232. .body-title {
  233. height: 80rpx;
  234. text-align: center;
  235. font-size: 35rpx;
  236. position: relative;
  237. .header {
  238. position: absolute;
  239. left: 0;
  240. top: 0;
  241. width: 100%;
  242. font-size: 36rpx;
  243. font-family: PingFang SC;
  244. font-weight: bold;
  245. color: #fffeff;
  246. height: 80rpx;
  247. font-size: 36rpx;
  248. font-weight: 700;
  249. z-index: 9;
  250. display: flex;
  251. justify-content: center;
  252. align-items: center;
  253. }
  254. .goback-box {
  255. position: absolute;
  256. left: 18rpx;
  257. top: 0;
  258. height: 80rpx;
  259. display: flex;
  260. align-items: center;
  261. }
  262. .goback {
  263. z-index: 100;
  264. width: 34rpx;
  265. height: 34rpx;
  266. }
  267. }
  268. }
  269. .info-box {
  270. width: 670rpx;
  271. height: 186rpx;
  272. background: #ffffff;
  273. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  274. border-radius: 20rpx;
  275. margin: -100rpx auto 0;
  276. position: relative;
  277. z-index: 2;
  278. .info-item {
  279. width: 50%;
  280. display: flex;
  281. flex-direction: column;
  282. align-items: center;
  283. line-height: 1;
  284. .info-font {
  285. font-size: 30rpx;
  286. font-family: PingFang SC;
  287. font-weight: bold;
  288. color: #999999;
  289. }
  290. .info-num {
  291. margin-top: 30rpx;
  292. font-size: 30rpx;
  293. font-family: PingFang SC;
  294. font-weight: bold;
  295. color: #181818;
  296. }
  297. }
  298. .shu {
  299. width: 2rpx;
  300. height: 74rpx;
  301. background: #dcdfe6;
  302. }
  303. }
  304. .money-box {
  305. position: relative;
  306. z-index: 2;
  307. /* #ifdef H5 */
  308. padding-top: 70rpx;
  309. /* #endif */
  310. color: #ffffff;
  311. text-align: center;
  312. /* #ifdef APP-PLUS */
  313. height: 180rpx;
  314. display: flex;
  315. flex-direction: column;
  316. justify-content: center;
  317. /* #endif */
  318. .money {
  319. font-size: 72rpx;
  320. font-family: PingFang SC;
  321. font-weight: bold;
  322. color: #ffffff;
  323. }
  324. .text {
  325. font-size: 30rpx;
  326. }
  327. }
  328. .money-btn {
  329. position: relative;
  330. z-index: 2;
  331. color: #ffffff;
  332. // padding-right: 50rpx;
  333. text-align: right;
  334. font-size: 30rpx;
  335. font-family: PingFang SC;
  336. font-weight: bold;
  337. color: #FFFFFF;
  338. text {
  339. display: inline-block;
  340. padding-left: 10rpx;
  341. }
  342. }
  343. .navbar {
  344. margin-top: 20rpx;
  345. display: flex;
  346. height: 88rpx;
  347. padding: 0 5px;
  348. background: #fff;
  349. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  350. position: relative;
  351. z-index: 10;
  352. .nav-item {
  353. flex: 1;
  354. display: flex;
  355. justify-content: center;
  356. align-items: center;
  357. height: 100%;
  358. font-size: 15px;
  359. color: #999999;
  360. position: relative;
  361. &.current {
  362. color: #000;
  363. &:after {
  364. content: '';
  365. position: absolute;
  366. left: 50%;
  367. bottom: 0;
  368. transform: translateX(-50%);
  369. width: 44px;
  370. height: 0;
  371. border-bottom: 2px solid #fe5b38;
  372. }
  373. }
  374. }
  375. }
  376. //列表
  377. .swiper-box {
  378. .order-item:last-child {
  379. margin-bottom: 60rpx;
  380. }
  381. .order-item {
  382. padding: 20rpx 30rpx;
  383. line-height: 1.5;
  384. .title-box {
  385. .title {
  386. font-size: $font-lg;
  387. color: $font-color-base;
  388. }
  389. .time {
  390. font-size: $font-base;
  391. color: $font-color-light;
  392. }
  393. }
  394. .money {
  395. color: #fd5b23;
  396. font-size: $font-lg;
  397. text-align: right;
  398. .status {
  399. color: $font-color-light;
  400. }
  401. }
  402. }
  403. }
  404. .list-scroll-content {
  405. background: #ffffff;
  406. height: 100%;
  407. }
  408. .content {
  409. height: 100%;
  410. .empty-content {
  411. background-color: #ffffff;
  412. }
  413. }
  414. .btn-box {
  415. width: 674rpx;
  416. height: 88rpx;
  417. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  418. border-radius: 44rpx;
  419. font-size: 36rpx;
  420. font-family: PingFang SC;
  421. font-weight: 500;
  422. color: #ffffff;
  423. text-align: center;
  424. line-height: 88rpx;
  425. position: fixed;
  426. bottom: 48rpx;
  427. left: 0;
  428. right: 0;
  429. margin: 0 auto;
  430. }
  431. .moneybtn-box {
  432. display: flex;
  433. justify-content: space-between;
  434. position: relative;
  435. z-index: 2;
  436. color: #ffffff;
  437. padding:0rpx 50rpx ;
  438. font-size: 30rpx;
  439. font-family: PingFang SC;
  440. font-weight: bold;
  441. color: #FFFFFF;
  442. }
  443. </style>