<template>
|
<el-dialog
|
:title="$t('量化交易')"
|
:visible.sync="dialogVisible"
|
width="600px"
|
:before-close="onClose"
|
>
|
<el-form ref="depositform" :model="form" label-width="auto" :rules="rules">
|
<el-form-item :label="$t('hj313')">
|
<div>
|
<el-tag
|
v-if="dataObj.stockType == 'MEX'"
|
size="small"
|
style="margin-right: 8px"
|
>
|
MEX
|
</el-tag>
|
<el-tag
|
type="success"
|
size="small"
|
style="margin-right: 8px"
|
v-else-if="dataObj.stockType == 'US'"
|
>
|
US
|
</el-tag>
|
<span>{{ dataObj.stockName }}</span>
|
</div>
|
</el-form-item>
|
|
<el-form-item :label="$t('最低认购金额')">
|
<div>
|
{{ dataObj.stockType | currencySymbol }} {{ dataObj.minPrice }}
|
</div>
|
</el-form-item>
|
|
<el-form-item :label="$t('申购金额')" prop="buyNum">
|
<el-input v-model.number="form.buyNum" type="number"></el-input>
|
<div v-if="dataObj.stockType == 'US'" class="sc_c">
|
≈ MX$ {{ (utm * form.buyNum).toFixed(2) }}
|
</div>
|
</el-form-item>
|
|
<el-form-item>
|
<el-button @click="onClose">{{ $t("qx") }}</el-button>
|
<el-button type="primary" @click="onSubmit" class="submit">
|
{{ $t("qr") }}
|
</el-button>
|
</el-form-item>
|
</el-form>
|
</el-dialog>
|
</template>
|
|
<script>
|
import mixins from "@/mixins/myMixins"; // 混入
|
import * as api from "@/axios/api";
|
export default {
|
mixins: [mixins],
|
data() {
|
return {
|
form: {
|
buyNum: 0,
|
},
|
rules: {
|
buyNum: [{ required: true, message: this.$t("请输入") }],
|
},
|
myMoney: {},
|
};
|
},
|
props: {
|
dialogVisible: {
|
type: Boolean,
|
default: false,
|
},
|
dataObj: {
|
type: Object,
|
default: () => {},
|
},
|
},
|
created() {
|
this.getExchangeRate();
|
},
|
methods: {
|
// 关闭弹窗
|
onClose() {
|
this.$emit("update:dialogVisible", false);
|
this.$emit("onClose"); // 关闭弹窗时,通知父组件
|
},
|
// 提交
|
onSubmit() {
|
this.$refs["depositform"].validate(async (valid) => {
|
if (valid) {
|
let opt = {
|
...this.form,
|
id: this.dataObj.id,
|
};
|
let data = await api.buyStockAi(opt);
|
if (data.status == 0) {
|
this.$message.success(data.msg);
|
this.onClose();
|
}
|
} else {
|
console.log("buyStockAi err");
|
return false;
|
}
|
});
|
},
|
},
|
};
|
</script>
|
|
<style lang="scss" scoped></style>
|