<style>
  .studyproauditInfo {
    margin: 20px;
  }

  .studyproauditInfo .row {
    margin-bottom: 20px;
  }

  .studyproauditInfo .border-bottom {
    border-bottom: 1px dashed #EEE;
    padding-bottom: 8px;
    margin-bottom: 5px;
  }

  .studyproauditInfo .q-radio {
    margin-bottom: 0 !important
  }

  .studyproauditInfo .audit_List {
    margin-bottom: 5px;
  }

  .studyproauditInfo .studyPass {
    color: #fff;
    padding: 1px 3px;
    border-radius: 3px;
    margin-left: 10px;
    font-size: 12px;
    background-color: #2bbb7e;
  }

  .studyproauditInfo .DirectYijian {
    width: 100%;
    min-height: 50px;
    padding: 10px;
    background-color: #F5F5F5;
    border-radius: 5px;
    position: relative;
    overflow: auto;
    max-height: 90px;
    word-break: break-all;
  }

  .DirectYijian::-webkit-scrollbar {
    width: 3px;
    height: 6px;
    background-color: #F5F5F5;
  }

  /*定义滚动条轨道 内阴影+圆角*/
  .DirectYijian::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    background-color: #F5F5F5;
  }

  /*定义滑块 内阴影+圆角*/
  .DirectYijian::-webkit-scrollbar-thumb {
    border-radius: 10px;
    -webkit-box-shadow: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent));
    background-color: #2961fe;
  }

  .studyproauditInfo .DirTriggle {
    width: 0;
    height: 0;
    border-right: 7px solid transparent;
    border-left: 7px solid transparent;
    border-bottom: 8px solid #f5f5f5;
    position: absolute;
    top: -8px;
  }

  .studyproauditInfo .studyHeader {
    border-top: 1px dashed #EEE;
    border-bottom: 1px dashed #EEE;
    padding: 8px 0;
    margin-bottom: 10px;
  }

  .studyproauditInfo .auditName {
    font-size: 14px;
    color: #333;
    font-weight: 700;
  }

  .stidyRoleLine {
    width: 3px;
    height: 11px;
    margin-right: 10px;
    background-color: #3FC4FF;
    display: inline-block;
  }

  .studyRemark {
    width: 100%;
    overflow: auto;
    max-height: 90px;
  }

  .studyRemark::-webkit-scrollbar {
    width: 3px;
    height: 6px;
    background-color: #F5F5F5;
  }

  /*定义滚动条轨道 内阴影+圆角*/
  .studyRemark::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    background-color: #F5F5F5;
  }

  /*定义滑块 内阴影+圆角*/
  .studyRemark::-webkit-scrollbar-thumb {
    border-radius: 10px;
    -webkit-box-shadow: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent));
    background-color: #2961fe;
  }
  .studyDrawerTop{
    font-weight: bold;
  }
</style>
<template>
  <q-dialog v-model="persistent" persistent maximized full-height seamless position="right" @hide="closeperForm">
    <q-card style="margin-top:61px;width:500px" class="no-border-radius classinfo_Dialog">
      <div class="studyDrawerTop">
        <div style="display:flex;align-items:center;margin:20px 0 0 20px;">
          <span class="drawer_Span">
            {{saveObj.Type==1?'留学':'就业'}}详情
          </span>
        </div>
      </div>
      <div class="studyproauditInfo">
        <div class="row">
          <div class="col-12">
            <span class="stidyRoleLine"></span>
            <span>基本信息</span>
          </div>
        </div>
        <div class="row">
          <div class="col-12">
            <span>项目名称：{{saveObj.Name}}</span>
          </div>
        </div>
        <div class="row">
          <div class="col-6">
            <span>创建人：{{saveObj.CreateByName}}</span>
          </div>
          <div class="col-6">
            <span>创建时间：{{saveObj.CreateTimeStr}}</span>
          </div>
        </div>
        <div class="row">
          <div class="col-12" v-if="isHaveViewSupplierAction">
            <div>供应商：{{saveObj.SupplierName}}
              <template v-if="isHaveViewContractAction">
                <a v-if="saveObj.SupplierContract&&saveObj.SupplierContract!=''" :href="saveObj.SupplierContract"
                  style="text-decoration:none;color:#2961fe;" target="_blank">
                  <i class="iconfont icon-view" style="font-size:18px;cursor:pointer;" @click="" title="查看合同"></i>
                </a>
                <a v-else style="font-size:12px;color:red;">(未上传合同)</a>
              </template>
            </div>
          </div>

        </div>
        <div class="row">
          <div class="col-12">
            <span>状态：{{saveObj.SaleStateName}}</span>
          </div>
        </div>
        <div class="row">
          <div class="col-6">
            <span>建议卖价：{{Number(saveObj.SuggestPrice).toFixed(2)}}</span>
          </div>
          <div class="col-6">
            <span>实际卖价：{{Number(saveObj.SellPrice).toFixed(2)}}</span>
          </div>
        </div>
        <div class="row">
          <div class="col-12">
            <div style="display:flex;">
              <div style="flex-shrink:0">备注：</div>
              <div class="studyRemark">
                {{saveObj.Remark}}
              </div>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col-12">
            <span class="stidyRoleLine"></span>
            <span>优惠信息</span>
          </div>
        </div>
        <div class="row studyHeader">
          <div class="col-4">
            优惠政策
          </div>
          <div class="col-4">
            销售佣金
          </div>
          <div class="col-4">
            同行佣金
          </div>
        </div>
        <div class="row audit_List" v-for="(x,index) in saveObj.PreferentialList" :key="index">
          <div class="col-4">
            <template v-if="saveObj.PreferentialList.length>0">
              <div class="border-bottom" v-if="x.PriceDiscountType == 1">
                买{{ x.BuyNum }}送{{ x.SendNum }}
              </div>
              <div class="border-bottom" v-if="x.PriceDiscountType == 2">
                单人报名享 <template v-if="x.PriceType==0">
                  {{ 100 - x.PriceMoney }}折
                </template>
                <template v-else>
                  {{  x.PriceMoney }}元
                </template>优惠
              </div>
              <div class="border-bottom" v-if="x.PriceDiscountType == 3">
                双人报名享 <template v-if="x.PriceType==0">
                  {{ 100 - x.PriceMoney }}折
                </template>
                <template v-else>
                  {{  x.PriceMoney }}元
                </template>优惠
              </div>
              <div class="border-bottom" v-if="x.PriceDiscountType == 4">
                续费享 <template v-if="x.PriceType==0">
                  {{ 100 - x.PriceMoney }}折
                </template>
                <template v-else>
                  {{  x.PriceMoney }}元
                </template>优惠
              </div>
              <div class="remark-font" v-if="x.PriceDiscountType == 0">
                暂无优惠政策
              </div>
            </template>
            <template v-else>
              <span>暂无优惠政策</span>
            </template>
          </div>
          <div class="col-4">
            <template v-if="saveObj.PreferentialList.length>0">
              <div class="border-bottom" style="padding-left: 16px;padding-right: 16px"
                :class="{ 'text-red': x.SaleCommissionType == 1 }" v-if="x.PriceDiscountType != 0">
                {{ x.SaleCommissionType == 1 ? "￥" : ""
                }}{{ x.SaleCommissionMoney
                }}{{ x.SaleCommissionType == 0 ? "%" : "" }}
              </div>
              <div v-if="x.PriceDiscountType == 0">
                <div class="remark-font">暂无佣金信息</div>
              </div>
            </template>
            <template v-else>
              <span>暂无优惠政策</span>
            </template>
          </div>
          <div class="col-4">
            <template v-if="saveObj.PreferentialList.length>0">
              <div class="border-bottom" style="padding-left: 16px" :class="{ 'text-red': x.B2BCommissionType == 1 }"
                v-if="x.PriceDiscountType != 0">
                {{ x.B2BCommissionType == 1 ? "￥" : ""
                }}{{ x.B2BCommissionMoney
                }}{{ x.B2BCommissionType == 0 ? "%" : "" }}
              </div>
              <div v-if="x.PriceDiscountType == 0">
                <div class="remark-font">暂无佣金信息</div>
              </div>
            </template>
            <template v-else>
              <span>暂无优惠政策</span>
            </template>
          </div>
        </div>
        <template>
          <div class="studyDrawerTop">
            <div style="display:flex;align-items:center;margin:20px 0">
              <span class="drawer_Span">
                部门主管审核
              </span>
            </div>
          </div>
          <div class="row" style="margin-bottom:10px;">
            <div class="col-6">
              <span class="auditName">{{saveObj.DirectorName}}</span>
              <span class="studyPass" v-if="saveObj.DirectorStatus==0" style="background-color:#1273bc;">待审核</span>
              <span class="studyPass" v-if="saveObj.DirectorStatus==1">通过</span>
              <span class="studyPass" v-if="saveObj.DirectorStatus==2" style="background-color:#e95252;">拒绝</span>
            </div>
            <div class="col-6" style="text-align:right;" v-if="saveObj.DirectorStatus>0">
              <span>{{saveObj.DirectorAuditTimeStr}}</span>
            </div>
          </div>
          <div class="row" v-if="saveObj.DirectorStatus>0">
            <div class="col-12">
              <div class="DirectYijian">
                <div class="DirTriggle"></div>
                {{saveObj.DirectorOpinion==''?'无':saveObj.DirectorOpinion}}
              </div>
            </div>
          </div>
        </template>
        <template v-if="saveObj.DirectorStatus>0">
          <div class="studyDrawerTop">
            <div style="display:flex;align-items:center;margin:20px 0">
              <span class="drawer_Span">
                部门负责人审核
              </span>
            </div>
          </div>
          <div class="row" style="margin-bottom:10px;">
            <div class="col-6">
              <span class="auditName">{{saveObj.ManagerName}}</span>
              <span class="studyPass" v-if="saveObj.ManagerStatus==0" style="background-color:#1273bc;">待审核</span>
              <span class="studyPass" v-if="saveObj.ManagerStatus==1">通过</span>
              <span class="studyPass" v-if="saveObj.ManagerStatus==2" style="background-color:#e95252;">拒绝</span>
            </div>
            <div class="col-6" style="text-align:right;" v-if="saveObj.ManagerStatus>0">
              <span>{{saveObj.ManagerAuditTimeStr}}</span>
            </div>
          </div>
          <div class="row" v-if="saveObj.ManagerStatus>0">
            <div class="col-12">
              <div class="DirectYijian">
                <div class="DirTriggle"></div>
                {{saveObj.ManagerOpinion==''?'无':saveObj.ManagerOpinion}}
              </div>
            </div>
          </div>
        </template>
      </div>
    </q-card>
    <div class="dialog-out-close" @click="closeperForm"
      style="height:40px !important;border-top-left-radius: 4px !important;border-bottom-left-radius: 4px !important;">
      <q-icon name="iconfont icon-jujue1" size="26px" />
    </div>
  </q-dialog>
</template>
<script>
  import {
    queryStudyAbroadInfo,
  } from "../../api/studyabroad/index";
  import {
    mapState
  } from "vuex";
  export default {
    meta: {
      title: "留学详情"
    },
    props: {
      Id: {
        type: Number,
        default: null
      }
    },
    data() {
      return {
        persistent: true,
        saveObj: {},
        msg: {
          Id: 0,
          IsGetPrice: 1
        }
      }
    },
    computed: mapState({
      //是否有查看合同权限
      isHaveViewContractAction(state) {
        if (state.user.userInfo && state.user.userInfo.ActionMenuList && state.user.userInfo.ActionMenuList.length >
          0) {
          let action = state.user.userInfo.ActionMenuList.find(x => {
            if (x.FunctionCode == "View_Supplier_Contract") {
              return x;
            }
          });
          return action && action.FunctionCode;
        }
        return false;
      },
      //是否有查看供应商权限
      isHaveViewSupplierAction(state) {
        if (state.user.userInfo && state.user.userInfo.ActionMenuList && state.user.userInfo.ActionMenuList.length >
          0) {
          let action = state.user.userInfo.ActionMenuList.find(x => {
            if (x.FunctionCode == "View_Supplier") {
              return x;
            }
          });
          return action && action.FunctionCode;
        }
        return false;
      }
    }),
    mounted() {
      this.msg.Id = this.Id;
      this.initObj();
    },
    created() {},
    methods: {
      //获取数据
      initObj() {
        queryStudyAbroadInfo(this.msg).then(res => {
            this.saveObj = res.Data;
          })
          .catch(() => {});
      },
      closeperForm() {
        this.$emit("close");
        this.persistent = false;
      }
    }
  }

</script>
<style lang="sass">
  @import url('~assets/css/table.sass')

</style>
