10.10综合交易所原始源码_移动端
admin
2026-01-06 42faef34194c466f03e29d75a63ae502e4213044
src/views/cryptos/loan/index.vue
@@ -1,7 +1,7 @@
<template>
  <div id="loanPage">
    <div class="loan">
      <assets-head :title="$t('信用贷')">
      <assets-head :title="$t('助力贷')">
        <div class="right flex items-center">
          <img src="@/assets/image/loan/rule.png" alt="rule-img" class="w-12 h-12 mr-5"
            @click="$router.push('/cryptos/loanRule')" />
@@ -20,62 +20,36 @@
        </div>
        <!--    list  -->
        <div class="loanList">
          <div class="flex justify-between py-8 border-b-color" @click="showCurrencyPicker = true">
            <div>
              <span class="grayText">{{ $t("货币选择") }}</span>
            </div>
            <div class="flex align-center items-center">
              <span class="font-semibold textColor mr-2">{{ currencyAct.name1 || $t("请选择货币") }}</span>
              <div class="w-6 h-6">
                <img src="@/assets/image/loan/right.png" alt="right-img" class="w-full" />
              </div>
            </div>
          </div>
          <div class="flex justify-between py-8 border-b-color">
            <div>
              <span class="grayText">{{ $t("期望借款金额") }}</span>
            </div>
            <div class="flex align-center">
              <!-- <input class="font-semibold textColor border-none text-right mr-14 mainBackground" v-model="loanAmount"
                disabled="disabled" @input="inputAmunt" /> -->
              <input class="font-semibold textColor border-none text-right mainBackground" v-model="loanAmount"
                @input="inputAmunt" />
              <!-- <span class="mr-4 font-semibold textColor">{{ loanData.max_quota || 0 }}</span> -->
              <span class="font-semibold textColor ml-2">{{ currencyAct.currency_symbol }}</span>
              <!--            <input class="font-semibold textColor border-none text-right mr-14 mainBackground" v-model="loanAmount"  disabled="disabled" @input="inputAmunt" />-->
              <span class="mr-4 font-semibold textColor">{{ loanData.max_quota || 0 }}</span>
              <span class="font-semibold textColor"></span>
            </div>
          </div>
          <!-- <div class="flex justify-between py-8 border-b-color">
          <div class="flex justify-between py-8 border-b-color">
            <div>
              <span class="grayText">{{ $t("还款周期") }}</span>
            </div>
            <div class="flex items-center">
              <!--            <div class="font-semibold textColor relative">-->
              <div class="font-semibold mr-4 textColor relative" @click="isSelectDay = !isSelectDay">
                <span>{{ loanData.term }} {{ $t("天") }}</span>
                <!--              <div class="selectDay"  v-show="isSelectDay">-->
                <!--                <div class="mb-20 border-b-white" v-for="(s,index) in selectDayList" :key="index"  @click="selectDay(s)">-->
                <!--                  <span>{{s}}</span>-->
                <!--                </div>-->
                <!--              </div>-->
              </div>
              <div class="w-6 h-6">
                <img src="@/assets/image/loan/right.png" alt="right-img" class="w-full" />
              </div>
            </div>
          </div> -->
          <div class="flex justify-between py-8 border-b-color">
            <div>
              <span class="grayText">{{ $t("最大可借") }}</span>
            </div>
            <div class="flex align-center">
              <span class="font-semibold textColor">
                {{ userInfo.loanLimit * currencyAct.rate }} {{ currencyAct.currency_symbol }}
              </span>
            </div>
          </div>
          <div class="flex justify-between py-8 border-b-color">
            <div>
              <span class="grayText">{{ $t("最小可借") }}</span>
            </div>
            <div class="flex align-center">
              <span class="font-semibold textColor">100 {{ currencyAct.currency_symbol }}</span>
            </div>
          </div>
          <!-- <div class="flex justify-between py-8 border-b-color">
            <div>
              <span class="grayText">{{ $t("日利率") }}</span>
            </div>
@@ -83,7 +57,7 @@
              <span class="font-semibold textColor">{{ loanData.daily_rate * 1 * 100 || 0 }}%
              </span>
            </div>
          </div> -->
          </div>
          <div class="flex justify-between py-8 border-b-color">
            <div>
              <span class="grayText">{{ $t("还款方式") }}</span>
@@ -97,30 +71,34 @@
              <span class="grayText">{{ $t("利息") }}</span>
            </div>
            <div class="flex align-center">
              <span class="font-semibold textColor">
                {{ +loanAmount * +this.userInfo.loanRate || 0 }} {{
                  currencyAct.currency_symbol }}
              </span>
              <!--            借款金额*日利率*借款天数-->
              <!-- <span class="font-semibold textColor">{{$bigDecimal.multiply(+loanData.maxQuota , +loanData.dailyRate) * +this.loanData.term || 0 }} USDT</span> -->
              <span class="font-semibold textColor">{{
                (+loanData.max_quota, +loanData.daily_rate) * +this.loanData.term || 0
              }}
                </span>
            </div>
          </div>
          <!-- <div class="flex justify-between py-8 border-b-color">
          <div class="flex justify-between py-8 border-b-color">
            <div>
              <span class="grayText">{{ $t("放款机构") }}</span>
            </div>
            <div class="flex align-center">
              <span class="font-semibold textColor">{{ loanData.lending_name }}</span>
            </div>
          </div> -->
          </div>
        </div>
        <!--      上传区域-->
        <div class="uploadImg">
          <!-- <div class="mb-10 textColor">
          <div class="mb-10 textColor">
            <span>{{ $t("信用放款(请确保图片清晰可见)") }}</span>
          </div> -->
          </div>
          <div class="upload">
            <!-- <div class="flex mt-8 mb-16 justify-between">
            <div class="flex mt-8 mb-16 justify-between">
              <div class="flex-1 flex flex-col text-center justify-center items-center">
                <div class="upload-wrap">
                  <!--                    <img src="@/assets/image/kyc/0.png" alt="" class="w-full"-->
                  <!--                         v-if="[1, 2].includes(status) && frontFile.length === 0" />-->
                  <van-uploader v-model="frontFile" :max-count="1" :disabled="isUpload" :after-read="afterRead"
                    @click-upload="onClickUpload('frontFile')" />
                </div>
@@ -130,6 +108,8 @@
              </div>
              <div class="flex-1 flex flex-col text-center justify-center items-center">
                <div class="upload-wrap">
                  <!--                    <img src="@/assets/image/kyc/1.png" alt="" class="w-full"-->
                  <!--                         v-if="[1, 2].includes(status) && reverseFile.length === 0" />-->
                  <van-uploader v-model="reverseFile" :max-count="1" :disabled="isUpload" :after-read="afterRead"
                    @click-upload="onClickUpload('reverseFile')" />
                </div>
@@ -137,10 +117,12 @@
                  {{ $t("证件反面") }}
                </div>
              </div>
            </div> -->
            <!-- <div class="flex mt-8 mb-16 justify-between">
            </div>
            <div class="flex mt-8 mb-16 justify-between">
              <div class="flex-1 flex flex-col text-center justify-center items-center">
                <div class="upload-wrap">
                  <!--                    <img src="@/assets/image/kyc/2.png" alt="" class="w-full"-->
                  <!--                         v-if="[1, 2].includes(status) && fileList.length === 0" />-->
                  <van-uploader v-model="fileList" :max-count="1" :disabled="isUpload" :after-read="afterRead"
                    @click-upload="onClickUpload('fileList')" />
                </div>
@@ -156,7 +138,7 @@
                  {{ $t("拍摄示例") }}
                </div>
              </div>
            </div> -->
            </div>
          </div>
        </div>
@@ -172,24 +154,6 @@
          </li>
        </ul>
      </van-popup>
      <!-- 货币选择弹窗 -->
      <van-popup v-model:show="showCurrencyPicker" position="bottom" :round="true">
        <div class="currency-picker">
          <div class="picker-header text-center py-8 border-b-color">
            <span class="font-semibold textColor">{{ $t("货币选择") }}</span>
          </div>
          <ul class="main2_background">
            <li v-for="(item, index) in currencyList" :key="index"
              class="flex justify-between items-center py-8 px-8 border-b-color" @click="selectCurrency(item)">
              <div class="flex items-center">
                <span class="font-semibold textColor">{{ item.name1 }}</span>
              </div>
              <img v-if="currencyAct.currency === item.currency" class="w-12 h-12"
                src="../../../assets/image/public/checked.png" />
            </li>
          </ul>
        </div>
      </van-popup>
    </div>
  </div>
</template>
@@ -197,11 +161,8 @@
<script>
import AssetsHead from "@/components/Transform/assets-head/index.vue";
import { Popup, Uploader } from "vant";
import { _getExchangeRate } from "@/service/home.api";
import { _getLoan, _loanApply } from "@/service/fund.api";
import { _getIdentify, _info, _exchangerateuserconfiglist } from "@/service/user.api.js";
import { _uploadImage } from "@/service/upload.api.js";
import { _exchangerateuserconfig } from "@/service/trade.api";
import { showToast } from "vant";
// import {debounce} from "@/utils/utis";
@@ -224,31 +185,24 @@
    },
    submit() {
      // console.log('this.frontFile',this.frontFile)
      // if (!this.frontFile.length || !this.reverseFile.length || !this.fileList.length) {
      // if (!this.frontFile.length || !this.reverseFile.length) {
      //   showToast(this.$t("请上传完整证件信息"));
      //   return;
      // }
      if (this.loanAmount > this.userInfo.loanLimit * this.currencyAct.rate || this.loanAmount < 100) {
        showToast(this.$t("借款金额不符合可借区间"));
      if (!this.frontFile.length || !this.reverseFile.length || !this.fileList.length) {
        showToast(this.$t("请上传完整证件信息"));
        return;
      }
      console.log(this.loanData);
      _loanApply({
        // ...this.loanData,
        // term: this.loanData.term,
        // quota: this.loanData.max_quota, //借贷金额 取max
        quota: this.loanAmount, //借贷金额 取max
        // dailyRate: this.loanData.daily_rate,
        // lendingInstitution: this.loanData.lending_institution, //放款机构名字
        // lendingName: this.loanData.lending_name,
        // repayment: this.loanData.repayment, //还款方式
        // repayCycle: this.loanData.repay_cycle, //还款日期
        symbol: this.currencyAct.currency.toLowerCase(),
        // frontFile: this.frontFile[0].resURL,
        // reverseFile: this.reverseFile[0].resURL,
        // fileList: this.fileList[0].resURL,
        term: this.loanData.term,
        quota: this.loanData.max_quota, //借贷金额 取max
        dailyRate: this.loanData.daily_rate,
        lendingInstitution: this.loanData.lending_institution, //放款机构名字
        lendingName: this.loanData.lending_name,
        repayment: this.loanData.repayment, //还款方式
        repayCycle: this.loanData.repay_cycle, //还款日期
        symbol: "USDT",
        frontFile: this.frontFile[0].resURL,
        reverseFile: this.reverseFile[0].resURL,
        fileList: this.fileList[0].resURL,
      })
        .then((res) => {
          // console.log('res',res)
@@ -258,38 +212,11 @@
          showToast(this.$t(err.msg));
        });
    },
    // 获取汇率列表
    ExchangeRate() {
      _exchangerateuserconfiglist().then(res => {
        this.exchangeRate = res || []
        this.initCurrencyList() // 初始化货币列表
      })
    },
    // 初始化货币列表(本地写死)
    initCurrencyList() {
      const currencies = {
        name1: 'USD',
        currency: "USDT",
        currency_symbol: "$",
        name: "美元",
        rate: 1
      }
      // this.exchangeRate.name1 = this.exchangeRate.currency
      this.exchangeRate.forEach(item => {
        item.name1 = item.currency
      })
      this.currencyList = [currencies, ...this.exchangeRate]
      this.currencyAct = this.currencyList[0]
    },
    // 选择货币
    selectCurrency(item) {
      this.currencyAct = item
    },
    // //防抖
    inputAmunt() {
      this.loanAmount = this.loanAmount.replace(/[^0-9]/g, '')
      // this.debounceFn()
    },
    // inputAmunt(){
    //   this.loanAmount = this.loanAmount.replace(/[^0-9]/g, '')
    //   this.debounceFn()
    // },
    // debounceFn: debounce(function () {
    //   this.getInterest()
    // }, 500),
@@ -324,16 +251,9 @@
          this.isUpload = false;
        });
    },
    getUserInfo() {
      _info().then(res => {
        this.userInfo = res
      })
    }
  },
  mounted() {
    // this.getLoan(); // 获取借贷信息(目前不需要了)
    this.getUserInfo()
    this.ExchangeRate() // 获取欧元的汇率
    this.getLoan();
    // this.getInterest()
  },
  data() {
@@ -348,12 +268,6 @@
      // status:'',
      isSelectDay: false,
      isUpload: false,
      loanAmount: 0,
      userInfo: {},
      exchangeRate: {},
      showCurrencyPicker: false, // 货币选择弹窗显示状态
      currencyList: [], // 货币列表
      currencyAct: {}
    };
  },
};
@@ -408,22 +322,6 @@
  .grayText {
    color: #868e9b;
  }
  .currency-picker {
    max-height: 70vh;
    overflow-y: auto;
    .picker-header {
      position: sticky;
      top: 0;
      background: $main_background;
      z-index: 1;
    }
    .border-b-color {
      border-bottom: 1px solid $line_color;
    }
  }
}
</style>