From 41f4f388a182612de2bea2c62cd68c6c437c95c7 Mon Sep 17 00:00:00 2001
From: PC-20250623MANY\Administrator <344137771@qq.com>
Date: Tue, 19 Aug 2025 15:16:55 +0800
Subject: [PATCH] 1

---
 /dev/null                        |    0 
 src/views/ipo/components/buy.vue |   89 +++++++++++++++++++++++++++++
 src/views/ipo/ipo.vue            |   61 +++++--------------
 3 files changed, 106 insertions(+), 44 deletions(-)

diff --git a/dist.rar b/dist.rar
deleted file mode 100644
index 8f35f46..0000000
--- a/dist.rar
+++ /dev/null
Binary files differ
diff --git a/src/views/ipo/components/buy.vue b/src/views/ipo/components/buy.vue
new file mode 100644
index 0000000..9e6918e
--- /dev/null
+++ b/src/views/ipo/components/buy.vue
@@ -0,0 +1,89 @@
+<template>
+  <el-dialog
+    :title="$t('操作确认')"
+    :visible.sync="dialogVisible"
+    width="480px"
+    :before-close="onClose"
+  >
+    <el-form ref="depositform" :model="form" label-width="auto" :rules="rules">
+      <el-form-item :label="$t('sl')" prop="applyNums">
+        <el-input v-model.number="form.applyNums" type="number"></el-input>
+      </el-form-item>
+
+      <el-form-item :label="$t('hj101')" prop="lever">
+        <el-input-number
+          v-model="form.lever"
+          :min="1"
+          :max="100"
+        ></el-input-number>
+      </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 * as api from "@/axios/api";
+export default {
+  data() {
+    return {
+      form: {
+        applyNums: "",
+        lever: 1,
+      },
+      rules: {
+        applyNums: [{ required: true, message: this.$t("请输入") }],
+        lever: [{ required: true, message: this.$t("请输入") }],
+      },
+    };
+  },
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+    dataObj: {
+      type: Object,
+      default: () => {},
+    },
+  },
+  created() {},
+  methods: {
+    // 关闭弹窗
+    onClose() {
+      this.$emit("update:dialogVisible", false);
+      this.$emit("onClose"); // 关闭弹窗时,通知父组件
+    },
+    // 提交
+    onSubmit() {
+      this.$refs["depositform"].validate(async (valid) => {
+        if (valid) {
+          let opt = {
+            newCode: this.dataObj.code,
+            password: this.dataObj.password,
+            newlistId: this.dataObj.newlistId,
+            type: this.dataObj.type,
+            ...this.form,
+          };
+          let data = await api.getNewAdd(opt);
+          if (data.status == 0) {
+            this.$message.success(data.msg);
+            this.onClose();
+          }
+        } else {
+          console.log("getNewAdd err");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped></style>
diff --git a/src/views/ipo/ipo.vue b/src/views/ipo/ipo.vue
index 257af68..5228bc1 100644
--- a/src/views/ipo/ipo.vue
+++ b/src/views/ipo/ipo.vue
@@ -111,15 +111,26 @@
     </template>
 
     <el-empty :description="$t('zwsj')" v-else></el-empty>
+
+    <buy
+      :dialogVisible.sync="buyVisible"
+      v-if="buyVisible"
+      :dataObj="openObj"
+      @onClose="onClose"
+    ></buy>
   </div>
 </template>
 
 <script>
+import buy from "./components/buy";
 import * as api from "@/axios/api";
 import mixins from "@/mixins/myMixins"; // 混入
 export default {
   name: "ipo",
   mixins: [mixins],
+  components: {
+    buy,
+  },
   data() {
     return {
       // 列表参数,必须是opt和myMixins混入配合使用
@@ -135,50 +146,12 @@
   methods: {
     // 打开购买弹窗
     buyOpen(i) {
-      // this.$confirm("", this.$t("操作确认"), {
-      //   confirmButtonText: this.$t("qr"),
-      //   cancelButtonText: this.$t("qx"),
-      // })
-      //   .then(async () => {
-      //     // 申购
-      //     let opt = {
-      //       newCode: i.code,
-      //       applyNums: i.orderNumber,
-      //       password: i.password,
-      //       newlistId: i.newlistId,
-      //       type: i.type,
-      //     };
-      //     let data = await api.getNewAdd(opt);
-
-      //     if (data.status == 0) {
-      //       this.$message.success(data.msg);
-      //       this.init(); // 重新获取列表
-      //     }
-      //   })
-      //   .catch(() => {});
-
-      this.$prompt(this.$t("sl"), this.$t("操作确认"), {
-        confirmButtonText: this.$t("qr"),
-        cancelButtonText: this.$t("qx"),
-      })
-        .then(async (val) => {
-          // 申购
-          let opt = {
-            newCode: i.code,
-            applyNums: val.value,
-            password: i.password,
-            newlistId: i.newlistId,
-            type: i.type,
-          };
-
-          let data = await api.getNewAdd(opt);
-
-          if (data.status == 0) {
-            this.$message.success(data.msg);
-            this.init(); // 重新获取列表
-          }
-        })
-        .catch(() => {});
+      this.openObj = i; // 赋值
+      this.buyVisible = true; // 打开弹窗
+    },
+    // 关闭弹窗
+    onClose() {
+      this.openObj = {};
     },
   },
 };

--
Gitblit v1.9.3