修复生成商品sku列表的bug

This commit is contained in:
2024-07-26 11:54:51 +08:00
parent 049a6f7476
commit 904bd82e39
6 changed files with 303 additions and 66 deletions

View File

@@ -21,9 +21,12 @@
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" />
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === 0" color="green">开启</a-tag>
<a-tag v-if="record.status === 1" color="red">关闭</a-tag>
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
</template>
<template v-if="column.key === 'action'">
<a-space>
@@ -52,6 +55,7 @@
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
import { toDateString } from 'ele-admin-pro';
import type {
DatasourceFunction,
ColumnItem
@@ -97,26 +101,98 @@
// 表格列配置
const columns = ref<ColumnItem[]>([
{
title: 'ID',
width: 90,
dataIndex: 'goodsSkuId'
},
{
title: '名称',
dataIndex: 'goodsSkuname',
key: 'goodsSkuname'
},
{
title: '描述',
dataIndex: 'comments',
ellipsis: true
},
{
title: '状态',
dataIndex: 'status',
width: 120,
title: '主键ID',
dataIndex: 'id',
key: 'id',
align: 'center',
key: 'status'
width: 90,
},
{
title: '商品ID',
dataIndex: 'goodsId',
key: 'goodsId',
align: 'center',
},
{
title: '商品属性索引值 (attr_value|attr_value[|....])',
dataIndex: 'sku',
key: 'sku',
align: 'center',
},
{
title: '商品图片',
dataIndex: 'image',
key: 'image',
align: 'center',
},
{
title: '商品价格',
dataIndex: 'price',
key: 'price',
align: 'center',
},
{
title: '市场价格',
dataIndex: 'salePrice',
key: 'salePrice',
align: 'center',
},
{
title: '成本价',
dataIndex: 'cost',
key: 'cost',
align: 'center',
},
{
title: '库存',
dataIndex: 'stock',
key: 'stock',
align: 'center',
},
{
title: 'sku编码',
dataIndex: 'skuNo',
key: 'skuNo',
align: 'center',
},
{
title: '唯一值',
dataIndex: 'unique',
key: 'unique',
align: 'center',
},
{
title: '重量',
dataIndex: 'weight',
key: 'weight',
align: 'center',
},
{
title: '体积',
dataIndex: 'volume',
key: 'volume',
align: 'center',
},
{
title: '状态, 0正常, 1异常',
dataIndex: 'status',
key: 'status',
align: 'center',
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments',
align: 'center',
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
sorter: true,
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
},
{
title: '操作',
@@ -148,7 +224,7 @@
/* 删除单个 */
const remove = (row: GoodsSku) => {
const hide = message.loading('请求中..', 0);
removeGoodsSku(row.id)
removeGoodsSku(row.goodsSkuId)
.then((msg) => {
hide();
message.success(msg);
@@ -173,7 +249,7 @@
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchGoodsSku(selection.value.map((d) => d.id))
removeBatchGoodsSku(selection.value.map((d) => d.goodsSkuId))
.then((msg) => {
hide();
message.success(msg);
@@ -205,7 +281,6 @@
}
};
};
query();
</script>