<template>

  <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
    <div style="padding: 20px; background-color: #fff;">
      套餐包详情
    </div>

<div class="content" v-if="item!=null">
    <div class="desct">
      套餐包信息
    </div>
    <el-descriptions title="" :column="3" border>
    <el-descriptions-item label="套餐包名称" >
        <span v-if="item!=null">{{item.packageName}}</span>
    </el-descriptions-item>

    <el-descriptions-item label="状态" >
         <dict-tag :options="statusOptions" :value="item.status"/>
    </el-descriptions-item>
    <el-descriptions-item label="类型" >
         <dict-tag :options="packageTypeOptions" :value="item.packageType"/>
    </el-descriptions-item>
    <el-descriptions-item label="子类型" >
         <dict-tag :options="packageSubTypeOptions" :value="item.packageSubType"/>
    </el-descriptions-item>
    <el-descriptions-item label="疾病类型" >
         <dict-tag :options="diseaseTypeOptions" :value="item.diseaseType"/>
    </el-descriptions-item>
    <el-descriptions-item label="总价 元/天" >
         <span v-if="item!=null">{{item.price}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="套餐价" >
         <span v-if="item!=null">{{item.totalPrice}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="问诊价格" >
         <span v-if="item!=null">{{item.inquiryPrice}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="药品价格" >
         <span v-if="item!=null">{{item.productPrice}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="周期" >
         <span v-if="item!=null">{{item.cycle}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="签约时长" >
         <span v-if="item!=null">{{item.duration}}</span>
    </el-descriptions-item>
    
    
    <el-descriptions-item label="是否展示" >
         <dict-tag :options="orOptions" :value="item.isShow"/>
    </el-descriptions-item>

    <el-descriptions-item label="排序" >
        <span v-if="item!=null">{{item.sort}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="套餐医生" >

         <span v-if="item!=null">{{item.doctors}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="创建时间" >
        <span v-if="item!=null">{{item.createTime}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="修改时间" >
        <span v-if="item!=null">{{item.updateTime}}</span>
    </el-descriptions-item>
        </el-descriptions>
            </div>
<div class="content" v-if="item!=null">
<div class="desct">
  商品内容
</div>
  <el-table border width="100%" style="margin-top:5px;"  :data="productJson">
                <el-table-column label="商品图片" align="center" width="100">
                  <template slot-scope="scope">
                    <el-popover
                      placement="right"
                      title=""
                      trigger="hover"
                    >
                      <img slot="reference" :src="scope.row.image" width="50">
                      <img :src="scope.row.image" style="max-width: 50px;">
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column label="商品名称" show-overflow-tooltip align="center" prop="productName" />

                <el-table-column label="数量" align="center"  prop="count" width="150px" />
                <el-table-column label="服用方法" align="center"  prop="usageMethod" width="150px" />
                <el-table-column label="一日几次" align="center"  prop="usageFrequencyUnit" width="150px" />
                <el-table-column label="商品编号" align="center" prop="barCode" />
                <el-table-column label="商品规格" align="center" prop="sku" />
                <el-table-column label="售价" align="center"  prop="price"  >
                   <template slot-scope="scope">
                    <div v-if="scope.row.price!=null">
                         {{scope.row.price.toFixed(2)}}
                    </div>
                  </template>
                </el-table-column>
                 <el-table-column label="小计" align="center"  prop="money"  >
                   <template slot-scope="scope">
                    <div v-if="scope.row.money!=null">
                         {{scope.row.money.toFixed(2)}}
                    </div>
                  </template>
                </el-table-column>
              </el-table>


      </div>
<el-dialog title="药品详情" :visible.sync="drugOpen" width="1000px" append-to-body>

              <el-row  >
              </el-row>

        <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="drugOpen=false">确 定</el-button>
          </div>
        </el-dialog>

<div class="content" v-if="item!=null">
<div class="desct">
  套餐详情
</div>
<span v-html="item.desc"></span>
 </div>
      </div>
</template>

<script>
import { listPackage, getPackage, delPackage, addPackage, updatePackage, exportPackage } from "@/api/store/package";
  export default {
    name: "patientdetails",
    props:["data"],
    data() {
      return {
       // 状态字典
       drugList:[],
       drugOpen:false,
       statusOptions: [],
       payTypeOptions: [],
       orOptions:[],
       packageTypeOptions: [],
       diseaseTypeOptions: [],
       // 是否删除字典
       isDelOptions: [],
       packageSubTypeOptions:[],
        item:null,
        productJson:[],
      }
    },
    created() {
     this.getDicts("sys_company_status").then(response => {
       this.statusOptions = response.data;
     });
     this.getDicts("sys_company_or").then(response => {
       this.isDelOptions = response.data;
       this.orOptions = response.data;
     });
     this.getDicts("sys_package_pay_type").then(response => {
       this.payTypeOptions = response.data;
     });
     this.getDicts("sys_product_type").then(response => {
          this.productTypeOptions = response.data;
        });
     this.getDicts("sys_package_type").then(response => {
       this.packageTypeOptions = response.data;
     });
     this.getDicts("sys_package_sub_type").then(response => {
       this.packageSubTypeOptions = response.data;
     });
     this.getDicts("sys_prescribe_disease_type").then(response => {
       this.diseaseTypeOptions = response.data;
     });

    },
    methods: {
      getDetails(orderId) {
          this.item=null;
          getPackage(orderId).then(response => {
              this.item = response.data;
              this.productJson=JSON.parse(response.data.productJson);
          });
      },
      drug(row){
        this.drugList=row.row.drug
        this.drugOpen=true;
      },
    }
  }
</script>
<style>
  .el-descriptions-item__content {
    max-width: 150px;
    min-width: 100px;
  }
  .content{
      height: 100%;
      background-color: #fff;
     padding: 0px 20px 20px;

      margin: 20px;
  }
  .el-descriptions-item__label.is-bordered-label{
    font-weight: normal;
  }
  .desct{
      padding-top: 20px;
      padding-bottom: 20px;
      color: #524b4a;
      font-weight: bold;
    }
</style>


