jf.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="content-money">
  5. <view class="status_bar"><!-- 这里是状态栏 --></view>
  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. <view class="content-bg"><image src="../../static/img/tg-bg1.png" mode=""></image></view>
  11. <view class="money-box">
  12. <view class="money">{{ userInfo.tickets | getMoneyStyle }}</view>
  13. <view>报单币</view>
  14. </view>
  15. <view class="moneybtn-box">
  16. <!-- <view class="money-btn" style="text-decoration: underline;" @click="navto('/pages/money/freeze')">冻结记录</view> -->
  17. <view class="money-btn" style="text-decoration: underline;"></view>
  18. <view class="money-btn" @click="navto('/pages/user/yjzz?type=2')">转给好友</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="info-box flex">
  23. <view class="shu"></view>
  24. <view class="info-item">
  25. <view class="info-font">累计收入</view>
  26. <view class="info-num">{{ sr }}</view>
  27. </view>
  28. <view class="shu"></view>
  29. <view class="info-item">
  30. <view class="info-font">累计支出</view>
  31. <view class="info-num">{{ zc }}</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" disable-touch>
  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 class="order-item flex" v-for="(item, index) in tabItem.orderList" :key="index">
  44. <view class="title-box">
  45. <view class="title">
  46. <text>{{ item.title }}</text>
  47. </view>
  48. <view class="time">
  49. <text>{{ item.add_time }}</text>
  50. </view>
  51. </view>
  52. <view class="money">
  53. <text>{{ (item.pm == 0 ? '-' : '+') + item.number }}</text>
  54. </view>
  55. </view>
  56. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  57. </scroll-view>
  58. </swiper-item>
  59. </swiper>
  60. </view>
  61. </template>
  62. <script>
  63. import { spreadCommission, userBalance, yue, integral } from '@/api/wallet.js';
  64. import { mapState, mapMutations } from 'vuex';
  65. import { getMoneyStyle } from '@/utils/rocessor.js';
  66. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  67. import empty from '@/components/empty';
  68. import { getUserInfo,ticketsList } from '@/api/user.js';
  69. import { userInfo } from 'os';
  70. export default {
  71. filters: {
  72. getMoneyStyle
  73. },
  74. computed: {
  75. ...mapState('user', ['userInfo'])
  76. },
  77. components: {
  78. empty,
  79. uniLoadMore
  80. },
  81. onReady(res) {
  82. var _this = this;
  83. uni.getSystemInfo({
  84. success: resu => {
  85. const query = uni.createSelectorQuery();
  86. query.select('.swiper-box').boundingClientRect();
  87. query.exec(function(res) {
  88. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  89. console.log('打印页面的剩余高度', _this.maxheight);
  90. });
  91. },
  92. fail: res => {}
  93. });
  94. },
  95. data() {
  96. return {
  97. // 头部图高度
  98. maxheight: '',
  99. tabCurrentIndex: 0,
  100. sr: '',
  101. zc: '',
  102. navList: [
  103. {
  104. state: 1,
  105. text: '收入',
  106. loadingType: 'more',
  107. orderList: [],
  108. page: 1, //当前页面
  109. limit: 10 //每次信息条数
  110. },
  111. {
  112. state: 0,
  113. text: '支出',
  114. loadingType: 'more',
  115. orderList: [],
  116. page: 1, //当前页面
  117. limit: 10 //每次信息条数
  118. }
  119. ],
  120. money: ''
  121. };
  122. },
  123. onLoad(options) {},
  124. onShow() {
  125. this.getUserInfo();
  126. this.loadData();
  127. //获取用户余额
  128. // userBalance({}).then(({ data }) => {
  129. // this.money = data.commissionCount;
  130. // });
  131. },
  132. methods: {
  133. ...mapMutations('user', ['setUserInfo']),
  134. navto(e) {
  135. uni.navigateTo({
  136. url: e
  137. });
  138. },
  139. getUserInfo() {
  140. getUserInfo({}).then(({ data }) => {
  141. this.setUserInfo(data);
  142. });
  143. },
  144. async loadData(source) {
  145. const 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. ticketsList(
  161. {
  162. page: navItem.page,
  163. limit: navItem.limit,
  164. uid: obj.userInfo.uid
  165. },
  166. state
  167. )
  168. .then(({ data }) => {
  169. console.log(data, '123456');
  170. obj.sr = data.general_income;
  171. obj.zc = data.general_expend;
  172. navItem.orderList = navItem.orderList.concat(data.list)
  173. //判断是否还有数据, 有改为more, 没有改为noMore
  174. if (navItem.limit == data.list.length) {
  175. navItem.loadingType = 'more';
  176. return;
  177. } else {
  178. navItem.loadingType = 'noMore';
  179. }
  180. uni.hideLoading();
  181. this.$set(navItem, 'loaded', true);
  182. })
  183. .catch(e => {
  184. console.log(e);
  185. });
  186. },
  187. //swiper 切换
  188. changeTab(e) {
  189. this.tabCurrentIndex = e.target.current;
  190. this.loadData('tabChange');
  191. },
  192. //顶部tab点击
  193. tabClick(index) {
  194. this.tabCurrentIndex = index;
  195. },
  196. toBack() {
  197. uni.navigateBack();
  198. }
  199. }
  200. };
  201. </script>
  202. <style lang="scss">
  203. page {
  204. background: #f2f5f4;
  205. height: 100%;
  206. }
  207. .status_bar {
  208. height: var(--status-bar-height);
  209. width: 100%;
  210. }
  211. .content-money {
  212. position: relative;
  213. height: 480rpx;
  214. .content-bg {
  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. .money-box {
  264. position: relative;
  265. z-index: 2;
  266. padding-top: 70rpx;
  267. color: #ffffff;
  268. text-align: center;
  269. .money {
  270. font-size: 72rpx;
  271. font-family: PingFang SC;
  272. font-weight: bold;
  273. color: #ffffff;
  274. }
  275. .text {
  276. font-size: 30rpx;
  277. }
  278. }
  279. .moneybtn-box {
  280. display: flex;
  281. justify-content: space-between;
  282. position: relative;
  283. z-index: 2;
  284. color: #ffffff;
  285. padding: 20rpx 50rpx;
  286. font-size: 30rpx;
  287. font-family: PingFang SC;
  288. font-weight: bold;
  289. color: #ffffff;
  290. }
  291. .navbar {
  292. margin-top: 25rpx;
  293. display: flex;
  294. height: 40px;
  295. padding: 0 5px;
  296. background: #fff;
  297. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  298. position: relative;
  299. z-index: 10;
  300. .nav-item {
  301. flex: 1;
  302. display: flex;
  303. justify-content: center;
  304. align-items: center;
  305. height: 100%;
  306. font-size: 15px;
  307. color: $font-color-dark;
  308. position: relative;
  309. &.current {
  310. color: #000;
  311. font-weight: bold;
  312. &:after {
  313. content: '';
  314. position: absolute;
  315. left: 50%;
  316. bottom: 0;
  317. transform: translateX(-50%);
  318. width: 44px;
  319. height: 0;
  320. border-bottom: 2px solid #ffac0e;
  321. }
  322. }
  323. }
  324. }
  325. //列表
  326. .swiper-box {
  327. .order-item {
  328. padding: 20rpx 30rpx;
  329. line-height: 1.5;
  330. .title-box {
  331. .title {
  332. font-size: $font-lg;
  333. color: $font-color-base;
  334. }
  335. .time {
  336. font-size: $font-base;
  337. color: $font-color-light;
  338. }
  339. }
  340. .money {
  341. color: rgba(239, 58, 85, 1);
  342. font-size: $font-lg;
  343. }
  344. }
  345. }
  346. .info-box {
  347. width: 670rpx;
  348. height: 186rpx;
  349. background: #ffffff;
  350. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  351. border-radius: 20rpx;
  352. margin: -100rpx auto 0;
  353. position: relative;
  354. z-index: 2;
  355. .info-item {
  356. width: 50%;
  357. display: flex;
  358. flex-direction: column;
  359. align-items: center;
  360. line-height: 1;
  361. .info-font {
  362. font-size: 30rpx;
  363. font-family: PingFang SC;
  364. font-weight: bold;
  365. color: #999999;
  366. }
  367. .info-num {
  368. margin-top: 30rpx;
  369. font-size: 30rpx;
  370. font-family: PingFang SC;
  371. font-weight: bold;
  372. color: #181818;
  373. }
  374. }
  375. .shu {
  376. width: 2rpx;
  377. height: 74rpx;
  378. background: #dcdfe6;
  379. }
  380. }
  381. .list-scroll-content {
  382. background-color: #ffffff;
  383. height: 100%;
  384. }
  385. .content {
  386. height: 100%;
  387. .empty-content {
  388. background-color: #ffffff;
  389. }
  390. }
  391. .btm-wrap {
  392. height: 140rpx;
  393. width: 750rpx;
  394. position: fixed;
  395. bottom: 0;
  396. left: 0;
  397. background-color: #fff;
  398. .btn {
  399. width: 674rpx;
  400. height: 88rpx;
  401. line-height: 88rpx;
  402. margin: auto;
  403. background: linear-gradient(-22deg, #9a5e19, #9a5e19);
  404. border-radius: 44rpx;
  405. text-align: center;
  406. font-size: 36rpx;
  407. font-family: PingFang SC;
  408. font-weight: 500;
  409. color: #ffffff;
  410. }
  411. }
  412. </style>