<template>
|
<div class="wrapper">
|
<van-nav-bar
|
:title="($t('yeb'))"
|
:right-text="($t('jl'))"
|
left-arrow
|
fixed
|
@click-left="handleBackClick"
|
@click-right="go_yebs"
|
/>
|
<div class="main">
|
<div class="ul" v-for="(item, i) in $store.state.yebinfo" :key="i + '_' + item.id">
|
<div class="li">
|
<div class="li-left">
|
<h3>{{ item.title }}</h3>
|
<div class="li-cont">
|
<div class="li-info li-1">
|
<span class="li-label">{{ $t('zq') + ':' }}</span>
|
<span class="li-value">{{ item.returnTime }} {{ $t('day') }}</span>
|
</div>
|
<div class="li-info">
|
<span class="li-label">{{ $t('ll') + ':' }}</span>
|
<span class="li-value">{{ item.returnOfRate }}%</span>
|
</div>
|
</div>
|
</div>
|
<div class="li-btn-box">
|
<div class="btn" @click="handlePurchase(i)">{{ $t('gm') }}</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<van-dialog
|
width="90%"
|
v-model="showPurchase"
|
:title="$t('yeb') + $t('gm')" show-cancel-button
|
:confirmButtonText="$t('qr')"
|
:cancelButtonText="$t('qx')"
|
@confirm="tosubmit(1,form.account1)"
|
>
|
<div class="dialog-box">
|
<van-field
|
v-model="$store.state.userInfo.enableAmt"
|
type="text"
|
:label="$t('ky') + $t('ye')"
|
:placeholder="$t('ky') + $t('ye')"
|
readonly
|
:border="false"
|
/>
|
<van-field
|
v-model="form.account1"
|
type="number"
|
name="amt"
|
:label="$t('gm') + $t('sl')"
|
:placeholder="$t('gm') + $t('sl')"
|
:border="false"
|
>
|
<template #button>
|
<span @click="selectAll1">{{ $t('hj160') }}</span>
|
</template>
|
</van-field>
|
<!-- <mt-field :label="'可用余额'" :placeholder="'可用余额'" type="text" disabled v-model="this.$store.state.userInfo.enableAmt" /> -->
|
<!-- <mt-field :label="'购买数量'" name="amt" v-model="form.account1" :placeholder="'购买数量'" type="number">
|
<span @click="selectAll1">{{ $t('hj160') }}</span>
|
</mt-field> -->
|
</div>
|
</van-dialog>
|
<!-- <mt-navbar v-model="selected" class="custom-navbar" >
|
<mt-tab-item id="1" class="warehouse_card" >
|
周期:{{ this.$store.state.yebinfo[0].returnTime }}<br>
|
利率:{{ this.$store.state.yebinfo[0].returnOfRate }}%
|
|
</mt-tab-item>
|
<hr>
|
<mt-tab-item id="2" class="warehouse_card">
|
周期:{{ this.$store.state.yebinfo[1].returnTime }}<br>
|
利率:{{ this.$store.state.yebinfo[1].returnOfRate }}%
|
</mt-tab-item>
|
<mt-tab-item id="3" class="warehouse_card">
|
周期:{{ this.$store.state.yebinfo[2].returnTime }}<br>
|
利率:{{ this.$store.state.yebinfo[2].returnOfRate }}%
|
</mt-tab-item>
|
<mt-tab-item id="4" class="warehouse_card">
|
周期:{{ this.$store.state.yebinfo[3].returnTime }}<br>
|
利率:{{ this.$store.state.yebinfo[3].returnOfRate }}%
|
</mt-tab-item>
|
</mt-navbar> -->
|
<!-- <mt-tab-container class="order-list" v-model="selected">
|
<mt-tab-container-item id="1">
|
<div class="form-block">
|
<mt-field :label="'可用余额'" :placeholder="'可用余额'" type="text" disabled
|
v-model="this.$store.state.userInfo.enableAmt">
|
</mt-field>
|
</div>
|
<div class="form-block">
|
<mt-field :label="'购买数量'" name="amt" v-model="form.account1" :placeholder="'购买数量'" type="number">
|
<span @click="selectAll1">{{ $t('hj160') }}</span>
|
</mt-field>
|
</div> -->
|
<!-- <div class="form-block">
|
<mt-field label="资金密码" placeholder="资金密码" type="password" v-model="form.password"></mt-field>
|
</div>
|
<p class="prompt">资金密码默认为登录密码</p> -->
|
<!-- <div class="btnbox">
|
<span class="text-center btnok loginout" @click="tosubmit(1,form.account1)">购买余额宝</span>
|
</div>
|
</mt-tab-container-item>
|
<mt-tab-container-item id="2">
|
<div class="form-block">
|
<mt-field :label="'可用余额'" :placeholder="'可用余额'" type="text" disabled
|
v-model="this.$store.state.userInfo.enableAmt">
|
</mt-field>
|
</div>
|
<div class="form-block">
|
<mt-field :label="'购买数量'" name="amt" v-model="form.account1" :placeholder="'购买数量'" type="number">
|
<span @click="selectAll1">{{ $t('hj160') }}</span>
|
</mt-field>
|
</div> -->
|
<!-- <div class="form-block">
|
<mt-field label="资金密码" placeholder="资金密码" type="password" v-model="form.password"></mt-field>
|
</div>
|
<p class="prompt">资金密码默认为登录密码</p> -->
|
<!-- <div class="btnbox">
|
<span class="text-center btnok loginout" @click="tosubmit(2,form.account1)">购买余额宝</span>
|
</div>
|
</mt-tab-container-item>
|
<mt-tab-container-item id="3">
|
<div class="form-block">
|
<mt-field :label="'可用余额'" :placeholder="'可用余额'" type="text" disabled
|
v-model="this.$store.state.userInfo.enableAmt">
|
</mt-field>
|
</div>
|
<div class="form-block">
|
<mt-field :label="'购买数量'" name="amt" v-model="form.account1" :placeholder="'购买数量'" type="number">
|
<span @click="selectAll1">{{ $t('hj160') }}</span>
|
</mt-field>
|
</div> -->
|
<!-- <div class="form-block">
|
<mt-field label="资金密码" placeholder="资金密码" type="password" v-model="form.password"></mt-field>
|
</div>
|
<p class="prompt">资金密码默认为登录密码</p> -->
|
<!-- <div class="btnbox">
|
<span class="text-center btnok loginout" @click="tosubmit(3,form.account1)">购买余额宝</span>
|
</div>
|
</mt-tab-container-item>
|
<mt-tab-container-item id="4">
|
<div class="form-block">
|
<mt-field :label="'可用余额'" :placeholder="'可用余额'" type="text" disabled
|
v-model="this.$store.state.userInfo.enableAmt">
|
</mt-field>
|
</div>
|
<div class="form-block">
|
<mt-field :label="'购买数量'" name="amt" v-model="form.account1" :placeholder="'购买数量'" type="number">
|
<span @click="selectAll1">{{ $t('hj160') }}</span>
|
</mt-field>
|
</div> -->
|
<!-- <div class="form-block">
|
<mt-field label="资金密码" placeholder="资金密码" type="password" v-model="form.password"></mt-field>
|
</div>
|
<p class="prompt">资金密码默认为登录密码</p> -->
|
<!-- <div class="btnbox">
|
<span class="text-center btnok loginout" @click="tosubmit(4)">购买余额宝</span>
|
</div>
|
</mt-tab-container-item>
|
</mt-tab-container> -->
|
</div>
|
</template>
|
|
<script>
|
// import '@/assets/style/common.less'
|
import * as api from '@/axios/api'
|
import { Toast } from 'mint-ui'
|
// import { getYebs } from '@/axios/api'
|
|
export default {
|
components: {
|
},
|
data () {
|
return {
|
selected: '1', // 选中
|
typeindex:'',
|
form: {
|
account1: '',
|
account2: '',
|
account3: '',
|
account4: '',
|
password: ''
|
},
|
userInfo: {
|
realName: ''
|
},
|
yebinfo: [],
|
showPurchase: false
|
}
|
},
|
watch: {},
|
computed: {},
|
created () {
|
this.getProductSetting()
|
},
|
mounted () {
|
if (this.$route.query.type) {
|
this.selected = this.$route.query.type + ''
|
}
|
this.getUserInfo()
|
this.getYebInfo()
|
},
|
methods: {
|
// 购买弹窗控制
|
handlePurchase (e) {
|
console.log(e);
|
this.typeindex = e+1
|
this.showPurchase = true
|
},
|
go_yebs () {
|
this.$router.push('/yebs')
|
},
|
async getProductSetting () {
|
let data = await api.getProductSetting()
|
console.log(data)
|
if (data.status === 0) {
|
this.$store.state.settingForm = data.data
|
if (!this.$store.state.settingForm.indexDisplay) {
|
this.selected = '3'
|
}
|
} else {
|
this.$message.error(data.msg)
|
}
|
},
|
handleBackClick () {
|
this.$router.go(-1)
|
},
|
selectAll1 () {
|
// 选择全部
|
this.form.account1 = this.$store.state.userInfo.enableAmt
|
},
|
selectAll2 () {
|
// 选择全部
|
this.form.account2 = this.$store.state.userInfo.enableIndexAmt
|
},
|
selectAll3 () {
|
// 选择全部
|
this.form.account3 = this.$store.state.userInfo.enableAmt
|
},
|
selectAll4 () {
|
// 选择全部
|
this.form.account4 = this.$store.state.userInfo.enableFuturesAmt
|
},
|
isInteger (obj) {
|
return obj % 1 === 0
|
},
|
async tosubmit (id, money) {
|
if (!this.isInteger(money)) {
|
Toast('请输入整数')
|
return
|
}
|
// 融资转指数
|
let opt = {
|
// amt: this.selected === '1' ? this.form.account1 : this.selected === '2' ? this.form.account2 : this.selected === '3' ? this.form.account3 : this.form.account4,
|
// type: this.selected // 1 融资转指数 2 指数转融资
|
eId: this.typeindex,
|
money: money
|
}
|
let data1 = await api.BuyYeb(opt)
|
|
if (data1.status === 0) {
|
Toast(data1.data)
|
this.$router.push('/yebs')
|
} else {
|
Toast(data1.data)
|
}
|
},
|
async getUserInfo () {
|
// 获取用户信息
|
let data = await api.getUserInfo()
|
if (data.status === 0) {
|
this.$store.state.userInfo = data.data
|
} else {
|
Toast(data.msg)
|
}
|
},
|
async getYebInfo () {
|
// 获取用户信息
|
let data = await api.getYebInfo()
|
|
if (data.status === 0) {
|
this.$store.state.yebinfo = data.data
|
} else {
|
Toast(data.msg)
|
}
|
}
|
}
|
}
|
</script>
|
<style lang="less" scoped>
|
/deep/ .van-nav-bar {
|
height: 64px !important;
|
background: linear-gradient(to bottom, #45acff, #287df5);
|
.van-nav-bar__content {
|
height: 64px !important;
|
}
|
.van-nav-bar__title, .van-nav-bar__text {
|
color: #FFFFFF;
|
font-size: 24px;
|
}
|
.van-icon {
|
color: #FFFFFF;
|
font-size: 24px;
|
}
|
}
|
.wrapper {
|
width: 100%;
|
height: 100%;
|
background: #f1f2f6;
|
.main {
|
margin-top: 64px;
|
height: calc(100% - 84px);
|
overflow-y: auto;
|
.ul {
|
margin: 15px;
|
padding: 20px;
|
border: 1px solid #EEEEEE;
|
background: #FFFFFF;
|
border-radius: 8px;
|
.li {
|
font-size: 18px;
|
display: flex;
|
justify-content: space-between;
|
.li-left {
|
h3 {
|
display: flex;
|
padding-bottom: 20px;
|
}
|
.li-cont {
|
display: flex;
|
.li-1 {
|
margin-right: 20px;
|
}
|
}
|
}
|
.li-btn-box {
|
display: flex;
|
align-items: center;
|
.btn {
|
color: #287df5;
|
font-size: 18px;
|
}
|
}
|
}
|
}
|
}
|
}
|
/deep/ .van-dialog__header {
|
font-size: 24px;
|
margin-bottom: 15px;
|
}
|
.dialog-box {
|
padding: 10px;
|
margin: 20px 0;
|
// background: rgb(245, 245, 245);
|
.van-field {
|
font-size: 18px;
|
color: #666666;
|
margin-top: 20px;
|
}
|
}
|
</style>
|