<template>
	<div>
		<div style="display: inline-block;">
			<div style="position: relative;display: inline-block;margin: 5px;">
				<span>状态：</span>
				<el-select v-model="statusT" style="width:150px;margin-left: 10px;" @change="select()">
					<el-option v-for="item in statesnum" :key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>&nbsp;&nbsp;
			</div>
			<div style="position: relative;display: inline-block;margin: 5px;">
				<span>用户昵称：</span>
				<el-input style="width: 200px;" @keydown.enter.native="select" placeholder="请输入姓名" v-model="userName">
				</el-input>&nbsp;&nbsp;
			</div>
			<div style="position: relative;display: inline-block;margin: 5px;">
				<span>企业名称：</span>
				<el-input style="width: 200px;" @keydown.enter.native="select" placeholder="请输入企业名称"
					v-model="companyNameT">
				</el-input>&nbsp;&nbsp;
			</div>
			<div style="position: relative;display: inline-block;margin: 5px;">
				<span>企业电话：</span>
				<el-input style="width: 200px;" @keydown.enter.native="select" placeholder="请输入企业电话"
					v-model="companyPhoneT">
				</el-input>&nbsp;&nbsp;
			</div>
			<div style="margin:5px;display: inline-block;">
				<span>开始时间：</span>
				<el-date-picker style="width: 160px;margin-left: 10px;" v-model="startTime" align="right"
					type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择开始时间">
				</el-date-picker>&nbsp;&nbsp;&nbsp;
			</div>
			<div style="margin:5px;display: inline-block;">
				<span>截止时间：</span>
				<el-date-picker style="width: 160px;margin-left: 10px;" v-model="endTime" align="right" type="date"
					format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择截止时间">
				</el-date-picker>
			</div>
			<el-button style='margin: 5px;' size="mini" type="primary" icon="document" @click="select">查询
			</el-button>
			<el-button style='margin: 5px;' size="mini" type="primary" icon="document" @click="cleans">重置
			</el-button>
			<!-- v-if="isAuth('autonym:pass')" -->
			<el-button style='margin:0 0 20px 20px;' size="mini" type="primary" icon="document" @click="addClick()">添加
			</el-button>
			<el-button style='margin-left:15px;' size="mini" type="warning" icon="document" :disabled="!isAuth('user:daochu')" @click="exportBtn">导出Excel
			</el-button>
		</div>
		<div style="color: orange;"> * 导出数据提示：导出数据前请进行时间或者状态等筛选，否则导出单量过多易出现卡顿或系统崩溃</div>
		<el-table v-loading="tableDataLoading" :data="tableData.records">
			<!-- @selection-change="changeFun" <el-table-column type="selection" fixed>
			</el-table-column> -->
			<el-table-column prop="companyId" label="编号" width="80" fixed="left">
			</el-table-column>
			<!-- <el-table-column prop="classify" label="类型" width="80">
				<template slot-scope="scope">
					<span v-if="scope.row.classify==null || scope.row.classify==1 ">企业</span>
					<span v-else>个人</span>
				</template>
			</el-table-column> -->
			<el-table-column prop="userName" label="姓名" width="100" fixed="left">
				<template slot-scope="scope">
					<span style="color: #4f9dec;cursor: pointer;"
						@click="updates(scope.row)">{{scope.row.userName ? scope.row.userName : '未绑定'}}</span>
				</template>
			</el-table-column>
			<el-table-column prop="phone" label="电话" width="150">
				<template slot-scope="scope">
					<span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row)" v-if="isAuth('userList:phone')">
						{{ scope.row.phone ? scope.row.phone : '未绑定' }}
					</span>
					<span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row)" v-else>
						{{ scope.row.phone1 ? scope.row.phone1 : '-' }}
					</span>
				</template>
			</el-table-column>
			<el-table-column prop="companyLegalPerson" label="企业法人" width="100">
				<template slot-scope="scope">
					<span style="color: #4f9dec;cursor: pointer;"
						@click="updates(scope.row)">{{scope.row.companyLegalPerson ? scope.row.companyLegalPerson : '未绑定'}}</span>
				</template>
			</el-table-column>
			<!-- <el-table-column prop="phone" label="类型" width="80">
				<template slot-scope="scope">
					<span v-if="scope.row.classify==1">个人</span>
					<span v-else-if="scope.row.classify==2">企业</span>
					<span v-else>无</span>
				</template>
			</el-table-column> -->

			<el-table-column prop="companyAllName" label="企业名称" width="200">
			</el-table-column>
			<el-table-column prop="companyLogo" label="企业头像" width="150">
				<template slot-scope="scope">
					<div v-if="scope.row.companyLogo == null || scope.row.companyLogo == ''">
						暂无图片
					</div>
					<div v-if="scope.row.companyLogo" style="display:flex;flex-wrap: wrap;">
						<el-popover placement="top-start" title="" trigger="hover">
							<img style="width: 50px; height: 50px" :src="scope.row.companyLogo" alt="" slot="reference">
							<img style="width: 200px; height: 200px" :src="scope.row.companyLogo" alt="">
						</el-popover>
					</div>
				</template>
			</el-table-column>
			<el-table-column prop="companyCertification" label="营业执照" width="150">
				<template slot-scope="scope">
					<div style="display:flex;flex-wrap: wrap;" v-if="scope.row.companyCertification">
						<div v-for="(item,index) in scope.row.companyCertification.split(',')" :key="index">
							<el-popover placement="top-start" title="" trigger="hover">
								<img style="width: 50px; height: 50px" :src="item" alt="" slot="reference">
								<img style="width: 400px; height: auto" :src="item" alt="">
							</el-popover>
						</div>
					</div>
				</template>
			</el-table-column>
			<el-table-column prop="employmentVerification" label="在职证明" width="200">
				<template slot-scope="scope">
					<!-- 字段为空时显示"无" -->
					<div v-if="!scope.row.employmentVerification">
					<span style="color: #999;">无</span>
					</div>
					
					<!-- 有PDF链接时显示下载按钮 -->
					<div v-else>
					<el-button 
						type="text" 
						@click="handlePdfDownload(scope.row.employmentVerification)"
						style="color: #409EFF; padding: 0;"
					>
							<div style="display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 3;overflow: hidden;max-height:80px;" >
							<el-popover placement="top-start" title="" trigger="hover">
								<div slot="reference">{{scope.row.employmentVerificationName || '在职证明.pdf'}}</div>
								<div style="width: 400px;">{{scope.row.employmentVerificationName || '在职证明.pdf'}}</div>
							</el-popover>
							</div>
					</el-button>
					</div>
				</template>
			</el-table-column>
			<el-table-column prop="companyVerification" label="公司证明" width="150">
				<template slot-scope="scope">
					<!-- 仅在有图片数据时展示容器 -->
					<div v-if="scope.row.companyVerification" style="display:flex;flex-wrap: wrap;gap: 4px;align-items: center;">
					<!-- 第一步：先处理图片链接数组，去重+过滤空值，再限制最多4张 -->
					<div 
						v-for="(item,index) in formatImageList(scope.row.companyVerification)" 
						:key="index"
						style="cursor: pointer;"
					>
						<el-popover placement="top-start" title="" trigger="hover">
						<!-- 缩略图：添加加载失败的占位处理 -->
						<img 
							style="width: 50px; height: 50px;object-fit: cover;border-radius: 2px;" 
							:src="item" 
							alt="公司证明图片" 
							slot="reference"
							@error="(e) => handleImageError(e)"
						>
						<!-- 弹窗大图：同样添加失败处理 -->
						<img 
							style="max-width: 400px; max-height: 400px;object-fit: contain;" 
							:src="item" 
							alt="公司证明图片"
							@error="(e) => handleImageError(e)"
						>
						</el-popover>
					</div>
					
					<!-- 超过4张时显示剩余数量提示 -->
					<div 
						v-if="scope.row.companyVerification.split(',').filter(img => img).length > 4" 
						style="color: #909399;font-size: 12px;margin-left: 4px;"
					>
						+{{ scope.row.companyVerification.split(',').filter(img => img).length - 4 }}
					</div>
					</div>
					<!-- 无数据时空白 -->
				</template>
			</el-table-column>
			<!-- <el-table-column prop="companyDutyParagraph" label="企业税号" width="160">
			</el-table-column> -->
			<el-table-column prop="companyPeople" label="企业规模">
			</el-table-column>
			<el-table-column prop="companyCreateTime" label="注册时间">
			</el-table-column>
			<el-table-column prop="companyScope" label="经营范围" width="200">
			</el-table-column>
			<el-table-column prop="companyAddress" label="企业地址" width="160">
			</el-table-column>
			<el-table-column prop="companyRegisteredFund" label="注册资金(单位:万)" width="160">
			</el-table-column>
			<el-table-column prop="email" label="企业邮箱" width="160">
			</el-table-column>
			<!-- <el-table-column prop="companyContent" label="招聘信息" width="200">
				<template slot-scope="scope">
					<div style="display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 3;overflow: hidden;max-height:80px;" >
					<el-popover placement="top-start" title="" trigger="hover">
						<div slot="reference">{{scope.row.companyContent}}</div>
						<div style="width: 400px;">{{scope.row.companyContent}}</div>
					</el-popover>
					</div>
				</template>
			</el-table-column> -->
			<el-table-column prop="companyContent" label="公司简介" width="200">
				<template slot-scope="scope">
					<div style="display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 3;overflow: hidden;max-height:80px;" >
					<el-popover placement="top-start" title="" trigger="hover">
						<div slot="reference">{{scope.row.companyContent}}</div>
						<div style="width: 400px;">{{scope.row.companyContent}}</div>
					</el-popover>
					</div>
				</template>
			</el-table-column>
			<el-table-column prop="auditContent" label="审核内容" width="160">
			</el-table-column>
			<el-table-column prop="createTime" label="创建时间" width="160">
			</el-table-column>
			<el-table-column prop="isRecommend" label="是否推荐" fixed="right">
				<template slot-scope="scope">
					<el-switch v-model="scope.row.isRecommend"
						@change="changeTj(scope.row.companyId,scope.row.isRecommend)"
						:active-value="openValue" :disabled="!isAuth('autonym:tongguo')"
						:inactive-value="closeValue" active-color="#13ce66" inactive-color="#ff4949">
					</el-switch>
				</template>
			</el-table-column>
			<el-table-column fixed='right' prop="status" label="状态" width="160">
				<template slot-scope="scope">
					<span v-if="scope.row.status == 1">待审核</span>
					<span v-if="scope.row.status == 2">已通过</span>
					<span v-if="scope.row.status == 3">已拒绝</span>
				</template>
			</el-table-column>
			<el-table-column fixed='right' label="操作" width="180">
				<template slot-scope="scope">
					<el-button size="mini" type="primary" :disabled="scope.row.status !== 1 || !isAuth('autonym:jujue')"
						@click="refuseClick(scope.row)" style="margin: 5px;">
						拒绝
					</el-button>
					<el-button size="mini" type="primary"
						:disabled="scope.row.status !== 1 || !isAuth('autonym:tongguo')" @click="passClicks(scope.row)"
						style="margin: 5px;">
						通过
					</el-button>
					<el-button size="mini" type="primary" @click="addClick(scope.row)" style="margin: 5px;">
						修改
					</el-button>
					<el-button size="mini" type="danger" @click="deleteClick(scope.row)" style="margin: 5px;">
						删除
					</el-button>
					<el-button size="mini" type="primary" @click="fapiaoClick(scope.row)" style="margin: 5px;">
						发票记录
					</el-button>
				</template>
			</el-table-column>
		</el-table>
		<div style="text-align: center;margin-top: 10px;">
			<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
				:page-sizes="[10, 20, 30, 40]" :page-size="limit" :current-page="page"
				layout="total,sizes, prev, pager, next,jumper" :total="tableData.total">
			</el-pagination>
		</div>
		<!-- 审核拒绝弹框 -->
		<el-dialog title="审核拒绝" :visible.sync="dialogFormVisible" center>
			<div style="margin-bottom: 10px;">
				<span
					style="width: 200px;display: inline-block;text-align: right;position: relative;top: -70px;">拒绝理由：</span>
				<el-input style="width:50%;" v-model="content" type="textarea" :rows="4" placeholder="请输入拒绝理由">
				</el-input>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisible = false">取 消</el-button>
				<el-button type="primary" @click="refuseto()">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 添加/修改企业 -->
		<el-dialog :title="titles" :visible.sync="dialogFormVisibleQ" center width="80%">
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业用户：</span>
				<el-input v-model="nickName1" @focus="userselect" style="width:45%;" placeholder="请选择企业用户">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">法人姓名：</span>
				<el-input v-model="companyLegalPerson" style="width:45%;" placeholder="请输入法人姓名">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业名称：</span>
				<el-input v-model="companyAllName" style="width:45%;" placeholder="请输入企业名称">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业规模：</span>
				<el-input v-model="companyPeople" style="width:45%;" placeholder="请输入企业规模">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">注册时间：</span>
				<el-date-picker v-model="companyCreateTime" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择日期" style="width:45%;">
				</el-date-picker>

			</div>

			<!-- <div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业电话：</span>
				<el-input v-model="companyPhone" style="width:45%;" placeholder="请输入企业电话">
				</el-input>
			</div> -->
			<div style="margin-bottom: 10px;display:flex;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业头像：</span>
				<div
					style=" width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
					<el-upload class="avatar-uploader" v-model="companyLogo"
						:action="$http.adornUrl('alioss/upload')" :show-file-list="false"
						:on-success="handleAvatarSuccess5" :on-progress="onprogress">
						<img v-if="companyLogo!=''&&percentage==100" :src="companyLogo" class="avatar"
							style="border-radius: 6px;width: 148px;height: 148px;" />
						<i v-else class="el-icon-plus avatar-uploader-icon iconss"></i>
						<el-progress v-if="percentage>0&&percentage<100" type="circle" :percentage="percentage">
						</el-progress>
					</el-upload>
				</div>
			</div>
			<div style="margin-bottom: 10px;display:flex;align-items: center;">
				<span style="width: 200px;display: inline-block;text-align: right;">营业执照：</span>
				<div style="display: flex;flex-wrap: wrap;">
				<div class="imgs" v-for="(item,index) in companyCertification" :key="index" style="margin-right: 20px;">
					<img width="100%" class="images" height="100%" :src="item" alt="" @click="lookBtn(item)"style="margin-right: 10px;" >
					<span class="dels">
						<i class="el-icon-delete" @click="clear(index)"></i>
					</span>
				</div>
				<div class="imgs">
					<el-upload :action="$http.adornUrl('alioss/upload')"
						list-type="picture-card" :show-file-list="false" :on-success="handleUploadSuccess"
						:on-progress="onprogress1">
						<el-progress v-if="percentage1>0 && percentage1<100" type="circle" :percentage="percentage1">
						</el-progress>
						<i v-else class="el-icon-plus"></i>
					</el-upload>
				</div>
				</div>

			</div>
			<div style="margin-bottom: 10px;display:flex;align-items: center;">
				<span style="width: 200px;display: inline-block;text-align: right;">公司证明：</span>
				<div style="display: flex;flex-wrap: wrap;">
				<!-- 已上传的图片列表 -->
				<div class="imgs" v-for="(item,index) in companyVerification" :key="index" style="margin-right: 20px;">
					<img width="100%" class="images" height="100%" :src="item" alt="" @click="lookBtn(item)" style="margin-right: 10px;" >
					<span class="dels">
					<i class="el-icon-delete" @click="clearzz(index)"></i>
					</span>
				</div>
				
				<!-- 上传按钮 - 只有当图片数量小于4时才显示 -->
				<div class="imgs" v-if="companyVerification.length < 4">
					<el-upload 
					:action="$http.adornUrl('alioss/upload')"
					list-type="picture-card" 
					:show-file-list="false" 
					:on-success="handleUploadSuccesszz"
					:on-progress="onprogresszz"
					:before-upload="beforeUploadzz"  
					>
					<el-progress v-if="percentagezz>0 && percentagezz<100" type="circle" :percentage="percentagezz">
					</el-progress>
					<i v-else class="el-icon-plus"></i>
					</el-upload>
				</div>
				</div>
			</div>
			<div style="margin-bottom: 10px;display:flex;align-items: flex-start;">
				<span style="width: 200px;display: inline-block;text-align: right; margin-top: 8px;">在职证明：</span>
				<div style="display: flex;flex-direction: column;align-items: flex-start;">
					<!-- 已上传的PDF文件展示 -->
					<div class="pdf-item" v-if="employmentVerification" style="margin-bottom: 10px; display: flex; align-items: center;">
						<!-- PDF文件信息 -->
						<div class="pdf-info" style="padding: 8px 12px; border: 1px solid #e6e6e6; border-radius: 4px; background: #f9f9f9;">
							<i class="el-icon-file-text" style="font-size: 16px; color: #409EFF; margin-right: 6px;"></i>
							<span style="font-size: 14px; color: #333;">{{ employmentVerificationName || '在职证明.pdf' }}</span>
						</div>
						<!-- 删除按钮 -->
						<span class="del-btn" 
							style="margin: 0 10px; cursor: pointer; color: #F56C6C; font-size: 14px;"
							@click="clearin()">
							<i class="el-icon-delete" style="margin-right: 4px;"></i>删除
						</span>
						<!-- 替换提示 -->
						<span style="font-size: 12px; color: #409EFF;">
							（可点击下方按钮替换文件）
						</span>
					</div>
					
					<!-- 上传按钮 - 固定在下方，不会被挤走 -->
					<div class="upload-btn">
						<el-upload 
							:action="$http.adornUrl('alioss/upload')"
							list-type="picture-card" 
							:show-file-list="false" 
							:on-success="handleUploadSuccessin"
							:on-progress="onprogressin"
							:before-upload="beforeUploadin"
							accept=".pdf" 
							:disabled="percentagein > 0 && percentagein < 100"  
						>
							<el-progress v-if="percentagein>0 && percentagein<100" type="circle" :percentage="percentagein" size="50">
							</el-progress>
							<div v-else style="width: 100%; height: 100%; border: 1px dashed #409EFF; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-direction: column; background: #f5f7fa;">
								<span style="font-size: 12px; color: #409EFF; margin-top: 5px;">上传/替换PDF</span>
							</div>
						</el-upload>
					</div>
				</div>
			</div>
			<!-- <div style="margin-bottom: 10px;display:flex;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业证书：</span>
				<div class="imgs" v-for="(item,index) in companyCertificate" :key="index">
					<img width="100%" class="images" height="100%" :src="item" alt="">
					<span class="dels">
						<i class="el-icon-delete" @click="clearQ(index)"></i>
					</span>
				</div>
				<div class="imgs" style="width: 50%;">
					<el-upload :action="$http.adornUrl('alioss/upload')"
						list-type="picture-card" :show-file-list="false" :on-success="handleUploadSuccessQ"
						:on-progress="onprogressQ">
						<el-progress v-if="percentageQ>0 && percentageQ<100" type="circle" :percentage="percentageQ">
						</el-progress>
						<i v-else class="el-icon-plus"></i>
					</el-upload>
				</div>
			</div> -->
			<!-- <div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业税号：</span>
				<el-input v-model="companyDutyParagraph" style="width:45%;" min="0" placeholder="请输入企业税号"></el-input>
			</div> -->
			<!-- <div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业地址：</span>
				<el-input v-model="companyAddress" style="width:45%;" min="0" placeholder="请输入企业地址"></el-input>
			</div> -->
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">经营范围：</span>
        <el-button style='margin-left:15px;' plain size="mini" type="primary" icon="document" @click="qungkong">
        	清空选项
        </el-button>
				<!-- <el-input v-model="companyScope" style="width:45%;" min="0" placeholder="请输入经营范围">
				</el-input> -->
        <div style="margin-left: 200px;">
        	<span v-for="(item,index) in hangyeData" :key="index">{{item.industryName}}:
        		<el-checkbox-group v-model="companyScope">
        			<el-checkbox v-for="(item1,index1) in item.childrenList" :label="item1.industryName"
        				:key="index1">
        				{{item1.industryName}}
        			</el-checkbox>
        		</el-checkbox-group>
        	</span>

        </div>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">注册资金(单位:万)：</span>
				<el-input v-model="companyRegisteredFund"  style="width:45%;"  placeholder="请输入注册资金(单位:万)">
				<!-- onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" -->
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业邮箱：</span>
				<el-input v-model="email"  style="width:45%;"  placeholder="请输入企业邮箱">
				<!-- onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" -->
				</el-input>
			</div>
			<!-- <div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业招聘信息：</span>
				<el-input v-model="companyContent" style="width:45%;" type="textarea" :rows="3" placeholder="请输入企业招聘信息">
				</el-input>
			</div> -->
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">企业介绍：</span>
				<el-input v-model="companyContent" style="width:45%;" type="textarea" :rows="3" placeholder="请输入企业介绍">
				</el-input>
			</div>
			<div slot="footer" class="dialog-footer" style="margin-top: 30px;text-align: center;">
				<el-button @click="prev">取 消</el-button>
				<el-button type="primary" @click="addmissionNoticeTo()">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 用户列表 -->
		<el-dialog title="用户列表" :visible.sync="dialogFormVisible3" center>
			<div style="margin:2% 0;display: inline-block;">
				<el-input style="width: 150px;" @keydown.enter.native="userclick" clearable placeholder="请输入手机号"
					v-model="phone1"></el-input>&nbsp;&nbsp;&nbsp;&nbsp;
				<el-input style="width: 150px;" @keydown.enter.native="userclick" clearable placeholder="请输入昵称"
					v-model="nickName2"></el-input>
				<el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="userclick">
					查询
				</el-button>
				<el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="userclose">
					重置
				</el-button>
			</div>
			<el-table width="780px" v-loading="tableDataLoading4" :data="userIds.records">
				<el-table-column fixed prop="nickName" width="220" label="昵称">
					<template slot-scope="scope">
						<span style="color: #f56c6c;">{{scope.row.userName ? scope.row.userName : '未设置'}}</span>
					</template>
				</el-table-column>
				<el-table-column prop="phone" width="220" label="手机号">
					<template slot-scope="scope">
						<span>{{scope.row.phone ? scope.row.phone : '未绑定'}}</span>
					</template>
				</el-table-column>
				<el-table-column prop="createTime" width="220" label="创建时间">
				</el-table-column>
				<el-table-column label="操作" fixed='right' width="120">
					<template slot-scope="scope">
						<el-button size="mini" type="primary" @click="confirm(scope.row)">确定
						</el-button>
					</template>
				</el-table-column>
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange2" @current-change="handleCurrentChange2"
					:page-sizes="[5, 10, 15, 20]" :page-size="size1" :current-page="page1"
					layout="total,sizes, prev, pager, next,jumper" :total="userIds.total">
				</el-pagination>
			</div>
		</el-dialog>
		<!-- 发票记录 -->
		<el-dialog title="发票记录" :visible.sync="dialogFormVisible4" center width="80%">
			<el-button style='margin:0 0 20px 20px;' size="mini" type="primary" icon="document" @click="addfpClick()">添加
			</el-button>
			<el-table width="780px" v-loading="tableDataLoading4" :data="userIds.list">
				<el-table-column prop="invoiceId" label="编号" width="80">
				</el-table-column>
				<el-table-column prop="title" label="开票信息" width="300">
					<template slot-scope="scope">
						<el-popover placement="top-start" title="" trigger="hover">
							<div style="display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 3;overflow: hidden;max-height:80px;" v-html="scope.row.title" slot="reference"></div>
							<div style="width: 500px;" v-html="scope.row.title"></div>
						</el-popover>
					</template>
				</el-table-column>
				<el-table-column prop="invoiceType" label="发票类型">
					<template slot-scope="scope">
						<span v-if="scope.row.invoiceType==1">专票</span>
						<span v-if="scope.row.invoiceType==2">普票</span>
					</template>
				</el-table-column>
				<el-table-column prop="content" label="发票内容">
				</el-table-column>
				<el-table-column prop="money" label="发票金额">
				</el-table-column>
				<el-table-column prop="status" label="发票状态">
					<template slot-scope="scope">
						<span v-if="scope.row.status==1">待开票</span>
						<span v-if="scope.row.status==2">已开票</span>
					</template>
				</el-table-column>
				<el-table-column prop="createTime" label="创建时间">
				</el-table-column>
				<el-table-column label="操作" fixed='right' width="150">
					<template slot-scope="scope">
						<el-button size="mini" type="primary" @click="updatefpBtn(scope.row)">修改
						</el-button>
						<el-button size="mini" type="danger" @click="deletefpBtn(scope.row)">删除
						</el-button>
					</template>
				</el-table-column>
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChangeF" @current-change="handleCurrentChangeF"
					:page-sizes="[5, 10, 15, 20]" :page-size="size2" :current-page="page2"
					layout="total,sizes, prev, pager, next,jumper" :total="userIds.totalCount">
				</el-pagination>
			</div>
		</el-dialog>

		<!-- 添加/修改发票 -->
		<el-dialog :title="titlesFp" :visible.sync="dialogFormVisibleFp" center width="70%">
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">发票信息：</span>
				<div style="margin-left: 200px;margin-top: 10px;">
					<quill-editor  ref="myTextEditor" v-model="title" :options="quillOption"
					  style="padding-bottom: 50px;height: 300px;width: 72%;display: inline-table;margin-bottom: 60px;">
					</quill-editor>
				</div>
			</div>
			<!-- <div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">开票信息：</span>
				<el-input v-model="title" style="width:45%;" min="0" placeholder="请输入开票信息">
				</el-input>
			</div> -->
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">发票金额：</span>
				<el-input v-model="money" type="number" style="width:45%;" min="0" placeholder="请输入发票金额"
					onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">发票内容：</span>
				<el-input v-model="content" style="width:45%;" min="0" placeholder="请输入发票内容">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">发票类型：</span>
				<el-radio-group v-model="invoiceType">
					<el-radio :label="1">专票</el-radio>
					<el-radio :label="2">普票</el-radio>
				</el-radio-group>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">发票状态：</span>
				<el-radio-group v-model="statusF">
					<el-radio :label="1">待开票</el-radio>
					<el-radio :label="2">已开票</el-radio>
				</el-radio-group>
			</div>
			<div slot="footer" class="dialog-footer" style="margin-top: 30px;text-align: center;">
				<el-button @click="dialogFormVisibleFp=false">取 消</el-button>
				<el-button type="primary" @click="fapiaoNoticeTo()">确 定</el-button>
			</div>
    </el-dialog>

    <!-- 查看图片 -->
    <el-dialog title="查看图片" :visible.sync="dialogFormVisibleImg" center width="70%">
      <div style="width: 100%;">
        <img :src="imgUrl" style="width: 100%;" />
      </div>
		</el-dialog>
	</div>
</template>

<script>
	import {
	  quillEditor
	} from 'vue-quill-editor'
	import 'quill/dist/quill.core.css'
	import 'quill/dist/quill.snow.css'
	import 'quill/dist/quill.bubble.css'
	import quillConfig from '../mission/quill-config.js'
	export default {
	  name: 'news',
	  components: {
	    quillEditor
	  },
		data() {
			return {
				limit: 10,
				page: 1,
				size1: 10,
				page1: 1,
				status: 0,
				statusT:0,
				statesnum: [{
						value: 0,
						label: '全部'
					},
					{
						value: 1,
						label: '待审核'
					}, {
						value: 2,
						label: '已通过'
					}, {
						value: 3,
						label: '已拒绝'
					}
				],
				classify: '',
				userName: '',
				tableDataLoading: false,
				tableDataLoading4: false,
				dialogFormVisible: false,
				dialogFormVisibleQ: false,
				dialogFormVisibleFp:false,
				dialogFormVisible3: false,
				dialogFormVisible4: false,
				tableData: {},
				checkBoxData: [], //多选框选择的值
				shopId: '',
				companyPhoneT: '',
				companyNameT: '',
				// 企业字段
				titles: '添加',
				companyId: '',
				companyPhone: '',
				companyName: '',
				companyAllName: '',
				companyLegalPerson: '',
				companyCreateTime:'',
				companyPeople:'',
				companyLogo: '',
				companyCertification: [],
				companyVerification: [],
				employmentVerification: '',
				employmentVerificationName: '在职证明', // 上传的PDF文件名
				companyCertificate: [],
				companyDutyParagraph: '',
				// companyAddress: '',
				companyRegisteredFund: '',
				email:'',
				// companyDetails: '',
				companyContent:'',
				companyScope: [],
				nickName1: '',
				percentage: 0, //进度条
				percentage1: 0,
				percentageQ: 0,
				percentagezz: 0,
				percentagein: 0,
				userIds: {},
				nickName2: '',
				phone1: '',
				page2:1,
				size2:10,
				userId:'',
				titlesFp:'添加',
				title:'',
				content:'',
				money:'',
				invoiceId:'',
				statusF:'',
				invoiceType:1,
				quillOption: quillConfig,

				info: {
					stockDate: this.getNowTime(), //日期
				},
				info2: {
					stockDate2: this.getNowTime2(), //日期
				},
				startTime: '',
				endTime: '',
				dialogFormVisibleImg:false,
				imgUrl:'',
				hangyeData: [],
				openValue:1,
				closeValue:2,
			}
		},
		methods: {
			// 格式化图片列表：分割、过滤空值、限制最多4张
			formatImageList(imgStr) {
				if (!imgStr) return [];
				// 分割成数组 → 过滤空字符串 → 截取前4个
				return imgStr.split(',').filter(img => img.trim()).slice(0, 4);
			},

			// 处理图片加载失败
			handleImageError(e) {
				// 可选：替换为自定义的占位图
				// e.target.src = '/path/to/your/error-placeholder.png';
				// 仅保留默认的加载失败样式，不替换图片
				e.target.alt = "图片加载失败";
			},
			// 极简版PDF下载方法（直接使用可下载的URL）
			handlePdfDownload(pdfUrl) {
				// 空值防御
				if (!pdfUrl) {
					this.$message.warning('暂无PDF文件可下载');
					return;
				}

				try {
					// 创建下载链接并直接触发下载
					const link = document.createElement('a');
					link.href = pdfUrl;
					// 自动提取文件名，无则用默认名
					link.download = pdfUrl.split('/').pop() || `在职证明_${new Date().getTime()}.pdf`;
					// 触发下载
					document.body.appendChild(link);
					link.click();
					// 清理临时元素
					document.body.removeChild(link);

					// 下载触发成功提示（注：无法判断文件是否真的下载成功，仅提示触发下载）
					this.$message.success('已触发PDF下载，请查收！');
				} catch (error) {
					// 捕获触发下载过程中的异常
					this.$message.error(`下载失败：${error.message || '触发下载时出错'}`);
					console.error('PDF下载异常：', error);
				}
			},
			//处理默认选中当前日期
			getNowTime() {
				var now = new Date()
				var year = now.getFullYear() //得到年份
				var month = now.getMonth() //得到月份
				var date = now.getDate() //得到日期
				month = month + 1
				month = month.toString().padStart(2, '0')
				date = date.toString().padStart(2, '0')
				var defaultDate = `${year}-${month}-${date}`
				return defaultDate
				this.$set(this.info, 'stockDate', defaultDate)
			},
			//处理默认选中当前日期
			getNowTime2() {
				var now = new Date()
				var year = now.getFullYear() //得到年份
				var month = now.getMonth() - now.getMonth() //得到月份
				var date = now.getDate() - now.getDate() + 1 //得到日期
				month = month + 1
				month = month.toString().padStart(2, '0')
				date = date.toString().padStart(2, '0')
				var defaultDate = `${year}-${month}-${date}`
				return defaultDate
				this.$set(this.info, 'stockDate', defaultDate)
			},
			// 多选
			changeFun(val) {
				this.checkBoxData = val;
			},
			// 详情跳转
			updates(row) {
				this.$router.push({
					path: '/userDetailQ',
					query: {
						userId: row.userId
					}
				})
			},
			handleSizeChange(val) {
				this.limit = val;
				this.dataSelect()
			},
			handleCurrentChange(val) {
				this.page = val;
				this.dataSelect()
			},
			handleSizeChange2(val) {
				this.size1 = val
				this.userClass()
			},
			handleCurrentChange2(val) {
				this.page1 = val
				this.userClass()
			},
			handleSizeChangeF(val) {
				this.size2 = val
				this.userClass()
			},
			handleCurrentChangeF(val) {
				this.page2 = val
				this.userClass()
			},
			//服务通过
			passClick(id) {
				this.status = 1
				this.content = '同意'
				var ids = id ? [id] : this.checkBoxData.map(item => {
					return item.id
				})
				this.$http({
					url: this.$http.adornUrl(
						`student/auditStudentAuthentication/${ids}/${this.status}/${this.content}`),
					method: 'post',
					data: this.$http.adornData({})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.content = ''
								this.status = ''
								this.dataSelect()
							}
						})
					} else {
						this.$message({
							message: data.msg,
							type: 'error',
							duration: 1500,
							onClose: () => {
								this.content = ''
								this.status = ''
								this.dataSelect()
							}
						})
					}
				})
			},
			//单条服务通过
			passClicks(row) {
				this.status = 1
				this.content = '同意'
				this.$http({
					url: this.$http.adornUrl('company/auditCompany'),
					method: 'post',
					params: this.$http.adornParams({
						'status': this.status,
						'ids': row.companyId,
						'content': '通过'
					})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.content = ''
								this.status = ''
								this.dataSelect()
								this.dataSelectDsh()
							}
						})
					} else {
						this.$message({
							message: data.msg,
							type: 'error',
							duration: 1500,
							onClose: () => {
								this.content = ''
								this.status = ''
								this.dataSelect()
							}
						})
					}

				})
			},
			//服务拒绝
			refuseClick(rows) {
				console.log('rows', rows)
				this.status = 2
				this.shopId = rows.companyId
				this.helpTakeId = rows.userId
				this.content = ''
				this.dialogFormVisible = true
			},
			refuseto() {
				if (this.content == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入拒绝理由',
						type: 'warning'
					});
					return
				}
				this.$http({
					url: this.$http.adornUrl('company/auditCompany'),
					method: 'post',
					params: this.$http.adornParams({
						'status': this.status,
						'ids': this.shopId,
						'content': this.content
					})
				}).then(({
					data
				}) => {
					this.dialogFormVisible = false
					if(data.code==0){
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.content = ''
								this.status = ''
								this.dataSelect()
								this.dataSelectDsh()
							}
						})
					}else {
						this.$message({
							message: data.msg,
							type: 'error',
							duration: 1500,
							onClose: () => {
								this.content = ''
								this.status = ''
								this.dataSelect()
							}
						})
					}

				})
			},
			// 查询
			select() {
				this.page = 1
				this.limit = 10
				this.dataSelect()
			},
			// 重置
			cleans() {
				this.statusT = ''
				this.userName = ''
				this.companyPhoneT = ''
				this.companyNameT = ''
				this.startTime = ''
				this.endTime = ''
				this.dataSelect()
			},
			// 获取派单数据列表
			dataSelect() {
				if(this.startTime!=""&&this.startTime !==null){
					if (this.endTime == ''||this.endTime ==null) {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请选择截止时间',
							type: 'warning'
						});
						return
					}
				}
				if(this.endTime!=""&&this.endTime !==null){
					if (this.startTime == ''||this.startTime ==null) {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请选择开始时间',
							type: 'warning'
						});
						return
					}
				}
				this.tableDataLoading = true
				this.$http({
					url: this.$http.adornUrl('company/selectCompanyList'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page,
						'limit': this.limit,
						'status': this.statusT,
						'userName': this.userName,
						'companyPhone': this.companyPhoneT,
						'companyName': this.companyNameT,
						'startTime': this.startTime,
						'endTime': this.endTime,
					})
				}).then(({
					data
				}) => {
					this.tableDataLoading = false
					if(data.data&&data.data.records.length>0){
						for(var i in data.data.records){
							var pattern = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
							var phone1 = data.data.records[i].phone
							var userName1 = data.data.records[i].userName
							if(pattern.test(phone1)){
								var one = phone1.slice(0, 3)
								var two = phone1.slice(7, 11)
								data.data.records[i].phone1 = one+'****'+two
							}
							if(pattern.test(userName1)){
								var one = userName1.slice(0, 3)
								var two = userName1.slice(7, 11)
								data.data.records[i].userName1 = one+'****'+two
							}
							
							
						}
					}
					this.tableData = data.data
				})
			},
			dataSelectDsh() {
				this.$http({
					url: this.$http.adornUrl('company/selectCompanyList'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page,
						'limit': this.limit,
						'status': 1,
						'userName': this.userName,
						'companyPhone': this.companyPhoneT,
						'companyName': this.companyNameT
					})
				}).then(({
					data
				}) => {
					if(data.data){
						this.$cookie.set('numberYh', data.data.totalCount)
					}
				})
			},
			// 添加
			addClick(row) {
				if (row) {
					this.titles = '修改'
					this.companyId = row.companyId
					// this.companyPhone = row.companyPhone
					this.companyAllName = row.companyAllName
					this.companyLegalPerson = row.companyLegalPerson
					this.companyCreateTime = row.companyCreateTime
					this.companyPeople = row.companyPeople
					this.companyLogo = row.companyLogo
					if(row.companyCertification){
						this.companyCertification = row.companyCertification.split(',')
					}
					if(row.companyVerification){
						this.companyVerification = row.companyVerification.split(',')
					}
					if(row.companyCertificate){
						this.companyCertificate = row.companyCertificate.split(',')
					}
					this.employmentVerification = row.employmentVerification
					this.employmentVerificationName = row.employmentVerificationName
					this.companyDutyParagraph = row.companyDutyParagraph
					// this.companyAddress = row.companyAddress
					this.companyRegisteredFund = row.companyRegisteredFund
					this.email = row.email
					// this.companyDetails = row.companyDetails
					this.companyContent = row.companyContent
          if(row.companyScope){
          	this.companyScope = row.companyScope.split(',')
          }

					this.nickName1 = row.userName
					this.userIdss = row.userId
					this.percentage = 100
				} else {
					this.titles = '添加'
					this.companyId = ''
					// this.companyPhone = ''
					this.companyAllName = ''
					this.companyLegalPerson = ''
					this.companyCreateTime = ''
					this.companyPeople = ''
					this.companyLogo = ''
					this.companyCertification = []
					this.companyVerification = []
					this.employmentVerification = ''
					this.employmentVerificationName = ''
					this.companyCertificate = []
					this.companyDutyParagraph = ''
					// this.companyAddress = ''
					this.companyRegisteredFund = ''
					this.email = ''
					// this.companyDetails = ''
					this.companyContent = ''
					this.companyScope = []
					this.nickName1 = ''
					this.nickName2 = ''
					this.phone = ''
					this.percentage = 100
				}
        this.hangyeSelect()
				this.dialogFormVisibleQ = true
			},
			// 获取用户列表弹框
			userselect() {
				this.dialogFormVisible3 = true
				this.tableDataLoading4 = true
				this.userClass()
			},
			// 获取用户列表
			userClass() {
				let phone = -1
				if (this.phone) {
					phone = this.phone
				}
				let nickName = -1
				if (this.nickName) {
					nickName = this.nickName
				}
				this.$http({
					url: this.$http.adornUrl('user/getNotHasCompanyUserList'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page1,
						'limit': this.size1,
						'userName': this.nickName2,
						'phone': this.phone1,
						'isAuthentication': 0
					})
				}).then(({
					data
				}) => {
					this.tableDataLoading4 = false
					let returnData = data.data
					this.userIds = returnData
				})
			},
			// 查询用户列表
			userclick() {
				this.page = 1
				this.tableDataLoading4 = true
				this.userClass()
			},
			// 重置用户列表数据
			userclose() {
				this.phone1 = ''
				this.nickName2 = ''
				this.tableDataLoading4 = true

				this.userClass()
			},
			// 确定用户
			confirm(row) {
				this.userIdss = row.userId
				this.nickName1 = row.userName
				this.phone = row.phone
				// if (this.nickName == '' || this.nickName == null) {
				// 	this.nickName = row.phone
				// }
				this.dialogFormVisible3 = false
			},
			// 封面图片上传
			handleAvatarSuccess5(file) {
				this.companyLogo = file.data;
			},
			onprogress(event, file, fileList) {
				console.log('event, file, fileList', parseInt(event.percent))
				this.percentage = parseInt(event.percent)
			},
			// 封面图片上传
			handleAvatarSuccess1(file) {
				this.gameImg = file.data;
			},
			// 删除
			clear(index) {
				this.companyCertification.splice(index, 1);
			},
			//上传成功
			handleUploadSuccess(file, fileList) {
				this.companyCertification.push(file.data)
				console.log('this.detailsImg', this.companyCertification)
			},
			onprogress1(event, file, fileList) {
				console.log('详情图上传进度', parseInt(event.percent))
				this.percentage1 = parseInt(event.percent)
			},
			// 删除
			clearQ(index) {
				this.companyCertificate.splice(index, 1);
			},
			//上传成功
			handleUploadSuccessQ(file, fileList) {
				this.companyCertificate.push(file.data)
				console.log('this.companyCertificate', this.companyCertificate)
				// this.detailsImg += file.data + ','
			},
			onprogressQ(event, file, fileList) {
				console.log('详情图上传进度', parseInt(event.percent))
				this.percentageQ = parseInt(event.percent)
			},
			// 删除
			clearzz(index) {
				this.companyVerification.splice(index, 1);
			},
			//上传成功
			handleUploadSuccesszz(file, fileList) {
				this.companyVerification.push(file.data)
				console.log('this.detailsImg', this.companyVerification)
				this.percentagezz = 0;
			},
			onprogresszz(event, file, fileList) {
				console.log('详情图上传进度', parseInt(event.percent))
				this.percentagezz = parseInt(event.percent)
			},
			// 上传前校验
			beforeUploadzz() {
				// 判断当前图片数量是否达到4张
				if (this.companyVerification.length >= 4) {
					// 提示用户最多只能上传4张
					this.$message.warning('最多只能上传4张公司证明图片');
					// 返回false阻止上传
					return false;
				}
				// 重置上传进度
				this.percentagezz = 0;
				return true;
			},
			 // 文件上传前校验
			beforeUploadin(file) {
				// 校验文件类型是否为PDF
				const isPDF = file.type === 'application/pdf';
				if (!isPDF) {
					this.$message.error('只能上传PDF格式的文件!');
					return false;
				}
				// 可根据需要添加文件大小限制
				const isLt20M = file.size / 1024 / 1024 < 20;
				if (!isLt20M) {
					this.$message.error('文件大小不能超过20MB!');
					return false;
				}
				return true;
			},
			// 上传进度回调
			onprogressin(event, file, fileList) {
				this.percentagein = Math.floor(event.percent);
			},
			// 上传成功回调
			handleUploadSuccessin(response, file, fileList) {
				this.percentagein = 0;
				// 假设接口返回的文件链接在response.data中
				if (response && response.data) {
					this.employmentVerification = response.data;
					this.employmentVerificationName = file.name || '在职证明.pdf';
					this.$message.success('PDF上传成功');
				} else {
					this.$message.error('PDF上传失败，请重试');
				}
			},
			// 删除PDF文件
			clearin() {
				this.$confirm('确定要删除该在职证明PDF吗？', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.employmentVerification = null; // 清空PDF链接
					this.pdfFileName = ''; // 清空文件名
					this.$message.success('PDF文件已删除');
				}).catch(() => {
					this.$message.info('已取消删除');
				});
			},
			// 确定添加
			addmissionNoticeTo() {
					// let photost = this.detailsImg.toString();
					// console.log(this.userIdss, this.gameId, photost)
					if (this.companyLegalPerson == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入法人姓名',
							type: 'warning'
						});
						return
					}
					if (this.companyAllName == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入企业名称',
							type: 'warning'
						});
						return
					}

					if (this.userIdss == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请选择发布人',
							type: 'warning'
						});
						return
					}

					if (this.companyLogo == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请上传企业头像',
							type: 'warning'
						});
						return
					}
					if (this.companyCertification.length == 0) {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请上传营业执照',
							type: 'warning'
						});
						return
					}

					if (this.companyPeople == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入企业规模',
							type: 'warning'
						});
						return
					}
					if (this.companyCreateTime == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请选择注册时间',
							type: 'warning'
						});
						return
					}
					if (this.companyScope.length == 0) {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请选择经营范围',
							type: 'warning'
						});
						return
					}
					// if (this.companyAddress == '') {
					// 	this.$notify({
					// 		title: '提示',
					// 		duration: 1800,
					// 		message: '请输入企业地址',
					// 		type: 'warning'
					// 	});
					// 	return
					// }
					if (this.companyRegisteredFund == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入注册资金',
							type: 'warning'
						});
						return
					}
					if (this.companyContent == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入企业简介',
							type: 'warning'
						});
						return
					}
					if (this.email == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入企业邮箱',
							type: 'warning'
						});
						return
					}

				let urls = ''
				if (this.titles == '添加') {
					urls = 'company/insertCompany'
				} else {
					urls = 'company/updateCompany'
				}
				let that = this
				setTimeout(function() {
					that.$http({
						url: that.$http.adornUrl(urls),
						method: 'post',
						data: that.$http.adornData({
							// params: that.$http.adornParams({
							'companyCertification': that.companyCertification.toString(),
							'companyVerification': that.companyVerification.toString(),
							'employmentVerification': that.employmentVerification,
							'employmentVerificationName': that.employmentVerificationName,
							'companyCertificate': that.companyCertificate.toString(),
							// 'phone': that.companyPhone,
							'companyAllName': that.companyAllName,
							'companyLegalPerson': that.companyLegalPerson,
							'companyCreateTime':that.companyCreateTime,
							'companyPeople':that.companyPeople,
							'companyLogo': that.companyLogo,
							'companyDutyParagraph': that.companyDutyParagraph,
							// 'companyAddress': that.companyAddress,
							'companyRegisteredFund': that.companyRegisteredFund,
							// 'companyDetails': that.companyDetails,
							'companyScope': that.companyScope.toString(),
							'userId': that.userIdss,
							'companyId': that.companyId,
							'email':that.email,
							'companyContent':that.companyContent
						})
					}).then(({
						data
					}) => {
						console.log('提交结果', data)
						if (data.code == 0) {
							that.$message({
								message: '操作成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									that.dataSelect()
									that.prev()
								}
							})
						} else {
							that.$notify({
								title: '提示',
								duration: 1800,
								message: data.msg,
								type: 'warning'
							});
						}
					})
				}, 1000)
			},
			// 关闭添加信息弹框
			prev() {
				this.dialogFormVisibleQ = false
				this.titles = '添加'
				this.companyId = ''
				this.companyPhone = ''
				this.companyAllName = ''
				this.companyLegalPerson = ''
				this.companyCreateTime = ''
				this.companyPeople = ''
				this.companyLogo = ''
				this.companyCertification = []
				this.companyVerification = []
				this.employmentVerification = ''
				this.employmentVerificationName = ''
				this.companyCertificate = []
				this.companyDutyParagraph = ''
				// this.companyAddress = ''
				this.companyRegisteredFund = ''
				this.email = ''
				// this.companyDetails = ''
				this.companyContent = ''
				this.companyScope = ''
				this.nickName1 = ''
				this.nickName2 = ''
				this.phone = ''
			},
			// 删除
			deleteClick(row) {
				this.$confirm(`确定删除此条信息?`, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$http({
						url: this.$http.adornUrl('company/deleteCompany'),
						method: 'post',
						params: this.$http.adornParams({
							'companyId': row.companyId
						})
					}).then(({
						data
					}) => {
						if (data.code == 0) {
							this.$message({
								message: '删除成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.dataSelect()
								}
							})
						} else {
							this.$notify({
								title: '提示',
								duration: 1800,
								message: data.msg,
								type: 'warning'
							});
						}

					})
				}).catch(() => {})
			},
			// 是否推荐
			changeTj(companyId, isRecommend) {
				this.$http({
					url: this.$http.adornUrl('company/updateCompanyIsRecommend'),
					method: 'post',
					params: this.$http.adornParams({
						'companyId': companyId,
						'isRecommend':isRecommend
					})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dataSelect()
							}
						})
					} else {
						this.$message({
							message: data.msg,
							type: 'warning',
							duration: 1500,
							onClose: () => {
								this.dataSelect()
							}
						})
					}

				})
			},
			// 发票记录按钮
			fapiaoClick(row){
				this.userId = row.userId
				this.companyId = row.companyId
				this.fapiaoList()
				this.dialogFormVisible4 = true
			},
			// 发票记录
			fapiaoList(){
				this.tableDataLoading4 = true
				this.$http({
					url: this.$http.adornUrl('invoice/selectInvoiceList'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page2,
						'limit': this.size2,
						'userName': '',
						'phone': '',
						'userId': this.userId,
						'companyName':'',
						'companyAllName':'',
						'title':'',
						'content':'',
						'status':''
					})
				}).then(({
					data
				}) => {
					this.tableDataLoading4 = false
					let returnData = data.data
					this.userIds = returnData
				})
			},
			addfpClick(){
				this.titlesFp = '添加'
				this.title = ''
				this.content = ''
				this.invoiceType = 1
				this.money = ''
				this.invoiceId = ''
				this.statusF = ''
				this.dialogFormVisibleFp = true
			},
			updatefpBtn(row){
				this.titlesFp = '修改'
				this.title = row.title
				this.content = row.content
				this.money = row.money
				this.invoiceId = row.invoiceId
				this.invoiceType = row.invoiceType
				this.statusF = Number(row.status)

				this.dialogFormVisibleFp = true
			},
			fapiaoNoticeTo(){
					if (this.title == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入开票信息',
							type: 'warning'
						});
						return
					}
					if (this.content == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入发票内容',
							type: 'warning'
						});
						return
					}
					if (this.money == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入发票金额',
							type: 'warning'
						});
						return
					}
					if (this.statusF == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请选择发票状态',
							type: 'warning'
						});
						return
					}
				let urls = ''
				if (this.titlesFp == '添加') {
					urls = 'invoice/insertInvoice'
				} else {
					urls = 'invoice/updateInvoice'
				}
				this.$http({
					url: this.$http.adornUrl(urls),
					method: 'post',
					data: this.$http.adornData({
						'companyId': this.companyId,
						'title':  this.title,
						'content':  this.content,
						'money':  this.money,
						'invoiceId':  this.invoiceId,
						'status': this.statusF,
						'invoiceType':this.invoiceType
					})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dialogFormVisibleFp = false
								this.fapiaoList()
							}
						})
					} else {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: data.msg,
							type: 'warning'
						});
					}

				})
			},
			deletefpBtn(row){
				this.$confirm(`确定删除此条信息?`, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$http({
						url: this.$http.adornUrl('invoice/deleteInvoice'),
						method: 'post',
						params: this.$http.adornParams({
							'invoiceId': row.invoiceId
						})
					}).then(({
						data
					}) => {
						if (data.code == 0) {
							this.$message({
								message: '删除成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.fapiaoList()
								}
							})
						} else {
							this.$notify({
								title: '提示',
								duration: 1800,
								message: data.msg,
								type: 'warning'
							});
						}

					})
				}).catch(() => {})
			},
			// 导出
			exportBtn() {
				 var endTime=this.endTime
				 if(this.endTime!=''){
				 	endTime=this.endTime+" 23:59:59"
				 }
				this.$http({
					url: this.$http.adornUrl('company/exportExcelCompanyList'),
					method: 'get',
					responseType: 'blob',
					params: this.$http.adornParams({
						// 'page': page,
						// 'size': this.size,
						'status': this.statusT,
						'userName': this.userName,
						'companyPhone': this.companyPhoneT,
						'companyName': this.companyAllName,
						'startTime': this.startTime,
						'endTime': this.endTime,
					})
				}).then(({
					data
				}) => {
					let blob = new Blob([data], {
						type: 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
					})
					if (window.navigator.msSaveOrOpenBlob) {
						navigator.msSaveBlob(blob)
					} else {
						let url = window.URL.createObjectURL(blob)
						let elink = document.createElement('a')
						elink.download = '企业列表.xlsx'
						elink.style.display = 'none'
						elink.href = url
						document.body.appendChild(elink)
						elink.click()
						document.body.removeChild(elink)
					}
				})
			},
      // 查看图片
      lookBtn(row){
        this.imgUrl = row
        this.dialogFormVisibleImg = true

      },
      // 获取一级行业数据
      hangyeSelect() {
      	this.$http({
      		url: this.$http.adornUrl('admin/industry/getIndustryList'),
      		method: 'get',
      		params: this.$http.adornParams({
      			'isEnable': 1
      			// 'page': this.page,
      			// 'limit': this.limit,
      			// 'industryName':'',

      		})
      	}).then(({
      		data
      	}) => {
      		if (data.code == 0) {
      			this.tableDataLoading = false
      			let returnData = data.data
      			this.hangyeData = returnData
      		} else {
      			this.$notify({
      				title: '提示',
      				duration: 1800,
      				message: data.msg,
      				type: 'warning'
      			});
      		}

      	})
      },
      // 清空经营范围
      qungkong(){
        this.companyScope = []
      },
		},
		mounted() {
			var statusN =  this.$route.query.status
			if(statusN){
				this.status = statusN
			}else{
				this.status = 0
			}
			this.dataSelect()
		}
	};
</script>

<style>
	.imgs {
		position: relative;
		border-radius: 6px;
		width: 148px;
		height: 148px;
		margin-right: 10px;
		display: inline-block;
    /* margin: 0 20px; */
	}

	.dels {
		position: absolute;
		top: 0;
		left: 0;
		display: none;
	}

	.dels .el-icon-delete {
		/* line-height: 148px; */
		/* padding-left: 58px; */
		font-size: 15px;
		    color: #fff;
		    position: relative;
		    bottom: 10px;
		    left: 140px;
		    background: #999;
		    padding: 5px;
		    border-radius: 50%;

	}

	.imgs:hover .dels {
		/* width: 100%;
		height: 100%; */
		/* background: #000; */
		display: block;
		opacity: 0.5;
	}
</style>
