qudou.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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. state: 0,
  141. text: '收入',
  142. loadingType: 'more',
  143. orderList: [],
  144. page: 1, //当前页数
  145. limit: 1000, //每次信息条数
  146. loaded: false
  147. },
  148. {
  149. state: 1,
  150. text: '支出',
  151. loadingType: 'more',
  152. orderList: [],
  153. page: 1, //当前页数
  154. limit: 1000, //每次信息条数
  155. loaded: false
  156. }
  157. ],
  158. money: ''
  159. };
  160. },
  161. onLoad(options) {},
  162. onShow() {
  163. this.loadData();
  164. this.loadBaseData();
  165. },
  166. methods: {
  167. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  168. // 页面跳转
  169. navto(e) {
  170. uni.navigateTo({
  171. url: e
  172. });
  173. },
  174. loadBaseData() {
  175. getUserInfo({})
  176. .then(({
  177. data
  178. }) => {
  179. this.setUserInfo(data);
  180. })
  181. .catch(e => {
  182. console.log(e);
  183. });
  184. },
  185. // 点击返回 我的页面
  186. toBack() {
  187. uni.navigateBack({});
  188. },
  189. //获取收入支出信息
  190. async loadData(source) {
  191. let obj = this;
  192. //这里是将订单挂载到tab列表下
  193. let index = this.tabCurrentIndex;
  194. let navItem = this.navList[index];
  195. let state = navItem.state;
  196. console.log(source, 'iwiwiwiwi');
  197. if (source === 'tabChange' && navItem.loaded === true) {
  198. //tab切换只有第一次需要加载数据
  199. return;
  200. }
  201. if (navItem.loadingType === 'loading') {
  202. //防止重复加载
  203. return;
  204. }
  205. // 修改当前对象状态为加载中
  206. navItem.loadingType = 'loading';
  207. integrallist({
  208. page: navItem.page,
  209. limit: navItem.limit
  210. })
  211. .then(({
  212. data
  213. }) => {
  214. // obj.recharge = data.income;
  215. // obj.orderStatusSum = data.expend;
  216. if (state == 0) {
  217. navItem.orderList = data.zj;
  218. }
  219. if (state == 1) {
  220. navItem.orderList = data.kc;
  221. }
  222. })
  223. .catch(e => {
  224. console.log(e);
  225. });
  226. },
  227. //swiper 切换
  228. changeTab(e) {
  229. this.tabCurrentIndex = e.target.current;
  230. this.loadData('tabChange');
  231. },
  232. //顶部tab点击
  233. tabClick(index) {
  234. this.tabCurrentIndex = index;
  235. }
  236. }
  237. };
  238. </script>
  239. <style lang="scss">
  240. page {
  241. background: #f1f1f1;
  242. height: 100%;
  243. }
  244. .status_bar {
  245. height: var(--status-bar-height);
  246. width: 100%;
  247. }
  248. .moneybtn-box {
  249. position: relative;
  250. z-index: 2;
  251. color: $font-color-dark;
  252. font-size: 28rpx;
  253. font-weight: bold;
  254. background-color: #FFF;
  255. border-radius: 30rpx;
  256. margin: -100rpx 30rpx 30rpx 30rpx;
  257. height: 180rpx;
  258. .money-btn {
  259. flex-grow: 1;
  260. line-height: 1;
  261. .tipIcon {
  262. width: 55rpx;
  263. height: 55rpx;
  264. }
  265. }
  266. .money-bt-line {
  267. border: 1px solid $border-color-base;
  268. height: 100rpx;
  269. }
  270. }
  271. .content-money {
  272. position: relative;
  273. height: 480rpx;
  274. .content-bg {
  275. position: absolute;
  276. top: 0;
  277. left: 0;
  278. right: 0;
  279. width: 750rpx;
  280. height: 480rpx;
  281. image {
  282. width: 100%;
  283. height: 100%;
  284. }
  285. }
  286. .body-title {
  287. height: 80rpx;
  288. text-align: center;
  289. font-size: 35rpx;
  290. position: relative;
  291. .header {
  292. position: absolute;
  293. left: 0;
  294. top: 0;
  295. width: 100%;
  296. font-size: 36rpx;
  297. font-family: PingFang SC;
  298. font-weight: bold;
  299. color: #fffeff;
  300. height: 80rpx;
  301. font-size: 36rpx;
  302. font-weight: 700;
  303. z-index: 9;
  304. display: flex;
  305. justify-content: center;
  306. align-items: center;
  307. }
  308. .goback-box {
  309. position: absolute;
  310. left: 18rpx;
  311. top: 0;
  312. height: 80rpx;
  313. display: flex;
  314. align-items: center;
  315. }
  316. .goback {
  317. z-index: 100;
  318. width: 34rpx;
  319. height: 34rpx;
  320. }
  321. }
  322. }
  323. .info-box {
  324. width: 670rpx;
  325. height: 186rpx;
  326. background: #ffffff;
  327. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  328. border-radius: 20rpx;
  329. margin: -100rpx auto 0;
  330. position: relative;
  331. z-index: 2;
  332. .info-item {
  333. width: 50%;
  334. display: flex;
  335. flex-direction: column;
  336. align-items: center;
  337. line-height: 1;
  338. .info-font {
  339. font-size: 30rpx;
  340. font-weight: bold;
  341. color: #999999;
  342. }
  343. .info-num {
  344. margin-top: 30rpx;
  345. font-size: 30rpx;
  346. font-family: PingFang SC;
  347. font-weight: bold;
  348. color: #181818;
  349. }
  350. }
  351. .shu {
  352. width: 2rpx;
  353. height: 74rpx;
  354. background: #dcdfe6;
  355. }
  356. }
  357. .money-box {
  358. position: relative;
  359. z-index: 2;
  360. padding-top: 90rpx;
  361. color: #ffffff;
  362. text-align: center;
  363. .money {
  364. font-size: 72rpx;
  365. font-family: PingFang SC;
  366. font-weight: bold;
  367. color: #ffffff;
  368. }
  369. .text {
  370. font-size: 30rpx;
  371. }
  372. }
  373. .navbar {
  374. margin-top: 20rpx;
  375. display: flex;
  376. height: 88rpx;
  377. padding: 0 5px;
  378. background: #fff;
  379. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  380. position: relative;
  381. z-index: 10;
  382. .nav-item {
  383. flex: 1;
  384. display: flex;
  385. justify-content: center;
  386. align-items: center;
  387. height: 100%;
  388. font-size: 15px;
  389. color: #999999;
  390. position: relative;
  391. &.current {
  392. color: #000;
  393. &:after {
  394. content: '';
  395. position: absolute;
  396. left: 50%;
  397. bottom: 0;
  398. transform: translateX(-50%);
  399. width: 44px;
  400. height: 0;
  401. border-bottom: 2px solid #fe5b38;
  402. }
  403. }
  404. }
  405. }
  406. //列表
  407. .swiper-box {
  408. .order-item:last-child {
  409. margin-bottom: 60rpx;
  410. }
  411. .order-item {
  412. padding: 20rpx 30rpx;
  413. line-height: 1.5;
  414. .title-box {
  415. .title {
  416. font-size: $font-lg;
  417. color: $font-color-base;
  418. }
  419. .time {
  420. font-size: $font-base;
  421. color: $font-color-light;
  422. }
  423. }
  424. .money {
  425. color: #fd5b23;
  426. font-size: $font-lg;
  427. text-align: right;
  428. .status {
  429. color: $font-color-light;
  430. }
  431. }
  432. }
  433. }
  434. .list-scroll-content {
  435. background: #ffffff;
  436. height: 100%;
  437. }
  438. .content {
  439. height: 100%;
  440. .empty-content {
  441. background-color: #ffffff;
  442. }
  443. }
  444. .btn-box {
  445. width: 674rpx;
  446. height: 88rpx;
  447. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  448. border-radius: 44rpx;
  449. font-size: 36rpx;
  450. font-family: PingFang SC;
  451. font-weight: 500;
  452. color: #ffffff;
  453. text-align: center;
  454. line-height: 88rpx;
  455. position: fixed;
  456. bottom: 48rpx;
  457. left: 0;
  458. right: 0;
  459. margin: 0 auto;
  460. }
  461. </style>