Răsfoiți Sursa

收益列表功能完成

BF-202210271038\Administrator 3 ani în urmă
părinte
comite
2876e29266

+ 2 - 0
api/contract.js

@@ -4,4 +4,6 @@ const commonUrl = '/api/contract/'
 // 获取sts
 export const getInvestData = (data) => request(commonUrl + 'invest', 'post', { ...data })
 export const setInvest = (data) => request(commonUrl + 'add-invest', 'post', { ...data })
+export const getEarnings = (data) => request(commonUrl + 'earnings', 'post', { ...data })
+export const getContractList = (data) => request(commonUrl + 'contracts', 'post', { ...data })
 

+ 1 - 1
components/en-list/en-list.vue

@@ -5,7 +5,7 @@
       <scroll-view class="scroll-list" scroll-y="true" style="height: 100%;" @scrolltolower="onReachScollBottom"
                    :scroll-top="scrollTop" @scroll="scroll">
         <slot name="listInfo" v-bind:pagingData="list"></slot>
-        <view class="toMore" v-show="isAjax">加载中-----</view>
+        <view class="toMore" v-show="isAjax">{{$t('list.load')}}-----</view>
       </scroll-view>
     </view>
 

+ 1 - 2
locale/zh-Hans.json

@@ -27,8 +27,7 @@
 	"index.contract.money": "可用余额",
 	"index.contract.word": "阅读文档",
 
-
-
+	"list.load": "加载中",
 
 	"index.error.quit": "刷新",
 	"index.error.errorMsg": "出错啦!",

+ 151 - 0
pages/index/components/earning-list.vue

@@ -0,0 +1,151 @@
+<template>
+  <view class="earning-box">
+    <en-list ref="earningObj" @getList="getList">
+      <template v-slot:listInfo="{pagingData}">
+        <view class="earning-list">
+          <view v-for="item in pagingData" class="item">
+            <view class="list-item">
+              <view class="item-line">
+                <view class="item-text">BNB</view>
+              </view>
+              <view class="item-line line-text">
+                <view class="item-text">{{$t('index.index.list.item.title')}}</view>
+              </view>
+              <view class="item-line" v-if="item.hash">
+                <view class="item-text">Hash</view>
+                <view class="item-text text-hash">
+                  {{item.hash}}
+                </view>
+              </view>
+              <view class="item-line" v-if="item.nbn_money>0">
+                <view class="item-text">BNB Number</view>
+                <view class="item-text text-two">
+                  <view class="text-img">
+                    <image src="@/static/img/index/bnb2.png"></image>
+                  </view>
+                  <view class="text">{{(item.nbn_money).toFixed(6)}}</view>
+                </view>
+              </view>
+              <view class="item-line" v-if="item.db_money>0">
+                <view class="item-text">{{$t('index.index.list.item.integral')}}</view>
+                <view class="item-text text-two">
+                  <view class="text-img">
+                    <image src="@/static/img/index/jf.svg"></image>
+                  </view>
+                  <view class="text">{{(item.db_money).toFixed(6)}}</view>
+                </view>
+              </view>
+              <view class="item-line">
+                <view class="item-text">{{$t('index.index.list.item.service')}}</view>
+                <view class="item-text">{{(item.service_money).toFixed(6)}}</view>
+              </view>
+              <view class="item-line">
+                <view class="item-text">{{$t('index.index.list.item.date')}}</view>
+                <view class="item-text">{{item.created_at}}</view>
+              </view>
+            </view>
+            <division class="division-item"></division>
+          </view>
+        </view>
+      </template>
+    </en-list>
+  </view>
+</template>
+
+<script>
+import EnList from "@/components/en-list/en-list";
+import {getEarnings} from "@/api/contract";
+import Division from "@/pages/index/components/division";
+
+export default {
+  name: "earning-list",
+  components: {Division, EnList},
+  props: {},
+  data() {
+    return {}
+  },
+  watch: {},
+  mounted() {
+
+  },
+  methods: {
+    getList(page) {
+      getEarnings({'page': page}).then((res) => {
+        if (res.code === 1) {
+          this.$refs.earningObj.setList(res.data.items, res.data.total)
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.earning-box {
+  .earning-list {
+    .list-item {
+      margin-top: 20rpx;
+
+      .item-line {
+        margin-bottom: 20rpx;
+        display: flex;
+        justify-content: space-between;
+
+        .item-text {
+          font-size: 26rpx;
+          color: rgb(177, 177, 177);
+          line-height: 42rpx;
+          height: 42rpx;
+        }
+        .text-hash{
+          max-width: 200rpx;
+          overflow-x:hidden;
+          text-overflow: ellipsis;
+        }
+
+        .text-two {
+          display: flex;
+          justify-content: right;
+
+          .text-img {
+            display: inline-block;
+            padding: 6rpx;
+            background: rgb(0, 87, 255);
+            border-radius: 50%;
+            height: 42rpx;
+            width: 42rpx;
+            box-sizing: border-box;
+
+            image {
+              width: 30rpx;
+              height: 30rpx;
+              z-index: 100;
+            }
+          }
+
+          .text {
+            margin-left: 10rpx;
+            font-size: 30rpx;
+          }
+        }
+      }
+
+      .line-text {
+        margin-bottom: 40rpx;
+
+        .item-text {
+          font-weight: bold;
+          font-size: 26rpx;
+          color: #222;
+        }
+      }
+    }
+    .item:last-child {
+      .division-item {
+        display: none;
+      }
+    }
+  }
+}
+
+</style>

+ 3 - 95
pages/index/index.vue

@@ -25,43 +25,7 @@
         <view class="title-text">{{$t('index.index.list.title')}}(100)</view>
       </view>
       <division></division>
-      <view v-for="i in 5" class="item">
-        <view class="list-item">
-          <view class="item-line">
-            <view class="item-text">BNB</view>
-          </view>
-          <view class="item-line line-text">
-            <view class="item-text">{{$t('index.index.list.item.title')}}</view>
-          </view>
-          <view class="item-line">
-            <view class="item-text">BNB Number</view>
-            <view class="item-text text-two">
-              <view class="text-img">
-                <image src="@/static/img/index/bnb2.png"></image>
-              </view>
-              <view class="text">56</view>
-            </view>
-          </view>
-          <view class="item-line">
-            <view class="item-text">{{$t('index.index.list.item.integral')}}</view>
-            <view class="item-text text-two">
-              <view class="text-img">
-                <image src="@/static/img/index/jf.svg"></image>
-              </view>
-              <view class="text">56</view>
-            </view>
-          </view>
-          <view class="item-line">
-            <view class="item-text">{{$t('index.index.list.item.service')}}</view>
-            <view class="item-text">56</view>
-          </view>
-          <view class="item-line">
-            <view class="item-text">{{$t('index.index.list.item.date')}}</view>
-            <view class="item-text">56</view>
-          </view>
-        </view>
-        <division class="division-item"></division>
-      </view>
+      <earning-list></earning-list>
 
     </view>
     <view class="index-bottom"></view>
@@ -75,9 +39,10 @@ import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
 import {getMemberInfo} from "@/api/member";
 import Division from "@/pages/index/components/division";
 import TopHead from "@/pages/index/components/top-head";
+import EarningList from "@/pages/index/components/earning-list";
 
 export default {
-  components: {TopHead,  Division},
+  components: {EarningList, TopHead,  Division},
   data() {
     return {
       applicationLocale: '',
@@ -362,64 +327,7 @@ export default {
       }
     }
 
-    .list-item {
-      margin-top: 20rpx;
-
-      .item-line {
-        margin-bottom: 20rpx;
-        display: flex;
-        justify-content: space-between;
-
-        .item-text {
-          font-size: 26rpx;
-          color: rgb(177, 177, 177);
-          line-height: 42rpx;
-          height: 42rpx;
-        }
-
-        .text-two {
-          display: flex;
-          justify-content: right;
-
-          .text-img {
-            display: inline-block;
-            padding: 6rpx;
-            background: rgb(0, 87, 255);
-            border-radius: 50%;
-            height: 42rpx;
-            width: 42rpx;
-            box-sizing: border-box;
-
-            image {
-              width: 30rpx;
-              height: 30rpx;
-              z-index: 100;
-            }
-          }
 
-          .text {
-            margin-left: 10rpx;
-            font-size: 30rpx;
-          }
-        }
-      }
-
-      .line-text {
-        margin-bottom: 40rpx;
-
-        .item-text {
-          font-weight: bold;
-          font-size: 26rpx;
-          color: #222;
-        }
-      }
-    }
-
-    .item:last-child {
-      .division-item {
-        display: none;
-      }
-    }
   }
 
   .index-bottom {