<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 v-show="bpLr3" label="销售渠道" prop="distributionChannel">
				<el-select v-model="queryParams.distributionChannel" style="width: 200px" clearable
					placeholder="请选择销售渠道">
					<el-option v-for="(item,index) in options4" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item v-show="bpLr2" label="多倍包赔" prop="isMultiple">
				<el-select v-model="queryParams.isMultiple" style="width: 200px" clearable placeholder="请选择多倍包赔">
					<el-option v-for="(item,index) in options9" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>

			<el-form-item label="商品编号" prop="goodsId">
				<el-input v-model="queryParams.goodsId" style="width: 200px;" placeholder="请输入商品编号" clearable
					@keyup.enter.native="handleQuery" />
			</el-form-item>
			<el-form-item label="付款状态" prop="paymentStatus">
				<el-select v-model="queryParams.paymentStatus" style="width: 200px" clearable placeholder="请选择付款状态">
					<el-option v-for="(item,index) in options1" :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   type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> -->
				<!-- <el-tooltip class="item" effect="dark" content="请输入商品名称" placement="top-start">
					<span>
						<el-button v-show="disabled" type="primary" icon="el-icon-search" size="mini" disabled>搜索
						</el-button>
					</span>

				</el-tooltip> -->

				<el-button style="margin-left: 20px;" icon="el-icon-refresh" size="mini" @click="resetQuery">重置
				</el-button>
			</el-form-item>
		</el-form>


		<el-row :gutter="10" class="mb8">
			<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" ></right-toolbar>
		</el-row>
		<el-table :data="tableData" style="width: 100%">
			<el-table-column prop="createTime" label="订单时间">
				<template slot-scope="scope">
					<span>{{scope.row.createTime.slice(0,10)}}</span>
				</template>
			</el-table-column>
			<el-table-column prop="deptName" label="部门">
			</el-table-column>
			<el-table-column prop="shopName" label="店铺">
			</el-table-column>
			<el-table-column prop="goodsId" label="商品编号">
			</el-table-column>
			<el-table-column v-if="bpLr3" prop="distributionChannel" label="销售渠道">
				<template slot-scope="scope">
					<span v-if="scope.row.distributionChannel=='game_platform_mapping_1'">游戏阁</span>
					<span v-if="scope.row.distributionChannel=='game_platform_mapping_3'">换号吧</span>
					<span v-if="scope.row.distributionChannel=='game_platform_mapping_4'">氪金兽</span>
					<span v-if="scope.row.distributionChannel=='game_platform_mapping_5'">盼之</span>
					<span v-if="scope.row.distributionChannel=='game_platform_mapping_6'">螃蟹</span>
					<span v-if="scope.row.distributionChannel=='game_platform_mapping_7'">神仙代售</span>
					<span v-if="scope.row.distributionChannel=='game_platform_mapping_8'">看个号</span>
					<span v-if="scope.row.distributionChannel=='game_platform_mapping_9'">7881</span>
					<span v-if="scope.row.distributionChannel=='game_platform_mapping_10'">聚幻游</span>
					<span v-if="scope.row.distributionChannel=='game_platform_mapping_11'">破晓网</span>
					<span v-if="scope.row.distributionChannel=='taohaowan'">淘号玩</span>
					<span v-if="scope.row.distributionChannel=='all'">其他</span>
				</template>
			</el-table-column>
			<el-table-column v-if="bpLr3" prop="channelId" label="分销编号">
			</el-table-column>
			<el-table-column v-if="cbj2" prop="originalPrice" label="成本价">
			</el-table-column>
			<el-table-column prop="salesPrice" label="销售价">
			</el-table-column>
			<el-table-column prop="paidinPrice" label="到手金额">
			</el-table-column>
			<el-table-column prop="gameId" v-if="columns[0].visible" label="游戏编号">
			</el-table-column>
			<el-table-column prop="gameName" v-if="columns[3].visible" label="游戏名称">
			</el-table-column>
			<el-table-column prop="gameareaId" v-if="columns[1].visible" label="游戏大区id">
			</el-table-column>
			<el-table-column prop="shopId" v-if="columns[2].visible" label="商家编号">
			</el-table-column>

			<el-table-column prop="goodsName" v-if="columns[4].visible" show-overflow-tooltip height="20px"
				label="商品名称">
			</el-table-column>



			<el-table-column prop="settlementPrice" label="结算价格">
			</el-table-column>
			<el-table-column v-if="bpLr" prop="isSecurity" label="包赔服务">
				<template slot-scope="scope">
					<span v-if="scope.row.isSecurity=='Y'">是</span>
					<span v-if="scope.row.isSecurity=='N'">否</span>
				</template>
			</el-table-column>
			<el-table-column v-if="bpLr" prop="securityRate" label="包赔利率">
			</el-table-column>
			<el-table-column v-if="bpLr" prop="securityPrice" label="包赔费用">
			</el-table-column>
			<el-table-column v-if="bpLr" prop="partnerHandlingFee" label="费率">
			</el-table-column>
			<el-table-column prop="platformProfit" label="利润">
			</el-table-column>
			<el-table-column v-if="bpLr1" prop="isMultiple" label="多倍包赔">
				<template slot-scope="scope">
					<span v-if="scope.row.isMultiple=='is_multiple_0'">是</span>
					<span v-if="scope.row.isMultiple=='is_multiple_1'">否</span>
				</template>
			</el-table-column>
			<el-table-column v-if="bpLr1" prop="multiplePrice" label="多倍包赔利润">
			</el-table-column>
			<el-table-column v-if="bpLr1" prop="byStages" label="分期购买">
				<template slot-scope="scope">
					<span v-if="scope.row.byStages=='by_stages_0'">分期客服-辉提</span>
					<span v-if="scope.row.byStages=='by_stages_1'">分期客服-苗提</span>
					<span v-if="scope.row.byStages=='by_stages_2'">没购买分期</span>
				</template>
			</el-table-column>
			<el-table-column prop="paymentStatus" label="状态">
				<template slot-scope="scope">
					<span v-if="scope.row.paymentStatus=='S'">已结算</span>
					<span v-if="scope.row.paymentStatus=='X'">未结算</span>
					<span v-if="scope.row.paymentStatus=='T'">已退款</span>
					<span v-if="scope.row.paymentStatus=='SH'">待审核</span>
				</template>
			</el-table-column>
			<el-table-column v-if="bpLr1" prop="paymentVoucher" label="付款凭证">
				<template slot-scope="scope">
					<span style="color:blue;cursor: pointer" v-if="scope.row.paymentVoucher!=null"
						@click="openFkpz(scope.row)">已上传</span>
				</template>
			</el-table-column>

			<el-table-column prop="paymentMethod" label="付款方式">
				<template slot-scope="scope">
					<span v-if="scope.row.paymentMethod=='X'">线下支付</span>
					<span v-if="scope.row.paymentMethod=='S'">线上支付</span>
				</template>
			</el-table-column>

			<el-table-column prop="createBy" v-if="columns[5].visible" label="创建者">
			</el-table-column>
			<el-table-column prop="remark" v-if="columns[6].visible" label="备注">
			</el-table-column>

			<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
				<template slot-scope="scope">
					<el-button v-if="scope.row.paymentStatus=='X'" size="mini" type="text" icon="el-icon-edit"
						@click="handleUpdate2(scope.row)">确认结算
					</el-button>
					<!-- <el-button v-if="scope.row.paymentStatus=='X'" size="mini" type="text" icon="el-icon-edit"
						@click="handleUpdate3(scope.row)">退款
					</el-button> -->
					<el-button v-if="scope.row.paymentStatus=='X'" size="mini" type="text" icon="el-icon-edit"
						@click="handleUpdate4(scope.row)">撤回
					</el-button>
					<!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(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="open1" title="保存信息" :visible.sync="open1" append-to-body width="1000px">
			<div style="padding: 10px;overflow: auto">
				<el-form ref="form" :model="form" :rules="rules" label-width="80px">
					<el-row>
						<el-col :span="12">
							<el-form-item v-show="cbj" label="成本价" prop="cbj1">
								<el-input v-model="queryParams.originalPrice" placeholder="请输入成本价" />
							</el-form-item>

						</el-col>

					</el-row>
					<el-row>
						<el-col :span="12">
							<el-form-item v-show="fkpz" label="付款凭证" prop="paymentVoucher">
								<div class="img_list">
									<div style="position: relative;width: 100px;height: 100px;"
										v-for="item in attach_list">
										<el-image @click="deletePicture(item.id)" style="width: 100px;height: 100px;"
											:src="nginx_pictures_path+item.url"></el-image>
									</div>
								</div>
								<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-row>
						<el-col :span="12">
							<el-form-item v-show="fkpz" label="付款渠道" prop="paymentChannels">
								<el-input v-model="queryParams.paymentChannels" placeholder="如：微信、支付宝、某某银行" />
							</el-form-item>

						</el-col>

					</el-row>
				</el-form>
			</div>

			<div slot="footer" class="dialog-footer">
				<el-button type="primary" v-hasPermi="['system:goodsPayment:add']" @click="submitForm1">确 定</el-button>
				<el-button @click="cancel">取 消</el-button>
			</div>
		</el-dialog>
		<!-- 付款凭证信息 -->
		<el-dialog v-if="openFkpz1" title="付款凭证" :visible.sync="openFkpz1" append-to-body width="800px">
			<div style="display: flex;flex-wrap: wrap;">
				<div style="padding: 10px;overflow: auto;" v-for="(item,index) in carouselImg" :key="item.id">
					<el-image style="width: 200px;height: 200px;" :preview-src-list="srcList"
						:src="pictureServerPath+item" :key="index">
					</el-image>
				</div>
			</div>


			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="openFkpz1=false">确 定</el-button>
				<el-button @click="openFkpz1=false">取 消</el-button>
			</div>
		</el-dialog>
		<!-- 退款信息 -->
		<el-dialog v-if="tuikuan" title="退款" :visible.sync="tuikuan" append-to-body width="800px">
			<div style="display: flex;flex-wrap: wrap;">
				<p>您的退款金额是{{tkje}}</p>
				<el-form>
					<el-form-item label="是否上架" prop="isRelease">
						<el-select v-model="queryParams.isRelease" style="width: 200px" clearable placeholder="请选择付款状态">
							<el-option v-for="(item,index) in options9" :label="item.label" :value="item.value">
							</el-option>
						</el-select>
					</el-form-item>
				</el-form>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="tuikuan">确 定</el-button>
				<el-button @click="tuikuan=false">取 消</el-button>
			</div>
		</el-dialog>
		<!-- 撤回信息 -->
		<el-dialog v-if="ch" title="撤回" :visible.sync="ch" append-to-body width="800px">
			<div style="display: flex;flex-wrap: wrap;">
				<el-form ref="form" :model="form3">
					<el-row>
						<el-col :span="12">
							<el-form-item label="撤回原因" prop="remark">
								<el-input style="width: 500px;" v-model="form3.remark" type="textarea" :rows="2"
									placeholder="请输入撤回原因" />
							</el-form-item>
						</el-col>
		
					</el-row>
		
		
				</el-form>
				<el-form>
		
				</el-form>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="bh">确 定</el-button>
				<el-button @click="ch=false">取 消</el-button>
			</div>
		</el-dialog>

		<!-- 详情状态信息 -->
		<el-dialog v-if="open" title="商品付款明细信息" :visible.sync="open" append-to-body width="1000px">
			<div style="padding: 10px;overflow: auto">
				<el-form ref="form" :model="form" label-width="80px">
					<el-row>

						<el-col :span="12">
							<el-form-item label="创建时间" prop="gameId">
								<el-input v-model="form.createTime" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="商品编号" prop="idNo">
								<el-input v-model="form.goodsId" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="商品名称" prop="idNo">
								<el-input v-model="form.goodsName" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="游戏名称" prop="accountId">
								<el-input v-model="form.gameName" disabled />
							</el-form-item>
						</el-col>


						<el-col :span="12">
							<el-form-item label="销售价格" prop="idNo">
								<el-input v-model="form.salesPrice" disabled />
							</el-form-item>
						</el-col>

						<el-col :span="12">
							<el-form-item label="实际价格" prop="idNo">
								<el-input v-model="form.paidinPrice" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="销售渠道" prop="idNo">
								<el-input v-if="form.distributionChannel=='game_platform_mapping_1'" value="游戏阁"
									disabled />
								<el-input v-if="form.distributionChannel=='game_platform_mapping_3'" value="换号吧"
									disabled />
								<el-input v-if="form.distributionChannel=='game_platform_mapping_4'" value="氪金兽"
									disabled />
								<el-input v-if="form.distributionChannel=='game_platform_mapping_5'" value="盼之"
									disabled />
								<el-input v-if="form.distributionChannel=='game_platform_mapping_6'" value="螃蟹"
									disabled />
								<el-input v-if="form.distributionChannel=='game_platform_mapping_7'" value="神仙代售"
									disabled />
								<el-input v-if="form.distributionChannel=='game_platform_mapping_8'" value="看个号"
									disabled />
								<el-input v-if="form.distributionChannel=='game_platform_mapping_9'" value="7881"
									disabled />
								<el-input v-if="form.distributionChannel=='game_platform_mapping_10'" value="聚幻游"
									disabled />
								<el-input v-if="form.distributionChannel=='game_platform_mapping_11'" value="破晓网"
									disabled />
								<el-input v-if="form.distributionChannel=='all'" value="其他" disabled />
								<el-input v-if="form.distributionChannel=='taohaowan'" value="淘号玩" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="费率" prop="partnerHandlingFee">
								<el-input v-model="form.partnerHandlingFee" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="结算价格" prop="settlementPrice">
								<el-input v-model="form.settlementPrice" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="利润" prop="platformProfit">
								<el-input v-model="form.platformProfit" disabled />
							</el-form-item>
						</el-col>

						<el-col :span="12">
							<el-form-item label="号商" prop="wxNo">
								<el-input v-model="form.shopName" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="状态 " prop="remark">
								<el-input value="已售出" disabled />
							</el-form-item>
						</el-col>


						<el-col :span="12">
							<el-form-item v-show="channelid" label="渠道id" prop="channelId">
								<el-input v-model="form.channelId" disabled placeholder="请输入渠道id" />
							</el-form-item>
						</el-col>
						<!-- <el-col :span="12">
							<el-form-item label="付款渠道" prop="paymentChannels">
								<el-input v-model="form.paymentChannels" disabled placeholder="如：微信、支付宝、XX银行" />
							</el-form-item>
						</el-col> -->




						<el-col :span="12" v-show="bp">
							<el-form-item label="是否包赔" prop="isSecurity">
								<el-select style="width: 100%;" v-if="form.isSecurity=='Y'" placeholder="请选择是否包赔"
									disabled v-model="form.isSecurity" clearable>
									<el-option label="是" value="Y"></el-option>
								</el-select>
								<el-select style="width: 100%;" v-if="form.isSecurity=='N'" placeholder="请选择是否包赔"
									disabled v-model="form.isSecurity" clearable>
									<el-option label="否" value="N"></el-option>
								</el-select>
							</el-form-item>

						</el-col>
						<!-- <el-col :span="12">
							<el-form-item label="付款流水号" prop="paymentNumber">
								<el-input v-model="form.paymentNumber" disabled placeholder="请输入付款流水号" />
							</el-form-item>
						</el-col> -->

					</el-row>
				</el-form>
			</div>
		</el-dialog>

	</div>
</template>

<script>
	import {
		goodsPayment,
		updatepartnerlist,
		getInitGoodsManager,
		getPaymentInfo,
		updateOriginalPrice,
		updateTefund,
		confirmSettlement,
		revoke
	} from "@/api/data/settlement";
	import {
		getDeptInfo
	} from "@/api/data/goodsPayment";
	import Cookies from 'js-cookie';
	import {
		getToken
	} from "@/utils/auth";
	export default {

		data() {
			return {
				uploadImgUrl: process.env.VUE_APP_BASE_API + "/file/uploadNew", // 上传的图片服务器地址
				headers: {
					Authorization: "Bearer " + getToken(),
				},
				// electronicDataList: [],
				// 表单参数
				form: {
					electronicDataList: [],
					// electronicDataList: '',
					gamePicture: [],
					//创建一个游戏属性数值
					arrayLIst: []
				},
				// 统计
				originalprice: 0,
				salesprice: 0,
				paidinprice: 0,
				lr: 0,
				//付款凭证
				carouselImg: [],
				srcList: [],
				openFkpz1: false,
				// 筛选
				// activeNames: ['1'],
				cs: 0,
				cs1: 0,
				cs2: 0,
				cs3: 0,
				//退款信息
				tuikuan: false,
				ch:false,
				tkje: 0,
				input: '',
				yxbh: false,
				yxdq: false,
				spbh: false,
				sjbh: false,
				disabled: true,
				block: false,
				originalPrice1open: false,
				originalPriceopen: false,
				open1: false,
				openPicture: false,
				cbj: false,
				cbj1: false,
				cbj2: true,
				fl: false,
				bp: false,
				zybd: true,
				sjbd: false,
				bpLr: true,
				bpLr1: true,
				bpLr2: true,
				bpLr3: true,
				// 付款凭证
				attach_list: [],
				// 列信息
				columns: [{
						key: 0,
						label: `游戏编号`,
						visible: false
					},
					{
						key: 1,
						label: `游戏大区id`,
						visible: false
					},
					{
						key: 2,
						label: `商家编号`,
						visible: false
					},
					{
						key: 3,
						label: `游戏名称`,
						visible: false
					},
					{
						key: 4,
						label: `商品名称`,
						visible: false
					},

					{
						key: 5,
						label: `备注`,
						visible: false
					},
					{
						key: 6,
						label: `创建者`,
						visible: false
					},
				],
				// 付款状态
				options1: [{
						value: "'S'",
						label: '已结算'
					}, {
						value: "'X'",
						label: '未结算'
					},
					{
						value: "'T'",
						label: '已退款'
					}
				],
				options2: [{
					value: "Y",
					label: '是'
				}, {
					value: "N",
					label: '否'
				}],
				options4: [{
						value: 'taohaowan',
						label: '淘号玩'
					}, {
						value: 'game_platform_mapping_1',
						label: '游戏阁'
					}, {
						value: 'game_platform_mapping_3',
						label: '换号吧'
					},
					{
						value: 'game_platform_mapping_4',
						label: '氪金兽'
					},
					{
						value: 'game_platform_mapping_5',
						label: '盼之'
					},
					{
						value: 'game_platform_mapping_6',
						label: '螃蟹'
					},
					{
						value: 'game_platform_mapping_7',
						label: '神仙代售'
					},
					{
						value: 'game_platform_mapping_8',
						label: '看个号'
					}, {
				
						value: 'game_platform_mapping_9',
						label: '7881'
					},
					{
						value: 'game_platform_mapping_10',
						label: '聚幻游'
					},
					{
						value: 'game_platform_mapping_11',
						label: '破晓网'
					},
					{
						value: 'all',
						label: '其他'
					},
				],
				//多倍包赔
				options9: [{
					value: "is_multiple_0",
					label: '是'
				}, {
					value: "is_multiple_1",
					label: '否'
				}],
				tableData: [],
				// 遮罩层
				loading: true,

				// 总条数
				total: 0,
				// 弹出层标题
				title: "",
				// 显示搜索条件
				showSearch: true,
				// 是否显示弹出层
				open: false,
				// 查询参数
				queryParams: {
					pageNum: 1,
					pageSize: 10,
					publishStatus: null,
					deleteStatus: null,
					updateStatus: null,
					goodsName: null,
					gameName: null,
					partnerName: null,
					beginTime: null,
					endTime: null,
					paymentStatus: null,
					type: "JS",
					// paymentStatus:null,
					originalPrice: null,
				},

				// 表单参数
				form3: {
					remark:null,
				},
				queryForm: {
					publishStatus: null,
					deleteStatus: null,
					updateStatus: null,
					goodsName: null,
					gameName: null,
					partnerName: null,
				},
			};
		},
		created() {
			this.getList();
			this.user();
		},
		methods: {
			//付款凭证信息
			openFkpz(row) {
				this.carouselImg = row.paymentVoucher.split(",")
				this.carouselImg.forEach((item) => {
					this.srcList.push(this.pictureServerPath + item);
				});
				this.openFkpz1 = true
			},
			user() {
				getDeptInfo().then(res => {
					// this.bpLr=true
					if (res.data.deptName == '自营商家' || res.data.deptName == '自营本部' || res.data.deptName ==
						'对接平台') {
						this.bpLr = false
					}
					if (res.data.deptName == '对接平台') {
						this.cbj2 = false
						this.bpLr1 = false
						this.bpLr2 = false
						this.bpLr3 = false
					}
				});
				getInitGoodsManager().then(res => {
					this.pictureServerPath = res.pictureServerPath
					// console.log(res.pictureServerPath)
				})
			},
			deletePicture(id) {
				let that = this
				this.$modal.confirm("确定删除此图片吗？").then(function() {
					delAttach(id).then(r => {
						getGoodsPictures({
							goodsId: that.form.id
						}).then(resp => {
							that.nginx_pictures_path = resp.nginx_pictures_path
							that.attach_list = resp.attachlist
						})
					})
				})
			},
			// 上传之前
			beforeAvatarUpload(file) {
				const isJPG = file.type === 'image/jpeg'
				const isPng = file.type === 'image/png'
				const isPdf = file.type === 'application/pdf'
				const isLt50M = file.size / 1024 / 1024 < 50
				if (!isLt50M) {
					this.$message.warning('上传文件大小不能超过 50MB!')
					return false
				}
				if (!isJPG && !isPng && !isPdf) {
					this.$message.warning('只能上传 JPG/PNG/PDF/JPEG 格式!')
					return false
				}
			},
			// 上传成功
			handleAvatarSuccess(res) {
				this.form.gamePicture = res.data.url
				// console.log(this.form.gamePicture)
			},
			// 删除
			handleRemove(file, fileList) {
				// console.log(file.response.data.webUrl)
				// console.log(this.form.electronicDataList)
				this.form.electronicDataList = this.form.electronicDataList.filter(item => item !== file.response.data
					.webUrl);
				// this.tobase64(file,fileList)
				// console.log(this.form.electronicDataList)
			},
			// 文件状态改变时的钩子，添加文件、上传成功和上传失败时都会被调用
			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 str='';
				// let that = this
				var reader = new FileReader()
				reader.readAsDataURL(file.raw)
				reader.onload = (e) => {
					const tempobj = {
						// data: e.target.result.split(',')[1],
						data: file.response.data.webUrl,
						suffix: '.' + file.raw.type.split('/')[1],
						fileName: file.name
					}
					this.form.electronicDataList.push(tempobj.data)
					// console.log(this.form.electronicDataList)

				}

			},




			/** 查询黑号信息列表 */
			getList() {
				this.loading = true;
				goodsPayment(this.queryParams).then(response => {
					this.tableData = response.data.table.rows;
					this.total = response.data.table.total
					this.loading = false;
				});
			},
			//搜索按钮使用
			getList1() {
				this.loading = true;
				goodsPayment(this.queryParams).then(response => {
					this.tableData = response.rows;
					this.total = response.total
					this.loading = false;
				});
			},

			/** 搜索按钮操作 */
			handleQuery() {
				this.queryParams.pageNum = 1;
				this.getList();
			},
			handleQuery1() {
				this.queryParams.pageNum = 1;
				this.getList();
			},
			/** 重置按钮操作 */
			resetQuery() {
				this.resetForm("queryForm");
				this.handleQuery1();
			},


			/** 详细按钮操作 */
			handleUpdate(row) {
				this.open = true;
				if (row.isSecurity == null) {
					this.bp = false
				} else {
					this.bp = true
				}
				let query = {
					id: row.id
				}
				getPaymentInfo(query).then(response => {
					this.form = response.data;
				});
			},
			/** 编辑按钮操作 */
			handleUpdate1(row) {

				if (row.mainIndustry == "account_source_2" && row.distributionChannel == 'taohaowan' || row.mainIndustry ==
					"account_source_2" && row.distributionChannel == 'youxige') {
					this.open1 = false
				} else {
					if (row.mainIndustry == 'account_source_0') {
						this.cbj = true
					} else if (row.mainIndustry == "account_source_2") {
						this.cbj = false
					}
					if (row.distributionChannel == 'taohaowan' || row.distributionChannel == 'youxige') {
						this.fkpz = false
					} else {
						this.fkpz = true
					}

					this.queryParams.originalPrice = row.originalPrice
					this.open1 = true
					Cookies.set('id', row.id)
				}

			},
			handleUpdate2(row) {
				this.$confirm('您的结算金额是 ￥' + row.settlementPrice + '', '确认结算', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					let query = {
						id: row.id,
					}

					// updatePaymentStatus(query).then(res=>{
					confirmSettlement(query).then(res => {
						console.log(res)
						this.$message({
							type: 'success',
							message: '结算成功!'
						})
						this.getList()
						this.getTBusGoods()
					})

				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消结算'
					});
				});



			},
			// 退款按钮
			handleUpdate3(row) {
				this.$confirm('您的退款金额是 ￥' + row.paidinPrice + '', '确认退款', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					let query = {
						id: row.id,
					}
					updateTefund(query).then(res => {
						console.log(res)
						this.$message({
							type: 'success',
							message: '退款成功!'
						})
						this.getList()
						this.getTBusGoods()
					})

				}).catch(() => {
					this.$message({
						type: 'info',
					 message: '已取消退款'
					});
				});



			},
			//撤回按钮
			handleUpdate4(row){
				this.$confirm('确认撤回' + row.goodsId + '吗？', '撤回', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					let query={
						id:row.id
					}
					revoke(query).then(res => {
						// console.log(res)
						this.$message({
							type: 'success',
							message: '撤回成功!'
						})
						this.ch = false
						this.getList()
						this.getTBusGoods()
					})
				
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消撤回'
					});
				});
				
			},

			submitForm1() {
				// console.log(this.form.gamePicture)
				let electronicDataList = this.form.electronicDataList.toString();
				// console.log(electronicDataList)
				let goodsid = Cookies.get('id')
				let query = {
					id: goodsid,
					originalPrice: this.queryParams.originalPrice,
					paymentChannels: this.queryParams.paymentChannels,
					paymentVoucher: electronicDataList
					// paymentVoucher: 'https://element.eleme.io/#/zh-CN/component/button'
				}
				// console.log(query)
				// console.log(query.paymentVoucher)
				updateOriginalPrice(query).then(response => {
					this.open1 = false
					this.getList()
					this.getTBusGoods()
					// console.log(response)
				});
			},
			cancel() {
				this.open1 = false
				this.resetForm("form");
			},
			/** 提交按钮 */
			submitForm() {
				this.$refs["form"].validate(valid => {
					if (valid) {
						if (this.form.id != null) {
							updatepartnerlist(this.form).then(response => {
								this.$modal.msgSuccess("修改成功");
								this.open = false;
								this.getList();
							});
						} else {
							addpartnerlist(this.form).then(response => {
								this.$modal.msgSuccess("新增成功");
								this.open = false;
								this.getList();
							});
						}
					}
				});
			},


		}
	};
</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>
