在线商城增加商品性质
This commit is contained in:
1 parent
8b4af2d868
commit
2837db2d6b
1 file changed
+13
-5
@@ -28,6 +28,13 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="8" class="mb20">
|
||||||
|
<el-form-item label="商品性质" prop="productNature">
|
||||||
|
<el-select v-model="form.productNature" placeholder="请选择商品性质">
|
||||||
|
<el-option :value="item.value" :label="item.label" v-for="(item, index) in supermarket_nature" :key="index" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="24" class="mb20">
|
<el-col :span="24" class="mb20">
|
||||||
<el-form-item label="商品封面图" prop="picUrl" required>
|
<el-form-item label="商品封面图" prop="picUrl" required>
|
||||||
<upload-img v-model:imageUrl="form.picUrl"></upload-img>
|
<upload-img v-model:imageUrl="form.picUrl"></upload-img>
|
||||||
@@ -195,13 +202,13 @@ const dataFormRef = ref();
|
|||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
const loading = 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({
|
const form = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
productCode: '',
|
productCode: '',
|
||||||
productName: '',
|
productName: '',
|
||||||
|
productNature: "",
|
||||||
description: '',
|
description: '',
|
||||||
categoryId: '',
|
categoryId: '',
|
||||||
picUrl: '',
|
picUrl: '',
|
||||||
@@ -220,6 +227,7 @@ const form = reactive({
|
|||||||
|
|
||||||
// 定义校验规则
|
// 定义校验规则
|
||||||
const dataRules = ref({
|
const dataRules = ref({
|
||||||
|
productNature: [{ required: true, message: "请选择商品性质", trigger: "blur" }],
|
||||||
productCode: [{ required: true, message: '货号不能为空', trigger: 'blur' }],
|
productCode: [{ required: true, message: '货号不能为空', trigger: 'blur' }],
|
||||||
productName: [{ required: true, message: '商品名称不能为空', trigger: 'blur' }],
|
productName: [{ required: true, message: '商品名称不能为空', trigger: 'blur' }],
|
||||||
categoryId: [{ required: true, message: '商品分类不能为空', trigger: 'change' }],
|
categoryId: [{ required: true, message: '商品分类不能为空', trigger: 'change' }],
|
||||||
@@ -298,10 +306,10 @@ const onSubmit = async () => {
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
// merchantIds 逗号分隔字符串
|
// merchantIds 逗号分隔字符串
|
||||||
const merchantIds = selectedMerchants.value.map(m => m.id).join(',');
|
const merchantIds = selectedMerchants.value.map(m => m.id).join(',');
|
||||||
const submitForm = {
|
const submitForm = {
|
||||||
...form,
|
...form,
|
||||||
categoryId: Array.isArray(form.categoryId) ? form.categoryId.slice(-1)[0] : form.categoryId,
|
categoryId: Array.isArray(form.categoryId) ? form.categoryId.slice(-1)[0] : form.categoryId,
|
||||||
merchantIds
|
merchantIds
|
||||||
};
|
};
|
||||||
form.id ? await putObj(submitForm) : await addObj(submitForm);
|
form.id ? await putObj(submitForm) : await addObj(submitForm);
|
||||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||||
|
|||||||
Reference in new issue
Block a user