qudou.vue 9.3 KB

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