cash.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar"><!-- 这里是状态栏 --></view>
  5. <!-- #ifndef MP-WEIXIN -->
  6. <view class="body-title">
  7. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view>
  8. <view class="header">我的佣金</view>
  9. </view>
  10. <!-- #endif -->
  11. <view class="content-bg"></image></view>
  12. <view class="money-box">
  13. <view class="money">{{ userInfo.brokerage_price ||'0.00' }}</view>
  14. <view>余额</view>
  15. </view>
  16. <view class="moneybtn-box" >
  17. <view class="money-btn" style="margin-top:20rpx;" @click="navto('/user/page/zhuanyue')">
  18. 佣金转余额
  19. </view>
  20. <view class="money-btn" style="margin-top: 20rpx;" @click="navto('/user/page/withdrawal')">
  21. 佣金提现
  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.mark || 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"></uni-load-more>
  62. </scroll-view>
  63. </swiper-item>
  64. </swiper>
  65. </view>
  66. </template>
  67. <script>
  68. import { cashList, userBalance,spreadCommission} 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: 3,
  108. text: '收入',
  109. loadingType: 'more',
  110. orderList: [],
  111. page: 1, //当前页数
  112. limit: 10 //每次信息条数
  113. },
  114. {
  115. state: 4,
  116. text: '支出',
  117. loadingType: 'more',
  118. orderList: [],
  119. page: 1, //当前页数
  120. limit: 10 //每次信息条数
  121. },
  122. ],
  123. money: ''
  124. };
  125. },
  126. onLoad(options) {},
  127. onShow() {
  128. this.loadData();
  129. },
  130. methods: {
  131. // 页面跳转
  132. navto(e) {
  133. uni.navigateTo({
  134. url: e
  135. });
  136. },
  137. // 点击返回 我的页面
  138. toBack() {
  139. uni.switchTab({
  140. url:'./user'
  141. })
  142. },
  143. //获取收入支出信息
  144. async loadData(source) {
  145. let obj = this
  146. //这里是将订单挂载到tab列表下
  147. let index = this.tabCurrentIndex;
  148. let navItem = this.navList[index];
  149. let state = navItem.state;
  150. if (source === 'tabChange' && navItem.loaded === true) {
  151. //tab切换只有第一次需要加载数据
  152. return;
  153. }
  154. if (navItem.loadingType === 'loading') {
  155. //防止重复加载
  156. return;
  157. }
  158. // 修改当前对象状态为加载中
  159. navItem.loadingType = 'loading';
  160. console.log(navItem.loadingType,'state');
  161. spreadCommission(
  162. {
  163. page: navItem.page,
  164. limit: navItem.limit,
  165. },state
  166. )
  167. .then(({ data }) => {
  168. console.log(data,'data');
  169. obj.recharge = data.income;
  170. obj.orderStatusSum = data.expend;
  171. if (data.length > 0) {
  172. navItem.orderList = navItem.orderList.concat(data[0].list);
  173. console.log(navItem.orderList);
  174. navItem.page++;
  175. }
  176. if (navItem.limit == data.length) {
  177. //判断是否还有数据, 有改为 more, 没有改为noMore
  178. navItem.loadingType = 'more';
  179. return;
  180. } else {
  181. //判断是否还有数据, 有改为 more, 没有改为noMore
  182. navItem.loadingType = 'noMore';
  183. }
  184. uni.hideLoading();
  185. this.$set(navItem, 'loaded', true);
  186. })
  187. .catch(e => {
  188. console.log(e);
  189. });
  190. },
  191. //swiper 切换
  192. changeTab(e) {
  193. this.tabCurrentIndex = e.target.current;
  194. this.loadData('tabChange');
  195. },
  196. //顶部tab点击
  197. tabClick(index) {
  198. this.tabCurrentIndex = index;
  199. }
  200. }
  201. };
  202. </script>
  203. <style lang="scss">
  204. page {
  205. background: #f1f1f1;
  206. height: 100%;
  207. }
  208. .status_bar {
  209. height: var(--status-bar-height);
  210. width: 100%;
  211. }
  212. .content-money {
  213. position: relative;
  214. height: 480rpx;
  215. .content-bg {
  216. background: #f75022;
  217. position: absolute;
  218. top: 0;
  219. left: 0;
  220. right: 0;
  221. width: 750rpx;
  222. height: 480rpx;
  223. image {
  224. width: 100%;
  225. height: 100%;
  226. }
  227. }
  228. .body-title {
  229. height: 80rpx;
  230. text-align: center;
  231. font-size: 35rpx;
  232. position: relative;
  233. .header {
  234. position: absolute;
  235. left: 0;
  236. top: 0;
  237. width: 100%;
  238. font-size: 36rpx;
  239. font-family: PingFang SC;
  240. font-weight: bold;
  241. color: #fffeff;
  242. height: 80rpx;
  243. font-size: 36rpx;
  244. font-weight: 700;
  245. z-index: 9;
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. }
  250. .goback-box {
  251. position: absolute;
  252. left: 18rpx;
  253. top: 0;
  254. height: 80rpx;
  255. display: flex;
  256. align-items: center;
  257. }
  258. .goback {
  259. z-index: 100;
  260. width: 34rpx;
  261. height: 34rpx;
  262. }
  263. }
  264. }
  265. .info-box {
  266. width: 670rpx;
  267. height: 186rpx;
  268. background: #ffffff;
  269. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  270. border-radius: 20rpx;
  271. margin: -100rpx auto 0;
  272. position: relative;
  273. z-index: 2;
  274. .info-item {
  275. width: 50%;
  276. display: flex;
  277. flex-direction: column;
  278. align-items: center;
  279. line-height: 1;
  280. .info-font {
  281. font-size: 30rpx;
  282. font-family: PingFang SC;
  283. font-weight: bold;
  284. color: #999999;
  285. }
  286. .info-num {
  287. margin-top: 30rpx;
  288. font-size: 30rpx;
  289. font-family: PingFang SC;
  290. font-weight: bold;
  291. color: #181818;
  292. }
  293. }
  294. .shu {
  295. width: 2rpx;
  296. height: 74rpx;
  297. background: #dcdfe6;
  298. }
  299. }
  300. .moneybtn-box {
  301. display: flex;
  302. justify-content: space-between;
  303. position: relative;
  304. z-index: 2;
  305. color:#fff ;
  306. padding:20rpx 50rpx ;
  307. font-size: 30rpx;
  308. font-family: PingFang SC;
  309. font-weight: bold;
  310. color: #fff;
  311. }
  312. .money-box {
  313. position: relative;
  314. z-index: 2;
  315. padding-top: 90rpx;
  316. color: #ffffff;
  317. text-align: center;
  318. .money {
  319. font-size: 72rpx;
  320. font-family: PingFang SC;
  321. font-weight: bold;
  322. color: #ffffff;
  323. }
  324. .text {
  325. font-size: 30rpx;
  326. }
  327. }
  328. .navbar {
  329. margin-top: 20rpx;
  330. display: flex;
  331. height: 88rpx;
  332. padding: 0 5px;
  333. background: #fff;
  334. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  335. position: relative;
  336. z-index: 10;
  337. .nav-item {
  338. flex: 1;
  339. display: flex;
  340. justify-content: center;
  341. align-items: center;
  342. height: 100%;
  343. font-size: 15px;
  344. color: #999999;
  345. position: relative;
  346. &.current {
  347. color: #000;
  348. &:after {
  349. content: '';
  350. position: absolute;
  351. left: 50%;
  352. bottom: 0;
  353. transform: translateX(-50%);
  354. width: 44px;
  355. height: 0;
  356. border-bottom: 2px solid #fff;
  357. }
  358. }
  359. }
  360. }
  361. //列表
  362. .swiper-box {
  363. .order-item:last-child {
  364. margin-bottom: 60rpx;
  365. }
  366. .order-item {
  367. padding: 20rpx 30rpx;
  368. line-height: 1.5;
  369. .title-box {
  370. .title {
  371. font-size: $font-lg;
  372. color: $font-color-base;
  373. }
  374. .time {
  375. font-size: $font-base;
  376. color: $font-color-light;
  377. }
  378. }
  379. .money {
  380. color: #fd5b23;
  381. font-size: $font-lg;
  382. text-align: right;
  383. .status {
  384. color: $font-color-light;
  385. }
  386. }
  387. }
  388. }
  389. .list-scroll-content {
  390. background: #ffffff;
  391. height: 100%;
  392. }
  393. .content {
  394. height: 100%;
  395. .empty-content {
  396. background-color: #ffffff;
  397. }
  398. }
  399. .btn-box {
  400. width: 674rpx;
  401. height: 88rpx;
  402. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  403. border-radius: 44rpx;
  404. font-size: 36rpx;
  405. font-family: PingFang SC;
  406. font-weight: 500;
  407. color: #ffffff;
  408. text-align: center;
  409. line-height: 88rpx;
  410. position: fixed;
  411. bottom: 48rpx;
  412. left: 0;
  413. right: 0;
  414. margin: 0 auto;
  415. }
  416. </style>