diff --git a/apps/web-antd/src/views/mall/product/spu/modules/form-data.ts b/apps/web-antd/src/views/mall/product/spu/modules/form-data.ts
index ad5cf83e5..905b47f36 100644
--- a/apps/web-antd/src/views/mall/product/spu/modules/form-data.ts
+++ b/apps/web-antd/src/views/mall/product/spu/modules/form-data.ts
@@ -1,5 +1,7 @@
import type { VbenFormSchema } from '#/adapter/form';
+import { h } from 'vue';
+
import { DeliveryTypeEnum, DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { handleTree } from '@vben/utils';
@@ -9,6 +11,8 @@ import { getSimpleBrandList } from '#/api/mall/product/brand';
import { getCategoryList } from '#/api/mall/product/category';
import { getSimpleTemplateList } from '#/api/mall/trade/delivery/expressTemplate';
+import SkuList from './sku-list.vue';
+
/** 基础设置的表单 */
export function useInfoFormSchema(): VbenFormSchema[] {
return [
@@ -104,7 +108,11 @@ export function useInfoFormSchema(): VbenFormSchema[] {
}
/** 价格库存的表单 */
-export function useSkuFormSchema(): VbenFormSchema[] {
+export function useSkuFormSchema(
+ propertyList: any[] = [],
+ ruleConfig: any[] = [],
+ isDetail: boolean = false,
+): VbenFormSchema[] {
return [
{
fieldName: 'id',
@@ -152,7 +160,65 @@ export function useSkuFormSchema(): VbenFormSchema[] {
},
rules: 'required',
},
- // TODO @xingyu:待补充商品属性
+ // 单规格时显示的 SkuList
+ {
+ fieldName: 'singleSkuList',
+ label: '',
+ component: h(SkuList),
+ componentProps: {
+ propertyList,
+ ruleConfig,
+ },
+ dependencies: {
+ triggerFields: ['specType'],
+ // 当 specType 为 false(单规格)时显示
+ show: (values) => values.specType === false,
+ },
+ },
+ // 多规格时显示的商品属性(占位,实际通过插槽渲染)
+ {
+ fieldName: 'productAttributes',
+ label: '商品属性',
+ component: 'Input',
+ componentProps: {},
+ dependencies: {
+ triggerFields: ['specType'],
+ // 当 specType 为 true(多规格)时显示
+ show: (values) => values.specType === true,
+ },
+ },
+ // 多规格 - 批量设置
+ {
+ fieldName: 'batchSkuList',
+ label: '批量设置',
+ component: h(SkuList),
+ componentProps: {
+ isBatch: true,
+ propertyList,
+ },
+ dependencies: {
+ triggerFields: ['specType'],
+ // 当 specType 为 true(多规格)且 propertyList 有数据时显示,且非详情模式
+ show: (values) =>
+ values.specType === true && propertyList.length > 0 && !isDetail,
+ },
+ },
+ // 多规格 - 规格列表
+ {
+ fieldName: 'multiSkuList',
+ label: '规格列表',
+ component: h(SkuList),
+ componentProps: {
+ propertyList,
+ ruleConfig,
+ isDetail,
+ },
+ dependencies: {
+ triggerFields: ['specType'],
+ // 当 specType 为 true(多规格)且 propertyList 有数据时显示
+ show: (values) => values.specType === true && propertyList.length > 0,
+ },
+ },
];
}
diff --git a/apps/web-antd/src/views/mall/product/spu/modules/form.vue b/apps/web-antd/src/views/mall/product/spu/modules/form.vue
index 3cfb43dab..8a395feac 100644
--- a/apps/web-antd/src/views/mall/product/spu/modules/form.vue
+++ b/apps/web-antd/src/views/mall/product/spu/modules/form.vue
@@ -1,11 +1,13 @@
+
+
@@ -160,7 +278,23 @@ onMounted(async () => {
-
+
+
+
+
+
diff --git a/apps/web-antd/src/views/mall/product/spu/modules/index.ts b/apps/web-antd/src/views/mall/product/spu/modules/index.ts
index f52caee99..a14d1838e 100644
--- a/apps/web-antd/src/views/mall/product/spu/modules/index.ts
+++ b/apps/web-antd/src/views/mall/product/spu/modules/index.ts
@@ -63,4 +63,5 @@ const getPropertyList = (spu: MallSpuApi.Spu): PropertyAndValues[] => {
export { getPropertyList };
-// export { default as SkuList } from './sku-list.vue';
+// 导出组件
+export { default as SkuList } from './sku-list.vue';
diff --git a/apps/web-antd/src/views/mall/product/spu/modules/product-property-add-form.vue b/apps/web-antd/src/views/mall/product/spu/modules/product-property-add-form.vue
index 149eea575..81551d960 100644
--- a/apps/web-antd/src/views/mall/product/spu/modules/product-property-add-form.vue
+++ b/apps/web-antd/src/views/mall/product/spu/modules/product-property-add-form.vue
@@ -73,6 +73,14 @@ const formSchema: VbenFormSchema[] = [
// 初始化表单
const [Form, formApi] = useVbenForm({
+ commonConfig: {
+ componentProps: {
+ class: 'w-full',
+ },
+ formItemClass: 'col-span-2',
+ labelWidth: 120,
+ },
+ layout: 'horizontal',
schema: formSchema,
showDefaultActions: false,
});
diff --git a/apps/web-antd/src/views/mall/product/spu/modules/sku-list.vue b/apps/web-antd/src/views/mall/product/spu/modules/sku-list.vue
new file mode 100644
index 000000000..ce92f9acd
--- /dev/null
+++ b/apps/web-antd/src/views/mall/product/spu/modules/sku-list.vue
@@ -0,0 +1,618 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ row.properties?.[index]?.valueName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ row.properties?.[index]?.valueName }}
+
+
+
+
+
+
+ {{ row.barCode }}
+
+
+
+
+ {{ row.price }}
+
+
+
+
+ {{ row.marketPrice }}
+
+
+
+
+ {{ row.costPrice }}
+
+
+
+
+ {{ row.stock }}
+
+
+
+
+ {{ row.weight }}
+
+
+
+
+ {{ row.volume }}
+
+
+
+
+
+ {{ row.firstBrokeragePrice }}
+
+
+
+
+ {{ row.secondBrokeragePrice }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ row.properties?.[index]?.valueName }}
+
+
+
+
+
+
+ {{ row.barCode }}
+
+
+
+
+ {{ formatToFraction(row.price) }}
+
+
+
+
+ {{ formatToFraction(row.marketPrice) }}
+
+
+
+
+ {{ formatToFraction(row.costPrice) }}
+
+
+
+
+ {{ row.stock }}
+
+
+
+
+
+