myPledge.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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 empty from "@/components/empty";
  121. import {
  122. spreadCommission,
  123. userBalance,
  124. // extractBank,
  125. } from "@/api/wallet.js";
  126. export default {
  127. filters: {
  128. getMoneyStyle,
  129. },
  130. components: {
  131. empty,
  132. },
  133. onReady(res) {
  134. var _this = this;
  135. uni.getSystemInfo({
  136. success: resu => {
  137. const query = uni.createSelectorQuery();
  138. query.select(".swiper-box").boundingClientRect();
  139. query.exec(function (res) {
  140. _this.height = resu.windowHeight - res[0].top + "px";
  141. console.log("打印页面的剩余高度", _this.height);
  142. });
  143. },
  144. fail: res => {},
  145. });
  146. },
  147. data() {
  148. return {
  149. userInfo: {},
  150. yj: "",
  151. height: "",
  152. // 头部图高度
  153. maxheight: "",
  154. tabCurrentIndex: 0,
  155. orderStatusSum: 0,
  156. recharge: 0,
  157. navList: [
  158. // {
  159. // state: 0,
  160. // text: '全部',
  161. // loadingType: 'more',
  162. // orderList: [],
  163. // page: 1, //当前页数
  164. // limit: 10 //每次信息条数
  165. // },
  166. {
  167. state: 4,
  168. text: "进行中",
  169. loadingType: "more",
  170. orderList: [],
  171. page: 1, //当前页数
  172. limit: 10, //每次信息条数
  173. },
  174. {
  175. state: 3,
  176. text: "已结束",
  177. loadingType: "more",
  178. orderList: [],
  179. page: 1, //当前页数
  180. limit: 10, //每次信息条数
  181. },
  182. ],
  183. money: "",
  184. };
  185. },
  186. onLoad(options) {},
  187. onShow() {
  188. this.getUserInfo();
  189. this.loadData();
  190. this.getLock();
  191. },
  192. methods: {
  193. getUserInfo() {
  194. getUserInfo({}).then(({ data }) => {
  195. this.userInfo = data;
  196. });
  197. },
  198. async getLock() {
  199. const res = await getLock();
  200. console.log("123", res);
  201. },
  202. toBack() {
  203. uni.switchTab({
  204. url: "/pages/pledge/pledge",
  205. });
  206. },
  207. // 页面跳转
  208. navto(e) {
  209. uni.navigateTo({
  210. url: e,
  211. });
  212. },
  213. //获取收入支出信息
  214. async loadData(source) {
  215. let obj = this;
  216. //这里是将订单挂载到tab列表下
  217. let index = this.tabCurrentIndex;
  218. let navItem = this.navList[index];
  219. let state = navItem.state;
  220. if (source === "tabChange" && navItem.loaded === true) {
  221. //tab切换只有第一次需要加载数据
  222. return;
  223. }
  224. if (navItem.loadingType === "loading") {
  225. //防止重复加载
  226. return;
  227. }
  228. // 修改当前对象状态为加载中
  229. // navItem.loadingType = 'loading';
  230. spreadCommission(
  231. {
  232. page: navItem.page,
  233. limit: navItem.limit,
  234. },
  235. state
  236. )
  237. .then(({ data }) => {
  238. if (data.length > 0) {
  239. data.forEach(e => {
  240. navItem.orderList = navItem.orderList.concat(
  241. e.list
  242. );
  243. });
  244. console.log(navItem.orderList);
  245. navItem.page++;
  246. }
  247. //判断是否还有数据, 有改为more, 没有改为noMore
  248. if (navItem.limit == data.length) {
  249. navItem.loadingType = "more";
  250. return;
  251. } else {
  252. navItem.loadingType = "noMore";
  253. }
  254. uni.hideLoading();
  255. this.$set(navItem, "loaded", true);
  256. })
  257. .catch(e => {
  258. console.log(e);
  259. });
  260. },
  261. //swiper 切换
  262. changeTab(e) {
  263. this.tabCurrentIndex = e.target.current;
  264. this.loadData("tabChange");
  265. },
  266. //顶部tab点击
  267. tabClick(index) {
  268. this.tabCurrentIndex = index;
  269. },
  270. },
  271. };
  272. </script>
  273. <style lang="scss">
  274. .all {
  275. width: 750rpx;
  276. height: 1660rpx;
  277. background-color: $page-color-base;
  278. }
  279. .top {
  280. margin-left: 30rpx;
  281. width: 690rpx;
  282. height: 137rpx;
  283. background-color: #191a1f;
  284. }
  285. .zhiya {
  286. margin-left: 28rpx;
  287. // margin-top: 31rpx;
  288. padding-top: 31rpx;
  289. height: 21rpx;
  290. font-size: 21rpx;
  291. font-family: PingFang SC;
  292. font-weight: 500;
  293. color: #757c8f;
  294. }
  295. .zhiyashu {
  296. display: flex;
  297. justify-content: start;
  298. }
  299. .shu {
  300. margin-left: 29rpx;
  301. margin-top: 30rpx;
  302. font-size: 32rpx;
  303. height: 30rpx;
  304. color: #ffffff;
  305. font-family: PingFang SC;
  306. font-weight: bold;
  307. }
  308. .wen {
  309. margin-left: 20rpx;
  310. margin-top: 36rpx;
  311. height: 26rpx;
  312. font-size: 26rpx;
  313. font-family: PingFang SC;
  314. font-weight: bold;
  315. color: #ffffff;
  316. }
  317. .body {
  318. background-color: #191a1f;
  319. margin-left: 30rpx;
  320. margin-top: 20rpx;
  321. width: 690rpx;
  322. height: 137rpx;
  323. }
  324. .navbar {
  325. margin-top: 20rpx;
  326. display: flex;
  327. height: 88rpx;
  328. padding: 0 5px;
  329. background: #191a1f;
  330. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  331. position: relative;
  332. z-index: 10;
  333. .nav-item {
  334. flex: 1;
  335. display: flex;
  336. justify-content: center;
  337. align-items: center;
  338. height: 100%;
  339. font-size: 15px;
  340. color: #999999;
  341. position: relative;
  342. &.current {
  343. color: #fff;
  344. &:after {
  345. content: "";
  346. position: absolute;
  347. left: 50%;
  348. bottom: 0;
  349. transform: translateX(-50%);
  350. width: 44px;
  351. height: 0;
  352. border-bottom: 2px solid #fe5b38;
  353. }
  354. }
  355. }
  356. }
  357. // 列表样式
  358. .order-item {
  359. background: #191a1f;
  360. }
  361. .title-box {
  362. margin-left: 38rpx;
  363. display: flex;
  364. justify-content: space-between;
  365. width: 690rpx;
  366. }
  367. .title {
  368. flex: 1;
  369. margin-top: 30rpx;
  370. width: 43rpx;
  371. height: 50rpx;
  372. font-size: 22rpx;
  373. font-family: PingFang SC;
  374. font-weight: 500;
  375. color: #ffffff;
  376. line-height: 28rpx;
  377. opacity: 0.53;
  378. }
  379. .list {
  380. margin-top: 40rpx;
  381. margin-left: 38rpx;
  382. display: flex;
  383. justify-content: space-between;
  384. width: 690rpx;
  385. }
  386. .item {
  387. height: 40rpx;
  388. font-size: 22rpx;
  389. font-family: PingFang SC;
  390. font-weight: bold;
  391. color: #ffffff;
  392. line-height: 23rpx;
  393. }
  394. .l-item {
  395. height: 15rpx;
  396. font-size: 18rpx;
  397. font-family: PingFang SC;
  398. font-weight: 500;
  399. color: #ffffff;
  400. }
  401. .heng {
  402. margin-top: 30rpx;
  403. width: 750rpx;
  404. height: 2rpx;
  405. background: #e9e9e9;
  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>