purpleJf.vue 10 KB

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