|
@@ -16,25 +16,19 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="商品品牌" prop="brandName">
|
|
|
|
|
|
|
+ <el-form-item label="商品品牌" prop="brandId">
|
|
|
<el-select
|
|
<el-select
|
|
|
- v-model="queryParams.brandName"
|
|
|
|
|
|
|
+ v-model="queryParams.brandId"
|
|
|
placeholder="请输入品牌名称搜索"
|
|
placeholder="请输入品牌名称搜索"
|
|
|
filterable
|
|
filterable
|
|
|
remote
|
|
remote
|
|
|
clearable
|
|
clearable
|
|
|
:remote-method="handleBrandSearch"
|
|
:remote-method="handleBrandSearch"
|
|
|
:loading="brandLoading"
|
|
:loading="brandLoading"
|
|
|
- value-key="brandName"
|
|
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
@keyup.enter="handleQuery"
|
|
@keyup.enter="handleQuery"
|
|
|
>
|
|
>
|
|
|
- <el-option
|
|
|
|
|
- v-for="item in brandOptions"
|
|
|
|
|
- :key="item.id"
|
|
|
|
|
- :label="item.brandName"
|
|
|
|
|
- :value="item.brandName"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <el-option v-for="item in brandOptions" :key="item.id" :label="item.brandName" :value="item.id" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -45,39 +39,35 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
|
- <el-col :span="6">
|
|
|
|
|
- <el-form-item label="商品分类" prop="bottomCategoryId">
|
|
|
|
|
- <el-tree-select
|
|
|
|
|
- v-model="queryParams.bottomCategoryId"
|
|
|
|
|
- :data="categoryOptions"
|
|
|
|
|
- :props="{ value: 'id', label: 'label', children: 'children' } as any"
|
|
|
|
|
- value-key="id"
|
|
|
|
|
- placeholder="请选择商品分类"
|
|
|
|
|
- clearable
|
|
|
|
|
- check-strictly
|
|
|
|
|
- />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="是否自营" prop="isSelf">
|
|
<el-form-item label="是否自营" prop="isSelf">
|
|
|
<el-select v-model="queryParams.isSelf" placeholder="请选择" clearable>
|
|
<el-select v-model="queryParams.isSelf" placeholder="请选择" clearable>
|
|
|
- <el-option label="是" value="1" />
|
|
|
|
|
- <el-option label="否" value="0" />
|
|
|
|
|
|
|
+ <el-option label="是" :value="1" />
|
|
|
|
|
+ <el-option label="否" :value="0" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
+<!-- <el-col :span="6">-->
|
|
|
|
|
+<!-- <el-form-item label="审核状态" prop="productReviewStatus">-->
|
|
|
|
|
+<!-- <el-select v-model="queryParams.productReviewStatus" placeholder="请选择" clearable>-->
|
|
|
|
|
+<!-- <el-option label="待采购审核" value="0" />-->
|
|
|
|
|
+<!-- <el-option label="审核通过" value="1" />-->
|
|
|
|
|
+<!-- <el-option label="驳回" value="2" />-->
|
|
|
|
|
+<!-- <el-option label="待营销审核" value="3" />-->
|
|
|
|
|
+<!-- </el-select>-->
|
|
|
|
|
+<!-- </el-form-item>-->
|
|
|
|
|
+<!-- </el-col>-->
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="审核状态" prop="productReviewStatus">
|
|
|
|
|
- <el-select v-model="queryParams.productReviewStatus" placeholder="请选择" clearable>
|
|
|
|
|
- <el-option label="待采购审核" value="0" />
|
|
|
|
|
- <el-option label="审核通过" value="1" />
|
|
|
|
|
- <el-option label="驳回" value="2" />
|
|
|
|
|
- <el-option label="待营销审核" value="3" />
|
|
|
|
|
|
|
+ <el-form-item label="上下架状态" prop="productStatus">
|
|
|
|
|
+ <el-select v-model="queryParams.productStatus" placeholder="请选择" clearable>
|
|
|
|
|
+ <el-option label="已上架" :value="1" />
|
|
|
|
|
+ <el-option label="下架" :value="0" />
|
|
|
|
|
+ <el-option label="上架中" :value="2" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="上下架状态" prop="productStatus">
|
|
|
|
|
|
|
+ <el-form-item label="商品类型" prop="productStatus">
|
|
|
<el-select v-model="queryParams.productStatus" placeholder="请选择" clearable>
|
|
<el-select v-model="queryParams.productStatus" placeholder="请选择" clearable>
|
|
|
<el-option label="已上架" :value="1" />
|
|
<el-option label="已上架" :value="1" />
|
|
|
<el-option label="下架" :value="0" />
|
|
<el-option label="下架" :value="0" />
|
|
@@ -86,8 +76,18 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
- <el-row>
|
|
|
|
|
- <el-col :span="24" class="text-left">
|
|
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+ <el-col :span="18">
|
|
|
|
|
+ <el-form-item label="商品分类">
|
|
|
|
|
+ <category-cascade-select
|
|
|
|
|
+ ref="categoryCascadeRef"
|
|
|
|
|
+ v-model:top-category-id="queryParams.topCategoryId"
|
|
|
|
|
+ v-model:medium-category-id="queryParams.mediumCategoryId"
|
|
|
|
|
+ v-model:bottom-category-id="queryParams.bottomCategoryId"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="6" class="text-left" style="display: flex; align-items: center; padding-bottom: 18px">
|
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -106,12 +106,21 @@
|
|
|
>条</span
|
|
>条</span
|
|
|
>
|
|
>
|
|
|
<span class="mx-2">【上架/总数({{ statistics.onSale || 0 }}/{{ statistics.total || 0 }})】</span>
|
|
<span class="mx-2">【上架/总数({{ statistics.onSale || 0 }}/{{ statistics.total || 0 }})】</span>
|
|
|
- <span class="mx-2">审核状态: 待审核<span class="text-red-600">{{ statistics.waitAudit || 0 }}</span>条,通过<span class="text-green-600">{{ statistics.auditPass || 0 }}</span>条,驳回<span class="text-orange-600">{{ statistics.auditReject || 0 }}</span>条</span>
|
|
|
|
|
- <span class="mx-2">上下架状态: 已上架<span class="text-green-600">{{ statistics.onSale || 0 }}</span>条,下架<span class="text-gray-600">{{ statistics.offSale || 0 }}</span>条</span>
|
|
|
|
|
|
|
+ <span class="mx-2"
|
|
|
|
|
+ >审核状态: 待审核<span class="text-red-600">{{ statistics.waitAudit || 0 }}</span
|
|
|
|
|
+ >条,通过<span class="text-green-600">{{ statistics.auditPass || 0 }}</span
|
|
|
|
|
+ >条,驳回<span class="text-orange-600">{{ statistics.auditReject || 0 }}</span
|
|
|
|
|
+ >条</span
|
|
|
|
|
+ >
|
|
|
|
|
+ <span class="mx-2"
|
|
|
|
|
+ >上下架状态: 已上架<span class="text-green-600">{{ statistics.onSale || 0 }}</span
|
|
|
|
|
+ >条,下架<span class="text-gray-600">{{ statistics.offSale || 0 }}</span
|
|
|
|
|
+ >条</span
|
|
|
|
|
+ >
|
|
|
<div class="ml-auto flex gap-2">
|
|
<div class="ml-auto flex gap-2">
|
|
|
- <el-button type="primary" icon="Plus" @click="handleAdd">商品新增</el-button>
|
|
|
|
|
- <el-button type="warning" icon="Check" @click="handleGoReview">商品审核</el-button>
|
|
|
|
|
- <el-button plain>批量操作</el-button>
|
|
|
|
|
|
|
+<!-- <el-button type="primary" icon="Plus" @click="handleAdd">商品新增</el-button>-->
|
|
|
|
|
+ <!-- <el-button type="warning" icon="Check" @click="handleGoReview">商品审核</el-button> -->
|
|
|
|
|
+ <!-- <el-button plain>批量操作</el-button>-->
|
|
|
<el-button plain icon="Download" @click="handleExport">导出</el-button>
|
|
<el-button plain icon="Download" @click="handleExport">导出</el-button>
|
|
|
<el-button circle icon="Refresh" @click="getList"></el-button>
|
|
<el-button circle icon="Refresh" @click="getList"></el-button>
|
|
|
</div>
|
|
</div>
|
|
@@ -136,12 +145,19 @@
|
|
|
<div class="text-left">
|
|
<div class="text-left">
|
|
|
<div style="white-space: normal; word-break: break-all; line-height: 1.4">{{ scope.row.itemName }}</div>
|
|
<div style="white-space: normal; word-break: break-all; line-height: 1.4">{{ scope.row.itemName }}</div>
|
|
|
<div class="text-gray-500" style="font-size: 12px">品牌: {{ scope.row.brandName || '-' }}</div>
|
|
<div class="text-gray-500" style="font-size: 12px">品牌: {{ scope.row.brandName || '-' }}</div>
|
|
|
|
|
+ <div class="text-gray-500" style="font-size: 12px">分类: {{ scope.row.topCategoryName+'-'+scope.row.mediumCategoryName+'-'+ scope.row.bottomCategoryName}}</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="商品分类" align="center" prop="categoryName" width="120" />
|
|
|
|
|
- <el-table-column label="单位" align="center" prop="unitName" width="60" />
|
|
|
|
|
- <el-table-column label="SKU价格" align="center" width="120">
|
|
|
|
|
|
|
+ <el-table-column label="单位" align="center" width="100">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div class="text-left">
|
|
|
|
|
+ <div class="text-gray-500" style="font-size: 12px">单位: {{ scope.row.unitName || '-' }}</div>
|
|
|
|
|
+ <div class="text-gray-500" style="font-size: 12px">起订量: {{ scope.row.minOrderQuantity || '-' }}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="价格信息" align="center" width="120">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<div class="text-left" style="font-size: 12px">
|
|
<div class="text-left" style="font-size: 12px">
|
|
|
<div>
|
|
<div>
|
|
@@ -149,7 +165,7 @@
|
|
|
<span class="text-red-500">¥{{ scope.row.marketPrice || '0.00' }}</span>
|
|
<span class="text-red-500">¥{{ scope.row.marketPrice || '0.00' }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div>
|
|
<div>
|
|
|
- <span class="text-gray-500">会员价:</span>
|
|
|
|
|
|
|
+ <span class="text-gray-500">官网价:</span>
|
|
|
<span class="text-red-500">¥{{ scope.row.memberPrice || '0.00' }}</span>
|
|
<span class="text-red-500">¥{{ scope.row.memberPrice || '0.00' }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div>
|
|
<div>
|
|
@@ -159,7 +175,8 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="成本情况" align="center" width="150">
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <el-table-column label="采购信息" align="center" width="150">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<div class="text-left" style="font-size: 12px">
|
|
<div class="text-left" style="font-size: 12px">
|
|
|
<div>
|
|
<div>
|
|
@@ -168,32 +185,50 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div>
|
|
<div>
|
|
|
<span class="text-gray-500">暂估毛利率:</span>
|
|
<span class="text-gray-500">暂估毛利率:</span>
|
|
|
- <span>{{ scope.row.tempGrossMargin || '0.0000' }}%</span>
|
|
|
|
|
|
|
+ <span>{{ scope.row.memberPrice ? (((scope.row.memberPrice - (scope.row.purchasingPrice || 0)) / scope.row.memberPrice) * 100).toFixed(2) : '0.00' }}%</span>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="数据来源" align="center" prop="dataSource" width="80">
|
|
|
|
|
|
|
+ <el-table-column label="库存情况" align="center" width="140">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <span>{{ scope.row.dataSource || '-' }}</span>
|
|
|
|
|
|
|
+ <div class="text-left" style="font-size: 12px">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span class="text-gray-500">总库存:</span>
|
|
|
|
|
+ <span>{{ scope.row.totalInventory ?? '-' }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span class="text-gray-500">可用库存:</span>
|
|
|
|
|
+ <span>{{ scope.row.nowInventory ?? '-' }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span class="text-gray-500">虚拟库存:</span>
|
|
|
|
|
+ <span>{{ scope.row.virtualInventory ?? '-' }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+<!-- <el-table-column label="数据来源" align="center" prop="dataSource" width="80">-->
|
|
|
|
|
+<!-- <template #default="scope">-->
|
|
|
|
|
+<!-- <span>{{ scope.row.dataSource || '-' }}</span>-->
|
|
|
|
|
+<!-- </template>-->
|
|
|
|
|
+<!-- </el-table-column>-->
|
|
|
<el-table-column label="是否自营" align="center" width="80">
|
|
<el-table-column label="是否自营" align="center" width="80">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <el-tag v-if="scope.row.isSelf === 1" type="success">是</el-tag>
|
|
|
|
|
- <el-tag v-else-if="scope.row.isSelf === 0" type="info">否</el-tag>
|
|
|
|
|
- <span v-else>-</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column label="审核状态" align="center" prop="productReviewStatus" width="90">
|
|
|
|
|
- <template #default="scope">
|
|
|
|
|
- <span v-if="scope.row.productReviewStatus === 0">待采购审核</span>
|
|
|
|
|
- <span v-else-if="scope.row.productReviewStatus === 1">审核通过</span>
|
|
|
|
|
- <span v-else-if="scope.row.productReviewStatus === 2">驳回</span>
|
|
|
|
|
- <span v-else-if="scope.row.productReviewStatus === 3">待营销审核</span>
|
|
|
|
|
|
|
+ <span v-if="scope.row.isSelf === 1">是</span>
|
|
|
|
|
+ <span v-else-if="scope.row.isSelf === 0">否</span>
|
|
|
<span v-else>-</span>
|
|
<span v-else>-</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+<!-- <el-table-column label="审核状态" align="center" prop="productReviewStatus" width="90">-->
|
|
|
|
|
+<!-- <template #default="scope">-->
|
|
|
|
|
+<!-- <span v-if="scope.row.productReviewStatus === 0">待采购审核</span>-->
|
|
|
|
|
+<!-- <span v-else-if="scope.row.productReviewStatus === 1">审核通过</span>-->
|
|
|
|
|
+<!-- <span v-else-if="scope.row.productReviewStatus === 2">驳回</span>-->
|
|
|
|
|
+<!-- <span v-else-if="scope.row.productReviewStatus === 3">待营销审核</span>-->
|
|
|
|
|
+<!-- <span v-else>-</span>-->
|
|
|
|
|
+<!-- </template>-->
|
|
|
|
|
+<!-- </el-table-column>-->
|
|
|
<el-table-column label="上下架状态" align="center" prop="productStatus" width="100">
|
|
<el-table-column label="上下架状态" align="center" prop="productStatus" width="100">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<el-tag v-if="scope.row.productStatus === 1" type="success">已上架</el-tag>
|
|
<el-tag v-if="scope.row.productStatus === 1" type="success">已上架</el-tag>
|
|
@@ -202,42 +237,25 @@
|
|
|
<el-tag v-else type="info">未知</el-tag>
|
|
<el-tag v-else type="info">未知</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" width="150" fixed="right">
|
|
|
|
|
- <template #default="scope">
|
|
|
|
|
- <!-- 待审核状态:只显示编辑 -->
|
|
|
|
|
- <div v-if="scope.row.productReviewStatus !== 1" class="flex gap-1 justify-center">
|
|
|
|
|
- <el-link type="primary" :underline="false" @click="handleUpdate(scope.row)">编辑</el-link>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 审核通过 -->
|
|
|
|
|
- <div v-else-if="scope.row.productReviewStatus === 1" class="flex flex-col gap-1">
|
|
|
|
|
- <!-- 下架状态:编辑、上架、停售、修改库存 -->
|
|
|
|
|
- <div v-if="scope.row.productStatus === 0" class="flex gap-1 justify-center">
|
|
|
|
|
- <el-link type="primary" :underline="false" @click="handleUpdate(scope.row)">编辑</el-link>
|
|
|
|
|
- <el-link type="success" :underline="false" @click="handleShelf(scope.row)">上架</el-link>
|
|
|
|
|
- <el-link type="danger" :underline="false" @click="handleDiscontinue(scope.row)">停售</el-link>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div v-if="scope.row.productStatus === 0" class="flex gap-1 justify-center">
|
|
|
|
|
- <el-link type="primary" :underline="false" @click="handleSupply(scope.row)">修改库存</el-link>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 上架状态:编辑、下架、停售、修改库存 -->
|
|
|
|
|
- <div v-else-if="scope.row.productStatus === 1" class="flex gap-1 justify-center">
|
|
|
|
|
- <el-link type="primary" :underline="false" @click="handleUpdate(scope.row)">编辑</el-link>
|
|
|
|
|
- <el-link type="warning" :underline="false" @click="handleShelf(scope.row)">下架</el-link>
|
|
|
|
|
- <el-link type="danger" :underline="false" @click="handleDiscontinue(scope.row)">停售</el-link>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div v-else-if="scope.row.productStatus === 1" class="flex gap-1 justify-center">
|
|
|
|
|
- <el-link type="primary" :underline="false" @click="handleSupply(scope.row)">修改库存</el-link>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 其他状态(待提交、审核驳回等):显示编辑 -->
|
|
|
|
|
- <div v-else class="flex gap-1 justify-center">
|
|
|
|
|
- <el-link type="primary" :underline="false" @click="handleUpdate(scope.row)">编辑</el-link>
|
|
|
|
|
- </div>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
|
+<!-- <el-table-column label="操作" align="center" width="150" fixed="right">-->
|
|
|
|
|
+<!-- <template #default="scope">-->
|
|
|
|
|
+<!-- <!– 其他状态(待提交、审核驳回等):显示编辑 –>-->
|
|
|
|
|
+<!-- <div class="flex gap-1 justify-center">-->
|
|
|
|
|
+<!-- <el-link type="primary" :underline="false" @click="handleUpdate(scope.row)">编辑</el-link>-->
|
|
|
|
|
+<!-- </div>-->
|
|
|
|
|
+<!-- <div class="flex gap-1 justify-center">-->
|
|
|
|
|
+<!-- <el-link type="primary" :underline="false" @click="handleSupply(scope.row)">修改库存</el-link>-->
|
|
|
|
|
+<!-- </div>-->
|
|
|
|
|
+<!-- <div v-if="scope.row.productStatus === 0" class="flex gap-1 justify-center">-->
|
|
|
|
|
+<!-- <el-link type="success" :underline="false" @click="handleShelf(scope.row)">上架</el-link>-->
|
|
|
|
|
+<!-- <el-link type="danger" :underline="false" @click="handleDiscontinue(scope.row)">停售</el-link>-->
|
|
|
|
|
+<!-- </div>-->
|
|
|
|
|
+<!-- <div v-if="scope.row.productStatus === 1" class="flex gap-1 justify-center">-->
|
|
|
|
|
+<!-- <el-link type="warning" :underline="false" @click="handleShelf(scope.row)">下架</el-link>-->
|
|
|
|
|
+<!-- <el-link type="danger" :underline="false" @click="handleDiscontinue(scope.row)">停售</el-link>-->
|
|
|
|
|
+<!-- </div>-->
|
|
|
|
|
+<!-- </template>-->
|
|
|
|
|
+<!-- </el-table-column>-->
|
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
|
|
|
<!-- 游标分页控制 -->
|
|
<!-- 游标分页控制 -->
|
|
@@ -251,15 +269,48 @@
|
|
|
@pagination="getList"
|
|
@pagination="getList"
|
|
|
/>
|
|
/>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
|
|
+ <!-- 库存修改弹框 -->
|
|
|
|
|
+ <el-dialog v-model="inventoryDialog.visible" title="修改库存" width="500px" :close-on-click-modal="false">
|
|
|
|
|
+ <div v-loading="inventoryDialog.loading">
|
|
|
|
|
+ <el-form ref="inventoryFormRef" :model="inventoryForm" :rules="inventoryRules" label-width="110px">
|
|
|
|
|
+ <el-form-item label="虚拟库存" prop="virtualInventory">
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="inventoryForm.virtualInventory"
|
|
|
|
|
+ :min="0"
|
|
|
|
|
+ :precision="0"
|
|
|
|
|
+ controls-position="right"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ placeholder="请输入虚拟库存"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <el-button @click="inventoryDialog.visible = false">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" :loading="inventoryDialog.submitLoading" @click="submitInventory">确定</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup name="Base" lang="ts">
|
|
<script setup name="Base" lang="ts">
|
|
|
-import { listBase, getBase, delBase, brandList, categoryTree, shelfReview, changeProductType, getProductStatusCount } from '@/api/product/base';
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ listBase,
|
|
|
|
|
+ getBase,
|
|
|
|
|
+ delBase,
|
|
|
|
|
+ brandList,
|
|
|
|
|
+ updateBase,
|
|
|
|
|
+ shelfReview,
|
|
|
|
|
+ changeProductType,
|
|
|
|
|
+ getProductStatusCount
|
|
|
|
|
+} from '@/api/product/base';
|
|
|
|
|
+import { generatePPT } from '@/utils/pptPlugin';
|
|
|
|
|
+import { addProductSelf } from '@/api/product/productSelf';
|
|
|
|
|
+import { addProductExquisite } from '@/api/product/productExquisite';
|
|
|
|
|
+import { PriceInventoryForm } from '@/api/product/priceInventory/types';
|
|
|
import { BaseVO, BaseQuery, BaseForm, StatusCountVo } from '@/api/product/base/types';
|
|
import { BaseVO, BaseQuery, BaseForm, StatusCountVo } from '@/api/product/base/types';
|
|
|
import { BrandVO } from '@/api/product/brand/types';
|
|
import { BrandVO } from '@/api/product/brand/types';
|
|
|
import { listBrand } from '@/api/product/brand';
|
|
import { listBrand } from '@/api/product/brand';
|
|
|
-import { categoryTreeVO } from '@/api/product/category/types';
|
|
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
@@ -274,14 +325,16 @@ const ids = ref<Array<string | number>>([]);
|
|
|
const single = ref(true);
|
|
const single = ref(true);
|
|
|
const multiple = ref(true);
|
|
const multiple = ref(true);
|
|
|
const total = ref(0);
|
|
const total = ref(0);
|
|
|
-const categoryOptions = ref<categoryTreeVO[]>([]);
|
|
|
|
|
const brandOptions = ref<BrandVO[]>([]);
|
|
const brandOptions = ref<BrandVO[]>([]);
|
|
|
const brandLoading = ref(false);
|
|
const brandLoading = ref(false);
|
|
|
-let brandSearchTimer: ReturnType<typeof setTimeout> | null = null;
|
|
|
|
|
|
|
+const brandSearchTimer = ref<ReturnType<typeof setTimeout> | null>(null);
|
|
|
const hasMore = ref(true); // 是否还有更多数据
|
|
const hasMore = ref(true); // 是否还有更多数据
|
|
|
-// 页面历史记录,存储每页的第一个id和最后一个id,用于支持双向翻页
|
|
|
|
|
|
|
+// 页面历史记录,存储每页的第一个 id 和最后一个 id,用于支持双向翻页
|
|
|
const pageHistory = ref([]);
|
|
const pageHistory = ref([]);
|
|
|
|
|
|
|
|
|
|
+// 三级分类选择组件引用
|
|
|
|
|
+const categoryCascadeRef = ref();
|
|
|
|
|
+
|
|
|
// 统计信息
|
|
// 统计信息
|
|
|
const statistics = ref<StatusCountVo>({
|
|
const statistics = ref<StatusCountVo>({
|
|
|
total: 0,
|
|
total: 0,
|
|
@@ -328,7 +381,7 @@ const data = reactive<PageData<BaseForm, BaseQuery>>({
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
productNo: undefined,
|
|
productNo: undefined,
|
|
|
itemName: undefined,
|
|
itemName: undefined,
|
|
|
- brandName: undefined,
|
|
|
|
|
|
|
+ brandId: undefined,
|
|
|
productTag: undefined,
|
|
productTag: undefined,
|
|
|
purchaseNature: undefined,
|
|
purchaseNature: undefined,
|
|
|
supplierType: undefined,
|
|
supplierType: undefined,
|
|
@@ -353,7 +406,6 @@ const data = reactive<PageData<BaseForm, BaseQuery>>({
|
|
|
bottomCategoryId: [{ required: true, message: '底层分类id不能为空', trigger: 'blur' }],
|
|
bottomCategoryId: [{ required: true, message: '底层分类id不能为空', trigger: 'blur' }],
|
|
|
unitId: [{ required: true, message: '单位id不能为空', trigger: 'blur' }],
|
|
unitId: [{ required: true, message: '单位id不能为空', trigger: 'blur' }],
|
|
|
productImage: [{ required: true, message: '产品图片URL不能为空', trigger: 'blur' }],
|
|
productImage: [{ required: true, message: '产品图片URL不能为空', trigger: 'blur' }],
|
|
|
- productReviewStatus: [{ required: true, message: '产品审核状态 0=待采购审核,1=审核通过,2=驳回,3=待营销审核不能为空', trigger: 'change' }],
|
|
|
|
|
homeRecommended: [{ required: true, message: '首页推荐:1=推荐,0=不推荐不能为空', trigger: 'blur' }],
|
|
homeRecommended: [{ required: true, message: '首页推荐:1=推荐,0=不推荐不能为空', trigger: 'blur' }],
|
|
|
categoryRecommendation: [{ required: true, message: '分类推荐:1=推荐,0=不推荐不能为空', trigger: 'blur' }],
|
|
categoryRecommendation: [{ required: true, message: '分类推荐:1=推荐,0=不推荐不能为空', trigger: 'blur' }],
|
|
|
cartRecommendation: [{ required: true, message: '购物车推荐:1=推荐,0=不推荐不能为空', trigger: 'blur' }],
|
|
cartRecommendation: [{ required: true, message: '购物车推荐:1=推荐,0=不推荐不能为空', trigger: 'blur' }],
|
|
@@ -366,11 +418,11 @@ const data = reactive<PageData<BaseForm, BaseQuery>>({
|
|
|
|
|
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/** 查询产品基础信息列表 */
|
|
/** 查询产品基础信息列表 */
|
|
|
const getList = async () => {
|
|
const getList = async () => {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
try {
|
|
try {
|
|
|
|
|
+ initRouteParams();
|
|
|
const params = { ...queryParams.value };
|
|
const params = { ...queryParams.value };
|
|
|
const currentPageNum = queryParams.value.pageNum;
|
|
const currentPageNum = queryParams.value.pageNum;
|
|
|
|
|
|
|
@@ -479,6 +531,11 @@ const handleQuery = () => {
|
|
|
/** 重置按钮操作 */
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = () => {
|
|
const resetQuery = () => {
|
|
|
queryFormRef.value?.resetFields();
|
|
queryFormRef.value?.resetFields();
|
|
|
|
|
+ // 手动重置分类字段
|
|
|
|
|
+ queryParams.value.topCategoryId = undefined;
|
|
|
|
|
+ queryParams.value.mediumCategoryId = undefined;
|
|
|
|
|
+ queryParams.value.bottomCategoryId = undefined;
|
|
|
|
|
+ categoryCascadeRef.value?.reset();
|
|
|
queryParams.value.lastSeenId = undefined;
|
|
queryParams.value.lastSeenId = undefined;
|
|
|
pageHistory.value = []; // 重置页面历史
|
|
pageHistory.value = []; // 重置页面历史
|
|
|
handleQuery();
|
|
handleQuery();
|
|
@@ -512,32 +569,67 @@ const handleDelete = async (row?: BaseVO) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
/** 导出按钮操作 */
|
|
|
-const handleExport = () => {
|
|
|
|
|
- proxy?.download(
|
|
|
|
|
- 'product/base/export',
|
|
|
|
|
- {
|
|
|
|
|
- ...queryParams.value
|
|
|
|
|
- },
|
|
|
|
|
- `base_${new Date().getTime()}.xlsx`
|
|
|
|
|
- );
|
|
|
|
|
|
|
+const handleExport = async () => {
|
|
|
|
|
+ // 检查是否有选中的商品
|
|
|
|
|
+ if (ids.value.length === 0) {
|
|
|
|
|
+ proxy?.$modal.msgWarning('请先选择要导出的商品');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取选中商品的完整信息
|
|
|
|
|
+ const selectedProducts = baseList.value.filter(item => ids.value.includes(item.id));
|
|
|
|
|
+
|
|
|
|
|
+ if (selectedProducts.length === 0) {
|
|
|
|
|
+ proxy?.$modal.msgWarning('未找到选中的商品信息');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 转换为 generatePPT 需要的格式
|
|
|
|
|
+ const products = selectedProducts.map(item => ({
|
|
|
|
|
+ image: item.productImage || item.productImageUrl || '',
|
|
|
|
|
+ name: item.itemName || '',
|
|
|
|
|
+ code: item.productNo || '',
|
|
|
|
|
+ spec: item.specification || item.packagingSpec || '-',
|
|
|
|
|
+ price: item.minSellingPrice || item.memberPrice || 0
|
|
|
|
|
+ }));
|
|
|
|
|
+
|
|
|
|
|
+ // 默认模板配置
|
|
|
|
|
+ const template = {
|
|
|
|
|
+ name: '商品展示方案',
|
|
|
|
|
+ title: '商品展示方案',
|
|
|
|
|
+ themeColor: '#C00000',
|
|
|
|
|
+ itemsPerPage: 1, // 每页1个商品,展示更详细
|
|
|
|
|
+ cover: '',
|
|
|
|
|
+ logo: ''
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ proxy?.$modal.loading('正在生成PPT...');
|
|
|
|
|
+ await generatePPT(template, products);
|
|
|
|
|
+ proxy?.$modal.closeLoading();
|
|
|
|
|
+ proxy?.$modal.msgSuccess('PPT导出成功');
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ proxy?.$modal.closeLoading();
|
|
|
|
|
+ console.error('PPT导出失败:', error);
|
|
|
|
|
+ proxy?.$modal.msgError('PPT导出失败');
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 查看商品详情 */
|
|
/** 查看商品详情 */
|
|
|
const handleView = (row: BaseVO) => {
|
|
const handleView = (row: BaseVO) => {
|
|
|
- console.log('查看商品', row);
|
|
|
|
|
- // TODO: 实现查看详情逻辑
|
|
|
|
|
|
|
+ const url = `https://item.xiaoluwebsite.xyz/item?productNo=${row.productNo}`;
|
|
|
|
|
+ window.open(url, '_blank');
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 上下架操作 */
|
|
/** 上下架操作 */
|
|
|
const handleShelf = async (row: BaseVO) => {
|
|
const handleShelf = async (row: BaseVO) => {
|
|
|
- // productStatus字段定义为string类型:1=已上架,0=下架,2=上架中
|
|
|
|
|
- const isOnShelf = row.productStatus === '1';
|
|
|
|
|
|
|
+ const isOnShelf = row.productStatus === 1;
|
|
|
const action = isOnShelf ? '下架' : '上架';
|
|
const action = isOnShelf ? '下架' : '上架';
|
|
|
await proxy?.$modal.confirm(`确认${action}该商品吗?`);
|
|
await proxy?.$modal.confirm(`确认${action}该商品吗?`);
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
// 上架:状态改为2(上架中),下架:状态改为0(下架)
|
|
// 上架:状态改为2(上架中),下架:状态改为0(下架)
|
|
|
- const productStatus = isOnShelf ? '0' : '2';
|
|
|
|
|
|
|
+ const productStatus = isOnShelf ? 0 : 2;
|
|
|
await shelfReview({
|
|
await shelfReview({
|
|
|
id: row.id,
|
|
id: row.id,
|
|
|
productStatus: productStatus,
|
|
productStatus: productStatus,
|
|
@@ -557,16 +649,71 @@ const handlePrice = (row: BaseVO) => {
|
|
|
// TODO: 打开价格设置对话框
|
|
// TODO: 打开价格设置对话框
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-/** 供货存管理 */
|
|
|
|
|
-const handleSupply = (row: BaseVO) => {
|
|
|
|
|
- console.log('供货存管理', row);
|
|
|
|
|
- // TODO: 打开供货存管理对话框
|
|
|
|
|
|
|
+/** 库存修改弹框 */
|
|
|
|
|
+const inventoryDialog = reactive({
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ submitLoading: false
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const inventoryFormRef = ref<ElFormInstance>();
|
|
|
|
|
+
|
|
|
|
|
+const inventoryForm = reactive<PriceInventoryForm>({
|
|
|
|
|
+ productId: undefined,
|
|
|
|
|
+ totalInventory: undefined,
|
|
|
|
|
+ nowInventory: undefined,
|
|
|
|
|
+ virtualInventory: undefined
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const inventoryRules = {
|
|
|
|
|
+ totalInventory: [{ required: true, message: '总库存不能为空', trigger: 'blur' }],
|
|
|
|
|
+ nowInventory: [{ required: true, message: '当前可用库存不能为空', trigger: 'blur' }],
|
|
|
|
|
+ virtualInventory: [{ required: true, message: '虚拟库存不能为空', trigger: 'blur' }]
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 打开库存修改弹框 */
|
|
|
|
|
+const handleSupply = async (row: BaseVO) => {
|
|
|
|
|
+ inventoryForm.id = row.id;
|
|
|
|
|
+ inventoryForm.totalInventory = undefined;
|
|
|
|
|
+ inventoryForm.nowInventory = undefined;
|
|
|
|
|
+ inventoryForm.virtualInventory = undefined;
|
|
|
|
|
+ inventoryDialog.loading = true;
|
|
|
|
|
+ inventoryDialog.visible = true;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await getBase(row.id);
|
|
|
|
|
+ if (res.data) {
|
|
|
|
|
+ inventoryForm.totalInventory = res.data.totalInventory;
|
|
|
|
|
+ inventoryForm.nowInventory = res.data.nowInventory;
|
|
|
|
|
+ inventoryForm.virtualInventory = res.data.virtualInventory;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取库存信息失败:', error);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ inventoryDialog.loading = false;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 提交库存修改 */
|
|
|
|
|
+const submitInventory = async () => {
|
|
|
|
|
+ await inventoryFormRef.value?.validate();
|
|
|
|
|
+ inventoryDialog.submitLoading = true;
|
|
|
|
|
+ try {
|
|
|
|
|
+ await updateBase({ ...inventoryForm });
|
|
|
|
|
+ proxy?.$modal.msgSuccess('库存修改成功');
|
|
|
|
|
+ inventoryDialog.visible = false;
|
|
|
|
|
+ await getList();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('库存修改失败:', error);
|
|
|
|
|
+ proxy?.$modal.msgError('库存修改失败');
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ inventoryDialog.submitLoading = false;
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 停售操作 */
|
|
/** 停售操作 */
|
|
|
const handleDiscontinue = async (row: BaseVO) => {
|
|
const handleDiscontinue = async (row: BaseVO) => {
|
|
|
await proxy?.$modal.confirm('确认停售该商品吗?停售后商品将无法正常售卖。');
|
|
await proxy?.$modal.confirm('确认停售该商品吗?停售后商品将无法正常售卖。');
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
// 调用停售API,将商品类型改为3(停售商品)
|
|
// 调用停售API,将商品类型改为3(停售商品)
|
|
|
await changeProductType({
|
|
await changeProductType({
|
|
@@ -581,6 +728,34 @@ const handleDiscontinue = async (row: BaseVO) => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+/** 加入自营池操作 */
|
|
|
|
|
+const handleAddToSelfPool = async (row: BaseVO) => {
|
|
|
|
|
+ await proxy?.$modal.confirm('确认将该商品加入自营池吗?');
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await addProductSelf({ productId: row.id, auditStatus: 1 });
|
|
|
|
|
+ proxy?.$modal.msgSuccess('加入自营池成功');
|
|
|
|
|
+ await getList();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('加入自营池失败:', error);
|
|
|
|
|
+ proxy?.$modal.msgError('加入自营池失败');
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 加入精品池操作 */
|
|
|
|
|
+const handleAddToExquisitePool = async (row: BaseVO) => {
|
|
|
|
|
+ await proxy?.$modal.confirm('确认将该商品加入精品池吗?');
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await addProductExquisite({ productId: row.id, auditStatus: 1 });
|
|
|
|
|
+ proxy?.$modal.msgSuccess('加入精品池成功');
|
|
|
|
|
+ await getList();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('加入精品池失败:', error);
|
|
|
|
|
+ proxy?.$modal.msgError('加入精品池失败');
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
/** 跳转到商品审核页面 */
|
|
/** 跳转到商品审核页面 */
|
|
|
const handleGoReview = () => {
|
|
const handleGoReview = () => {
|
|
|
router.push({
|
|
router.push({
|
|
@@ -591,18 +766,14 @@ const handleGoReview = () => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-/** 查询分类树 */
|
|
|
|
|
-const getCategoryTree = async () => {
|
|
|
|
|
- const res = await categoryTree();
|
|
|
|
|
- categoryOptions.value = res.data || [];
|
|
|
|
|
-};
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/** 加载品牌选项(默认100条) */
|
|
/** 加载品牌选项(默认100条) */
|
|
|
const loadBrandOptions = async (keyword?: string) => {
|
|
const loadBrandOptions = async (keyword?: string) => {
|
|
|
brandLoading.value = true;
|
|
brandLoading.value = true;
|
|
|
try {
|
|
try {
|
|
|
const res = await listBrand({ pageNum: 1, pageSize: 100, brandName: keyword });
|
|
const res = await listBrand({ pageNum: 1, pageSize: 100, brandName: keyword });
|
|
|
- brandOptions.value = res.rows || [];
|
|
|
|
|
|
|
+ brandOptions.value = res.rows || [];
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('加载品牌列表失败:', error);
|
|
console.error('加载品牌列表失败:', error);
|
|
|
} finally {
|
|
} finally {
|
|
@@ -612,8 +783,8 @@ const loadBrandOptions = async (keyword?: string) => {
|
|
|
|
|
|
|
|
/** 品牌远程搜索(防抖) */
|
|
/** 品牌远程搜索(防抖) */
|
|
|
const handleBrandSearch = (query: string) => {
|
|
const handleBrandSearch = (query: string) => {
|
|
|
- if (brandSearchTimer) clearTimeout(brandSearchTimer);
|
|
|
|
|
- brandSearchTimer = setTimeout(() => {
|
|
|
|
|
|
|
+ if (brandSearchTimer.value) clearTimeout(brandSearchTimer.value);
|
|
|
|
|
+ brandSearchTimer.value = setTimeout(() => {
|
|
|
loadBrandOptions(query || undefined);
|
|
loadBrandOptions(query || undefined);
|
|
|
}, 300);
|
|
}, 300);
|
|
|
};
|
|
};
|
|
@@ -632,7 +803,6 @@ const getStatistics = async () => {
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getList();
|
|
getList();
|
|
|
- getCategoryTree();
|
|
|
|
|
getStatistics();
|
|
getStatistics();
|
|
|
loadBrandOptions();
|
|
loadBrandOptions();
|
|
|
});
|
|
});
|