1
jhzh
2025-06-16 1760942f9204e56032ca93ff1b720bbf966dd495
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<template>
     <view class="layout-page bg-panel-1" :style="themeStyle">
         <v-header :title="$t('common.c10')" ></v-header>
         <view class="layout-main">
             <view class="w-12/12 m-t-xs">
                <view class=" m-md p-md d-flex rounded bg-panel-3 box-shadow">
                    <view class="flex-fill">{{$t('common.c11')}} </view>
                    <view class="color-light"> <span class="fn-lg color-light"> {{miningInfo.kj_name}}</span></view>
                </view>        
            </view>    
                <view class="w-12/12 m-t-xs">
                    <view class=" m-md p-md d-flex rounded bg-panel-3 box-shadow">
                        <view class="flex-fill">{{$t('common.c7')}} </view>
                        <view class="color-light"> <span class="fn-lg color-light">  {{miningInfo.annualized_rate}}%</span></view>
                    </view>        
                </view>    
                <view class="w-12/12 m-t-xs">
                    <view class=" m-md p-md d-flex rounded bg-panel-3 box-shadow">
                        <view class="flex-fill">{{$t('common.c8')}} </view>
                        <view class="color-light"> <span class="fn-lg color-light">  {{miningInfo.cycle}}</span></view>
                    </view>        
                </view>    
                <view class="w-12/12 m-t-xs">
                    <view class=" m-md p-md d-flex rounded bg-panel-3 box-shadow">
                        <view class="flex-fill">{{$t('common.c13')}} :</view>
                        <view class="color-light"> <span class="fn-lg color-light" style="display: flex;">  <input style="font-size: 14px;width:80px;" type="number" :min="miningInfo.amount" class="send-input t-28 "  maxlength="200" v-model="amount">{{miningInfo.coin_name}}</span></view>
                    </view>        
                </view>    
                <view class="w-12/12 m-t-xs">
                    <view class=" m-md p-md d-flex rounded bg-panel-3 box-shadow">
                        <view class="flex-fill">{{$t('common.c14')}} </view>
                        <view class="color-light">{{miningInfo.coink_name}}</view>
                    </view>        
                </view>    
             <view class="w-10/12 m-x-auto m-t-xl">
             <v-button  block class="w-max m-y-md rounded-xs" type="red"  @click="buyMining()">{{$t("common.c10")}}</v-button>
             </view>
         </view>
    </view>
</template>
 
<script>
    import Mining from "@/api/mining.js";
    import { mapState, mapActions,mapGetters } from "vuex";
    export default {
          name: "index",
            data() {
                return{
                    miningId: uni.getStorageSync('k_id'),
                    miningInfo:"",
                    amount:'',
                }
            },
            computed: {
              ...mapGetters(['themeStyle'])
            },
            created(){
                 //this.getMining();
            },
            mounted() {
                this.$nextTick(function(){
                    this.miningId = uni.getStorageSync('k_id')
                     this.getMining()            
                })
            },
            methods:{
                buyMining(){
                    let data2 ={
                        id:this.miningId,
                        amount:this.amount
                    }
                    Mining.buyMining(data2).then((res)=>{
                        if(res.code==0){
                            this.$toast(res.msg);
                            return;
                        }else if(res.code==200){
                            this.$toast(res.message);
                            setTimeout(() => {
                                this.$router.push('/pages/mining/myMining')
                            }, 1000)        
                        }
                    })
                },
                getMining(){
                    let data1 ={
                        id:this.miningId,
                    }
                //    console.log(data1);
                    Mining.getMining(data1).then((res1)=>{
                    //    console.log(res1.data);
                                if(res1.code==200){
                                    this.miningInfo = res1.data;
                                }
                    });
                    
                },
            },
    }
</script>
 
<style>
</style>