优化店铺商品及分类管理

This commit is contained in:
2024-07-27 23:07:06 +08:00
parent b9df13a916
commit d74b844ee0
12 changed files with 677 additions and 82 deletions

View File

@@ -16,6 +16,7 @@
<search
@search="reload"
:selection="selection"
:merchantId="merchantId"
@add="openEdit"
@remove="removeBatch"
@batchMove="openMove"
@@ -69,17 +70,21 @@
</a-card>
<!-- 编辑弹窗 -->
<GoodsEdit v-model:visible="showEdit" :data="current" @done="reload" />
<GoodsEdit
v-model:visible="showEdit"
:merchantId="merchantId"
:data="current"
@done="reload"
/>
</div>
</div>
</template>
<script lang="ts" setup>
import { createVNode, ref } from 'vue';
import { createVNode, ref, watch } from 'vue';
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
@@ -94,6 +99,7 @@
} from '@/api/shop/goods';
import type { Goods, GoodsParam } from '@/api/shop/goods/model';
import { formatNumber } from 'ele-admin-pro/es';
import router from '@/router';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -106,8 +112,8 @@
const showEdit = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 加载状态
const loading = ref(true);
// 店铺ID
const merchantId = ref<number>();
// 表格数据源
const datasource: DatasourceFunction = ({
@@ -120,6 +126,9 @@
if (filters) {
where.status = filters.status;
}
if (merchantId.value) {
where.merchantId = merchantId.value;
}
return pageGoods({
...where,
...orders,
@@ -362,11 +371,6 @@
});
};
/* 查询 */
const query = () => {
loading.value = true;
};
/* 自定义行属性 */
const customRow = (record: Goods) => {
return {
@@ -380,7 +384,15 @@
}
};
};
query();
watch(
() => router.currentRoute.value.params.id,
(id) => {
merchantId.value = Number(id);
reload();
},
{ immediate: true }
);
</script>
<script lang="ts">