myPledge.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <view class="all">
  3. <view class="top">
  4. <view class="zhiya"> {{ $t("myple.u1") }} </view>
  5. <view class="zhiyashu">
  6. <p class="shu">241,142,574.25</p>
  7. <p class="wen">USDT</p>
  8. </view>
  9. </view>
  10. <view class="navbar">
  11. <view
  12. v-for="(item, index) in navList"
  13. :key="index"
  14. class="nav-item"
  15. :class="{ current: tabCurrentIndex === index }"
  16. @click="tabClick(index)"
  17. >{{ item.text }}</view
  18. >
  19. </view>
  20. <swiper
  21. :current="tabCurrentIndex"
  22. :style="{ height: height }"
  23. class="swiper-box"
  24. duration="300"
  25. @change="changeTab">
  26. <swiper-item
  27. class="tab-content"
  28. v-for="(tabItem, tabIndex) in navList"
  29. :key="tabIndex">
  30. <scroll-view
  31. scroll-y="true"
  32. class="list-scroll-content"
  33. @scrolltolower="loadData">
  34. <!-- 空白页 -->
  35. <!-- <empty
  36. v-if="
  37. tabItem.loaded === true &&
  38. tabItem.orderList.length === 0
  39. "></empty> -->
  40. <!-- 订单列表 -->
  41. <view>
  42. <!-- <view class="order-item flex" > -->
  43. <view class="order-item">
  44. <view class="title-box">
  45. <view class="title">
  46. <text>{{ $t("myple.u4") }}</text>
  47. </view>
  48. <view class="title">
  49. <text>{{ $t("myple.u5") }}</text>
  50. </view>
  51. <view class="title">
  52. <text>{{ $t("myple.u6") }}</text>
  53. </view>
  54. <view class="title">
  55. <text>{{ $t("myple.u7") }}</text>
  56. </view>
  57. <view class="title">
  58. <text>{{ $t("myple.u8") }}</text>
  59. </view>
  60. </view>
  61. <view class="heng"></view>
  62. <view
  63. class="all-list"
  64. v-for="item in 10"
  65. :key="item">
  66. <view class="list">
  67. <view class="list-item">
  68. <view class="item"> 100 </view>
  69. <view class="item"> USDT </view>
  70. </view>
  71. <view class="list-item">
  72. <view class="item"> 100 </view>
  73. <view class="item"> USDT </view>
  74. </view>
  75. <view class="list-item">
  76. <view
  77. class="item"
  78. style="margin-top: 18rpx">
  79. 7天
  80. </view>
  81. </view>
  82. <view class="list-item">
  83. <view class="l-item"> 2023.12.02 </view>
  84. <view
  85. class="l-item"
  86. style="margin-top: 20rpx">
  87. 12:00:00
  88. </view>
  89. </view>
  90. <view class="list-item">
  91. <view class="l-item"> 2023.12.02 </view>
  92. <view
  93. class="l-item"
  94. style="margin-top: 20rpx">
  95. 12:00:00
  96. </view>
  97. </view>
  98. </view>
  99. <view class="heng"></view>
  100. </view>
  101. <!-- <view class="money">
  102. <view>{{ (item.pm == 0 ? '-' : '+') + item.number * 1 }}</view>
  103. </view> -->
  104. </view>
  105. </view>
  106. <!-- 上拉显示更多 -->
  107. <!-- <uni-load-more :status="tabItem.loadingType"
  108. v-if="!(tabItem.orderList.length == 0 && tabItem.loaded)"></uni-load-more> -->
  109. </scroll-view>
  110. </swiper-item>
  111. </swiper>
  112. </view>
  113. </template>
  114. <script>
  115. import { mapState, mapMutations } from "vuex";
  116. import { getCommissionInfo, getUserInfo } from "@/api/user.js";
  117. import { getLock } from "@/api/mypledge.js";
  118. import { getMoneyStyle } from "@/utils/rocessor.js";
  119. import { mapGetters } from "vuex";
  120. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  121. import empty from "@/components/empty";
  122. import {
  123. spreadCommission,
  124. userBalance,
  125. // extractBank,
  126. } from "@/api/wallet.js";
  127. export default {
  128. filters: {
  129. getMoneyStyle,
  130. },
  131. components: {
  132. empty,
  133. uniLoadMore,
  134. },
  135. onReady(res) {
  136. var _this = this;
  137. uni.getSystemInfo({
  138. success: resu => {
  139. const query = uni.createSelectorQuery();
  140. query.select(".swiper-box").boundingClientRect();
  141. query.exec(function (res) {
  142. _this.height = resu.windowHeight - res[0].top + "px";
  143. console.log("打印页面的剩余高度", _this.height);
  144. });
  145. },
  146. fail: res => {},
  147. });
  148. },
  149. data() {
  150. return {
  151. userInfo: {},
  152. yj: "",
  153. height: "",
  154. // 头部图高度
  155. maxheight: "",
  156. tabCurrentIndex: 0,
  157. orderStatusSum: 0,
  158. recharge: 0,
  159. navList: [
  160. // {
  161. // state: 0,
  162. // text: '全部',
  163. // loadingType: 'more',
  164. // orderList: [],
  165. // page: 1, //当前页数
  166. // limit: 10 //每次信息条数
  167. // },
  168. {
  169. state: 4,
  170. text: "进行中",
  171. loadingType: "more",
  172. orderList: [],
  173. page: 1, //当前页数
  174. limit: 10, //每次信息条数
  175. },
  176. {
  177. state: 3,
  178. text: "已结束",
  179. loadingType: "more",
  180. orderList: [],
  181. page: 1, //当前页数
  182. limit: 10, //每次信息条数
  183. },
  184. ],
  185. money: "",
  186. };
  187. },
  188. onLoad(options) {},
  189. onShow() {
  190. this.getUserInfo();
  191. this.loadData();
  192. this.getLock();
  193. },
  194. methods: {
  195. getUserInfo() {
  196. getUserInfo({}).then(({ data }) => {
  197. this.userInfo = data;
  198. });
  199. },
  200. async getLock() {
  201. const res = await getLock();
  202. console.log("123", res);
  203. },
  204. toBack() {
  205. uni.switchTab({
  206. url: "/pages/pledge/pledge",
  207. });
  208. },
  209. // 页面跳转
  210. navto(e) {
  211. uni.navigateTo({
  212. url: e,
  213. });
  214. },
  215. //获取收入支出信息
  216. async loadData(source) {
  217. let obj = this;
  218. //这里是将订单挂载到tab列表下
  219. let index = this.tabCurrentIndex;
  220. let navItem = this.navList[index];
  221. let state = navItem.state;
  222. if (source === "tabChange" && navItem.loaded === true) {
  223. //tab切换只有第一次需要加载数据
  224. return;
  225. }
  226. if (navItem.loadingType === "loading") {
  227. //防止重复加载
  228. return;
  229. }
  230. // 修改当前对象状态为加载中
  231. // navItem.loadingType = 'loading';
  232. spreadCommission(
  233. {
  234. page: navItem.page,
  235. limit: navItem.limit,
  236. },
  237. state
  238. )
  239. .then(({ data }) => {
  240. if (data.length > 0) {
  241. data.forEach(e => {
  242. navItem.orderList = navItem.orderList.concat(
  243. e.list
  244. );
  245. });
  246. console.log(navItem.orderList);
  247. navItem.page++;
  248. }
  249. //判断是否还有数据, 有改为more, 没有改为noMore
  250. if (navItem.limit == data.length) {
  251. navItem.loadingType = "more";
  252. return;
  253. } else {
  254. navItem.loadingType = "noMore";
  255. }
  256. uni.hideLoading();
  257. this.$set(navItem, "loaded", true);
  258. })
  259. .catch(e => {
  260. console.log(e);
  261. });
  262. },
  263. //swiper 切换
  264. changeTab(e) {
  265. this.tabCurrentIndex = e.target.current;
  266. this.loadData("tabChange");
  267. },
  268. //顶部tab点击
  269. tabClick(index) {
  270. this.tabCurrentIndex = index;
  271. },
  272. },
  273. };
  274. </script>
  275. <style lang="scss">
  276. .all {
  277. width: 750rpx;
  278. height: 1660rpx;
  279. background-color: $page-color-base;
  280. }
  281. .top {
  282. margin-left: 30rpx;
  283. width: 690rpx;
  284. height: 137rpx;
  285. background-color: #191a1f;
  286. }
  287. .zhiya {
  288. margin-left: 28rpx;
  289. // margin-top: 31rpx;
  290. padding-top: 31rpx;
  291. height: 21rpx;
  292. font-size: 21rpx;
  293. font-family: PingFang SC;
  294. font-weight: 500;
  295. color: #757c8f;
  296. }
  297. .zhiyashu {
  298. display: flex;
  299. justify-content: start;
  300. }
  301. .shu {
  302. margin-left: 29rpx;
  303. margin-top: 30rpx;
  304. font-size: 32rpx;
  305. height: 30rpx;
  306. color: #ffffff;
  307. font-family: PingFang SC;
  308. font-weight: bold;
  309. }
  310. .wen {
  311. margin-left: 20rpx;
  312. margin-top: 36rpx;
  313. height: 26rpx;
  314. font-size: 26rpx;
  315. font-family: PingFang SC;
  316. font-weight: bold;
  317. color: #ffffff;
  318. }
  319. .body {
  320. background-color: #191a1f;
  321. margin-left: 30rpx;
  322. margin-top: 20rpx;
  323. width: 690rpx;
  324. height: 137rpx;
  325. }
  326. .navbar {
  327. margin-top: 20rpx;
  328. display: flex;
  329. height: 88rpx;
  330. padding: 0 5px;
  331. background: #191a1f;
  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: #999999;
  343. position: relative;
  344. &.current {
  345. color: #fff;
  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 #fe5b38;
  355. }
  356. }
  357. }
  358. }
  359. // 列表样式
  360. .order-item {
  361. background: #191a1f;
  362. }
  363. .title-box {
  364. margin-left: 38rpx;
  365. display: flex;
  366. justify-content: space-between;
  367. width: 690rpx;
  368. }
  369. .title {
  370. flex: 1;
  371. margin-top: 30rpx;
  372. width: 43rpx;
  373. height: 50rpx;
  374. font-size: 22rpx;
  375. font-family: PingFang SC;
  376. font-weight: 500;
  377. color: #ffffff;
  378. line-height: 28rpx;
  379. opacity: 0.53;
  380. }
  381. .list {
  382. margin-top: 40rpx;
  383. margin-left: 38rpx;
  384. display: flex;
  385. justify-content: space-between;
  386. width: 690rpx;
  387. }
  388. .item {
  389. height: 40rpx;
  390. font-size: 22rpx;
  391. font-family: PingFang SC;
  392. font-weight: bold;
  393. color: #ffffff;
  394. line-height: 23rpx;
  395. }
  396. .l-item {
  397. height: 15rpx;
  398. font-size: 18rpx;
  399. font-family: PingFang SC;
  400. font-weight: 500;
  401. color: #ffffff;
  402. }
  403. .heng {
  404. margin-top: 30rpx;
  405. width: 750rpx;
  406. height: 2rpx;
  407. background: #e9e9e9;
  408. }
  409. .btn-box {
  410. width: 674rpx;
  411. height: 88rpx;
  412. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  413. border-radius: 44rpx;
  414. font-size: 36rpx;
  415. font-family: PingFang SC;
  416. font-weight: 500;
  417. color: #ffffff;
  418. text-align: center;
  419. line-height: 88rpx;
  420. position: fixed;
  421. bottom: 48rpx;
  422. left: 0;
  423. right: 0;
  424. margin: 0 auto;
  425. }
  426. </style>