123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- <template>
- <view class="all">
- <view class="top padding-v-30 padding-c-30">
- <view class="zhiya padding-b-10"> {{ $t("myple.u1") }} </view>
- <view class="zhiyashu">
- <text class="shu">{{navList[tabCurrentIndex].sum|getMoneyStyle}}</text>
- <text class="wen padding-l-10">USDT</text>
- </view>
- </view>
- <view class="navbar flex">
- <view v-for="(item, index) in navList" :key="index" class="nav-item flex-center"
- :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
- </view>
- <view class="title-box flex">
- <view class="title">
- <text>{{ $t("myple.u4") }}</text>
- </view>
- <view class="title">
- <text>{{ $t("myple.u5") }}</text>
- </view>
- <view class="title">
- <text>{{ $t("myple.u6") }}</text>
- </view>
- <view class="title">
- <text>{{ $t("myple.u7") }}</text>
- </view>
- <!-- <view class="title">
- <text>{{ $t("myple.u8") }}</text>
- </view> -->
- </view>
- <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300"
- @change="changeTab">
- <swiper-item class="tab-content padding-b-30" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
- <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
- <!-- 空白页 -->
- <empty v-if="
- tabItem.loaded === true &&
- tabItem.orderList.length === 0
- "></empty>
- <!-- 订单列表 -->
- <view>
- <!-- <view class="order-item flex" > -->
- <view class="order-item">
- <view class="all-list" v-for="(item,ind) in navList[tabCurrentIndex].orderList" :key="ind">
- <view class="list flex padding-v-20">
- <view class="list-item">
- <view class="item"> {{item.num}} </view>
- <view class="item"> USDT </view>
- </view>
- <view class="list-item">
- <view class="item"> {{item.income}} </view>
- <view class="item"> PKR </view>
- </view>
- <view class="list-item">
- <view class="item">
- {{item.day}}天
- </view>
- </view>
- <view class="list-item">
- <view class="l-item">{{item.add_time[0]}} </view>
- <view class="l-item">
- {{item.add_time[1]}}
- </view>
- </view>
- <!-- <view class="list-item">
- <view class="l-item">{{item.send_time[0]}}</view>
- <view class="l-item">
- {{item.send_time[1]}}
- </view>
- </view> -->
- </view>
- </view>
- <!-- <view class="money">
- <view>{{ (item.pm == 0 ? '-' : '+') + item.number * 1 }}</view>
- </view> -->
- </view>
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- import {
- getLock
- } from "@/api/mypledge.js";
- import empty from "@/components/empty";
- import {
- getTime
- } from '@/utils/rocessor.js';
- import {
- getMoneyStyle
- } from "@/utils/rocessor.js";
- export default {
- filters: {
- getMoneyStyle,
- },
- components: {
- empty,
- },
- onReady(res) {
- var _this = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.swiper-box').boundingClientRect();
- query.exec(function(res) {
- _this.height = resu.windowHeight - res[0].top + 'px';
- });
- },
- fail: res => {}
- });
- },
- data() {
- return {
- height: "",
- tabCurrentIndex: 0,
- navList: [{
- state: 1,
- text: this.$t('myple.u2'),
- loadingType: "more",
- orderList: [],
- page: 1, //当前页数
- limit: 10, //每次信息条数
- loaded: false,
- sum:''
- },
- {
- state: 2,
- text: this.$t('myple.u3'),
- loadingType: "more",
- orderList: [],
- page: 1, //当前页数
- limit: 10, //每次信息条数
- loaded: false,
- sum:''
- },
- ],
- };
- },
- onLoad(options) {
- uni.setNavigationBarTitle({
- title: this.$t("tab.a1"),
- });
- },
- onShow() {
- this.loadData();
- },
- methods: {
- getTime,
- toBack() {
- uni.switchTab({
- url: "/pages/pledge/pledge",
- });
- },
- // 页面跳转
- navto(e) {
- uni.navigateTo({
- url: e,
- });
- },
- //获取收入支出信息
- async loadData(source) {
- const that = this;
- //这里是将订单挂载到tab列表下
- let index = that.tabCurrentIndex;
- let navItem = that.navList[index];
- let state = navItem.state;
- if (source === 'tabChange' && navItem.loaded === true) {
- //tab切换只有第一次需要加载数据
- return;
- }
- if (navItem.loadingType === 'loading') {
- //防止重复加载
- return;
- }
- if (navItem.loadingType === 'noMore') {
- //防止重复加载
- return;
- }
- // 修改当前对象状态为加载中
- navItem.loadingType = 'loading';
- getLock({
- status: state,
- page: navItem.page,
- limit: navItem.limit
- })
- .then(({
- data
- }) => {
- // 保存我的总金额
- navItem.sum = data.sum;
- let arr = data.list.map(e => {
- e.add_time = that.getTime(e.add_time).split(" ")
- e.send_time = that.getTime(e.send_time).split(" ")
- e.income = Number(e.income);
- e.num = Number(e.num);
- return e;
- });
- navItem.orderList = navItem.orderList.concat(arr);
- if (navItem.limit == data.length) {
- navItem.page++;
- //判断是否还有数据, 有改为 more, 没有改为noMore
- navItem.loadingType = 'more';
- return;
- } else {
- //判断是否还有数据, 有改为 more, 没有改为noMore
- navItem.loadingType = 'noMore';
- }
- uni.hideLoading();
- that.$set(navItem, 'loaded', true);
- })
- .catch(e => {
- console.log(e);
- });
- },
- //swiper 切换
- changeTab(e) {
- this.tabCurrentIndex = e.target.current;
- this.loadData("tabChange");
- },
- //顶部tab点击
- tabClick(index) {
- this.tabCurrentIndex = index;
- },
- },
- };
- </script>
- <style lang="scss">
- .all {
- line-height: 1;
- }
- .top {
- margin: 0 30rpx;
- height: 138rpx;
- background-color: #191a1f;
- font-weight: bold;
- color: #ffffff;
- border-radius: 20rpx;
- .zhiya {
- font-size: $font-sm;
- color: #757c8f;
- }
- .zhiyashu {
- .shu {
- font-size: $font-lg;
- }
- .wen {
- font-size: $font-base;
- }
- }
- }
- .swiper-box {
- margin: 0 30rpx;
- }
- .navbar {
- margin: 20rpx 30rpx 0 30rpx;
- border-top-right-radius: 20rpx;
- border-top-left-radius: 20rpx;
- height: 88rpx;
- padding: 0 5px;
- background: #191a1f;
- border-bottom: 1px solid rgba(255, 255, 255, 0.3);
- .nav-item {
- flex: 1;
- height: 100%;
- font-size: 15px;
- color: #999999;
- position: relative;
- &.current {
- color: #fff;
- &:after {
- content: "";
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 44px;
- height: 0;
- border-bottom: 2px solid $color-yellow;
- }
- }
- }
- }
- .tab-content {
- .list-scroll-content {
- background: #191a1f;
- border-bottom-right-radius: 20rpx;
- border-bottom-left-radius: 20rpx;
- height: 100%;
- overflow:hidden;
- }
- }
- // 列表样式
- .title-box {
- padding: 20rpx 0;
- background: #191a1f;
- margin: 0 30rpx;
- justify-content: space-around;
- border-bottom: 1px solid rgba(255, 255, 255, 0.3);
- .title {
- width: 20%;
- font-size: 22rpx;
- color: $font-color-light;
- text-align: center;
- }
- }
- .all-list {
- .list {
- border-bottom: 1px solid rgba(255, 255, 255, 0.3);
- justify-content: space-around;
- .list-item {
- color: #ffffff;
- width: 20%;
- text-align: center;
- flex-shrink: 0;
- .item {
- font-size: 22rpx;
- font-weight: bold;
- }
- .l-item {
- font-size: 18rpx;
- }
- }
- }
- }
- </style>
|