myxfjf.vue 9.2 KB

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