diff --git a/src/views/supermarket/shopSpu/form.vue b/src/views/supermarket/shopSpu/form.vue
index a2ea1ad..587f848 100644
--- a/src/views/supermarket/shopSpu/form.vue
+++ b/src/views/supermarket/shopSpu/form.vue
@@ -28,6 +28,13 @@
/>
+
+
+
+
+
+
+
@@ -195,13 +202,13 @@ const dataFormRef = ref();
const visible = ref(false)
const loading = ref(false)
// 定义字典
-const {spu_status} = useDict('spu_status')
-
+const { supermarket_nature,spu_status} = useDict("supermarket_nature",'spu_status')
// 提交表单数据
const form = reactive({
id: '',
productCode: '',
productName: '',
+ productNature: "",
description: '',
categoryId: '',
picUrl: '',
@@ -220,6 +227,7 @@ const form = reactive({
// 定义校验规则
const dataRules = ref({
+ productNature: [{ required: true, message: "请选择商品性质", trigger: "blur" }],
productCode: [{ required: true, message: '货号不能为空', trigger: 'blur' }],
productName: [{ required: true, message: '商品名称不能为空', trigger: 'blur' }],
categoryId: [{ required: true, message: '商品分类不能为空', trigger: 'change' }],
@@ -298,10 +306,10 @@ const onSubmit = async () => {
loading.value = true;
// merchantIds 逗号分隔字符串
const merchantIds = selectedMerchants.value.map(m => m.id).join(',');
- const submitForm = {
- ...form,
+ const submitForm = {
+ ...form,
categoryId: Array.isArray(form.categoryId) ? form.categoryId.slice(-1)[0] : form.categoryId,
- merchantIds
+ merchantIds
};
form.id ? await putObj(submitForm) : await addObj(submitForm);
useMessage().success(form.id ? '修改成功' : '添加成功');