<style scoped>
    .page_MyCustomer{
        padding-top: 25px;
    }
    .page_MyCustomer ._mc_addbox{height: 52px;width: 100%; margin-top: 20px;}
    .page_MyCustomer ._mc_addbox>li{float: left; width: 116px; font-size: 14px; height: 52px; color: #666; text-align: center; line-height: 52px; background: #E9E9E9; cursor: pointer;}
	.page_MyCustomer ._mc_addbox>li.active{background: #fff; color: #333;}
	.page_MyCustomer ._mc_addbox .divActive{margin: -3px auto; width: 26px; height: 3px; background: #E95252;}
    .page_MyCustomer ._mc_edit{overflow: auto;display: none;position:absolute;
     z-index: 50; bottom:0;left: 0;border-top:3px solid #38425d;background-color:#f9f9f9; padding: 10px;width: 100%;min-width: 1146px;} 
    .page_MyCustomer .edHeight{display: block;height: 191px;}
    .page_MyCustomer ._mc_list{overflow-x: auto; background: #fff; padding-top: 20px; padding-left: 15px;}
    .page_MyCustomer ._scrollbar::-webkit-scrollbar{width: 4px;height: 8px;}
    .page_MyCustomer ._scrollbar::-webkit-scrollbar-thumb{border-radius: 4px;-webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);background: #c9c9c9;}
    .page_MyCustomer ._scrollbar::-webkit-scrollbar-track{-webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);border-radius: 4px;background: #EDEDED;}
    .page_MyCustomer ._mc_edit ._tit{padding-left: 10px;border-left: 3px solid #E95252; font-size: 16px; font-family: 'PingFangSc-Fine'; color: #000000}
    .page_MyCustomer ._mc_edit ._info_box ul._form li{float: left;}
    .page_MyCustomer ._check_list{padding-left: 120px;margin-bottom: 20px;}
    .page_MyCustomer ._check_box .el-form-item{margin-bottom: 0}
    .page_MyCustomer ._info_box .el-form-item__label{font-size: 12px; color: #666;}
    ._remark textarea{resize: none;width: 646px;height: 100px}
	.page_MyCustomer  .avatar {
	    width: 148px;
	    height: 148px;
	    display: block;
	  }
  .page_MyCustomerSearch{width: 100%; min-height: auto; overflow: hidden; padding:0 0 20px 0;}
  .page_MyCustomerSearch li{float: left; font-size: 12px; color: #666; margin:20px 0 0px 0;}
  .page_MyCustomerSearch li>span {display: inline-block; }
  .page_MyCustomerSearch li span>em{display: inline-block; min-width: 60px; text-align: right; font-style: normal; margin:0 12px 0 0;}
  .page_MyCustomerSearch li:last-child{float: right;}
    .saleDepartmetTable{width: 100%; font-size:14px; color: #333; }
	.saleDepartmetTable tr{border-bottom: 2px solid #333;}
	.saleDepartmetTable tr th{background: #E6E6E6;height:30px; font-size: 12px; text-align: left; text-indent: 25px;}
	.saleDepartmetTable tr{background: #fff;text-align: left;}
	.saleDepartmetTable tr td{height: 60px; padding-left:25px; border-bottom:1px solid #f5f5f5; font-size: 14px; color: #333;}	
	.saleDepartmetTable tr td>img{width:24px;height:24px;border-radius:50%; float: left; margin-right: 5px;}
.saleDepartmetTable tr td .tuanqian{vertical-align: middle; font-weight:400; display: table-cell; text-align: center; width: 44px;font-size: 12px; height:19px;color: #FFFFFF;background:#2AAEF2;}
.saleDepartmetTable tr td .geqian{vertical-align: middle; font-weight:400; display: table-cell; text-align: center; width: 44px;font-size: 12px; height:19px;color: #FFFFFF;background:#FF9000;}
.page_MyCustomer ._edHeight{height:340px;}
.dateClass{width: 171px !important;}
.surplusNum{color: #E95252 !important;}
.peopleNum{height:15px;font-size:16px;font-weight:400;color:rgba(51,51,51,1);line-height:24px;}
.orderNum{cursor:pointer;text-decoration:underline;width:18px;height:16px;font-size:16px;font-weight:400;color:rgba(51,51,51,1);line-height:24px;}
.saleDepartmetTable tr td .createName{vertical-align: middle;  display: table-cell;text-align: left;padding-left:3px; height:21px;}
   .groupTourOrderIcon button{width: 28px; height:28px;border-radius:4px;}
	.groupTourOrderIcon .el-button--primary {padding: 5px; margin: 0; font-size: 14px!important;}
</style>
<template>
    <div class="page_MyCustomer">  
			<table class="saleDepartmetTable"  border="0" cellspacing="0" cellpadding="0"  v-loading='loading'>
			<tr>
				<th width="10%">产品名称</th>
				<th width="10%">签证类型</th>
				<th width="10%">送签时间</th>
				<th width="10%">成本价</th>
				<th width="10%">售价</th>
				<th width="10%">{{$t('admin.admin_status')}}</th>
				<th width="8%">订单数</th>
				<th width="12%">总人数（剩余人数）</th>
				<th width="10%">创建者</th>
				<th width="10%">{{$t('hotel.table_operat')}}</th>
			</tr>
			<tr v-for='item in dataList'>
				<td>{{item.Name}}</td>
				<td>
					<span v-if="item.VisaType==1" class="geqian">个签</span>
					<span v-else  class="tuanqian">团签</span>
				</td>
				<td>
				<span class="fbold">{{item.SendVisaDate}}</span>	
				</td>
				<td>
				<span class="totalPrice fbold" style="color: #47BF8C;">￥{{moneyFormat(item.CostPrice)}}</span>
				</td>
				<td>
				<span class="totalPrice fbold" style="color: #f90;">￥{{moneyFormat(item.VisaPrice)}}</span>
				</td>
				<td>
					<i v-if="item.VisaStatus==1" class="iconfont icon-shangjia" style="color:#4BCA81;"></i> 
					<i v-else class="iconfont icon-xiajia" style="color:#4BCA81;"></i> 
					{{item.VisaStatus==1?"上架":"下架"}}
				</td>	
				<td>
				<span class="orderNum" @click="goUrl(item)" >{{item.OrderNum}}</span>	
				</td>
					<td>
					<span class="peopleNum">{{item.PeopleNum}}(<span class="surplusNum">{{item.SurplusNum}}</span>)</span>
				</td>
				<td>
				<img v-if='!item.CreatePhoto' src="../../assets/img/litheader.png"/>
				    <img v-if='item.CreatePhoto' :onerror="defaultImg" :src='item.CreatePhoto'/>
				    <span class="createName">{{item.CreateName}}</span>
				</td>
				   <td class="groupTourOrderIcon">
				   	<el-button-group>
			            <el-tooltip  effect="dark" :content="$t('fnc.chakan')" placement="top-start">
			              <el-button type="primary" style='background:#25C1C3; border-color:#25C1C3' @click="goUrl(item)" icon="iconfont icon-img_cz"></el-button>
			            </el-tooltip>
			            </el-button-group>
				   </td>
			</tr>
			<tr v-show="dataList.length==0">
					<td v-show="dataList.length==0" colspan="10" align="center">{{$t('system.content_noData')}}</td>
			</tr>
		</table>
     
         <el-pagination 
            background
            @current-change="handleCurrentChange" 
            :current-page.sync="currentPage"
            layout="total,prev, pager, next, jumper"
            :page-size="this.msg.pageSize"
            :total="total">
        </el-pagination>
    </div>
</template>
<script>
export default {
    data(){
        return{
        	defaultImg: 'this.src="' + require("../../assets/img/litheader.png") + '"',
            msg:{
                pageIndex:1,
                pageSize:12,
                ProductName:'',
                StartTime:'',
                EndTime:'',
                EmId:'-1',
                VisaStatus:'-1',
                ProductID:this.$route.query.ID,
            },
            addMsg:{
                Id:0,
                Name:'',
                VisaType:'',
                SendVisaDate:'',
                VisaPrice:'',
				PeopleNum:'',
				CostPrice:'',
                CommissionPrice:'',
                VisaManagementId:''
            },
            rules:{
                Name:[{required: true, message: "请输入产品名称", trigger: "blur"}],
                customerName:[{required: true, message: "请输入客户名", trigger: "blur"}],
                VisaPrice:[
                    {required: true, message: "请输入售价", trigger: "blur"},
                    { pattern: this.$commonUtils.Regex.el_Isdecimal, message: "请输入售价" }
				],
				 CostPrice:[
                    {required: true, message: this.$t('objFill.qingshurucbj'), trigger: "blur"},
                    { pattern: this.$commonUtils.Regex.el_Isdecimal, message: "请输入成本价" }
                ],
                VisaType:[{required: true, message: "请选择类型", trigger: "change"}],
				PeopleNum:[{required: true, message: "请输入人数", trigger: "blur"}],  
				CommissionPrice:[{required: true, message: "请输入提成金额", trigger: "blur"},
				{ pattern: this.$commonUtils.Regex.el_Isdecimal, message: "请输入提成金额" }],
			},
			 dataList:[],
			 EmployeeList:[],
            loading:true,
            total: 0,
			addShow:false,
            currentPage: 1,
            VisaManagementList:[],
        }
    },methods:{
       getVisaManagementList(){  //  获取签证管理
        	this.VisaManagementList=[]
        	this.addMsg.VisaManagementId=''
            this.apipost('dmc_get_visa_GetVisaManagementList',{Status:-1,BranchId:-1,SignStatus:this.addMsg.VisaType},res=>{
                if(res.data.resultCode==1){
                    this.VisaManagementList = res.data.data
                }else{
                    this.$message.error(res.data.message)
                }
            },err=>{})
       },

    	goUrl(obj){
     	   this.$router.push({ name: 'VisaProductOrderCopy',query:{"id":obj.Id,"name":obj.Name,"sendDate":obj.SendVisaDate,"isShow":0,"EmId":"-1"} }) 
		},
        getList(){  // 获取列表数据
            this.apipost('dmc_get_visa_GetVisaProductList',this.msg,res=>{
                if(res.data.resultCode==0){
                    this.loading = false;
                    this.dataList=[]
                }else{
                    this.dataList = res.data.data.pageData;
                    this.total = res.data.data.count;
                    this.loading = false;
                }
            },err=>{})
		},
			getDetail(obj){
				this.addMsg.Id=obj.Id
				this.apipost('dmc_get_visa_GetVisaProductInfo',{Pid:obj.Id},res=>{
					if(res.data.resultCode == 1) {
						this.addMsg.VisaType=res.data.data.VisaType.toString()
						this.getVisaManagementList()
						this.addMsg.VisaManagementId = res.data.data.VisaManagementId
						this.addMsg.Name=res.data.data.Name
						
						this.addMsg.SendVisaDate=res.data.data.SendVisaDate
						if(res.data.data.CostPrice){
							this.addMsg.CostPrice=res.data.data.CostPrice.toString()
						}
						else{
							this.addMsg.CostPrice=''
						}
						this.addMsg.VisaPrice=res.data.data.VisaPrice.toString()
						this.addMsg.PeopleNum=res.data.data.PeopleNum.toString()
						this.addMsg.CommissionPrice=res.data.data.CommissionPrice.toString()
						this.addShow=true;
					}else{
					}
				},err=>{})
			},
			updateVisaStatus(obj){
				this.addMsg.Id=obj.Id
				this.apipost('dmc_post_visa_SetVisaProductStatus',{Pid:obj.Id},res=>{
					if(res.data.resultCode == 1) {
					 this.addShow=false
                    this.getList()
					this.$message.success(res.data.message)
					}else{
						this.$message.error(res.data.message)
					}
				},err=>{})
			},
        saveVisa(){  // 保存
        	     this.addMsg.VisaManagementId==''?'0':this.addMsg.VisaManagementId
           		 this.apipost('dmc_post_visa_SetVisaProduct',this.addMsg,res=>{
                if(res.data.resultCode==1){
                    this.addMsg={
					Id:0,
					Name:'',
					VisaType:'',
					SendVisaDate:'',
					VisaPrice:'',
					PeopleNum:'',
					CostPrice:'',
					CommissionPrice:'',
                    }
                    this.$message.success(res.data.message)
                    this.addShow=false
                    this.getList()
                }else{
                    this.$message.error(res.data.message)
                }
            },err=>{})
        },
        cancelEdit(){  // 取消新增
            this.addShow=false
            this.addMsg={
				  Id:0,
                Name:'',
                VisaType:'',
                SendVisaDate:'',
                VisaPrice:'',
				PeopleNum:'',
				CostPrice:'',
                CommissionPrice:'',
                VisaManagementId:''
            }
            this.resetForm('addMsg')
        },
        resetForm(formName) {  // 重置表单
            this.$refs[formName].resetFields();
        },
        handleCurrentChange(val) {  
            this.msg.pageIndex = val;
            this.getList();
        },
    },mounted(){
        this.getList();
    }
}
</script>
