完成商城下单功能
This commit is contained in:
@@ -70,15 +70,15 @@
|
||||
/>
|
||||
<div class="ele-text-placeholder">上传视频(mp4格式),视频时长不超过60秒,视频大小不超过200M。</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="商品标题" name="title">
|
||||
<a-form-item label="商品名称" name="goodsName">
|
||||
<a-space style="margin-bottom: 20px">
|
||||
<a-input
|
||||
allow-clear
|
||||
show-count
|
||||
:maxlength="60"
|
||||
style="width: 558px"
|
||||
placeholder="请输入商品标题"
|
||||
v-model:value="form.title"
|
||||
placeholder="请输入商品名称"
|
||||
v-model:value="form.goodsName"
|
||||
/>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
@@ -291,15 +291,14 @@
|
||||
import { FormInstance, RuleObject } from 'ant-design-vue/es/form';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import {getDictionaryOptions, openUrl} from '@/utils/common';
|
||||
import { getDictionaryOptions, getMerchantId, openUrl } from "@/utils/common";
|
||||
import { addGoods, updateGoods } from '@/api/shop/goods';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { BathSet, Goods } from '@/api/shop/goods/model';
|
||||
import {PlusCircleOutlined, PlusOutlined} from '@ant-design/icons-vue';
|
||||
import {PlusCircleOutlined} from '@ant-design/icons-vue';
|
||||
import { getGoods } from '@/api/shop/goods';
|
||||
import CategorySelect from '@/views/cms/article/components/category-select.vue';
|
||||
import { listGoodsCategory } from '@/api/shop/goodsCategory';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
import {toTreeData, uuid} from 'ele-admin-pro';
|
||||
@@ -309,6 +308,7 @@
|
||||
import {ColumnItem} from "ele-admin-pro/es/ele-pro-table/types";
|
||||
import {listSpec} from '@/api/shop/spec';
|
||||
import {Spec} from "@/api/shop/spec/model";
|
||||
import { getMerchantName } from "@/utils/merchant";
|
||||
|
||||
const { currentRoute } = useRouter();
|
||||
// 是否开启响应式布局
|
||||
@@ -346,7 +346,7 @@
|
||||
const { form, assignFields } = useFormData<Goods>({
|
||||
goodsId: undefined,
|
||||
type: 1,
|
||||
title: '',
|
||||
goodsName: '',
|
||||
image: '',
|
||||
content: '',
|
||||
code: '',
|
||||
@@ -367,7 +367,8 @@
|
||||
comments: '',
|
||||
recommend: 0,
|
||||
sortNumber: undefined,
|
||||
status: undefined
|
||||
status: undefined,
|
||||
merchantId: getMerchantId()
|
||||
});
|
||||
const skuColumns = ref<ColumnItem[]>([
|
||||
{
|
||||
@@ -463,10 +464,10 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
title: [
|
||||
goodsName: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择商品标题',
|
||||
message: '请选择商品名称',
|
||||
type: 'string',
|
||||
trigger: 'blur'
|
||||
}
|
||||
@@ -681,7 +682,6 @@
|
||||
};
|
||||
|
||||
const chooseGoodsCategory = (item,value) => {
|
||||
console.log(value);
|
||||
form.categoryId = value[1].value;
|
||||
form.categoryParent = value[0].label;
|
||||
form.categoryChildren = value[1].label;
|
||||
@@ -881,6 +881,8 @@
|
||||
const formData = {
|
||||
...form,
|
||||
content: content.value,
|
||||
merchantId: getMerchantId(),
|
||||
merchantName: getMerchantName(),
|
||||
image: JSON.stringify(imgList.value),
|
||||
files: JSON.stringify(fileList.value),
|
||||
goodsSpecs: specList.value,
|
||||
@@ -890,6 +892,10 @@
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
imgList.value = []
|
||||
fileList.value = []
|
||||
category.value = []
|
||||
resetFields();
|
||||
message.success(msg);
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -911,6 +917,8 @@
|
||||
reload();
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
imgList.value = []
|
||||
fileList.value = []
|
||||
// images.value = [];
|
||||
// skuList.value = [];
|
||||
// specList.value = [];
|
||||
|
||||
Reference in New Issue
Block a user