<template>
  <view class="Scanning_orderSign">
    <view class="Scanning_top">
      <view class="Scanning_top_icon">
        <text class="cubeic-ok icon_transport transport-duigou"></text>
      </view>
      <view class="Scanning_top_text">
        <view class="text1">工单完成</view>
      </view>
    </view>
    <view class="page_item footerOtherMargin" v-for="(infoDATA, i) of infoDATAS" :key="i">
      <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 icon_transport transport-shiwujiaoxing"></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 icon_transport transport-shiwujiaoxing"></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 icon_transport transport-shiwujiaoxing"></text>
              {{ infoDATA.emergencyType.name }}
            </text>
          </view>
        </view>
        <view class="page_item_top_R">
          <text class="L_iocn" v-if="infoDATA.taskType.associationType.value == 'specimen'">标本</text>
          <text class="L_iocn" v-if="infoDATA.taskType.associationType.value == 'specimenPlan'">标本</text>
          <text class="L_iocn" v-if="infoDATA.taskType.associationType.value == 'drugsBag'">药品</text>
          <text class="L_iocn" v-if="infoDATA.taskType.associationType.value == 'jPBag'">静配</text>
          <text class="L_iocn" v-if="infoDATA.taskType.associationType.value == 'inspect'">患者陪检</text>
          <text class="L_iocn" v-if="infoDATA.taskType.associationType.value == 'patientTransport'">患者转运</text>
          <text class="L_iocn" v-if="infoDATA.taskType.associationType.value == 'other'">其他配送</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) of infoDATA.middleDept" :key="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) of infoDATA.endDepts" :key="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">
          <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" v-if="infoDATA.gdState.value == '2'">
          <text class="text1">预计响应时间</text>
          <text class="text2">{{ infoDATA.estimeResponseTime || 0 }}</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 || 0 }}</text>
        </view>
        <view class="page_item_foot_text" v-if="infoDATA.gdState.value == '4'">
          <text class="text1">预计到达时间</text>
          <text class="text2">{{ infoDATA.estimateArriveTime || 0 }}</text>
        </view>
        <view class="page_item_foot_text">
          <text class="text1">创建时间</text>
          <text class="text2">{{ infoDATA.startTime }}</text>
        </view>
      </view>
      <!-- 标本 送达-->
      <view class="page_item_info" v-if="
          infoDATA.taskType.associationType.value == 'specimenPlan' ||
          infoDATA.taskType.associationType.value == 'specimen' && ((infoType == 'plan-spe-dsd-3' && infoDATA.gdState.value == '7') ||
            (infoType == 'spe-dsd-3' && infoDATA.gdState.value == '7'))
        ">
        <!-- <text class="page_item_info_title">标本信息</text>
        <text class="text">
          已扫描标本总数
          <text>{{ infoDATA.expectReceiveNum || 0 }}</text>
        </text> -->
        <!-- <view class="page_item_list">
          <view class="page_item_list_head">
            <view>标本类型</view>
            <view>床号</view>
            <view>标本编号</view>
            <view>患者姓名</view>
          </view>
          <view
            class="page_item_list_cont"
            v-for="(data, i) of infoDATA.specimenSet"
            :key="i"
          >
            <view>{{ data.stype.name || "-" }}</view>
            <view>{{ data.bedNum || "-" }}</view>
            <view>{{ data.scode || "-" }}</view>
            <view>{{ data.patientName || "-" }}</view>
          </view>
        </view> -->
      </view>
    </view>
    <view class="foot_btn2 footerPadding">
      <view class="btn2" @click="Scanning_again()">知道了</view>
    </view>
  </view>
</template>
<script>
  import {
    get,
    post,
    SM,
    webHandle
  } from "../../http/http.js";
  export default {
    data() {
      return {
        infoDATA: [],
        infoDATAS: [],
        infoType: "",
        DEPTCode: "",
        DEPT: "",
        dataId: "",
      };
    },
    methods: {
      // 知道了
      Scanning_again(id) {
        uni.navigateTo({
          url: "../receiptpage/receiptpage",
        });
      },
      // 获取信息内容
      getInfo(ids) {
        for (var i = 0; i < ids.length; i++) {
          get("/api/fetchData/workOrder/" + ids[i]).then((res) => {
            if (res.status == 200) {
              this.infoDATA = res.data;
              this.infoDATAS.push(this.infoDATA);
            } else {
              uni.showToast({
                icon: "none",
                title: "请求失败！",
              });
            }
          });
        }
      },
      // 请求详细页面的数据
      getInfoBySpecimen(ids) {
        for (var i = 0; i < ids.length; i++) {
          post("/api/getWechatItem", {
            id: ids[i]
          }).then((res) => {
            if (res.state == 200) {
              this.infoDATA = res.data;
              this.infoDATAS.push(this.infoDATA);
            } else {
              uni.showToast({
                icon: "none",
                title: "请求失败！",
              });
            }
          });
        }
      },
    },
    onLoad(options) {
      console.log(options, 'options');
      let id = JSON.parse(options.id);
      this.dataId = id;
      this.infoType = options.type1;
      this.DEPTCode = options.deptCode;
      this.DEPT = options.dept;
      if (options.type === 'specimen' || options.type === 'specimenPlan') {
        this.getInfoBySpecimen(id);
      } else {
        this.getInfo(id);
      }
      // #ifdef APP-PLUS
      webHandle("no", "app");
      // #endif
      // #ifdef H5
      webHandle("no", "wx");
      // #endif
    },
  };
</script>
<style lang="less">
  .Scanning_orderSign {
    padding: 0 20rpx;
    height: calc(100% - 100rpx);

    .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 {
      position: relative;
      margin-top: 16rpx;
      margin-bottom: 124rpx;
      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: 20px;
        height: 20px;
        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;
          display: flex;
          align-items: center;

          .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: 600;
          }
        }

        .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;

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

          .text2 {
            float: right;
            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 {
            color: #49b856;
          }
        }

        .page_item_list {
          .page_item_list_head {
            height: 90rpx;
            background-image: linear-gradient(to right, #72c172, #3bb197);
            display: flex;

            view {
              flex: 1;
              text-align: center;
              line-height: 90rpx;
              color: #fff;
            }
          }

          .page_item_list_cont {
            height: 90rpx;
            display: flex;

            view {
              flex: 1;
              text-align: center;
              line-height: 90rpx;
              color: rgb(51, 51, 51);
            }
          }
        }
      }

      #infos {
        display: none;
      }

      .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;
            }
          }
        }
      }
    }

    .foot_btn2 {
      position: fixed;
      bottom: 0;
      right: 20rpx;
      left: 20rpx;
      line-height: 66rpx;
      height: 100rpx;
      border-top: 2rpx solid #e5e9ed;
      background: #f9fafb;
      text-align: center;

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