<template>
  <view class="Scanning_Result">
    <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"> 交接成功 </view>
      </view>
    </view>

    <view class="Scanning_cont">
      <view>您已到达{{queryObj.deptName}}，请核对以下数量</view>
      <view class="table_head">
        <view>科室</view>
        <view>是否配送完成</view>
      </view>
      <view class="table_bodys">
        <view class="table_body" v-for="(item, index) in dataList" :key="index">
          <view>{{item.dept}}</view>
          <view :class="{red: item.all != item.complete}">{{item.all == item.complete ? '是' : '否'}}</view>
        </view>
      </view>
    </view>

    <view class="foot_btn_spe">
      <view class="btn3" @click="goIndex()">返回</view>
    </view>
  </view>
</template>
<script>
  import {
    get,
    post,
    SM,
    webHandle
  } from "@/http/http.js";
  export default {
    data() {
      return {
        orderIds: '',
        bloodIds: '',
        hosId: uni.getStorageSync('userData').user.currentHospital.id,
        dataList: [],
        queryObj: {}, //路由传递过来的数据
      };
    },
    methods: {

      // 返回
      goIndex() {
        uni.navigateTo({
          url: `/pages/receiptpage/receiptpage`
        })
      },
      //获取页面信息
      getInfo(){
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        post('/workerOrder/ordersSpeSignDeptInfo', {
          "orderIds": JSON.parse(this.queryObj.ids).toString(),
        }).then(res => {
          uni.hideLoading();
          if(res.state == 200){
            this.dataList = res.data || [];
          }else{
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败！",
            });
          }
        })
      },

    },
    onLoad(options) {
      console.log(options, "result");
      this.queryObj = options;
      this.getInfo();
      // #ifdef APP-PLUS
      webHandle("no", "app");
      // #endif
      // #ifdef H5
      webHandle("no", "wx");
      // #endif
    },
    // 监听自定义事件并进行页面刷新操作
    onShow() {
      uni.$on('refresh', (data) => {
        if (data.refresh) {
            // 刷新操作
          this.getInfo();
        }
      });
    },
    onUnload() {
      uni.$off('refresh'); // 需要手动解绑自定义事件
    }
  };
</script>
<style lang="less" scoped>
  .Scanning_Result {
    padding: 0 20rpx;
    display: flex;
    flex-direction: column;
    height: 100vh;

    .Scanning_top {
      .Scanning_top_icon {
        width: 140rpx;
        height: 140rpx;
        margin: 50rpx auto 40rpx;
        border-radius: 50%;

        .speNum{
          text-align: center;
          font-size: 140rpx;
        }

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

        .cubeic-close {
          font-size: 140rpx;
          color: #ff3b53;
        }
      }

      .Scanning_top_text {
        .text1 {
          font-size: 48rpx;
          text-align: center;
        }

        .success_tips {
          color: red;
          font-size: 30rpx;
        }
      }
    }

    .Scanning_cont {
      flex: 1;
      text-align: center;
      display: flex;
      flex-direction: column;

      .table_bodys{
        overflow-y: auto;
        flex: 1;
      }

      .table_head{
        display: flex;
        margin-top: 50rpx;
        .ml16{
          margin-left: 16rpx;
        }

        view {
          height: 110rpx;
          line-height: 1;
          flex: 1;
          font-weight: bold;
          color: #000;
          font-size: 38rpx;
          display: flex;
          justify-content: center;
          align-items: center;
        }
      }

      .table_body{
        background: #F3FAF7;
        border-radius: 8px;
        border: 1px solid #E9E9E9;
        display: flex;
        margin-bottom: 20rpx;
        padding: 30rpx 20rpx;
        view {
          line-height: 1;
          flex: 1;
          color: #555;
          font-size: 38rpx;
          display: flex;
          justify-content: center;
          align-items: center;
          word-break: break-all;
        }
      }
    }

    .foot_btn_spe {
      line-height: 64rpx;
      height: 64rpx;
      margin-bottom: 40rpx;
      text-align: center;
      display: flex;
      justify-content: space-between;

      view {
        height: 64rpx;
        flex: 1;
        margin: 0 1%;
        background-image: linear-gradient(to right, #72c172, #3bb197);
        color: #fff;
        border-radius: 8rpx;
        font-size: 26rpx;
      }
    }
  }
</style>
