yue.vue 9.2 KB

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