From f4a892233ef13cd34ca772185eaf789d0e850b37 Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期六, 08 七月 2023 15:13:49 +0800
Subject: [PATCH] 扫码弹窗问题解决

---
 igds-web/src/main/resources/static/admin/inout/in-check.js |   45 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/igds-web/src/main/resources/static/admin/inout/in-check.js b/igds-web/src/main/resources/static/admin/inout/in-check.js
index 54d4873..594983d 100644
--- a/igds-web/src/main/resources/static/admin/inout/in-check.js
+++ b/igds-web/src/main/resources/static/admin/inout/in-check.js
@@ -67,11 +67,21 @@
     //鏄剧ず鍏ュ簱娴佺▼
     showProgress();
 });
+window.onbeforeunload = function () {
+    console.log('椤甸潰鍒锋柊涔嬪墠瑙﹀彂');
+}
 
+window.onunload = function () {
+    console.log('椤甸潰鍒锋柊瀹屾垚瑙﹀彂');
+}
 window.onload = function () {
+
     //鎵弿鏋嚜鍔ㄥ洖杞︿簨浠�
-    $('#checkId').bind('keyup', function(event) {
+    $('#checkId').bind('keyup', function (event) {
         if (event.keyCode == "13") {
+            // //鍘绘帀鐒︾偣锛岄槻姝㈠埛鏂伴〉闈�
+            // $('#checkId').blur();
+            console.log("in-check", "鎵爜鏋�");
             getDataByCheckId();
         }
     });
@@ -175,6 +185,7 @@
     });
     form.render();
     var data = form.val("form-detail");
+    console.log("getPriceByFoodLevel")
 
     $.ajax({
         type: "POST",
@@ -185,7 +196,9 @@
         success: function (result) {
             if (result.code != "0000") {
                 layer.msg(result.msg);
+                console.log("getPriceByFoodLevel", "!=0000")
             } else {
+                console.log("getPriceByFoodLevel", "==0000")
                 $("#check-result-tip2").text("绮瀹氫环锛�" + result.data.price + "鍏�/鍏枻");
             }
         },
@@ -217,6 +230,7 @@
     // var url = "com.ld.igds.inout.ReportInoutCheck.d";
     // window.parent.openTab(url, "鍖栭獙缁撴灉瀵煎嚭", "checkDataExport");
 };
+
 // 鎵︽牱鏈鸿В闄ゆ�ュ仠
 function checkResetStop() {
     var param = JSON.stringify(checkDto);
@@ -274,6 +288,7 @@
  * 娓叉煋琛ㄦ牸
  */
 function renderTableCheckItem() {
+    console.log("renderTableCheckItem")
     // 娓呯┖鏁版嵁
     $("#tableCheckItem").empty();
     table.render({
@@ -359,7 +374,6 @@
 
 function showDetail(data) {
     curCheckData = data;
-
     if (!curCheckData.checkTime) {
         curCheckData.checkTime = dateFtt("yyyy-MM-dd hh:mm:ss", new Date());
     }
@@ -368,6 +382,7 @@
     // 璧嬪��
     form.val("form-detail", curCheckData);
     form.render();
+    console.log("showDetail");
 
     layer.open({
         type: 1,
@@ -376,34 +391,38 @@
         shade: 0,
         content: $('#checkDetail'),
         btnAlign: 'c',
-        btn: ['浠呬繚瀛�', '淇濆瓨鎻愪氦','鍏抽棴鍙栨秷'],
+        btn: ['浠呬繚瀛�', '淇濆瓨鎻愪氦', '鍏抽棴鍙栨秷'],
         yes: function () {
+            console.log("showDetail", "btn1")
             // 鏇存柊鍒伴〉闈�
             var data = form.val("form-detail");
             // 鍚堝苟鏇存柊鐣跺墠缂栬緫鏁版嵁
             Object.assign(curCheckData, data);
             saveCheckData();
-            if(scanCodeTag){
+            if (scanCodeTag) {
+                console.log("showScanCode")
                 showScanCode();
             }
         }, btn2: function () {
+            console.log("showDetail", "btn2")
             // 鏇存柊鍒伴〉闈�
             var data = form.val("form-detail");
             // 鍚堝苟鏇存柊鐣跺墠缂栬緫鏁版嵁
             Object.assign(curCheckData, data);
             submit();
-            if(scanCodeTag){
+            if (scanCodeTag) {
                 showScanCode();
             }
         }, btn3: function () {
             parent.layer.closeAll();
-            if(scanCodeTag){
+            console.log("showDetail", "btn3")
+            if (scanCodeTag) {
                 showScanCode();
             }
         },
         closeBtn: 0
     });
-
+    console.log("showDetail", "end");
     // 鑾峰彇鍖栭獙椤逛俊鎭�
     flushCheckItem(curCheckData.foodVariety);
     getPriceByFoodLevel(curCheckData.foodLevel);
@@ -417,8 +436,8 @@
     $("#check-result-tip").text("妫�楠岀粨鏋滐細#");
     $("#price-result-tip2").text("绮瀹氫环锛�#鍏�/鍏枻");
     curCheckData.foodVariety = foodVariety;
-
     var index = layer.load();
+    console.log("flushCheckItem")
     $.ajax({
         type: "POST",
         url: "../../basic/inout/get-check-item",
@@ -427,9 +446,11 @@
         data: JSON.stringify(curCheckData),
         success: function (result) {
             if (result.code != "0000") {
+                console.log("flushCheckItem", "!==0000")
                 layer.msg(result.msg);
             } else {
                 curCheckItems = result.data;
+                console.log("flushCheckItem", "==0000")
                 // 鏍规嵁鍖栭獙缁撴灉鎻愰啋鏄惁鍚堟牸
                 updateCheckResultTip();
                 // 椤甸潰娓叉煋妫�娴嬮」
@@ -438,10 +459,12 @@
             }
         },
         error: function () {
+            console.log("flushCheckItem", "error")
             layer.close(index);
             layer.msg("鍚庡彴寮傚父锛岃閲嶈瘯鎴栬�呰仈绯荤鐞嗗憳锛侊紒");
         }
     });
+    console.log("flushCheckItem", "end")
 };
 
 //浠呬繚瀛�
@@ -537,7 +560,7 @@
         area: ['700px', '320px'],
         shade: 0,
         content: $('#scanCodeDetail'),
-        success: function(){
+        success: function () {
             document.getElementById('checkId').focus();
         },
         btnAlign: 'c',
@@ -555,7 +578,7 @@
 //鏍规嵁璐ㄦ鍗曞彿鑾峰彇淇℃伅
 function getDataByCheckId() {
     var param = form.val("form-sacnCodeDetail");
-    if(!param.checkId){
+    if (!param.checkId) {
         layer.alert("璐ㄦ鍗曞彿涓虹┖锛岃鎵爜鎴栬緭鍏ヨ川妫�鍗曞彿");
     }
     var index = layer.load();
@@ -567,11 +590,13 @@
         data: JSON.stringify(param),
         success: function (result) {
             if (result.code != "0000") {
+                console.log("success", "!=0000")
                 layer.close(index);
                 $("#form-sacnCodeDetail")[0].reset();
                 form.render();
                 notify(result.msg, result.data);
             } else {
+                console.log("success", "==0000")
                 updateSelect();
                 showDetail(result.data);
             }

--
Gitblit v1.9.3