jf.vue 9.1 KB

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