<template>
  <div class="p-3 bg-white dark:!bg-[#060818]">
    <div class="search bg-white pt-2 dark:!bg-[#060818] w-full">
      <el-form :inline="true" :model="form" class="search-form">
        <el-form-item class="min-w-40">
          <el-input v-model="form.sku" placeholder="SKU: 请输入SKU" clearable>
            <template #append>
              <el-button @click="searchEvent">
                <el-icon style="vertical-align: middle">
                  <Search />
                </el-icon>
              </el-button>
            </template>
          </el-input>
        </el-form-item>
        <el-form-item class="min-w-40">
          <el-input v-model="form.listingTemplate" placeholder="刊登模板" clearable></el-input>
        </el-form-item>

        <el-form-item class="min-w-40">
          <el-input v-model="form.title" placeholder="标题" clearable></el-input>
        </el-form-item>

        <el-form-item class="min-w-40"
          ><!--多选:  multiple collapse-tags collapse-tags-tooltip  -->
          <el-select v-model="form.tag" placeholder="标签" clearable>
            <el-option label="标签1" value="tag1"></el-option>
            <el-option label="标签2" value="tag2"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item class="min-w-40">
          <el-select v-model="form.site" placeholder="站点" clearable>
            <el-option label="站点1" value="site1"></el-option>
            <el-option label="站点2" value="site2"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item class="min-w-40">
          <el-select v-model="form.productCategory" placeholder="产品分类" clearable>
            <el-option label="分类1" value="category1"></el-option>
            <el-option label="分类2" value="category2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item class="min-w-40">
          <el-date-picker
            v-model="form.promotionTime"
            type="daterange"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            range-separator="-"
          ></el-date-picker>
          <!-- <el-select v-model="form.creationTime" placeholder="创建时间" clearable>
            <el-option label="时间1" value="time1"></el-option>
            <el-option label="时间2" value="time2"></el-option>
          </el-select> -->
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="searchEvent">搜索</el-button>
        </el-form-item>
      </el-form>
    </div>
    <en-table-layout :tableData="tableData.records" :loading="loading">
      <template #toolbar>
        <div class="inner-toolbar w-11/12 flex justify-between">
          <div class="toolbar-btns">
            <el-button v-if="checkPermission(['warehouse:add']) && store.state.user.user.founder !== 1" type="primary" @click="handleAddWarehouse">{{
              $t('add')
            }}</el-button>
          </div>
          <div class="toolbar-search">
            <!--  <en-table-search @search="searchEvent" :placeholder="$t('search_placeholde')" /> -->
          </div>
        </div>
      </template>

      <template #table-columns>
        <el-table-column prop="name" :label="$t('goods_name')" />
        <el-table-column prop="brand" :label="$t('goods_brand')" />
        <el-table-column prop="bar_code" :label="$t('goods_bar_code')" />
        <el-table-column prop="sku" label="sku" />
        <el-table-column prop="weight" :label="$t('goods_weight')" />
        <el-table-column prop="unit" :label="$t('goods_unit')" />
        <el-table-column prop="image" :label="$t('goods_image')">
          <template #default="scope">
            <img :src="scope.row.image" style="margin: auto" width="50px" height="50px" alt="" />
          </template>
        </el-table-column>

        <el-table-column :label="$t('operate')" fixed="right" width="450">
          <template #default="scope">
            <el-button size="small" v-if="checkPermission(['warehouse:update'])" @click="handleView(scope.row)">{{ $t('view') }}</el-button>
            <el-button
              size="small"
              v-if="checkPermission(['warehouse:update']) && store.state.user.user.founder !== 1"
              @click="handleEditWarehouse(scope.$index, scope.row)"
              >{{ $t('edit') }}</el-button
            >
            <el-button
              type="success"
              size="small"
              v-if="checkPermission(['removeAreaType:delete']) && store.state.user.user.founder !== 1"
              @click="handleDelGoods(scope.row)"
              >{{ $t('delete') }}</el-button
            >
            <!--<el-button size="mini" v-if="checkPermission(['warehouse:update'])" @click="handleRenew(scope.$index, scope.row)">续费</el-button> -->
          </template>
        </el-table-column>
      </template>
      <template #pagination>
        <el-pagination
          v-if="tableData.records"
          @size-change="handlePageSizeChange"
          @current-change="handlePageCurrentChange"
          :current-page="tableData.page"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="tableData.size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="tableData.total"
        >
        </el-pagination>
      </template>
    </en-table-layout>

    <el-dialog
      :title="skuForm.id ? $t('edit') : $t('add') + '商品'"
      v-model="dialogVisible"
      @open="handleDialogOpen"
      :modal-append-to-body="false"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      top="20px"
      width="90%"
      class="w-11/12 !rounded-lg"
    >
      <el-tabs v-model="activeProduct" type="card" class="demo-tabs" @tab-click="handleProductClick">
        <el-tab-pane label="库存信息" name="first">
          <el-form :model="productForm" label-width="140px">
            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
              <span class="pr-2.5">基本信息</span>
              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
            </div>
            <el-row>
              <el-col :span="10">
                <el-form-item :label="$t('库存SKU') + ':'" prop="name">
                  <el-input v-model="productForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('封面图') + ':'" prop="name">
                  <el-upload
                    class="avatar-uploader"
                    :action="uploadUrl"
                    :show-file-list="false"
                    :disabled="disabled"
                    :on-success="handleAvatarSuccess"
                    :before-upload="beforeAvatarUpload"
                  >
                    <img v-if="productForm.CoverImage" :src="productForm.CoverImage" class="avatar w-28 h-28" />
                    <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
                  </el-upload>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('产品分类') + ':'" prop="name">
                  <el-select v-model="productForm.company_package_id" clearable placeholder="请选择分类">
                    <el-option v-for="item in productClassList" :key="item.id" :label="item.name" :value="item.id" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('产品名称(中)') + ':'" prop="name">
                  <el-input v-model="productForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('产品名称(英)') + ':'" prop="name">
                  <el-input v-model="productForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('本地库存总数') + ':'" prop="name">
                  <el-input v-model="productForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('标签') + ':'" prop="name">
                  <el-select
                    v-model="productForm.label"
                    multiple
                    filterable
                    allow-create
                    default-first-option
                    :reserve-keyword="false"
                    placeholder="请输入标签"
                    style="min-width: 240px"
                    ><el-option v-for="item in labelList" :key="item.value" :label="item.label" :value="item.value" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="采购成本">
                  <el-input v-model="productForm.input" placeholder="请输入" class="!w-1/3" type="number" @input="handleInput">
                    <template #prepend>¥</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="头程运费">
                  <el-input v-model="productForm.input" placeholder="请输入" class="!w-1/3" type="number" @input="handleInput">
                    <template #prepend>¥</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="海关税费">
                  <el-input v-model="productForm.input" placeholder="请输入" class="!w-1/3" type="number" @input="handleInput">
                    <template #prepend>¥</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('可售库存') + ':'" prop="name">
                  <el-input v-model="productForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <div class="w-full border-b border-gray-300"></div>
            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
              <span class="pr-2.5">高级信息</span>
              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
            </div>
            <el-row>
              <el-col :span="10">
                <el-form-item :label="$t('销量状态') + ':'" prop="name">
                  <el-radio-group v-model="productForm.combination">
                    <el-radio :value="1">一般销量</el-radio>
                    <el-radio :value="2">滞销品</el-radio>
                    <el-radio :value="3">畅销品</el-radio>
                    <el-radio :value="4">新品</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('特殊标识') + ':'" prop="name">
                  <el-checkbox-group v-model="productForm.combination">
                    <el-checkbox label="带电池" value="Value A" />
                    <el-checkbox label="液体" value="Value B" />
                    <el-checkbox label="化妆品" value="Value C" />
                    <el-checkbox label="危险器具" value="Value disabled" />
                    <el-checkbox label="生物制品" value="Value selected and disabled" />
                  </el-checkbox-group>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('平台sku映射') + ':'" prop="name">
                  <el-input v-model="productForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('产品标识') + ':'" prop="name">
                  <el-checkbox-group v-model="productForm.combination">
                    <el-checkbox label="产品清货" value="Value A" />
                    <el-checkbox label="侵权产品" value="Value B" />
                    <el-checkbox label="暂停销售" value="Value C" />
                  </el-checkbox-group>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('产品备注') + ':'" prop="name">
                  <el-input v-model="productForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <div class="w-full border-b border-gray-300"></div>
            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
              <span class="pr-2.5">规格信息</span>
              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
            </div>
            <el-row>
              <el-col :span="10">
                <el-form-item :label="$t('尺寸') + ':'" prop="name">
                  <el-input
                    v-model="productForm.name"
                    :minlength="2"
                    :maxlength="20"
                    class="!w-20"
                    :disabled="disabled"
                    clearable
                    :placeholder="$t('place')"
                  ></el-input
                  >X
                  <el-input
                    v-model="productForm.name"
                    :minlength="2"
                    :maxlength="20"
                    class="!w-20"
                    :disabled="disabled"
                    clearable
                    :placeholder="$t('place')"
                  ></el-input
                  >X
                  <el-input
                    v-model="productForm.name"
                    :minlength="2"
                    :maxlength="20"
                    class="!w-20"
                    :disabled="disabled"
                    clearable
                    :placeholder="$t('place')"
                  ></el-input
                  >cm
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('销量状态') + ':'" prop="name">
                  <el-radio-group v-model="productForm.combination">
                    <el-radio value="ordinary">普通产品</el-radio>
                    <el-radio value="materials">包材</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="10" v-if="productForm.combination">
                <el-form-item :label="$t('选择包材') + ':'" prop="name">
                  <el-select v-model="productForm.company_package_id" clearable placeholder="请选择分类">
                    <el-option v-for="item in productClassList" :key="item.id" :label="item.name" :value="item.id" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="10" v-if="productForm.combination">
                <el-form-item :label="$t('包材重量') + ':'" prop="name">
                  <el-input v-model="productForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <div class="w-full border-b border-gray-300"></div>
            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
              <span class="pr-2.5">申报信息</span>
              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
            </div>
            <el-row>
              <el-col :span="10">
                <el-form-item :label="$t('申报品名(中)') + ':'" prop="name">
                  <el-input v-model="productForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('申报品名(英)') + ':'" prop="name">
                  <el-input v-model="productForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="申报金额">
                  <el-input v-model="productForm.input" placeholder="请输入" class="!w-1/3" type="number" @input="handleInput">
                    <template #prepend>¥</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="海关编码">
                  <el-input v-model="productForm.input" placeholder="请输入" class="!w-1/3" type="number" @input="handleInput"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="净重">
                  <el-input v-model="productForm.input" placeholder="请输入" class="!w-1/3"><template #append>g</template></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('包裹尺寸') + ':'" prop="name">
                  <el-input
                    v-model="productForm.name"
                    :minlength="2"
                    :maxlength="20"
                    class="!w-20"
                    :disabled="disabled"
                    clearable
                    :placeholder="$t('place')"
                  ></el-input
                  >X
                  <el-input
                    v-model="productForm.name"
                    :minlength="2"
                    :maxlength="20"
                    class="!w-20"
                    :disabled="disabled"
                    clearable
                    :placeholder="$t('place')"
                  ></el-input
                  >X
                  <el-input
                    v-model="productForm.name"
                    :minlength="2"
                    :maxlength="20"
                    class="!w-20"
                    :disabled="disabled"
                    clearable
                    :placeholder="$t('place')"
                  ></el-input
                  >cm
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="材质">
                  <el-input v-model="productForm.input" placeholder="请输入" class="!w-1/3" type="number" @input="handleInput"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="用途">
                  <el-input v-model="productForm.input" placeholder="请输入" class="!w-1/3" type="number" @input="handleInput"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <div class="w-full border-b border-gray-300"></div>
            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
              <span class="pr-2.5">销量信息</span>
              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
            </div>
            <el-table :data="productForm.tableData" style="width: 100%">
              <el-table-column prop="date" label="仓库名称" />
              <el-table-column prop="name" label="仓库类型" />
              <el-table-column prop="address" label="当天销量" />
              <el-table-column prop="date" label="7天销量" />
              <el-table-column prop="name" label="15天销量" />
              <el-table-column prop="address" label="30天销量" />
              <el-table-column prop="date" label="60天销量" />
              <el-table-column prop="name" label="90天销量" />
            </el-table>
            <div class="w-full border-b border-gray-300"></div>
            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
              <span class="pr-2.5">仓库信息</span>
              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
            </div>
            <el-table :data="productForm.tableData" style="width: 100%">
              <el-table-column prop="date" label="仓库名称" />
              <el-table-column prop="name" label="仓库类型" />
              <el-table-column prop="address" label="货值" />
              <el-table-column prop="date" label="库存总数" />
              <el-table-column prop="name" label="可用库存" />
              <el-table-column prop="address" label="冻结库存" />
              <el-table-column prop="date" label="在途库存" />
              <el-table-column prop="name" label="待上货库存" />
              <el-table-column prop="date" label="次品库存" />
              <el-table-column prop="name" label="操作" />
            </el-table>
            <div class="w-full border-b border-gray-300"></div>
            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
              <span class="pr-2.5">供应商信息</span>
              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
            </div>
            <el-button>绑定供应商</el-button>
            <el-table :data="productForm.supplierData" style="width: 100%">
              <el-table-column prop="supplier" label="供应商" />
              <el-table-column prop="supplierLink" label="供应商链接" />
              <el-table-column prop="name" label="联系人" />
              <el-table-column prop="phone" label="移动电话" />
              <el-table-column prop="wechatNum" label="微信号" />
              <el-table-column prop="address" label="地址" />
              <el-table-column prop="name" label="操作" />
            </el-table>
            <div class="w-full border-b border-gray-300"></div>
            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
              <span class="pr-2.5">1688商品配对</span>
              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
            </div>
            <el-button @click="addPairing">添加配对</el-button>
            <el-table :data="productForm.pairingData" style="width: 100%">
              <el-table-column prop="supplier" label="供应商" />
              <el-table-column prop="supplierLink" label="1688商品" />
              <el-table-column prop="name" label="商品属性" />
              <el-table-column prop="phone" label="商品价格" />
              <el-table-column prop="wechatNum" label="1688供应名称" />
            </el-table>
          </el-form>
        </el-tab-pane>
        <!-- 库存信息部分 -->
        <el-tab-pane label="刊登信息" name="second">
          <el-form :model="skuForm" :rules="stockRules" ref="skuFormRef" label-width="140px">
            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5">
              <span class="pr-2.5">基本信息</span>
              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
            </div>
            <el-row>
              <el-col :span="10">
                <el-form-item :label="$t('库存SKU') + ':'" prop="name">
                  <el-input v-model="skuForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('产品分类') + ':'" prop="name">
                  <el-select v-model="skuForm.company_package_id" clearable placeholder="请选择分类">
                    <el-option v-for="item in productClassList" :key="item.id" :label="item.name" :value="item.id" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('标签') + ':'" prop="name">
                  <el-select
                    v-model="skuForm.label"
                    multiple
                    filterable
                    allow-create
                    default-first-option
                    :reserve-keyword="false"
                    placeholder="请输入标签"
                    style="min-width: 240px"
                  >
                    <el-option v-for="item in labelList" :key="item.value" :label="item.label" :value="item.value" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('销售计划') + ':'" prop="name">
                  <span class="mr-2">库存托管</span>
                  <el-switch v-model="skuForm.sale" inline-prompt active-text="开" inactive-text="关" />
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('本地库存总数') + ':'" prop="name">
                  <el-input v-model="skuForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('可售库存') + ':'" prop="name">
                  <el-input v-model="skuForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item :label="$t('产品备注') + ':'" prop="name">
                  <el-input v-model="skuForm.name" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place')"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="16">
                <el-form-item :label="$t('组合产品') + ':'" prop="name">
                  <el-radio-group v-model="skuForm.combination">
                    <el-radio :value="true">是</el-radio>
                    <el-radio :value="false">否</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="24" v-if="skuForm.combination">
                <el-form-item prop="name">
                  <el-button @click="SelectProduct">选择组合产品</el-button>
                  <el-table :data="combinationList" style="width: 100%">
                    <el-table-column prop="date" label="缩略图" />
                    <el-table-column prop="name" label="sku" />
                    <el-table-column prop="address" label="可售库存" />
                    <el-table-column prop="name" label="组合数量">
                      <template #default="scope">
                        <el-input-number v-model="scope.row.num" :disabled="disabled" clearable :placeholder="$t('place')"></el-input-number>
                      </template>
                    </el-table-column>
                    <el-table-column prop="address" label="产品名称" />
                    <el-table-column prop="address" label="总采购成本" />
                    <el-table-column prop="address" label="操作" />
                  </el-table>
                </el-form-item>
              </el-col>
              <div class="w-full border-b border-gray-300"></div>
              <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
                <span class="pr-2.5">Listing刊登模板</span>
                <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
              </div>
              <el-col :span="24">
                <el-button class="ml-11">添加刊登模板</el-button>
              </el-col>
              <el-col :span="24">
                <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
                  <el-tab-pane label="亚马逊" name="first">
                    <el-container>
                      <el-container>
                        <el-main class="flex justify-between">
                          <el-form :model="form" label-width="120px">
                            <el-form-item label="模板名称" required>
                              <el-input v-model="form.templateName" placeholder="请填写模板名称" class="!w-1/3"></el-input>
                            </el-form-item>
                            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
                              <span class="pr-2.5">站点类目</span>
                              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
                            </div>
                            <el-form-item label="站点">
                              <el-select v-model="form.site" class="!w-1/3" filterable placeholder="请选择">
                                <el-option label="美国" value="美国"></el-option>
                              </el-select>
                            </el-form-item>

                            <el-form-item label="刊登类型">
                              <el-radio-group v-model="form.listingType">
                                <el-radio label="单属性"></el-radio>
                                <el-radio label="多属性"></el-radio>
                              </el-radio-group>
                            </el-form-item>

                            <el-form-item label="刊登类别" required>
                              <el-cascader :options="options" :show-all-levels="false" class="!w-1/3" :props="{ multiple: true }" clearable />
                              <!--  <el-select v-model="form.category" placeholder="请先选择类别"></el-select> -->
                            </el-form-item>

                            <el-divider></el-divider>
                            <div class="text-base bg-transparent border-t-0 border-b-0 p-0 pl-3 ml-6 relative mb-5 mt-5">
                              <span class="pr-2.5">站点类目</span>
                              <div class="absolute left-0 top-0 w-1 h-full bg-[#a1d83e] rounded-md"></div>
                            </div>

                            <!-- <el-form-item label="快速填写">
                          <el-select v-model="form.quickFill" placeholder="请选择"></el-select>
                        </el-form-item> -->

                            <el-form-item label="亚马逊账号">
                              <el-select v-model="form.amazonAccount" class="!w-1/3" placeholder="请选择账号"></el-select>
                            </el-form-item>

                            <el-form-item label="标题" required>
                              <el-input type="textarea" v-model="form.title" placeholder="请输入" :autosize="{ minRows: 2, maxRows: 4 }"></el-input>
                            </el-form-item>

                            <el-form-item label="平台SKU">
                              <el-input v-model="form.sku" class="!w-1/3" placeholder="请输入"></el-input>
                            </el-form-item>
                            <el-form-item label="详细描述">
                              <div style="border: 1px solid #ccc">
                                <Toolbar style="border-bottom: 1px solid #ccc" :editor="editorRef" :defaultConfig="toolbarConfig" :mode="mode" />
                                <Editor
                                  style="height: 300px; overflow-y: hidden"
                                  v-model="form.content"
                                  :defaultConfig="editorConfig"
                                  :readOnly="editorReadonly || disabled"
                                  :mode="editorReadonly || disabled ? 'simple' : 'default'"
                                  @onCreated="handleCreated"
                                />
                              </div>
                            </el-form-item>
                            <el-form-item label="图片:">
                              <el-upload
                                class="avatar-uploader"
                                :action="uploadUrl"
                                :show-file-list="false"
                                :disabled="disabled"
                                :on-success="handleAvatarSuccess"
                                :before-upload="beforeAvatarUpload"
                              >
                                <img v-if="skuForm.image" :src="skuForm.image" class="avatar w-28 h-28" />
                                <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
                              </el-upload>
                            </el-form-item>
                            <el-form-item label="价格">
                              <el-input v-model="form.input" placeholder="请输入" class="!w-1/3" type="number" @input="handleInput">
                                <template #prepend>$</template>
                              </el-input>
                            </el-form-item>
                            <el-form-item label="设置促销价" required>
                              <el-radio-group v-model="form.isPromotion">
                                <el-radio :label="true">是</el-radio>
                                <el-radio :label="false">否</el-radio>
                              </el-radio-group>
                            </el-form-item>

                            <el-form-item label="促销价" required>
                              <el-input v-model="form.input" placeholder="请输入" class="!w-1/3" type="number" @input="handleInput">
                                <template #prepend>$</template>
                              </el-input>
                            </el-form-item>

                            <el-form-item label="促销时间" required :style="{ width: '45%' }">
                              <el-date-picker
                                v-model="form.promotionTime"
                                type="daterange"
                                start-placeholder="开始时间"
                                end-placeholder="结束时间"
                                range-separator="-"
                              ></el-date-picker>
                            </el-form-item>

                            <el-form-item label="销售计划" required>
                              <el-select v-model="form.salesPlan" class="!w-1/3" placeholder="请选择销售计划 (可多选)" multiple>
                                <el-option label="计划1" value="plan1"></el-option>
                                <el-option label="计划2" value="plan2"></el-option>
                                <!-- 添加更多选项 -->
                              </el-select>
                            </el-form-item>

                            <el-form-item label="是否UPC确免" required>
                              <el-select v-model="form.isUPCExempt" class="!w-1/3" placeholder="请选择">
                                <el-option label="是" value="yes"></el-option>
                                <el-option label="否" value="no"></el-option>
                              </el-select>
                            </el-form-item>

                            <el-form-item label="商品编码" required>
                              <el-select v-model="form.productCodeType" class="!w-1/6 mr-2.5" placeholder="UPC">
                                <el-option label="UPC" value="UPC"></el-option>
                                <el-option label="EAN" value="EAN"></el-option>
                              </el-select>
                              <el-input v-model="form.productCode" class="!w-5/12" placeholder="不填写则自动从商品编码池获取"></el-input>
                              <!--  <el-button type="text">商品编码池</el-button> -->
                            </el-form-item>

                            <el-form-item label="货运方式" required>
                              <el-select v-model="form.shippingMethod" class="!w-1/3" placeholder="自发">
                                <el-option label="自发" value="self"></el-option>
                                <el-option label="代发" value="proxy"></el-option>
                                <!-- 添加更多选项 -->
                              </el-select>
                            </el-form-item>

                            <el-form-item label="物品状况" required>
                              <el-select v-model="form.productCondition" class="!w-1/3" placeholder="New">
                                <el-option label="New" value="new"></el-option>
                                <el-option label="Used" value="used"></el-option>
                                <!-- 添加更多选项 -->
                              </el-select>
                            </el-form-item>

                            <el-form-item label="物品状况描述">
                              <el-input v-model="form.productConditionDescription" class="!w-1/3" placeholder="请输入"></el-input>
                            </el-form-item>

                            <el-form-item label="在线初始库存">
                              <el-input v-model="form.initialStock" class="!w-1/3" placeholder="请输入"></el-input>
                            </el-form-item>
                          </el-form>
                        </el-main>
                      </el-container>
                    </el-container>
                  </el-tab-pane>
                </el-tabs>
              </el-col>
            </el-row>
            <!--  <el-row>
          <el-col :span="10">
            <el-form-item :label="$t('goods_name') + ':'" prop="name">
              <el-input
                v-model="skuForm.name"
                :minlength="2"
                :maxlength="20"
                :disabled="disabled"
                clearable
                :placeholder="$t('place') + $t('goods_name')"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item :label="$t('goods_brand') + ':'" prop="brand">
              <el-input
                v-model="skuForm.brand"
                :minlength="2"
                :maxlength="20"
                :disabled="disabled"
                clearable
                :placeholder="$t('place') + $t('goods_brand')"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item :label="$t('goods_bar_code') + ':'" prop="bar_code">
              <el-input
                v-model="skuForm.bar_code"
                :minlength="2"
                :maxlength="20"
                :disabled="disabled"
                clearable
                :placeholder="$t('place') + $t('goods_bar_code')"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="sku:" prop="sku">
              <el-input v-model="skuForm.sku" :minlength="2" :maxlength="20" :disabled="disabled" clearable :placeholder="$t('place') + 'sku'"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item :label="$t('goods_weight') + ':'" prop="weight">
              <el-input
                v-model="skuForm.weight"
                :minlength="2"
                :maxlength="20"
                :disabled="disabled"
                clearable
                :placeholder="$t('place') + $t('goods_weight')"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item :label="$t('goods_unit') + ':'" prop="unit">
              <el-input
                v-model="skuForm.unit"
                :minlength="2"
                :maxlength="20"
                :disabled="disabled"
                clearable
                :placeholder="$t('place') + $t('goods_unit')"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item :label="$t('goods_image') + ':'" prop="image">
              <el-upload
                class="avatar-uploader"
                :action="uploadUrl"
                :show-file-list="false"
                :disabled="disabled"
                :on-success="handleAvatarSuccess"
                :before-upload="beforeAvatarUpload"
              >
                <img v-if="skuForm.image" :src="skuForm.image" class="avatar w-28 h-28" />
                <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
              </el-upload>
            </el-form-item>
          </el-col>
        </el-row> -->
          </el-form>
          <template #footer>
            <div class="dialog-footer">
              <el-button @click="dialogVisible = false">{{ $t('cancel') }}</el-button>
              <el-button type="primary" @click="submitWarehouseForm">{{ $t('submit') }}</el-button>
            </div>
          </template>
        </el-tab-pane>
      </el-tabs>
    </el-dialog>
    <!-- 选择产品弹窗 -->
    <el-dialog
      :title="$t('goods_info')"
      v-model="goodsVisible"
      width="1000px"
      :modal-append-to-body="false"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      @close="closeGoosData"
      class="!rounded-lg"
    >
      <div style="display: flex; align-items: center; justify-content: flex-end; padding: 10px 0">
        <span>{{ $t('search') + $t('goods_info') }}:</span><el-input v-model="goodsKeyWord" style="width: 200px; margin-right: 5px"></el-input>
        <el-button @click="searchGoodEvent"> {{ $t('search') }} </el-button>
      </div>
      <el-table :data="goodsData.records" border style="width: 100%" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="product_vo.name" :label="$t('goods_name')"></el-table-column>
        <el-table-column prop="product_vo.sku" label="sku"> </el-table-column>
        <el-table-column prop="" :label="$t('brand')">
          <template #default="scope">
            {{ scope.row.product_vo.brand }}
          </template>
        </el-table-column>
        <el-table-column prop="product_vo.weight" :label="$t('weight')"> </el-table-column>
        <el-table-column prop="product_vo.unit" :label="$t('goods_unit')"> </el-table-column>
      </el-table>
      <el-pagination
        @size-change="goodsPageSizeChange"
        @current-change="goodsPageCurrentChange"
        :current-page="goodsData.current"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="goodsData.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="goodsData.total"
      >
      </el-pagination>
      <template #footer>
        <el-button @click="closeGoosData">{{ $t('cancel') }}</el-button>
        <el-button type="primary" @click="submitGoosData()">{{ $t('submit') }}</el-button>
      </template>
    </el-dialog>
    <!-- 设置库存托管 -->
    <el-dialog :title="$t('设置库存托管')" v-model="skuForm.sale" :modal-append-to-body="false" :close-on-click-modal="false" :close-on-press-escape="false">
      <p>了解自动补货与库存同步的区别 库存问题自检</p>
      <div class="my-5">
        <el-radio-group v-model="radioType" size="small">
          <el-radio-button label="整体设置" value="first" />
          <el-radio-button label="按每个子sku设置" value="second" />
        </el-radio-group>
      </div>
      <el-form :model="overallForm" v-if="radioType == 'first'">
        <el-form-item :label="$t('自动补货') + ':'">
          <el-radio-group v-model="overallForm.reple" class="vertical-radio-group">
            <el-radio :value="3">买几个补几个</el-radio>
            <el-radio :value="6">库存补至<el-input v-model="overallForm.num" style="width: 50px" /></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item :label="$t('库存同步') + ':'">
          <el-radio-group v-model="overallForm.Inventory" class="vertical-radio-group">
            <el-radio :value="3">同步可售库存到线上</el-radio>
            <el-radio :value="6">同步锁定库存<el-input v-model="overallForm.num" style="width: 50px" />到线上</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <div v-else>
        <el-button class="mb-1">批量修改</el-button>
        <el-table :data="goodsSkuData" border style="width: 100%" @selection-change="handgoodsSkuData">
          <el-table-column type="selection" width="55" />
          <el-table-column prop="product_vo.name" :label="$t('goods_image')"></el-table-column>
          <el-table-column prop="product_vo.sku" label="sku"></el-table-column>
          <el-table-column prop="" :label="$t('库存托管')"></el-table-column>
          <el-table-column prop="product_vo.weight" :label="$t('可售库存')"> </el-table-column>
          <el-table-column prop="product_vo.unit" :label="$t('operate')"> </el-table-column>
        </el-table>
      </div>
    </el-dialog>
    <!-- 添加1688配对 -->
    <el-dialog title="添加1688配对" v-model="pairingVisible" :modal-append-to-body="false" :close-on-click-modal="false" :close-on-press-escape="false">
      <el-form :model="pairingForm" label-width="140px">
        <el-form-item label="配对方式:">
          <el-radio-group v-model="pairingForm.pairingType">
            <el-radio value="ordinary">为单属性SKU匹配</el-radio>
            <el-radio value="materials">查找其他兄弟SKU,批量完成匹</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="商品链接:">
          <el-input v-model="pairingForm.input" placeholder="请填写" class="!w-1/3"></el-input>
        </el-form-item>
        <el-form-item label="供应商名称:">
          <el-select v-model="pairingForm.company_package_id" clearable placeholder="请选择" class="!w-1/3">
            <el-option v-for="item in productClassList" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button>解析产品</el-button>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="pairingVisible = false">取 消</el-button>
          <el-button type="primary" @click="submitPairing">保存</el-button>
        </div>
      </template>
    </el-dialog>
    <!-- <el-dialog title="续费" v-model="renewVisible" :modal-append-to-body="false" width="450px" :close-on-click-modal="false" :close-on-press-escape="false">
        <el-form :model="packageForm" :rules="stockRules" ref="packageFormRef" label-width="140px">
          <el-form-item label="套餐:" prop="company_package_id">
            <el-select v-model="packageForm.company_package_id" clearable placeholder="请选择套餐">
              <el-option v-for="item in packageList" :key="item.id" :label="item.name" :value="item.id" />
            </el-select>
          </el-form-item>
        </el-form>
        <template #footer>
          <div class="dialog-footer">
            <el-button @click="renewVisible = false">取 消</el-button>
            <el-button type="primary" @click="submitPackageForm">确 定</el-button>
          </div>
        </template>
      </el-dialog> -->
  </div>
</template>
      
      <script lang="ts" setup>
import { ref, onMounted, shallowRef } from 'vue';
import { useStore } from 'vuex';
import { ElMessageBox, FormInstance, ElMessage } from 'element-plus';
import * as API_BasicSetting from '@/api/basicSetting';
import * as API_Setting from '@/api/setting';
import * as API_Company from '@/api/company';
import * as API_Goods from '@/api/goods';
import Storage from '@/utils/storage';
import router from '@/router';
import { provinceAndCityData, pcTextArr, regionData, pcaTextArr, codeToText } from 'element-china-area-data';
import { Plus } from '@element-plus/icons-vue';
import type { UploadProps } from 'element-plus';
import { createEditor, createToolbar, IEditorConfig, IDomEditor } from '@wangeditor/editor';
import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
import '@wangeditor/editor/dist/css/style.css';
import { useI18n } from 'vue-i18n';
import { Search } from '@element-plus/icons-vue';

const { t } = useI18n();

const handleAvatarSuccess: UploadProps['onSuccess'] = (response, uploadFile) => {
  console.log(response, uploadFile);
  skuForm.value.image = response.url; //URL.createObjectURL(uploadFile.raw!);
};

const uploadUrl = ref(import.meta.env.VITE_API_URL + '/uploaders');
const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile) => {
  if (rawFile.size / 1024 / 1024 > 10) {
    ElMessage.error('Avatar picture size can not exceed 10MB!');
    return false;
  }
  return true;
};
/* 商品配对 */
const pairingVisible = ref(false);
const pairingForm = ref<any>({});
/* 添加配对 */
const addPairing=()=>{
  pairingVisible.value=true
}
/* 商品配对保存 */
const submitPairing=()=>{

}
/* 库存托管 */
const custodyVisible = ref(false);
const radioType = ref('first');
const overallForm = ref({
  reple: '',
  num: '',
  Inventory: '',
});
const handgoodsSkuData = () => {};
/* sku表格 */
const goodsSkuData = ref([]);
/* 选择商品 */
const goodsVisible = ref(false);
const goodsKeyWord = ref('');
const goodsData = ref<any>({});
/* 选中的商品列表 */
const goodsList = ref([]);
const handleSelectionChange = (val) => {
  goodsList.value = val.map((el) => {
    return el;
  });
};
const SelectProduct = () => {
  goodsVisible.value = true;
};
/* 搜索商品 */
const searchGoodEvent = () => {};
/* 选择商品分页 */
const goodsParams = ref<any>({
  page_size: '1',
  page_no: '10',
});
const goodsPageSizeChange = (size) => {
  goodsParams.value.page_size = size;
  searchGoodEvent();
};

const goodsPageCurrentChange = (page) => {
  goodsParams.value.page_no = page;
  searchGoodEvent();
};
/* 选择商品确认 */
const submitGoosData = () => {
  if (goodsList.value.length >= 1) {
    /*  goodsExchangeAddForm.value.product_list = goodsList.value.map((el) => {
      return el;
    }); */
    goodsVisible.value = false;
  } else {
    ElMessage.error(t('change') + t('goods_info') + '!');
  }
};
/* 关闭商品窗口 */
const closeGoosData = () => {
  goodsVisible.value = false;
};
/* 富文本编辑器 */
const editorReadonly = ref(false);
const editorRef = shallowRef();
const mode = ref('default');
const toolbarConfig = {};
const editorConfig = {
  placeholder: t('place') + '...',
  readOnly: editorReadonly.value,
};
const handleCreated = (editor: IDomEditor) => {
  editorRef.value = editor; // 记录 editor 实例，重要！
};
/*  */
const handleInput = (value: string) => {
  const formattedValue = value.replace(/[^0-9.]/g, ''); // 只允许数字和小数点
  const parts = formattedValue.split('.');
  if (parts.length > 2) {
    form.value.input = parts[0] + '.' + parts.slice(1).join('').substring(0, 2);
  } else if (parts.length === 2) {
    form.value.input = parts[0] + '.' + parts[1].substring(0, 2);
  } else {
    form.value.input = formattedValue;
  }
};

/* 组合产品 */
const combinationList = ref([]);
/* tab标签 */
const activeName = ref('first');
const handleClick = () => {};
/* 库存信息 */
const productForm = ref<any>({});
/* 添加产品 */
const activeProduct = ref('first');
const handleProductClick = () => {};
/* 模板 */
const activeTab = ref();
const form = ref<any>({});

/* 锚点 */
const anchors = ref([
  { id: 'site-category', label: '站点类别', active: true },
  { id: 'basic-info', label: '基本信息', active: false },
  { id: 'product-attributes', label: '产品属性', active: false },
]);

const store = useStore();
const tableData = ref<any>({});
const loading = ref(false);
const dialogVisible = ref(false);
const skuForm = ref<any>({
  name: '',
  brand: '',
  snCode: '',
  bar_code: '',
  sku: '',
  weight: '',
  image: '',
  unit: '',
  combination: false,
});
const stockRules = ref<any>({
  name: [{ required: true, message: t('place') + t('goods_name') + '!', trigger: 'blur' }],
  brand: [{ required: true, message: t('place') + t('goods_brand') + '!', trigger: 'blur' }],
  snCode: [{ required: true, message: '请输入商品序列号!', trigger: 'blur' }],
  bar_code: [{ required: true, message: t('place') + t('goods_bar_code') + '!', trigger: 'blur' }],
  sku: [{ required: true, message: t('place') + 'sku!', trigger: 'blur' }],
  weight: [{ required: true, message: t('place') + t('goods_weight') + '!', trigger: 'blur' }],
  postal_code: [{ required: true, message: t('place') + t('goods_unit') + '!', trigger: 'blur' }],
  image: [{ required: true, message: t('place') + t('goods_image') + '!', trigger: 'blur' }],
});
const selectedOptions = ref<any[]>([]);
const marketingList = ref<any[]>([]);
const options = ref<any[]>(regionData);
const params = ref({
  data: [],
  page_no: 1,
  page_size: 10,
  keyword: '',
  company_id: store.state.companId,
});
const roleArray = ref<any[]>([]);
const disabled = ref(false);

const renewVisible = ref(false);
/* 套餐 */
const packageForm = ref<any>({
  company_package_id: '',
  this_money: '',
});
let packageId = ref('');
let companyId = ref('');
const packageFormRef = ref();
/* 商品分类列表 */
const productClassList = ref<any>([]);
/* 标签列表 */
const labelList = ref<any>([]);
const setActiveAnchor = (index) => {
  anchors.value.forEach((anchor, i) => {
    anchor.active = i === index;
  });
};

const handleBranch = (index: number, row: any) => {
  router.push({ name: 'branch' });
};

/* 续费 */
const handleRenew = (index: number, row: any) => {
  packageForm.value.company_package_id = row.company_package_id;
  companyId.value = row.id;
  packageId.value = row.company_package_id;
  API_Company.companyPackage(row.company_package_id).then((res) => {
    packageForm.value.this_money = res.money;
    renewVisible.value = true;
  });
};
const skuFormRef = ref();
const checkPermission = (permissions: string[]): boolean => {
  // Implement your permission check logic here
  return true;
};

const handleAddWarehouse = () => {
  selectedOptions.value = [];
  skuForm.value = {
    combination: false,
  };
  disabled.value = false;
  dialogVisible.value = true;
};

const handleEditWarehouse = (index: number, row: any) => {
  skuForm.value = { ...row };
  disabled.value = false;
  selectedOptions.value = row.province;
  dialogVisible.value = true;
};

const searchEvent = (keyword: string) => {
  params.value = {
    ...params.value,
    keyword: keyword,
  };
  params.value.page_no = 1;
  GET_GoodsList();
};

const handlePageSizeChange = (size: number) => {
  params.value.page_size = size;
  GET_GoodsList();
};

const handlePageCurrentChange = (page: number) => {
  params.value.page_no = page;
  GET_GoodsList();
};

const handleDialogOpen = () => {
  setTimeout(() => {
    skuFormRef.value.clearValidate();
  });
};

const submitWarehouseForm = () => {
  skuFormRef.value.validate((valid: boolean) => {
    if (valid) {
      const { id } = skuForm.value;
      const params = { ...skuForm.value };
      if (id) {
        API_Goods.editProduct(id, params).then(() => {
          dialogVisible.value = false;
          ElMessage.success(t('edit_success') + '!');
          GET_GoodsList();
        });
      } else {
        API_Goods.addProduct(params).then(() => {
          dialogVisible.value = false;
          ElMessage.success(t('add_success') + '!');
          GET_GoodsList();
        });
      }
    } else {
      ElMessage.error(t('form_erroe') + '!');
      /*    store.dispatch('showMessage', { message: '表单填写有误，请核对！', type: 'error' }); */
      return false;
    }
  });
};

const GET_GoodsList = () => {
  loading.value = true;
  API_Goods.productList(params.value)
    .then((response) => {
      loading.value = false;
      tableData.value = response;
    })
    .catch(() => {
      loading.value = false;
    });
};

/* 删除 */
const handleDelGoods = (row) => {
  ElMessageBox.confirm(t('del_info'), t('prompt'), { type: 'warning' })
    .then(() => {
      API_Goods.delProduct(row.id).then(() => {
        ElMessage.success(t('del_success') + '!');
        GET_GoodsList();
      });
    })
    .catch(() => {});
};
const adminName = (val: string[]) => {
  let text = '';
  if (val !== undefined) {
    text += codeToText[val[0]];
    text += codeToText[val[1]];
    text += codeToText[val[2]];
  }
  return text;
};

/* 切换菜单 */

const handleView = (row) => {
  skuForm.value = { ...row };
  disabled.value = true;
  dialogVisible.value = true;
};

onMounted(() => {
  GET_GoodsList();
  /*  GET_MarketingList();
  GET_PackageList(); */
});
</script>
  <style>
.avatar-uploader .el-upload {
  border: 1px dashed var(--el-border-color);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--el-transition-duration-fast);
}

.avatar-uploader .el-upload:hover {
  border-color: var(--el-color-primary);
}

.el-icon.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 112px;
  height: 112px;
  text-align: center;
}
.vertical-radio-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 10px; /* 可选：增加间距 */
}
</style>
  