myxfjf.vue 9.2 KB

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