cash.vue 9.0 KB

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