gouwu.vue 8.6 KB

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