zhihuanquan.vue 9.5 KB

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