myxfjf.vue 10 KB

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