优化店铺商品及分类管理
This commit is contained in:
@@ -12,11 +12,12 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { ref, watch, reactive } from 'vue';
|
||||
import type { ValueType } from 'ant-design-vue/es/vc-cascader/Cascader';
|
||||
import { listGoodsCategory } from '@/api/shop/goodsCategory';
|
||||
import { toTreeData } from 'ele-admin-pro/es';
|
||||
import { GoodsCategory } from '@/api/shop/goodsCategory/model';
|
||||
import { FileRecordParam } from '@/api/system/file/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -26,6 +27,7 @@
|
||||
valueField?: 'label';
|
||||
type?: 'provinceCity' | 'province';
|
||||
showSearch?: boolean;
|
||||
merchantId?: number;
|
||||
}>(),
|
||||
{
|
||||
showSearch: true
|
||||
@@ -38,6 +40,11 @@
|
||||
(e: 'load-data-done', value: GoodsCategory[]): void;
|
||||
}>();
|
||||
|
||||
// 搜索表单
|
||||
const where = reactive<GoodsCategory>({
|
||||
merchantId: undefined
|
||||
});
|
||||
|
||||
// 级联选择器数据
|
||||
const regionsData = ref<GoodsCategory[]>([]);
|
||||
|
||||
@@ -47,7 +54,7 @@
|
||||
};
|
||||
|
||||
const onChange = (item: any, value: ValueType) => {
|
||||
console.log(item,value);
|
||||
console.log(item, value);
|
||||
emit('done', item, value);
|
||||
};
|
||||
|
||||
@@ -107,7 +114,10 @@
|
||||
watch(
|
||||
() => props.options,
|
||||
() => {
|
||||
listGoodsCategory().then((data) => {
|
||||
if (props.merchantId) {
|
||||
where.merchantId = props.merchantId;
|
||||
}
|
||||
listGoodsCategory(where).then((data) => {
|
||||
const list = toTreeData({
|
||||
data: data?.map((d) => {
|
||||
d.value = d.categoryId;
|
||||
|
||||
Reference in New Issue
Block a user