<template>
|
<div style="height: 100vh">
|
<van-nav-bar
|
:placeholder="true"
|
:safe-area-inset-top="true"
|
:title="$t('劃轉')"
|
left-arrow
|
@click-left="onClickLeft"
|
/>
|
<main>
|
<div>
|
<div class="main-header">
|
<div class="main-li" @click="show = true">
|
<span class="li-left">{{ $t("从") }}</span
|
><span class="li-center">{{ from.name }}</span>
|
<div class="img-con">
|
<img
|
class="main-li-img"
|
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAUCAYAAAC58NwRAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADESURBVHgBlZGhDsIwEEDvWvD7FEJIJgnBYHFYBATZoCHbAmjmwBE+A8OQE4TvQGJJBsdaQYCN9frEpU3eu4oC5CgVeOPpUgEDocdd1pP8sJ6oRcgKsgcOCeAGAgNbJPW4pMdr0+8eEGGAiL2W38Fzmpz+Bi6R/LxwIvm7wRYVAltUGlRFCBZGatUQgpJc9OBJkQAnkJC/HcJtPIvQRTZvuMilQZVcCGzyV8CR3wFX1ph/qCHtOLJx9SCSfYSsvYnne7DwAtMYh1773jN+AAAAAElFTkSuQmCC"
|
alt="选择"
|
/>
|
</div>
|
</div>
|
<van-action-sheet
|
v-model="show"
|
:actions="actions"
|
:cancel-text="$t('hj106')"
|
close-on-click-action
|
@select="fromSelect"
|
/>
|
<div class="main-img" @click="zh">
|
<img
|
class="img"
|
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAjCAYAAAD17ghaAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADASURBVHgB7dZBCgMhDAXQONjuvaaXGHsJr+m+LbQjlEJbdUwxP7PwL1wIwgNNoqFGTj49Svu36Exp3/oU7tEFYmShgdlUa0ZwzgwF/IMYDuAiRAAchBigFyEK6EGIA/YQEEALAQPUEFBACQEHfCMsKeWFwABqwytH5QomYAIm4FAAe/Zp3b6+gZSyXKO7GE1AXjQR7zeghfh4hBqInypAI4pliERU+wAK0WxECMRuJ5RGdLViSUT3LJBCsIaRBOIJOvdIzG7h9ekAAAAASUVORK5CYII="
|
alt="转换"
|
/>
|
</div>
|
<div class="main-li" @click="toShow = true">
|
<span class="li-left">{{ $t("到") }}</span
|
><span class="li-center">{{ to.name }}</span>
|
<div class="img-con">
|
<img
|
class="main-li-img"
|
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAUCAYAAAC58NwRAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADESURBVHgBlZGhDsIwEEDvWvD7FEJIJgnBYHFYBATZoCHbAmjmwBE+A8OQE4TvQGJJBsdaQYCN9frEpU3eu4oC5CgVeOPpUgEDocdd1pP8sJ6oRcgKsgcOCeAGAgNbJPW4pMdr0+8eEGGAiL2W38Fzmpz+Bi6R/LxwIvm7wRYVAltUGlRFCBZGatUQgpJc9OBJkQAnkJC/HcJtPIvQRTZvuMilQZVcCGzyV8CR3wFX1ph/qCHtOLJx9SCSfYSsvYnne7DwAtMYh1773jN+AAAAAElFTkSuQmCC"
|
alt="选择"
|
/>
|
</div>
|
</div>
|
<van-action-sheet
|
v-model="toShow"
|
:actions="actions"
|
:cancel-text="$t('hj106')"
|
close-on-click-action
|
@select="toSelect"
|
/>
|
</div>
|
<van-row style="margin-top: 15px; position: relative">
|
<van-col span="12">
|
<div
|
style="
|
font-size: 12px;
|
margin-bottom: 4px;
|
color: rgb(140, 159, 173);
|
"
|
>
|
{{ $t("輸入金額") }}
|
</div>
|
<div
|
class="van-cell van-field white-input"
|
modelmodifiers="[object Object]"
|
>
|
<div class="van-cell__value van-field__value">
|
<div class="van-field__body">
|
<input
|
:value="formValue"
|
type="text"
|
inputmode="decimal"
|
id="van-field-47-input"
|
class="van-field__control"
|
:placeholder="$t('請選擇')"
|
@input="inputValue"
|
/>
|
<div class="van-field__button" style="margin-right: 10px">
|
<span style="color: rgb(79, 82, 87)">{{
|
from.symbolCode
|
}}</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
</van-col>
|
<div class="huazhuan">
|
<img
|
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAgCAYAAACYTcH3AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACvSURBVHgB7dZLCsIwEIDhP6LuvWYuYb2E18wFhOosCqX0kUjnsci/yiKLj5CBgcbuuQwodWm5LJARnihVjdGGUIuxgFCDsYJwhLGEsIexhkiJIBDWMF4QlhhPCHOMN4QJEwEipSiQXq93ZumWy0iAfoihae3USiCf9+PljpkgcnbFzCF4YpYQvDBrECmh1NaUbkEk05fZg2CJOYJghamBYIGphagmH/iaS4wN8h/IF9zXWw5krh1JAAAAAElFTkSuQmCC"
|
alt=""
|
/>
|
</div>
|
<van-col span="12" style="padding-left: 5px">
|
<div
|
style="
|
font-size: 12px;
|
margin-bottom: 4px;
|
color: rgb(140, 159, 173);
|
"
|
>
|
{{ $t("轉換得到金額") }}
|
</div>
|
<div class="van-cell van-field van-field--disabled white-input">
|
<div class="van-cell__value van-field__value">
|
<div class="van-field__body">
|
<div class="van-field__control" style="padding-left: 10px">
|
{{
|
from.accectType !== "US"
|
? (formValue / exchangeRate).toFixed(2)
|
: (formValue * exchangeRate).toFixed(2)
|
}}
|
</div>
|
<div class="van-field__button" style="">
|
<span style="color: rgb(79, 82, 87)">{{
|
to.symbolCode
|
}}</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
</van-col>
|
</van-row>
|
|
<div
|
@click="formValue = from.availableBalance"
|
style="
|
color: rgb(5, 106, 239);
|
text-align: right;
|
font-size: 16px;
|
margin-top: 5px;
|
"
|
>
|
{{ $t("最大") }}
|
</div>
|
<div class="balance">
|
<div>{{ $t("可用餘額") }}</div>
|
<div class="balance-text">
|
{{ from.availableBalance || "0.0000" }} {{ from.symbolCode }}
|
</div>
|
</div>
|
</div>
|
<van-button type="primary" @click="transferIndex" class="but">{{
|
$t("確認劃轉")
|
}}</van-button>
|
</main>
|
</div>
|
</template>
|
|
<script>
|
import * as api from "@/axios/api";
|
import { Notify } from "vant";
|
import { login, transfer } from "../../axios/api";
|
|
export default {
|
created() {
|
this.getMoneyData();
|
},
|
|
components: {},
|
data() {
|
return {
|
exchangeRate: 7.3,
|
formValue: "",
|
from: {},
|
to: {},
|
show: false,
|
actions: [],
|
toShow: false,
|
};
|
},
|
methods: {
|
inputValue(e) {
|
this.formValue = e.target.value;
|
},
|
async transferIndex() {
|
const res = await transfer({
|
fromType: this.from.accectType,
|
toType: this.to.accectType,
|
amt: this.formValue,
|
});
|
if (res.status === 0) {
|
Notify({ type: "success", message: this.$t("划转成功") });
|
setTimeout(() => {
|
this.$router.push("/user");
|
}, 500);
|
} else {
|
Notify({ type: "warning", message: res.msg });
|
}
|
},
|
zh() {
|
const obj = { ...this.from };
|
this.from = { ...this.to };
|
this.to = { ...obj };
|
this.formValue = "";
|
},
|
fromSelect(e) {
|
if (e.accectType === this.to.accectType) {
|
return Notify({ type: "warning", message: this.$t("不能选择一样的") });
|
}
|
this.from = e;
|
this.formValue = "";
|
},
|
toSelect(e) {
|
if (e.accectType === this.from.accectType) {
|
return Notify({ type: "warning", message: this.$t("不能选择一样的") });
|
}
|
|
this.to = e;
|
this.formValue = "";
|
},
|
async getMoneyData() {
|
let res = await api.getMoney();
|
if (res.status === 0) {
|
let array = res.data.filter((item) => item.accectType !== "ALL");
|
array.map((item) => {
|
item.name = this.$t(item.accectType);
|
});
|
this.actions = array;
|
}
|
},
|
onClickLeft() {
|
this.$router.push("/user");
|
},
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
/deep/ .van-nav-bar__content {
|
height: 65px;
|
}
|
/deep/ .van-nav-bar__title {
|
font-family: "DINPro";
|
width: 100%;
|
height: 1.17333rem;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
font-style: normal;
|
font-weight: 500;
|
font-size: 0.48rem;
|
color: #14181f;
|
}
|
main {
|
width: 100%;
|
flex: 1;
|
padding: 0 0.4rem;
|
box-sizing: border-box;
|
display: flex;
|
flex-direction: column;
|
justify-content: space-between;
|
.main-header {
|
width: 100%;
|
height: 2.66667rem;
|
background: #fefffe;
|
box-shadow: 0 0.16rem 0.32rem #eaeaea99;
|
border-radius: 0.10667rem;
|
margin-top: 0.4rem;
|
padding: 0.4rem 0.53333rem;
|
display: flex;
|
flex-direction: column;
|
justify-content: space-between;
|
font-style: normal;
|
font-weight: 400;
|
font-size: 0.37333rem;
|
color: #8c9fad;
|
.main-li {
|
display: flex;
|
align-items: center;
|
.li-left {
|
width: 15%;
|
font-style: normal;
|
font-weight: 400;
|
font-size: 0.37333rem;
|
color: #8c9fad;
|
}
|
.li-center {
|
width: 40%;
|
height: 100%;
|
font-style: normal;
|
font-weight: 400;
|
font-size: 0.37333rem;
|
color: #14181f;
|
line-height: 0.37333rem;
|
text-align: center;
|
}
|
.img-con {
|
flex: 1;
|
display: flex;
|
margin-left: 0.53333rem;
|
}
|
.main-li-img {
|
width: 0.14667rem;
|
height: 0.25653rem;
|
}
|
}
|
.main-img {
|
text-align: right;
|
.img {
|
width: 0.42667rem;
|
height: 0.46667rem;
|
}
|
}
|
}
|
.huazhuan {
|
width: 0.90667rem;
|
height: 0.90667rem;
|
border: 0.02667rem solid black;
|
position: absolute;
|
border-radius: 50%;
|
left: 50%;
|
top: 0.66667rem;
|
transform: translate(-50%);
|
z-index: 20;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
background-color: #fff;
|
img {
|
width: 0.42667rem;
|
height: 0.46667rem;
|
}
|
}
|
.van-field__control {
|
display: block;
|
box-sizing: border-box;
|
width: 100%;
|
min-width: 0;
|
margin: 0;
|
padding: 0;
|
height: 60px;
|
color: var(--van-field-input-text-color);
|
line-height: 60px;
|
text-align: left;
|
background-color: transparent;
|
border: 0;
|
resize: none;
|
-webkit-user-select: auto;
|
user-select: auto;
|
font-size: 20px;
|
}
|
.van-field__button {
|
padding-left: 0.148148rem;
|
font-size: 20px;
|
}
|
.balance {
|
display: flex;
|
justify-content: space-between;
|
font-style: normal;
|
font-weight: 400;
|
font-size: 0.37333rem;
|
color: #8c9fad;
|
margin-top: 0.21333rem;
|
padding: 0 0.13333rem;
|
box-sizing: border-box;
|
.balance-text {
|
font-style: normal;
|
font-weight: 500;
|
font-size: 0.37333rem;
|
color: #4f5257;
|
}
|
}
|
.but {
|
width: calc(100% - 40px);
|
height: 1.06667rem;
|
margin-bottom: 0.53333rem;
|
position: fixed;
|
bottom: 20px;
|
left: 20px;
|
border-radius: 8px;
|
font-size: 20px;
|
}
|
}
|
</style>
|