qx
qx
2025-04-15 d65aa7fee641733e13fcbcd6c326d6bd27a45d96
src/views/reservation/reservations/index.vue
@@ -857,9 +857,19 @@
                  "
                >
                  <el-table :data="tableData1" border style="width: 100%">
                    <el-table-column prop="proName" label="项目" width="180" align="center">
                    <el-table-column
                      prop="proName"
                      label="项目"
                      width="180"
                      align="center"
                    >
                    </el-table-column>
                    <el-table-column prop="proType" label="性别" width="50" align="center">
                    <el-table-column
                      prop="proType"
                      label="性别"
                      width="50"
                      align="center"
                    >
                      <template slot-scope="scope">
                        <template v-if="isAll(scope.row.proType)">
                          全部
@@ -873,7 +883,11 @@
                      </template>
                    </el-table-column>
                    <el-table-column prop="ordPrice" label="应收金额" align="center">
                    <el-table-column
                      prop="ordPrice"
                      label="应收金额"
                      align="center"
                    >
                    </el-table-column>
                    <el-table-column label="折扣" width="160px" align="center">
                      <template slot-scope="scope">
@@ -887,14 +901,22 @@
                          :step="0.1"
                          :max="10"
                          :min="0"
                          :disabled="true"
                          :disabled="true"
                        >
                        </el-input-number>
                      </template>
                    </el-table-column>
                    <el-table-column prop="nowPrice" label="实收金额" align="center">
                    <el-table-column
                      prop="nowPrice"
                      label="实收金额"
                      align="center"
                    >
                    </el-table-column>
                    <el-table-column prop="proCheckMethod" label="是否空腹" align="center">
                    <el-table-column
                      prop="proCheckMethod"
                      label="是否空腹"
                      align="center"
                    >
                      <template slot-scope="scope">
                        <dict-tag
                          :options="dict.type.sys_yes_no"
@@ -1079,7 +1101,7 @@
              </div>
            </el-col>
          </el-row>
          <el-dialog
            title="导检单预览"
            :visible.sync="dialogVisibles"
@@ -1097,7 +1119,6 @@
        </div>
      </template>
    </el-drawer>
    <el-dialog
      title="PDF 预览"
@@ -1611,9 +1632,19 @@
                  "
                >
                  <el-table :data="tableData1" border style="width: 100%">
                    <el-table-column prop="proName" label="项目" width="180" align="center">
                    <el-table-column
                      prop="proName"
                      label="项目"
                      width="180"
                      align="center"
                    >
                    </el-table-column>
                    <el-table-column prop="proType" label="性别" width="50" align="center">
                    <el-table-column
                      prop="proType"
                      label="性别"
                      width="50"
                      align="center"
                    >
                      <template slot-scope="scope">
                        <template v-if="isAll(scope.row.proType)">
                          全部
@@ -1627,7 +1658,11 @@
                      </template>
                    </el-table-column>
                    <el-table-column prop="ordPrice" label="应收金额" align="center">
                    <el-table-column
                      prop="ordPrice"
                      label="应收金额"
                      align="center"
                    >
                    </el-table-column>
                    <el-table-column label="折扣" width="160px" align="center">
                      <template slot-scope="scope">
@@ -1641,14 +1676,22 @@
                          :step="0.1"
                          :max="10"
                          :min="0"
                          :disabled="true"
                          :disabled="true"
                        >
                        </el-input-number>
                      </template>
                    </el-table-column>
                    <el-table-column prop="nowPrice" label="实收金额" align="center">
                    <el-table-column
                      prop="nowPrice"
                      label="实收金额"
                      align="center"
                    >
                    </el-table-column>
                    <el-table-column prop="proCheckMethod" label="是否空腹" align="center">
                    <el-table-column
                      prop="proCheckMethod"
                      label="是否空腹"
                      align="center"
                    >
                      <template slot-scope="scope">
                        <dict-tag
                          :options="dict.type.sys_yes_no"
@@ -1853,10 +1896,9 @@
</template>
<script>
import { addComp,
  addPlOrderAndDetail } from "@/api/system/comp";
import { addComp, addPlOrderAndDetail } from "@/api/system/comp";
import Big from "big.js";
import { Loading } from "element-ui";
import {
  listReservation,
  gettjCancel,
@@ -1934,7 +1976,7 @@
      url: "",
      open2: false,
      forms: {
        tjCategory:"12"
        tjCategory: "12",
      },
      dialogVisible: false,
      /** 照相机弹窗模块-start */
@@ -1993,7 +2035,7 @@
      // 是否显示弹出层
      pacId: "",
      cusIds:[],
      cusIds: [],
      // 结果
      result: "",
      proIds: [],
@@ -2682,92 +2724,107 @@
      this.open2 = true;
    },
    submitType() {
      // let cusIds = [];
      // this.selectList.forEach((item) => {
      //   cusIds.push(item.idCard);
      // });
      let loadingInstance1 = Loading.service({
        fullscreen: true,
        text: "签到中",
      });
      let data = {
        cusIds: this.cusIds,
        tjCategory: this.forms.tjCategory,
      };
      this.open2 = false;
      addPlOrderAndDetail(data).then((res) => {
        this.open2 = false;
        this.$modal.msgSuccess("签到成功");
        if (res.file) {
          let base64 = res.file;
          this.base64ToBlob({
            b64data: base64,
            contentType: "application/pdf",
          }).then((res) => {
            this.dialogVisible = true;
            // 转后后的blob对象
            try {
              this.url = res.preview;
            } catch (error) {
              this.url = window.webkitURL.createObjectURL(res.preview);
        if (res.code == 200) {
          this.open2 = false;
          this.$modal.msgSuccess("签到成功");
          if (res.file) {
            let base64 = res.file;
            this.base64ToBlob({
              b64data: base64,
              contentType: "application/pdf",
            }).then((res) => {
              this.dialogVisible = true;
              // 转后后的blob对象
              try {
                this.url = res.preview;
              } catch (error) {
                this.url = window.webkitURL.createObjectURL(res.preview);
              }
            });
          } else {
            let _this = this;
            this.$nextTick(() => {
              // 以服务的方式调用的 Loading 需要异步关闭
              loadingInstance1.close();
            });
            var websocket = null;
            var url = _this.valueUrls;
            if ("WebSocket" in window) {
              websocket = new WebSocket(url);
            } else if ("MozWebSocket" in window) {
              websocket = new MozWebSocket(url);
            } else {
            }
          });
        }else{
          let _this = this;
        var websocket = null;
        var url = _this.valueUrls;
        if ("WebSocket" in window) {
          websocket = new WebSocket(url);
        } else if ("MozWebSocket" in window) {
          websocket = new MozWebSocket(url);
        } else {
        }
        if (websocket == null) {
          alert("11111");
        }
        websocket.onopen = function () {
          try {
            // 连接设备
            var jsonObjs = {
              type: 4,
              data: res,
            };
            var jStrs = JSON.stringify(jsonObjs);
            websocket.send(jStrs);
          } catch (err) {
            var tryTime = 0;
            // 重试10次,每次之间间隔3秒
            if (tryTime < 1) {
              var t1 = setTimeout(function () {
                tryTime++;
            if (websocket == null) {
              alert("11111");
            }
            websocket.onopen = function () {
              console.log('res',res);
              try {
                // 连接设备
                var jsonObjs = {
                  type: 4,
                  data: res,
                };
                var jStrs = JSON.stringify(jsonObjs);
                websocket.send(jStrs);
              }, 1 * 1000);
            } else {
              console.error("重连失败.");
            }
          }
        };
        websocket.onclose = function () {
          alert("连接关闭");
        };
        websocket.onmessage = function (event) {
          var resultObj = JSON.parse(event.data);
          _this.cardreader = false;
        };
              } catch (err) {
                var tryTime = 0;
                // 重试10次,每次之间间隔3秒
                if (tryTime < 1) {
                  var t1 = setTimeout(function () {
                    tryTime++;
                    var jsonObjs = {
                      type: 4,
                      data: res,
                    };
                    var jStrs = JSON.stringify(jsonObjs);
                    websocket.send(jStrs);
                  }, 1 * 1000);
                } else {
                  console.error("重连失败.");
                }
              }
            };
            websocket.onclose = function () {
              alert("连接关闭");
            };
            websocket.onmessage = function (event) {
              var resultObj = JSON.parse(event.data);
              _this.cardreader = false;
            };
        //连接发生错误的回调方法
        websocket.onerror = function () {
          alert("请检查连接是否正常");
        };
          this.getList()
            //连接发生错误的回调方法
            websocket.onerror = function () {
              alert("请检查连接是否正常");
            };
            this.getList();
          }
        } else {
          this.$nextTick(() => {
            // 以服务的方式调用的 Loading 需要异步关闭
            loadingInstance1.close();
          });
        }
      });
    },
    base64ToBlob({ b64data = "", contentType = "", sliceSize = 512 } = {}) {
      return new Promise((resolve, reject) => {
@@ -3194,8 +3251,6 @@
  height: 700px;
  overflow: hidden;
}
#printIframe::-webkit-scrollbar {
  width: 6px;