<template>
    <div class="visaWorksheet">
        <div class="visaWorksheet_tableBox">
            <table class="visaWorksheet_table" border="0" cellspacing="0" cellpadding="0" :loading="loading">
                <thead>
                    <tr>
                        <th width="12%">公司团号</th>
                        <th width="12%">单号</th>
                        <th width="6%">办签人数</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">
                    <tr v-for="(item,index) in tableList" :key="index">
                        <td v-if="index===0" :rowspan="tableList.length">{{item.TCNUM}}</td>
                        <td><span class="visaWorksheet_url" @click="goUrlR('RegistrationList', msg.TCID)">{{item.OrderId}}</span></td>
                        <td><span class="visaWorksheet_url" @click="goUrlR('RegistrationList', msg.TCID)">{{item.VisaNum}}</span></td>
                        <td><span class="visaWorksheet_url" @click="goUrlR('RegistrationList', msg.TCID)">{{item.NotVisaNum}}</span></td>
                        <td>{{item.CreateByName}}</td>
                        <td v-if="index===0" :rowspan="tableList.length"><span class="visaWorksheet_url" @click="goUrlR('RegistrationList', msg.TCID)">{{item.VisaTotal}}</span></td>
                        <td v-if="index===0" :rowspan="tableList.length">{{item.VisaTMoney}}</td>
                        <td v-if="index===0" :rowspan="tableList.length">
                            <span class="visaWorksheet_tickets" v-for="(item2,index2) in financeList" :key="index2">
                                <span v-if="item2.ColorState===1" class="visaWorksheet_tickets_blue" @click="goUrlT('财务单据','FinancialDocumentsDetail',item2.FrID,'')">{{item2.FrID}}</span>
                                <span v-else-if="item2.ColorState===2" class="visaWorksheet_tickets_green" @click="goUrlT('财务单据','FinancialDocumentsDetail',item2.FrID,'')">{{item2.FrID}}</span>
                                <span v-else class="visaWorksheet_tickets_red" @click="goUrlT('财务单据','FinancialDocumentsDetail',item2.FrID,'')">{{item2.FrID}}</span>
                            </span>
                            <span class="visaWorksheet_apply" @click="goUrlTA(item)">添加</span>
                        </td>
                        <!-- <td></td> -->
                        <td>{{item.Remarks}}</td>
                    </tr>
                </tbody>
                <tbody v-show="tableList.length===0" class="visaWorksheet_table_noInfo">
                    <tr>
                        <td colspan="10" class="">暂无数据</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            loading: false,
            msg: {
                TCID: '0'
            },
            tableList:[],
            financeList: []
        };
    },
    methods: {
        getData: function () {
            this.loading = true
            this.apipost("sellorder_get_GetTravelVisaWorklist", this.msg, res => {
                if (res.data.resultCode == 1) {
                    this.tableList = res.data.data.list
                    this.financeList = res.data.data.FinanceList
                } 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: 8,
                Obj: {},
                SourceID: '',
                TCIDList: [item.TCID]
            }
            this.$router.push({
                name: 'ChoiceAddFinancialDocuments',
                query:{
                    'Type':2,
                    'path':'SaleOrderModule',
                    'companyID':item.RB_Branch_Id,
                    'orderObj': JSON.stringify(orderObj),
                    'blank':'y'
                }
            });
        }
    },
    mounted: function (){
        this.msg.TCID = this.$route.query.tcid===undefined?"0":this.$route.query.tcid
        this.getData()
    }
};
</script>

<style>
.visaWorksheet {
  width: 100%;
}
.visaWorksheet_tableBox {
  padding: 20px 0 0 0;
  width: 100%;
}
.visaWorksheet_table {
  width: 100%;
  color: #333;
  border-bottom: 1px solid #cccccc;
  border-right: 1px solid #cccccc;
}
.visaWorksheet_table tr {
  border-bottom: 2px solid #333;
  background: #fff;
}
.visaWorksheet_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;
}
.visaWorksheet_table tr td {
  padding: 10px;
  font-size: 12px;
  border-top: 1px solid #cccccc;
  border-left: 1px solid #cccccc;
}
.visaWorksheet_table_noInfo tr td {
  height: 30px;
  text-align: center;
  font-size: 12px;
  color: #999999;
}
.visaWorksheet_url{
  text-decoration: underline;
  cursor: pointer;
}
.visaWorksheet_apply{
  color: #2aaef2;
  cursor: pointer;
}

.visaWorksheet_tickets{
    margin: 5px 5px 0 0;
    cursor: pointer;
}
.visaWorksheet_tickets_red{
	color: #FF0000;
	text-decoration: underline;
}
.visaWorksheet_tickets_blue{
	color: #0000FF;
	text-decoration: underline;
}
.visaWorksheet_tickets_green{
	color: #008000;
	text-decoration: underline;
}
</style>