| | |
| | | <template> |
| | | <el-dialog :title="$t('劃轉')" :visible.sync="dialogVisible" width="720px" :before-close="onClose"> |
| | | <el-dialog |
| | | :title="$t('劃轉')" |
| | | :visible.sync="dialogVisible" |
| | | width="720px" |
| | | :before-close="onClose" |
| | | > |
| | | <el-form ref="withdrawform" :model="form" label-width="auto" :rules="rules"> |
| | | <el-form-item :label="$t('从')" prop="fromType"> |
| | | <div class="flex-center"> |
| | | <el-select @change="getExchangeRate" v-model="form.fromType" :placeholder="$t('請選擇')"> |
| | | <el-option v-for="item in options" :key="item.value" :label="item.name" :value="item.name"> |
| | | <el-select |
| | | @change="getExchangeRate" |
| | | v-model="form.fromType" |
| | | :placeholder="$t('請選擇')" |
| | | > |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.name" |
| | | :value="item.name" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <el-input v-model.number="form.amt" @input="amtinput" type="number"></el-input> |
| | | <el-button type="primary" style="margin-left: 10px" @click="form.amt = maxNum" |
| | | class="submit">{{ $t("最大") }}</el-button> |
| | | |
| | | <el-input |
| | | v-model.number="form.amt" |
| | | @input="amtinput" |
| | | type="number" |
| | | ></el-input> |
| | | <el-button |
| | | type="primary" |
| | | style="margin-left: 10px" |
| | | @click="form.amt = maxNum" |
| | | class="submit" |
| | | >{{ $t("最大") }}</el-button |
| | | > |
| | | </div> |
| | | </el-form-item> |
| | | |
| | | <el-form-item :label="$t('到')" prop="toType"> |
| | | <div class="flex-center"> |
| | | <el-select @change="getExchangeRate" v-model="form.toType" :placeholder="$t('請選擇')"> |
| | | <el-option v-for="item in actions" :key="item.value" :label="item.name" :value="item.name"> |
| | | <el-select |
| | | @change="getExchangeRate" |
| | | v-model="form.toType" |
| | | :placeholder="$t('請選擇')" |
| | | > |
| | | <el-option |
| | | v-for="item in actions" |
| | | :key="item.value" |
| | | :label="item.name" |
| | | :value="item.name" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <el-input v-model.number="price" disabled type="number"></el-input> |
| | |
| | | allMoney: "", |
| | | moneylist:[], //全部账户信息 |
| | | rules: { |
| | | fromType: [{ |
| | | fromType: [ |
| | | { |
| | | required: true, |
| | | message: this.$t("請選擇"), |
| | | trigger: "change" |
| | | }, ], |
| | | toType: [{ |
| | | required: true, |
| | | message: this.$t("請選擇"), |
| | | trigger: "change" |
| | | }], |
| | | bankId: [{ |
| | | required: true, |
| | | message: this.$t("請選擇"), |
| | | trigger: "change" |
| | | }, ], |
| | | amt: [{ |
| | | required: true, |
| | | message: this.$t("请输入") |
| | | }], |
| | | trigger: "change", |
| | | }, |
| | | options: [{ |
| | | ], |
| | | toType: [ |
| | | { |
| | | required: true, |
| | | message: this.$t("請選擇"), |
| | | trigger: "change", |
| | | }, |
| | | ], |
| | | bankId: [ |
| | | { |
| | | required: true, |
| | | message: this.$t("請選擇"), |
| | | trigger: "change", |
| | | }, |
| | | ], |
| | | amt: [ |
| | | { |
| | | required: true, |
| | | message: this.$t("请输入"), |
| | | }, |
| | | ], |
| | | }, |
| | | options: [ |
| | | { |
| | | name: "US", |
| | | value: "USD" |
| | | }, { |
| | | value: "USD", |
| | | }, |
| | | { |
| | | name: "HK", |
| | | value: "HKD" |
| | | }, { |
| | | value: "HKD", |
| | | }, |
| | | { |
| | | name: "IN", |
| | | value: "INR" |
| | | }, { |
| | | value: "INR", |
| | | }, |
| | | { |
| | | name: "TW", |
| | | value: "TWD" |
| | | }], |
| | | actions: [{ |
| | | value: "TWD", |
| | | }, |
| | | ], |
| | | actions: [ |
| | | { |
| | | name: "US", |
| | | value: "USD" |
| | | }, { |
| | | value: "USD", |
| | | }, |
| | | { |
| | | name: "HK", |
| | | value: "HKD" |
| | | }, { |
| | | value: "HKD", |
| | | }, |
| | | { |
| | | name: "IN", |
| | | value: "INR" |
| | | }, { |
| | | value: "INR", |
| | | }, |
| | | { |
| | | name: "TW", |
| | | value: "TWD" |
| | | }], |
| | | value: "TWD", |
| | | }, |
| | | ], |
| | | yhkactions: [], |
| | | }; |
| | | }, |
| | |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | //可用余额 |
| | | maxNum: { |
| | | type: Number, |
| | | default: 0, |
| | | moneyData: { |
| | | type: Array, |
| | | default: () => [], |
| | | }, |
| | | }, |
| | | computed: { |
| | | maxNum() { |
| | | let max = 0; |
| | | this.moneyData.forEach((i) => { |
| | | if (i.accectType == this.form.fromType) max = i.availableBalance; |
| | | }); |
| | | return max; |
| | | }, |
| | | }, |
| | | created() { |
| | | this.getExchangeRate() |
| | | this.getfee() |
| | | this.getMoney() |
| | | this.getExchangeRate(); |
| | | this.getfee(); |
| | | this.getMoney(); |
| | | }, |
| | | methods: { |
| | | |
| | | async getMoney() { |
| | | let data = await api.getMoney(); |
| | | if (data.status === 0) { |
| | | this.moneylist = data.data |
| | | this.moneylist = data.data; |
| | | } |
| | | }, |
| | | amtinput(e) { |
| | | this.price = e * this.rata |
| | | this.price = e * this.rata; |
| | | }, |
| | | async getfee() { |
| | | let data = await api.getfee(); |
| | | if (data.status == 0) { |
| | | this.handling_fee = data.data.cValue |
| | | this.handling_fee = data.data.cValue; |
| | | } |
| | | }, |
| | | async getExchangeRate() { |
| | |
| | | let selectedName = this.form.fromType; |
| | | let toselectedName = this.form.toType; |
| | | if (selectedName == toselectedName) { |
| | | this.rata = '1' |
| | | return |
| | | this.rata = "1"; |
| | | return; |
| | | } |
| | | let selectedItem = this.options.find(item => item.name === selectedName); |
| | | let toselectedItem = this.actions.find(item => item.name === toselectedName); |
| | | |
| | | this.moneylist.forEach((item) => { |
| | | if (item.symbolCode == selectedItem.value ) { |
| | | this.maxNum = item.availableBalance; |
| | | } |
| | | }); |
| | | let selectedItem = this.options.find( |
| | | (item) => item.name === selectedName |
| | | ); |
| | | let toselectedItem = this.actions.find( |
| | | (item) => item.name === toselectedName |
| | | ); |
| | | |
| | | let data = await api.getRateInfo(); |
| | | data.data && |
| | | data.data.forEach((item) => { |
| | | if (item.currency == selectedItem.value && item.conversionCurrency == toselectedItem |
| | | .value) { |
| | | if ( |
| | | item.currency == selectedItem.value && |
| | | item.conversionCurrency == toselectedItem.value |
| | | ) { |
| | | this.rata = item.rata; |
| | | } |
| | | }); |