<template>
	<div class="app-container">

		<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
			label-width="68px">
			<el-form-item label="开始日期" prop="beginTime">
				<div class="block">
					<el-date-picker v-model="queryParams.beginTime" value-format="yyyy-MM-dd" type="date"
						placeholder="选择日期" style="width: 200px;">
					</el-date-picker>
				</div>
			</el-form-item>
			<el-form-item label="结束日期" prop="endTime">
				<div class="block">
					<el-date-picker v-model="queryParams.endTime" type="date" value-format="yyyy-MM-dd"
						placeholder="选择日期" style="width: 200px;">
					</el-date-picker>
				</div>
			</el-form-item>
			<el-form-item label="游戏账号" prop="gameAccount">
				<el-input v-model="queryParams.gameAccount" style="width: 200px;" placeholder="请输入游戏账号" clearable
					@keyup.enter.native="handleQuery" />
			</el-form-item>
			<el-form-item label="状态" prop="status">
				<el-select style="width: 100%" v-model="queryParams.status" placeholder="请选择状态">
					<el-option v-for="item in stoptions" :key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="级别" prop="level">
				<el-select style="width: 100%" v-model="queryParams.level" placeholder="请选择级别">
					<el-option v-for="item in shdjoptions" :key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="店铺" prop="shopId">
				<el-select style="width: 100%" v-model="queryParams.shopId" filterable placeholder="请选择店铺">
					<el-option v-for="item in deptOptions" :key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>

			<el-form-item>
				<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索
				</el-button>

				<el-button style="margin-left: 20px;" icon="el-icon-refresh" size="mini" @click="resetQuery">重置
				</el-button>
				<el-button style="margin-left: 20px;" icon="el-icon-plus" type="primary" size="mini" @click="handleAdd">新增
				</el-button>
			</el-form-item>
		</el-form>
		<div>
			<p>账户余额：<span style="color: green;">{{balance}}</span>
				<!-- <el-button style="margin-left: 30px;" type="primary" size="small" @click="handleQuery2">提现</el-button> -->
			</p>
		</div>
		<el-table :data="tableData" border :row-class-name="tableRowClassName" show-summary :summary-method="getSummaries"
			:header-cell-style="{background: '#e1effb', color: 'black'}" style="width: 100%">
			<el-table-column prop="shopName" label="店铺名称">
			</el-table-column>
			<el-table-column prop="goodsId" label="商品编号">
			</el-table-column>
			<el-table-column prop="type" label="类型">
				<template slot-scope="scope">
					<span v-if="scope.row.type=='ZHPF'">找回赔付</span>
					<span v-if="scope.row.type=='QT'">其他</span>
				</template>
			</el-table-column>
			<el-table-column prop="aftermarketId" label="售后编号">
			</el-table-column>
			<el-table-column prop="gamePrice" label="游戏价格" width="120px" align="center">
				<template slot-scope="scope">
					<el-input v-model="scope.row.gamePrice" />
				</template>
			</el-table-column>
			<el-table-column prop="salesPrice" label="销售价格">
			</el-table-column>
			<el-table-column prop="merchantsPrice" label="商家退款">
			</el-table-column>
			<el-table-column prop="firmsPrice" label="平台退款">
			</el-table-column>
			<el-table-column prop="payoutAmount" label="赔付金额">
				<template slot-scope="scope">
				<el-tooltip class="item" effect="dark" content="赔付金额=平台退款+商家退款" placement="top-start">
					<span>{{scope.row.payoutAmount}}</span>
				</el-tooltip>
				</template>
			</el-table-column>
			<el-table-column prop="margins" label="平台支出利润">
				<template slot-scope="scope">
					<span style="color: red;">{{scope.row.margins}}</span>
				</template>
			</el-table-column>
			<el-table-column prop="multiplePrice" label="多倍支出利润">
				<template slot-scope="scope">
					<span style="color: red;" v-if="Number(scope.row.multiplePrice)>0">{{scope.row.multiplePrice}}</span>
				</template>
			</el-table-column>
			<el-table-column prop="payeeName" label="姓名">
			</el-table-column>
			<el-table-column prop="payeeAccount" label="收款账号">
			</el-table-column>
			<el-table-column prop="payeeAccountName" label="收款账号名称">
			</el-table-column>
			<el-table-column prop="gameAccount" label="游戏账号">
			</el-table-column>
			<el-table-column prop="service" label="服务商">
				<template slot-scope="scope">
					<span v-if="scope.row.service=='taohaowan'">淘号玩</span>
					<span v-if="scope.row.service=='panzhi'">盼之</span>
					<span v-if="scope.row.service=='pangxie'">螃蟹</span>
					<span v-if="scope.row.service=='nanzhi'">南栀</span>
					<span v-if="scope.row.service=='jiaoyiyou'">交易游</span>
					<span v-if="scope.row.service=='kejinshou'">氪金兽</span>
					<span v-if="scope.row.service=='baiqing'">白情</span>
				</template>
			</el-table-column>
			<el-table-column prop="guaranteeBy" v-if="this.$auth.hasPermi('system:gameAftermarket:baopei')" label="包赔确认"
				width="120px" align="center">
				<template slot-scope="scope">
					<span v-if="scope.row.guaranteeBy!=null">已确认</span>
					<el-button v-else type="primary" @click="handleUpdate(scope.row)">包赔确认
					</el-button>
				</template>
			</el-table-column>
			<el-table-column prop="aftermarketBy" v-if="this.$auth.hasPermi('system:gameAftermarket:shouhou')"
				label="售后确认" width="120px" align="center">
				<template slot-scope="scope">
					<span v-if="scope.row.aftermarketBy!=null">已确认</span>

					<el-button v-else type="success" @click="handleUpdate1(scope.row)">售后确认
					</el-button>
				</template>
			</el-table-column>
			<el-table-column prop="voucher" label="赔款凭证" width="120px" align="center">
				<template slot-scope="scope">
					<image-preview v-if="scope.row.voucher!=null"
						:src="'https://static.taohaowan.com/'+scope.row.voucher" :width="50" :height="50" />
					<span v-else>未上传</span>
				</template>
			</el-table-column>
			<el-table-column prop="createBy" label="创建人">
			</el-table-column>
			<el-table-column prop="createTime" label="创建日期">
			</el-table-column>
			<el-table-column prop="status" label="状态">
				<template slot-scope="scope">
					<span v-if="scope.row.status=='T'">已托收</span>
					<span v-if="scope.row.status=='N'">未托收</span>
					<span v-if="scope.row.status=='S'">已完成</span>
				</template>
			</el-table-column>
			<el-table-column prop="remark" label="备注">
			</el-table-column>

			<el-table-column label="操作" v-if="this.$auth.hasPermi('system:gameAftermarket:shouhou')" align="center"
				width="200px" class-name="small-padding fixed-width">
				<template slot-scope="scope">
					<el-button v-if="scope.row.guaranteeBy!=null&&scope.row.aftermarketBy!=null&&scope.row.status=='N'"
						type="primary" @click="handleUpdate2(scope.row)">托收
					</el-button>
					<el-button v-if="scope.row.status=='T'&&scope.row.voucher==null" type="warning"
						@click="handleUpdate4(scope.row)">上传凭证
					</el-button>
					<el-button v-if="scope.row.status=='N'" type="danger" @click="handleDelete(scope.row)">删除
					</el-button>
				</template>
			</el-table-column>
		</el-table>

		<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
			@pagination="getList" />
		<!-- 赔付信息对话框 -->
		<el-dialog v-if="peifu" title="赔付信息" :visible.sync="peifu" append-to-body width="1000px">
			<div>
				<el-form ref="form5" :model="form5" :rules="rules1" label-width="120px">
					<el-row>
						<el-col :span="12">
							<el-form-item label="店铺名称" prop="shopId">
								<el-select filterable v-model="form5.shopId" style="width: 100%" clearable
									placeholder="请选择店铺名称">
									<el-option v-for="(item,index) in deptOptions" :label="item.label"
										:value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>

						<el-col :span="12">
							<el-form-item label="商户状态" prop="merchantStatus">
								<el-select v-model="form5.merchantStatus" style="width: 100%" clearable
									placeholder="请选择商户状态">
									<el-option v-for="(item,index) in options2" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="售后编号" prop="aftermarketId">
								<el-input v-model="form5.aftermarketId" placeholder="请输入售后编号" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="商品编号" prop="goodsId">
								<el-input v-model="form5.goodsId" placeholder="请输入商品编号" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="游戏账号" prop="gameAccount">
								<el-input v-model="form5.gameAccount"  placeholder="请输入游戏账号" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="成本金额" prop="gamePrice">
								<el-input v-model="form5.gamePrice" placeholder="请输入成本金额" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="销售金额" prop="salesPrice">
								<el-input v-model="form5.salesPrice"  placeholder="请输入销售金额" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="商家退款" prop="merchantsPrice">
								<el-input v-model="form5.merchantsPrice"  placeholder="请输入商家退款" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="平台退款" prop="firmsPrice">
								<el-input v-model="form5.firmsPrice" placeholder="请输入平台退款" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="赔付金额" prop="payoutAmount">
								<el-input v-model="form5.payoutAmount" placeholder="请输入赔付金额" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="平台支出利润" prop="margins">
								<el-input v-model="form5.margins" placeholder="请输入平台支出利润" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="收款人姓名" prop="payeeName">
								<el-input v-model="form5.payeeName" placeholder="请输入收款人姓名" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="收款账号" prop="payeeAccount">
								<el-input v-model="form5.payeeAccount" placeholder="请输入收款账号" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="收款账号名称" prop="payeeAccountName">
								<el-input v-model="form5.payeeAccountName" placeholder="请输入收款账号名称" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="包赔服务" prop="service">
								<el-select style="width: 100%" v-model="form5.service" placeholder="请选择包赔服务商">
									<el-option v-for="item in bpfwsoptions" :key="item.value" :label="item.label"
										:value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
					</el-row>
				</el-form>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitForm5">生成 订单</el-button>
				<el-button @click="cancel">取 消</el-button>
			</div>
		</el-dialog>
		<!-- 付款凭证信息 -->
		<el-dialog v-if="openFkpz" title="赔款凭证" :visible.sync="openFkpz" append-to-body width="800px">
			<el-form ref="formpz" :model="formpz" :rules="rules3" label-width="80px">
				<el-row>
					<el-col :span="12">
						<el-form-item label="赔款凭证" prop="voucher">
							<el-upload ref="upload" :action="uploadImgUrl" list-type="picture-card"
								:before-upload="beforeAvatarUpload" :on-success="handleAvatarSuccess"
								:on-remove="handleRemove" :on-change="changeUpload" :show-file-list="true"
								accept="image/png, image/jpeg, application/pdf" :multiple="true" :headers="headers">
							</el-upload>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitForm3">确 定
				</el-button>
				<el-button @click="openFkpz=false">取 消</el-button>
			</div>
		</el-dialog>
		<el-dialog v-if="open1" title="申请提现" :visible.sync="open1" append-to-body width="1000px">
			<div style="padding: 10px;overflow: auto;">
				<center>
					<el-form ref="form4" :model="form4" :rules="rules1" label-width="200px">
						<el-row>
							<el-col :span="12">
								<el-form-item label="店铺名称" prop="shopId">
									<el-select disabled v-model="form4.shopId" style="width: 100%;" clearable placeholder="请选择店铺名称">
										<el-option v-for="(item,index) in deptOptions" :label="item.label" :value="item.value">
										</el-option>
									</el-select>
								</el-form-item>
							</el-col>
						</el-row>
						<el-row>
							<el-col :span="12">
								<el-form-item label="收款名称" prop="payeeAccountName">
									<el-input  v-model="form4.payeeAccountName"  placeholder="如微信、支付宝、某某银行" />
								</el-form-item>
							</el-col>
						</el-row>
						<el-row>
							<el-col :span="12">
								<el-form-item label="姓名" prop="payeeName">
									<el-input  v-model="form4.payeeName"  placeholder="请输入姓名" />
								</el-form-item>
							</el-col>
						</el-row>
						<el-row>
							<el-col :span="12">
								<el-form-item label="提现账号" prop="payeeAccount">
									<el-input  v-model="form4.payeeAccount"  placeholder="请输入提现账号" />
								</el-form-item>
							</el-col>
						</el-row>
						<el-row>
							<el-col :span="12">
								<el-form-item label="余额(元)" prop="withdrawalAmountK">
									<el-input disabled v-model="form4.withdrawalAmountK" placeholder="余额" />
								</el-form-item>
							</el-col>
						</el-row>
						<el-row>
							<el-col :span="12">
								<el-form-item label="提现金额(元)" prop="txMoney">
									<el-input v-model="form4.txMoney" placeholder="请输入提现金额" />
								</el-form-item>
							</el-col>
						</el-row>
					</el-form>
				</center>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button v-if="tixian==true" type="primary" @click="submitForm4">确 定
				</el-button>
				<el-button type="primary" v-else :loading="true">等待中</el-button>
				<el-button @click="cancel">取 消</el-button>
			</div>
		</el-dialog>


	</div>
</template>

<script>
	import {
		getSysDeptInfo,
		getDeptInfo,
		accountMonitoring,
		add,
		upData,
		getPhone,
		view,
		deletePhone,
		getPaymentInfo,
		updateOriginalPrice,
		getTBusGoodsPaymentSum,
		updatePaymentStatus,
		paginQuery,
		paginQueryAdd,
		accept,
		orderInfo,
		deleteById
	} from "@/api/data/peifuList";
	import {
		tixian,
	} from "@/api/data/accountDetails";
	import {
		goodsPayment,
	} from "@/api/data/orderDetails";
	import {
		getShopInfo,
	} from "@/api/data/numberLibrary";
	import {
		getInitGoodsManager,
	} from "@/api/data/goods";
	import {
		queryTBusShop,
	} from "@/api/data/goodsPayment";
	import Cookies from 'js-cookie';
	import {
		getToken
	} from "@/utils/auth";
	import {checktime} from '@/utils/timeout_utils'
	export default {

		dicts: ['pallet_type', 'service_name', 'collection_source'],
		data() {
			var checkPhone = (rule, value, callback) => { // 手机号验证
				if (!value) {
					return callback(new Error('手机号不能为空'));
				} else {
					const reg = /^1[3456789]\d{9}$/
					if (reg.test(value)) {
						callback();
					} else {
						return callback(new Error('请输入正确的手机号'));
					}
				}
			};
			return {
				uploadImgUrl: process.env.VUE_APP_BASE_API + "/file/upload", // 上传的图片服务器地址
				headers: {
					Authorization: "Bearer " + getToken(),
				},
				openFkpz: false,
				zhCount: 0,
				zhPrice: 0,
				open1:false,
				// 统计
				originalprice: 0,
				salesprice: 0,
				paidinprice: 0,
				lr: 0,
				bplr: 0,
				allPrice: 0,
				// 筛选
				// activeNames: ['1'],
				cs: 0,
				cs1: 0,
				cs2: 0,
				cs3: 0,
				input: '',
				ck: false,
				yxbh: false,
				yxdq: false,
				spbh: false,
				sjbh: false,
				disabled: false,
				block: false,
				originalPrice1open: false,
				originalPriceopen: false,
				xz: false,
				peifu: false,
				openPicture: false,
				cbj: false,
				cbj1: false,
				cbj2: true,
				fl: false,
				bp: false,
				zybd: true,
				sjbd: false,
				bpLr: false,
				form2: {
					salesPrice: 0,
					merchantsPrice: 0,
					firmsPrice: 0,
				},
				form5:{},
				//包赔
				options2: [{
					value: "Y",
					label: '正常'
				}, {
					value: "X",
					label: '异常'
				}],
				rules: {
					shopId: [{
						required: true,
						message: '请选择店铺名称',
						trigger: 'blur'
					}],
					retrieveDate: [{
						required: true,
						message: '请选择找回日期',
						trigger: 'blur'
					}],
					status: [{
						required: true,
						message: '请选择状态',
						trigger: 'blur'
					}],
					acquirePrice: [{
						required: true,
						message: '请输入收购价格',
						trigger: 'blur'
					}],
					gameId: [{
						required: true,
						message: '请选择游戏',
						trigger: 'blur'
					}],
					gameAccount: [{
						required: true,
						message: '请输入游戏账号',
						trigger: 'blur'
					}],
					mobile: [{
							required: true,
							message: '请输入电话号码',
							trigger: 'blur'
						},
						{
							validator: checkPhone,
							trigger: 'blur'
						}
					],
					idNo: [{
						required: true,
						message: '请输入身份证',
						trigger: 'blur'
					}],
					name: [{
						required: true,
						message: '请输入姓名',
						trigger: 'blur'
					}],
					service: [{
						required: true,
						message: '请选择服务商',
						trigger: 'blur'
					}],
					level: [{
						required: true,
						message: '请选择售后等级',
						trigger: 'blur'
					}],
				},
				rules1: {
					shopId: [{
						required: true,
						message: '请选择店铺',
						trigger: 'blur'
					}],
					merchantStatus: [{
						required: true,
						message: '请选择商户状态',
						trigger: 'blur'
					}],
					aftermarketId: [{
						required: true,
						message: '请输入售后编号',
						trigger: 'blur'
					}],
					goodsId: [{
						required: true,
						message: '请输入商品编号',
						trigger: 'blur'
					}],
					salesPrice: [{
						required: true,
						message: '请输入销售价格',
						trigger: 'blur'
					}],
					merchantsPrice: [{
						required: true,
						message: '请输入商家退款',
						trigger: 'blur'
					}],
					firmsPrice: [{
						required: true,
						message: '请输入平台退款',
						trigger: 'blur'
					}],
					payoutAmount: [{
						required: true,
						message: '请输入赔付金额',
						trigger: 'blur'
					}],
					margins: [{
						required: true,
						message: '请输入平台支出利润',
						trigger: 'blur'
					}],
					gamePrice: [{
						required: true,
						message: '请输入游戏价格',
						trigger: 'blur'
					}],
					gameAccount: [{
						required: true,
						message: '请输入游戏账号',
						trigger: 'blur'
					}],
					payeeName: [{
						required: true,
						message: '请输入姓名',
						trigger: 'blur'
					}],
					payeeAccount: [{
						required: true,
						message: '请输入收款账号',
						trigger: 'blur'
					}],
					payeeAccountName: [{
						required: true,
						message: '请输入收款账号名称',
						trigger: 'blur'
					}],
					service: [{
						required: true,
						message: '请选择服务商',
						trigger: 'blur'
					}],
				},
				typeoptions: [{
					value: 'ZHPF',
					label: '找回赔付'
				}],

				bpfwsoptions: [{
					value: 'taohaowan',
					label: '淘号玩'
				}, {
					value: 'panzhi',
					label: '盼之'
				}, {
					value: 'nanzhi',
					label: '南栀'
				}, {
					value: 'pangxie',
					label: '螃蟹'
				}, {
					value: 'baiqing',
					label: '白情'
				}, {
					value: 'jiaoyiyou',
					label: '交易游'
				}, {
					value: 'kejinshou',
					label: '氪金兽'
				}, ],
				bpoptions: [{
					value: 'Y',
					label: '是'
				}, {
					value: 'N',
					label: '否'
				}, ],
				csoptions: [{
					value: 'goods_status_3',
					label: '已售'
				}, {
					value: '',
					label: '未售'
				}, ],
				shdjoptions: [{
					value: '1',
					label: '售后一级'
				}, {
					value: '2',
					label: '售后二级'
				}, ],
				hhoptions: [{
					value: 'Y',
					label: '是'
				}, {
					value: 'N',
					label: '否'
				}, ],
				stoptions: [{
					value: '0',
					label: '待处理'
				}, {
					value: '1',
					label: '已处理(失败)'
				}, {
					value: '2',
					label: '已处理(成功)'
				}, ],
				gameList: [],
				deptOptions: [],
				tableData: [],
				// 遮罩层
				loading: true,
				// open:false

				// 总条数
				total: 0,
				// 弹出层标题
				title: "",
				// 显示搜索条件
				showSearch: true,
				// 是否显示弹出层
				open: false,
				// 查询参数
				queryParams: {
					pageNum: 1,
					pageSize: 10,
					realName: null,
					phone: null,
					level: '',
					shopId: '',
					status: '',
					beginTime: '',
					endTime: '',
				},
				tixian:true,

				// 表单参数
				form1: {},
				form3: {},
				form4: {},//提现
				balance:'',
			};
		},
		created() {
			let query={
				shopName:'售后服务'
			}
			goodsPayment(query).then(response => {
				this.balance = response.rows[0].balance;
			});
			let level = this.$route.name.slice(this.$route.name.length - 8, this.$route.name.length)
			if (level == '&level=1') {
				this.queryParams.level = '1'
			} else {
				this.queryParams.level = '2'
			}
			this.getList();
			this.initGoodsManager();
			this.loadAll(); //获取店铺
		},
		methods: {
			// 合计 指定某一列添加合计

			getSummaries(param) {
				const {
					columns,
					data
				} = param;
				const sums = [];
				columns.forEach((column, index) => {
					if (index === 0) {
						sums[index] = "合计";
						return;
					} else if (column.property == "margins"||column.property == "firmsPrice"||column.property == "payoutAmount"||column.property == "merchantsPrice"||column.property == "salesPrice") {
						//如果是经费（正常的加减法）
						const values = data.map((item) => Number(item[column.property]));
						if (!values.every((value) => isNaN(value))) {
							sums[index] = values.reduce((prev, curr) => {
								const value = Number(curr);
								var sum = 0;
								if (!isNaN(value)) {
									sum = Number(Number(prev) + Number(curr));
									return sum.toFixed(2);
								} else {
									return prev;
								}
							}, 0);
							sums[index] += " ";
						}
					}
				});
				return sums;
			},
			submitForm4() {
				this.$refs["form4"].validate(valid => {
					if (valid) {
						if (Number(this.form4.txMoney) > Number(this.form4.withdrawalAmountK)) {
							this.$message.error('提现金额不能大于余额');
						} else {
							if (this.form4.payeeAccountName != null && this.form4.payeeAccountName != '' && this.form4.payeeName !=
								null && this.form4.payeeName != '' && this.form4.payeeAccount != null && this.form4.payeeAccount !=
								'') {
								this.tixian = false;
								let query = {
									shopId: this.form4.shopId,
									txPrice: this.form4.txMoney,
									payee: this.form4.payeeName,
									payeeAccount: this.form4.payeeAccount,
									accountName: this.form4.payeeAccountName,
								}
								tixian(query).then(response => {
									window.location.reload()
								});
							} else {
								alert('请核对提现账户信息!')
							}
						}
					}
				});

			},
			/** 提现按钮操作 */
			handleQuery2() {
				if (this.balance == 0 || this.balance == '0' || this.balance == "") {
					this.open1 = false;
				} else {
					// 21739f7ea7024134a7e8f47e245f6fa5
					getShopInfo('b790d9fd177040bc9b987054c434c2af').then(res => {
						this.form4 = res.data;
						this.form4.shopId='b790d9fd177040bc9b987054c434c2af';
						this.form4.withdrawalAmountK=this.balance;
						this.open1 = true;
					})
				}
			},
			handleUpdate4(row) {
				this.form2 = row;
				this.openFkpz = true;
			},
			submitForm3() {
				if (this.form2.voucher == null || this.form2.voucher == '') {
					return this.$modal.msgError("请上传赔付凭证!");
				}
				this.form2.shShopId="b790d9fd177040bc9b987054c434c2af";
				this.form2.status="S";
				upData(this.form2).then(res => {
					if (res.code == 200) {
						this.getList();
						this.$modal.msgSuccess("上传成功!");
						window.location.reload()
					} else {
						alert(res.msg)
					}
				})
			},
			// 上传成功
			handleAvatarSuccess(res) {
				this.form2.voucher = res.data.url
			},
			// 删除
			handleRemove(file, fileList) {
				this.form2.electronicDataList = this.form2.electronicDataList.filter(item => item !== file.response.data
					.webUrl);
			},
			// 文件状态改变时的钩子，添加文件、上传成功和上传失败时都会被调用
			changeUpload(file, fileList) {
				if (file.status === 'success') {
					this.$refs.upload.uploadFiles = this.$refs.upload.uploadFiles.filter((item) => {
						return item.raw.size / 1024 / 1024 < 50
					})
					this.tobase64(file, fileList)
				}
			},
			tobase64(file, fileList) {
				var reader = new FileReader()
				reader.readAsDataURL(file.raw)
				reader.onload = (e) => {
					const tempobj = {
						data: file.response.data.webUrl,
						suffix: '.' + file.raw.type.split('/')[1],
						fileName: file.name
					}
					this.form2.electronicDataList.push(tempobj.data)
				}
			},
			//查看
			handleUpdate2(row) {
        if(!checktime()){
          return false
        }
				let query = {
					id: row.id
				}
				accept(query).then(res => {
          this.loading = true;
					if (res.code == 200) {
						this.$modal.msgSuccess("已托收!");
						window.location.reload(); //置空form3
            this.loading = false;
					} else {
						alert(res.msg)
					}
				})
			},
			blur() {
				if (this.form2.goodsId) {
					let query = {
						goodsId: this.form2.goodsId,
						shopId: this.form2.shopId,
					};
					orderInfo(query).then(response => {
						if (response.data.length != 0) {
							response.data.forEach((item) => {
								let gameAccount = Cookies.get('gameAccount');
								if (this.form2.gameAccount == gameAccount) {
									this.form2.salesPrice = item.salesPrice;
									this.form2.merchantsPrice = item.settlementPrice;
									this.form2.firmsPrice = (Number(this.form2.salesPrice) - Number(this
										.form2.merchantsPrice)).toFixed(0);
								} else {
									alert('账号有误请核对!')
								}
							});
							console.log(this.form2)
						} else {
							alert('商品编号有误请核对!')
						}
					});
				}

			},
			tableRowClassName({
				row,
				rowIndex
			}) {
				if (rowIndex === 1 || rowIndex === 5 || rowIndex === 9) {
					return 'warning-row';
				} else if (rowIndex === 3 || rowIndex === 7) {
					return 'success-row';
				}
				return '';
			},
			loadAll() {
				queryTBusShop().then(response => {
					response.data.forEach((item) => {
						this.deptOptions.push({
							label: item.name,
							value: item.id,
						});
					});
				});
				return this.deptOptions;
			},
			initGoodsManager() {
				getInitGoodsManager().then(res => {
					this.gameList = res.gameList
				})
			},
			/** 新增按钮操作 */
			handleAdd() {
				this.form5 = {};
				this.resetQuery();
				this.peifu = true;
			},
			/** 删除按钮操作 */
			handleDelete(row) {
				const id = row.id
				this.$modal.confirm('是否确认删除商品编号为["' + row.goodsId + '"]的数据项吗？').then(function() {
					return deleteById(id);
				}).then(() => {
					this.getList();
					this.$modal.msgSuccess("删除成功");
				}).catch(() => {});
			},

			/** 查询账号信息列表 */
			getList() {
				this.loading = true;
				accountMonitoring(this.queryParams).then(response => {
					this.tableData = response.data.table.rows;
					this.total = response.data.table.total;
					this.zhCount = response.data.table.total;
					this.zhPrice = response.data.price;
					this.loading = false;
				});
			},
			//包赔确认按钮
			handleUpdate(row) {
				this.$modal.confirm('请核对您的退款本金' + row.gamePrice).then(function() {

				}).then(() => {
					let data = row;
					data.guaranteeBy = 'Y';
					upData(data).then(res => {
						if (res.code == 200) {
							this.getList();
							this.$modal.msgSuccess("已确认!");
						} else {
							alert(res.msg)
						}
					})
				}).catch(() => {});
			},
			//售后确认按钮
			handleUpdate1(row) {
				this.$modal.confirm('请核对您的退款本金' + row.gamePrice).then(function() {

				}).then(() => {
					let data = row;
					data.aftermarketBy = 'Y';
					upData(data).then(res => {
						if (res.code == 200) {
							this.getList();
							this.$modal.msgSuccess("已确认!");
						} else {
							alert(res.msg)
						}
					})
				}).catch(() => {});
			},


			/** 搜索按钮操作 */
			handleQuery() {
				this.block = false;
				this.queryParams.pageNum = 1;
				this.getList();
			},

			/** 重置按钮操作 */
			resetQuery() {
				this.block = false;
				this.disabled = false;
				this.resetForm("queryForm");
				this.handleQuery();
			},





			// 新增确定按钮
			submitForm() {
				this.gameList.forEach(res => {
					if (res.id == this.form1.gameId) {
						this.form1.gameName = res.gameName
					}
				})
				this.$refs["form"].validate(valid => {
					if (valid) {
						if (this.title == '添加找回信息') {
							add(this.form1).then(res => {
								if (res.code == 200) {
									this.getList();
									this.xz = false;
									this.$modal.msgSuccess("添加成功");
								} else {
									alert(res.msg)
								}
							})
						} else {
							upData(this.form1).then(res => {
								if (res.code == 200) {
									this.getList();
									this.xz = false;
									this.$modal.msgSuccess("修改成功");
								} else {
									alert(res.msg)
								}
							})
						}
					}
				})
			},
			// 新增确定按钮
			submitForm1() {
				this.$refs["form2"].validate(valid => {
					if (valid) {
						paginQueryAdd(this.form2).then(res => {
							if (res.code == 200) {
								this.getList();
								this.peifu = false;
								this.$modal.msgSuccess("已赔付!");
								window.location.reload(); //置空form2
							} else {
								alert(res.msg)
							}
						})
					}
				})
			},
			// 新增确定按钮
			submitForm5() {
				this.$refs["form5"].validate(valid => {
					if (valid) {
						this.form5.type='QT';
						this.form5.status='T';
						this.form5.guaranteeBy = 'Y';
						paginQueryAdd(this.form5).then(res => {
							if (res.code == 200) {
								this.getList();
								this.peifu = false;
								this.$modal.msgSuccess("已添加");
								window.location.reload(); //置空form5
							} else {
								alert(res.msg)
							}
						})
					}
				})
			},
			// 新增确定按钮
			submitForm2() {
				this.$refs["form3"].validate(valid => {
					if (valid) {
						accept(this.form3).then(res => {
							if (res.code == 200) {
								this.$modal.msgSuccess("已托收!");
								window.location.reload(); //置空form3
							} else {
								alert(res.msg)
							}
						})
					}
				})
			},


			cancel() {
				this.ck = false;
				this.xz = false;
				this.peifu = false;
				this.open1 = false;
				this.resetForm("form");
				this.resetForm("form2");
			},



		}
	};
</script>
<style>
	.father {
		height: 80px;
		line-height: 80px;
		font-size: 25px;
		display: flex;
		justify-content: space-around;
	}

	.el-icon-loading {
		color: green;
		margin-right: 5px;
	}

	.el-icon-message-solid {
		color: green;
		margin-right: 5px;
	}

	.el-icon-check {
		color: green;
		margin-right: 5px;
	}

	.el-icon-coin {
		color: green;
		margin-right: 5px;
	}
</style>
