<template>
|
<div>
|
<van-popup v-model="show" round position="bottom">
|
<div class="boxd">
|
<div class="boxh">
|
{{ $t("hj261") }}
|
<span @click="show = false"></span>
|
</div>
|
<h5>{{ $t("hj130") }}</h5>
|
<h6> ﷼{{ currentItem.nowPrice | _toString }}</h6>
|
<div class="erty tghj">
|
<input
|
:placeholder="$t('hj262')"
|
type="text"
|
:minlength="4"
|
class="inpy"
|
v-model="num"
|
@input="priceinput"
|
/>
|
<a>{{ $t("hj274") }}</a>
|
</div>
|
<p class="plm">
|
<span>{{ $t("hj263") }}</span>
|
<a> ﷼{{ currentItem.nowPrice*num | _toString }}</a>
|
</p>
|
<div class="erty" v-if="currentItem.password">
|
<input
|
:placeholder="$t('hj264')"
|
type="password"
|
class="inpy"
|
v-model="password"
|
/>
|
</div>
|
<p class="plm">
|
<span>
|
{{ $t("hj54") }}
|
</span>
|
<a> ﷼{{ enableAmt | _toString }}</a>
|
</p>
|
<div class="maik" @click="getxiadan">{{ $t("hj85") }}</div>
|
</div>
|
</van-popup>
|
</div>
|
</template>
|
|
<script>
|
import { buyStockDz, getMoney } from "@/axios/api";
|
|
export default {
|
methods: {
|
priceinput(e){
|
this.num = this.num.replace(/^(0+)|[^\d]+/g, '')
|
var maxnum = this.enableAmt/this.currentItem.nowPrice
|
if(this.num>=maxnum){
|
this.num = Math.floor(maxnum)
|
}
|
},
|
async getxiadan() {
|
if (!this.num) {
|
this.show = false;
|
this.$toast(this.$t("hj262"));
|
return;
|
}
|
this.show = false;
|
// if (!this.password) {
|
// this.show = false;
|
// this.$toast(this.$t("hj264"));
|
// return;
|
// }
|
|
var opt = {
|
dzId: this.currentItem.id,
|
password: this.password,
|
num: this.num,
|
buyingType: "dz",
|
};
|
let res = await buyStockDz(opt);
|
console.log(res, "======");
|
if (res.status == 0) {
|
this.$toast(this.$t("hj265"));
|
this.num = "";
|
this.password = "";
|
this.getenableAmt();
|
} else {
|
this.$toast(res.msg);
|
}
|
this.show = false;
|
},
|
async getenableAmt() {
|
const res = await getMoney();
|
|
const data = res.data.filter((item) => item.accectType === "ALL");
|
this.enableAmt = data[0].availableBalance;
|
},
|
},
|
mounted() {
|
this.getenableAmt();
|
},
|
data() {
|
return {
|
show: false,
|
num: "",
|
password: "",
|
currentItem: {},
|
enableAmt: "",
|
};
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.boxd {
|
background: #fff;
|
border-radius: 0.266rem 0.266rem 0 0;
|
padding-bottom: 0.53rem;
|
|
.boxh {
|
height: 1.2rem;
|
border-bottom: 0.0266rem solid #e0e0e0;
|
text-align: center;
|
line-height: 1.2rem;
|
color: #333;
|
font-size: 0.43rem;
|
width: 9.48rem;
|
margin: 0 auto;
|
position: relative;
|
|
span {
|
position: absolute;
|
width: 0.32rem;
|
height: 0.32rem;
|
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAStJREFUSEutlk1qhDAUgF+EzG5EWsYTzK6HKO0hcgB3gscR3IgH8BBTeojuegJLQWg3NqDlyUQwRn0xcWeQ7zMv7ycMAKCu61PTNOcsy77x3fUpy/IhDMNfIcQfQ3jbtvUwDFfO+UuSJF8ugqqqLlLKN8bYZxRFguV5/sg5fweAJwD4cJEouGJJKZ8Z/m1RFHEQBDcXiQ7v+/41TdNmFLhK1uDInQRHJVvwhcBWsgc3CqgSCnxVsCehwjcFaxJcxzynZtzskE0Fpqfw/RtyzewKDDvBJXJBkgRazP0K9AP1GiIdjn2q6zpm01ZWQ2SCq05r07uMgi24be9aCChwG8lMYAOnSibBEThFMgpc4HsSryNTz65xZPoe+koyDX3cou9rC14k4jj+wWvLP1ylVM57GzhpAAAAAElFTkSuQmCC)
|
no-repeat 50%;
|
background-size: 100%;
|
right: 0.266rem;
|
top: 0.4rem;
|
}
|
}
|
|
h5 {
|
color: #333;
|
font-size: 0.37rem;
|
font-weight: 500;
|
width: 9.48rem;
|
margin: 0 auto;
|
margin-top: 0.32rem;
|
}
|
|
h6 {
|
color: #ea3544;
|
font-size: 0.43rem;
|
width: 9.48rem;
|
margin: 0 auto;
|
margin-top: 0.32rem;
|
font-weight: 600;
|
}
|
|
.erty {
|
width: 9.21rem;
|
height: 1.07rem;
|
border: 0.0266rem solid #5c288c;
|
border-radius: 0.13rem;
|
margin: 0 auto;
|
display: flex;
|
justify-content: space-between;
|
margin-top: 0.59rem;
|
|
.inpy {
|
height: 1.07rem;
|
width: 5.34rem;
|
margin-left: 0.266rem;
|
background: transparent;
|
font-size: 0.37rem;
|
color: #000;
|
}
|
|
a {
|
height: 0.64rem;
|
border-left: 0.0266rem solid #999;
|
width: 1.15rem;
|
margin-top: 0.266rem;
|
text-align: center;
|
font-size: 0.37rem;
|
color: #000;
|
line-height: 0.64rem;
|
}
|
}
|
|
.tghj {
|
border: 0.0266rem solid #5c288c;
|
margin-top: 0.45rem;
|
}
|
|
.plm {
|
width: 8.94rem;
|
margin: 0 auto;
|
margin-top: 0.266rem;
|
|
span {
|
color: #999;
|
font-size: 0.32rem;
|
}
|
|
a {
|
color: #f33030;
|
margin-left: 0.11rem;
|
}
|
}
|
|
.maik {
|
width: 9.21rem;
|
height: 1.07rem;
|
background: #5c288c;
|
border-radius: 0.26rem;
|
margin: 0 auto;
|
margin-top: 0.56rem;
|
text-align: center;
|
line-height: 1.07rem;
|
color: #fff;
|
font-size: 0.37rem;
|
}
|
}
|
</style>
|