<!--packageI/invoice/invoice-details/invoice-details.wxml-->
<wxs module="fn">
module.exports = {
  invoiceType: function (type) {
    switch (parseInt(type)) {
      case 0:
        return "电子发票"
      case 1:
        return "普通发票"
      case 2:
        return "专用发票"
    }
  } 
}
</wxs>
<view class="invoice-details">
      <view class="content" wx:if="{{detailData}}">
        <view class="invoice">
          <view class="title">
            <icon class="iconfont {{true?'icon-all_select_active':'icon-fontclass-gantanhao'}}"></icon>
            <view>
              <view style="font-size:32rpx;">{{detailData.status == "1" ? "开票成功" : "未开票"}}</view>
              <view class="amount">
                <text>{{detailData.status=='1' ? "已开发票金额：" : "预计可开发票金额："}}</text>
                {{language['money']}}{{detailData.invoice_amount}}
                </view>
            </view>
          </view>
          <view class="detailed"> 
            <view class="title-name">增值税{{fn.invoiceType(invoiceType)}}</view>
            <progress-step list="{{ steps }}" currentIndex="{{ stepIndex }}" ></progress-step>
            <view class="list">
              <cell-item lable="发票类型" text="{{fn.invoiceType(invoiceType)}}">
                <text wx:if="{{invoiceType == '1'}}" style="color: #747474;">开票数量：{{detailData.invoice_count}}张</text>
              </cell-item>
              <cell-item lable="发票内容" text="{{detailData.content}}"></cell-item>
              <view class="download-invoice" wx:if="{{(invoiceType == '0') && detailData.status == '1'}}">
                <view class="invoiced-img-box" wx:if="{{detailData.invoice}}" bindtap="preview" data-src="{{detailData.invoice}}">
                  <image src="{{detailData.invoice}}" mode="aspectFill"></image>
                  <view class="img-num">1张</view>
                </view>
                <view class="download" bindtap="downpdf" data-download_url="{{detailData.invoice_pdf}}">
                  <icon class="iconfont icon-fontclass-xiazai"></icon>下载发票
                </view>
              </view>
              <cell-item lable="发票抬头" text="{{detailData.collect_name}}"></cell-item>
              <cell-item lable="抬头类型" text="{{item.rise_type==1?'个人':'单位'}}"></cell-item>
              <cell-item lable="开票金额" text="{{language['money'] + detailData.invoice_amount}}" rightColor="#f15353"></cell-item>
              <cell-item lable="申请时间" text="{{detailData.created_at}}"></cell-item>
              <cell-item lable="开票时间" text="{{detailData.invoice_time}}"></cell-item>
            </view>
          </view>
        </view>
        <view wx:if="{{invoiceType == '1'}}" class="info">
            <cell-item lable="收票人" text="{{detailData.col_name}}"></cell-item>
            <cell-item lable="联系电话" text="{{detailData.col_mobile}}"></cell-item>
            <cell-item lable="详细地址" text="{{detailData.col_address}}"></cell-item>
        </view>

        <!-- 商品店铺  -->
        <view class="shop-store">
            <view class="shop-name">
                <icon class="iconfont icon-dianpu"></icon>
                <text>{{detailData.shop_name}}</text>
            </view>

            <!-- 混合商品 -->
            <view class="mixin-goods flex-j-sb flex-a-c" wx:if="{{orderGoods.length > 1}}">
                <scroll-view scroll-x="true" enable-flex="true" class="left-goods-imgs">
                    <image wx:for="{{orderGoods}}" wx:key="index" src="{{item.thumb}}" mode="aspectFill"></image>
                </scroll-view>
                <view class="right-goods-info">
                    <view class="goods-price">{{language['money']}}{{detailData.invoice_amount}}</view>
                    <view class="goods-total">共{{orderGoods.length}}件</view>
                </view>
            </view>
            <!-- 单个商品 -->
            <view class="alone-goods flex-a-c" wx:else>
                <image class="left-img" src="{{orderGoods[0].thumb}}"></image>
                <view class="goods-name">{{orderGoods[0].title}}</view>
                <view class="right-goods-info">
                    <view class="goods-price">{{language['money']}}{{orderGoods[0].price || '0.00'}}</view>
                    <view class="goods-total">共{{orderGoods[0].total || 0}}件</view>
                </view>
            </view>

            <cell-item lable="订单编号" text="{{orderData.order_sn}}"></cell-item>
            <cell-item lable="下单时间" text="{{orderData.create_time}}"></cell-item>
            <cell-item lable="订单状态" text="{{orderData.status_name}}"></cell-item>
        </view>
      </view>


     <view class="send-email-box" wx:if="{{invoiceType == '0'}}">
        <view class="send-email-btn"  bindtap="showEditEmail">发送邮箱</view>
      </view>

    <!-- 填写邮箱地址 -->
      <van-overlay show="{{show}}" bindtap="hideEditEmail">
        <view class="wrapper" catchtap="noop">
          <view class="wrapper-item">
            <view style="margin: 32rpx 0;">请确认邮箱地址</view>
            <input class="email-input" value="{{email}}" placeholder="请填写邮箱地址" bindinput="changeEmail"></input>
            <view class="tips">提交成功后，系统会自动将您的发票发送至您的邮箱。</view>
            <view class="enter">
              <view catchtap="hideEditEmail">取消</view>
              <view class="right" catchtap="enterFun">确定</view>
            </view>
          </view>
        </view>
      </van-overlay>
  </view>
