1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
| <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
| :type="dataObj.stockType != $mc ? 'success' : ''"
| size="small"
| style="margin-right: 8px"
| >
| {{ dataObj.stockType }}
| </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 != $mc" class="sc_c">
| ≈ $ {{ (rate(dataObj.stockType) * 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>
|
|