qxq.vue 9.6 KB

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