<template>
  <div class="create-shop-wrapper">
    <bread-crumb
      :curmbFirst="curmbFirst"
      :curmbSecond="curmbSecond"
      :curmbThird="curmbThird"
      :jumPathThird="jumPathThird"
    ></bread-crumb>
    <div class="create-shop-content screenSet" id="screenSet">
      <el-row class="step-content">
        <el-col :span="20">
          <p class="title">{{ title }}</p>
        </el-col>
        <el-col :span="4" style="text-align: right">
          <el-button size="small" type="primary" @click="complete"
            >完成</el-button
          >
        </el-col>
      </el-row>
      <el-form
        ref="formData3"
        :model="formData3"
        :rules="rules3"
        label-width="150px"
        label-suffix="："
        class="basic-form"
      >
        <!-- 通用信息 -->
        <div class="basic-item-icon">
          <div class="part-tit">通用信息</div>
          <el-form-item label="商品名称" prop="goodsName">
            <el-col :span="13">
              <el-input
                size="small"
                v-model="formData3.goodsName"
                placeholder="请输入商品名称"
                show-word-limit
                maxlength="60"
              ></el-input>
              <!-- <span class="word-num">{{(formData.goodsName).replace(/\s+/g,"").length}}/60</span> -->
            </el-col>
          </el-form-item>

          <el-form-item label="商品介绍" prop="goodsDescription">
            <el-col :span="13">
              <el-input
                type="textarea"
                rows="4"
                size="small"
                v-model="formData3.goodsDescription"
                placeholder="请输入商品介绍"
                maxlength="40"
                show-word-limit
              ></el-input>
              <span class="word-tip"
                >此文案可摘取药品说明书【功能主治】or【适应症】</span
              >
            </el-col>
          </el-form-item>

          <el-form-item label="商品头图" class="required-label">
            <el-upload
              :file-list="fileGoodsList"
              class="bg-uploader"
              :show-file-list="isShowFileList"
              action="#"
              :before-upload="beforeUploadPic"
              multiple
              :on-exceed="imgExceed"
              :limit="6"
            >
              <template v-for="(item, index) in fileGoodsList">
                <div v-if="fileGoodsList.length > 0" class="file-pics">
                  <img
                    :src="item.url"
                    @mouseover.stop="headIndex = index"
                    class="bg-img"
                  />

                  <div
                    class="img-delete"
                    v-if="headIndex == index"
                    @click.stop="deleteImg(item, fileGoodsList)"
                    @mouseout.stop="headIndex = -1"
                  >
                    <el-icon><el-icon-delete /></el-icon>
                  </div>
                </div>
              </template>
              <img
                class="bg-img"
                src="../../assets/image/small.png"
                v-if="fileGoodsList.length < 6"
              />
              <div class="limit-text" v-if="fileGoodsList.length < 6">
                <!-- <p>限制大小: 200kb</p> -->
                <p>建议尺寸：750*750</p>
                <p>支持jpeg, png格式</p>
              </div>
            </el-upload>
            <p class="upload-message" v-if="!isgoodsImages">请上传商品头图</p>
            <!-- <p class="upload-message" v-if="uploadImgMessage1">请上传商品头图</p> -->
          </el-form-item>

          <el-form-item label="商品介绍视频" class="label-video">
            <el-upload
              accept=".mp4"
              :on-remove="handleRemoveVideo"
              :file-list="videoList"
              :before-upload="beforeVideoUpload"
              :show-file-list="false"
              :disabled="videoList.length == 1"
              :limit="1"
              action="#"
              class="bg-uploader"
            >
              <video
                id="introVideoLecture"
                :src="videoModel.videoFullPath"
                controls
                preload
                style="width: 100%"
                v-if="videoList.length == 1"
              >
                视频
              </video>
              <img
                class="bg-img"
                src="../../assets/image/video.png"
                v-if="videoList.length < 1"
              />
              <div class="limit-text" v-if="videoList.length < 1">
                <p>建议大小：20M以内</p>
                <p>仅支持MP4格式</p>
                <P>视频名称必须包含3个下划线：举例（YQ_01_02_03.mp4)</P>
              </div>
            </el-upload>

            <el-progress
              :text-inside="true"
              :stroke-width="16"
              :percentage="uploadProgress"
              status="success"
              class="video-progress"
              v-show="uploadProgress > 0 && uploadProgress < 100"
            >
            </el-progress>
            <el-button
              class="dl-video"
              :icon="ElIconDelete"
              circle
              @click="deleteVideo"
              v-if="videoList.length == 1"
            ></el-button>
          </el-form-item>
          <!-- <el-form-item label="业务类型" prop="businessCategoryId">
                    <el-select
                        v-model="formData3.businessCategoryId"
                        placeholder="请选择业务类型"
                        size="small"
                       >
                      <el-option
                          v-for="item in businessCategoryList"
                          :key="item.id"
                          :label="item.categoryName"
                          :value="item.id"
                      ></el-option>
                    </el-select>
                  </el-form-item> -->
          <el-form-item label="商品类型" prop="goodsType">
            <el-select
              v-model="formData3.goodsType"
              placeholder="请选择商品类型"
              size="small"
              :disabled="isEdit"
              @change="getGoodsTypes(formData3.goodsType, 2)"
            >
              <el-option
                v-for="(item, index) in oneLever"
                :key="item.categoryName + '-' + index"
                :label="item.categoryName"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <!-- 新增项目合同名称 -->
          <el-form-item
            label="项目-合同名称"
            prop="cooperationProjectId"
            class="project-req"
          >
            <el-select
              v-model="formData3.cooperationProjectId"
              placeholder="请选择"
              size="small"
              :disabled="isEdit && isProject"
              @change="getContract"
              @clear="projectClear"
              clearable
              filterable
            >
              <el-option
                v-for="(item, index) in cooperationProjectList"
                :key="item.projectName + '-' + index"
                :label="item.projectName"
                :value="item.cooperationProjectId"
              ></el-option>
            </el-select>
            <el-select
              v-model="formData3.contractId"
              placeholder="请选择"
              size="small"
              clearable
              :disabled="isEdit && isContract"
            >
              <el-option
                v-for="(item, index) in contractList"
                :key="item.contractName + '-' + index"
                :label="item.contractName"
                :value="item.contractId"
              ></el-option>
            </el-select>
            <div class="project-tip">未找到项目名称请联系产品经理添加</div>
          </el-form-item>

          <el-form-item
            label="是否支持售后"
            prop="expressLimitFlag"
            v-if="storeType < 3"
          >
            <el-radio-group
              v-model="formData3.expressLimitFlag"
              :disabled="!hasRepoFlag"
            >
              <el-radio :label="1">是</el-radio>
              <el-radio :label="0">否</el-radio>
            </el-radio-group>
            <p class="backTip" v-if="!hasRepoFlag" @click="goShopDeatil">
              若需设置商品支持售后，需先至店铺页<span class="ad-back"
                >设置售后地址</span
              >
            </p>
          </el-form-item>
        </div>
      </el-form>

      <!-- 基本信息 -->
      <el-form
        ref="formData1"
        :model="formData1"
        :rules="rules1"
        label-width="150px"
        label-suffix="："
        class="basic-form"
      >
        <div class="basic-item-icon" v-if="!isCheckServe && !showTcm">
          <div class="part-tit">基本信息</div>
          <el-form-item label="条形码" prop="barCode">
            <el-col :span="18">
              <el-input
                :disabled="barAndGoodsFlag || idMedicEdit"
                size="small"
                v-model="formData1.barCode"
                placeholder="请输入条形码"
                @input="changeBarCode"
              ></el-input>
              <span class="fast-opt" @click="fastInput(1)">快速录入</span>
              <span class="word-num">(点击可快速录入下面的基本信息)</span>
            </el-col>
          </el-form-item>
          <el-form-item label="批准文号" prop="approvalNumber">
            <el-col :span="18">
              <el-input
                size="small"
                v-model="formData1.approvalNumber"
                :disabled="idMedicEdit"
                placeholder="请输入批准文号"
                style="width: 50%"
              ></el-input>
            </el-col>
          </el-form-item>

          <el-form-item label="通用名称" prop="medicCommonName">
            <el-col :span="13">
              <el-input
                :disabled="goodDisabled || barAndGoodsFlag || idMedicEdit"
                size="small"
                v-model="formData1.medicCommonName"
                placeholder="请输入通用名称"
                style="width: 70%"
                maxlength="60"
                show-word-limit
              ></el-input>

              <!-- <span class="word-num">{{(formData.medicCommonName).replace(/\s+/g,"").length}}/60</span> -->
            </el-col>
          </el-form-item>
          <el-form-item label="商品名称" prop="medicGoodsName">
            <el-col :span="13">
              <el-input
                size="small"
                v-model="formData1.medicGoodsName"
                placeholder="请输入商品名称"
                :disabled="idMedicEdit"
                maxlength="60"
                show-word-limit
              ></el-input>

              <!-- <span class="word-num">{{(formData.medicGoodsName).replace(/\s+/g,"").length}}/60</span> -->
            </el-col>
          </el-form-item>
          <el-form-item label="规格" prop="size">
            <el-col :span="13">
              <el-input
                size="small"
                v-model="formData1.size"
                placeholder="请输入规格"
                :disabled="idMedicEdit"
                style="width: 70%"
              ></el-input>

              <span class="word-num">例如:0.125g*12袋/盒</span>
            </el-col>
          </el-form-item>
          <div class="inline">
            <el-form-item label="是否是处方药" prop="otc1">
              <el-col :span="24">
                <el-radio size="mini" v-model="formData1.otc1" label="1"
                  >处方药</el-radio
                >
                <el-radio v-model="formData1.otc1" label="0">非处方药</el-radio>
              </el-col>
            </el-form-item>
            <el-form-item label="剂型" prop="dosageId">
              <el-select
                v-model="formData1.dosageId"
                placeholder="请选择药品剂型"
                size="small"
                :disabled="idMedicEdit"
                clearable
              >
                <el-option
                  v-for="(item, index) in doseAll"
                  :key="index"
                  :label="item.dosageName"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </div>
          <el-form-item label="用法用量" prop="usage">
            <el-col :span="13">
              <el-input
                size="small"
                v-model="formData1.usage"
                placeholder="请输入用法用量"
                style="width: 70%"
                :disabled="idMedicEdit"
              ></el-input>

              <span class="word-num">例如:每次一袋 每天1-2次</span>
            </el-col>
          </el-form-item>

          <!-- <el-form-item label="药品类型" prop="categoryIdLevel2">
                    <el-select
                        v-model="formData1.categoryIdLevel2"
                        placeholder="请选择药品类型"
                        size="small"
                        @change="getLever(formData1.categoryIdLevel2,3)"
                        clearable
                    >
                      <el-option
                          v-for="(item,index) in twoLever"
                          :key="item.id"
                          :label="item.categoryName"
                          :value="item.id"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                  <div class="inline">
                    <el-form-item label="一级类目" prop="categoryIdLevel3" >
                      <el-select
                          v-model="formData1.categoryIdLevel3"
                          placeholder="请选择一级类目"
                          size="small"
                          @change="getLever(formData1.categoryIdLevel3,4)"
                      >
                        <el-option
                            v-for="(item,index) in threeLever"
                            :key="index"
                            :label="item.categoryName"
                            :value="item.id"
                        ></el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="二级类目" prop="categoryIdLevel4" >
                      <el-select
                          v-model="formData1.categoryIdLevel4"
                          placeholder="请选择二级类目"
                          size="small"
                          @change="getLever(formData1.categoryIdLevel4,5)"
                      >
                       <el-option
                           v-for="(item,index) in fourLever"
                           :key="index"
                           :label="item.categoryName"
                           :value="item.id"
                       ></el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="三级级类目" prop="categoryIdLevel5">
                      <el-select
                          v-model="formData1.categoryIdLevel5"
                          placeholder="请选择三级类目"
                          size="small"
                      >
                        <el-option
                            v-for="(item,index) in fiveLever"
                            :key="index"
                            :label="item.categoryName"
                            :value="item.id"
                        ></el-option>
                      </el-select>
                    </el-form-item>
                  </div> -->
          <el-form-item label="生产厂家" prop="manufacturer">
            <el-col :span="13">
              <el-input
                size="small"
                v-model="formData1.manufacturer"
                placeholder="请输入生产厂家"
                style="width: 70%"
                :disabled="idMedicEdit"
              ></el-input>

              <span class="word-num"></span>
            </el-col>
          </el-form-item>
          <div class="inline">
            <el-form-item label="适用科室" prop="department">
              <el-input
                size="small"
                v-model="formData1.department"
                placeholder="请输入适用科室"
                :disabled="idMedicEdit"
              ></el-input>
              <!-- <el-select
                          v-model="formData.department"
                          placeholder="请选择适用科室"
                          size="small"
                          clearable
                      >
                        <el-option
                            v-for="(item,index) in allDeparts"
                            :key="index"
                            :label="item.name"
                            :value="item.id"
                        ></el-option>
                      </el-select> -->
            </el-form-item>
            <el-form-item label="治疗疾病" prop="treatDisease">
              <el-col :span="24">
                <el-input
                  size="small"
                  v-model="formData1.treatDisease"
                  placeholder="请输入治疗疾病"
                  :disabled="idMedicEdit"
                ></el-input>

                <span class="word-num"></span>
              </el-col>
            </el-form-item>
          </div>

          <el-form-item label="有效期" prop="expiredTime">
            <el-col :span="13">
              <el-input
                size="small"
                v-model="formData1.expiredTime"
                placeholder="请输入有效期"
                style="width: 70%"
                :disabled="idMedicEdit"
              ></el-input>
              <!-- <el-date-picker
                        v-model="formData.expiredTime"
                        size="small"
                        format="yyyy-MM-dd HH:mm:ss"
                        type="date"
                        placeholder="选择日期">
                      </el-date-picker> -->

              <span class="word-num"></span>
            </el-col>
          </el-form-item>

          <el-form-item label="型号" prop="modelNo">
            <el-col :span="13">
              <el-input
                size="small"
                v-model="formData1.modelNo"
                placeholder="请输入型号"
                style="width: 70%"
                :disabled="idMedicEdit"
              ></el-input>
              <span class="word-num"></span>
            </el-col>
          </el-form-item>
          <el-form-item label="执行标准号" prop="standardNo">
            <el-col :span="13">
              <el-input
                size="small"
                v-model="formData1.standardNo"
                placeholder="请输入执行标准号"
                style="width: 70%"
                :disabled="idMedicEdit"
              ></el-input>
              <span class="word-num"></span>
            </el-col>
          </el-form-item>

          <el-form-item label="说明书">
            <el-upload
              class="bg-uploader"
              action="#"
              :show-file-list="false"
              :before-upload="beforeUploadPic1"
            >
              <div v-if="fileIntrList.length > 0">
                <template v-for="(item, index) in fileIntrList">
                  <div v-if="item.url" class="file-pics">
                    <img
                      :src="item.url"
                      @mouseover.stop="intrIndex = index"
                      class="bg-img"
                    />

                    <div
                      class="img-delete"
                      v-if="intrIndex == index"
                      @click.stop="deleteImg(item, fileIntrList)"
                      @mouseout.stop="intrIndex = -1"
                    >
                      <el-icon><el-icon-delete /></el-icon>
                    </div>
                  </div>
                </template>
              </div>

              <img class="bg-img" src="../../assets/image/small.png" />
              <div class="limit-text">
                <p>限制大小: 2M</p>
                <!-- <p>最小尺寸：750*420</p> -->
                <p>支持jpeg, png格式</p>
              </div>
            </el-upload>
            <p class="upload-message" v-if="!isSpecification_url">
              请上传说明书
            </p>
          </el-form-item>
        </div>
        <div class="basic-item-icon" v-show="showTcm">
          <div class="part-tit">基本信息</div>
          <el-form-item
            label="适用项目"
            prop="useProject"
            class="required-label"
          >
            <el-col :span="13">
              <el-input
                :disabled="goodDisabled || barAndGoodsFlag || idMedicEdit"
                size="small"
                v-model="formData1.useProject"
                placeholder="请输入适用项目"
                style="width: 70%"
                maxlength="40"
                show-word-limit
              ></el-input>
            </el-col>
          </el-form-item>
          <div class="inline">
            <el-form-item
              label="适用科室"
              prop="department"
              class="required-label"
            >
              <el-input
                size="small"
                v-model="formData1.department"
                placeholder="请输入适用科室"
                :disabled="idMedicEdit"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="治疗疾病"
              prop="treatDisease"
              class="required-label"
            >
              <el-col :span="24">
                <el-input
                  size="small"
                  v-model="formData1.treatDisease"
                  placeholder="请输入治疗疾病"
                  :disabled="idMedicEdit"
                ></el-input>

                <span class="word-num"></span>
              </el-col>
            </el-form-item>
          </div>
          <el-form-item
            label="商品使用时间"
            prop="rangeTime"
            class="required-label"
          >
            <el-col :span="8">
              <el-date-picker
                v-model="rangeTime"
                type="daterange"
                value-format="yyyy-MM-dd"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :disabled="idMedicEdit"
              >
              </el-date-picker>
            </el-col>
          </el-form-item>

          <el-form-item label="说明书">
            <el-upload
              class="bg-uploader"
              action="#"
              :show-file-list="false"
              :before-upload="beforeUploadPic1"
            >
              <div v-if="fileIntrList.length > 0">
                <template v-for="(item, index) in fileIntrList">
                  <div v-if="item.url" class="file-pics">
                    <img
                      :src="item.url"
                      @mouseover.stop="intrIndex = index"
                      class="bg-img"
                    />

                    <div
                      class="img-delete"
                      v-if="intrIndex == index"
                      @click.stop="deleteImg(item, fileIntrList)"
                      @mouseout.stop="intrIndex = -1"
                    >
                      <el-icon><el-icon-delete /></el-icon>
                    </div>
                  </div>
                </template>
              </div>

              <img class="bg-img" src="../../assets/image/small.png" />
              <div class="limit-text">
                <p>限制大小: 2M</p>
                <!-- <p>最小尺寸：750*420</p> -->
                <p>支持jpeg, png格式</p>
              </div>
            </el-upload>
            <p class="upload-message" v-if="!isSpecification_url">
              请上传说明书
            </p>
          </el-form-item>
        </div>
      </el-form>
      <!-- =========================================================调试新增检测服务 start=========================================================
      =========================================================调试新增检测服务 start=========================================================
      =========================================================调试新增检测服务 start========================================================= -->

      <!-- 服务信息 -->
      <el-form
        ref="formData2"
        :model="formData2"
        :rules="rules2"
        label-width="150px"
        label-suffix="："
        class="basic-form"
      >
        <div
          class="basic-item-icon"
          v-show="!isMedic && isCheckServe && !showTcm"
        >
          <div class="part-tit">服务信息</div>
          <el-form-item label="条形码" prop="barCode">
            <el-col :span="18">
              <el-input
                size="small"
                v-model="formData2.barCode"
                placeholder="请输入条形码"
              ></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="检测登记表" prop="checkPackageId">
            <el-select
              v-model="formData2.checkPackageId"
              placeholder="请选择"
              :disabled="isEdit"
              size="small"
            >
              <el-option
                v-for="(item, index) in checkPackageIdList"
                :key="index"
                :label="item.name"
                :value="item.content"
              ></el-option>
              <!-- <el-option label="其他" value="0">其他</el-option> -->
            </el-select>
          </el-form-item>
          <el-form-item label="检测名称" prop="checkName">
            <el-col :span="13">
              <el-input
                size="small"
                v-model="formData2.checkName"
                placeholder="请输入检测名称"
                show-word-limit
                maxlength="60"
              ></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="医疗机构名称" prop="hospitalName">
            <el-col :span="13">
              <el-input
                size="small"
                v-model="formData2.hospitalName"
                placeholder="请输入医疗机构名称"
                show-word-limit
              ></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="医疗机构类型" prop="hospitalType">
            <el-select
              v-model="formData2.hospitalType"
              placeholder="请选择"
              size="small"
            >
              <el-option
                v-for="(item, index) in hospitalTypeList"
                :key="index"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="检测项目" prop="checkItem">
            <el-col :span="13">
              <el-input
                type="textarea"
                rows="4"
                size="small"
                v-model="formData2.checkItem"
                placeholder="请输入检测项目"
                maxlength="400"
                show-word-limit
              ></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="检测指标" prop="checkStandard">
            <el-col :span="13">
              <el-input
                type="textarea"
                rows="4"
                size="small"
                v-model="formData2.checkStandard"
                placeholder="请输入检测指标"
                maxlength="400"
                show-word-limit
              ></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="使用人数" prop="useCount" class="required-label">
            <el-col :span="20">
              <div class="stock-com">
                <span
                  class="sp sp-l"
                  @click="formData2.useCount > 0 ? formData2.useCount-- : ''"
                  :class="{ opac: formData2.useCount == 0 }"
                  ><el-icon><el-icon-minus /></el-icon
                ></span>
                <span class="sp sp-c">
                  <el-input
                    type="number"
                    rows="4"
                    size="small"
                    v-model="formData2.useCount"
                    placeholder="请输入使用人数"
                  ></el-input>
                  <!-- <input style="text-align:center;width:100%;height:100%;border:none;outline:none;" v-model="formData.useCount" type="text" placeholder="0"> -->
                </span>
                <span class="sp sp-r" @click="formData2.useCount++"
                  ><el-icon><el-icon-plus /></el-icon
                ></span>
              </div>
              <!-- <p class="error-message" v-if="formData.useCount<=0">使用人数必须大于0</p> -->
            </el-col>
          </el-form-item>
          <el-form-item label="检测类型" prop="checkType">
            <el-select
              v-model="formData2.checkType"
              placeholder="请选择"
              size="small"
            >
              <el-option
                v-for="(item, index) in checkTypeList"
                :key="index"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="适用人群" prop="suitableArr">
            <el-select
              v-model="formData2.suitableArr"
              :multiple="true"
              placeholder="请选择"
              class="suitableList-select"
            >
              <el-option
                v-for="(item, index) in suitableList"
                :key="item + '_' + index"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="附加服务" prop="accessorialService">
            <el-col :span="13">
              <el-input
                type="textarea"
                rows="4"
                size="small"
                v-model="formData2.accessorialService"
                placeholder="请输入附加服务"
                maxlength="400"
                show-word-limit
              ></el-input>
            </el-col>
          </el-form-item>

          <el-form-item
            label="商品使用日期"
            prop="endTime"
            class="required-label"
          >
            <el-date-picker
              v-model="formData2.endTime"
              size="small"
              type="datetime"
              placeholder="请选择商品使用日期"
              value-format="yyyy-MM-dd HH:mm:ss.SSS"
              format="yyyy-MM-dd HH:mm:ss"
            ></el-date-picker>
          </el-form-item>
          <el-form-item label="检测说明">
            <el-upload
              :file-list="goodsCheckList"
              class="bg-uploader"
              :show-file-list="isShowFileList"
              action="#"
              :before-upload="beforeUploadPic2"
            >
              <div
                class="file-pics"
                :key="index"
                v-for="(item, index) in goodsCheckList"
              >
                <img
                  :src="item.url"
                  @mouseover.stop="headIndex = index"
                  class="bg-img"
                />
                <div
                  class="img-delete"
                  v-if="headIndex == index"
                  @click.stop="deleteImg(item, goodsCheckList)"
                  @mouseout.stop="headIndex = -1"
                >
                  <el-icon><el-icon-delete /></el-icon>
                </div>
              </div>
              <img
                class="bg-img"
                src="../../assets/image/small.png"
                v-if="goodsCheckList.length < 10"
              />
              <div class="limit-text">
                <p>尺寸：686 * 高度不变</p>
                <p>支持jpeg, png格式</p>
              </div>
            </el-upload>
            <p class="upload-message" v-if="!isgoodsImages">请上传检测说明图</p>
          </el-form-item>
        </div>
      </el-form>

      <!-- =========================================================调试新增检测服务 start=========================================================
      =========================================================调试新增检测服务 start=========================================================
      =========================================================调试新增检测服务 start========================================================= -->

      <!-- 销售信息 -->
      <el-form
        ref="formData"
        :model="formData"
        :rules="rules"
        label-width="150px"
        label-suffix="："
        class="basic-form"
      >
        <div class="basic-item-icon">
          <div class="part-tit">销售信息</div>
          <div class="inline">
            <el-form-item label="销售方式" prop="saleType">
              <el-radio-group v-model="formData.saleType" size="small">
                <el-radio :label="1">零售</el-radio>
                <el-radio :label="2" :disabled="commissionFlag == 1"
                  >批发</el-radio
                >
              </el-radio-group>
            </el-form-item>
          </div>

          <div class="inline" v-if="formData.saleType == 1">
            <el-form-item label="零售价" prop="optPrice">
              <el-col :span="20">
                <el-input-number
                  class="stock-com"
                  @input="$forceUpdate()"
                  v-model="formData.optPrice"
                  size="small"
                  :precision="2"
                  :min="0.0"
                  :max="99999.99"
                ></el-input-number>
              </el-col>
            </el-form-item>
          </div>
          <div class="inline" v-if="formData.saleType == 2">
            <el-form-item label="批发价" prop="optPrice">
              <el-col :span="20">
                <el-input-number
                  class="stock-com"
                  @input="$forceUpdate()"
                  v-model="formData.optPrice"
                  size="small"
                  :precision="2"
                  :min="0"
                  :max="20000000.0"
                ></el-input-number>
              </el-col>
            </el-form-item>
          </div>
          <div class="inline" v-if="formData.saleType == 1">
            <el-form-item label="绩效分值">
              <el-col :span="20">
                <el-input-number
                  class="stock-com"
                  @input="$forceUpdate()"
                  v-model="formData.scorePerformance"
                  size="small"
                  :precision="2"
                  :min="0.0"
                  :max="999999.99"
                ></el-input-number>
              </el-col>
            </el-form-item>
          </div>
          <div class="inline">
            <el-form-item label="库存" prop="stock" class="required-label">
              <el-col :span="20">
                <div class="stock-com">
                  <span
                    class="sp sp-l"
                    @click="changeStock(1)"
                    :class="{ opac: formData.stock == 0 }"
                    ><el-icon><el-icon-minus /></el-icon
                  ></span>
                  <span class="sp sp-c">{{ formData.stock }}</span>
                  <span class="sp sp-r" @click="changeStock(2)"
                    ><el-icon><el-icon-plus /></el-icon
                  ></span>
                </div>
                <p class="error-message" v-if="!isgoodStock">库存不能为0</p>
              </el-col>
            </el-form-item>
          </div>

          <div class="inline" v-if="formData.saleType == 1">
            <el-form-item
              label="最小起购件数"
              prop="leastCount"
              class="required-label"
            >
              <el-col :span="20">
                <div class="stock-com" style="width: 500px; display: flex">
                  <el-input-number
                    class="stock-com"
                    @input="$forceUpdate()"
                    v-model="formData.leastCount"
                    size="small"
                    :precision="0"
                    :min="0"
                    :max="9999"
                  ></el-input-number>
                  <span class="word-num" style="margin-left: 10px"
                    >最高9999件哦</span
                  >
                </div>
                <p class="error-message" v-if="formData.leastCount <= 0">
                  最小起购件数不能为0
                </p>
              </el-col>
            </el-form-item>
          </div>

          <div
            class="inline"
            v-if="formData.saleType == 1 && formData.leastCount > 1"
          >
            <el-form-item label="递增方式">
              <el-col :span="24">
                <el-radio size="mini" v-model="formData.incrType" :label="2"
                  >倍数递增</el-radio
                >
                <el-radio v-model="formData.incrType" :label="1"
                  >1件递增</el-radio
                >
              </el-col>
            </el-form-item>
          </div>

          <div class="inline" v-if="formData.saleType == 1">
            <el-form-item
              label="单次购买上限"
              prop="mostCount"
              class="required-label"
            >
              <el-col :span="20" style="width: 300%">
                <div class="stock-com" style="width: 500px; display: flex">
                  <el-input-number
                    class="stock-com"
                    @input="$forceUpdate()"
                    v-model="formData.mostCount"
                    size="small"
                    :precision="0"
                    :min="-1"
                    :max="9999"
                  ></el-input-number>
                  <span class="word-num" style="margin-left: 10px"
                    >数值为-1时，代表单次购买上限已无限制(最高9999件哦)</span
                  >
                </div>
                <p class="error-message" v-if="formData.mostCount === 0">
                  单次购买上限不能为0
                </p>
              </el-col>
            </el-form-item>
          </div>
          <div class="inline" v-if="formData.saleType == 1">
            <el-form-item label="第三方商品编码">
              <el-col :span="20">
                <el-input
                  size="small"
                  v-model="formData.externalGoodsCode"
                  placeholder="请输入第三方商品编码"
                ></el-input>
              </el-col>
            </el-form-item>
          </div>

          <div class="inline" v-if="formData.saleType == 2">
            <el-form-item
              label="最小起批"
              prop="minWhole"
              class="required-label"
            >
              <el-col :span="20">
                <div class="stock-com" style="width: 500px; display: flex">
                  <el-input-number
                    class="stock-com"
                    @input="$forceUpdate()"
                    v-model="formData.minWhole"
                    size="small"
                    :precision="0"
                    :min="1"
                  ></el-input-number>
                </div>
                <p class="error-message" v-if="formData.minWhole <= 0">
                  最小起批不能为0
                </p>
              </el-col>
            </el-form-item>
          </div>
        </div>
        <div class="basic-item-icon" v-if="formData.saleType == 1">
          <div class="part-tit">限购条件</div>
          <div v-for="(item, index) in buyLimitDtoList" :key="index">
            <el-form-item label="限制条件">
              <el-button @click="delLimit(index)" type="text" size="small"
                >删除</el-button
              >
            </el-form-item>
            <el-form-item label="限制对象">
              <el-col :span="10">
                <el-radio-group
                  v-model="item.limitUserType"
                  size="small"
                  @change="changeLimitUserType(item, index)"
                >
                  <el-radio :label="1">开单人</el-radio>
                  <el-radio :label="2">患者</el-radio>
                </el-radio-group>
              </el-col>
            </el-form-item>
            <el-form-item label="购买限制">
              <el-input-number
                v-model="item.days"
                style="margin-left: 5px"
                size="small"
                :precision="0"
                :min="1"
                :max="100000"
              ></el-input-number>
              <el-select v-model="item.daysType" size="small">
                <el-option
                  v-for="(item, index) in daysTypeList"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
              <span style="margin-left: 5px">内，最多购买</span>
              <el-input-number
                v-model="item.limitCount"
                style="margin-left: 5px"
                size="small"
                :precision="0"
                :min="1"
                :max="100000"
              ></el-input-number>
              <span style="margin-left: 5px">次</span>
            </el-form-item>
          </div>
          <div class="inline">
            <el-form-item>
              <el-button size="small" type="primary" @click="addBuyingLimit"
                ><el-icon><el-icon-plus /></el-icon>限购条件</el-button
              >
            </el-form-item>
          </div>
        </div>
      </el-form>

      <el-dialog :title="stock.title" v-model="stockDio" width="30%" center>
        <div class="stock-dia">
          <div class="stock-item">更新库存后，将影响买家购买，请谨慎操作</div>
          <div class="stock-item">当前库存：{{ formData.goodsStock }}</div>
          <div class="demo-input-suffix">
            {{ stock.type == 1 ? '减少数量' : '增加数量' }}：
            <el-input
              v-model="stock.num"
              :placeholder="stock.placeholderTxt"
              maxLength="8"
              style="width: 180px"
            ></el-input>
          </div>
        </div>
        <template v-slot:footer>
          <span class="dialog-footer" style="text-align: right">
            <el-button type="primary" @click="updateStock">完成</el-button>
          </span>
        </template>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import {
  Delete as ElIconDelete,
  Minus as ElIconMinus,
  Plus as ElIconPlus,
} from '@element-plus/icons'
import BreadCrumb from '@/components/breadcrumb.vue'
let vm = null
import { openLoading, closeLoading, signFigures } from '../../utils/utils'
import { isEmptyUtils } from '@/utils/index'
import { doUpload, getFilePath, createFilePath } from '../../utils/qiniu-util'
import {
  updateGoods,
  updateStock,
  dosageAll,
  getDeparts,
  getGoodsList,
  getGoodDetails,
  updateGoodsV2,
  getHospitalInfoByStoreId,
  getCheckPackageIdList,
  getTypeCodeList,
  getContractList,
  getCooperationProjectList,
} from '@/utils/goods'
import { getStoreAdressRepot } from '@/utils/shop'
import Cropper from '@/components/common/cropper.vue'
import { originRules1, originRules2, originRules, originRules3 } from './rules'
import { originForm1, originForm2, originForm, originForm3 } from './forms'

export default {
  data() {
    return {
      // 编辑时商品名称和条形码是否可以编辑
      barAndGoodsFlag: false,
      // 商品通用名称是否可编辑
      goodDisabled: false,
      isEdit: false,
      stock: {
        title: '减少库存',
        type: 1,
        placeholderTxt: '请输入减少的库存数量',
        num: '',
      },
      doseAll: [],
      fileGoodsList: [],
      goodsCheckList: [],
      fileIntrList: [],
      intrIndex: -1,
      isShowFileList: false,
      isgoodStock: true,
      headIndex: -1,
      oneLever: [],
      twoLever: [],
      allDeparts: [],
      threeLever: [
        {
          categoryName: '其他',
          id: -1,
        },
      ],
      fourLever: [
        {
          categoryName: '其他',
          id: -1,
        },
      ],
      fiveLever: [
        {
          categoryName: '其他',
          id: -1,
        },
      ],
      stockDio: false,
      curmbFirst: '云鹊店铺',
      curmbSecond: '商品管理',
      // /live-manage?id=
      curmbThird: '编辑商品',
      jumPathThird: '',
      isgoodsImages: true,
      isSpecification_url: true,
      title: '',
      typeList: [
        {
          label: '药品',
          value: '1',
        },
        {
          label: '药品器械',
          value: '2',
        },
        {
          label: '其他',
          value: '3',
        },
      ],
      daysTypeList: [
        {
          label: '日',
          value: 1,
        },
        {
          label: '周',
          value: 7,
        },
        {
          label: '月',
          value: 30,
        },
        {
          label: '年',
          value: 365,
        },
      ],
      saleTypeList: [
        {
          value: 1,
          label: '零售',
        },
        {
          value: 2,
          label: '批发',
        },
      ],
      checkPackageIdList: [{ name: '其他', content: 0 }],
      // 医疗机构类型
      hospitalTypeList: [
        { label: '村卫生室', value: 1 },
        { label: '乡镇卫生院/中心', value: 2 },
      ],
      // 检测类型
      checkTypeList: [{ label: '常规检测', value: 1 }],
      // suitableList: [{label:'儿童',value:'1'},{label:'青年',value:'2'},{label:'中年',value:'4'},{label:'老年',value:'8'},{label:'40-74岁的结直肠癌高风险人群',value:'10'}], // 适用人群
      suitableList: [],
      // 不同类型服务的表单通用字段
      // 不同类型服务的表单通用字段
      // 不同类型服务的表单通用字段
      // 通用信息
      formData: JSON.parse(JSON.stringify(originForm)),
      // 基本信息
      formData1: JSON.parse(JSON.stringify(originForm1)),
      formData2: JSON.parse(JSON.stringify(originForm2)),
      formData3: JSON.parse(JSON.stringify(originForm3)),
      buyLimitDtoList: [],
      rules: {},
      rules1: {},
      rules2: {},
      // 新增时传0，更新时必需>0
      goodsId: 0,
      goodsType: '',
      storeId: '',
      commissionFlag: 2,
      // 不同类型服务的表单通用字段
      // 不同类型服务的表单通用字段
      // 不同类型服务的表单通用字段
      showCropper: false,
      currentOption: {
        offset_x: 120,
        offset_y: 185,
        width: 160,
        height: 120,
        cvWidth: 1000,
        cvHeight: 800,
        uploadType: 1,
        cropDialogWidth: '900px',
        cropBoxResizable: true,
        minCropBoxWidth: 100,
        minCropBoxHeight: 100,
        aspectRatio: 16 / 9,
      },
      slide2: {
        oriUrl: '', // 原图
      },
      imgMouseOver1: false,
      //未上传图片，校验提示语
      uploadImgMessage1: false,
      // 商品类型选择【药品】时！！！！！！！！！！！！！！！！！！！！！！！！！！！！！
      isMedic: false,
      // 商品类型选择【检测服务】时！！！！！！！！！！！！！！！！！！！！！！！！！！！！！
      isCheckServe: false,
      inputType: '',
      limitVisibleFlag: false,
      limit: {
        title: '限购条件',
      },
      //1: "供货商",2: "小药房",3: "医生小店"
      storeType: 1,
      //店铺是否有退货地址
      hasRepoFlag: 0,
      //视频上传文件列表
      videoList: [],
      videoModel: {
        videoFullPath: '',
      },
      // businessCategoryList:[],
      sumFile: 0,
      // 上传视频进度条
      uploadProgress: 0,
      // 合作项目
      cooperationProjectList: [],
      // 合同
      contractList: [],
      // 是否选择合作项目
      isProject: false,
      // 是否选择合同
      isContract: false,
      showTcm: false,
      //   pickerOptions: {
      //   disabledDate: (time) => {
      //     return time.getTime() > new Date().getTime(); //减去一天的时间代表可以选择同一天;
      //   },
      // },
      rangeTime: '',
      ElIconDelete,
    }
  },
  components: {
    BreadCrumb,
    Cropper,
    ElIconDelete,
    ElIconMinus,
    ElIconPlus,
  },
  computed: {
    idMedicEdit() {
      return this.isEdit && !this.isCheckServe
    },
  },
  created() {
    vm = this
    const { id, storeId, goodsType, inputType, commissionFlag, storeType } =
      this.$route.query
    this.goodsType = goodsType
    this.storeId = storeId
    this.inputType = inputType || ''
    this.commissionFlag = commissionFlag
    this.storeType = storeType
    // this.formData = originForm;
    // this.formData1 = originForm1;
    // this.formData2 = originForm2;
    this.rules = originRules
    this.rules1 = originRules1
    this.rules2 = originRules2
    this.rules3 = originRules3
    // this.rules2.barCode = originRules.barCode;

    this.jumPathThird =
      '/goods-manage?storeId=' +
      storeId +
      '&commissionFlag=' +
      this.commissionFlag +
      '&storeType=' +
      this.storeType
    //this.jumPathThird = '/create-good?id=add&storeId=46'
    this.title = id == 'add' ? '新增商品' : '编辑商品'
    this.isEdit = id != 'add'
    this.curmbThird = this.title
    this.formData.storeId = Number(storeId) || ''
    this.getTypeCodeList()
    // this.getBusinessCategory();
    this.getLever(0, 1)
    this.getCooperationProjectList()
    dosageAll().then((res) => {
      this.doseAll = res.data
      if (!this.doseAll) {
        this.doseAll.push({ dosageName: '其他', id: -1 })
      }
    })
    getDeparts().then((res) => {
      this.allDeparts = res.data
    })
    if (id != 'add') {
      this.getDetailByEdit(id, goodsType)
      getCheckPackageIdList().then((res) => {
        console.log(`getCheckPackageIdList`, res)
        this.checkPackageIdList = res.data
      })
    } else {
      this.getStoreAdress()
    }
    // debugger;
    // 判空
    if (this.formData.leastCount == null || this.formData.leastCount === '') {
      this.formData.leastCount = 1
    }
    if (this.formData.mostCount == null || this.formData.mostCount === '') {
      this.formData.mostCount = -1
    }
    if (this.formData.incrType == null || this.formData.incrType === '') {
      this.formData.incrType = 2
    }
    console.log('save')
  },
  methods: {
    // 获取合同
    getContractList(projectId) {
      getContractList(projectId || 0).then((res) => {
        if (res.code == '000000') {
          this.contractList = res.data
          console.log(this.contractList, 'this.contractList')
        }
      })
    },
    //  获取合作项目
    getCooperationProjectList() {
      getCooperationProjectList().then((res) => {
        if (res.code == '000000') {
          this.cooperationProjectList = res.data
        }
      })
    },
    getContract(projectId) {
      this.formData3.contractId = ''
      this.contractList = []
      this.getContractList(projectId)
    },
    projectClear() {
      this.formData3.contractId = ''
      this.contractList = []
    },
    // 获取业务类型
    // getBusinessCategory(){
    //   getBusinessCategory().then((res) => {
    //     if (res.code == '000000') {
    //       this.businessCategoryList=res.data
    //     }
    //   }).catch((err)=>{})
    // },
    // 判断imgurl是否有效
    checkImgExists(imgurl) {
      return new Promise(function (resolve, reject) {
        var ImgObj = new Image()
        ImgObj.src = imgurl
        ImgObj.onload = function (res) {
          resolve(res)
        }
        ImgObj.onerror = function (err) {
          reject(err)
        }
      })
    },
    // 获取适用人群
    getTypeCodeList() {
      return getTypeCodeList()
        .then((res) => {
          if (res.code == '000000') {
            this.suitableList = []
            for (const item of res.data) {
              this.suitableList.push({
                label: item.value,
                value: item.no + '',
              })
            }
          }
        })
        .catch((err) => {})
    },
    //eidt状态
    async getDetailByEdit(id, goodsType) {
      this.goodsId = id
      if (goodsType == 337) {
        this.isCheckServe = true
        await this.getTypeCodeList()
        const res = await getGoodDetails(id)
        console.log(`========================>`, res)
        if (res.code != '000000') {
          return this.$message({
            message: res.message,
            type: 'error',
          })
        }
        closeLoading(this)
        if (res.data == null) {
          return this.$message({
            type: 'error',
          })
        }

        const { goodsInfo, medicalService, buyLimitDtoList, hasRepoFlag } =
          res.data
        const {
          goodsName,
          goodsDescription,
          goodsType,
          expressLimitFlag,
          goodsHeaderImages = [],
          goodsVideoList = [],
          contractId,
          cooperationProjectId,
        } = goodsInfo
        this.isProject = Boolean(cooperationProjectId)
        if (this.isProject) {
          this.getContractList(cooperationProjectId)
        }
        this.isContract = Boolean(contractId)
        this.formData = { ...this.formData, ...goodsInfo }
        this.formData2 = medicalService
        this.formData = { ...this.formData, ...this.formData2 }
        this.formData3 = {
          goodsName,
          goodsDescription,
          goodsHeaderImages,
          goodsVideoList,
          goodsType,
          expressLimitFlag,
          cooperationProjectId,
          contractId,
        }
        this.buyLimitDtoList = buyLimitDtoList
        this.hasRepoFlag = hasRepoFlag
        this.formData2['suitableArr'] = this.formData.suitable.split(',')
        this.formData['suitableArr'] = this.formData.suitable.split(',')
        this.formData.stock = this.formData.goodsStock
        this.formData.scorePerformance = this.formData.scorePerformance / 100
        this.formData.optPrice = this.formData.costPrice / 100
        this.fileGoodsList = this.getImges(goodsInfo.goodsHeaderImages, 1)
        this.goodsCheckList = this.getImges(
          medicalService.goodsCheckImages,
          goodsType
        )
        if (goodsInfo.goodsVideoList.length > 0) {
          this.videoList.push(goodsInfo.goodsVideoList[0])
          this.videoModel.videoFullPath = this.videoList[0].goodsImgUrl
        }
        let newImgList = []
        this.fileGoodsList.map((item, index) => {
          this.checkImgExists(item.imageUrl)
            .then(() => {
              newImgList.push(item)
            })
            .catch(() => {
              newImgList = this.fileGoodsList.splice(index, 1)
            })
        })
        this.fileGoodsList = newImgList

        this.rules = {
          ...this.rules,
          ...originRules,
        }
      } else {
        this.isMedic = goodsType == '5'
        const res = await getGoodsList({
          goodsIdList: [id],
          goodsName: '',
          goodsType: '',
          pageNo: 1,
          pageSize: 10,
          storeId: this.storeId,
        })
        if (res.code != '000000') {
          return this.$message({
            message: res.message,
            type: 'error',
          })
        }
        closeLoading(this)
        if (res.data == null) {
          return this.$message({
            type: 'error',
          })
        }
        const { goodsList, hasRepoFlag } = res.data
        const {
          goodsName,
          goodsDescription,
          goodsType,
          expressLimitFlag,
          goodsHeaderImages = [],
          goodsVideoList = [],
          contractId,
          cooperationProjectId,
        } = goodsList[0]
        const goodDet = goodsList[0]
        goodDet.otc1 = goodDet.otc ? '1' : '0'
        this.isProject = Boolean(cooperationProjectId)
        if (this.isProject) {
          this.getContractList(cooperationProjectId)
        }
        this.isContract = Boolean(contractId)
        this.formData1 = goodDet
        if (this.formData1.goodsType == 340) {
          this.showTcm = true
          if (this.formData1.useBeginTime && this.formData1.useEndTime) {
            this.rangeTime = [
              new Date(this.formData1.useBeginTime).format('yyyy-MM-dd'),
              new Date(this.formData1.useEndTime).format('yyyy-MM-dd'),
            ]
          }
        }
        this.formData = goodDet
        this.formData3 = {
          goodsName,
          goodsDescription,
          goodsHeaderImages,
          goodsVideoList,
          goodsType,
          expressLimitFlag,
          contractId,
          cooperationProjectId,
        }
        this.hasRepoFlag = hasRepoFlag
        this.buyLimitDtoList = this.formData.buyLimitDtoList
        this.formData.optPrice = this.formData.costPrice / 100
        this.formData.scorePerformance = this.formData.scorePerformance / 100
        this.fileGoodsList = this.getImges(goodDet.goodsImgList, 1)
        this.fileIntrList = this.getImges(goodDet.medicImgList, 2)
        this.formData.stock = this.formData.goodsStock
        if (goodDet.goodsVideoList.length > 0) {
          this.videoList.push(goodDet.goodsVideoList[0])
          this.videoModel.videoFullPath = this.videoList[0].goodsImgUrl
        }
        let newImgList = []
        this.fileGoodsList.map((item, index) => {
          this.checkImgExists(item.imageUrl)
            .then(() => {
              newImgList.push(item)
            })
            .catch(() => {
              newImgList = this.fileGoodsList.splice(index, 1)
            })
        })
        this.fileGoodsList = newImgList
        if (this.isMedic) {
          this.getLever(5, 2, 1)
        } else {
          this.getLever(goodsType, 1)
        }
        const {
          categoryIdLevel2,
          categoryIdLevel3,
          categoryIdLevel4,
          categoryIdLevel5,
        } = this.formData
        if (categoryIdLevel2 && categoryIdLevel2 != -1) {
          this.getLever(categoryIdLevel2, 3, 1)
        }
        if (categoryIdLevel3 && categoryIdLevel3 != -1) {
          this.getLever(categoryIdLevel3, 4, 1)
        }
        if (categoryIdLevel4 && categoryIdLevel4 != -1) {
          this.getLever(categoryIdLevel4, 5, 1)
        }
        //this.totalRows = res.data.totalCount

        this.rules = {
          ...this.rules,
          ...originRules,
        }
        this.barAndGoodsFlag = this.formData1.medicalCategoryId ? true : false
      }
    },
    getImges(d, type) {
      let a = []
      if (d.length > 0) {
        for (let i = 0; i < d.length; i++) {
          a.push({
            url: type == 1 ? d[i].goodsImgUrl : d[i].imageUrl,
            imageUrl: type == 1 ? d[i].goodsImgUrl : d[i].imageUrl,
            goodsImgUrl: type == 1 ? d[i].goodsImgUrl : d[i].imageUrl,
            id: d[i].id,
            imageSort: d[i].imageSort,
            imgSort: d[i].imgSort,
            imageType: type == 1 ? d[i].imgType : d[i].imageType,
          })
        }
      }
      return a
    },
    // 修改条形码
    changeBarCode(val) {
      this.$refs.formData1.resetFields()
      this.formData1.barCode = val
      this.goodDisabled = false
    },
    //快速录入
    fastInput(type) {
      ///medications/query/{approvalnumber}
      if (this.formData1.barCode == '') {
        this.$refs.formData1.validateField('barCode')
        return
      }
      // this.GET("store/medications/query/"+this.formData.approvalNumber).then(res => {
      this.GET(
        `store/medications/query/barcode/${this.formData1.barCode}`
      ).then((res) => {
        console.log(res)
        if (res.code != '000000') {
          return this.$message({
            message: res.message,
            type: 'error',
          })
        }
        if (res.data == null) {
          return this.$message({
            message: '未查询到数据，请手动输入',
            type: 'warning',
          })
        }
        const { imageList, medicationInfo } = res.data
        this.formData1.medicationId = medicationInfo.id
        this.formData1.approvalNumber = medicationInfo.approvalNumber
        const {
          medicCommonName,
          medicGoodsName,
          dosageId,
          size,
          otc,
          usage,
          categoryIdLevel2,
          categoryIdLevel3,
          categoryIdLevel4,
          categoryIdLevel5,
          manufacturer,
          department,
          treatDisease,
          expiredTime,
        } = medicationInfo
        let fastParm = {
          medicCommonName,
          medicGoodsName,
          dosageId,
          size,
          otc,
          usage,
          categoryIdLevel2,
          categoryIdLevel3,
          categoryIdLevel4,
          categoryIdLevel5,
          manufacturer,
          department,
          treatDisease,
          expiredTime,
        }
        if (categoryIdLevel2) {
          this.getLever(categoryIdLevel2, 3, 1)
        }
        if (categoryIdLevel3 != -1) {
          this.getLever(categoryIdLevel3, 4, 1)
        }
        if (categoryIdLevel4 != -1) {
          this.getLever(categoryIdLevel4, 5, 1)
        }
        this.formData1.otc1 = this.formData1.otc ? '1' : '0'

        this.formData1 = Object.assign(this.formData1, fastParm)

        this.goodDisabled = medicationInfo.medicalCategoryId ? true : false

        this.fileIntrList = this.getImges(imageList, 2)
      })
    },

    getGoodsTypes(goodsType, type) {
      this.goodsType = goodsType
      if (goodsType == 337) {
        this.isMedic = false
        this.showTcm = false
        this.isCheckServe = true
        getHospitalInfoByStoreId(this.storeId).then(
          ({ code, message, data }) => {
            this.formData2.hospitalName = data.hospital
          }
        )
        getCheckPackageIdList().then((res) => {
          console.log(`getCheckPackageIdList`, res)
          this.checkPackageIdList = res.data
        })
      } else {
        if (goodsType == 340) {
          this.showTcm = true
        } else {
          this.isMedic = goodsType == '5'
          this.isCheckServe = false
          this.showTcm = false
          this.getLever(goodsType, type)
        }
      }
      console.log(goodsType, type)
      console.log(this.formData)
    },
    defaultArr() {
      let a = [
        {
          categoryName: '其他',
          id: -1,
        },
      ]
      return a
    },
    //获取分类
    getLever(id, type, parm) {
      this.GET('store/category/' + id).then((res) => {
        if (type == 1) {
          this.oneLever = res.data
        } else if (type == 2) {
          //console.log(res)
          //this.twoLever = res.data || this.defaultArr()
          res.data =
            res.data.length > 0
              ? res.data.concat([{ categoryName: '其他', id: -1 }])
              : this.defaultArr()
          this.twoLever = res.data
          // console.log(this.twoLever)
        } else if (type == 3) {
          // res.data = res.data.push({categoryName: "其他",id:-1})
          res.data =
            res.data.length > 0
              ? res.data.concat([{ categoryName: '其他', id: -1 }])
              : this.defaultArr()
          this.threeLever = res.data
          if (!parm) {
            this.formData.categoryIdLevel3 = ''
            this.formData.categoryIdLevel4 = ''
            this.formData.categoryIdLevel5 = ''
          }
        } else if (type == 4) {
          res.data =
            res.data.length > 0
              ? res.data.concat([{ categoryName: '其他', id: -1 }])
              : this.defaultArr()
          this.fourLever = res.data
          if (!parm) {
            this.formData.categoryIdLevel4 = ''
            this.formData.categoryIdLevel5 = ''
          }
        } else if (type == 5) {
          res.data =
            res.data.length > 0
              ? res.data.concat([{ categoryName: '其他', id: -1 }])
              : this.defaultArr()
          this.fiveLever = res.data
          if (!parm) {
            this.formData.categoryIdLevel5 = ''
          }
        }
      })
    },
    updateStock() {
      let r = /^\+?[1-9][0-9]*$/
      //造假  接口来了删掉
      if (this.stock.num <= 0) {
        return this.$message({
          message: '增加库存数量不得为0',
          type: 'warning',
        })
      }
      if (!r.test(this.stock.num)) {
        return this.$message({
          message: '库存数量必须正整数',
          type: 'warning',
        })
      }

      if (this.stock.type == 1) {
        if (this.stock.num > this.formData.goodsStock) {
          return this.$message({
            message: '减少库存数量不得大于当前库存',
            type: 'warning',
          })
        }
        this.formData.stock = this.formData.goodsStock - this.stock.num
        this.formData.decrStock = Number(this.stock.num)
        this.formData.incrStock = ''
      } else if (this.stock.type == 2) {
        this.formData.stock =
          Number(this.stock.num) + Number(this.formData.goodsStock)
        this.formData.incrStock = Number(this.stock.num)
        this.formData.decrStock = ''
      }
      //this.formData.goodsStock = this.formData.stock
      this.stockDio = false
    },
    changeStock(type) {
      if (this.formData.stock == 0 && type == 1) {
        return
      }
      let str = type == 1 ? '减少' : '增加',
        txt = `请输入${str}的库存数量`,
        tit = str + '库存'
      this.stock = {
        title: tit,
        type,
        num: '',
        placeholderTxt: txt,
      }
      this.stockDio = true
    },
    buyingLimit() {},
    complete() {
      if (this.goodsType == 340) {
        this.formData1.otc1 = '0'
      }
      console.log(this.formData1)
      console.log(this.rangeTime)
      this.formData1.useBeginTime =
        new Date(
          this.rangeTime ? this.rangeTime[0] + ' ' + '00:00:00' : ''
        ).getTime() || ''
      this.formData1.useEndTime =
        new Date(
          this.rangeTime ? this.rangeTime[1] + ' ' + '23:59:59' : ''
        ).getTime() || ''
      console.log('==============')
      // debugger;
      this.formData1.leastCount = this.formData.leastCount
      this.formData1.mostCount = this.formData.mostCount
      let formNameList = ['formData', 'formData1', 'formData2', 'formData3']

      // let formName = "formData";
      if (this.goodsType == 337) {
        formNameList = ['formData', 'formData2', 'formData3']
        this.formData = {
          ...this.formData,
          ...this.formData3,
          ...this.formData2,
        }
      } else {
        formNameList = ['formData', 'formData1', 'formData3']
        this.formData = {
          ...this.formData,
          ...this.formData1,
          ...this.formData3,
        }
      }
      for (let i = 0; i < this.fileGoodsList.length; i++) {
        this.fileGoodsList[i].imageSort = i + 1
      }
      for (let j = 0; j < this.fileIntrList.length; j++) {
        this.fileIntrList[j].imageSort = j + 1
      }
      this.formData.categoryId = this.formData.goodsType
      this.formData.otc = this.formData.otc1 == 1 ? true : false
      this.isgoodStock = this.formData.stock > 0 ? true : false
      this.formData.goodsId = this.goodsId
      // console.log(this.isgoodStock);
      this.formData.goodsImages = this.fileGoodsList
      this.formData.goodsHeaderImages = this.fileGoodsList
      this.formData.goodsVideoList = this.videoList
      this.formData.specificationImages = this.fileIntrList
      this.formData.buyLimitDtoList = this.buyLimitDtoList
      this.isgoodsImages = this.formData.goodsImages.length == 0 ? false : true
      const { cooperationProjectId, contractId } = this.formData3
      if (!cooperationProjectId) {
        return this.$message({
          message: '请关联项目名称',
          type: 'error',
        })
      }
      if (
        (cooperationProjectId && !contractId) ||
        (!cooperationProjectId && contractId)
      ) {
        return this.$message({
          message: '请选择项目-合同名称',
          type: 'warning',
        })
      }

      // 如果是【药品】类型的商品
      // if(this.isMedic){
      if (!this.isgoodsImages) {
        return
      }
      // }
      // 如果是【检测服务】类型的商品
      if (this.isCheckServe) {
        this.formData.goodsCheckImages = this.goodsCheckList
        const { suitableArr } = this.formData2
        this.formData2.suitable = this.formData.suitable = suitableArr.join(',')
        this.formData.medicalServiceId = this.formData.medicationId
      }

      if (!this.isgoodStock) {
        return
      }

      if (!this.checkCount()) {
        return
      }

      let isTrue = false
      // formNameList.map(item=>{
      //   this.$refs[item].validate((valid,object) => {
      //     isTrue = valid;
      //     if (!valid) return false;
      //   });
      // });
      let item = ''
      for (let i = 0; i < formNameList.length; i++) {
        item = formNameList[i]
        this.$refs[item].validate((valid, object) => {
          isTrue = valid
          if (!valid) return false
        })
        if (!isTrue) {
          return
        }
      }

      if (!isTrue) {
        return false
      } else {
        this.formData.costPrice = signFigures(this.formData.optPrice * 100, 10)
        this.formData.hasChanged = true
        this.formData.inputType = this.inputType
        this.updateGoodsInfo()
      }

      // this.$refs[formName].validate((valid) => {
      //   if (valid) {
      //     //alert('submit!');
      //     this.formData.costPrice = this.formData.optPrice*100
      //     this.formData.hasChanged = true;
      //     this.updateGoodsInfo();
      //   } else {
      //     console.log('error submit!!');
      //     return false;
      //   }
      // });
    },
    //更新商品
    updateGoodsInfo() {
      console.log('提交值', JSON.parse(JSON.stringify(this.formData)))
      const submieFn = this.isCheckServe ? updateGoodsV2 : updateGoods
      let params = JSON.parse(JSON.stringify(this.formData))
      params.scorePerformance = params.scorePerformance * 100
      submieFn(params).then((res) => {
        if (res.code !== '000000') {
          return this.$message({
            message: res.message,
            type: 'error',
          })
        }

        vm.$message.success('操作成功')
        this.$router.push({
          path: '/goods-manage',
          query: {
            storeId: this.formData.storeId,
            commissionFlag: this.commissionFlag,
            storeType: this.storeType,
          },
        })
      })
    },
    imgExceed(file) {
      if (file.length > 6) {
        this.$message.error('最多只能上传6张图片')
      }
    },
    //上传商品头图
    beforeUploadPic(file) {
      // if(this.fileGoodsList.length > 6){
      //     this.$message.error("最多只能上传6张图片");
      //     return ;
      // }
      let vm = this
      let picTypes = ['image/jpeg', 'image/png']

      const isLt200k = file.size / 1024 < 200
      if (picTypes.indexOf(file.type) == -1) {
        return this.$message.error('请上传jpeg或png格式的图片')
      }
      let _img = new FileReader()
      _img.readAsDataURL(file)

      _img.onload = function (theFile) {
        let image = new Image()
        image.src = theFile.target.result
        vm.slide2.oriUrl = theFile.target.result
        image.onload = function () {
          let _this = this
          if (_this.width !== 750 || _this.height !== 750) {
            vm.$message.error('图片长宽尺寸必须为750*750')
            return
          }
          openLoading(vm)
          doUpload(
            vm,
            file,
            getFilePath(file, null),
            'preview4',
            'progress1',
            1
          ).then(function (path) {
            closeLoading(vm)
            console.log('上传成功后路径', path)
            let len = vm.fileGoodsList.length
            vm.fileGoodsList.push({
              url: path.fullPath,
              goodsImgUrl: path.fullPath,
              imageUrl: path.fullPath,
              imgSort: len + 1,
              imageSort: len + 1,
              goodsId: vm.formData.goodsId,
            })
            // vm.fileGoodsList.push({url:path.fullPath,goodsImgUrl: path.fullPath,imageUrl:path.fullPath,imageName:'',imageSort: len+1,imageType: 2,id: null,})
            vm.$message.success('上传成功')
          })
        }
      }
    },
    // 上传检测说明图
    beforeUploadPic2(file) {
      if (this.fileGoodsList.length > 10) {
        return
      }
      let vm = this
      let picTypes = ['image/jpeg', 'image/png']

      const isLt200k = file.size / 1024 < 200
      if (picTypes.indexOf(file.type) == -1) {
        return this.$message.error('请上传jpeg或png格式的图片')
      }
      let _img = new FileReader()
      _img.readAsDataURL(file)

      _img.onload = function (theFile) {
        let image = new Image()
        image.src = theFile.target.result
        vm.slide2.oriUrl = theFile.target.result
        image.onload = function () {
          let _this = this
          console.log(_this.width, _this.height)
          openLoading(vm)
          doUpload(
            vm,
            file,
            getFilePath(file, null),
            'preview4',
            'progress1',
            1
          ).then(function (path) {
            closeLoading(vm)
            console.log('上传成功后路径', path)
            let len = vm.goodsCheckList.length
            vm.goodsCheckList.push({
              url: path.fullPath,
              imageUrl: path.fullPath,
              imageSort: len + 1,
              id: vm.formData.goodsId,
            })
            vm.$message.success('上传成功')
          })
        }
      }
    },
    //上传药品说明
    beforeUploadPic1(file, type) {
      this.currentOption.aspectRatio = 1 / 1
      this.currentOption.cropBoxResizable = true
      this.currentOption.minCropBoxWidth = 160
      this.currentOption.minCropBoxHeight = 160
      let fileLimit = {
        width: 160,
        height: 160,
        size: 0.5,
        sizeText: '500K',
        key: 'headUrl',
        more: 'imgUrl1More',
        show: 'uploadImgMessage1',
      }
      this.beforeUpload(file, fileLimit)
    },
    //上传图片
    beforeUpload(file, fileLimit) {
      let vm = this
      const isJPG = file.type === 'image/jpeg'
      const isPNG = file.type === 'image/png'
      const isLt2M = file.size / 1024 / 1024 < 2
      if (!isJPG && !isPNG) {
        vm.$message.error('图片格式不符合规范，请根据规范上传图片')
        // return;
      }
      if (!isLt2M) {
        vm.$message.error('图片大小请控制在2M以内 ')
        return
      }
      let _img = new FileReader()
      _img.readAsDataURL(file)
      _img.onload = function (theFile) {
        let image = new Image()
        image.src = theFile.target.result
        vm.slide2.oriUrl = theFile.target.result
        image.onload = function () {
          let _this = this
          // if (_this.width != fileLimit.width || _this.height != fileLimit.height) {
          // if (_this.width < fileLimit.width ||  _this.height < fileLimit.height) {
          //   vm.$message.error("图片尺寸不符合规范，请根据规范上传图片");
          //   return;
          // } else if(_this.width > fileLimit.width ||  _this.height > fileLimit.height){
          //   vm.showCropper = true;
          //   vm.currentOption.cvWidth = _this.width;
          //   vm.currentOption.cvHeight = _this.height;
          //   return;
          // } else {
          openLoading(vm)
          doUpload(
            vm,
            file,
            getFilePath(file, null),
            'preview4',
            'progress1',
            1
          ).then(function (path) {
            closeLoading(vm)
            let len = vm.fileIntrList.length
            vm.fileIntrList.push({
              url: path.fullPath,
              imageUrl: path.fullPath,
              imageSort: len + 1,
              imageType: 1,
              id: null,
            })
            vm.$message.success('上传成功')
          })
          //}
        }
      }
      return isJPG && isLt2M
    },
    //删除图片
    deleteImg(item, d) {
      let index = ''
      for (let i = 0; i < d.length; i++) {
        if (item.url == d[i].url) {
          index = i
          break
        }
      }
      d.splice(index, 1)
      // if (type == 1) {
      //   vm.formData.headUrl = "";
      //   vm.imgMouseOver1 = false;
      // }
    },
    // 获取裁剪的图片数据
    getCropImg(argument) {
      this.showCropper = false
      this.cropData = argument[1]
      vm.doUploadQiNiu(argument[2])
      argument[3] && argument[3].destroy()
      // vm.slide2.oriUrl = "";
    },
    // 单次购买上限和最大购买数
    minusCount(type) {
      if (type === 1) {
        if (this.formData.leastCount >= 2) {
          this.formData.leastCount -= 1
          this.formData1.leastCount = this.formData.leastCount
        }
      } else if (type === 2) {
        if (this.formData.mostCount > -1) {
          this.formData.mostCount -= 1
          this.formData1.mostCount = this.formData.mostCount
        }
      } else if (type === 3) {
        if (this.formData.minWhole >= 2) {
          this.formData.minWhole -= 1
        }
      }
      // if (this.formData.mostCount < this.formData.leastCount) {
      //   this.formData.mostCount = this.formData.leastCount;
      // }
    },
    plusCount(type) {
      if (type === 1) {
        this.formData.leastCount += 1
        this.formData1.leastCount = this.formData.leastCount
      } else if (type === 2) {
        this.formData.mostCount += 1
        this.formData1.mostCount = this.formData.mostCount
      } else if (type === 3) {
        this.formData.minWhole += 1
      }
      // if (this.formData.mostCount < this.formData.leastCount) {
      //   this.formData.mostCount = this.formData.leastCount;
      // }
    },
    // 上传七牛
    doUploadQiNiu(file) {
      doUpload(
        this,
        file,
        getFilePath(file, null),
        'preview4',
        'uploadProgress1',
        ''
      ).then(function (path) {
        vm.formData.headUrl = path.fullPath

        vm.$message.success('上传成功')
      })
    },
    addBuyingLimit() {
      if (this.buyLimitDtoList != null && this.buyLimitDtoList.length == 2) {
        this.$message({
          message: '最多添加两个限制条件',
          type: 'warning',
        })
        return
      }
      if (this.buyLimitDtoList == null || this.buyLimitDtoList.length == 0) {
        this.buyLimitDtoList.push({
          days: 0,
          daysType: 1,
          limitCount: 0,
          limitUserType: 1,
        })
        return
      }

      if (this.buyLimitDtoList.length < 2) {
        let limitUserType = 1
        if (this.buyLimitDtoList[0].limitUserType == 1) {
          limitUserType = 2
        }
        this.buyLimitDtoList.push({
          days: 0,
          daysType: 1,
          limitCount: 0,
          limitUserType: limitUserType,
        })
      }
      // this.limitVisibleFlag = true;
    },
    delLimit(index) {
      this.buyLimitDtoList.splice(index, 1)
    },
    changeLimitUserType(item, index) {
      if (item.limitUserType == 1) {
        if (this.buyLimitDtoList.length == 2 && index == 0) {
          this.buyLimitDtoList[1].limitUserType = 2
        } else if (this.buyLimitDtoList.length == 2 && index == 1) {
          this.buyLimitDtoList[0].limitUserType = 2
        }
      } else {
        if (this.buyLimitDtoList.length == 2 && index == 0) {
          this.buyLimitDtoList[1].limitUserType = 1
        } else if (this.buyLimitDtoList.length == 2 && index == 1) {
          this.buyLimitDtoList[0].limitUserType = 1
        }
      }
    },
    checkCount() {
      let flag = true
      if (this.formData.saleType == 1 && this.formData.mostCount == 0) {
        flag = false
        this.$message({
          message: '单次购买上限不能为0',
          type: 'warning',
        })
        return flag
      }

      if (
        this.formData.saleType == 1 &&
        this.formData.mostCount != -1 &&
        this.formData.mostCount < this.formData.leastCount
      ) {
        flag = false
        this.$message({
          message: '单次购买上限不能小于最小起购件数',
          type: 'warning',
        })
        return flag
      }
      return flag
    },
    goShopDeatil() {
      this.$router.push({
        path: `/create-shop`,
        query: {
          storeId: this.storeId,
          // storeData: JSON.stringify(row),
        },
      })
    },
    //店铺是否配置售后地址
    getStoreAdress() {
      getStoreAdressRepot(this.storeId).then((res) => {
        if (res.code == '000000') {
          // repotList 地址数组
          if (res.data && res.data.repotList && res.data.repotList.length) {
            this.hasRepoFlag = true
          } else {
            this.hasRepoFlag = false
          }
        } else {
          this.$message.error(res.message)
        }
      })
    },
    // 视频
    deleteVideo(videoList) {
      console.log(videoList, 'item,fileGoodsListitem,fileGoodsListv')
      this.videoList = []
      this.videoModel.videoFullPath = ''
    },
    beforeVideoUpload(file) {
      const video2M = file.size / 1024 / 1024 < 20
      console.log(file.size, 'video2Mvideo2Mvideo2M')

      if (!video2M) {
        this.$message.error('上传视频大小不能超过20M!')
      } else {
        this.doVideoUpload(file, 1)
      }
    },
    handleRemoveVideo(file, videoList) {
      //console.log(this.videoList);
      for (let i = 0; i < this.videoList.length; i++) {
        if (this.videoList[i].name == file.name) {
          this.videoList.splice(i, 1)
          console.log('删除' + i)
        }
      }
    },
    checkUpdate(name) {
      let flag = true
      for (let i = 0; i < this.videoList.length; i++) {
        if (this.videoList[i].name == name) {
          flag = false
          this.$message.warning('上传文件重发')
        }
      }
      console.log('name', name, '', this.videoList)
      return flag
    },
    doVideoUpload(file, index) {
      console.log('file', file)
      //console.log('videoList项目列表：',this.videoList);
      this.videoModel.videoFullPath = ''
      if (file.name.indexOf(' ') != -1) {
        this.$message.warning('文件名不能包含空格')
        return
      }
      let updateFlag = this.checkUpdate(file.name)
      if (updateFlag == false) {
        return
      }
      var ext = file.type
      var arr = ext.split('/')
      var filety = '.' + arr[1]
      /*if (filety.indexOf(".pdf") < 0 && filety.indexOf(".jpeg") < 0 && filety.indexOf(".jpg") < 0
      && filety.indexOf(".png") < 0 && filety.indexOf(".mp4") < 0) {
      this.$message.warning('文件格式错误');
      return
  }*/

      let self = this
      //如果没有选择文件,返回
      if (isEmptyUtils(file)) {
        return
      }

      console.log('file.type', file.type)
      if (filety != '.mp4') {
        // if (file.type !== 'video/mp4') {
        self.$message.error('仅支持上传mp4格式视频')
        return
      }

      var arr = file.name.split('_')
      if (arr.length != 4) {
        self.$message.error(
          '上传视频文件名格式不正确：举例（GXY_001_02_03.mp4)'
        )
        return
      }

      self.$message.info('开始上传')
      self.videoModel.videoPath = createFilePath(file, file.name)
      //  let videoPath = createFilePath(file,file.name)
      doUpload(
        self,
        file,
        self.videoModel.videoPath,
        'preview4',
        'uploadProgress1',
        ''
      ).then(function (result) {
        console.log('成功result', result)
        self.videoModel.videoFullPath = result.fullPath
        // self.model.size = result.size;
        // self.model.ext = result.ext;
        // self.model.name = self.model.videoPath;
        let fileItem = {
          goodsImgUrl: result.fullPath,
          uid: '',
          imageUrl: result.fullPath,
          imageType: 9,
          goodsId: self.formData.goodsId,
          id: null,
          deleteFlag: 0,
        }
        self.videoList.push(fileItem)
        self.$message.success('上传成功')
        console.log('sumFile', self.sumFile, 'videoList', self.videoList)
        return false
      })
    },
  },
}
</script>

<style lang="scss">
.create-shop-wrapper {
  .create-shop-content {
    background: #fff;
    padding: 10px;
    .step-content {
      overflow: hidden;
      height: 60px;
      padding: 10px 10px 50px;
      border-bottom: 1px solid #efefef;
      .title {
        font-size: 13px;
        color: #449284;
      }
    }
    .word-tip {
      color: #e6af7a;
    }
  }
  .suitableList-select {
    width: 445px;
  }
  .el-button--text {
    color: #449284;
    font-size: 14px;
    &::after {
      content: '';
      position: relative;
      height: 14px;
      /*border-right: 1px solid #EBEEF5;*/
      border-right: 1px solid #aaaaaa;
      padding-right: 10px;
    }
    &:last-of-type {
      &::after {
        content: '';
        position: relative;
        width: 1px;
        height: 14px;
        border-right: none;
      }
    }
  }
}
.project-req {
  .el-form-item__label::before {
    content: '*';
    color: #f56c6c;
    margin-right: 4px;
  }
  .project-tip {
    color: #aaaaaa;
  }
}
.required-label .el-form-item__label::before {
  content: '*';
  color: #f56c6c;
  margin-right: 4px;
}
.basic-item-icon {
  position: relative;
  .require {
    position: absolute;
    left: 67px;
    top: 11px;
    color: #f56c6c;
  }
  .error-message {
    font-size: 12px;
    color: #f56c6c;
  }
  .upload-message {
    position: absolute;
    left: 0;
    top: 105px;
    font-size: 12px;
    color: #f56c6c;
  }
  .backTip {
    font-size: 12px;
    color: red;
    cursor: pointer;
  }
  .ad-back {
    color: #449284;
  }
  .img-delete {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 84px;
    height: 100px;
    background: #000;
    opacity: 0.7;
    z-index: 999;

    i {
      color: #fff;
      margin-top: 39px;
      margin-left: 0px;
    }
  }
}
.word-num {
  font-size: 12px;
  color: #999;
}
.line {
  margin-left: 10px;
  width: 20px;
}
.bg-uploader {
  .bg-img {
    float: left;
    width: 84px;
    height: 100px;
  }

  .limit-text {
    float: left;
    margin-left: 10px;
    margin-top: -10px;

    p {
      font-size: 12px;
      color: #999;
      text-align: left;
    }
  }
}
.el-upload__tip {
  position: absolute;
  top: -6px;
  left: 130px;
}
.span-mt-10 {
  .edit-img {
    width: 20px;
    margin-top: 10px;
  }
}
.p-tips {
  font-size: 13px;
  color: #8c8c8c;
  line-height: 26px;
}
.part-tit {
  font-size: 14px;
  padding: 20px 0 20px 20px;
}
.inline {
  .el-form-item {
    display: inline-block;
    vertical-align: top;
    .el-radio__label {
      font-size: 12px;
    }
  }
}
.stock-com {
  width: 158px;
  height: 32px;
  border-radius: 4px;
  overflow: hidden;
  .sp {
    display: inline-block;
    float: left;
    color: #fff;
  }
  .sp-c {
    line-height: 30px;
    height: 30px;
    width: 92px;
    text-align: center;
    color: #666;
    border-top: 1px solid #449284;
    border-bottom: 1px solid #449284;
  }
  .sp-l {
    border-right: 1px solid #449284;
  }
  .sp-r {
    border-left: 1px solid #449284;
    border-radius: 0 4px 4px 0;
  }
  .sp-l,
  .sp-r {
    width: 32px;
    text-align: center;
    line-height: 32px;
    font-size: 13px;
    background: #449284;
    cursor: pointer;
  }
  .opac {
    opacity: 0.5;
  }
}
.stock-dia {
  .stock-item {
    padding-bottom: 20px;
  }
}
.fast-opt {
  font-size: 12px;
  padding: 0 10px;
  cursor: pointer;
  color: #449284;
}
.file-pics {
  display: inline-block;
  width: 84px;
  height: 100px;
  float: left;
  margin-right: 15px;
  position: relative;
}
 {
}
.el-input-number__decrease,
.el-input-number__increase {
  position: absolute;
  z-index: 1;
  top: 1px;
  width: 40px;
  height: auto;
  text-align: center;
  background: #449284;
  color: #606266;
  cursor: pointer;
  font-size: 13px;
}
.el-icon-plus {
  color: #ffffff;
}
.el-icon-minus {
  color: #ffffff;
}
#introVideoLecture {
  height: 140px;
}
.video-progress {
  width: 20%;
}
.el-upload-list {
  width: 30%;
}
.label-video {
  position: relative;
  .el-button:focus,
  .el-button:hover {
    color: #449284;
    border-color: #449284;
    background-color: #ecf5ff;
  }
  .dl-video {
    position: absolute;
    top: 50%;
    left: 35%;
    transform: translate(-50%, -50%);
  }
}
</style>
