| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- <template>
- <view class="container">
- <view class="empty-box" v-show="list.length === 0"><empty></empty></view>
- <view class="item-wrapper" v-if="list.length > 0" v-for="(ls,index) in list" :key='index'>
- <view class="item">
- <view class="item-name">设备名称</view>
- <view class="item-val">{{ls.machine.name}}</view>
- </view>
- <view class="item">
- <view class="item-name">状态</view>
- <view class="item-val blue">{{ls.status == 0 ? '准备中' : ls.status == 1 ? '挖矿中' : '已到期'}}</view>
- </view>
- <view class="item">
- <view class="item-name">合约期限</view>
- <view class="item-val blue">{{ls.machine.first_step_time + ls.machine.second_step_time }}天 + {{ ls.machine.third_step_time}}天</view>
- </view>
- <view class="item">
- <view class="item-name">算力</view>
- <view class="item-val blue">{{+ls.num}} {{ls.get_money_type==='BZZ'?'节点':'T'}}</view>
- </view>
- <view class="item">
- <view class="item-name">管理费</view>
- <view class="item-val">{{ls.user_service_ratio}}%</view>
- </view>
- <view class="item">
- <view class="item-name">单价</view>
- <view class="item-val">{{ls.machine.cost_money * 1}} {{ls.machine.cost_money_type}}/{{ls.get_money_type==='BZZ'?'节点':'T'}}</view>
- </view>
- <view class="item">
- <view class="item-name">购买份数</view>
- <view class="item-val">{{+ls.num}}</view>
- </view>
- <view class="item">
- <view class="item-name">总价</view>
- <view class="item-val">{{ls._cost_money}}</view>
- </view>
- <view class="item">
- <view class="item-name">购买时间</view>
- <view class="item-val">{{ls._pay_time}}</view>
- </view>
- </view>
-
- <!-- <view class="jg" v-if="list.length !== 0"></view> -->
- <uni-load-more :status="loadingType"></uni-load-more>
- <!-- <view class="list-cell" v-if="list.length > 0" v-for="(ls,index) in list" :key='index'>
- <view class="cell-title flex">
- <view class="cellTpl flex_item">
- <image :src="ls.machine.logo"></image>
- <view class="title">{{ls.machine.name}}</view>
- </view>
- <view class="status">{{ls.status == 0 ? '准备中' : ls.status == 1 ? '挖矿中' : '已到期'}}</view>
- </view>
- <view class="cell-tip">{{ls.machine.first_step_time + ls.machine.second_step_time + ls.machine.third_step_time}}天矿机</view>
- <view class="flex cell-tpl">
- <view class="tpl">
- <view class="" v-if="ls.get_money_type == 'BZZ'">单价(节点)</view>
- <view class="" v-else>单价(T)</view>
- <view class="">{{ls.machine.cost_money * 1}} {{ls.machine.cost_money_type}}</view>
- </view>
- <view class="tpl">
- <view class="">有效算力</view>
- <view class="" v-if="ls.get_money_type == 'BZZ'">{{ls.num * 1}}节点</view>
- <view class="" v-else>{{ls.num * 1}}T</view>
- </view>
- <view class="tpl">
- <view class="">合约周期</view>
- <view class="">{{ls.machine.first_step_time + ls.machine.second_step_time + ls.machine.third_step_time}}天</view>
- </view>
- </view>
- <view class="cell-info flex">
- <view class="tip">到期时间:{{ls.mining_end_time}}</view>
- </view>
- <view class="cell-info flex">
- <view class="tip">购买时间:{{ls._pay_time}}</view>
- </view>
- <view class="cell-info flex" v-if="ls.status == 0">
- <view class="tip">倒计时:<uni-countdown
- color="#FFF"
- background-color="#BAC1EF"
- :day="ls.stopTimeD"
- :hour="ls.stopTimeH"
- :minute="ls.stopTimeM"
- :second="ls.stopTimeS"
- :index="index"
- @timeover="isTime"
- ></uni-countdown></view>
- </view>
- </view> -->
-
- </view>
- </template>
- <script>
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import { mymining } from '@/api/calculation.js';
- import empty from '@/components/empty';
- import { timeComputed } from '@/utils/rocessor.js';
- import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
- export default {
- components: {
- empty,uniCountdown
- },
- data() {
- return {
- list:[],
- page: 1,
- limit: 10,
- loadingType: 'more',
- };
- },
- onLoad(option){
- this.loadData();
- },
- onShow() {
-
- },
- onReachBottom() {
- this.loadData();
- },
- methods: {
- async loadData() {
- let obj = this;
- if(obj.loadingType == 'loading' || obj.loadingType == 'noMore' ) {
- return
- }
- obj.loadingType = 'loading'
- mymining({
- page:obj.page,
- limit:obj.limit,
- }).then(({ data }) => {
- console.log(data,"基础数据")
- // obj.list = data.data;
- obj.list = obj.list.concat(data.data)
-
- if(data.data.length == obj.limit) {
- obj.page++
- obj.loadingType = 'more'
- }else {
- obj.loadingType = 'noMore'
- }
- // obj.list = data.data.map((e,ind) => {
- // let ar = e;
- // console.log(e,"饿");
- // // 判断是否为进行中的活动
- // if (ar.status === 0) {
- // // 计算倒计时时间
- // obj.timeComputed(ar.mining_start_time * 1000, ar);
- // console.log(ar.stopTimeD)
- // } else {
- // console.log('++++++++++')
- // // 获取距离开始还需要多少时间
- // if( ar.time){
- // let arTime = ar.time.split(':');
- // let h = arTime[0];
- // let m = arTime[1];
- // let time = new Date();
- // // 设置时间
- // time.setHours(h, m, 0);
- // // 计算倒计时时间
- // obj.timeComputed(time.getTime(), ar);}
- // }
-
- // return e;
- // })
- });
- },
- // 计算倒计时时间
- timeComputed(da, ar) {
- let obj = this;
- // 计算时间,保存需要多少时间到期
- let stopTime = timeComputed(da);
- console.log(stopTime);
- ar.stopTimeD = stopTime.day;
- ar.stopTimeH = stopTime.hours;
- ar.stopTimeM = stopTime.minutes;
- ar.stopTimeS = stopTime.seconds;
- },
- isTime(index) {
- this.list[index].status = 1
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- min-height: 100%;
- background-color: #ffffff;
- .container {
- width: 100%;
-
- }
- }
- .list-cell{
- padding: 40rpx 40rpx;
- .cell-title{
- padding: 29rpx 38rpx;
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- .cellTpl{
- image{
- width: 40rpx;
- height: 40rpx;
- margin-right: 15rpx;
- }
- }
- .status{
- color: #E51C23;
- }
- }
- .cell-tip{
- padding: 0rpx 38rpx;
- font-size: 24rpx;
- font-weight: bold;
- color: #0EC1A1;
- }
- .cell-tpl{
- padding: 40rpx 31rpx;
- font-size: 24rpx;
- font-weight: bold;
- color: #333333;
- line-height: 40rpx;
- }
- .cell-info{
- margin-bottom: 25rpx;
- .tip{
- font-size: 30rpx;
- font-weight: bold;
- color: #5771DF;
- }
- .zhiya-btn{
- background-color: #5771DF;
- padding: 12rpx 22rpx;
- font-size: 24rpx;
- border-radius: 50rpx;
- color: #FFFFFF;
- }
- }
- .list-tip{
- word-wrap:break-word;
- background-color: #BAC1EF !important;
- font-size: 24rpx;
- font-weight: 500;
- color: #333333;
- padding: 36rpx 32rpx;
- margin-top: 15rpx;
- border-bottom-left-radius:15rpx ;
- border-bottom-right-radius:15rpx ;
- }
- }
- .empty-box{
- margin-top: 100rpx;
- width: 100%;
- height: 500rpx;
- }
- .item-wrapper {
- padding: 0 35rpx;
- width: 690rpx;
- height: 748rpx;
- background: #F7F6FB;
- border: 1rpx solid #5771DF;
- border-radius: 20rpx;
- margin: 20rpx auto;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- line-height: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- .item {
- display: flex;
- justify-content: space-between;
- .item-val {
- font-weight: bold;
- }
- }
- .blue {
- color: #5771DF;
-
- }
- }
- .jg {
- height: 20rpx;
- }
- </style>
|