<template>
  <div :class="theme">
    <div :class="['scroll-Y']">
      <div class="push-box">
        <div class="choose-invoice-header" @click="changeHeader">
          <div class="invoice-header-info" v-if="headerInfo.titleName">
            <div class="invoice-header-name" :class="headerInfo.invoiceTitleType == 'COMPANY' ? 'header-name' : ''">
              <div>
                {{ headerInfo.titleName }}
                <span class="isDefault" v-if="headerInfo.defaultOrNot">默认</span>
              </div>
              <img class="invoice-header-arrow" :src="arrowIcon" mode="widthFix" />
            </div>
            <div  class="duty-paragraph"><span v-if="headerInfo.invoiceTitleType == 'COMPANY'">公司税号</span>  <span v-if="headerInfo.invoiceTitleType == 'COMPANY'">{{ headerInfo.taxNo }}</span></div>
          </div>
          <div class="invoice-header-info" v-else>
            <div class="invoice-header-name">
              <div>请选择发票抬头</div>
              <img class="invoice-header-arrow" :src="arrowIcon" mode="widthFix" />
            </div>
            <div class="duty-paragraph">未选择发票抬头</div>
          </div>
        </div>
        <div class="tab-header" v-if="headerInfo.titleName">发票详情</div>
        <div class="part" v-if="headerInfo.titleName">
          <div class="invoice-header">
            <div class="part-item">
              <span class="part-item-key">发票类型</span>
              <span class="part-item-value">增值税普通发票</span>
            </div>
            <div class="part-item">
              <span class="part-item-key">抬头类型</span>
              <span class="part-item-value">{{ headerInfo.invoiceTitleType === 'COMPANY' ? '单位' : '个人/非企业单位' }}</span>
            </div>
            <div class="part-item" :class="headerInfo.invoiceTitleType == 'COMPANY' ? 'header-name' : ''">
              <span class="part-item-key">抬头名称</span>
              <span class="part-item-value">{{ headerInfo.titleName }}</span>
            </div>
            <div class="part-item lines" v-if="headerInfo.invoiceTitleType === 'COMPANY'">
              <span class="part-item-key">公司税号</span>
              <span class="part-item-value">{{ headerInfo.taxNo }}</span>
            </div>
          </div>
          <div class="invoice-more" v-if="headerInfo.invoiceTitleType === 'COMPANY'">
            <div class="tab-title show-more" @click="changeShowMore">
              <span class="c">更多信息</span>
              <!--  :class="!isShowMore ? 'toBottom' : 'toRight'" -->
              <div class="arrow-box">
                <img :src="arrowIcon" mode="widthFix" />
              </div>
            </div>
            <div class="is-show-more" v-if="isShow">
              <div class="part-item">
                <span class="part-item-key">公司地址</span>
                <span class="part-item-value">{{ headerInfo.companyAddress }}</span>
              </div>
              <div class="part-item">
                <span class="part-item-key">公司电话</span>
                <span class="part-item-value">{{ headerInfo.companyTel }}</span>
              </div>
              <div class="part-item">
                <span class="part-item-key">开户银行</span>
                <span class="part-item-value">{{ headerInfo.depositBank }}</span>
              </div>
              <div class="part-item top">
                <span class="part-item-key">开户账户</span>
                <span class="part-item-value">{{ headerInfo.depositAccount }}</span>
              </div>
            </div>
          </div>
        </div>
        <div class="part middle">
          <div class="part-item lines">
            <span class="part-item-key">总金额</span>
            <span class="part-item-value"
              ><span class="purple">{{ invoiceAmount }} 元</span></span
            >
          </div>
          <div class="part-item top part-item-bg" v-if="type == ''">
            <span class="part-item-key"
              >共<span class="purple">{{ orderQuantity }}笔</span>缴费记录</span
            >
            <div class="part-item-value" @click="gotoDetail">
              <span>查看详情</span>
              <img class="invoice-header-arrow" :src="arrowIcon" mode="widthFix" />
            </div>
          </div>
        </div>
        <div class="tab-header">接收方式</div>
        <div class="part" style="padding-top: 10px;">
          <div class="part-item" style="padding-top:30px;padding-bottom: 15px;">
            <span class="part-item-key" style="min-width: 120px; white-space: nowrap">电子邮箱</span>
            <div class="part-item-value">
              <input class="van-field__control" style="white-space: nowrap; width:520px;" type="text" @blur="mailboxChange" placeholder="请输入电子邮箱" v-model="condition.email" />
            </div>
          </div>
          <div class="part-item default-email part-item-bg" @click="changeDefaultEMail">
            <van-checkbox checked-color="var(--k-color-primary-01)" v-model="condition.emailAsDefault" @change="emailAsDefaultChange" icon-size="30PX"><span class="text">保存电子邮箱为默认邮箱</span></van-checkbox>
          </div>
        </div>
        <div class="tab-header2">备注</div>
        <div class="textarea-remark">
          <textarea
            rows="3"
            placeholder-style="color:#999999;
              font-style: normal;
              font-weight: 400;
              font-size: 30px;
              height:275px;
              background:#fff;"
              
            placeholder="如果您对本次发票申请有其他需求，可在此输入详细信息。"
            @blur="storeRemarkChange"
            v-model="condition.remark"
          ></textarea>
        </div>
        <!-- 占位 -->
        <div style="height: 75px; background-color: transparent; color: transparent; position: relative">占位</div>
      </div>
    </div>
    <div class="footer">
      <k-button v-if="headerInfo.titleName" title="提交" style="margin: 0 auto" disabledColor="#D1D2D9" @click="submit" />
      <k-button v-else disabled title="请选择发票抬头" style="margin: 0 auto" disabledColor="#D1D2D9" />
    </div>
  </div>
</template>

<script>
import parkingApplicationJs from '../mixins/parkingReceipt/parkingApplication';
import baseMixins from '../mixins/base';
export default {
  mixins: [baseMixins, parkingApplicationJs],
};
</script>

<style lang="less" scoped>
//@import '../../../styles/common.less';

.scroll-Y {
  width: 100%;
  display: flex;
  height: 100vh;
  overflow-y: scroll;
  flex-direction: column;
  // height: 88vh;
  background-color: #f4f7ff;
  // padding: 30px 20px;
  box-sizing: border-box;

  .push-box {
    padding: 30px 20px;
    width: 750px;
    box-sizing: border-box;
    margin-bottom: 180px;
  }

  .choose-invoice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    padding: 10px 0;
    font-size: 28px;
    background: #fafbff;
    // border: 1px solid #d8dae0;
    margin-bottom: 24px;
    border-radius: 4px;
    
    .invoice-header-info {
      flex: 1;

      .invoice-header-name {
        color: #333333;
        padding: 20px 35px;
        border-bottom: 0.8px dashed #E1E2E8 !important;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .isDefault {
          color: #fff;
          margin-left: 16px;
          background: var(--k-color-primary-01);;
          border-radius: 4px;
          padding: 4px 8px;
          font-family: 'PingFang SC';
          font-style: normal;
          font-weight: 400;
          font-size: 22px;
        }
      }

      .duty-paragraph {
        color: #999;
        // margin-top: 32px;
        padding: 20px 35px;
        display: flex;
        justify-content: space-between;
   
      }
    }
  }

  .tab-header {
    color: #333;
    padding: 28px 20px;
    background: #FBFCFF;
    border-bottom: 0.8px dashed #e1e2e8;
  }
  .tab-header2 {
    background: #fff;
    color: #333;
    padding: 20px 20px 20px;
    border-bottom: 1px dashed #e1e2e8;
  }
  .part {
    // background-color: #ffffff;

    background: #fafbff;
    // padding-left: 30px;
    margin-bottom: 20px;
    border-radius: 4px;
    padding: 30px 0;
    // border: 1px solid #d8dae0;
    .part-item-bg {
      background: var(--k-color-primary-05);
    }
    .part-item {
      font-size: 28px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 30px;
      padding-bottom: 20px;
      .part-item-key {
        color: #333333;
        min-width: 146px;
      }

      .part-item-value {
        color: #666;
        text-align: right;
        display: flex;
        align-items: center;
        .van-field__control {
          text-align: right;
        }
      }
    }

    .is-show-more {
      .part-item {
        padding-top: 32px;
      }
    }

    .tab-title {
      color: #676767;
      padding-top: 30px;
      padding-left: 35px;
    }

    .show-more {
      display: flex;
      justify-content: space-between;
      align-content: center;
      // padding-right: 30px;

      .arrow-box {
        // transform: rotate(90deg);
        // transition-duration:0.1s;
        > img {
          width: 30px;
        }
      }
    }

    .default-email {
      justify-content: flex-start;
      color: #999999;
      margin-top: 20px;
      // font-size: 28PX;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #999999;
      padding-bottom: 10px;
      .text {
        font-size: 28px;
        font-weight: 400;
        color: #999999;
        line-height: 40px;
      }
      // line-height: 80PX;
      // /deep/ .van-checkbox__icon {
      //   font-size: 25PX;
      // }
      // /deep/ .van-checkbox__label {
      //   line-height: 80PX;
      // }
    }
  }

  .top {
    margin-top: 20px;
    // padding-bottom: 0 !important;
    padding: 10px 30px !important;
  }

  .middle {
    padding-top: 10px;

    > .part-item {
      // background-color: #ffffff;
      // padding-left: 30px;
    }

    .purple {
      color: var(--k-color-primary-01);
    }
  }

  .footer {
    // padding-top: 20px;
    border-radius: 4px;
  }

  .textarea-remark {
    margin-bottom: 20px;

    > textarea {
      background-color: #fff;
      width: 100%;
      padding: 32px;
      // padding: 10px 20px;
      border-radius: 4px;
      box-sizing: border-box;
      height: 275px;
      border: none;
    }
  }

  .invoice-header-arrow {
    width: 30px;
  }

  .lines {
    border-bottom: 1px dashed #e1e2e8;
  }

  .toBottom {
    transform: rotate(90deg);
    transition-duration: 0.1s;
  }

  .toRight {
    transform: rotate(-90deg);
    transition-duration: 0.1s;
  }

  .header-name {
    // padding: 0 !important;
    border: unset !important;
  }
}
.push-btn {
  width: 100%;
  height: 170px;
  background-color: #fff;
  // padding: 0 41px;
  position: fixed;
  bottom: 0;
  z-index: 999;
  box-sizing: border-box;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 0 10px 0 hsla(0, 6%, 58%, 0.6);
  -webkit-box-shadow: 0 0 20px 0 hsla(0, 6%, 58%, 0.6);
  -moz-box-shadow: 0 0 20px 0 hsla(0, 6%, 58%, 0.6);
  // width: 100%;
  // padding: 20px 0;
  // position: fixed;
  // bottom: 0px;
  // height: 110px;
  // padding-bottom: constant(safe-area-inset-bottom);
  // padding-bottom: env(safe-area-inset-bottom);
  // box-shadow: 0 0 10px 0 hsla(0, 6%, 58%, 0.6);
  // -webkit-box-shadow: 0 0 20px 0 hsla(0, 6%, 58%, 0.6);
  // -moz-box-shadow: 0 0 20px 0 hsla(0, 6%, 58%, 0.6);

  .btn {
    // margin: 20px 60px;
    color: #ffffff;
    border-radius: 50px;
    text-align: center;
    // padding: 20px 0;
    height: 80px;
    line-height: 80px;
    width: 90%;
    margin: 0 auto;
    margin-top: 25px;
    border-radius: 45px;
  }

  .push-again-btn {
    // background-image: linear-gradient(to right, #7d4ea1, #40397c);
    background: var(--k-color-primary-01);
  }

  .blue-push-again-btn {
    .color-background-color('blue');
  }

  .green-push-again-btn {
    .color-background-color('green');
  }

  .disable-btn {
    background-color: #bdbdbd;
  }
}

.footer {
  width: 100%;
  //background-color: #ffffff;
  background-color: #fafbff;
  position: fixed;
  bottom: 0;
  box-shadow: 0 0 2px 0 hsla(0, 6%, 58%, 0.6);
  //padding-bottom: constant(safe-area-inset-bottom);
  //padding-bottom: env(safe-area-inset-bottom);
  //padding-bottom: 20px;
  //margin: 30px;
  padding: 30px 30px 50px 30px;
  //padding-bottom: constant(safe-area-inset-bottom);
  //padding-bottom: env(safe-area-inset-bottom);

  .push-again-btn {
    color: #ffffff;
    // background-image: linear-gradient(to right, #7d4ea1, #40397c);
    background-color: var(--k-color-primary-01);
    border-radius: 50px;
    text-align: center;
    //padding: 20px 0;
  }

  .blue-push-again-btn {
    .color-background-color('blue');
  }

  .green-push-again-btn {
    .color-background-color('green');
  }
}
</style>
