فهرست منبع

确认弹窗修改

Zhangbw 2 ماه پیش
والد
کامیت
a54d05d826
1فایلهای تغییر یافته به همراه26 افزوده شده و 16 حذف شده
  1. 26 16
      src/pages/admin/shortPool.vue

+ 26 - 16
src/pages/admin/shortPool.vue

@@ -262,23 +262,33 @@ const handleAddFromSuggestion = async (item) => {
     uni.showToast({ title: '该股票已在超短池中', icon: 'none' })
     return
   }
-  try {
-    const res = await request({
-      url: '/v1/stock/pool/admin/add',
-      method: 'POST',
-      header: { 'content-type': 'application/json' },
-      data: { stockCode: item.code, poolType }
-    })
-    if (res.code === 200) {
-      uni.showToast({ title: '添加成功', icon: 'success' })
-      clearSearch()
-      loadStockList()
-    } else {
-      uni.showToast({ title: res.message || '添加失败', icon: 'none' })
+
+  // 添加确认弹窗
+  uni.showModal({
+    title: '确认添加',
+    content: `确定要将 ${item.name} (${item.code}) 添加到超短池吗?`,
+    success: async (modalRes) => {
+      if (modalRes.confirm) {
+        try {
+          const res = await request({
+            url: '/v1/stock/pool/admin/add',
+            method: 'POST',
+            header: { 'content-type': 'application/json' },
+            data: { stockCode: item.code, poolType }
+          })
+          if (res.code === 200) {
+            uni.showToast({ title: '添加成功', icon: 'success' })
+            clearSearch()
+            loadStockList()
+          } else {
+            uni.showToast({ title: res.message || '添加失败', icon: 'none' })
+          }
+        } catch (e) {
+          uni.showToast({ title: '添加失败', icon: 'none' })
+        }
+      }
     }
-  } catch (e) {
-    uni.showToast({ title: '添加失败', icon: 'none' })
-  }
+  })
 }
 
 const handleDeleteStock = (item) => {