qudou.vue 9.1 KB

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