wallet.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <template>
  2. <view class="content">
  3. <!-- #ifndef MP -->
  4. <view class="revert flex-upDown-center">
  5. <view class="revert-1" @click="switchTab('/pages/user/user')">
  6. <image src="../../static/img/img03.png"></image>
  7. </view>
  8. <view class="revert-2">余额</view>
  9. </view>
  10. <!-- #endif -->
  11. <view class="content-money">
  12. <view class="money-box">
  13. <view class="money flex1" @click="navto('/pages/award/balancedetails')">
  14. <text>总金额(元)</text>
  15. <text >余额明细</text>
  16. </view>
  17. <view class="text" style="text-align: center;">¥{{money}}</view>
  18. </view>
  19. </view>
  20. <view class="buttom-box flex">
  21. <view class="buttom">
  22. <view class="money">¥{{brokerage_recharge}}</view>
  23. <text class="text">佣金转入(元)</text>
  24. </view>
  25. <view class="interval"></view>
  26. <!-- <view class="buttom">
  27. <view class="money">¥{{ recharge | getMoneyStyle }}</view>
  28. <text class="text">充值金额</text>
  29. </view> -->
  30. </view>
  31. <view class="button">
  32. <!-- <view class="button1" @click="navto('/pages/wallet/recharge')">充值</view> -->
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. spreadCommission,
  39. userBalance
  40. } from '@/api/wallet.js';
  41. import {
  42. mapState,
  43. mapMutations
  44. } from 'vuex';
  45. import {
  46. getMoneyStyle
  47. } from '@/utils/rocessor.js';
  48. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  49. import empty from '@/components/empty';
  50. export default {
  51. filters: {
  52. getMoneyStyle
  53. },
  54. components: {
  55. empty,
  56. uniLoadMore
  57. },
  58. onReady() {
  59. // 初始化获取页面宽度
  60. uni.createSelectorQuery()
  61. .select('.content')
  62. .fields({
  63. size: true
  64. },
  65. data => {
  66. // 保存头部高度
  67. this.maxheight = data.height - Math.floor((data.width / 750) * 570);
  68. }
  69. )
  70. .exec();
  71. },
  72. data() {
  73. return {
  74. // 头部图高度
  75. brokerage_recharge:0,
  76. maxheight: '',
  77. tabCurrentIndex: 0,
  78. navList: [{
  79. state: 1,
  80. text: '支出',
  81. loadingType: 'more',
  82. orderList: [],
  83. page: 1, //当前页数
  84. limit: 10 //每次信息条数
  85. },
  86. {
  87. state: 2,
  88. text: '收入',
  89. loadingType: 'more',
  90. orderList: [],
  91. page: 1, //当前页数
  92. limit: 10 //每次信息条数
  93. }
  94. ],
  95. money: '', // 总余额
  96. recharge: '', // 充值金额
  97. orderStatusSum: '', // 累计消费
  98. };
  99. },
  100. onLoad(options) {},
  101. onShow() {
  102. this.loadData();
  103. // 获取用户余额
  104. userBalance({}).then(({
  105. data
  106. }) => {
  107. this.money = data.now_money;
  108. this.brokerage_recharge = data.brokerage_recharge;
  109. this.recharge = data.recharge;
  110. this.orderStatusSum = data.orderStatusSum;
  111. });
  112. },
  113. methods: {
  114. // 页面跳转
  115. switchTab(e) {
  116. uni.switchTab({
  117. url: e
  118. });
  119. },
  120. navto(e) {
  121. uni.navigateTo({
  122. url: e
  123. });
  124. },
  125. //获取收入支出信息
  126. async loadData(source) {
  127. //这里是将订单挂载到tab列表下
  128. let index = this.tabCurrentIndex;
  129. let navItem = this.navList[index];
  130. let state = navItem.state;
  131. if (source === 'tabChange' && navItem.loaded === true) {
  132. //tab切换只有第一次需要加载数据
  133. return;
  134. }
  135. if (navItem.loadingType === 'loading') {
  136. //防止重复加载
  137. return;
  138. }
  139. // 修改当前对象状态为加载中
  140. navItem.loadingType = 'loading';
  141. spreadCommission({
  142. page: navItem.page,
  143. limit: navItem.limit
  144. },
  145. state
  146. )
  147. .then(({
  148. data
  149. }) => {
  150. if (data.length > 0) {
  151. navItem.orderList = navItem.orderList.concat(data);
  152. console.log(navItem.orderList);
  153. navItem.page++;
  154. }
  155. if (navItem.limit == data.length) {
  156. //判断是否还有数据, 有改为 more, 没有改为noMore
  157. navItem.loadingType = 'more';
  158. return;
  159. } else {
  160. //判断是否还有数据, 有改为 more, 没有改为noMore
  161. navItem.loadingType = 'noMore';
  162. }
  163. uni.hideLoading();
  164. this.$set(navItem, 'loaded', true);
  165. })
  166. .catch(e => {
  167. console.log(e);
  168. });
  169. },
  170. //swiper 切换
  171. changeTab(e) {
  172. this.tabCurrentIndex = e.target.current;
  173. this.loadData('tabChange');
  174. },
  175. //顶部tab点击
  176. tabClick(index) {
  177. this.tabCurrentIndex = index;
  178. }
  179. }
  180. };
  181. </script>
  182. <style lang="scss">
  183. page {
  184. background: #ffffff;
  185. height: 100%;
  186. }
  187. .revert {
  188. z-index: 10;
  189. width: 100%;
  190. position: absolute;
  191. top: 20rpx;
  192. padding: 0 30rpx;
  193. .revert-1 {
  194. width: 20rpx;
  195. height: 35rpx;
  196. image {
  197. width: 20rpx;
  198. height: 35rpx;
  199. }
  200. }
  201. .revert-2 {
  202. text-align: center;
  203. width: calc(100% - 20rpx);
  204. font-size: 32rpx;
  205. font-weight: 500;
  206. color: #ffffff;
  207. }
  208. }
  209. .content-money {
  210. background: $page-color-base;
  211. // border: 2px solid #ffffff;
  212. .moneyTx {
  213. position: absolute;
  214. top: 150rpx;
  215. right: 0rpx;
  216. width: 150rpx;
  217. padding: 10rpx 30rpx;
  218. border: 2px solid #ffffff;
  219. border-top-left-radius: 99rpx;
  220. border-bottom-left-radius: 99rpx;
  221. color: #ffffff;
  222. line-height: 1;
  223. font-size: $font-base;
  224. }
  225. .buttom-box {
  226. background-color: #ffffff;
  227. text-align: center;
  228. margin: 0 30rpx;
  229. padding: 20rpx 0;
  230. border-radius: $border-radius-sm;
  231. margin-top: -60rpx;
  232. .buttom {
  233. font-size: $font-lg;
  234. flex-grow: 1;
  235. }
  236. .interval {
  237. width: 2px;
  238. height: 60rpx;
  239. background-color: #eeeeee;
  240. }
  241. .icon {
  242. height: 50rpx;
  243. width: 48rpx;
  244. margin: 0 auto;
  245. .icon-img {
  246. width: 100%;
  247. height: 100%;
  248. }
  249. }
  250. }
  251. }
  252. .buttom-box {
  253. background-color: #ffffff;
  254. text-align: center;
  255. margin: 0 30rpx;
  256. padding: 30rpx 0;
  257. border-radius: $border-radius-sm;
  258. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  259. margin-top: -60rpx;
  260. position: relative;
  261. .buttom {
  262. font-size: $font-lg;
  263. flex-grow: 1;
  264. .money {
  265. font-weight: bold;
  266. font-size: 32rpx;
  267. color: #DB1935;
  268. }
  269. }
  270. .text {
  271. color: #666666;
  272. }
  273. .interval {
  274. width: 2rpx;
  275. height: 60rpx;
  276. background-color: #eeeeee;
  277. }
  278. .icon {
  279. height: 50rpx;
  280. width: 48rpx;
  281. margin: 0 auto;
  282. .icon-img {
  283. width: 100%;
  284. height: 100%;
  285. }
  286. }
  287. }
  288. .button {
  289. .button1 {
  290. width: 480rpx;
  291. height: 80rpx;
  292. background: linear-gradient(90deg, rgba(254, 78, 70, 1) 0%, rgba(252, 65, 65, 1) 100%);
  293. border-radius: 10rpx;
  294. font-size: 30rpx;
  295. font-weight: 500;
  296. color: #ffffff;
  297. line-height: 80rpx;
  298. text-align: center;
  299. margin: 180rpx auto 0;
  300. }
  301. .button2 {
  302. width: 480rpx;
  303. height: 80rpx;
  304. background: #F2F2F2;
  305. border-radius: 10rpx;
  306. font-size: 30rpx;
  307. font-weight: 500;
  308. color: #FC4141;
  309. line-height: 80rpx;
  310. text-align: center;
  311. margin: 30rpx auto 0;
  312. }
  313. }
  314. .money-box {
  315. background: $base-color;
  316. padding-top: var(--status-bar-height);
  317. height: 600rpx;
  318. color: #ffffff;
  319. // text-align: center;
  320. position: relative;
  321. .text {
  322. padding-top: 140rpx;
  323. font-size: 82rpx;
  324. }
  325. .money {
  326. padding: 120rpx 25rpx 0 25rpx;
  327. font-size: 24rpx;
  328. }
  329. .money-accum {
  330. display: flex;
  331. align-items: center;
  332. justify-content: space-around;
  333. margin-top: 44rpx;
  334. .money-frame {
  335. .money-num {
  336. font-size: 45rpx;
  337. font-weight: 500;
  338. color: rgba(255, 255, 255, 1);
  339. }
  340. .mon-text {
  341. font-size: 30rpx;
  342. font-weight: 500;
  343. color: rgba(255, 255, 255, 1);
  344. }
  345. }
  346. }
  347. .money-loca {
  348. width: 140rpx;
  349. height: 50rpx;
  350. background: #FFFFFF;
  351. color: #FA2740;
  352. font-size: $font-base;
  353. line-height: 50rpx;
  354. border-radius: 10rpx 0 0 10rpx;
  355. }
  356. // 立即提现
  357. .draw {
  358. position: absolute;
  359. right: 0;
  360. top: 64rpx;
  361. }
  362. // 余额支付
  363. .rech {
  364. position: absolute;
  365. right: 0;
  366. top: 134rpx;
  367. }
  368. }
  369. .navbar {
  370. display: flex;
  371. height: 40px;
  372. padding: 0 5px;
  373. background: #fff;
  374. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  375. position: relative;
  376. z-index: 10;
  377. .nav-item {
  378. flex: 1;
  379. display: flex;
  380. justify-content: center;
  381. align-items: center;
  382. height: 100%;
  383. font-size: 15px;
  384. color: $font-color-dark;
  385. position: relative;
  386. &.current {
  387. color: $font-color-spec;
  388. &:after {
  389. content: '';
  390. position: absolute;
  391. left: 50%;
  392. bottom: 0;
  393. transform: translateX(-50%);
  394. width: 44px;
  395. height: 0;
  396. border-bottom: 2px solid $font-color-spec;
  397. }
  398. }
  399. }
  400. }
  401. // 列表
  402. .swiper-box {
  403. padding-top: 10rpx;
  404. .order-item {
  405. padding: 20rpx 30rpx;
  406. line-height: 1.5;
  407. .title-box {
  408. .title {
  409. font-size: $font-lg;
  410. color: $font-color-base;
  411. }
  412. .time {
  413. font-size: $font-base;
  414. color: $font-color-light;
  415. }
  416. }
  417. .money {
  418. color: #fd5b23;
  419. font-size: $font-lg;
  420. }
  421. }
  422. }
  423. .list-scroll-content {
  424. height: 100%;
  425. }
  426. .content {
  427. height: 100%;
  428. .empty-content {
  429. background-color: #ffffff;
  430. }
  431. }
  432. </style>