frozen.vue 9.8 KB

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