qxq.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  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">{{ userInfo.certificate || 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. import { certificate,getUser } from '@/api/user.js'
  102. export default {
  103. filters: {
  104. getMoneyStyle
  105. },
  106. computed: {
  107. ...mapState('user', ['userInfo'])
  108. },
  109. onReady(res) {
  110. var _this = this;
  111. console.log(_this.userInfo)
  112. uni.getSystemInfo({
  113. success: resu => {
  114. const query = uni.createSelectorQuery();
  115. query.select('.swiper-box').boundingClientRect();
  116. query.exec(function(res) {
  117. _this.height = resu.windowHeight - res[0].top + 'px';
  118. console.log('打印页面的剩余高度', _this.height);
  119. });
  120. },
  121. fail: res => {}
  122. });
  123. },
  124. data() {
  125. return {
  126. height: '',
  127. // 头部图高度
  128. maxheight: '',
  129. tabCurrentIndex: 0,
  130. orderStatusSum: 0,
  131. recharge: 0,
  132. navList: [
  133. // {
  134. // state: 0,
  135. // text: '全部',
  136. // loadingType: 'more',
  137. // orderList: [],
  138. // page: 1, //当前页数
  139. // limit: 10 //每次信息条数
  140. // },
  141. {
  142. state: 1,
  143. text: '收入',
  144. loadingType: 'more',
  145. orderList: [],
  146. page: 1, //当前页数
  147. limit: 10 //每次信息条数
  148. },
  149. {
  150. state:0,
  151. text: '支出',
  152. loadingType: 'more',
  153. orderList: [],
  154. page: 1, //当前页数
  155. limit: 10 //每次信息条数
  156. }
  157. ],
  158. money: '',
  159. bankData:{
  160. brokerage_price:'0.00',
  161. ext_broerage:'0.00',//累计支出
  162. total_brokerage:'0.00',//累计收入
  163. }
  164. };
  165. },
  166. onLoad(options) {},
  167. onShow() {
  168. // this.extractBank()
  169. this.loadData();
  170. },
  171. methods: {
  172. extractBank() {
  173. extractBank().then(res => {
  174. this.bankData = res.data
  175. })
  176. },
  177. toBack() {
  178. uni.switchTab({
  179. url: '/pages/user/user'
  180. });
  181. },
  182. // 页面跳转
  183. navto(e) {
  184. uni.navigateTo({
  185. url: e
  186. });
  187. },
  188. //获取收入支出信息
  189. async loadData(source) {
  190. let obj = this;
  191. //这里是将订单挂载到tab列表下
  192. let index = this.tabCurrentIndex;
  193. let navItem = this.navList[index];
  194. let state = navItem.state;
  195. if (source === 'tabChange' && navItem.loaded === true) {
  196. //tab切换只有第一次需要加载数据
  197. return;
  198. }
  199. if (navItem.loadingType === 'loading' || navItem.loadingType == 'noMore') {
  200. //防止重复加载
  201. return;
  202. }
  203. // 修改当前对象状态为加载中
  204. navItem.loadingType = 'loading';
  205. certificate({
  206. page: navItem.page,
  207. limit: navItem.limit,
  208. pm: state
  209. })
  210. .then(({
  211. data
  212. }) => {
  213. navItem.orderList = navItem.orderList.concat(data)
  214. if(data.length == navItem.limit) {
  215. navItem.loadingType = 'more'
  216. }else {
  217. navItem.loadingType = 'noMoe'
  218. }
  219. navItem.page++
  220. uni.hideLoading();
  221. this.$set(navItem, 'loaded', true);
  222. })
  223. .catch(e => {
  224. console.log(e);
  225. });
  226. },
  227. //swiper 切换
  228. changeTab(e) {
  229. this.tabCurrentIndex = e.target.current;
  230. this.loadData('tabChange');
  231. },
  232. //顶部tab点击
  233. tabClick(index) {
  234. this.tabCurrentIndex = index;
  235. }
  236. }
  237. };
  238. </script>
  239. <style lang="scss">
  240. page {
  241. background: #f1f1f1;
  242. height: 100%;
  243. }
  244. .content-money {
  245. position: relative;
  246. height: 480rpx;
  247. color: #ffffff;
  248. .content-bg {
  249. position: absolute;
  250. top: 0;
  251. left: 0;
  252. right: 0;
  253. height: 480rpx;
  254. image {
  255. width: 100%;
  256. height: 100%;
  257. }
  258. }
  259. .money-box {
  260. position: relative;
  261. z-index: 2;
  262. padding-top: 230rpx;
  263. text-align: center;
  264. padding-bottom: 50rpx;
  265. .money {
  266. font-size: 72rpx;
  267. font-weight: bold;
  268. }
  269. .text {
  270. font-size: $font-lg;
  271. }
  272. }
  273. .body-title {
  274. height: 80rpx;
  275. text-align: center;
  276. font-size: 35rpx;
  277. z-index: 999;
  278. font-weight: bold;
  279. position: fixed;
  280. left: 0;
  281. top: 0;
  282. /* #ifdef MP-WEIXIN */
  283. top: 44rpx;
  284. /* #endif */
  285. width: 100%;
  286. .header {}
  287. .goback-box {
  288. position: absolute;
  289. left: 18rpx;
  290. bottom: 0;
  291. top: 0;
  292. .goback {
  293. width: 34rpx;
  294. height: 34rpx;
  295. transform: rotate(180deg);
  296. }
  297. }
  298. }
  299. }
  300. .info-box {
  301. width: 670rpx;
  302. height: 186rpx;
  303. background: #ffffff;
  304. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  305. border-radius: 20rpx;
  306. margin: -100rpx auto 0;
  307. position: relative;
  308. z-index: 2;
  309. .info-item {
  310. width: 50%;
  311. display: flex;
  312. flex-direction: column;
  313. align-items: center;
  314. line-height: 1;
  315. .info-font {
  316. font-size: 30rpx;
  317. font-weight: bold;
  318. color: #999999;
  319. }
  320. .info-num {
  321. margin-top: 30rpx;
  322. font-size: 30rpx;
  323. font-weight: bold;
  324. color: #181818;
  325. }
  326. }
  327. .shu {
  328. width: 2rpx;
  329. height: 74rpx;
  330. background: #dcdfe6;
  331. }
  332. }
  333. .moneybtn-box {
  334. position: relative;
  335. padding: 0rpx 50rpx;
  336. font-size: 30rpx;
  337. font-weight: bold;
  338. .money-btn{
  339. font-size: $font-lg;
  340. .tip{
  341. width: 40rpx;
  342. height:40rpx;
  343. margin-right: 10rpx;
  344. }
  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>