<template>
  <view class="query-wrap">
    <view class="inner-item">
      <view class="text-title">
        <view class="title-circ"> </view>
        <span class="title-text">基本信息</span>
      </view>
      <view class="inventory-item" style="margin-top: 40rpx">
        <view class="shuo-item-name">
          <view class="shuo-label-podnme"> 药品名称: </view>
          <view class="shuo-unit">
            <span>{{ item.drugName }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 药品编码: </view>
          <view class="shuo-unit">
            {{ acceptDetaData.id }}
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 医保编码: </view>
          <view class="shuo-unit">
            {{ acceptDetaData.purcPlanId }}
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item">
          <view class="shuo-label"> 是否集采: </view>
          <view class="shuo-cont">
            {{ acceptDetaData.isFas || "" }}
          </view>
        </view>
        <view class="shuo-item">
          <view class="shuo-label"> 是否基药: </view>
          <view class="shuo-cont">
            {{ acceptDetaData.essdrugType || "" }}
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item">
          <view class="shuo-label"> 集采批次: </view>
          <view class="shuo-cont">
            {{ acceptDetaData.fasBtch || "" }}
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 药品规格: </view>
          <view class="shuo-cont">
            {{
              "【" +
              item.specName +
              "*" +
              item.convrat +
              item.pac +
              "/" +
              item.pacUnt +
              "】"
            }}
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 药品剂型: </view>
          <view class="shuo-cont">
            {{ acceptDetaData.dosformName }}
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 件装数: </view>
          <view class="shuo-cont">
            {{ acceptDetaData.convrat }}
          </view>
        </view>
        <view class="shuo-item-name">
          <view class="shuo-label"> 单价: </view>
          <view class="shuo-cont">
            {{ acceptDetaData.pric }}
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 配送企业: </view>
          <view class="shuo-cont">
            {{ acceptDetaData.splerName }}
          </view>
        </view>
      </view>
    </view>

    <view class="empty-cont" v-if="listData.length == '0'"> 暂无明细数据 </view>
    <view class="inner-item" v-for="(item, idex) in listData" :key="idex">
      <view class="text-title" v-if="idex == '0'">
        <view class="title-circ"> </view>
        <span class="title-text">药品基础信息</span>
      </view>
      <view class="inventory-item" style="margin-top: 40rpx">
        <view class="shuo-item-name">
          <view class="shuo-label-podnme"> 药品分类: </view>
          <view class="shuo-unit">
            <span>{{ item.drugType }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item">
          <view class="shuo-label"> 批准文号: </view>
          <view class="shuo-cont">
            <span>{{ item.aprvNo }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label-podnme"> 生产企业: </view>
          <view class="shuo-cont">
            <span>{{ item.prodentpName }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item">
          <view class="shuo-label"> 生产方式: </view>
          <view class="shuo-cont">
            {{ item.prodMode || "" }}
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item">
          <view class="shuo-label"> 通用名称: </view>
          <view class="shuo-cont">
            {{ item.genName || "" }}
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 化学名称: </view>
          <view class="shuo-cont">
            <span>{{ item.chemName || "" }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label-podnme"> 限价/参考价: </view>
          <view class="shuo-cont">
            <span>{{ item.lmtPric }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 最小单位: </view>
          <view class="shuo-cont">
            <span>{{ item.pac }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 包装单位: </view>
          <view class="shuo-cont">
            <span>{{ item.pacUnt }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 包装数量: </view>
          <view class="shuo-cont">
            <span>{{ item.convrat }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 件装数量: </view>
          <view class="shuo-cont">
            <span>{{ item.pieceUntNum }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 存储仓库: </view>
          <view class="shuo-cont">
            <span>{{ item.stogWrhs }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 存储条件: </view>
          <view class="shuo-cont">
            <span>{{ item.stogCond }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label"> 适合温度: </view>
          <view class="shuo-cont">
            <span>{{ item.splerName }}</span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label">采购价：</view>
          <view class="shuo-cont">
            <span class="link-text" @click="onPriceClick(item)">
              {{ item.pric || "—" }}（点击调价）
            </span>
          </view>
        </view>
      </view>
      <view class="inventory-item">
        <view class="shuo-item-name">
          <view class="shuo-label">配送企业：</view>
          <view class="shuo-cont">
            <span class="link-text" @click="onSupplierClick(item)">
              {{ item.splerName || "—" }}（点击更换供应商）
            </span>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>
<script>
import moment from "moment";
export default {
  data() {
    return {
      listData: [],
      acceptDetaData: {},
      subMitData: {},
    };
  },
  onShow() {
    let that = this;
    uni.getStorage({
      key: "puhseOrderDetail",
      success: function (res) {
        that.acceptDetaData = res.data;
        that.getDetail(res.data.id);
      },
    });
  },
  mounted() {},
  methods: {
    async getDetail(id) {
      await this.$http("drugHospital.getPurcOrdDetl", { id }, "加载中").then((res) => {
        if (res && res.data) {
          this.listData = res.data || [];
        }
      });
    },
    forMatTime(row) {
      return moment(row).format("YYYY-MM-DD HH:mm");
    },
    //日期格式化
    forMatTime(time) {
      return moment(time).format("YYYY-MM-DD");
    },
    //加时分秒
    forMatTimehs(time) {
      return moment(time).format("YYYY-MM-DD HH:mm");
    },
  },
  watch: {},
};
</script>

<style lang="scss" scoped>
.query-wrap {
  width: 100%;
  height: 100%;
  padding: 20rpx;
  box-sizing: border-box;
  background-color: #f1f1f1;
  overflow-y: scroll;
  overflow-x: hidden;
  position: relative;
  padding-bottom: 200rpx;

  .botm-btn {
    width: 100%;
    height: 120rpx;
    background-color: #fff;
    position: fixed;
    left: 0;
    bottom: 0;
    padding-top: 40rpx;
    display: flex;
    align-items: center;
    justify-content: space-around;
  }

  .time-view {
    height: 350rpx;
    background-color: #fff;
    padding: 50rpx 50rpx 0 50rpx;
    box-sizing: border-box;

    .btn-view {
      width: 100%;
      height: 100rpx;
      margin-top: 100rpx;
      display: flex;
      justify-content: space-around;
    }
  }
}
.title-text {
  font-size: 32rpx;
  color: #5ab7a5;
  font-weight: bold;
}
.item-stats {
  margin-top: 80rpx;
}
uni-page-body {
  width: 100%;
  height: 100%;
}
.link-text {
  color: #1890ff;
  cursor: pointer;
  text-decoration: underline;
}
</style>
