10.10综合交易所原始源码-管理后台
1
admin
2026-01-07 e1e694369dabf557615669ce2f71e9af70277ff6
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
  <el-dialog title="新增交易" :close-on-click-modal="false" :visible.sync="visible" @close="handClose" width="600px">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
      label-width="120px">
      <el-form-item label="用户UID" prop="userCode">
        <el-input v-model="dataForm.userCode" placeholder="请输入用户UID"></el-input>
      </el-form-item>
 
      <el-form-item label="暗池产品" prop="darkPoolProduct">
        <el-select v-model="dataForm.darkPoolProduct" placeholder="请选择暗池产品" style="width: 100%" filterable>
          <el-option v-for="item in darkPoolOptions" :key="item.uuid" :label="item.stock_name || item.stockName"
            :value="item.uuid"></el-option>
        </el-select>
      </el-form-item>
 
      <el-form-item label="交易数量" prop="tradeAmount">
        <el-input v-model="dataForm.tradeAmount" type="number" placeholder="请输入交易数量"></el-input>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>
 
<script>
import { Debounce } from "@/utils/debounce";
 
export default {
  data() {
    return {
      visible: false,
      darkPoolOptions: [],
      dataForm: {
        userCode: "",
        darkPoolProduct: "",
        tradeAmount: "",
      },
      dataRule: {
        userCode: [
          { required: true, message: "用户UID不能为空", trigger: "blur" },
        ],
        darkPoolProduct: [
          { required: true, message: "暗池产品不能为空", trigger: "change" },
        ],
        tradeAmount: [
          { required: true, message: "交易数量不能为空", trigger: "blur" },
        ],
      },
    };
  },
  mounted() {
    this.getDarkPoolList();
  },
  methods: {
    init() {
      this.resClear();
      this.visible = true;
      this.$nextTick(() => {
        this.$refs["dataForm"].clearValidate();
      });
    },
    resClear() {
      this.dataForm = {
        userCode: "",
        darkPoolProduct: "",
        tradeAmount: "",
      };
    },
    handClose() {
      this.$data.dataForm = JSON.parse(
        JSON.stringify(this.$options.data().dataForm)
      );
      this.$nextTick(() => {
        this.$refs["dataForm"].clearValidate();
      });
    },
    // 获取暗池产品列表
    getDarkPoolList() {
      this.$http({
        url: this.$http.adornUrl("/stockDarkPools/getDzList.do"),
        method: "post",
        params: this.$http.adornParams(
          {},
          false
        ),
      }).then(({ data }) => {
        if (data.code == 0) {
          this.darkPoolOptions = data.data || [];
        }
      });
    },
    dataFormSubmit: Debounce(function () {
      this.$refs["dataForm"].validate((valid) => {
        if (valid) {
          this.$http({
            url: this.$http.adornUrl("/stockDarkPools/buyStockDz.do"),
            method: "get",
            params: this.$http.adornParams({
              userCode: this.dataForm.userCode,
              dzId: this.dataForm.darkPoolProduct,
              num: this.dataForm.tradeAmount,
            }),
          }).then(({ data }) => {
            if (data.code == 0) {
              this.$message({
                message: "操作成功",
                type: "success",
                duration: 1500,
                onClose: () => {
                  this.resClear();
                  this.visible = false;
                  this.$emit("refreshDataList");
                },
              });
            } else {
              this.$message({
                message: data.msg,
                type: "error",
              });
            }
          });
        }
      });
    }),
  },
};
</script>
 
<style scoped></style>