| | |
| | | :title="$t('劃轉')" |
| | | left-arrow |
| | | @click-left="onClickLeft" |
| | | /> |
| | | > |
| | | <template #right> |
| | | <van-icon |
| | | @click="$router.push('/transferindex-list')" |
| | | name="orders-o" |
| | | size="20" |
| | | /> |
| | | </template> |
| | | </van-nav-bar> |
| | | <main> |
| | | <div> |
| | | <div class="main-header"> |
| | |
| | | <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) |
| | | }} |
| | | {{ (formValue * rate).toFixed(2) }} |
| | | </div> |
| | | <div class="van-field__button" style=""> |
| | | <span style="color: rgb(79, 82, 87)">{{ |
| | |
| | | <script> |
| | | import * as api from "@/axios/api"; |
| | | import { Notify } from "vant"; |
| | | import { login, transfer } from "../../axios/api"; |
| | | import { transfer } from "../../axios/api"; |
| | | |
| | | export default { |
| | | created() { |
| | |
| | | components: {}, |
| | | data() { |
| | | return { |
| | | exchangeRate: 7.35, |
| | | // 马股和美元的汇率 |
| | | exchangeRate: 4.59, |
| | | // 划转的金额 |
| | | formValue: "", |
| | | from: {}, |
| | | to: {}, |
| | | show: false, |
| | | actions: [], |
| | | toShow: false, |
| | | // 后端返回的数据列表比较多。在这里前端配置需要展示的 |
| | | filterActions: ["US", "MAS", "HK"], |
| | | // 选择的列表 |
| | | actions: [], |
| | | // 汇率 |
| | | rate: "", |
| | | }; |
| | | }, |
| | | methods: { |
| | |
| | | if (res.status === 0) { |
| | | Notify({ type: "success", message: this.$t("划转成功") }); |
| | | setTimeout(() => { |
| | | this.$router.push("/user"); |
| | | this.$router.push("/transferindex-list"); |
| | | }, 500); |
| | | } else { |
| | | Notify({ type: "warning", message: res.msg }); |
| | |
| | | this.from = { ...this.to }; |
| | | this.to = { ...obj }; |
| | | this.formValue = ""; |
| | | this.geCurrencyRate(); |
| | | }, |
| | | fromSelect(e) { |
| | | if (e.accectType === this.to.accectType) { |
| | |
| | | } |
| | | this.from = e; |
| | | this.formValue = ""; |
| | | this.geCurrencyRate(); |
| | | }, |
| | | toSelect(e) { |
| | | if (e.accectType === this.from.accectType) { |
| | |
| | | |
| | | this.to = e; |
| | | this.formValue = ""; |
| | | this.geCurrencyRate(); |
| | | }, |
| | | // 获取账号余额 |
| | | async getMoneyData() { |
| | | let res = await api.getMoney(); |
| | | if (res.status === 0) { |
| | | let array = res.data.filter((item) => item.accectType !== "ALL"); |
| | | let array = res.data.filter( |
| | | (item) => this.filterActions.indexOf(item.accectType) !== -1 |
| | | ); |
| | | array.map((item) => { |
| | | item.name = this.$t(item.accectType); |
| | | }); |
| | | this.actions = array; |
| | | } |
| | | }, |
| | | // 获取汇率 |
| | | async geCurrencyRate() { |
| | | if (this.from.accectType && this.to.accectType) { |
| | | let res = await api.currencyRate({ |
| | | fromType: this.from.accectType, |
| | | toType: this.to.accectType, |
| | | }); |
| | | if (res.status === 0) { |
| | | this.rate = res.data; |
| | | } |
| | | } |
| | | }, |
| | | onClickLeft() { |
| | | this.$router.push("/user"); |
| | | }, |