pengjingzhao 1 månad sedan
förälder
incheckning
876aa20cbc
1 ändrade filer med 51 tillägg och 0 borttagningar
  1. 51 0
      src/main/resources/static/js/mz/toll_administration.js

+ 51 - 0
src/main/resources/static/js/mz/toll_administration.js

@@ -105,7 +105,56 @@ $(function () {
         consume();
     });
 });
+function getCurrentTime() {
+    const now = new Date();
+    const year = now.getFullYear().toString();
+    const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始
+    const day = String(now.getDate()).padStart(2, '0');
+    const hours = String(now.getHours()).padStart(2, '0');
+    const minutes = String(now.getMinutes()).padStart(2, '0');
+    const seconds = String(now.getSeconds()).padStart(2, '0');
+
+    return `${year}${month}${day}${hours}${minutes}${seconds}`;
+};
+function getEBill(serialNo) {
+    $.ajax({
+        type: "POST",
+        url: 'http://130.150.161.72:9206/thyy/api/public/ebill/invoicequery',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        data: JSON.stringify({
+            "timestamp":this.getCurrentTime(),
+            "busseqno":serialNo,
+        }),
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            // console.log('getEBill',res);
+            if(res.code == 1 && res.data.invoice_url){
+                successMesageSimaple("电子发票查询成功!")
+            }
+        }
+    })
+};
 
+
+function downloadEBill(serialNo) {
+    $.ajax({
+        type: "POST",
+        url: 'http://130.150.161.72:9206/thyy/api/public/ebill/invoicedownload',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        data: JSON.stringify({
+            "timestamp":this.getCurrentTime(),
+            "busseqno": serialNo,
+        }),
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if(res.code == 1 && res.data.invoicefiledata){
+                base64toPDF(res.data.invoicefiledata)
+            }
+        }
+    })
+};
 /**
  * 列表类型按钮切换事件
  * @param object
@@ -553,6 +602,8 @@ function initFeeTable() {
                         if(fpVsesionNo == 1){
                             str += '<button type="button" class="registration-no-color-foot-button" title="上传电子发票" onclick="printDzfp(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo +',1'+ ');" style="color: #35D082;"><i class="fa fa-upload"></i></button>';
                             str += '<button type="button" class="registration-no-color-foot-button"title="下载电子发票" onclick="openDzfpDownModal(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ',1'+')"><i class="fa fa-download"></i></button>';
+                            str += '<button type="button" class="registration-no-color-foot-button"title="查询电子发票" onclick="getEBill(\'' + row.serialNo+ '\',)"><i class="fa fa-search"></i></button>';
+                            str += '<button type="button" class="registration-no-color-foot-button"title="下载电子发票" onclick="downloadEBill(\'' + row.serialNo+ '\',)"><i class="fa fa-download"></i></button>';
                         }
 
                         str += '<button type="button" class="registration-no-color-foot-button"title="支付明细" onclick="depositFileList(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ')"><i class="fa fa-th-list"></i></button>';