<template>
	<div>
		<!-- <div style="display: inline-block;">
			<div style="display: inline-block;margin-top: 5px;">
				<span>商家名称:</span>
				<el-input style="width: 150px;" @keydown.enter.native="refresh" clearable placeholder="请输入商家名称"
					v-model="consortiaNameT">
				</el-input>&nbsp;&nbsp;&nbsp;&nbsp;
			</div>
			<div style="display: inline-block;margin-top: 5px;">
				<span>用户昵称:</span>
				<el-input style="width: 150px;" @keydown.enter.native="refresh" clearable placeholder="请输入用户昵称"
					v-model="userNameT">
				</el-input>&nbsp;&nbsp;&nbsp;
			</div>
			<div style="display: inline-block;margin-top: 5px;">
				<span>手机号:</span>
				<el-input style="width: 150px;" @keydown.enter.native="refresh" clearable placeholder="请输入手机号"
					v-model="phoneT">
				</el-input>&nbsp;&nbsp;&nbsp;&nbsp;
			</div>

			<el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="refresh">刷新
			</el-button>
			<el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="chognzhi">重置
			</el-button>
		</div> -->
		<!-- <el-table v-loading="tableDataLoading" :data="tableData">
			<el-table-column prop="consortiaId" label="编号" width="80" fixed="left">
			</el-table-column>
			<el-table-column prop="userName" label="绑定用户" width="120"  fixed="left">
				<template slot-scope="scope">
					<span style="color: #f56c6c;"
						@click="updates(scope.row)">{{ scope.row.userName ? scope.row.userName : '未设置' }}</span>
				</template>
			</el-table-column>

			<el-table-column prop="phone" label="手机号" width="150">
			</el-table-column>
			<el-table-column prop="consortiaName" label="商家名称"  fixed="left">
			</el-table-column>
			<el-table-column prop="logo" label="商家头像">
				<template slot-scope="scope">
					<div v-if="scope.row.logo == null || scope.row.logo == ''">
						暂无图片
					</div>
					<div v-if="scope.row.logo" style="display:flex;flex-wrap: wrap;">
						<el-popover placement="top-start" title="" trigger="hover">
							<img style="width: 50px; height: 50px" :src="scope.row.logo" alt=""
								slot="reference">
							<img style="width: 200px; height: 200px" :src="scope.row.logo" alt="">
						</el-popover>
					</div>
				</template>
			</el-table-column>
			<el-table-column prop="identityName" label="身份证姓名">
			</el-table-column>
			<el-table-column prop="identityCard" label="身份证号">
			</el-table-column>
			<el-table-column prop="businessLicense" label="营业执照" width="150">
				<template slot-scope="scope">
					<div v-if="scope.row.businessLicense">
						<div v-for="(item,index) in scope.row.businessLicense.split(',')" :key="index"
							style="display: inline-block; margin: 3px;">
							<el-popover placement="top-start" title="" trigger="hover">
								<img style="width: 50px; height: 50px" :src="item" alt="" slot="reference">
								<img style="width: 300px; height: auto" :src="item" alt="">
							</el-popover>
						</div>
					</div>

				</template>
			</el-table-column>
			<el-table-column prop="qualificationCertificate" label="资质证书" width="150">
				<template slot-scope="scope">
					<div v-if="scope.row.qualificationCertificate">
						<div v-for="(item,index) in scope.row.qualificationCertificate.split(',')" :key="index"
							style="display: inline-block; margin: 3px;">
							<el-popover placement="top-start" title="" trigger="hover">
								<img style="width: 50px; height: 50px" :src="item" alt="" slot="reference">
								<img style="width: 300px; height: auto" :src="item" alt="">
							</el-popover>
						</div>
					</div>

				</template>
			</el-table-column>
			<el-table-column prop="address" label="详细地址">
			</el-table-column>
			<el-table-column prop="consortiaContent" label="商家公告" width="200">
				<template slot-scope="scope">
					<div  style="display: inline-block; margin: 3px;">
						<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;" slot="reference">{{scope.row.consortiaContent}}</div>
							<div style="width:500px">{{scope.row.consortiaContent}}</div>
						</el-popover>
					</div>
				</template>
			</el-table-column>
			<el-table-column prop="rate" label="商家抽成比例" width="150">
			</el-table-column>
			<el-table-column prop="createTime" label="创建时间" width="150">
			</el-table-column>
			<el-table-column label="操作" width="180"  fixed="right">
				<template slot-scope="scope">
					<el-button size="mini" type="primary"
						@click="shopshifus(scope.row)" style="margin: 3px;">师傅列表
					</el-button>
					<el-button size="mini" type="primary" :disabled="!isAuth('couponYhq:update')"
						@click="shopUpdates(scope.row)" style="margin: 3px;">修改
					</el-button>
					<el-button size="mini" type="primary" @click="syCompile(scope.row)" style="margin: 3px;">
						收益明细
					</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, 50, 100]" :page-size="size" :current-page="page"
				layout="total,sizes, prev, pager, next" :total="tableData.totalCount">
			</el-pagination>
		</div> -->
		<!-- 添加-->
		<!-- <el-dialog title="添加" :visible.sync="dialogFormVisible" center  width="80%"> -->
			<!-- <div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">绑定用户：</span>
				<el-input style="width:50%;" v-model="userName" type="text" placeholder="请选择用户" @focus="couponIdBtn1(1)">
				</el-input>
			</div> -->
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">商家名称：</span>
				<el-input style="width:50%;" v-model="consortiaName" placeholder="请输入商家名称"></el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">标签：</span>
				<el-input style="width:50%;" v-model="tags" type="text"  placeholder="请输入标签','分割">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">营业时间：</span>
				<el-input style="width:50%;" v-model="yysj" type="text"  placeholder="请输入营业时间">
				</el-input>
			</div>

			<!-- <div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">商家抽成比例：</span>
				<el-input style="width:50%;" v-model="rate" type="number" :min="0" :max="1" :step="0.01" placeholder="请输入商家抽成比例,例如:0.1为10%">
				</el-input>
			</div> -->
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">联系电话：</span>
				<el-input style="width:50%;" v-model="phone" type="text" placeholder="请输入联系电话"></el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">负责人姓名：</span>
				<el-input style="width:50%;" v-model="identityName" type="text" placeholder="请输入负责人姓名"></el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">负责人身份证号：</span>
				<el-input style="width:50%;" v-model="identityCard" type="text" placeholder="请输入负责人身份证号"></el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">详细地址：</span>
				<el-input style="width:50%;" v-model="address" type="text" placeholder="请输入地址"></el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">商家公告：</span>
				<el-input style="width:50%;" v-model="consortiaContent" type="textarea" :rows="2"  placeholder="请输入商家公告">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">商家头像：</span>
				<div style="display: inline-block;width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
					<el-upload class="avatar-uploader" v-model="logo"
						:action="uploadUrl" :show-file-list="false"
						:on-success="handleAvatarSuccess1">
						<img v-if="logo" :src="logo" class="avatar"
							style="width: 148px;height: 148px;" />
						<i v-else class="el-icon-plus avatar-uploader-icon" style="font-size: 28px;color: #8c939d"></i>
					</el-upload>
				</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 qualificationCertificate" :key="index">
					<img width="100%" class="images" height="100%" :src="item" alt="">
					<span class="dels">
						<i class="el-icon-delete" @click="clear1(index)"></i>
					</span>
				</div>
				<div class="imgs" style="width: 50%;">
					<el-upload :action="uploadWatermarkUrl"
						list-type="picture-card" :show-file-list="false" :on-success="handleUploadSuccess3"
						: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 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 businessLicense" :key="index">
					<img width="100%" class="images" height="100%" :src="item" alt="">
					<span class="dels">
						<i class="el-icon-delete" @click="clear2(index)"></i>
					</span>
				</div>
				<div class="imgs" style="width: 50%;">
					<el-upload :action="uploadWatermarkUrl"
						list-type="picture-card" :show-file-list="false" :on-success="handleUploadSuccess4"
						:on-progress="onprogress2">
						<el-progress v-if="percentage2>0 && percentage2<100" type="circle"
							:percentage="percentage2"></el-progress>
						<i v-else class="el-icon-plus"></i>
					</el-upload>
				</div>
			</div>

			<div slot="footer" class="dialog-footer">
				<!-- <el-button @click="dialogFormVisible = false">取 消</el-button> -->
				<el-button type="primary" @click="couponNoticeTo()">确 定</el-button>

				<el-button type="primary"
					@click="shopshifus(tableData)" style="margin: 3px;">师傅列表
				</el-button>
				<!-- <el-button type="primary" @click="syCompile(tableData)" style="margin: 3px;">
					收益明细
				</el-button> -->
			</div>



		<!-- </el-dialog> -->
		<!-- 修改优惠券 -->
		<el-dialog title="修改" :visible.sync="dialogFormVisible3" center width="80%">
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">绑定用户：</span>
				<el-input style="width:50%;" v-model="userName" type="text" placeholder="请选择用户" @focus="couponIdBtn1(1)">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">商家名称：</span>
				<el-input style="width:50%;" v-model="consortiaName" placeholder="请输入商家名称"></el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">标签：</span>
				<el-input style="width:50%;" v-model="tags" type="text"  placeholder="请输入标签','分割">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">营业时间：</span>
				<el-input style="width:50%;" v-model="yysj" type="text"  placeholder="请输入营业时间">
				</el-input>
			</div>

			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">商家抽成比例：</span>
				<el-input style="width:50%;" v-model="rate" type="number" :min="0" :max="1" :step="0.01" placeholder="请输入商家抽成比例,例如:0.1为10%">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">手机号：</span>
				<el-input style="width:50%;" v-model="phone" type="text" placeholder="请输入手机号"></el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">身份证姓名：</span>
				<el-input style="width:50%;" v-model="identityName" type="text" placeholder="请输入身份证姓名"></el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">身份证号：</span>
				<el-input style="width:50%;" v-model="identityCard" type="text" placeholder="请输入身份证号"></el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">详细地址：</span>
				<el-input style="width:50%;" v-model="address" type="text" placeholder="请输入详细地址"></el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">商家公告：</span>
				<el-input style="width:50%;" v-model="consortiaContent" type="textarea" :rows="2"  placeholder="请输入商家公告">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">商家头像：</span>
				<div style="display: inline-block;width: 148px;height: 148px;border: 1px dashed #c0ccda;">
					<el-upload class="avatar-uploader" v-model="logo"
						:action="uploadUrl" :show-file-list="false"
						:on-success="handleAvatarSuccess1" style="text-align: center;">
						<img v-if="logo" :src="logo" class="avatar"
							style="width: 148px;height: 148px;" />
						<i v-else class="el-icon-plus avatar-uploader-icon" style="font-size: 28px;color: #8c939d;line-height: 148px;text-align: center;"></i>
					</el-upload>
				</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 qualificationCertificate" :key="index">
					<img width="100%" class="images" height="100%" :src="item" alt="">
					<span class="dels">
						<i class="el-icon-delete" @click="clear1(index)"></i>
					</span>
				</div>
				<div class="imgs" style="width: 50%;">
					<el-upload :action="uploadWatermarkUrl"
						list-type="picture-card" :show-file-list="false" :on-success="handleUploadSuccess3"
						: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 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 businessLicense" :key="index">
					<img width="100%" class="images" height="100%" :src="item" alt="">
					<span class="dels">
						<i class="el-icon-delete" @click="clear2(index)"></i>
					</span>
				</div>
				<div class="imgs" style="width: 50%;">
					<el-upload :action="uploadWatermarkUrl"
						list-type="picture-card" :show-file-list="false" :on-success="handleUploadSuccess4"
						:on-progress="onprogress2">
						<el-progress v-if="percentage2>0 && percentage2<100" type="circle"
							:percentage="percentage2"></el-progress>
						<i v-else class="el-icon-plus"></i>
					</el-upload>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisible3 = false">取 消</el-button>
				<el-button type="primary" @click="amendNoticeTo()">确 定</el-button>
			</div>
		</el-dialog>



		<!-- 用户列表 -->
		<el-dialog title="用户列表" :visible.sync="dialogFormVisible5" center width="70%">
			<!-- <div style="margin:5px;display: inline-block;">
				<span>是否是会员:</span>
				<el-select v-model="member" style="width:150px;margin-left: 10px;" @change="select1()">
					<el-option v-for="item in memberList" :key="item.value" :label="item.title" :value="item.value">
					</el-option>
				</el-select>&nbsp;&nbsp;&nbsp;
			</div>&emsp;&emsp; -->
			<div style="display: inline-block;margin-top: 5px;">
				<span>邀请人邀请码:</span>
				<el-input style="width: 150px;" @keydown.enter.native="select1" clearable placeholder="请输入邀请人邀请码"
					v-model="inviterCode">
				</el-input>&nbsp;&nbsp;&nbsp;&nbsp;
			</div>
			<div style="display: inline-block;margin-top: 5px;">
				<span>手机号:</span>
				<el-input style="width: 150px;" @keydown.enter.native="select1" clearable placeholder="请输入手机号"
					v-model="phoneU">
				</el-input>&nbsp;&nbsp;&nbsp;&nbsp;
			</div>
			<div style="display: inline-block;margin-top: 5px;">
				<span>技师名称:</span>
				<el-input style="width: 150px;" @keydown.enter.native="select1" clearable placeholder="请输入技师名称"
					v-model="nickName">
				</el-input>&nbsp;&nbsp;&nbsp;
			</div>
			<div style="display: inline-block;margin-top: 5px;">
				<el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="select1">查询
				</el-button>
				<el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="cleans1">重置
				</el-button>
			</div>

			<el-table v-loading="tableDataLoading1" :data="userData.list">
				<el-table-column prop="userId" label="id" width="80">
				</el-table-column>
				<el-table-column prop="artificerName" label="技师名称" width="120">
					<template slot-scope="scope">
						<span style="color: #f56c6c;"
							@click="updates(scope.row)">{{ scope.row.artificerName ? scope.row.artificerName : '未设置' }}</span>
					</template>
				</el-table-column>
				<el-table-column label="图像">
					<template slot-scope="scope">
						<img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40"
							height="40">
						<img v-else :src="scope.row.avatar" alt="" width="40" height="40">
					</template>
				</el-table-column>
				<el-table-column prop="phone" label="手机号">
					<template slot-scope="scope">
						<span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row)">
							{{ scope.row.phone ? scope.row.phone : '未绑定' }}
						</span>
					</template>
				</el-table-column>
				<el-table-column prop="shopName" label="绑定的商家"></el-table-column>
				<el-table-column prop="member" label="是否是会员">
					<template slot-scope="scope">
						<span v-if="scope.row.member==1">是</span>
						<span v-else>否</span>
					</template>
				</el-table-column>
				<el-table-column prop="inviterCode" label="邀请人邀请码">
					<template slot-scope="scope">
						<span>{{ scope.row.inviterCode ? scope.row.inviterCode : '-' }}</span>
					</template>
				</el-table-column>
				<el-table-column prop="inviterCode" label="操作">
					<template slot-scope="scope">
						<el-button style="margin:3px;" size="mini" type="primary" v-if="indexUser==1"
							icon="document" @click="closes2(scope.row)" >确定</el-button>
						<el-button style="margin:3px;" size="mini" type="primary" v-if="indexUser==2"
							icon="document" @click="queding(scope.row)">添加</el-button>
						<el-button style="margin:3px;" size="mini" type="warning" v-if="indexUser==2&&scope.row.consortiaId"
							icon="document" @click="closes3(scope.row)" :disabled="!isAuth('userList:updatejb')">解绑</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="[10, 20, 30, 50, 100]" :page-size="size1" :current-page="page1"
					layout="total,sizes, prev, pager, next,jumper" :total="userData.totalCount">
				</el-pagination>
			</div>
		</el-dialog>
		<!-- 师傅列表 -->
		<el-dialog title="师傅列表" :visible.sync="dialogFormVisible1" center width="80%">
			<div style="margin:2% 0;display: inline-block;">
				<span>师傅名称：</span>
				<el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入师傅名称"
					v-model="userNameS"></el-input>&nbsp;&nbsp;&nbsp;&nbsp;
			</div>
			<div style="margin:2% 0;display: inline-block;">
				<span>师傅电话：</span>
				<el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入师傅电话"
					v-model="phoneS"></el-input>&nbsp;&nbsp;&nbsp;&nbsp;
			</div>
			<div style="display: inline-block;">
				<el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="select">查询
				</el-button>
				<el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="cleans">重置
				</el-button>
			</div>
			<el-table v-loading="tableDataLoading1" :data="shopData.list">
				<el-table-column fixed prop="userId" label="id" width="80">
				</el-table-column>
				<el-table-column fixed prop="artificerName" label="师傅名称" width="120">
					<template slot-scope="scope">
						<span style="color: #f56c6c;"
							@click="updates(scope.row)">{{ scope.row.artificerName ? scope.row.artificerName : '未设置' }}</span>
					</template>
				</el-table-column>
				<el-table-column label="图像">
					<template slot-scope="scope">
						<img v-if="scope.row.artificerImg==null" src="~@/assets/img/avatar.png" alt="" width="40"
							height="40">
						<img v-else :src="scope.row.artificerImg" alt="" width="40" height="40">
					</template>
				</el-table-column>
				<el-table-column prop="phone" label="手机号">
					<template slot-scope="scope">
						<span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row)">
							{{ scope.row.phone ? scope.row.phone : '未绑定' }}
						</span>
					</template>
				</el-table-column>
				<el-table-column prop="creditScore" label="信誉分">
				</el-table-column>
				<el-table-column prop="ordersCount" label="销量">
					<template slot-scope="scope">
						<span>{{ scope.row.ordersCount ? scope.row.ordersCount : '0' }}</span>
					</template>
				</el-table-column>

			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange1" @current-change="handleCurrentChange1"
					:page-sizes="[10, 20, 30, 50, 100]" :page-size="size1" :current-page="page1"
					layout="total,sizes, prev, pager, next,jumper" :total="shopData.totalCount">
				</el-pagination>
			</div>
		</el-dialog>


	</div>
</template>

<script>
import { serverPaths } from '@/utils/enumData'
	export default {
		data() {
			return {
				uploadUrl: serverPaths.uploadUrl,
				uploadWatermarkUrl: serverPaths.uploadWatermarkUrl,
				size: 10,
				page: 1,
				size1: 10,
				page1: 1,
				type: 1,
				title: '',
				typeId: '',
				consortiaName: '',
				couponPicture:'',
				consortiaContent: 0,
				tags:'',
				yysj:'',
				rate: '',
				identityName:'',
				identityCard:'',
				address:'',
				logo:'',
				phone:'',
				qualificationCertificate:[],
				businessLicense:[],
				userId: '',
				userName:'',
				sort: 0,
				status: 1,
				goodsIds: '',
				goodsImages: '',
				issueNumber: 0,
				remainNumber: '',
				isLimit: 1,
				form: {
					consortiaId: '',
					consortiaName: '',
					consortiaContent: '',
					tags:'',
					yysj:'',
					rate: '',
					userId: '',
					userName:'',
				},
				coverImg: '',
				couponName1: '',
				consortiaId: '',
				startTime: '',
				endTime: '',
				checkBoxData: [], //多选框选择的值
				formLabelWidth: '200px',
				tableDataLoading: false,
				dialogFormVisible: false,
				dialogFormVisible1: false,
				dialogFormVisible2: false,
				dialogFormVisible3: false,
				tableData: [],
				shopData: [],
				// 赠送优惠券
				tableDataLoading1: false,
				dialogFormVisible0: false,
				dialogFormVisible5: false,
				dialogFormVisible4: false,
				couponIds: [],
				couponIdList: [],
				userIdList: [],
				userNameList: [],
				isCoupon: 1,
				userData: [],
				types: '',
				phoneU:'',

				nickName: '',
				member: '',
				memberList: [{
						value: '',
						title: '全部'
					},
					{
						value: 0,
						title: '否'
					},
					{
						value: 1,
						title: '是'
					},
				],
				inviterCode: '',

				consortiaNameT:'',
				userNameT:'',
				phoneT:'',
				userNameS:'',
				phoneS:'',
				indexUser:1,

				percentage1: 0,
				percentage2: 0,
				certification:[],
				imagePhoto:[],
			}
		},

		methods: {
			// 通用券/商品券
			couponClick(val) {
				if (val = 1) {
					this.goodsIds = ''
					this.goodsImages = ''
					this.form.goodsIds = ''
					this.form.goodsImages = ''
				}
			},
			// 刷新
			refresh() {
				this.page = 1
				this.dataSelect()
			},
			// 重置
			chognzhi(){
				this.page = 1
				this.consortiaNameT = ''
				this.userNameT = ''
				this.phoneT = ''
				this.dataSelect()
			},
			handleSizeChange(val) {
				this.size = val;
				this.dataSelect()
			},
			handleCurrentChange(val) {
				this.page = val;
				this.dataSelect()
			},
			handleSizeChange1(val) {
				this.size = val;
				this.shopSelect()
			},
			handleCurrentChange1(val) {
				this.page = val;
				this.shopSelect()
			},
			handleSizeChange2(val) {
				this.size1 = val;
				this.dataSelect1()
			},
			handleCurrentChange2(val) {
				this.page1 = val;
				this.dataSelect1()
			},
			// 添加优惠券弹框
			addCoupon() {
				this.consortiaName = ''
				this.couponPicture = ''
				this.consortiaContent = ''
				this.tags=''
				this.yysj=''
				this.userId = ''
				this.userName = ''
				this.phone = ''
				this.rate = ''
				this.identityName = ''
				this.identityCard = ''
				this.address = ''
				this.logo = ''
				this.qualificationCertificate = []
				this.businessLicense = []
				this.dialogFormVisible = true
			},
			handleAvatarSuccess1(file, fileList) {
				this.couponPicture = file.data
			},
			handleAvatarSuccess2(file, fileList) {
				this.form.couponPicture = file.data
			},
			// 添加优惠券
			couponNoticeTo() {
				if (this.userId == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请选择用户',
						type: 'warning'
					});
					return
				}
				if (this.consortiaName == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入商家名称',
						type: 'warning'
					});
					return
				}

				if (this.consortiaContent == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入商家公告',
						type: 'warning'
					});
					return
				}
				if (this.rate === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入商家抽成比例',
						type: 'warning'
					});
					return
				}else {
					alert(this.rate);
					console.log(this.rate);
				}
				if (this.rate < 0 ||  this.rate > 1) {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '抽成比例只能设置0-1之间的数字',
						type: 'warning'
					});
					return
				}
				if (this.phone === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入手机号',
						type: 'warning'
					});
					return
				}
				if (this.identityName === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入身份证姓名',
						type: 'warning'
					});
					return
				}
				if (this.identityCard === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入身份证号',
						type: 'warning'
					});
					return
				}
				if (this.rate === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入商家抽成比例',
						type: 'warning'
					});
					return
				}
				if (this.address === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入详细地址',
						type: 'warning'
					});
					return
				}
				if (this.logo === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请上传商家头像',
						type: 'warning'
					});
					return
				}
				if (this.businessLicense.length == 0) {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请上传营业执照',
						type: 'warning'
					});
					return
				}
				if (this.qualificationCertificate.length == 0) {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请上传资格证书',
						type: 'warning'
					});
					return
				}

				this.$http({
					url: this.$http.adornUrl('consortia/insertConsortia'),
					method: 'post',
					data: this.$http.adornData({
						'consortiaName': this.consortiaName,
						'couponPicture': this.couponPicture,
						'consortiaContent': this.consortiaContent,
						'tags': this.tags,
						'yysj':this.yysj,
						'rate': this.rate,
						'userId': this.userId,
						'identityName': this.identityName,
						'identityCard': this.identityCard,
						'address': this.address,
						'logo': this.logo,
						'qualificationCertificate': this.qualificationCertificate.toString(),
						'businessLicense': this.businessLicense.toString(),
					})
				}).then(({
					data
				}) => {
					if(data.code==0){
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dataSelect()
							}
						})
						this.dialogFormVisible = false
					}else{
						this.$message({
							message: data.msg,
							type: 'warning',
							duration: 1500,
							onClose: () => {
							}
						})
					}

				})
			},
			// 修改优惠券
			shopUpdates(row) {
				// this.dialogFormVisible3 = true
				this.consortiaId = row.consortiaId
				this.consortiaName = row.consortiaName
				this.consortiaContent = row.consortiaContent
				this.tags = row.tags
				this.yysj = row.yysj
				this.rate = row.rate
				this.phone = row.phone
				this.userId = row.userId
				this.userName = row.userName
				this.identityName = row.identityName
				this.identityCard = row.identityCard
				this.address = row.address
				if(row.logo){
					this.logo = row.logo
				}else{
					this.logo = ''
				}
				if(row.qualificationCertificate){
					this.qualificationCertificate = row.qualificationCertificate.split(',')
				}else{
					this.qualificationCertificate = []
				}
				if(row.businessLicense){
					this.businessLicense =  row.businessLicense.split(',')
				}else{
					this.businessLicense = []
				}


			},
			amendNoticeTo() {
				if (this.userId == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请选择用户',
						type: 'warning'
					});
					return
				}
				if (this.consortiaName == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入商家名称',
						type: 'warning'
					});
					return
				}

				if (this.consortiaContent == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入商家公告',
						type: 'warning'
					});
					return
				}
				if (this.rate === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入商家抽成比例',
						type: 'warning'
					});
					return
				}
				if (this.rate < 0 ||  this.rate > 1) {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '抽成比例只能设置0-1之间的数字',
						type: 'warning'
					});
					return
				}
				if (this.phone === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入手机号',
						type: 'warning'
					});
					return
				}
				if (this.identityName === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入身份证姓名',
						type: 'warning'
					});
					return
				}
				if (this.identityCard === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入身份证号',
						type: 'warning'
					});
					return
				}
				if (this.rate === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入商家抽成比例',
						type: 'warning'
					});
					return
				}
				if (this.address === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入详细地址',
						type: 'warning'
					});
					return
				}
				if (this.logo === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请上传商家头像',
						type: 'warning'
					});
					return
				}
				if (this.businessLicense.length == 0) {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请上传营业执照',
						type: 'warning'
					});
					return
				}
				if (this.qualificationCertificate.length == 0) {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请上传资格证书',
						type: 'warning'
					});
					return
				}
				this.$http({
					url: this.$http.adornUrl('consortia/updateConsortia'),
					method: 'post',
					data: this.$http.adornData({
						'consortiaId': this.consortiaId,
						'consortiaName': this.consortiaName,
						'consortiaContent': this.consortiaContent,
						'tags': this.tags,
						'yysj': this.yysj,
						'rate': this.rate,
						'phone':this.phone,
						'userId': this.userId,
						'identityName': this.identityName,
						'identityCard': this.identityCard,
						'address': this.address,
						'logo': this.logo,
						'qualificationCertificate': this.qualificationCertificate.toString(),
						'businessLicense': this.businessLicense.toString(),
					})
				}).then(({
					data
				}) => {
					if(data.code==0){
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dataSelect()
							}
						})
						this.dialogFormVisible3 = false
					}else{
						this.$message({
							message: data.msg,
							type: 'warning',
							duration: 1500,
							onClose: () => {
							}
						})
					}

				})
			},

			// 删除优惠券
			shopdeletes(row) {
				this.$confirm(`确定删除此条信息?`, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$http({
						url: this.$http.adornUrl('consortia/deleteConsortia'),
						method: 'post',
						params: this.$http.adornParams({
							'consortiaId': row.consortiaId
						})
					}).then(({
						data
					}) => {
						if (data.code == 0) {
							this.$message({
								message: '删除成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.dataSelect()
								}
							})
						} else {
							this.$message({
								message: data.msg,
								type: 'error',
								duration: 1500,
								onClose: () => {
								}
							})
						}
					})
				}).catch(() => {})
			},
			//获取数据
			dataSelect() {
				this.tableDataLoading = true
				this.$http({
					url: this.$http.adornUrl('consortia/selectConsortiaListNew'),
					method: 'get',
					params: this.$http.adornParams({
					})
				}).then(({
					data
				}) => {
					this.tableDataLoading = false
					let returnData = data.data;
					console.log(`🚀 ~ dataSelect ~ this.tableData:`, this.tableData)
					this.tableData = returnData
					this.shopUpdates(returnData)
				})
			},
			// 获取用户数据列表
			dataSelect1() {
				let phone = -1
				if(this.indexUser==1){
					var userType = ''
				}else{
					var userType = 2
				}

				if (this.phoneU) {
					phone = this.phoneU
				}
				this.tableDataLoading1 = true
				this.$http({
					url: this.$http.adornUrl('user/selectUserList'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page1,
						'limit': this.size1,
						'isAuthentication': userType,
						'phone': this.phoneU,
						'artificerName': this.nickName,
						'inviterCode': this.inviterCode,
						'platform': '',
						'member': '',
						'sex':'',
						'ordersUser':'',
						'invitationCode':'',
						'isAgency':''

					})
				}).then(({
					data
				}) => {
					this.tableDataLoading1 = false
					let returnData = data.data
					this.userData = returnData
				})
			},
			// 查询
			select1() {
				this.page1 = 1
				this.dataSelect1()
			},
			// 重置
			cleans1() {
				this.page1 = 1
				this.phoneU = ''
				this.member = ''
				this.nickName = ''
				this.inviterCode = ''
				this.dataSelect1()
			},
			// 打开用户列表
			couponIdBtn1(index) {
				this.indexUser = index
				this.dataSelect1()
				this.dialogFormVisible5 = true
			},
			// 选择用户
			closes2(row) {
				this.userId = row.userId
				this.userName = row.userName
				this.dialogFormVisible5 = false
			},
			// 用户详情
			updates(row) {
				this.$router.push({
					path: '/userDetail',
					query: {
						userId: row.userId
					}
				})
			},
			// 师傅列表弹框
			shopshifus(row){
				this.consortiaId = row.consortiaId
				this.userId = row.userId
				this.dialogFormVisible1 = true
				this.shopSelect()
			},
			// 获取师傅列表
			shopSelect() {
				this.tableDataLoading = true
				this.$http({
					url: this.$http.adornUrl('consortia/selectUserListByConsortiaId'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page1,
						'limit': this.size1,
						'userName': this.userNameS,
						'phone':this.phoneS,
						'consortiaId': this.consortiaId,
						'shopId': this.userId
					})
				}).then(({
					data
				}) => {
					this.tableDataLoading = false
					let returnData = data.data;
					this.shopData = returnData
				})
			},
			//搜索
			select() {
				this.page1 = 1
				this.shopSelect()
			},
			// 重置
			cleans() {
				this.page1 = 1
				this.userNameS = ''
				this.phoneS = ''
				this.shopSelect()
			},
			// 确定添加师傅
			queding(row) {
				if(row.consortiaId){
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '该骑手已绑定商家，请先解绑',
						type: 'warning'
					});
					return
				}
				this.$http({
					url: this.$http.adornUrl('consortia/insertConsortiaUser'),
					method: 'post',
					params: this.$http.adornParams({
						'consortiaId': this.consortiaId,
						'userId':row.userId
					})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dialogFormVisible5 = false
								this.shopSelect()

							}
						})
					} else {
						this.$message({
							message: data.msg,
							type: 'error',
							duration: 1500,
							onClose: () => {
							}
						})
					}
				})
			},
			// 移除师傅
			closes3(row){
				this.$http({
					url: this.$http.adornUrl('consortia/deleteConsortiaUser'),
					method: 'post',
					params: this.$http.adornParams({
						'userId':row.userId
					})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.shopSelect()
								this.dataSelect1()
							}
						})
					} else {
						this.$message({
							message: data.msg,
							type: 'error',
							duration: 1500,
							onClose: () => {
							}
						})
					}
				})
			},
			// 收益统计
			syCompile(row){
				this.$router.push({
					path: '/profitList',
					query: {
						consortiaId: row.consortiaId,
						shopId:row.userId
					}
				})
			},
			handleAvatarSuccess1(file, fileList) {
				this.logo = file.data
			},
			//上传成功
			handleUploadSuccess3(file, fileList) {
				this.qualificationCertificate.push(file.data)
				console.log('this.contentImg', this.qualificationCertificate)
			},
			onprogress1(event, file, fileList) {
				console.log('详情图上传进度', parseInt(event.percent))
				this.percentage1 = parseInt(event.percent)
			},
			onprogress2(event, file, fileList) {
				console.log('详情图上传进度', parseInt(event.percent))
				this.percentage2 = parseInt(event.percent)
			},
			//上传成功
			handleUploadSuccess4(file, fileList) {
				this.businessLicense.push(file.data)
				console.log('this.contentImg', this.businessLicense)
			},
			// 删除
			clear1(index) {
				this.qualificationCertificate.splice(index, 1);
			},
			clear2(index) {
				this.businessLicense.splice(index, 1);
			},
			// 解绑
			jiebang(row){

			}

		},
		mounted() {
			this.dataSelect()
		}
	};
</script>

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

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

	.dels .el-icon-delete {
		line-height: 148px;
		padding-left: 58px;
		font-size: 25px;
		color: #fff;
	}

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