publicPing.vue 10 KB

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