11
jhzh
2024-08-01 4ebbadfe4c8c7aa6404dcd9b126cc8265bf03c0d
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<template>
  <div class="pledgeLoanOrder">
    <assets-head
      :title="$t('质押借币订单')"
      :backFunc="() => $router.push('/pledgeLoan')"
    ></assets-head>
    <template v-if="noticeList.length">
      <div
        class="h-100 flex items-center justify-between pl-32 pr-28 mb-40"
        style="color: #f5c425; background: #56481b"
        v-for="(item, index) in noticeList"
        :key="index"
        @click="toOrderDetail(item)"
      >
        <div class="flex font-28">
          <img src="../../assets/image/waring.png" alt="" class="w-36 h-36" />
          <span class="ml-22">{{ $t("有笔订单质押率高于60%有平仓风险") }}</span>
        </div>
        <img src="@/assets/image/warningTo.png" alt="" class="w-32 h-32" />
      </div>
    </template>
    <div class="content px-32">
      <van-list
        v-model="loading"
        :loading-text="$t('加载中...')"
        :finished="finished"
        :finished-text="orderList.length ? $t('已经全部加载完毕') : ''"
        @load="onLoad"
        :offset="130"
      >
        <div
          class="item mb-40 contBackground rounded-lg pl-24 pr-22 pb-30"
          v-for="(item, index) in orderList"
          :key="index"
          @click="toOrderDetail(item.id)"
        >
          <div
            class="flex justify-between border-b-color h-101 box-border text items-center mb-30"
          >
            <div class="textColor">
              <span class="skyColor mr-10">{{ fixStr(item.orderType) }}</span
              >{{ item.loanAmount }}&nbsp;USDT
            </div>
            <div
              :class="{
                redColor: item.state == 3,
                red: item.state == 4,
                'text-grey': item.state == 2,
                skyColor: item.state == 1,
              }"
            >
              {{ fixStatus(item.state) }}
            </div>
          </div>
          <div class="flex">
            <div class="mr-100">
              <div class="text-grey">{{ $t("贷款币种") }}</div>
              <div class="textColor mt-20">
                {{ item.loanCurrency.toUpperCase() }}
              </div>
            </div>
            <div class="mr-100">
              <div class="text-grey">{{ $t("质押率") }}</div>
              <div class="textColor mt-20">
                {{
                  item.pledgeRate !== ""
                    ? ((item.pledgeRate * 10000) / 100).toFixed(2)
                    : "--"
                }}%
              </div>
            </div>
            <div>
              <div class="text-grey">{{ $t("总负债") }}</div>
              <div class="textColor mt-20">
                {{ item.debtAmount }}&nbsp;{{ item.loanCurrency.toUpperCase() }}
              </div>
            </div>
          </div>
        </div>
        <div
          class="flex flex-col justify-center pt-50 pb-20 items-center"
          v-if="!orderList.length && !loading"
        >
          <img
            src="@/assets/image/assets-center/no-data.png"
            alt=""
            class="w-180 h-180"
          />
          <p class="text-grey mt-10">{{ $t("暂无记录") }}</p>
        </div>
      </van-list>
    </div>
  </div>
</template>
 
<script>
import assetsHead from "@/components/assets-head";
import Axios from "@/API/pledgeLoan.js";
import { List } from "vant";
export default {
  props: {},
  components: {
    assetsHead,
    [List.name]: List,
  },
  data() {
    return {
      page: 1,
      orderList: [],
      noticeList: [],
      loading: false,
      finished: false,
    };
  },
 
  methods: {
    onLoad() {
      this.getOrderList();
    },
    toOrderDetail(id) {
      this.$router.push({ path: "/pledgeLoanOrderDetail", query: { id } });
    },
    fixStr(orderType) {
      let str = "";
      if (orderType == 1) {
        str = this.$t("借款");
      } else if (orderType == 2) {
        str = this.$t("新增质押");
      } else if (orderType == 3) {
        str = this.$t("续借");
      } else if (orderType == 4) {
        str = this.$t("还款");
      } else if (orderType == 5) {
        str = this.$t("强平结清");
      }
      return str;
    },
    fixStatus(state) {
      let string = "";
      if (state == 1) {
        string = this.$t("计息中");
      } else if (state == 2) {
        string = this.$t("已结清");
      } else if (state == 3) {
        string = this.$t("强平结清");
      } else if (state == 4) {
        string = this.$t("已逾期");
      }
      return string;
    },
    getOrderList() {
      Axios.orderList({
        page_no: this.page,
      }).then((res) => {
        this.orderList = [...this.orderList, ...res.data.list];
        // console.log(logs)
        this.loading = false;
        if (res.data.list.length < 10) {
          this.finished = true;
        } else {
          this.page++;
        }
        this.noticeList = res.data.noticeList;
      });
    },
  },
};
</script>
 
<style lang="scss" scoped>
.pledgeLoanOrder {
  width: 100%;
  box-sizing: border-box;
}
.skyColor {
  color: #13d3eb;
}
.redColor {
  color: #e35461;
}
.red {
  color: #ff0000;
}
</style>