<template>
	<!--  基础设置-->
	<Container>
		<ContainerTit>
			<div slot="headr">
				<el-button type="primary" @click="setSubmit">提交</el-button>
			</div>
			<div class="detail-tab-item" style="padding: 20px">
				<div v-if="page_tabs !== '5'" class="page-tip-div" style="margin: 0">
					<i class="el-icon-info"></i>
					温馨提示：基本设置重新提交后，其他账户需重新选择企业进入后，设置方能生效
				</div>
				<div v-else class="page-tip-div" style="margin: 0">
					<i class="el-icon-info"></i>
					温馨提示：小票打印机使用的是佳博打印机，下面有打印机的购买链接和使用帮助，也可自行淘宝购买打印机
				</div>
				<el-tabs v-model="page_tabs" type="card">
					<el-tab-pane label="商城设置" name="1"></el-tab-pane>
					<el-tab-pane label="交易设置" name="2"></el-tab-pane>
					<el-tab-pane label="商品设置" name="3"></el-tab-pane>
					<el-tab-pane label="客户设置" name="4"></el-tab-pane>
					<el-tab-pane label="打印机设置" name="5"></el-tab-pane>
					<el-tab-pane label="库存设置" name="6"></el-tab-pane>
					<el-tab-pane label="钉钉设置" name="7"></el-tab-pane>
					<el-tab-pane label="奖励分红设置" name="8"></el-tab-pane>
				</el-tabs>
				<el-form ref="basicData" style="padding-top: 10px" :model="basicData" :rules="rules" size="small"
					label-width="180px">
					<div v-if="page_tabs === '1'" class="desc-div">
						<!--          v-if="activeName === 'BaseSet'"-->
						<div>
							<el-form-item label="商城LOGO：" prop="images">
								<UploadQiniu :limit="1" :file-list="img_list" @uploadSuccess="uploadSuccess"
									@handleRemove="uploadRemove" />
							</el-form-item>
							<el-form-item prop="shop" label="商城：">
								<el-input v-model="basicData.shop" style="width: 350px" placeholder="商城"></el-input>
							</el-form-item>
							<el-form-item prop="description" label="商城简介：">
								<el-input v-model="basicData.description" style="width: 350px" placeholder="请输入商城简介">
								</el-input>
							</el-form-item>
							<el-form-item prop="phone" label="客服电话：">
								<el-input v-model="basicData.phone" style="width: 350px" placeholder="请输入客服电话">
								</el-input>
							</el-form-item>
							<el-form-item prop="company" label="公司名字：">
								<el-input v-model="basicData.company" style="width: 350px" placeholder="请输入公司名字">
								</el-input>
							</el-form-item>
							<el-form-item prop="region" label="公司地址：">
								<span>
									<RegionSelect v-model="basicData.region" size="small" style="width: 350px"
										@change="regionChange" />
								</span>
							</el-form-item>
							<el-form-item prop="address" label="详细地址：">
								<el-input v-model="basicData.address" style="width: 350px" placeholder="请输入公司详细地址">
								</el-input>
							</el-form-item>
						</div>
					</div>
					<div v-if="page_tabs === '2'" class="desc-div">
						<!--          v-if="activeName === 'TradeSet'"-->
						<div>
							<!--              订单自动审核-->
							<div v-if="false">
								<el-form-item label="微信支付：">
									<el-switch v-model="autoAuditOrder.wxPay" active-color="#36B365"
										inactive-color="#ff4949" :active-value="5" :inactive-value="4" active-text="启用"
										inactive-text="禁用"></el-switch>
									<p class="form-tip">
										开启后：该种支付方式的订单支持自动审核下推到销售出库单
									</p>
								</el-form-item>
								<el-form-item label="支付宝支付：">
									<el-switch v-model="autoAuditOrder.aliPay" active-color="#36B365"
										inactive-color="#ff4949" :active-value="5" :inactive-value="4" active-text="启用"
										inactive-text="禁用"></el-switch>
									<p class="form-tip">
										开启后：该种支付方式的订单支持自动审核下推到销售出库单
									</p>
								</el-form-item>
								<el-form-item label="货到付款：">
									<el-switch v-model="autoAuditOrder.cashPay" active-color="#36B365"
										inactive-color="#ff4949" :active-value="5" :inactive-value="4" active-text="启用"
										inactive-text="禁用"></el-switch>
									<p class="form-tip">
										开启后：该种支付方式的订单支持自动审核下推到销售出库单
									</p>
								</el-form-item>
							</div>
							<el-form-item prop="address" label="订单打印标示展示：">
								<el-radio-group v-model="basicData.printTag">
									<el-radio :label="5">展示</el-radio>
									<el-radio :label="4">不展示</el-radio>
								</el-radio-group>
							</el-form-item>
							<el-form-item label="自动取消订单：">
								<el-input-number v-model="orderAutoCloseSec" :controls="false"></el-input-number>
								<span style="padding-left: 10px">小时</span>
								<p class="form-tip">
									货到付款的订单下单后未审核，{{
                    orderAutoCloseSec || "未设置"
                  }}小时内会自动取消
								</p>
							</el-form-item>
							<el-form-item label="自动收货订单：">
								<el-input-number v-model="orderAutoFinishSec" :controls="false"></el-input-number>
								<span style="padding-left: 10px">小时</span>
								<p class="form-tip">
									订单出库后用户未确认收货，{{
                    orderAutoFinishSec || "未设置"
                  }}小时内会自动收货
								</p>
							</el-form-item>
							<el-form-item prop="returnWay" label="退款金额返回方式:">
								<el-radio-group v-model="basicData.returnWay">
									<el-radio :label="5">原路返回</el-radio>
									<el-radio :label="4">退回余额</el-radio>
								</el-radio-group>
							</el-form-item>
							<el-form-item prop="cancelOrder" label="取消订单节点:">
								<el-radio-group v-model="basicData.cancelOrder">
									<el-radio :label="5">启用</el-radio>
									<el-radio :label="4">禁用</el-radio>
								</el-radio-group>
								<p class="form-tip">
									开启：订单在出库前客户可以点击取消订单按钮；
									<br />
									禁用：只有待审核的订单客户才能操作取消订单按钮；
								</p>
							</el-form-item>
							<el-form-item prop="cancelOrderAudit" label="取消订单审核:">
								<el-radio-group v-model="basicData.cancelOrderAudit">
									<el-radio :label="5">启用</el-radio>
									<el-radio :label="4">禁用</el-radio>
								</el-radio-group>
								<p class="form-tip">
									开启：客户取消订单需要系统进行审核
									<br />
									禁用：客户可直接进行取消订单，不需要系统审核
								</p>
							</el-form-item>
						</div>
					</div>
					<div v-if="page_tabs === '3'" class="desc-div">
						<!--          v-if="activeName === 'GoodsSet'"-->
						<div>
							<el-form-item prop="phone" label="起订价：">
								<el-input-number v-model="basicData.startDeliveryPrice" :controls="false">
								</el-input-number>
								<p class="form-tip">
									当订单总额低于设置价格时，商城APP&微信小程序不允许客户提交创建订单，单位：元
								</p>
							</el-form-item>

							<el-form-item prop="phone" label="配送：">
								订单满
								<el-input-number v-model="basicData.freeExpressPrice" :controls="false">
								</el-input-number>
								元包邮
								<p class="form-tip">
									当订单总额大于等于设置价格时，订单可进行包邮，单位：元
								</p>
							</el-form-item>
							<el-form-item prop="phone" label="运费规则：">
								<el-radio-group v-model="basicData.calculateExpressType">
									<el-radio :label="4">累加运费</el-radio>
									<el-radio :label="5">组合运费</el-radio>
								</el-radio-group>
								<el-tooltip placement="right">
									<div slot="content">
										累加运费:所有商品运费合计金额,作为整单运费金额
										<br />
										组合运费:取订单中运费最高的商品运费,作为整单运费金额
									</div>
									<i style="
                      position: absolute;
                      top: 30%;
                      left: 200px;
                      color: rgb(192, 197, 207);
                    " class="el-icon-question"></i>
								</el-tooltip>
							</el-form-item>
							<el-form-item prop="phone" label="商品市场价：">
								<el-input-number v-model="basicData.salePriceTimes" :controls="false"></el-input-number>
								倍销售价
							</el-form-item>

							<el-form-item prop="phone" label="商品价格：">
								<el-radio-group v-model="basicData.goodsPrice">
									<el-radio :label="5">允许游客查看</el-radio>
									<el-radio :label="4">不允许游客查看</el-radio>
								</el-radio-group>
							</el-form-item>
							<el-form-item prop="phone" label="库存展示：">
								<el-radio-group v-model="basicData.stockDisplay">
									<el-radio :label="4">不显示库存</el-radio>
									<el-radio :label="5">显示有/无货</el-radio>
									<el-radio :label="6">显示库存数量</el-radio>
								</el-radio-group>
							</el-form-item>
							<!--              <el-form-item prop="phone" label="是否支持负库存销售：">-->
							<!--                <el-switch-->
							<!--                  v-model="basicData.preSale"-->
							<!--                  active-color="#36B365"-->
							<!--                  inactive-color="#ff4949"-->
							<!--                  :active-value="5"-->
							<!--                  :inactive-value="4"-->
							<!--                  active-text="启用"-->
							<!--                  inactive-text="禁用"-->
							<!--                  @change="changePre"-->
							<!--                ></el-switch>-->
							<!--              </el-form-item>-->
							<el-form-item prop="phone" label="限购级别：">
								<el-radio-group v-model="basicData.limitLevel">
									<el-radio :label="5">单笔限购</el-radio>
									<el-radio :label="4">活动时间范围限购</el-radio>
								</el-radio-group>
								<p class="form-tip">活动商品用户购买数量</p>
							</el-form-item>
							<el-form-item prop="phone" label="销量展示：">
								<el-radio-group v-model="basicData.isSalesNum">
									<el-radio :label="4">不显示销量</el-radio>
									<el-radio :label="5">显示销量</el-radio>
								</el-radio-group>
							</el-form-item>
							<el-form-item v-if="false" prop="phone" label="退货设置：">
								订单完成
								<el-input v-model="basicData.allowReturnDay" size="small" style="width: 50px"
									placeholder="请输入允许退货天数"></el-input>
								天后不会允许退货
							</el-form-item>

							<!--              <el-form-item prop="phone" label="库存预警：">-->
							<!--                商品低于-->
							<!--                <el-input-number-->
							<!--                  v-model="basicData.goodsNum"-->
							<!--                  :controls="false"-->
							<!--                  size="small"-->
							<!--                  style="width: 100px"-->
							<!--                  placeholder=""-->
							<!--                ></el-input-number>-->
							<!--                时请通知我-->
							<!--                <p class="form-tip">-->
							<!--                  当库存数量不足时，库存预警能够帮助店铺及时处理库存商品-->
							<!--                </p>-->
							<!--              </el-form-item>-->
							<!--              <el-form-item-->
							<!--                prop="phone"-->
							<!--                label="自动上下架："-->
							<!--              >-->
							<!--                <el-switch-->
							<!--                  v-model="basicData.autoRemoveGoods"-->
							<!--                  active-color="#36B365"-->
							<!--                  inactive-color="#ff4949"-->
							<!--                  :active-value="5"-->
							<!--                  :inactive-value="4"-->
							<!--                  active-text="启用"-->
							<!--                  inactive-text="禁用"-->
							<!--                >-->
							<!--                </el-switch>-->
							<!--                <p class="form-tip">-->
							<!--                  开启后，商品库存为空后，自动下架该商品，否则反之-->
							<!--                </p>-->
							<!--              </el-form-item>-->
							<!--              <el-form-item prop="phone" label="开启保质期：">-->
							<!--                <el-switch-->
							<!--                  v-model="basicData.shelfLifeSetUp"-->
							<!--                  active-color="#36B365"-->
							<!--                  inactive-color="#ff4949"-->
							<!--                  :active-value="5"-->
							<!--                  :inactive-value="4"-->
							<!--                  active-text="启用"-->
							<!--                  inactive-text="禁用"-->
							<!--                ></el-switch>-->
							<!--                <p class="form-tip">-->
							<!--                  开启后，商品基础资料必填保质期,入库单必填批次生产日期,菜单展示保质期查询，否则反之-->
							<!--                </p>-->
							<!--              </el-form-item>-->
							<el-form-item prop="phone" label="搜索推荐设置：">
								<el-tag v-for="(tag, index) in basicData.recommend" :key="index" closable
									:disable-transitions="false" @close="handleClose(index)">
									{{ tag.name }}
								</el-tag>
								<el-input v-if="inputVisible" ref="saveTagInput" v-model="tagVal" class="input-new-tag"
									size="small" @keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm">
								</el-input>
								<el-button v-else class="button-new-tag" size="small" @click="showInput">
									+ 新增
								</el-button>
							</el-form-item>
						</div>
					</div>
					<div v-if="page_tabs === '4'" class="desc-div">
						<!--          v-if="activeName === 'CustomerSet'"-->
						<div>
							<el-form-item prop="personnelReview" label="客户审核：">
								<el-switch v-model="basicData.personnelReview" active-color="#36B365"
									inactive-color="#ff4949" :active-value="5" :inactive-value="4" active-text="启用"
									inactive-text="禁用"></el-switch>
								<p class="form-tip">
									开启后：必须审核过后才可以进行下单购买；禁用后:客户注册成功即代表审核通过
								</p>
							</el-form-item>
							<el-form-item prop="personnelReview" label="完善资料：">
								<el-switch v-model="basicData.finishData" active-color="#36B365"
									inactive-color="#ff4949" :active-value="5" :inactive-value="4" active-text="启用"
									inactive-text="禁用"></el-switch>
								<p>
									<el-checkbox v-model="basicData.finishDataGo">
										立即去完善
									</el-checkbox>
								</p>
								<p class="form-tip">
									开启后：客户在小程序授权完成登陆以后必须完善资料才可以进行使用
								</p>
							</el-form-item>
							<el-form-item label="资料内容:">
								<el-checkbox-group v-model="basicData.customerData" @change="customerDataChange">
									<el-checkbox v-for="(item, index) in customer_data_list" :key="index" :label="item"
										:disabled="item === '真实姓名'">
										{{ item }}
									</el-checkbox>
								</el-checkbox-group>
							</el-form-item>
						</div>
					</div>
					<div v-if="page_tabs === '5'" class="desc-div">
						<el-form-item prop="memberCode" label="商户编码：">
							<el-input v-model="basicData.memberCode" style="width: 350px" placeholder="请输入商户编码">
							</el-input>
						</el-form-item>
						<el-form-item prop="deviceID" label="终端编号：">
							<el-input v-model="basicData.deviceID" style="width: 350px" placeholder="请输入终端编号">
							</el-input>
						</el-form-item>
						<el-form-item prop="apiKey" label="商户秘钥：">
							<el-input v-model="basicData.apiKey" style="width: 350px" placeholder="请输入商户秘钥"></el-input>
						</el-form-item>
						<el-form-item label="打印机帮助：">
							<a href="https://www.kancloud.cn/qianniaoyunshang/houtaishiyongliucheng/1806010"
								target="_blank">
								https://www.kancloud.cn/qianniaoyunshang/houtaishiyongliucheng/1806010
							</a>
						</el-form-item>
						<el-form-item label="打印机购买：">
							<a href="https://item.jd.com/62582739647.html" target="_blank">
								https://item.jd.com/62582739647.html
							</a>
						</el-form-item>
					</div>
					<div v-if="page_tabs === '6'" class="desc-div">
						<el-form-item prop="phone" label="是否开启库区库位：">
							<el-switch v-model="basicData.enableLocationManagement" active-color="#36B365"
								inactive-color="#ff4949" :active-value="5" :inactive-value="4" active-text="启用"
								inactive-text="禁用"></el-switch>
						</el-form-item>
						<el-form-item prop="phone" label="库存预警：">
							商品低于
							<el-input-number v-model="basicData.goodsNum" :controls="false" size="small"
								style="width: 100px" placeholder=""></el-input-number>
							时请通知我
							<p class="form-tip">
								当库存数量不足时，库存预警能够帮助店铺及时处理库存商品
							</p>
						</el-form-item>
						<el-form-item prop="phone" label="开启保质期：">
							<el-switch v-model="basicData.shelfLifeSetUp" active-color="#36B365"
								inactive-color="#ff4949" :active-value="5" :inactive-value="4" active-text="启用"
								inactive-text="禁用"></el-switch>
							<p class="form-tip">
								开启后，商品基础资料必填保质期,入库单必填批次生产日期,菜单展示保质期查询，否则反之
							</p>
						</el-form-item>
						<!--            <el-form-item prop="phone" label="是否允许负库存出库：">-->
						<!--              <el-switch-->
						<!--                v-model="basicData.distributionExamine"-->
						<!--                active-color="#36B365"-->
						<!--                inactive-color="#ff4949"-->
						<!--                :active-value="5"-->
						<!--                :inactive-value="4"-->
						<!--                active-text="启用"-->
						<!--                inactive-text="禁用"-->
						<!--              ></el-switch>-->
						<!--            </el-form-item>-->
					</div>
					<div v-if="page_tabs === '7'" class="desc-div">
						<el-form-item prop="appkey" label="appkey：">
							<el-input v-model="basicData.appKey" style="width: 350px" placeholder="请输入钉钉appKey">
							</el-input>
						</el-form-item>
						<el-form-item prop="appSecret" label="appSecret：">
							<el-input v-model="basicData.appSecret" style="width: 350px" placeholder="请输入钉钉appSecret">
							</el-input>
						</el-form-item>
						<el-form-item prop="corpid" label="corpid：">
							<el-input v-model="basicData.corpid" style="width: 350px" placeholder="请输入钉钉corpid"></el-input>
						</el-form-item>
						<el-form-item prop="ssoSecred" label="ssoSecred：">
							<el-input v-model="basicData.ssoSecred" style="width: 350px" placeholder="请输入钉钉ssoSecred"></el-input>
						</el-form-item>
					</div>
					<div v-if="page_tabs === '8'" class="desc-div">
						<el-form-item prop="original_bonus" label="原始分红：">
							<el-input v-model="basicData.original_bonus" style="width: 350px" placeholder="设置为利润的百分比"></el-input>
						</el-form-item>
						<el-form-item prop="bonus" label="分红股分红：">
							<el-input v-model="basicData.bonus" style="width: 350px" placeholder="设置为利润的百分比"></el-input>
						</el-form-item>
						<el-form-item prop="attendance" label="全勤奖：">
							<el-input v-model="basicData.attendance" style="width: 350px" placeholder="员工全勤奖励固定金额人民币"></el-input>
						</el-form-item>
						<el-form-item prop="recommen_registerd" label="推荐注册奖励：">
							<el-input v-model="basicData.recommen_registerd" style="width: 350px" placeholder="固定金额人民币"></el-input>
						</el-form-item>
						<el-form-item prop="shopowner" label="店长分红比例：">
							<el-input v-model="basicData.shopowner" style="width: 350px" placeholder="设置为利润的百分比"></el-input>
						</el-form-item>
						<el-form-item prop="stock_exchange" label="员工股份兑换比例：">
							<el-input v-model="basicData.stock_exchange" style="width: 350px" placeholder="1股份可以兑换多少人民币"></el-input>
						</el-form-item>
						<el-form-item prop="shareholder_extension" label="股东推广奖励比例：">
							<el-input v-model="basicData.shareholder_extension" style="width: 350px" placeholder="设置为利润的百分比"></el-input>
						</el-form-item>
						<el-form-item prop="customer_extension" label="客户推广奖励比例：">
							<el-input v-model="basicData.customer_extension" style="width: 350px" placeholder="设置为利润的百分比"></el-input>
						</el-form-item>
					</div>
				</el-form>
			</div>
		</ContainerTit>
	</Container>
</template>

<script>
	import RegionSelect from "@/component/common/RegionSelectJSON";
	import {
		mapActions
	} from "vuex";
	import UploadQiniu from "../../../component/common/UploadQiniu";
	import {
		getBasicSetup,
		setting
	} from "@/api/System";
	export default {
		name: "BaseSetAdd",
		components: {
			RegionSelect,
			UploadQiniu,
		},
		data() {
			return {
				customer_data_list: [
					"真实姓名",
					"电话",
					"地址",
					"客户类型",
					"营业执照",
					"备注",
				],
				activeName: "",
				img_list: [], // 上传公司照片
				rules: {},
				inputVisible: false,
				tagVal: "",
				autoAuditOrder: {
					wxPay: 4,
					aliPay: 4,
					cashPay: 4,
				},
				orderAutoCloseSec: "",
				orderAutoFinishSec: "",
				basicData: {
					orderAutoCloseSec: "",
					isSalesNum: 5,
					orderAutoFinishSec: "",
					startDeliveryPrice: 0, // 起送价
					calculateExpressType: 5, // 运费规则 4累加 5组合
					freeExpressPrice: 0, // 包邮价
					goodsNum: "", // 库存警告
					images: [],
					salePriceTimes: 1.2,
					stockDisplay: 4,
					goodsPrice: 5,
					printTag: 4, // 订单打印标示是否展示 4不展示 ，5 展示
					returnWay: 5, //退款金额返回方式 5原路返回 ，4退回余额
					cancelOrder: 5, // 取消订单 5启用，4禁用
					cancelOrderAudit: 4, // 取消订单审核 5启用，4禁用
					allowReturnDay: 0, // 设置天数
					personnelReview: 4, // 客户审核 4禁用 5启用
					finishData: 4, // 完善资料 4禁用 5启用
					customerData: [
						"真实姓名",
						"电话",
						"地址",
						"客户类型",
						"营业执照",
						"备注",
					], // 自定义完善资料
					autoRemoveGoods: 4,
					shop: "",
					description: "",
					phone: "",
					company: "",
					region: [],
					address: "",
					shelfLifeSetUp: 4,
					enableLocationManagement: 4,
					preSale: 4,
					recommend: [],
					memberCode: "",
					deviceID: "",
					apiKey: "",
					limitLevel: 4,
					// distributionExamine: 4,
					finishDataGo: false, // 完善资料登录后立即去完善
					"appKey":"",//钉钉appkey
					"appSecret":"",//钉钉appSecret
					"corpid":"",//钉钉corpid
					"ssoSecred":"",//钉钉ssoSecred
					"original_bonus": '', //原始分红
					"bonus" : '',//分红股份分红
					"attendance": '',//全勤奖
					"recommen_registerd":'',//推荐注册奖励
					"shopowner" : '',//店长分红比列
					"stock_exchange": '',//员工股份兑换比列
					"commission":'',//提成比列
					"shareholder_extension":'',//股东推广奖励比列
					"customer_extension" : '',//客户推广奖励比列
				},
				page_tabs: "1",
			};
		},
		async created() {
			await this.getBasicSetup();
			this.activeName = this.$route.name;
		},
		activated() {
			if (this.$_isInit()) return;
			this.activeName = this.$route.name;
			this.getBasicSetup();
		},
		methods: {
			...mapActions({
				changeShelfLifeSetUp: "MUser/changeShelfLifeSetUp",
				changeEnableLocationManagement: "MUser/changeEnableLocationManagement",
				changePrintTag: "MUser/changePrintTag",
				changeSalePriceTimes: "MUser/changeSalePriceTimes",
				changeBaseSetting: "MUser/changeBaseSetting",
			}),
			changePre(val) {
				if (val === 5) {
					this.basicData.stockDisplay = 4;
				}
			},
			// 打开收银台
			openUrl(url) {
				let routeData = this.$router.resolve({
					path: url,
				});
				window.open(routeData.href, "_blank");
			},
			// 添加照片
			uploadSuccess(val, res, file, fileList) {
				this.basicData.images = val;
			},
			uploadRemove(file, fileList) {
				this.basicData.images = "";
			}, // 移出照片
			handleClose(index) {
				this.basicData.recommend.splice(index, 1);
			},
			showInput() {
				this.inputVisible = true;
				this.$nextTick(() => {
					this.$refs.saveTagInput.$refs.input.focus();
				});
			},

			handleInputConfirm() {
				let inputValue = this.tagVal;
				if (inputValue) {
					this.basicData.recommend.push({
						name: inputValue
					});
				}
				this.inputVisible = false;
				this.tagVal = "";
			},
			//  获取详情
			async getBasicSetup() {
				const {
					data
				} = await getBasicSetup();

				this.basicData = {
					...this.basicData,
					...data.basicData
				};
				this.autoAuditOrder = {
					...this.autoAuditOrder,
					...this.basicData.autoAuditOrder,
				};
				this.orderAutoFinishSec = data.basicData.orderAutoFinishSec ?
					this.$NP.divide(data.basicData.orderAutoFinishSec, 3600) :
					"";
				this.orderAutoCloseSec = data.basicData.orderAutoCloseSec ?
					this.$NP.divide(data.basicData.orderAutoCloseSec, 3600) :
					"";
				if (this.basicData.images) {
					this.img_list = [{
						name: "",
						url: this.basicData.images,
					}, ];
				} else {
					this.img_list = [];
				}
				this.changePrintTag(this.basicData.printTag || 4);
				this.changeSalePriceTimes(this.basicData.salePriceTimes || 1.2);
			},
			//  提交
			async setSubmit() {
				const orderAutoFinishSec = this.$NP.times(
					this.orderAutoFinishSec,
					3600
				);
				const orderAutoCloseSec = this.$NP.times(this.orderAutoCloseSec, 3600);

				this.basicData = {
					...this.basicData,
					autoAuditOrder: this.autoAuditOrder,
					orderAutoCloseSec: orderAutoCloseSec,
					orderAutoFinishSec: orderAutoFinishSec,
				};
				const data = await setting({
					basicData: this.basicData,
				});

				this.$message({
					message: "提交成功，基本设置重新提交后，其他账户需重新选择企业进入后，设置方能生效",
					type: "success",
				});
				this.changeShelfLifeSetUp(this.basicData.shelfLifeSetUp);
				this.changeEnableLocationManagement(
					this.basicData.enableLocationManagement
				);
				this.changeBaseSetting(this.basicData);
				await this.getBasicSetup();
			},
			regionChange(row) {
				this.basicData.region = row;
			},
			// 自定义客户资料
			customerDataChange() {},
		},
	};
</script>

<style scoped>
	.button-new-tag {
		margin-left: 10px;
		height: 32px;
		line-height: 30px;
		padding-top: 0;
		padding-bottom: 0;
	}

	.input-new-tag {
		width: 90px;
		margin-left: 10px;
		vertical-align: bottom;
	}

	.index-view {
		display: inline-block;
		font-size: 12px;
		width: 20px;
		height: 20px;
		line-height: 20px;
		border: 1px solid #ddd;
		border-radius: 100%;
		text-align: center;
		margin-right: 10px;
		color: #666;
	}

	.desc-div {
		font-size: 12px;
		padding: 10px 20px;
		line-height: 32px;
		color: #666666;
	}
</style>
