123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- <template>
- <view class="rake">
- <view class="jg" style="height: 20rpx;">
-
- </view>
- <view class="item" v-for="(ls,index) in list" v-if="ls.stock != 0" :key="index">
- <view class="top">
- <view class="info-title">
- <image :src="ls.logo" mode=""></image>
- <view class="">{{ ls.name }}</view>
- </view>
- <view class="tags">
- <view class="tag" v-for="it in ls.tags" :key="it">{{ it }}</view>
- </view>
- <view class="base-info">
- <view class="info-item">
- <view class="tit">单价</view>
- <view class="val">{{ +ls.cost_money }}{{ls.cost_money_type}}/{{ ls.get_money_type === 'BZZ' ? '节点' : 'T' }}</view>
- </view>
- <view class="info-item">
- <view class="tit">有效算力</view>
- <view class="val">{{ ls.step }} {{ ls.get_money_type === 'BZZ' ? '节点' : 'T' }}</view>
- </view>
- <view class="info-item">
- <view class="tit">周期</view>
- <view class="val">{{ ls.first_step_time + ls.second_step_time }}天 + {{ ls.third_step_time }}天</view>
- </view>
- </view>
- </view>
- <view class="btn-wrapper">
- <view class="btn">
- 服务费:{{ls.user_service_ratio*1}}%
- <text @click="+ls.lower_service_ratio<= +mList[index].user_service_ratio ? '': set(index,ls,0)" :class="{'black':+ls.lower_service_ratio<= +mList[index].user_service_ratio }">设置</text>
-
- </view>
- <!-- <view class="btn">
- 佣金:{{ls.award_ratio*1}}%
- <text @click="ls.lower_award_ratio*1 < mList[index].award_ratio*1 ? set(index,ls,1):''" :class="{'black':+ls.lower_award_ratio >= +mList[index].award_ratio }">设置</text>
- </view> -->
- </view>
-
- </view>
- <view class="jg" v-if="list.length !== 0"></view>
- <empty v-if="list.length == 0"></empty>
- <uni-popup ref="popup" type="center">
- <view class="wrapper">
- <view class="title">
- 设置{{setType === 0? '服务费比例':'佣金比例'}}
- </view>
- <input type="number" v-model="setVal" :placeholder="placeTitle" class="inp" />
- <view class="btn-wrapper">
- <view class="cansel" @click="close()">取消</view>
- <view class="qr" @click="sub()">确定</view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import { mining, buyMining } from '@/api/calculation.js';
- import {setServiceRatio ,setRatio} from '../../api/set.js'
- import empty from '../../components/empty.vue';
- export default {
- components: {
- empty
- },
- data() {
- return {
- height: 0,
- setType: 0,
- setVal: null,
- list: [],
- mList: [],
- m_service_ratio: 0,
- uid:0,
- max_ratio: 0,
- min_ratio: 0,
- item: {}
- };
- },
- computed: {
- placeTitle() {
- return `可设置比例为${this.min_ratio}%~${this.max_ratio}%`;
- }
- },
- onReady(res) {
- // var _this = this;
- // uni.getSystemInfo({
- // success: resu => {
- // const query = uni.createSelectorQuery();
- // query.select('.list-cell').boundingClientRect();
- // query.exec(function(res) {
- // console.log(res, 'ddddddddddddd');
- // _this.height = resu.windowHeight - res[0].top + 'px';
- // console.log('打印页面的剩余高度', _this.height);
- // });
- // },
- // fail: res => {}
- // });
- },
- onLoad(opt) {
- if(opt) {
- this.uid = opt.uid
- }
- // uni.showLoading({
- // title: '加载中'
- // })
- this.loadMlist()
-
- },
- methods: {
- set(index,ls,num) {
- console.log(index)
- this.setType = num
- this.item = ls
- if(this.setType === 0) {
- this.min_ratio = +this.mList[index].user_service_ratio
- this.max_ratio = +this.list[index].lower_service_ratio
- console.log(this.min_ratio,this.max_ratio,'5555555555555555555555555')
- if(this.min_ratio === this.max_ratio) {
- this.$api.msg('当前无法设置')
- }else {
- this.$refs.popup.open();
- }
-
- console.log(this.min_ratio,this.max_ratio)
- }else {
- this.min_ratio = +this.list[index].lower_award_ratio
- this.max_ratio = +this.mList[index].award_ratio
- console.log(this.min_ratio,this.max_ratio,'5555555555555555555555555')
- if(this.min_ratio === this.max_ratio) {
- this.$api.msg('当前无法设置')
- }else {
- this.$refs.popup.open();
- }
- }
-
-
- },
- close() {
- this.$refs.popup.close();
- this.setVal = null;
- },
- sub() {
- console.log();
- this.$refs.popup.close();
- if(this.setType === 0){
- setServiceRatio(this.uid,{
- ratio: this.setVal,
- mid: this.item.id
- }).then(res => {
- this.$api.msg(res.msg)
- this.loadData()
- })
- }else {
- setRatio(this.uid,{
- ratio: this.setVal,
- mid: this.item.id
- }).then(res => {
- this.$api.msg(res.msg)
- this.loadData()
- })
- }
- this.setVal = null
-
-
-
- },
- loadData() {
- mining({
- uid: this.uid,
- page: 1,
- limit: 1000
- }).then(({ data }) => {
- this.list = data.data;
- // uni.hideLoading()
- console.log(this.list, '88888888888888');
- });
- },
- loadMlist() {
- mining({
- // uid: this.uid,
- page: 1,
- limit: 1000
- }).then(({ data }) => {
- this.mList = data.data;
- console.log(this.mList, '999999999999999999999999999999999999');
- this.loadData();
- });
- }
-
- }
- };
- </script>
- <style lang="scss" scoped>
- page {
- height: 100%;
- // padding-top: 20rpx;
- }
- .rake {
- height: 100%;
- // padding-top: 30rpx;
- }
- .item {
- margin:0 auto 25rpx;
- width: 670rpx;
- // height: 438rpx;
- background: #f7f6fb;
- border-radius: 10rpx;
- box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
- .top {
- // height: 347rpx;
- width: 100%;
- padding: 40rpx 30rpx 0;
- .info-title {
- display: flex;
- image {
- display: inline-block;
- width: 38rpx;
- height: 38rpx;
- margin-left: 10rpx;
- flex-shrink: 0;
- }
- view {
- padding-left: 12rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- }
- }
- .tags {
- padding-top: 20rpx;
- display: flex;
- flex-wrap: wrap;
- .tag {
- display: inline-block;
- padding: 0 20rpx;
- text-align: center;
- line-height: 43rpx;
- background: #e3f6fa;
- border-radius: 22rpx;
- margin: 10rpx 10rpx 0;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #0ec1a1;
- }
- }
- .base-info {
- padding-top: 30rpx;
- display: flex;
- justify-content: space-between;
- // text-align: center;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- padding-bottom: 30rpx;
- }
- .end-time {
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #5771df;
- padding-bottom: 24rpx;
- }
- }
- .btn-wrapper {
- // width: 670rpx;
- height: 95rpx;
- background: #ffffff;
- border-radius: 0px 0px 10rpx 10rpx;
- display: flex;
- justify-content: flex-end;
- // justify-content: space-between;
- align-items: center;
- padding-right: 20rpx;
- .btn {
- // display: flex;
- padding-left: 10rpx;
- text {
-
- display: inline-block;
- width: 108rpx;
- height: 39rpx;
- background: #5771df;
- border: 1rpx solid #5771df;
- box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.1);
- border-radius: 20rpx;
- text-align: center;
- line-height: 35rpx;
- margin-left: 11rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #ffffff;
- }
- .black {
- background-color: #999;
- border-color: #999;
- }
- }
- }
- }
- .list-cell {
- width: 100%;
- height: 100%;
- background-color: #f8f8f8;
- }
- .wrapper {
- width: 549rpx;
- height: 344rpx;
- background: #ffffff;
- border-radius: 14rpx;
- .title {
- text-align: center;
- padding-top: 40rpx;
- font-size: 37rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- }
- .inp {
- display: block;
- margin: 60rpx auto;
- width: 439rpx;
- height: 68rpx;
- background: #f6f6f6;
- border-radius: 10rpx;
- padding-left: 13rpx;
- }
- .btn-wrapper {
- display: flex;
-
- view {
- width: 50%;
- text-align: center;
- }
- .cansel {
- font-size: 37rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- .qr {
- font-size: 37rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #5771df;
- }
- }
- }
- .jg {
- height: 20rpx;
- }
- </style>
|