qudou.vue 11 KB

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