Browse Source

fix: modal确认功能判断

xyh 2 years ago
parent
commit
a39e4e5d7a
2 changed files with 19 additions and 16 deletions
  1. 3 2
      src/pages/deliver/hooks.js
  2. 16 14
      src/pages/receive/hooks.js

+ 3 - 2
src/pages/deliver/hooks.js

@@ -65,8 +65,9 @@ export function useSubmit({goodsList, customerNo, truckNo, date}) {
     showModal({
       title: '提交发货',
       content: `你确定要提交${truckNo}${customerNo}发货单吗?`,
-      complete() {
-        mutate({dataList, customer: customerNo, truckNo, arrivalTime: date});
+      success({confirm}) {
+        confirm &&
+          mutate({dataList, customer: customerNo, truckNo, arrivalTime: date});
       },
     });
   }

+ 16 - 14
src/pages/receive/hooks.js

@@ -44,12 +44,13 @@ export function useUpload() {
       showModal({
         title: '删除图片',
         content: `你确定要删除第${idx + 1}张图片吗?`,
-        success() {
-          setFiles(function (prev) {
-            const next = [...prev];
-            next.splice(idx, 1);
-            return next;
-          });
+        success({confirm}) {
+          confirm &&
+            setFiles(function (prev) {
+              const next = [...prev];
+              next.splice(idx, 1);
+              return next;
+            });
         },
       });
     };
@@ -103,14 +104,15 @@ export function useSubmit({customerNo, truckNo, anomaly, note, imgs}) {
     showModal({
       title: '确认收货',
       content: `你确认要对${truckNo}${customerNo}进行确认收货吗?`,
-      success() {
-        mutate({
-          customer: customerNo,
-          truckNo,
-          anomaly: anomaly ? '1' : '0',
-          note,
-          imgs: imgUrls,
-        });
+      success({confirm}) {
+        confirm &&
+          mutate({
+            customer: customerNo,
+            truckNo,
+            anomaly: anomaly ? '1' : '0',
+            note,
+            imgs: imgUrls,
+          });
       },
     });
   }