|
|
@@ -12,24 +12,17 @@
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="商品名称" prop="itemName">
|
|
|
- <el-input v-model="queryParams.itemName" placeholder="请输入商品名称" clearable @keyup.enter="handleQuery" />
|
|
|
+ <el-input v-model="queryParams.itemName" placeholder="请输入商品名称" clearable @keyup.enter="handleQuery" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="商品品牌" prop="brandId">
|
|
|
- <el-select v-model="queryParams.brandId" placeholder="请选择商品品牌" clearable>
|
|
|
- <el-option
|
|
|
- v-for="brand in brandOptions"
|
|
|
- :key="brand.id"
|
|
|
- :label="brand.brandName"
|
|
|
- :value="brand.id"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="商品品牌" prop="brandName">
|
|
|
+ <el-input v-model="queryParams.brandName" placeholder="请输入商品品牌" clearable @keyup.enter="handleQuery" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="商品来源" prop="purchaseNature">
|
|
|
- <el-input v-model="queryParams.itemName" placeholder="请输入商品来源" clearable @keyup.enter="handleQuery" />
|
|
|
+ <el-input v-model="queryParams.itemName" placeholder="请输入商品来源" clearable @keyup.enter="handleQuery" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -58,19 +51,18 @@
|
|
|
<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-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-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="1" />
|
|
|
+ <el-option label="下架" value="0" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -90,8 +82,14 @@
|
|
|
<el-card shadow="never" class="mb-[10px]">
|
|
|
<div class="flex items-center text-sm text-gray-600">
|
|
|
<span>商品总/已配置数量: </span>
|
|
|
- <span class="text-blue-600 mx-1">总=<span class="text-red-600">{{ statistics.total }}</span>条,</span>
|
|
|
- <span>外/已配置数量<span class="text-red-600">{{ statistics.configured }}</span>条,</span>
|
|
|
+ <span class="text-blue-600 mx-1"
|
|
|
+ >总=<span class="text-red-600">{{ statistics.total }}</span
|
|
|
+ >条,</span
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ >外/已配置数量<span class="text-red-600">{{ statistics.configured }}</span
|
|
|
+ >条,</span
|
|
|
+ >
|
|
|
<span>【上架/总数({{ statistics.onShelf }}/{{ statistics.total }})】</span>
|
|
|
<span class="mx-2">,审核状态({{ statistics.reviewStatus }}),上架状态({{ statistics.shelfStatus }})</span>
|
|
|
<div class="ml-auto flex gap-2">
|
|
|
@@ -105,7 +103,6 @@
|
|
|
</el-card>
|
|
|
|
|
|
<el-card shadow="never">
|
|
|
-
|
|
|
<el-table v-loading="loading" border :data="baseList" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="商品编号" align="center" prop="productNo" width="120" fixed="left">
|
|
|
@@ -115,14 +112,14 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="商品图片" align="center" prop="productImage" width="100">
|
|
|
<template #default="scope">
|
|
|
- <image-preview :src="scope.row.productImage" :width="60" :height="60"/>
|
|
|
+ <image-preview :src="scope.row.productImage" :width="60" :height="60" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="商品信息" align="center" width="250" show-overflow-tooltip>
|
|
|
<template #default="scope">
|
|
|
<div class="text-left">
|
|
|
<div>{{ 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>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -130,7 +127,7 @@
|
|
|
<el-table-column label="单位" align="center" prop="unitName" width="80" />
|
|
|
<el-table-column label="SKU价格" align="center" width="180">
|
|
|
<template #default="scope">
|
|
|
- <div class="text-left" style="font-size: 12px;">
|
|
|
+ <div class="text-left" style="font-size: 12px">
|
|
|
<div>
|
|
|
<span class="text-gray-500">市场价:</span>
|
|
|
<span class="text-red-500">¥{{ scope.row.marketPrice || '0.00' }}</span>
|
|
|
@@ -148,7 +145,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="成本情况" align="center" width="150">
|
|
|
<template #default="scope">
|
|
|
- <div class="text-left" style="font-size: 12px;">
|
|
|
+ <div class="text-left" style="font-size: 12px">
|
|
|
<div>
|
|
|
<span class="text-gray-500">采购价:</span>
|
|
|
<span>¥{{ scope.row.purchasingPrice || '0.00' }}</span>
|
|
|
@@ -167,57 +164,57 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="是否自营" align="center" width="100">
|
|
|
<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>
|
|
|
+ <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="100">
|
|
|
<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.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="120">
|
|
|
<template #default="scope">
|
|
|
- <el-tag v-if="scope.row.productStatus === '1'" type="success">上架</el-tag>
|
|
|
- <el-tag v-else-if="scope.row.productStatus === '0'" type="warning">下架</el-tag>
|
|
|
+ <el-tag v-if="scope.row.productStatus === 1" type="success">上架</el-tag>
|
|
|
+ <el-tag v-else-if="scope.row.productStatus === 0" type="warning">下架</el-tag>
|
|
|
<el-tag v-else type="info">未知</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" width="200" fixed="right">
|
|
|
<template #default="scope">
|
|
|
<!-- 待审核状态:只显示编辑 -->
|
|
|
- <div v-if="scope.row.productReviewStatus !== '2'" class="flex gap-1 justify-center">
|
|
|
+ <div v-if="scope.row.productReviewStatus !== 2" 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 === '2'" class="flex flex-col gap-1">
|
|
|
+ <div v-else-if="scope.row.productReviewStatus === 2" class="flex flex-col gap-1">
|
|
|
<!-- 下架状态:编辑、上架、停售、修改库存 -->
|
|
|
- <div v-if="scope.row.productStatus === '0'" class="flex gap-1 justify-center">
|
|
|
+ <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">
|
|
|
+ <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">
|
|
|
+ <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">
|
|
|
+ <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>
|
|
|
@@ -226,7 +223,16 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
- <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
|
+ <!-- 游标分页控制 -->
|
|
|
+ <pagination
|
|
|
+ v-show="baseList.length > 0"
|
|
|
+ v-model:page="cursorQueryParams.pageNum"
|
|
|
+ v-model:limit="cursorQueryParams.pageSize"
|
|
|
+ v-model:way="cursorQueryParams.way"
|
|
|
+ :cursor-mode="true"
|
|
|
+ :has-more="hasMore"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
</el-card>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -249,8 +255,10 @@ const ids = ref<Array<string | number>>([]);
|
|
|
const single = ref(true);
|
|
|
const multiple = ref(true);
|
|
|
const total = ref(0);
|
|
|
-const brandOptions = ref<BrandVO[]>([]);
|
|
|
const categoryOptions = ref<categoryTreeVO[]>([]);
|
|
|
+const hasMore = ref(true); // 是否还有更多数据
|
|
|
+// 页面历史记录,存储每页的第一个id和最后一个id,用于支持双向翻页
|
|
|
+const pageHistory = ref([]);
|
|
|
|
|
|
// 统计信息
|
|
|
const statistics = ref({
|
|
|
@@ -288,16 +296,16 @@ const initFormData: BaseForm = {
|
|
|
isPopular: undefined,
|
|
|
isNew: undefined,
|
|
|
productStatus: undefined,
|
|
|
- remark: undefined,
|
|
|
-}
|
|
|
+ remark: undefined
|
|
|
+};
|
|
|
const data = reactive<PageData<BaseForm, BaseQuery>>({
|
|
|
- form: {...initFormData},
|
|
|
+ form: { ...initFormData },
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
productNo: undefined,
|
|
|
itemName: undefined,
|
|
|
- brandId: undefined,
|
|
|
+ brandName: undefined,
|
|
|
productTag: undefined,
|
|
|
purchaseNature: undefined,
|
|
|
supplierType: undefined,
|
|
|
@@ -306,143 +314,194 @@ const data = reactive<PageData<BaseForm, BaseQuery>>({
|
|
|
topCategoryId: undefined,
|
|
|
mediumCategoryId: undefined,
|
|
|
bottomCategoryId: undefined,
|
|
|
+ isSelf: undefined,
|
|
|
+ productReviewStatus: undefined,
|
|
|
productStatus: undefined,
|
|
|
- params: {
|
|
|
- }
|
|
|
+ params: {}
|
|
|
},
|
|
|
rules: {
|
|
|
- productNo: [
|
|
|
- { required: true, message: "产品编号不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- itemName: [
|
|
|
- { required: true, message: "项目名称不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- brandId: [
|
|
|
- { required: true, message: "品牌id不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- topCategoryId: [
|
|
|
- { required: true, message: "顶级分类id不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- mediumCategoryId: [
|
|
|
- { required: true, message: "中级分类id不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- bottomCategoryId: [
|
|
|
- { required: true, message: "底层分类id不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- unitId: [
|
|
|
- { required: true, message: "单位id不能为空", 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" }
|
|
|
- ],
|
|
|
- categoryRecommendation: [
|
|
|
- { required: true, message: "分类推荐:1=推荐,0=不推荐不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- cartRecommendation: [
|
|
|
- { required: true, message: "购物车推荐:1=推荐,0=不推荐不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- recommendedProductOrder: [
|
|
|
- { required: true, message: "推荐产品顺序不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- isPopular: [
|
|
|
- { required: true, message: "是否热门:1=是,0=否不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- isNew: [
|
|
|
- { required: true, message: "是否新品:1=是,0=否不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- remark: [
|
|
|
- { required: true, message: "备注不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
+ productNo: [{ required: true, message: '产品编号不能为空', trigger: 'blur' }],
|
|
|
+ itemName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
|
|
|
+ brandId: [{ required: true, message: '品牌id不能为空', trigger: 'blur' }],
|
|
|
+ topCategoryId: [{ required: true, message: '顶级分类id不能为空', trigger: 'blur' }],
|
|
|
+ mediumCategoryId: [{ required: true, message: '中级分类id不能为空', trigger: 'blur' }],
|
|
|
+ bottomCategoryId: [{ required: true, message: '底层分类id不能为空', trigger: 'blur' }],
|
|
|
+ unitId: [{ required: true, message: '单位id不能为空', 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' }],
|
|
|
+ categoryRecommendation: [{ required: true, message: '分类推荐:1=推荐,0=不推荐不能为空', trigger: 'blur' }],
|
|
|
+ cartRecommendation: [{ required: true, message: '购物车推荐:1=推荐,0=不推荐不能为空', trigger: 'blur' }],
|
|
|
+ recommendedProductOrder: [{ required: true, message: '推荐产品顺序不能为空', trigger: 'blur' }],
|
|
|
+ isPopular: [{ required: true, message: '是否热门:1=是,0=否不能为空', trigger: 'blur' }],
|
|
|
+ isNew: [{ required: true, message: '是否新品:1=是,0=否不能为空', trigger: 'blur' }],
|
|
|
+ remark: [{ required: true, message: '备注不能为空', trigger: 'blur' }]
|
|
|
}
|
|
|
});
|
|
|
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
|
|
|
|
+// 游标分页查询参数
|
|
|
+const cursorQueryParams = ref<BaseQuery>({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ way: undefined,
|
|
|
+ productNo: undefined,
|
|
|
+ itemName: undefined,
|
|
|
+ brandName: undefined,
|
|
|
+ purchaseNature: undefined,
|
|
|
+ bottomCategoryId: undefined,
|
|
|
+ isSelf: undefined,
|
|
|
+ productReviewStatus: undefined,
|
|
|
+ productStatus: undefined,
|
|
|
+ lastSeenId: undefined // 游标分页的lastSeenId
|
|
|
+});
|
|
|
+
|
|
|
/** 查询产品基础信息列表 */
|
|
|
const getList = async () => {
|
|
|
loading.value = true;
|
|
|
- const res = await listBase(queryParams.value);
|
|
|
- baseList.value = res.rows;
|
|
|
- total.value = res.total;
|
|
|
-
|
|
|
- // 更新统计信息
|
|
|
- statistics.value.total = res.total || 0;
|
|
|
- statistics.value.configured = res.rows?.filter((item: any) => item.isConfigured)?.length || 0;
|
|
|
- statistics.value.onShelf = res.rows?.filter((item: any) => item.productStatus === '1')?.length || 0;
|
|
|
-
|
|
|
- loading.value = false;
|
|
|
-}
|
|
|
+ try {
|
|
|
+ const params = { ...cursorQueryParams.value };
|
|
|
+ const currentPageNum = cursorQueryParams.value.pageNum;
|
|
|
+
|
|
|
+ // 第一页不需要游标参数
|
|
|
+ if (currentPageNum === 1) {
|
|
|
+ delete params.lastSeenId;
|
|
|
+ delete params.way;
|
|
|
+ } else {
|
|
|
+ // way参数:0=上一页,1=下一页
|
|
|
+ if (cursorQueryParams.value.way === 0) {
|
|
|
+ // 上一页:使用目标页(即当前显示页)的firstId
|
|
|
+ const nextPageHistory = pageHistory.value[currentPageNum];
|
|
|
+ if (nextPageHistory) {
|
|
|
+ params.firstSeenId = nextPageHistory.firstId;
|
|
|
+ params.way = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 下一页:使用前一页的lastId作为lastSeenId
|
|
|
+ const prevPageHistory = pageHistory.value[currentPageNum - 1];
|
|
|
+ if (prevPageHistory) {
|
|
|
+ params.lastSeenId = prevPageHistory.lastId;
|
|
|
+ params.way = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const res = await listBase(params);
|
|
|
+ baseList.value = res.rows || [];
|
|
|
+
|
|
|
+ // 判断是否还有更多数据
|
|
|
+ hasMore.value = baseList.value.length === cursorQueryParams.value.pageSize;
|
|
|
+
|
|
|
+ // 记录当前页的第一个id和最后一个id
|
|
|
+ if (baseList.value.length > 0) {
|
|
|
+ const firstItem = baseList.value[0];
|
|
|
+ const lastItem = baseList.value[baseList.value.length - 1];
|
|
|
+ //如果长度小于currentPageNum则创建
|
|
|
+
|
|
|
+ if (pageHistory.value.length <= currentPageNum) {
|
|
|
+ pageHistory.value[currentPageNum] = {
|
|
|
+ firstId: firstItem.id,
|
|
|
+ lastId: lastItem.id
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ total.value = res.total || 0;
|
|
|
+
|
|
|
+ // 更新统计信息
|
|
|
+ statistics.value.total = res.total || 0;
|
|
|
+ statistics.value.configured = res.rows?.filter((item: any) => item.isConfigured)?.length || 0;
|
|
|
+ statistics.value.onShelf = res.rows?.filter((item: any) => item.productStatus === '1')?.length || 0;
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取列表失败:', error);
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
/** 取消按钮 */
|
|
|
const cancel = () => {
|
|
|
reset();
|
|
|
dialog.visible = false;
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 表单重置 */
|
|
|
const reset = () => {
|
|
|
- form.value = {...initFormData};
|
|
|
+ form.value = { ...initFormData };
|
|
|
baseFormRef.value?.resetFields();
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
const handleQuery = () => {
|
|
|
- queryParams.value.pageNum = 1;
|
|
|
+ // 同步查询参数到游标分页参数
|
|
|
+ cursorQueryParams.value = {
|
|
|
+ ...cursorQueryParams.value,
|
|
|
+ pageNum: 1,
|
|
|
+ productNo: queryParams.value.productNo,
|
|
|
+ itemName: queryParams.value.itemName,
|
|
|
+ brandName: queryParams.value.brandName,
|
|
|
+ bottomCategoryId: queryParams.value.bottomCategoryId,
|
|
|
+ isSelf: queryParams.value.isSelf,
|
|
|
+ productReviewStatus: queryParams.value.productReviewStatus,
|
|
|
+ productStatus: queryParams.value.productStatus,
|
|
|
+ lastSeenId: undefined
|
|
|
+ };
|
|
|
+ pageHistory.value = []; // 重置页面历史
|
|
|
getList();
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = () => {
|
|
|
queryFormRef.value?.resetFields();
|
|
|
+ cursorQueryParams.value.lastSeenId = undefined;
|
|
|
+ pageHistory.value = []; // 重置页面历史
|
|
|
handleQuery();
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 多选框选中数据 */
|
|
|
const handleSelectionChange = (selection: BaseVO[]) => {
|
|
|
- ids.value = selection.map(item => item.id);
|
|
|
+ ids.value = selection.map((item) => item.id);
|
|
|
single.value = selection.length != 1;
|
|
|
multiple.value = !selection.length;
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
const handleAdd = () => {
|
|
|
router.push('/product/base/add');
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
const handleUpdate = async (row?: BaseVO) => {
|
|
|
const _id = row?.id || ids.value[0];
|
|
|
router.push(`/product/base/edit/${_id}`);
|
|
|
-}
|
|
|
-
|
|
|
+};
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
const handleDelete = async (row?: BaseVO) => {
|
|
|
const _ids = row?.id || ids.value;
|
|
|
- await proxy?.$modal.confirm('是否确认删除产品基础信息编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
|
|
+ await proxy?.$modal.confirm('是否确认删除产品基础信息编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
|
|
await delBase(_ids);
|
|
|
- proxy?.$modal.msgSuccess("删除成功");
|
|
|
+ proxy?.$modal.msgSuccess('删除成功');
|
|
|
await getList();
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
const handleExport = () => {
|
|
|
- proxy?.download('product/base/export', {
|
|
|
- ...queryParams.value
|
|
|
- }, `base_${new Date().getTime()}.xlsx`)
|
|
|
-}
|
|
|
+ proxy?.download(
|
|
|
+ 'product/base/export',
|
|
|
+ {
|
|
|
+ ...queryParams.value
|
|
|
+ },
|
|
|
+ `base_${new Date().getTime()}.xlsx`
|
|
|
+ );
|
|
|
+};
|
|
|
|
|
|
/** 查看商品详情 */
|
|
|
const handleView = (row: BaseVO) => {
|
|
|
console.log('查看商品', row);
|
|
|
// TODO: 实现查看详情逻辑
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 上下架操作 */
|
|
|
const handleShelf = async (row: BaseVO) => {
|
|
|
@@ -451,19 +510,19 @@ const handleShelf = async (row: BaseVO) => {
|
|
|
// TODO: 调用上下架API
|
|
|
proxy?.$modal.msgSuccess(`${action}成功`);
|
|
|
await getList();
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 价格设置 */
|
|
|
const handlePrice = (row: BaseVO) => {
|
|
|
console.log('设置价格', row);
|
|
|
// TODO: 打开价格设置对话框
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 供货存管理 */
|
|
|
const handleSupply = (row: BaseVO) => {
|
|
|
console.log('供货存管理', row);
|
|
|
// TODO: 打开供货存管理对话框
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 停售操作 */
|
|
|
const handleDiscontinue = async (row: BaseVO) => {
|
|
|
@@ -471,33 +530,26 @@ const handleDiscontinue = async (row: BaseVO) => {
|
|
|
// TODO: 调用停售API
|
|
|
proxy?.$modal.msgSuccess('停售成功');
|
|
|
await getList();
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 跳转到商品审核页面 */
|
|
|
const handleGoReview = () => {
|
|
|
router.push({
|
|
|
path: '/product/base/review',
|
|
|
query: {
|
|
|
- productReviewStatus: '1' // 默认显示待审核的商品
|
|
|
+ productReviewStatus: 1 // 默认显示待审核的商品
|
|
|
}
|
|
|
});
|
|
|
-}
|
|
|
-
|
|
|
-/** 查询品牌列表 */
|
|
|
-const getBrandList = async () => {
|
|
|
- const res = await brandList();
|
|
|
- brandOptions.value = res.data || [];
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 查询分类树 */
|
|
|
const getCategoryTree = async () => {
|
|
|
const res = await categoryTree();
|
|
|
categoryOptions.value = res.data || [];
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
onMounted(() => {
|
|
|
getList();
|
|
|
- getBrandList();
|
|
|
getCategoryTree();
|
|
|
});
|
|
|
</script>
|