diff --git a/src/views/assets/asset/component/editAsset.vue b/src/views/assets/asset/component/editAsset.vue index 43d548e..55d27f0 100644 --- a/src/views/assets/asset/component/editAsset.vue +++ b/src/views/assets/asset/component/editAsset.vue @@ -62,6 +62,14 @@ /> + + + + 有限库存 + 无限库存 + + + @@ -486,6 +494,7 @@ interface RuleForm { description: string; onlineTime: string; offlineTime: string; + unlimitedStock: boolean; physicalAssetConfig: { shipping: { deliveryMethod: string; @@ -588,6 +597,7 @@ const getInitialForm = (): RuleForm => ({ description: '', onlineTime: '', offlineTime: '', + unlimitedStock: false, physicalAssetConfig: { shipping: { deliveryMethod: 'express', @@ -892,6 +902,7 @@ const openDialog = (row?: any, edit?: boolean) => { ruleForm.description = data.description || ''; ruleForm.onlineTime = data.onlineTime || ''; ruleForm.offlineTime = data.offlineTime || ''; + ruleForm.unlimitedStock = data.unlimitedStock || false; // 主图预览 (支持 imageUrl 和 fileURL) const mainImg = data.imageUrl || data.fileURL; @@ -1096,6 +1107,9 @@ const buildRequestBody = async (): Promise => { body.offlineTime = ruleForm.offlineTime; } + // 库存类型 + body.unlimitedStock = ruleForm.unlimitedStock; + // 主图 (已在上传时直接赋值给 ruleForm.mainImage) if (ruleForm.mainImage) { body.imageURL = ruleForm.mainImage; diff --git a/src/views/assets/asset/component/skuDialog.vue b/src/views/assets/asset/component/skuDialog.vue index 90929a1..c812a6b 100644 --- a/src/views/assets/asset/component/skuDialog.vue +++ b/src/views/assets/asset/component/skuDialog.vue @@ -78,9 +78,10 @@ - + @@ -131,10 +132,6 @@ - - - 无限库存 - 激活 @@ -199,6 +196,7 @@ const editSkuId = ref(''); const assetId = ref(''); const assetName = ref(''); const assetType = ref(''); +const unlimitedStock = ref(false); // 资产是否无限库存 const assetSpecAttrs = ref([]); const fileAddressPrefix = ref(''); const skuImagePreview = ref(''); @@ -264,10 +262,11 @@ const skuRules: FormRules = { }; // 打开弹窗 -const openDialog = (row: { id: string; name: string; type?: string }) => { +const openDialog = (row: { id: string; name: string; type?: string; unlimitedStock?: boolean }) => { assetId.value = row.id; assetName.value = row.name; assetType.value = row.type || ''; + unlimitedStock.value = row.unlimitedStock || false; dialogVisible.value = true; resetQuery(); getSkuList(); @@ -479,6 +478,12 @@ const onDeleteSku = (row: any) => { .catch(() => {}); }; +// 生成库存 +const onGenerateStock = (row: any) => { + // TODO: 实现生成库存功能 + ElMessage.info(`生成库存功能待实现,SKU: ${row.skuName}`); +}; + // 重置 SKU 表单 const resetSkuForm = () => { skuForm.skuName = ''; diff --git a/src/views/assets/asset/index.vue b/src/views/assets/asset/index.vue index fca335c..3eaae6c 100644 --- a/src/views/assets/asset/index.vue +++ b/src/views/assets/asset/index.vue @@ -112,6 +112,7 @@ interface AssetRow { onlineTime: string; offlineTime: string; status: number; + unlimitedStock: boolean; createdAt: string; updatedAt: string; } @@ -222,7 +223,12 @@ const onEdit = (row: AssetRow) => { // 管理SKU const onAddSku = (row: AssetRow) => { - skuDialogRef.value.openDialog(row); + skuDialogRef.value.openDialog({ + id: row.id, + name: row.name, + type: row.type, + unlimitedStock: row.unlimitedStock, + }); }; // 分页大小改变