award.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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.mark }}</text>
  69. </view>
  70. <view class="time">
  71. <text>{{ item.create_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. navItem.orderList = navItem.orderList.concat(data)
  212. navItem.page++
  213. if (navItem.limit == data.length) {
  214. navItem.loadingType = 'more';
  215. } else {
  216. navItem.loadingType = 'noMore'
  217. }
  218. uni.hideLoading();
  219. this.$set(navItem, 'loaded', true);
  220. })
  221. .catch(e => {
  222. console.log(e);
  223. });
  224. },
  225. //swiper 切换
  226. changeTab(e) {
  227. this.tabCurrentIndex = e.target.current;
  228. this.loadData('tabChange');
  229. },
  230. //顶部tab点击
  231. tabClick(index) {
  232. this.tabCurrentIndex = index;
  233. }
  234. }
  235. };
  236. </script>
  237. <style lang="scss">
  238. page {
  239. background: #f1f1f1;
  240. height: 100%;
  241. }
  242. .content-money {
  243. position: relative;
  244. height: 480rpx;
  245. color: #ffffff;
  246. .content-bg {
  247. position: absolute;
  248. top: 0;
  249. left: 0;
  250. right: 0;
  251. height: 480rpx;
  252. image {
  253. width: 100%;
  254. height: 100%;
  255. }
  256. }
  257. .money-box {
  258. position: relative;
  259. z-index: 2;
  260. padding-top: 130rpx;
  261. text-align: center;
  262. padding-bottom: 50rpx;
  263. .money {
  264. font-size: 72rpx;
  265. font-weight: bold;
  266. }
  267. .text {
  268. font-size: $font-lg;
  269. }
  270. }
  271. .body-title {
  272. height: 80rpx;
  273. text-align: center;
  274. font-size: 35rpx;
  275. z-index: 999;
  276. font-weight: bold;
  277. position: fixed;
  278. left: 0;
  279. top: 0;
  280. width: 100%;
  281. .header {}
  282. .goback-box {
  283. position: absolute;
  284. left: 18rpx;
  285. bottom: 0;
  286. top: 0;
  287. .goback {
  288. width: 34rpx;
  289. height: 34rpx;
  290. transform: rotate(180deg);
  291. }
  292. }
  293. }
  294. }
  295. .info-box {
  296. width: 670rpx;
  297. height: 186rpx;
  298. background: #ffffff;
  299. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  300. border-radius: 20rpx;
  301. margin: -100rpx auto 0;
  302. position: relative;
  303. z-index: 2;
  304. .info-item {
  305. width: 50%;
  306. display: flex;
  307. flex-direction: column;
  308. align-items: center;
  309. line-height: 1;
  310. .info-font {
  311. font-size: 30rpx;
  312. font-weight: bold;
  313. color: #999999;
  314. }
  315. .info-num {
  316. margin-top: 30rpx;
  317. font-size: 30rpx;
  318. font-weight: bold;
  319. color: #181818;
  320. }
  321. }
  322. .shu {
  323. width: 2rpx;
  324. height: 74rpx;
  325. background: #dcdfe6;
  326. }
  327. }
  328. .moneybtn-box {
  329. position: relative;
  330. padding: 0rpx 50rpx;
  331. font-size: 30rpx;
  332. font-weight: bold;
  333. .money-btn{
  334. font-size: $font-lg;
  335. .tip{
  336. width: 40rpx;
  337. height:40rpx;
  338. margin-right: 10rpx;
  339. }
  340. }
  341. }
  342. .navbar {
  343. margin-top: 20rpx;
  344. display: flex;
  345. height: 88rpx;
  346. padding: 0 5px;
  347. background: #fff;
  348. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  349. position: relative;
  350. z-index: 10;
  351. .nav-item {
  352. flex: 1;
  353. display: flex;
  354. justify-content: center;
  355. align-items: center;
  356. height: 100%;
  357. font-size: 15px;
  358. color: #999999;
  359. position: relative;
  360. &.current {
  361. color: #000;
  362. &:after {
  363. content: '';
  364. position: absolute;
  365. left: 50%;
  366. bottom: 0;
  367. transform: translateX(-50%);
  368. width: 44px;
  369. height: 0;
  370. border-bottom: 2px solid #fe5b38;
  371. }
  372. }
  373. }
  374. }
  375. //列表
  376. .swiper-box {
  377. .order-item:last-child {
  378. margin-bottom: 60rpx;
  379. }
  380. .order-item {
  381. padding: 20rpx 30rpx;
  382. line-height: 1.5;
  383. .title-box {
  384. .title {
  385. font-size: $font-lg;
  386. color: $font-color-base;
  387. }
  388. .time {
  389. font-size: $font-base;
  390. color: $font-color-light;
  391. }
  392. }
  393. .money {
  394. color: #fd5b23;
  395. font-size: $font-lg;
  396. text-align: right;
  397. .status {
  398. color: $font-color-light;
  399. }
  400. }
  401. }
  402. }
  403. .list-scroll-content {
  404. background: #ffffff;
  405. height: 100%;
  406. }
  407. .content {
  408. height: 100%;
  409. .empty-content {
  410. background-color: #ffffff;
  411. }
  412. }
  413. .btn-box {
  414. width: 674rpx;
  415. height: 88rpx;
  416. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  417. border-radius: 44rpx;
  418. font-size: 36rpx;
  419. font-family: PingFang SC;
  420. font-weight: 500;
  421. color: #ffffff;
  422. text-align: center;
  423. line-height: 88rpx;
  424. position: fixed;
  425. bottom: 48rpx;
  426. left: 0;
  427. right: 0;
  428. margin: 0 auto;
  429. }
  430. </style>