<template>
  <view class="Scanning_code" v-if="infoDATA.emergencyType">
    <view class="Scanning_top">
      <view class="Scanning_top_icon">
        <text class="cubeic-ok newicon newicon-duigou"></text>
      </view>
      <view class="Scanning_top_text">
        <view class="text1" v-if="infoDATA.gdState.value != '6'">签到成功</view>
        <view class="text1" v-if="infoDATA.gdState.value == '6'">扫描成功</view>
        <!-- 工单状态->value -->
        <!-- 待抢单-2，待接单-3，带到达-4，待送达-5，待评价-6，已完成-7，执行中-8 -->
        <view class="text2">
          您已到达
          <text style="font-weight: 600" v-if="
              infoType == 'plan-spe-ddd-1' ||
              infoType == 'spe-ddd-1' ||
              infoType == 'plan-spe-ddd-2' ||
              infoType == 'spe-ddd-2' ||
              infoType == 'drug-ddd-2' ||
              infoType == 'jp-ddd-2'
            ">{{ infoDATA.startDept.dept }}</text>
          <text style="font-weight: 600"
            v-if="infoType == 'drug-dsd-2' || infoType == 'jp-dsd-2'">{{ infoDATA.endDepts[0].dept }}</text>
          <text style="font-weight: 600" v-if="
              infoType == 'plan-spe-dsd-2' ||
              infoType == 'plan-spe-dsd-3' ||
              infoType == 'plan-spe-dsd-1' ||
              infoType == 'spe-dsd-2' ||
              infoType == 'spe-dsd-3' ||
              infoType == 'spe-dsd-1' ||
              infoType == 'ins-zxz-1' ||
              infoType == 'ins-dsd-1' ||
              infoType == 'trans-dsd-1' ||
              (infoType == 'qt-ddd-1' && infoDATA.gdState.value == '5') ||
              infoDATA.gdState.value == '6' ||
              infoDATA.gdState.value == '8'
            ">{{ DEPT }}</text>
          <text v-if="
              infoType == 'ins-zxz-1' ||
              infoType == 'ins-dsd-1' ||
              infoType == 'trans-dsd-1'
            ">, 请扫描患者腕带</text>
          <text v-if="
              infoType == 'plan-spe-ddd-2' ||
              infoType == 'spe-ddd-2' ||
              infoType == 'spe-ddd-1' ||
              infoType == 'plan-spe-ddd-1'
            ">,请取标本</text>
          <text v-if="infoType == 'drug-ddd-2' || infoType == 'jp-ddd-2'">, 请取药包</text>
          <text v-if="infoType == 'drug-dsd-2' || infoType == 'jp-dsd-2'">, 请放置药包</text>
          <text v-if="
              (infoType == 'spe-dsd-3' && infoDATA.gdState.value == '5') ||
              (infoType == 'plan-spe-dsd-3' && infoDATA.gdState.value == '5')
            ">,请扫描标本</text>
          <text v-if="
              infoType == 'plan-spe-dsd-1' ||
              infoType == 'plan-spe-dsd-2' ||
              (infoType == 'plan-spe-dsd-2' && infoDATA.gdState.value == '5') ||
              infoType == 'spe-dsd-1' ||
              infoType == 'spe-dsd-2' ||
              (infoType == 'spe-dsd-2' && infoDATA.gdState.value == '5')
            ">,请放置标本</text>
        </view>
        <text v-if="infoType == 'qt-dsd-1'">工单已完成。</text>
      </view>
    </view>
    <view class="page_item footerOtherMargin">
      <view class="page_item_top">
        <view class="page_item_top_L">
          <text class="L_text">单号:{{ infoDATA.gdcode }}</text>
          <view class="page_item_cont_start emergency1" v-if="infoDATA.emergencyType.value == 1">
            <text class="page_item_cont_start_txt">
              <text class="cubeic-star newicon newicon-shiwujiaoxing" style="font-size: 14px"></text>
              {{ infoDATA.emergencyType.name }}
            </text>
          </view>
          <view class="page_item_cont_start emergency" v-if="infoDATA.emergencyType.value == 2">
            <text class="page_item_cont_start_txt">
              <text class="cubeic-star newicon newicon-shiwujiaoxing" style="font-size: 14px"></text>
              {{ infoDATA.emergencyType.name }}
            </text>
          </view>
          <view class="page_item_cont_start emergencys" v-if="infoDATA.emergencyType.value == 3">
            <text class="page_item_cont_start_txt">
              <text class="cubeic-star newicon newicon-shiwujiaoxing" style="font-size: 14px"></text>
              {{ infoDATA.emergencyType.name }}
            </text>
          </view>
        </view>
        <view class="page_item_top_R">
          <text class="L_iocn"
            v-if="!(infoDATA.gdState.value == '5'&&infoDATA.taskType.associationType.value == 'inspect')">{{ infoDATA.gdState.name }}</text>
          <text class="L_iocn"
            v-if="infoDATA.gdState.value == '5'&&infoDATA.taskType.associationType.value == 'inspect'">待送回</text>
        </view>

        <view class="L"></view>
        <view class="R"></view>
      </view>
      <view class="page_item_cont">
        <view class="page_item_cont_T">
          <view class="page_item_cont_title">
            <text> <text class="starting">起</text> 点科室 </text>
            <text class="text_big">{{ infoDATA.startDept.dept }}</text>
          </view>
        </view>
        <view class="line"></view>
        <view class="page_item_cont_B">
          <view class="page_item_cont_title" v-for="(dept, i) in infoDATA.middleDept" :key="'middleDept-' + i">
            <view v-if="infoDATA.taskType.associationType.value == 'inspect'">
              <text> <text class="End">检</text> 查科室 </text>
              <text class="text_big">{{ dept.dept }}</text>
            </view>
          </view>
          <view class="page_item_cont_title" v-for="(dept, i) in infoDATA.endDepts" :key="'endDepts-' + i">
            <view v-if="infoDATA.taskType.associationType.value != 'inspect'">
              <text> <text class="End">终</text> 点科室 </text>
              <text class="text_big">{{ dept.dept }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="page_item_foot">
        <view class="page_item_foot_text" v-if="accountObj && (infoType === 'drug-ddd-1' || infoType === 'drug-dsd-1')">
          <text class="text1">交接人工号</text>
          <text class="text2">{{ accountObj.account }}</text>
        </view>
        <view class="page_item_foot_text" v-if="accountObj && (infoType === 'drug-ddd-1' || infoType === 'drug-dsd-1')">
          <text class="text1">交接人姓名</text>
          <text class="text2">{{ accountObj.accountName }}</text>
        </view>
        <view class="page_item_foot_text">
          <text class="text1">状态</text>
          <text class="text2"
            v-if="!(infoDATA.gdState.value == '5'&&infoDATA.taskType.associationType.value == 'inspect')">{{ infoDATA.gdState.name }}</text>
          <text class="text2"
            v-if="infoDATA.gdState.value == '5'&&infoDATA.taskType.associationType.value == 'inspect'">待送回</text>
        </view>
        <view class="page_item_foot_text">
          <text class="text1">关联类型</text>
          <text class="text2">{{ infoDATA.taskType.associationType.name }}</text>
        </view>
        <view class="page_item_foot_text">
          <text class="text1">任务类型</text>
          <text class="text2">{{ infoDATA.taskType.taskName }}</text>
        </view>
        <view class="page_item_foot_text" v-if="infoDATA.taskType.associationType.value==='inspect'">
          <text class="text1">是否半程陪检</text>
          <text class="text2">{{ infoDATA.isHalfInspect===1?'是':'否' }}</text>
        </view>
        <view class="page_item_foot_text" v-if="infoDATA.gdState.value == '2'">
          <text class="text1">预计响应时间</text>
          <text class="text2">{{ infoDATA.estimeResponseTime || '无' }}</text>
        </view>
        <view class="page_item_foot_text" v-if="infoDATA.gdState.value == '5'">
          <text class="text1" v-if="!(infoDATA.taskType.associationType.value == 'inspect')">预计送达时间</text>
          <text class="text1" v-if="infoDATA.taskType.associationType.value == 'inspect'">预计送回时间</text>
          <text class="text2">{{ infoDATA.estimeCompleteTime || '无' }}</text>
        </view>
        <view class="page_item_foot_text" v-if="infoDATA.gdState.value == '4'">
          <text class="text1">预计到达时间</text>
          <text class="text2">{{ infoDATA.estimateArriveTime || '无' }}</text>
        </view>
        <view class="page_item_foot_text">
          <text class="text1">创建时间</text>
          <text class="text2">{{ infoDATA.startTime || '无' }}</text>
        </view>
        <view class="page_item_foot_text" v-if="
            infoDATA.taskType.associationType.value == 'inspect' ||
            infoDATA.taskType.associationType.value == 'patientTransport'
          ">
          <text class="text1">携带设备</text>
          <text class="text2">{{ infoDATA.goods || "暂无" }}</text>
        </view>
        <view class="page_item_foot_text" v-if="
            infoDATA.taskType.associationType.value == 'inspect' ||
            infoDATA.taskType.associationType.value == 'patientTransport'
          ">
          <text class="text1">患者姓名</text>
          <text class="text2">{{ infoDATA.patient.patientName }}({{
              infoDATA.patient.residenceNo
            }})</text>
        </view>
      </view>
      <!-- 药包 -->
      <view class="page_item_info" v-if="infoDATA.taskType.associationType.value == 'drugsBag'">
        <text class="page_item_info_title">药包信息</text>
        <text class="text">#{{ infoDATA.drugs.packid }}</text>
      </view>
      <!-- 标本 送达-->
      <view class="page_item_info" v-if="
          infoDATA.taskType.associationType.value == 'specimen' ||
          infoDATA.taskType.associationType.value == 'specimenPlan'
        ">
        <!-- <text class="page_item_info_title">标本信息</text> -->
        <!-- <text class="text" v-if="
            infoType == 'plan-spe-ddd-1' ||
            infoType == 'plan-spe-dsd-2' ||
            infoType == 'spe-ddd-1' ||
            infoType == 'spe-dsd-2'
          ">
          预计标本总数
          <text class="text_span">{{ infoDATA.expectReceiveNum || 0 }}</text>
        </text>
        <text class="text" v-if="
            (infoType == 'plan-spe-ddd-2' && infoDATA.gdState.value == '4') ||
            (infoType == 'spe-ddd-2' && infoDATA.gdState.value == '4')
          ">
          预计标本总数
          <text>{{ infoDATA.expectReceiveNum || 0 }}</text>
        </text>
        <text class="text" v-if="
            (infoType == 'plan-spe-dsd-2' && infoDATA.gdState.value == '6') ||
            (infoType == 'spe-dsd-2' && infoDATA.gdState.value == '6')
          ">
          已扫描标本总数
          <text>{{ infoDATA.actualReceiveNum || 0 }}</text>
        </text>
        <text class="text" v-if="
            (infoType == 'plan-spe-dsd-3' && infoDATA.gdState.value == '5') ||
            (infoType == 'spe-dsd-3' && infoDATA.gdState.value == '5')
          ">
          已收取标本总数
          <text>{{ infoDATA.actualReceiveNum || 0 }}</text>
        </text> -->
      </view>
      <!-- 静配 -->
      <view class="page_item_info" v-if="infoDATA.taskType.associationType.value == 'jPBag'">
        <text class="page_item_info_title">静配信息</text>
        <text class="text">#{{ infoDATA.staticDistri.packid }}</text>
      </view>
      <!-- 陪检 -->
      <view v-if="infoDATA.taskType.associationType.value == 'inspect'">
        <view class="page_item_info">
          <text class="page_item_info_title">检查信息</text>
        </view>
        <view id="infos" :animation="animationData">
          <view class="page_item_infos" v-for="(item, i) of infoDATA.checkList" :key="i">
            <view class="page_item_info2">
              <view class="page_item_foot_text">
                <text class="text1">检查科室</text>
                <text class="text2">{{ item.execDept.dept }}</text>
              </view>
              <view class="page_item_foot_text">
                <text class="text1">检查项</text>
                <text class="text2">{{ item.inspectName }}</text>
              </view>
              <view class="page_item_foot_text">
                <text class="text1">预约时间</text>
                <text class="text2">{{ item.yyTime || "-" }}</text>
              </view>
            </view>
          </view>
        </view>
        <view id="pulldown" @click="show('show')" v-if="showType == 'hiddle'">
          点击可查看检查详情
          <text class="cubeic-pulldown newicon newicon-paixujiantouxia"></text>
        </view>
        <view id="pullup" @click="show('hiddle')" v-if="showType == 'show'">
          点击可收起检查详情
          <text class="cubeic-pullup newicon newicon-paixujiantoushang"></text>
        </view>
      </view>
    </view>

    <view class="foot_btn2 footerPadding" v-if="infoType == 'plan-spe-ddd-1' || infoType == 'spe-ddd-1'">
      <view class="btn2" @click="Scanning_complete(dataId)">返回</view>
    </view>
    <view class="foot_btn1 footerPadding" v-if="
        (infoType == 'plan-spe-dsd-1' && infoDATA.gdState.value == '5') ||
        (infoType == 'spe-dsd-1' && infoDATA.gdState.value == '5')
      ">
      <view class="btn1" @click="Scanning_complete(dataId)">工单完成</view>
      <view class="btn2" @click="showAlert">继续配送</view>
    </view>
    <view class="foot_btn1 footerPadding" v-if="
        (infoType == 'plan-spe-ddd-2' && infoDATA.gdState.value == '4') ||
        (infoType == 'spe-ddd-2' && infoDATA.gdState.value == '4')
      ">
      <view class="btn1" @click="Scanning_again(dataId)" v-if="
          infoDATA.taskType.associationType.value == 'specimen' ||
          infoDATA.taskType.associationType.value == 'specimenPlan'
        ">扫描标本</view>
      <view class="btn1" @click="Scanning_again(dataId)" v-if="
          infoDATA.taskType.associationType.value == 'jPBag' ||
          infoDATA.taskType.associationType.value == 'drugsBag'
        ">扫描药包</view>
    </view>
    <view class="foot_btn1 footerPadding" v-if="
        (infoType == 'plan-spe-dsd-3' && infoDATA.gdState.value == '5') ||
        (infoType == 'spe-dsd-3' && infoDATA.gdState.value == '5')
      ">
      <view class="btn1" @click="Scanning_again(dataId)" v-if="
          infoDATA.taskType.associationType.value == 'specimen' ||
          infoDATA.taskType.associationType.value == 'specimenPlan'
        ">扫描标本</view>
      <view class="btn1" @click="Scanning_again(dataId)" v-if="
          infoDATA.taskType.associationType.value == 'jPBag' ||
          infoDATA.taskType.associationType.value == 'drugsBag'
        ">扫描药包</view>
      <view class="btn2" @click="Scanning_complete1(dataId)">完成工单</view>
    </view>
    <view class="foot_btn2 footerPadding" v-if="
        infoType == 'plan-spe-ddd-2' ||
        infoType == 'plan-spe-dsd-2' ||
        (infoType == 'plan-spe-dsd-3' && infoDATA.gdState.value == '5') ||
        infoType == 'spe-ddd-2' ||
        infoType == 'spe-dsd-2' ||
        (infoType == 'spe-dsd-3' && infoDATA.gdState.value == '5')
      ">
      <view class="btn3" @click="Scanning_again(dataId)">继续扫描</view>
      <view class="btn3" @click="showHandViewSpecimen()">手动录入</view>
      <view class="btn3" v-if="infoDATA.taskType.isDigitalHandover==1" @click="checkNumber(infoDATA)">数量核对</view>
      <view class="btn3" @click="next()" v-if="queryObj.fromSpecimenBuild">下一步</view>
    </view>
    <view class="foot_btn2 footerPadding" v-if="
        infoType == 'ins-dsd-1' ||
        infoType == 'ins-zxz-1' ||
        infoType == 'trans-dsd-1'
      ">
      <view class="btn3" @click="Scanning_again(dataId)">继续扫描患者腕带</view>
      <view class="btn3" @click="photograph(infoDATA, { DEPTCode, DEPT, infoType })">拍照</view>
    </view>
    <view class="foot_btn2 footerPadding" v-if="
        infoType == 'plan-spe-ddd-1' ||
        infoType == 'spe-ddd-1' ||
        infoDATA.gdState.value == '6'
      ">
      <view class="btn2" @click="showAlert">返回</view>
    </view>
    <view class="foot_btn2 footerPadding" v-if="
        infoType == 'drug-ddd-2' ||
        infoType == 'drug-dsd-2' ||
        infoType == 'jp-ddd-2' ||
        infoType == 'jp-dsd-2'
      ">
      <view class="btn2" @click="Scanning_again(dataId)">继续扫描</view>
      <view class="btn3" @click="showHandViewDrugsbag()">手动录入</view>
    </view>
    <view class="foot_btn2 footerPadding" v-if="
        infoType == 'drug-ddd-1' ||
        infoType == 'drug-dsd-1' ||
        infoType == 'jp-ddd-1' ||
        infoType == 'jp-dsd-1'
      ">
      <view class="btn2" @click="showAlert">返回</view>
    </view>
    <view class="foot_btn2 footerPadding" v-if="infoType == 'qt-ddd-1' && infoDATA.gdState.value == '5'">
      <view class="btn2" @click="showAlert">返回</view>
    </view>
    <!-- 弹窗 -->
    <showModel :title="models.title" :icon="models.icon" :disjunctor="models.disjunctor" :content="models.content"
      @ok="ok" @cancel="cancel" :operate="models.operate"></showModel>
    <!-- 手动查询标本弹窗 -->
    <handViewSpecimen v-if="speModels.disjunctor" :title="speModels.title" :disjunctor="speModels.disjunctor"
      @ok="speOk" @cancel="speCancel">
    </handViewSpecimen>
    <!-- 手动查询药品弹窗 -->
    <handViewDrugsBag v-if="drugbagModels.disjunctor" :title="drugbagModels.title"
      :disjunctor="drugbagModels.disjunctor" @ok="drugbagOk" @cancel="drugbagCancel">
    </handViewDrugsBag>
    <!-- 修改标本数量弹窗 -->
    <changeSpeNum v-if="changeSpeModels.disjunctor" :operate="{ok:'确认数量',check:'详细核对',cancel:'取消'}" :title="changeSpeModels.title" :content="changeSpeModels.content"
      :disjunctor="changeSpeModels.disjunctor" @ok="changeSpeOk" @check="changeSpeCheck" @cancel="changeSpeCancel" :num="speNumChange" :modifyReason="modifyReason" :isFirstShowReason="false">
    </changeSpeNum>
		<!-- 调查问卷二维码 -->
		 <questionCode v-if="isQuestionModel" :orderId="infoDATA.id" @know="isQuestionModel = false"></questionCode>
		<!-- PDA扫描 -->
		<scanner></scanner>
	</view>
</template>
<script>
	import scanner from "../../components/scanner/scanner.vue";
  import showModel from "../../components/showModel/showModel.vue";
	import questionCode from "../../components/questionCode/questionCode.vue";
  import {
    get,
    post,
    SM,
    webHandle
  } from "../../http/http.js";
  import {
    photographTool
  } from "../../tools/photograph.js";
  export default {
		components:{
			questionCode,
			scanner
		},
    data() {
      return {
        // 终点科室标红
        isEndDeptRed: false,
				// 调研二维码
				isQuestionModel:false,
        speNumChange: 0,
        modifyReason:'',
        changeSpeObj: {},
        // 修改标本数量弹窗model
        changeSpeModels: {
          disjunctor: false,
        },
        currentCode: '', //当前小扫描的科室二维码
        // 手动查询标本弹窗model
        speModels: {
          disjunctor: false,
        },
        // 手动查询药品弹窗model
        drugbagModels: {
          disjunctor: false,
        },
        SMFlag: true,
        // 交接人信息
        accountObj: undefined,
        deptId: undefined,
        // 完成工单的id
        wcId: "",
        // 弹窗model
        models: {
          disjunctor: false,
        },
        modelFlag: "", //完成工单标识
        animationData: {},
        showType: "hiddle",
        infoDATA: {},
        infoType: "",
        DEPTCode: "",
        DEPT: "",
        dataId: "",
        queryObj: {}, //路由传过来的对象
      };
    },
    methods: {
      // 修改标本数量-核对
      changeSpeCheck(){
        console.log(this.infoDATA);
        this.changeSpeModels.disjunctor = false;
        let deptId = this.queryObj.deptId;
        let endDepts = this.queryObj.endDepts;
        if (deptId) {
          // 小扫描
          uni.navigateTo({
            url: `/pages/specimenCheckingDetail/specimenCheckingDetail?infoDATA=${encodeURIComponent(JSON.stringify({startDept:this.infoDATA.startDept.id,uuid:this.infoDATA.id}))}&id=${deptId}&t=small&gdState=${this.infoDATA.gdState.value}&endDepts=${endDepts}`
          })
        } else {
          // 快捷建单进入小扫描
          uni.navigateTo({
            url: `/pages/specimenCheckingDetail/specimenCheckingDetail?infoDATA=${encodeURIComponent(JSON.stringify({startDept:this.infoDATA.startDept.id,uuid:this.infoDATA.id}))}&id=${deptId}&t=small&endDepts=${endDepts}`
          })
        }
      },
      // 修改标本数量-确认
      changeSpeOk(data) {
        console.log(data);
        const pathUrl = uni.getStorageSync("path");
        const {
          speNum,
          reason,
          imageValue
        } = data;
        this.changeSpeModels.disjunctor = false;
        uni.showLoading({
          mask: true,
          title: "加载中",
        });
        let postData = {
          checkDept: this.changeSpeObj.endDepts, //终点科室
          transDeptId: this.changeSpeObj.infoDATA.startDept,
          gdId: this.changeSpeObj.infoDATA.uuid,
          deptId: this.changeSpeObj.id == "undefined" ?
            this.changeSpeObj.infoDATA.startDept : this.changeSpeObj.id,
          specimensNum: speNum,
          modifyReason: reason,
        };
        post("/api/updateCheckDeptSpecimensNum", postData).then((res) => {
          if (res.status == 200) {
            console.log(imageValue);
            if (!imageValue.length) {
              uni.hideLoading();
              if (this.changeSpeObj.t == "big") {
                if (this.changeSpeObj.gdState == 4) {
                  // 待到达
                  uni.navigateTo({
                    url: `../../pages/receiptpage/receiptpage`,
                  });
                } else if (this.changeSpeObj.gdState == 5) {
                  // 待送达
                  if (res.type1 === "plan-spe-ddd-2") {} else {
                    let content = `本工单已签到<strong class="red">${
                    res.scanSet ? res.scanSet.join("、") : ""
                  }</strong>，剩余需签到科室<strong class="red">${
                    res.notScanSet ? res.notScanSet.join("、") : ""
                  }</strong>，您确定完成工单吗？`;
                    uni.navigateTo({
                      url: `../scanning/scanning?type=${res.type}&type1=${
                      res.type1
                    }&id=${encodeURIComponent(
                      JSON.stringify([res.gdid])
                    )}&content=${content}`,
                    });
                  }
                }
              } else if (this.changeSpeObj.t == "small") {
                if (this.changeSpeObj.id == "undefined") {
                  //快捷建单建单进入
                  uni.navigateTo({
                    url: `../../pages/receiptpage/receiptpage`,
                  });
                } else {
                  if (this.changeSpeObj.gdState == 4) {
                    // 待到达
                    uni.navigateTo({
                      url: `../../pages/receiptpage/receiptpage`,
                    });
                  } else if (this.changeSpeObj.gdState == 5) {
                    // 待送达
                    if (res.type1 === "plan-spe-ddd-2") {} else {
                      let content = `本工单已签到<strong class="red">${
                      res.scanSet ? res.scanSet.join("、") : ""
                    }</strong>，剩余需签到科室<strong class="red">${
                      res.notScanSet ? res.notScanSet.join("、") : ""
                    }</strong>，您确定完成工单吗？`;
                      uni.navigateTo({
                        url: `../scanning/scanning?type=${res.type}&type1=${
                        res.type1
                      }&id=${encodeURIComponent(
                        JSON.stringify([res.gdid])
                      )}&content=${content}`,
                      });
                    }
                  }
                }
              } else {
                uni.navigateTo({
                  url: `../../pages/specimenChecking/specimenChecking?infoDATA=${encodeURIComponent(
                  JSON.stringify(this.changeSpeObj.infoDATA)
                )}`,
                });
              }
              return;
            }
            let n = 0;
            imageValue.forEach((v) => {
              // 图片上传 start
              console.log("压缩前");
              let canvasWidth = v.image.width; //图片原始长宽
              let canvasHeight = v.image.height;
              let img = new Image();
              img.src = v.path;
              let canvas = document.createElement("canvas");
              let ctx = canvas.getContext("2d");
              canvas.width = canvasWidth;
              canvas.height = canvasHeight;
              ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight);
              canvas.toBlob(
                (fileSrc) => {
                  let tp = window.URL.createObjectURL(fileSrc);
                  console.log("压缩后");
                  n++;
                  uni.uploadFile({
                    url: pathUrl +
                      "/common/common/uploadAttachment/specimenPhotos/" +
                      res.deptSpecimensNumId +
                      "/666",
                    filePath: tp,
                    name: "file",
                    formData: {
                      filename: v.name,
                    },
                    success: (uploadFileRes) => {
                      console.log(uploadFileRes);
                      if (--n === 0) {
                        uni.hideLoading();
                        if (this.changeSpeObj.t == "big") {
                          if (this.changeSpeObj.gdState == 4) {
                            // 待到达
                            uni.navigateTo({
                              url: `../../pages/receiptpage/receiptpage`,
                            });
                          } else if (this.changeSpeObj.gdState == 5) {
                            // 待送达
                            if (res.type1 === "plan-spe-ddd-2") {} else {
                              let content = `本工单已签到<strong class="red">${
                              res.scanSet ? res.scanSet.join("、") : ""
                            }</strong>，剩余需签到科室<strong class="red">${
                              res.notScanSet ? res.notScanSet.join("、") : ""
                            }</strong>，您确定完成工单吗？`;
                              uni.navigateTo({
                                url: `../scanning/scanning?type=${res.type}&type1=${
                                res.type1
                              }&id=${encodeURIComponent(
                                JSON.stringify([res.gdid])
                              )}&content=${content}`,
                              });
                            }
                          }
                        } else if (this.changeSpeObj.t == "small") {
                          if (this.changeSpeObj.id == "undefined") {
                            //快捷建单建单进入
                            uni.navigateTo({
                              url: `../../pages/receiptpage/receiptpage`,
                            });
                          } else {
                            if (this.changeSpeObj.gdState == 4) {
                              // 待到达
                              uni.navigateTo({
                                url: `../../pages/receiptpage/receiptpage`,
                              });
                            } else if (this.changeSpeObj.gdState == 5) {
                              // 待送达
                              if (res.type1 === "plan-spe-ddd-2") {} else {
                                let content = `本工单已签到<strong class="red">${
                                res.scanSet ? res.scanSet.join("、") : ""
                              }</strong>，剩余需签到科室<strong class="red">${
                                res.notScanSet ? res.notScanSet.join("、") : ""
                              }</strong>，您确定完成工单吗？`;
                                uni.navigateTo({
                                  url: `../scanning/scanning?type=${res.type}&type1=${
                                  res.type1
                                }&id=${encodeURIComponent(
                                  JSON.stringify([res.gdid])
                                )}&content=${content}`,
                                });
                              }
                            }
                          }
                        } else {
                          uni.navigateTo({
                            url: `../../pages/specimenChecking/specimenChecking?infoDATA=${encodeURIComponent(
                            JSON.stringify(this.changeSpeObj.infoDATA)
                          )}`,
                          });
                        }
                      }
                    },
                    fail: (err) => {
                      n--;
                      console.error(err);
                      uni.hideLoading();
                      uni.showToast({
                        icon: "none",
                        title: "上传失败",
                        duration: 2000,
                      });
                    },
                  });
                },
                "image/jpeg",
                0.3
              );
              // 图片上传 end
            });
          } else {
            uni.hideLoading();
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败！",
            });
          }
        });
      },
      // 修改标本数量-取消
      changeSpeCancel() {
        this.changeSpeModels.disjunctor = false;
      },
      // 修改标本数量弹窗
      showChangeSpe() {
        uni.showLoading({
          mask: true,
          title: "加载中",
        });
        let postData = {
          deptId: this.deptId,
          gdId: this.dataId,
        };
        post(`/api/getStartDeptSpecimensNum`, postData).then((res) => {
          uni.hideLoading();
          if (res.status == 200) {
            this.speNumChange = res.data[0].deptSpecimensNum;
            this.modifyReason = res.data[0].modifyReason;
            this.changeSpeModels = {
              title: "修改标本数量",
              content: `您已到达<span class="red">${this.DEPT}</span>本科室标本数量为<span class="red">${this.speNumChange}</span>，请确认标本数量`,
              disjunctor: true,
            };
          } else {
            this.speNumChange = "";
            this.modifyReason = '';
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败！",
            });
          }
        });
      },
      // 数量核对
      checkNumber(infoDATA) {
        let deptId = this.queryObj.deptId;
        let endDepts = this.queryObj.endDepts;
        console.log(endDepts, 'scanning_code');
        // 存数据
        if (deptId) {
          // 小扫描
          this.changeSpeObj = {
            infoDATA: {
              startDept: this.infoDATA.startDept.id,
              uuid: this.infoDATA.id
            },
            id: deptId,
            t: 'small',
            gdState: this.infoDATA.gdState.value,
            endDepts,
          }
        } else {
          // 快捷建单进入小扫描
          this.changeSpeObj = {
            infoDATA: {
              startDept: this.infoDATA.startDept.id,
              uuid: this.infoDATA.id
            },
            id: deptId,
            t: 'small',
            endDepts,
          }
        }
        this.showChangeSpe();
      },
      // 手动查询药品-确认
      drugbagOk(data) {
        console.log(data);
        if (!data.id) {
          //没有查询到药品
          uni.showModal({
            title: '提示',
            content: "没有查询到发药单号！",
            showCancel: false,
            success: function(res) {
              if (res.confirm) {
                console.log('用户点击确定');
              } else if (res.cancel) {
                console.log('用户点击取消');
              }
            }
          });
          return;
        }
        this.drugbagModels.disjunctor = false;
        this.hand_scanning_common(data.packid, 'hand');
      },
      // 手动查询药品-取消
      drugbagCancel() {
        this.drugbagModels.disjunctor = false;
      },
      // 手动查询药品弹窗
      showHandViewDrugsbag() {
        this.drugbagModels = {
          title: '填写发药单号',
          disjunctor: true,
        }
      },
      // 手动查询标本-确认
      speOk(data) {
        console.log(data);
        if (!data.id) {
          //没有查询到标本
          uni.showModal({
            title: '提示',
            content: "没有查询到标本！",
            showCancel: false,
            success: function(res) {
              if (res.confirm) {
                console.log('用户点击确定');
              } else if (res.cancel) {
                console.log('用户点击取消');
              }
            }
          });
          return;
        }
        this.speModels.disjunctor = false;
        this.hand_scanning_common(data.scode, 'hand');
      },
      // 手动查询标本-取消
      speCancel() {
        this.speModels.disjunctor = false;
      },
      // 手动查询标本弹窗
      showHandViewSpecimen() {
        this.speModels = {
          title: '填写标本编码',
          disjunctor: true,
        }
      },
      // 下一步
      next() {
        uni.showLoading({
          title: '加载中',
          mask: true,
        })
        post('/workerOrder/getSpecimenCount', {
          gdId: this.queryObj.id
        }).then(res => {
          get('/api/fetchData/specimen/' + this.queryObj.specimenId).then(ress => {
            uni.hideLoading();
            console.log(ress);
            ress.msg = '成功';
            ress.specimenCount = res.specimenCount;
            ress.type = this.queryObj.type1;
            uni.navigateTo({
              url: `../scanning_Result/scanning_Result?type=${
              this.queryObj.type
            }&type1=${
              this.queryObj.type1
            }&infoData=${encodeURIComponent(
              JSON.stringify(ress.data)
            )}&status=${ress.status}&msg=${ress.msg}&deptCode=${
              this.queryObj.deptCode
            }&dept=${
              this.queryObj.dept
            }&taskTypeId=${
							this.infoDATA.taskType.id
						}&deptId=${this.deptId}&id=${this.dataId}&model=${encodeURIComponent(
              JSON.stringify(ress)
            )}&speNum=${res.specimenCount}`,
            });
          })
        })
      },
      // 拍照
      photograph(data, obj) {
        photographTool(data, obj);
      },
      // 手动输入标本和扫码公共方法,type----scan是扫码，hand是手动录入
      hand_scanning_common(ress1, type) {
        // ----------------
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        //检验二维码的有效性
        post("/dept/scanning", {
          content: ress1,
        }).then((result) => {
          this.SMFlag = true;
          if (result.state == 200 || result.state == 201) {
            this.currentCode = result.code;
            let codes = result.code;
            if (codes) {
              let speCode = codes;
              let data = {
                code: speCode,
                type: this.infoType,
                deptCode: this.DEPTCode,
                ids: [this.dataId],
              };
              let postType = "";
              if (
                this.infoDATA.taskType.associationType.value == "jPBag" ||
                this.infoDATA.taskType.associationType.value == "drugsBag"
              ) {
                postType = "handleDrugsAndJp";
                if(this.infoDATA.taskType.associationType.value == "drugsBag"){
                  delete data.ids;
                }
                if (this.accountObj) {
                  data.handover = this.accountObj.accountId;
                }
                if (this.queryObj.grabOrders) {
                  data.grabOrders = '666';
                }
                data.deptId = this.deptId;
              }
              if (this.infoDATA.taskType.associationType.value == "specimen") {
                data["speCode"] = data.code;
                delete data.code;
                postType = "handleSpes";
              }
              if (
                this.infoDATA.taskType.associationType.value == "specimenPlan"
              ) {
                data["speCode"] = data.code;
                delete data.code;
                postType = "handlePlanSpes";
              }
              if (this.infoDATA.taskType.associationType.value == "inspect") {
                // delete data.type;//seimin
                postType = "handleIns";
              }
              if (
                this.infoDATA.taskType.associationType.value ==
                "patientTransport"
              ) {
                postType = "handleTrans";
              }
              //扫描
              post("/workerOrder/" + postType, data).then((ress) => {
                console.log(ress, 1111)
                if (ress.status == 200 || ress.status == 11111) {
                  //标本和标本轮巡工单，扫描标本后会自动调用摄像头，继续扫描，直到status不是200
                  if ((this.infoDATA.taskType.associationType.value == 'specimen' || this.infoDATA.taskType
                    .associationType.value == 'specimenPlan') && ress.status != 11111) {
                    uni.hideLoading();
                    this.getPageConfigSpecimen((flag, type, ress) => {
                      if(flag){
                        if (type === 'scan') {
                          setTimeout(() => {
														// #ifdef H5
														this.Scanning_again(this.dataId);
														// #endif
                          }, 500)
                        }
                      }

                      uni.navigateTo({
                        url: `../scanning_Result/scanning_Result?type=${
                        this.queryObj.type
                      }&type1=${
                        this.queryObj.type1
                      }&infoData=${encodeURIComponent(
                        JSON.stringify(ress.data)
                      )}&status=${ress.status}&msg=${ress.msg}&deptCode=${
                        this.queryObj.deptCode
                      }&dept=${
                        this.queryObj.dept
                      }&taskTypeId=${
                        this.infoDATA.taskType.id
                      }&deptId=${this.deptId}&id=${this.dataId}&model=${encodeURIComponent(
                        JSON.stringify(ress)
                      )}&speNum=${ress.specimenCount}&scanOrHand=${type}&isEndDeptRed=${this.isEndDeptRed}`,
                      });
                    }, type, ress.data, ress);
                    return;
                  }
                  if (
                    this.infoDATA.taskType.associationType.value == "drugsBag"
                  ) {
                    uni.hideLoading();
                    // --------start----------
                    uni.navigateTo({
                      url: `../scanning_Result/scanning_Result?type=${
                        this.queryObj.type
                      }&type1=${
                        this.queryObj.type1
                      }&infoData=${encodeURIComponent(
                        JSON.stringify(ress.data)
                      )}&status=${ress.status}&msg=${ress.msg}&deptCode=${
                        this.queryObj.deptCode
                      }&dept=${
                        this.queryObj.dept
                      }&taskTypeId=${
												this.infoDATA.taskType.id
												}&id=${this.dataId}&model=${encodeURIComponent(
                        JSON.stringify(ress)
                      )}&accountObj=${encodeURIComponent(JSON.stringify(this.accountObj))}&deptId=${this.deptId}&handover=${this.handover}`,
                    });
                    // ------------end------------
                  } else {
                    uni.hideLoading();
                    // --------start----------
                    if(this.infoDATA.taskType.associationType.value == 'patientTransport' && this.infoDATA.gdState.value == 5){
                      // 门诊服务点,有orderList
                      if(ress.orderList){
                        uni.navigateTo({
                          url: `/pages/outpatient/outpatientEndSignIn/outpatientEndSignIn?model=${encodeURIComponent(JSON.stringify(ress))}`,
                        });
                      }else{
                        // 患者陪检执行中或待送达,患者转运待送达
                        if (
                          ress.type == "ins-zxz-1" ||
                          ress.type == "ins-dsd-1" ||
                          ress.type == "trans-dsd-1"
                        ) {
                          console.log(ress.patientName, "code");
                          uni.navigateTo({
                            url: `../scanning_Result/scanning_Result?type=${
                            this.queryObj.type
                          }&type1=${
                            this.queryObj.type1
                          }&infoData=${encodeURIComponent(
                            JSON.stringify(ress.data)
                          )}&status=${ress.status}&msg=${ress.msg}&patient=${
                            ress.patient
                          }&patientCode=${ress.patientCode}&deptName=${
                            ress.deptName
                          }&bedNum=${ress.bedNum}&deptCode=${
                            this.queryObj.deptCode
                          }&dept=${
                            this.queryObj.dept
                          }&taskTypeId=${
														this.infoDATA.taskType.id
													}&id=${this.dataId}&model=${encodeURIComponent(
                            JSON.stringify(ress)
                          )}`,
                          });
                        } else {
                          uni.navigateTo({
                            url: `../scanning_Result/scanning_Result?type=${
                            this.queryObj.type
                          }&type1=${
                            this.queryObj.type1
                          }&infoData=${encodeURIComponent(
                            JSON.stringify(ress.data)
                          )}&status=${ress.status}&msg=${ress.msg}&deptCode=${
                            this.queryObj.deptCode
                          }&dept=${
                            this.queryObj.dept
                          }&taskTypeId=${
														this.infoDATA.taskType.id
													}&deptId=${this.deptId}&id=${this.dataId}&model=${encodeURIComponent(
                            JSON.stringify(ress)
                          )}&speNum=${ress.specimenCount}&scanOrHand=${type}`,
                          });
                        }
                      }
                    }else{
                      // 患者陪检执行中或待送达,患者转运待送达
                      if (
                        ress.type == "ins-zxz-1" ||
                        ress.type == "ins-dsd-1" ||
                        ress.type == "trans-dsd-1"
                      ) {
                        console.log(ress.patientName, "code");
                        uni.navigateTo({
                          url: `../scanning_Result/scanning_Result?type=${
                          this.queryObj.type
                        }&type1=${
                          this.queryObj.type1
                        }&infoData=${encodeURIComponent(
                          JSON.stringify(ress.data)
                        )}&status=${ress.status}&msg=${ress.msg}&patient=${
                          ress.patient
                        }&patientCode=${ress.patientCode}&deptName=${
                          ress.deptName
                        }&bedNum=${ress.bedNum}&deptCode=${
                          this.queryObj.deptCode
                        }&dept=${
                          this.queryObj.dept
                        }&taskTypeId=${
													this.infoDATA.taskType.id
												}&id=${this.dataId}&model=${encodeURIComponent(
                          JSON.stringify(ress)
                        )}`,
                        });
                      } else {
                        uni.navigateTo({
                          url: `../scanning_Result/scanning_Result?type=${
                          this.queryObj.type
                        }&type1=${
                          this.queryObj.type1
                        }&infoData=${encodeURIComponent(
                          JSON.stringify(ress.data)
                        )}&status=${ress.status}&msg=${ress.msg}&deptCode=${
                          this.queryObj.deptCode
                        }&dept=${
                          this.queryObj.dept
                        }&taskTypeId=${
													this.infoDATA.taskType.id
												}&deptId=${this.deptId}&id=${this.dataId}&model=${encodeURIComponent(
                          JSON.stringify(ress)
                        )}&speNum=${ress.specimenCount}&scanOrHand=${type}`,
                        });
                      }
                    }
                    // ------------end------------
                  }
                } else {
                  uni.hideLoading();
                  uni.navigateTo({
                    url: `../scanning_Result/scanning_Result?type=${
                    this.queryObj.type
                  }&type1=${this.queryObj.type1}&status=${ress.status}&msg=${
                    ress.msg
                  }&deptCode=${this.queryObj.deptCode}&dept=${
                    this.queryObj.dept
                  }&taskTypeId=${
										this.infoDATA.taskType.id
									}&id=${this.dataId}&model=${encodeURIComponent(
                    JSON.stringify(ress)
                  )}&accountObj=${encodeURIComponent(JSON.stringify(this.accountObj))}&deptId=${this.deptId}&handover=${this.handover}&scanOrHand=${type}&qrcode=${this.currentCode}`,
                  });
                }
              });
            }
          } else {
            uni.hideLoading();
            uni.showToast({
              icon: "none",
              title: result.info || "接口获取数据失败！",
            });
          }
        });
        // ------------------------------
      },
      // 扫描
      Scanning_again(id) {
        if (!this.SMFlag) {
          return;
        }
        this.SMFlag = false;
        SM().then((ress1) => {
          this.hand_scanning_common(ress1, 'scan');
        }).catch(err => {
          this.SMFlag = true;
        });
      },
			// pda扫描
			pdaChange(content){
				content = content.replace('\n','')
				this.hand_scanning_common(content, 'scan');
			},
      show(type) {
        this.showType = type;
        if (type === "show") {
          //展开
          // 计算高度
          const query = uni.createSelectorQuery().in(this);
          query
            .selectAll(".page_item_infos")
            .boundingClientRect((data) => {
              let len = data.reduce((prev, current) => {
                return prev + current.height;
              }, 0);
              this.animation.height(len).step();
              this.animationData = this.animation.export();
            })
            .exec();
        } else if (type === "hiddle") {
          this.animation.height(0).step();
          this.animationData = this.animation.export();
        }
      },
      // 确定
      ok() {
        this.models.disjunctor = false;
        if (this.modelFlag == "complete1") {
          //一对多完成扫描
          let ids = [];
          ids.push(this.wcId);
          let data = {
            type: this.infoType,
            ids,
          };
          uni.showLoading({
            title: '加载中',
            mask: true,
          });
          post("/workerOrder/finishSpes", data).then((res) => {
            if (res.status == 200) {
              uni.reLaunch({
                url: "../receiptpage/receiptpage",
              });
            } else {
              uni.hideLoading();
              uni.showToast({
                icon: "none",
                title: res.msg || "接口获取数据失败！",
              });
            }
          });
        } else if (this.modelFlag == "complete") {
          //一对一完成扫描
          let ids = [];
          ids.push(this.wcId);
          uni.showLoading({
            title: '加载中',
            mask: true,
          });
          post("/workerOrder/finishSpeOrder", ids).then((res) => {
            if (res.status == 200) {
              uni.reLaunch({
                url: "../receiptpage/receiptpage",
              });
            } else {
              uni.hideLoading();
              uni.showToast({
                icon: "none",
                title: res.msg || "接口获取数据失败！",
              });
            }
          });
        }
      },
      // 取消
      cancel() {
        this.models.disjunctor = false;
      },
      //一对多完成扫描
      Scanning_complete1(id) {
        this.wcId = id;
        this.modelFlag = "complete1";
        this.models = {
          disjunctor: true,
          title: "提示",
          content: "是否确定标本配送完成？",
          icon: "warn",
          operate: {
            ok: "确定",
            cancel: "取消",
          },
        };
      },
      //一对一完成扫描
      Scanning_complete(id) {
        this.wcId = id;
        this.modelFlag = "complete";
        this.models = {
          disjunctor: true,
          title: "提示",
          content: "是否确定标本配送完成？",
          icon: "warn",
          operate: {
            ok: "确定",
            cancel: "取消",
          },
        };
      },
      // 返回
      showAlert() {
        uni.navigateTo({
          url: "../receiptpage/receiptpage",
        });
      },
      // 请求详细页面的数据(除标本轮巡和标本配送)
      getInfo(id) {
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        get("/api/fetchData/workOrder/" + id).then((res) => {
          uni.hideLoading();
          if (res.status == 200) {
            this.infoDATA = res.data;
						if(this.infoDATA.gdState.value=='6' || this.infoDATA.gdState.value=='7'){//7已完成
							this.getQuestionnaireSet()
						}
            if(this.infoDATA.taskType.isDigitalHandover==1){
              this.checkNumber(this.infoDATA);//自动弹出数量核对
            }
          } else {
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败！",
            });
          }
        });
      },
      // 请求详细页面的数据
      getInfoBySpecimen(id) {
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        post("/api/getWechatItem", {
          id
        }).then((res) => {
          uni.hideLoading();
          if (res.state == 200) {
            this.infoDATA = res.data;
						if(this.infoDATA.gdState.value=='6' || this.infoDATA.gdState.value=='7'){//7已完成
							this.getQuestionnaireSet()
						}
            if(this.infoDATA.taskType.isDigitalHandover==1){
              this.checkNumber(this.infoDATA);//自动弹出数量核对
            }
            // 计算高度
            setTimeout(() => {
              const query = uni.createSelectorQuery().in(this);
              query
                .selectAll(".page_item_infos")
                .boundingClientRect((data) => {
                  let len = data.reduce((prev, current) => {
                    return prev + current.height;
                  }, 0);
                  this.animation.height(len).step();
                  this.animationData = this.animation.export();
                })
                .exec();
            }, 500)
          } else {
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败！",
            });
          }
        });
      },
			// 获取问卷配置
			getQuestionnaireSet(){
				uni.showLoading({
				  title: "加载中",
				  mask: true,
				});
				const userData = uni.getStorageSync("userData");
				post("/simple/data/fetchDataList/questionnaireConfig",{
					questionnaireConfig:{
						hosId:userData.user.currentHospital.id
					},
					idx:0,
					sum:10
				}).then((res) => {
				  uni.hideLoading();
				  if (res.status == 200) {
				    let data = res.list[0];
						if(data.taskTypeDTOS.length>0 && data.questionnaireDTOS.length>0){
							let isQuestion = data.taskTypeDTOS.find(i=> i.id == this.infoDATA.taskType.id)
							if(isQuestion){
								this.isQuestionModel = true
							}
						}
				  } else {
				    uni.showToast({
				      icon: "none",
				      title: res.msg || "接口获取数据失败！",
				    });
				  }
				});
			},
      // 页面控制-标本
      getPageConfigSpecimen(fn, type, specimenDTO, ress){
        const userData = uni.getStorageSync("userData");
        console.log('userData', userData);
        console.log('specimenDTO', specimenDTO);
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        // 查询标本配送业务
        post("/simple/data/fetchDataList/taskType",{
            "idx": 0,
            "sum": 10,
            "taskType": {
                "simpleQuery": true,
                "hosId": {
                    "id": userData.user.currentHospital.id
                },
                "associationType": {
                    "key": "association_types",
                    "value": "specimen"
                }
            }
        }).then((res) => {
          if (res.status == 200) {
            let taskTypeDTO = res.list[0];
        		if(taskTypeDTO){
              // 查询业务页面控制-标本
              post("/simple/data/fetchDataList/taskTypeConfig",{
                  "idx": 0,
                  "sum": 10,
                  "taskTypeConfig": {
                    taskTypeDTO,
                  }
              }).then((res) => {
                uni.hideLoading();
                if (res.status == 200) {
                  let data = res.list[0];
              		if(data){
                    let deptNotAlertList = data.deptNotAlertList || [];
                    deptNotAlertList = deptNotAlertList.map(v => v.id);
                    if(deptNotAlertList.includes(specimenDTO.checkDept.id)){
                      this.isEndDeptRed = true;
                      console.log('红色')
                      fn(false, type, ress);
                    }else{
                      this.isEndDeptRed = false;
                      fn(true, type, ress);
                    }
                    console.log('this.isEndDeptRed', this.isEndDeptRed);
                  }else{
                    this.isEndDeptRed = false;
                    fn(true, type, ress);
                  }
                } else {
                  uni.showToast({
                    icon: "none",
                    title: res.msg || "接口获取数据失败！",
                  });
                }
              });
            }else{
              uni.hideLoading();
              uni.showToast({
                icon: "none",
                title: "未查询到标本配送业务！",
              });
            }
          } else {
            uni.hideLoading();
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败！",
            });
          }
        });
      },
    },
    onShow() {
      this.SMFlag = true;
			let that = this
			// #ifdef APP-PLUS
			uni.$off('scan') // 每次进来先 移除全局自定义事件监听器
			uni.$on('scan', function(data) {
				that.pdaChange(data)
			})
			// #endif
    },
    onLoad(options) {
      console.log(options);
      if (options.accountObj && options.accountObj != "undefined") {
        this.accountObj = JSON.parse(options.accountObj);
      }
      if (options.deptId && options.deptId != "undefined") {
        this.deptId = options.deptId;
      }
      this.queryObj = options;
      let id = options.id;
      this.dataId = id; //工单ID
      this.infoType = options.type1; //type类型
      this.DEPTCode = options.deptCode; //二维码
      this.DEPT = options.dept; //科室名称
      if (
        options.type == 'specimen' ||
        options.type == 'specimenPlan'
      ) {
        this.getInfoBySpecimen(id);
      } else {
        this.getInfo(id);
      }
      // 创建动画
      this.animation = uni.createAnimation({
        duration: 500,
        timingFunction: "ease",
      });
      // #ifdef APP-PLUS
      webHandle("no", "app");
      // #endif
      // #ifdef H5
      webHandle("no", "wx");
      // #endif
    },
    onUnload() {
      // 页面关闭后清空数据
      this.animationData = {};
    },
  };
</script>
<style lang="less">
  .Scanning_code {
    padding: 0 20rpx;
    padding-bottom: 124rpx;

    .Scanning_top {
      height: 340rpx;

      .Scanning_top_icon {
        width: 140rpx;
        height: 140rpx;
        margin: 0 auto;
        margin-top: 36rpx;
        border-radius: 50%;
        line-height: 140rpx;

        .cubeic-ok {
          font-size: 140rpx;
          color: #35b34a;
        }
      }

      .Scanning_top_text {
        text-align: center;

        .text1 {
          margin-top: 40rpx;
          font-size: 48rpx;
        }

        .text2 {
          margin-top: 16rpx;
          font-size: 36rpx;
        }
      }
    }

    .page_item {
      margin-top: 16rpx;
      min-height: 356rpx;
      background: #fff;
      border-radius: 8rpx;
      overflow: hidden;
      padding: 0 16rpx;
      border: 2rpx solid #e5e9ed;

      .L {
        width: 40rpx;
        height: 40rpx;
        border-radius: 50%;
        background: #f9fafb;
        position: relative;
        left: -50rpx;
        top: 66rpx;
      }

      .R {
        width: 40rpx;
        height: 40rpx;
        border-radius: 50%;
        background: #f9fafb;
        position: relative;
        float: right;
        right: -50rpx;
        top: 26rpx;
      }

      .starting {
        width: 50rpx;
        height: 50rpx;
        color: #fff;
        background: #49b856;
        display: inline-block;
        border-radius: 50%;
        text-align: center;
        line-height: 46rpx;
        font-size: 32rpx;
        margin-right: 6rpx;
      }

      .End {
        width: 50rpx;
        height: 50rpx;
        color: #fff;
        background: #39b199;
        display: inline-block;
        border-radius: 50%;
        text-align: center;
        line-height: 46rpx;
        font-size: 32rpx;
        margin-right: 6rpx;
      }

      .page_item_top {
        height: 86rpx;
        border-bottom: 2rpx dashed #e5e9ed;
        padding: 0 16rpx;

        .page_item_top_L {
          height: 100%;
          float: left;
          line-height: 88rpx;

          .emergencys {
            background: #ff3b53 !important;
            width: 124rpx !important;
          }

          .emergency {
            background: #ff3b53 !important;
          }

          .emergency1 {
            background: #49b856 !important;
          }

          .page_item_cont_start {
            text-align: center;
            height: 44rpx;
            width: 104rpx;
            line-height: 44rpx;
            border-radius: 8rpx;
            background: #49b856;
            color: #fff;
            display: inline-block;

            .page_item_cont_start_txt {
              font-size: 28rpx;
              display: flex;
              align-items: center;
              justify-content: center;
            }
          }

          .L_time {
            color: #6cc076;
            font-size: 32rpx;
          }

          .L_text {
            font-size: 32rpx;
            display: inline-block;
            font-weight: 700;
            margin-right: 8rpx;
          }
        }

        .page_item_top_R {
          height: 60rpx;
          float: right;
          padding-top: 20rpx;
          font-size: 32rpx;
          position: absolute;
          right: 50rpx;

          .L_iocn {
            display: inline-block;
            height: 52rpx;
            line-height: 48rpx;
            color: rgb(7, 134, 60);
            font-size: 36rpx;
            font-weight: 700;
          }
        }
      }

      .page_item_cont {
        min-height: 180rpx;
        padding: 0 16rpx;
        text-align: left;
        position: relative;

        .text_big {
          font-size: 32rpx;
          position: absolute;
          right: 16rpx;
          font-weight: 700;
          margin-top: 10rpx;
        }

        .text_big2 {
          font-size: 32rpx;
          position: absolute;
          right: 16rpx;
          font-weight: 700;
        }

        .line {
          height: 20rpx;
          width: 2rpx;
          border-left: 2rpx solid #e5e9ed;
          position: absolute;
          top: 82rpx;
          left: 40rpx;
        }

        .lines {
          height: 40%;
          width: 2rpx;
          border-left: 2rpx solid #e5e9ed;
          position: absolute;
          top: 23%;
          left: 36rpx;
        }

        .page_item_cont_T {
          padding-top: 28rpx;
          font-size: 28rpx;

          .page_item_cont_title {
            height: 100%;
            font-size: 32rpx;
          }
        }

        .page_item_cont_B {
          padding-top: 28rpx;
          margin-bottom: 28rpx;

          .page_item_cont_title {
            height: 60rpx;
            font-size: 32rpx;
          }

          .page_item_cont_title1 {
            height: 60rpx;
            line-height: 60rpx;
            font-size: 32rpx;
            padding-left: 64rpx;
          }
        }
      }

      .page_item_foot {
        border-top: 2rpx dashed #e5e9ed;
        border-bottom: 2rpx dashed #e5e9ed;
        padding: 28rpx 16rpx;
        text-align: left;

        .page_item_foot_text {
          font-size: 32rpx;
          margin-bottom: 20rpx;
          display: flex;
          justify-content: space-between;
          align-items: center;

          .text1 {
            color: rgb(102, 102, 102);
          }

          .text2 {
            font-weight: 700;
          }
        }

        .text_padd {
          padding: 0 10% 0 10%;
        }
      }

      .page_item_info {
        padding: 20rpx 16rpx;
        text-align: left;
        line-height: 60rpx;
        font-size: 32rpx;

        .page_item_info_title {
          font-weight: 700;
        }

        .text {
          float: right;
          font-weight: 700;

          .text_span {
            color: #49b856;
          }
        }
      }

      #infos {
        height: 0;
        overflow: hidden;
      }

      .page_item_infos {
        padding-bottom: 20rpx;
        border-bottom: 2rpx dashed #e5e9ed;

        .page_item_info2 {
          text-align: left;
          line-height: 60rpx;
          font-size: 32rpx;
          padding-left: 16rpx;

          .page_item_foot_text {
            font-size: 32rpx;
            margin-bottom: 20rpx;

            .text1 {
              color: rgb(102, 102, 102);
            }

            .text2 {
              float: right;
              font-weight: 700;
            }
          }
        }
      }

      #pulldown {
        color: #49b856;
        font-size: 36rpx;
        height: 60rpx;
        text-align: center;

        .cubeic-pulldown {
          font-size: 48rpx;
          position: relative;
          bottom: 6rpx;
        }
      }

      #pullup {
        color: #49b856;
        font-size: 36rpx;
        height: 60rpx;
        text-align: center;

        .cubeic-pullup {
          font-size: 48rpx;
          position: relative;
          top: 12rpx;
        }
      }
    }

    .foot_btn2 {
      position: fixed;
      bottom: 0;
      right: 20rpx;
      left: 20rpx;
      line-height: 66rpx;
      height: 100rpx;
      border-top: 2rpx solid #e5e9ed;
      background: #f9fafb;
      display: flex;
      justify-content: space-between;

      .btn2,
      .btn3 {
        height: 66rpx;
        flex: 1;
        background-image: linear-gradient(to right, #72c172, #3bb197);
        color: #fff;
        border-radius: 8rpx;
        font-size: 32rpx;
        margin-top: 16rpx;
        margin-right: 16rpx;
        text-align: center;

        &:last-of-type {
          margin-right: 0;
        }
      }
    }

    .foot_btn1 {
      position: fixed;
      bottom: 0;
      right: 20rpx;
      left: 20rpx;
      line-height: 66rpx;
      height: 100rpx;
      border-top: 2rpx solid #e5e9ed;
      background: #f9fafb;
      display: flex;

      .btn1,
      .btn2 {
        height: 66rpx;
        flex: 1;
        margin: 0 1%;
        background-image: linear-gradient(to right, #72c172, #3bb197);
        color: #fff;
        border-radius: 8rpx;
        font-size: 32rpx;
        margin-top: 16rpx;
        text-align: center;
      }
    }
  }
</style>
