<template>
	<div class="app-container">
		<el-form :model="queryParams" v-if="this.$auth.hasPermi('system:shop:sx')" ref="queryForm" size="small" :inline="true"
			label-width="68px">
			<el-form-item label="店铺名称" prop="name">
				<el-input v-model="queryParams.name" placeholder="请输入店铺名称" clearable
					@keyup.enter.native="handleQuery" />
			</el-form-item>
			<el-form-item label="店铺编号" prop="code">
				<el-input v-model="queryParams.code" placeholder="请输入店铺编号" clearable
					@keyup.enter.native="handleQuery" />
			</el-form-item>



			<el-form-item label="搜索商品标题" prop="connName">
				<el-input v-model="queryParams.connName" placeholder="请输入商品标题查询对应店铺" clearable
					@keyup.enter.native="handleQuery" />
			</el-form-item>


			<!--<el-form-item label="搜索游戏标题" prop="certificationType">
        <el-select v-model="queryParams.certificationType" placeholder="请选择认证类型" clearable>
          <el-option
            v-for="dict in dict.type.certification_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>-->
			<el-form-item label="认证状态" prop="certificationStatus">
				<el-select v-model="queryParams.certificationStatus" placeholder="请选择认证状态" clearable>
					<el-option v-for="dict in dict.type.certification_status" :key="dict.value" :label="dict.label"
						:value="dict.value" />
				</el-select>
			</el-form-item>

			<el-form-item label="店铺状态" prop="shopStatus">
				<el-select v-model="queryParams.shopStatus" placeholder="请选择店铺状态" clearable>
					<el-option v-for="dict in dict.type.shop_status" :key="dict.value" :label="dict.label"
						:value="dict.value" />
				</el-select>
			</el-form-item>
			<!-- <el-form-item label="到期时间" prop="endTime">
				<el-date-picker clearable v-model="queryParams.endTime" type="date" value-format="yyyy-MM-dd"
					placeholder="请选择到期时间">
				</el-date-picker>
			</el-form-item> -->
			<el-form-item label="店铺关键字" prop="shopKeyword">
				<el-input v-model="queryParams.shopKeyword" placeholder="请输入店铺关键字" clearable
					@keyup.enter.native="handleQuery" />
			</el-form-item>
			<!-- <el-form-item label="店铺关键字" prop="shopKeyword">
	    <el-input
	      v-model="queryParams.shopKeyword"
	      placeholder="请输入店铺关键字"
	      clearable
	    />
	  </el-form-item>
 -->
			<el-form-item>
				<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
				<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
			</el-form-item>
		</el-form>

		<el-row :gutter="10" class="mb8">
			<el-col :span="1.5">
				<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
					v-hasPermi="['system:shop:add']">新增
				</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
					v-hasPermi="['system:shop:edit1']">修改
				</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
					@click="handleDelete" v-hasPermi="['system:shop:remove']">删除
				</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
					v-hasPermi="['system:shop:export']">导出
				</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button type="danger" plain icon="el-icon-share" size="mini" @click="all"
					v-hasPermi="['system:shop:tj']">统计
				</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button type="danger" plain icon="el-icon-circle-close" size="mini" @click="toOtherPage1('numberIncreaseFailed')"
					v-hasPermi="['system:shop:Defeat']">提号失败
				</el-button>
			</el-col>
			<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
		</el-row>

		<el-table v-loading="loading" stripe="true" :data="shopList" @selection-change="handleSelectionChange">
			<el-table-column type="selection" width="55" align="center" />
			<!--<el-table-column label="店铺ID" align="center" prop="id" />-->
			<el-table-column label="店铺名称" align="center" prop="name" />
			<el-table-column label="店铺编号" align="center" prop="code" />
			<el-table-column label="店铺状态" align="center" prop="shopStatus">
				<template slot-scope="scope">
					<dict-tag :options="dict.type.shop_status" :value="scope.row.shopStatus" />
				</template>
			</el-table-column>
			<!-- <el-table-column>
				<template slot-scope="scope">
					<label @click="handleUpdate(scope.row)">详情</label>
				</template>
			</el-table-column> -->
			<el-table-column>
				<template slot-scope="scope">
					<label style="color: #1890ff;cursor: pointer;" @click="toOtherPage('goods',scope.row)">在售商品</label>
				</template>
			</el-table-column>
			<el-table-column>
				<template slot-scope="scope">
					<label style="color: #ff4949;cursor: pointer;" @click="toOtherPage('downGoods',scope.row)">下架商品</label>
				</template>
			</el-table-column>
			<el-table-column>
				<template slot-scope="scope">
					<label style="color: #13ce66;cursor: pointer;" @click="toOtherPage('order',scope.row)">订单</label>
				</template>
			</el-table-column>
			<!-- <el-table-column>
				<template slot-scope="scope">
					<label @click="shopServers(scope.row)">客服</label>
				</template>
			</el-table-column> -->
			<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
				<template slot-scope="scope">

					<el-button size="small" type="danger"  @click="handleDelete(scope.row)"
						v-hasPermi="['system:shop:remove']">删除
					</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="open" :title="title" :visible.sync="open" append-to-body width="1000px">
			<div style="height: 500px;padding: 10px;overflow: auto">
				<el-form ref="form" :model="form" :rules="rules" label-width="120px">
					<el-row>
						<el-col :span="24">
							<el-form-item label="店铺类型" prop="shopType">
								<el-radio-group v-model="form.shopType">
									<el-radio label="1">公司</el-radio>
									<el-radio label="0">个人</el-radio>
								</el-radio-group>
							</el-form-item>
						</el-col>
					</el-row>


					<el-row>
						<el-col :span="24">
							<el-form-item label="归属部门" prop="deptId">
								<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true"
									placeholder="请选择归属部门" />
							</el-form-item>
						</el-col>
					</el-row>





					<el-row>
						<el-col :span="12">
							<el-form-item label="店铺名称" prop="name">
								<el-input v-model="form.name" placeholder="请输入店铺名称" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="店铺编号" prop="name">
								<el-input v-model="form.code" placeholder="请输入店铺编号" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="收号客服" prop="customerService">
								<el-input v-model="form.customerService" placeholder="请输入收号客服" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="收号来源" prop="gameAccountSource">
								<el-input v-model="form.gameAccountSource" placeholder="请输入收号来源" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="联系电话" prop="phone">
								<el-input v-model="form.phone" placeholder="请输入联系电话" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="认证类型" prop="certificationType">
								<el-select v-model="form.certificationType" placeholder="请选择认证类型" style="width: 100%">
									<el-option v-for="dict in dict.type.certification_type" :key="dict.value"
										:label="dict.label" :value="dict.value"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="12">
							<el-form-item label="认证状态" prop="certificationStatus">
								<el-select v-model="form.certificationStatus" placeholder="请选择认证状态" style="width: 100%">
									<el-option v-for="dict in dict.type.certification_status" :key="dict.value"
										:label="dict.label" :value="dict.value"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="主营行业" prop="mainIndustry">
								<el-select v-model="form.mainIndustry" placeholder="请选择主营行业" style="width: 100%">
									<el-option v-for="dict in dict.type.account_source" :key="dict.value"
										:label="dict.label" :value="dict.value"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="12">
							<el-form-item label="店铺状态" prop="shopStatus">
								<el-select v-model="form.shopStatus" placeholder="请选择店铺状态" style="width: 100%">
									<el-option v-for="dict in dict.type.shop_status" :key="dict.value"
										:label="dict.label" :value="dict.value"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="到期时间" prop="endTime">
								<el-date-picker v-model="form.endTime" clearable placeholder="请选择到期时间"
									style="width: 100%" type="date" value-format="yyyy-MM-dd">
								</el-date-picker>
							</el-form-item>
						</el-col>
					</el-row>

					<el-row>
						<el-col :span="12">
							<el-form-item label="店铺关键字" prop="shopKeyword">
								<el-input v-model="form.shopKeyword" placeholder="请输入店铺关键字" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="收款人姓名" prop="payeeName">
								<el-input v-model="form.payeeName" placeholder="请输入收款人姓名" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="收款账号" prop="payeeAccount">
								<el-input v-model="form.payeeAccount" placeholder="请输入收款账号" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="账号名称" prop="payeeAccountName">
								<el-input v-model="form.payeeAccountName" placeholder="如微信、支付宝、某某银行" />
							</el-form-item>
						</el-col>

						<el-col :span="12">
							<el-form-item label="费率" prop="goodsRate">
								<el-input v-model="form.goodsRate" placeholder="请输入费率" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="店铺排序" prop="sort">
								<el-input v-model="form.sort" placeholder="请输入排序" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="同步数据" prop="synchronizeExternal">
								<el-select v-model="form.synchronizeExternal" multiple collapse-tags
									placeholder="请选择合作方">
									<el-option v-for="dict in dict.type.notice_partner" :key="dict.value"
										:label="dict.label" :value="dict.value" />
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="同步游戏" prop="openGame">
								<el-select v-model="form.openGame" multiple collapse-tags placeholder="请选择游戏">
									<el-option v-for="(item,index) in gameList" :key="item.id" :label="item.gameName"
										:value="item.id"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="属性模式" prop="attributeInvert">
								<el-select v-model="form.attributeInvert" collapse-tags placeholder="请选择模式">
									<el-option v-for="item in options6" :key="item.value" :label="item.label"
										:value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="是否启用号库" prop="warehouse">
								<el-select v-model="form.warehouse" collapse-tags placeholder="请选择是否启用号库">
									<el-option v-for="item in options7" :key="item.value" :label="item.label"
										:value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
					</el-row>

					<el-row>
						<el-col :span="8">
							<el-form-item label="店铺logo" label-width="120px">
								<image-upload-sign v-model="form.shopLog" :pictureServerPath="pictureServerPath"
									:showPic="form.shopLog"></image-upload-sign>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="店铺头像" label-width="120px" prop="shopPortrait">
								<image-upload-sign v-model="form.shopPortrait" :pictureServerPath="pictureServerPath"
									:showPic="form.shopPortrait"></image-upload-sign>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="店铺大图" label-width="120px" prop="shopBigpicture">
								<image-upload-sign v-model="form.shopBigpicture" :pictureServerPath="pictureServerPath"
									:showPic="form.shopBigpicture"></image-upload-sign>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="24">
							<el-form-item label="店铺简介">
								<editor v-model="form.shopContent" :min-height="192" />
							</el-form-item>
						</el-col>
					</el-row>
				</el-form>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitForm">确 定</el-button>
				<!-- <el-button type="primary" @click="submitForm">确 定</el-button> -->
				<el-button @click="cancel">取 消</el-button>
			</div>
		</el-dialog>
		<!-- 统计弹出框 -->
		<el-dialog v-if="open1" title="统计" :visible.sync="open1" append-to-body width="800px">
			<div class="tj">
				<div style="display: flex;justify-content: space-around;font-size: 20px;margin-bottom: 20px;">
					<P>游戏总数：<span style="color: red;">{{allNumber}}</span></P>
					<p>游戏总金额：<span style="color: red;">{{allPrice}}</span></p>
				</div>
				<el-form @submit.native.prevent ref="tj" style="display: flex;justify-content: space-around;">

					<el-form-item label="店铺名称" prop="gameName">

						<el-input style="width: 300px;" v-model="queryParams1.channelNumber" placeholder="请输入店铺名称"
							clearable />



					</el-form-item>
					<el-form-item label="部门名称" prop="gameName">


						<treeselect style="width: 300px;" v-model="queryParams1.deptId" :options="deptOptions1"
							:show-count="true" placeholder="请选择部门" />


					</el-form-item>
					<el-form-item label="状态" prop="goodsStatus">
						<el-select v-model="queryParams1.goodsStatus" style="width: 200px;" clearable
							placeholder="请选择上架状态">
							<el-option style="text-align: center;" v-for="item in options" :key="item.value"
								:label="item.label" :value="item.value">
							</el-option>
						</el-select>
					</el-form-item>

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





				<el-table :data="tableData" style="width: 100%">
					<el-table-column prop="gameName" label="游戏名称" width="250">
					</el-table-column>
					<el-table-column prop="gameNumber" label="游戏数量" width="250">
					</el-table-column>
					<el-table-column prop="totalGamePrice" label="游戏总价">
					</el-table-column>
				</el-table>

			</div>
		</el-dialog>


	</div>
</template>

<script>
	import {
		getInitGoodsManager,
	} from "@/api/data/goods";
	import {
		addShop,
		delShop,
		getShop,
		listShop,
		getStatisticalData,
		updateShop,
		getDep
	} from "@/api/data/shop";
	import {
		getConfigKey
	} from "@/api/system/config";
	import {
		deptTreeSelect
	} from '@/api/system/user'
	import Treeselect from "@riophae/vue-treeselect";
	import "@riophae/vue-treeselect/dist/vue-treeselect.css";
	// import { forEach } from "core-js/library/core/dict";
	export default {
		name: "Shop",
		dicts: ['main_industry', 'shop_status', 'certification_status', 'certification_type', "account_source",
			"notice_partner"
		],
		components: {
			Treeselect
		},
		props: {
			ImageUpload: Function,
			value: [String, Object, Array],
			// 图片数量限制
			limit: {
				type: Number,
				default: 5,
			},
			// 大小限制(MB)
			fileSize: {
				type: Number,
				default: 10,
			},
			// 文件类型, 例如['png', 'jpg', 'jpeg']
			fileType: {
				type: Array,
				default: () => ["png", "jpg", "jpeg"],
			},
			// 是否显示提示
			isShowTip: {
				type: Boolean,
				default: true
			}
		},
		data() {
			return {
				options6: [{
					value: 'A',
					label: '模式一（标题反选属性）'
				}, {
					value: 'B',
					label: '模式二（属性生成标题）'
				}],
				options7: [{
					value: 'Y',
					label: '是'
				}, {
					value: 'N',
					label: '否'
				}],
				gameList: [],
				// 游戏总数
				allNumber: 0,
				// 价格总数
				allPrice: 0,
				open1: false,
				isShowComp: true,
				isShowPerson: false,
				pictureServerPath: null,
				// 遮罩层
				loading: true,
				// 部门树选项
				deptOptions: undefined,
				deptOptions1: undefined,
				// 选中数组
				ids: [],
				names: [],
				// 非单个禁用
				single: true,
				// 非多个禁用
				multiple: true,
				// 显示搜索条件
				showSearch: true,
				// 总条数
				total: 0,
				// 店铺信息表格数据
				shopList: [],
				// 弹出层标题
				title: "",
				// 是否显示弹出层
				open: false,
				// 查询参数
				queryParams: {
					pageNum: 1,
					pageSize: 10,
					gameName: null,
					name: null,
					certificationType: null,
					certificationStatus: null,
					mainIndustry: null,
					shopStatus: null,
					endTime: null,
					shopLog: null,
					shopPortrait: null,
					shopBigpicture: null,
					shopContent: null,
					shopKeyword: null,
					deptId: null,
					deptName: null,
					connName: null,
					connPhone: null,
					shopPhone: null,
					qq: null,
					alww: null,
					email: null,
					workday: null,
					busTime: null,
					busTimeStart: null,
					busTimeEnd: null,
					selfLifting: null,
					addressProvinceId: null,
					addressProvinceName: null,
					addressCityId: null,
					addressCityName: null,
					addressDistrictId: null,
					addressDistrictName: null,
					address: null,
					longitude: null,
					latitude: null,
					userId: null,
					identifiedCode: null,
					identifiedZ: null,
					identifiedF: null
				},
				options: [{
					value: 'goods_status_0',
					label: '未出售'
				}, {
					value: 'goods_status_3',
					label: '已出售'
				}],
				// //统计商家名称
				options2: [{

					value: 'zy',
					label: '官方自营',
					children: [{
							value: '',
							label: ''
						},
						{
							value: '',
							label: ''
						}
					]

				}, {

					value: 'sj',
					label: '商家账号',
					children: [{
							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: '聚幻游'
						},
					]

				}],
				// 统计查询
				queryParams1: {
					channelNumber: '',
					goodsStatus: 'goods_status_0',
				},


				// 表单参数
				form: {
					shopType: '1',
					dialogImageUrl: ''
				},
				tableData: [],
				// 表单校验
				rules: {}
			};
		},
		created() {
			this.getServierPicture();
			this.getList();
			this.getDeptTree();
		},
		methods: {
			initGoodsManager() {
				getInitGoodsManager().then(res => {
					this.gameList = res.gameList
				})
			},

			/**跳转*/
			toOtherPage(p, row) {
				let b = "/guanli/"
				this.$router.push({
					path: b + p,
					query: {
						shopId: row.id,
						accountSource: row.mainIndustry,
						openGame: row.openGame,
						attributeInvert: row.attributeInvert,
						warehouse: row.warehouse,
						sort: row.sort,
					}
				})
			},
			/**跳转*/
			toOtherPage1(p) {
				let b = "/guanli/"
				this.$router.push({
					path: b + p,
				})
			},
			getServierPicture() {
				let that = this
				getConfigKey('pictureServerPath').then(res => {
					that.pictureServerPath = res.msg
				})
			},

			/** 查询部门下拉树结构 */
			getDeptTree() {
				deptTreeSelect().then(response => {
					this.deptOptions = response.data;
				});
			},
			/** 查询店铺信息列表 */
			getList() {
				this.loading = true;
				listShop(this.queryParams).then(response => {
					this.shopList = response.rows;
					this.total = response.total;
					this.loading = false;
				});
			},
			// 取消按钮
			cancel() {
				this.open = false;
				this.reset();
			},
			// 表单重置
			reset() {
				this.form = {
					shopType: '1',
					id: null,
					name: null,
					certificationType: null,
					certificationStatus: null,
					mainIndustry: null,
					shopStatus: null,
					endTime: null,
					shopLog: null,
					shopPortrait: null,
					shopBigpicture: null,
					shopContent: null,
					shopKeyword: null,
					deptId: null,
					deptName: null,
					connName: null,
					connPhone: null,
					shopPhone: null,
					qq: null,
					alww: null,
					email: null,
					workday: null,
					busTime: null,
					busTimeStart: null,
					busTimeEnd: null,
					selfLifting: null,
					addressProvinceId: null,
					addressProvinceName: null,
					addressCityId: null,
					addressCityName: null,
					addressDistrictId: null,
					addressDistrictName: null,
					address: null,
					longitude: null,
					latitude: null,
					userId: null,
					identifiedCode: null,
					identifiedZ: null,
					identifiedF: null,
					channelNumber: ''
				};
				this.resetForm("form");
			},
			/** 搜索按钮操作 */
			handleQuery() {
				this.queryParams.pageNum = 1;
				this.getList();
			},
			handleQuery1() {
				let data = decodeURIComponent(this.queryParams1.channelNumber)
				let query = {
					goodsStatus: this.queryParams1.goodsStatus,
					deptId: this.queryParams1.deptId,
					channelNumber: data
				}
				getStatisticalData(query).then(res => {
					console.log(res)
					this.tableData = res.data
					var a = 0
					var b = 0
					res.data.forEach((num) => {
						a = a + Number(num.gameNumber)
						b = b + Number(num.totalGamePrice)
					})
					this.allNumber = a;
					this.allPrice = b;
				})
			},
			/** 重置按钮操作 */
			resetQuery() {
				this.resetForm("queryForm");
				this.resetForm("tj");
				this.handleQuery();
				this.handleQuery1();
			},
			resetQuery1() {
				this.resetForm("tj");
				this.handleQuery1();
			},
			// 多选框选中数据
			handleSelectionChange(selection) {
				this.ids = selection.map(item => item.id)
				this.names = selection.map(item => item.name)
				this.single = selection.length !== 1
				this.multiple = !selection.length
			},
			/** 新增按钮操作 */
			handleAdd() {
				this.reset();
				this.open = true;
				this.title = "添加店铺信息";
				this.initGoodsManager();
			},
			/** 统计按钮操作 */
			all() {
				this.open1 = true;
				deptTreeSelect().then(response => {
					console.log(response)
					this.deptOptions1 = response.data[0].children.slice(0, 2);
				});
			},

			shopServers(row) {
				this.$router.push({
					path: '/system/shopServers',
					query: {
						deptId: row.deptId
					}
				})
			},

			/** 修改按钮操作 */
			handleUpdate(row) {
				this.reset();
				const id = row.id || this.ids
				getShop(id).then(response => {
					this.form = response.data;
					if (response.data.synchronizeExternal != null) {
						this.form.synchronizeExternal = response.data.synchronizeExternal.split(',');
					}
					if (response.data.openGame != null) {
						this.form.openGame = response.data.openGame.split(',');
					}
					this.open = true;
					this.title = "修改店铺信息";
				});
				this.initGoodsManager();
			},
			/** 提交按钮 */
			submitForm() {
				this.$refs["form"].validate(valid => {
					if (valid) {
						this.form.synchronizeExternal = this.form.synchronizeExternal.join();
						this.form.openGame = this.form.openGame.join();
						if (this.form.id != null) {
							updateShop(this.form).then(response => {
								this.$modal.msgSuccess("修改成功");
								this.open = false;
								this.getList();
							});
						} else {
							addShop(this.form).then(response => {
								this.$modal.msgSuccess("新增成功");
								this.open = false;
								this.getList();
							});
						}
					}
				});
			},

			/** 删除按钮操作 */
			handleDelete(row) {
				const ids = row.id || this.ids;
				const names = row.name || this.names
				this.$modal.confirm('是否确认删除店铺["' + names + '"]的数据项？').then(function() {
					return delShop(ids);
				}).then(() => {
					this.getList();
					this.$modal.msgSuccess("删除成功");
				}).catch(() => {});
			},
			/** 导出按钮操作 */
			handleExport() {
				this.download('system/shop/export', {
					...this.queryParams
				}, `shop_${new Date().getTime()}.xlsx`)
			}
		}
	};
</script>