<template>
    <div class="signatureHandle">
        <div class="signatureHandle_tableBox">
            <table class="signatureHandle_table" border="0" cellspacing="0" cellpadding="0" :loading="loading">
                <thead>
                    <tr>
                        <th width="6%">签证分类</th>
                        <th width="12%">出发日期</th>
                        <th width="12%">个签单号</th>
                        <th width="6%">办签人数</th>
                        <th width="10%">负责销售</th>
                        <th width="8%">办签总数</th>
                        <th width="8%">签证费用</th>
                        <th width="8%">费用申请</th>
                        <!-- <th width="10%">操作人</th> -->
                        <th width="20%">备注</th>
                    </tr>
                </thead>
                <tbody v-show="tableList.length>0" v-for="(item, index) in tableList" :key="index">
                    <tr v-for="(item2,index2) in item.list" :key="index2">
                        <td v-if="index2===0" :rowspan="item.list.length">{{item.VisaName}}</td>
                        <td v-if="index2===0" :rowspan="item.list.length">{{item2.EnterCountryTime}}</td>
                        <td>{{item2.VisaTCNUM}}</td>
                        <!-- <td>{{item2.VisaName}}</td> -->
                        <td><span class="signatureHandle_url" @click="goUrlR('VisaProductOrder', item2.VisaId)">{{item2.PeopleNum}}</span></td>
                        <!-- <td><span class="signatureHandle_url" @click="goUrlR('RegistrationList', msg.TCID)">{{item.OrderId}}</span></td> -->
                        <!-- <td><span class="signatureHandle_url" @click="goUrlR('RegistrationList', msg.TCID)">{{item.VisaNum}}</span></td> -->
                        <!-- <td><span class="signatureHandle_url" @click="goUrlR('RegistrationList', msg.TCID)">{{item.NotVisaNum}}</span></td> -->
                        <td>{{item2.CreateBy}}</td>
                        <td v-if="index2===0" :rowspan="item.list.length">{{item2.TotalNum}}</td>
                        <td v-if="index2===0" :rowspan="item.list.length">{{item2.TotalMoney}}</td>
                        <td v-if="index2===0&&item.VisaIds.length<item.list.length" :rowspan="item.list.length-item.VisaIds.length">
                            <span class="signatureHandle_tickets" v-for="(item3,index3) in item.FinanceList" :key="index3">
                                <span v-if="item3.ColorState===1" class="signatureHandle_tickets_blue" @click="goUrlT('财务单据','FinancialDocumentsDetail',item3.FrID,'')">{{item3.FrID}}</span>
                                <span v-else-if="item3.ColorState===2" class="signatureHandle_tickets_green" @click="goUrlT('财务单据','FinancialDocumentsDetail',item3.FrID,'')">{{item3.FrID}}</span>
                                <span v-else class="signatureHandle_tickets_red" @click="goUrlT('财务单据','FinancialDocumentsDetail',item3.FrID,'')">{{item3.FrID}}</span>
                            </span>
                        </td>
                        <td v-if="index2===item.list.length-item.VisaIds.length&&item.VisaIds.length!==0" :rowspan="item.VisaIds.length">
                            <span class="signatureHandle_apply" @click="goUrlTA(item)">添加</span>
                        </td>
                        <!-- <td></td> -->
                        <td>{{item2.Remark}}</td>
                    </tr>
                </tbody>
                <tbody v-show="tableList.length===0" class="signatureHandle_table_noInfo">
                    <tr>
                        <td colspan="10" class="">暂无数据</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            loading: false,
            msg: {
                StartTime: '',
                VoId: ''
            },
            tableList:[]
        };
    },
    methods: {
        getData: function () {
            this.loading = true
            this.apipost("dmc_get_GetVisaOrderWork", this.msg, res => {
                if (res.data.resultCode == 1) {
                    let dataList = res.data.data
                    for (let i = 0; i < dataList.length; i++) {
                        dataList[i]['VisaIds'] = []
                        for (let j = 0; j < dataList[i].list.length; j++) {
                            if (dataList[i].list[j].FinanceId === 0) {
                                dataList[i].VisaIds.push(dataList[i].list[j].Id)
                            }
                        }
                    }
                    this.tableList = dataList
                } else {
                    this.$message.error(res.data.message)
                }
                this.loading = false
            });
        },
        goUrlR(path, id) {
            this.$router.push({ name: path, query: { id: id,blank:'y',tab: '签证报名清单'} });
        },
        goUrlT(name, path, id, tcmun) {
            this.$router.push({ name: path, query: { id: id, tcmun: tcmun, blank: 'y', tab: name} });
        },
        goUrlTA(item) {
            let orderObj = {
                OrderID: '',
                OrderSource: 10,
                Obj: {},
                SourceID: '',
                VisaIds: item.VisaIds.join(',')
            }
            this.$router.push({
                name: 'ChoiceAddFinancialDocuments',
                query:{
                    'Type':2,
                    'path':'SaleOrderModule',
                    'companyID':'',
                    'orderObj': JSON.stringify(orderObj),
                    'blank':'y'
                }
            });
        }
    },
    mounted: function (){
        this.msg.StartTime = this.$route.query.StartTime===undefined?"":this.$route.query.StartTime
        this.msg.VoId = this.$route.query.VoId===undefined?"":this.$route.query.VoId
        this.getData()
    }
};
</script>

<style>
.signatureHandle {
  width: 100%;
}
.signatureHandle_tableBox {
  padding: 20px 0 0 0;
  width: 100%;
}
.signatureHandle_table {
  width: 100%;
  color: #333;
  border-bottom: 1px solid #cccccc;
  border-right: 1px solid #cccccc;
}
.signatureHandle_table tr {
  border-bottom: 2px solid #333;
  background: #fff;
}
.signatureHandle_table tr th {
  background: #e6e6e6;
  height: 30px;
  font-size: 12px;
  text-align: left;
  text-indent: 15px;
  border-top: 1px solid #cccccc;
  border-left: 1px solid #cccccc;
}
.signatureHandle_table tr td {
  padding: 10px;
  font-size: 12px;
  border-top: 1px solid #cccccc;
  border-left: 1px solid #cccccc;
}
.signatureHandle_table_noInfo tr td {
  height: 30px;
  text-align: center;
  font-size: 12px;
  color: #999999;
}
.signatureHandle_url{
  text-decoration: underline;
  cursor: pointer;
}
.signatureHandle_apply{
  color: #2aaef2;
  cursor: pointer;
}

.signatureHandle_tickets{
    margin: 5px 5px 0 0;
    cursor: pointer;
}
.signatureHandle_tickets_red{
	color: #FF0000;
	text-decoration: underline;
}
.signatureHandle_tickets_blue{
	color: #0000FF;
	text-decoration: underline;
}
.signatureHandle_tickets_green{
	color: #008000;
	text-decoration: underline;
}
</style>