<style scoped>
    .Receipt_box{padding: 15px;color: #c94052;width: 100%;background-color: rgba(245, 245, 245, 1);border-top: 1px dashed #BFBFBF; }
    .Receipt_box tr th{color: #c94052}
    .Receipt_box.color_blur tr th{color: #106BAF}
    .Receipt_box.color_blur{color: #106BAF;}
    .Receipt_box.color_blur .rb_stit span{display: inline-block;border-bottom: 2px solid #106BAF;padding: 0 20px}
    .rb_tit{font-size: 18px;text-align: center}
    .rb_stit{font-size: 14px;text-align: center}
    .rb_stit span{display: inline-block;border-bottom: 2px solid #C94052;padding: 0 20px}
    .rb_top_row{display: flex;justify-content: space-between;font-size: 12px;}
    .rb_top_row span._r_name{color: #333333}
    .rb_top_row span._r_bold{font-weight: bold}
    .rb_top_row ._r_time span{color: #333333}
    ._r_mb5{margin-bottom: 5px;}
    .Receipt_table{width: 100%;font-size: 14px;text-align: center}
    .Receipt_table th{font-weight: 200 !important}
    .Receipt_table tr th,.Receipt_table tr td{background-color: white}
    ._r_mt10{margin-top: 10px;}
    .Receipt_box.color_blur{color: #106BAF;}
    .Receipt_box.color_blur .rb_stit span{display: inline-block;border-bottom: 2px solid #106BAF;padding: 0 20px}
    ._show_img_box{position: fixed; background: rgba(0,0,0,.6); left: 0; top:0;  width: 100%; height: 100%; z-index: 999; text-align: center;}
    ._font_size12{font-size: 12px !important}
</style>
<template v-if="GetDetail" v-loading="loading">
    <div class="Receipt_box" :class="GetDetail.Type==1?'':'color_blur'" :style="{width:width,backgroundColor:color}" @click.stop v-loading='loading'>
            <p class="rb_tit">{{GetDetail.CompanyName}}（{{GetDetail.BranchName}}）</p>
            <p class="rb_stit">
                <span>{{GetDetail.Type==1?$t('fnc.cnskuandan'):$t('fnc.cnfkuandan')}}</span>
            </p>
            <div class="rb_top_row _r_mb5">
                <p v-if="GetDetail.Type==1">{{$t('fnc.hnrdanwei')}}：<span class="_r_name">{{GetDetail.RemitterName}}</span></p>
                <p v-if="GetDetail.Type==2">{{$t('fnc.fkduixiang')}}：<span class="_r_name">{{GetDetail.AccountHolder}}</span></p>
                <p style="display:none"><span class="_r_bold">No.</span>{{GetDetail.FrID}}-{{$t('fnc.cnfshulian')}}</p>
            </div>
            <div class="rb_top_row _r_mb5">
                <p v-if="GetDetail.Type==1">{{$t('fnc.fkzhlshuihao')}}：<span class="_r_name">{{GetDetail.AccountNumber}} （{{GetDetail.CreateDate}}）</span></p>
                <p v-if="GetDetail.Type==2">{{$t('fnc.fkzhanghu')}}<span class="_r_name">{{GetDetail.AccountNumber}}（{{GetDetail.CreateDate}}）</span></p>
                <p><span class="_r_bold">No.</span>{{GetDetail.FrID}}-{{$t('fnc.cnfshulian')}}</p>
            </div>
            <table class="Receipt_table" border="1" :bordercolor="GetDetail.Type==1?'#c94052':'#106BAF'" style="border-collapse:collapse;">
                <tr>
                    <th rowspan="2">{{$t('fnc.fkfangshi')}}</th>
                    <th rowspan="2">{{$t('hotel.hotel_Currency')}}</th>
                    <th rowspan="2">{{$t('fnc.zhanghuleixing')}}</th>
                    <th colspan="3">{{$t('fnc.jine')}}</th>
                    <th rowspan="2" width="180">{{$t('hotel.hotel_remark')}}</th>
                </tr>
                <tr>
                    <th width="88">{{$t('fnc.yuanbi')}}</th>
                    <th width="50">{{$t('hotel.hotel_CurrentRate')}}</th>
                    <th width="88">{{$t('fnc.bweibi')}}</th>
                </tr>
                <tr v-for="(item,index) in GetDetail.CashierDetail">
                    <td height="26px">{{item.Alias+item.BankNo}}</td>
                    <td height="26px">{{item.CurrencyName}}</td>
                    <td height="26px">{{item.TypeName}}</td>
                    <td height="26px">{{item.OriginalMoney}}</td>
                    <td height="26px">{{item.Rate}}</td>
                    <td height="26px">{{item.Money}}</td>
                    <td height="26px">
                        <template v-for="(son,sindex) in item.VorcherInos">
                            <span v-if="son.VoucherType==2">{{son.Content}}</span>
                            <i v-else class="iconfont icon-sousuo" @click="showImg(son.Content)"></i>
                        </template>
                    </td>
                </tr>
                <tr v-if="GetDetail.CashierDetail&&GetDetail.CashierDetail.length<2">
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                </tr>
                <tr v-if="GetDetail.CashierDetail&&GetDetail.CashierDetail.length<3">
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                </tr>
                <tr v-if="GetDetail.CashierDetail&&GetDetail.CashierDetail.length<4">
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                    <td height="26px"></td>
                </tr>
                <tr>
                    <td>{{GetDetail.Type==1?$t('fnc.skjine'):$t('fnc.fkjine')}}<br/><span class="_font_size12">{{$t('fnc.daxie')}}</span></td>
                    <td colspan="2">{{cnAllMoney==''?$t('fnc.ling'):cnAllMoney}}</td>
                    <td colspan="1">{{GetDetail.Type==1?$t('fnc.skjine'):$t('fnc.fkjine')}}<br/><span class="_font_size12">{{$t('fnc.xiaoxie')}}</span></td>
                    <td colspan="3">{{allMoney}}</td>
                </tr>
            </table>
            <div class="rb_top_row _r_mt10">
                <template v-for="(item,index) in GetDetail.AuditSteps">
                    <p>{{item.AuditDescription}}：
                        <template v-if="item.AuditRecordList&&item.AuditRecordList.length!=0">
                            <!-- <span v-if="si!=item.AuditRecordList-1">,</span> -->
                            <span class="_r_name" v-for="(s,si) in item.AuditRecordList" v-if="item.Sort==0 || (item.Sort!=0&&s.AuditStatus==2)">{{s.AuditName}} </span>
                        </template>                        
                    </p> 
                </template>
            </div>
            <div v-if='picIsShow' class="_show_img_box" @click="picIsShow=false,picObj=[]">
                <div style="position: absolute; width: 800px; height: 600px; left: 50%; top: 50%; margin-left: -400px; margin-top: -300px;">
                    <el-carousel :initial-index=initialIndex height="600px" :interval="5000" trigger="click">
                    <el-carousel-item  v-for="(item,index) in picObj" :key="index">
                        <img :src="item"  style="width: 100%; height: 100%;"/>
                    </el-carousel-item>
                    </el-carousel>
                </div>
            </div>
        </div>
</template>
<script>
export default {
    props:["ID","width","color","GetDetail"],  //接收参数 ID width color
    data(){
        return{
            picObj:[],
            loading:true,
            picIsShow:false,
            allMoney:0,
            cnAllMoney:'',
        }
    },methods:{
        showImg(obj){
            this.picObj= obj;
            this.picIsShow= true;
        },
        Financial_post_GetDetail(id){  //获取单据详情
            if(!id) return
            this.loading = true;
            this.apipost('Financial_post_GetDetail',{ID:id}, res => {
                if(res.data.resultCode == 1) {
                    let data= res.data.data;
                    let Money = 0;
                    data.DetailList.forEach(x=>{
                        x.UnitPrice = this.$commonUtils.addCommas(Math.round(x.UnitPrice * 100) / 100);
                        x.Money = Math.round(x.Money * 100) / 100;
                        x.OriginalMoney = Math.round(x.OriginalMoney * 100) / 100;;
                        
                    })
                    data.CashierDetail.forEach(y=>{
                        Money = Money+parseFloat(y.Money);
                    })
                    this.cnAllMoney = this.$commonUtils.changeMoneyToChinese(Math.round(Money * 100) / 100);
                    this.allMoney = this.$commonUtils.addCommas(Math.round(Money * 100) / 100);
                    data.ChineseMoney = this.$commonUtils.changeMoneyToChinese(data.Money);
                    data.Money = this.$commonUtils.addCommas(Math.round(data.Money * 100) / 100);
                    data.AuditSteps.reverse();
                    this.GetDetail = data;
                    this.loading=false;
                }
            }, err => {})
        },        
    },mounted(){
        // this.Financial_post_GetDetail(this.ID)
    },watch: {  // 监听参数变化
        // GetDetail: {
        //     handler: function(val, oldVal) {
        //         // console.log(val)
        //         // console.log(oldVal)
        //     },
        //     deep: true
        // },
        // ID:{
        //     handler: function(val, oldVal) {
        //         this.ID = val
        //         this.Financial_post_GetDetail(this.ID)
        //     },
        //     deep: true
        // }
    }
}
</script>
