mygwjf.vue 10 KB

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