Browse Source

调试取货码

zcb 4 years ago
parent
commit
d4a7ef79a4
1 changed files with 23 additions and 21 deletions
  1. 23 21
      kmall-admin/src/main/webapp/js/sale/sale.js

+ 23 - 21
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -48,6 +48,9 @@ let vm = new Vue({
 
             var thisGoods = {};
             $.get("../goods/details/"+vm.prodBarcode+"/"+vm.storeId, function (r) {
+                console.log(typeof r);
+                console.log(r.code == 0);
+                console.log(r.code);
                 if (r.code == 0) {
 
                     vm.goodsDetail = true;
@@ -159,16 +162,15 @@ let vm = new Vue({
             this.userInfo.customName = vm.customname == ''  ? this.$refs.customName.value :vm.customname;
             this.userInfo.customIDCard = vm.customidcard == ''  ? this.$refs.customIDCard.value :vm.customidcard;
             this.userInfo.customPhone = this.$refs.customPhone.value;
-            debugger
             var idcardReg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
             if(!idcardReg.test(this.userInfo.customIDCard)){
-                alert("请输入正确的身份证号");
-                return ;
+                // alert("请输入正确的身份证号");
+                // return ;
             }
 
             if(!(/^1[3456789]\d{9}$/.test(this.userInfo.customPhone))){
-                alert("手机号码有误,请重填");
-                return ;
+                // alert("手机号码有误,请重填");
+                // return ;
             }
 
 
@@ -309,31 +311,30 @@ let vm = new Vue({
 });
 
 function getPrintContent(ticket) {
-    var content = "<div style=\"width: 250px;font-family: 微软雅黑;font-size: 8px;\">";
+    var content = "<div style=\"width: 250px;font-family: 微软雅黑;font-size: 15px;\">";
     //小票头
-    content += "<div style=\"text-align: center;width: 100%;font-weight:bold;font-size: 13px;\">";
+    content += "<div style=\"text-align: center;width: 100%;font-weight:bold;font-size: 15px;\">";
     content += ticket.shopName
     content += "</div>";
     content += "<div style=\"width: 100%;overflow:hidden;white-space: nowrap;\">--------------------------------------------------</div>";
-    content += "<div style=\"width: 100%;\">";
-    content += "收银机号:" + ticket.salesNo;
+    content += "<div style=\"width: 100%;margin:5px 0px;\">";
+    /*content += "收银机号:" + ticket.salesNo;
     content += "</div>";
-    content += "<div style=\"width: 100%;\">";
+    content += "<div style=\"width: 100%;\">";*/
     content += "收银员:" + ticket.userName;
     content += "</div>";
-    content += "<div style=\"width: 100%;\">";
+    content += "<div style=\"width: 100%;font-size: 30px;margin:15px 0 10px 5px;\">";
     content += "取货码:" + ticket.code;
     content += "</div>";
-
-    content += "<div style=\"width: 100%;\">";
-    content += "该取货单号只有当天有效"
-    content += "</div>";
-    content += "<div style=\"width: 100%;\">";
+    content += "<div style=\"width: 100%;margin:5px 0px;\">";
     content += "订单编号:" + ticket.orderNo;
     content += "</div>";
-    content += "<div style=\"width: 100%;\">";
+    content += "<div style=\"width: 100%;margin:5px 0px;\">";
     content += "打印日期:" + ticket.time;
     content += "</div>";
+    content += "<div style=\"width: 100%;margin:5px 0px;font-size: 13px;\">";
+    content += "该取货单号只有当天有效"
+    content += "</div>";
 
     return content;
 }
@@ -345,7 +346,7 @@ function printArea(content) {
     removePrintArea(idPrefix + printAreaCount);
     printAreaCount++;
     var iframeId = idPrefix + printAreaCount;
-    var iframeStyle = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
+    var iframeStyle = 'width:0px;height:0px;left:0px;top:0px;';
     iframe = document.createElement('IFRAME');
     $(iframe).attr({
         style: iframeStyle,
@@ -364,10 +365,11 @@ function printArea(content) {
     doc.write('<div class="">' + content
         + '</div>');
     doc.close();
+    console.log(doc);
     var frameWindow = iframe.contentWindow;
     frameWindow.close();
     frameWindow.focus();
-    frameWindow.print();
+    // frameWindow.print();
     frameWindow.print();
 }
 var removePrintArea = function (id) {
@@ -387,8 +389,8 @@ function openWebSocket() {
         //注意ws、wss使用不同的端口。我使用自签名的证书测试,
         //无法使用wss,浏览器打开WebSocket时报错
         //ws对应http、wss对应https。
-        webSocket = new WebSocket("ws://183.62.225.124:8080/ws/server/"+storeId);
-        // webSocket = new WebSocket("ws://127.0.0.1:8080/ws/server/"+storeId);
+        // webSocket = new WebSocket("ws://183.62.225.124:8080/ws/server/"+storeId);
+        webSocket = new WebSocket("ws://127.0.0.1:8080/ws/server/"+storeId);
         if (webSocket.readyState === webSocket.CONNECTING) {
             console.log('1.连接正在打开......');
         }