feat: 修改商品类型错误

This commit is contained in:
duan
2025-02-24 09:44:05 +08:00
parent 7a508800f4
commit bad27514f3

View File

@@ -137,7 +137,7 @@
</el-table>
</div>
</div>
<el-button type="primary" @click="$refs.shopListRef.show(); addGroupIndex = false">添加套餐组</el-button>
<el-button type="primary" @click="addtaocan">添加套餐组</el-button>
</div>
</div>
</el-form-item>
@@ -335,11 +335,11 @@ interface RuleForm {
coverImg: string,
images: string[],
type: string,
specId: string,
specId: any,
groupType: string,
skuList: string[],
weight: Number,
isAllowTempModifyPrice: Number,
weight: any,
isAllowTempModifyPrice: any,
days: string[],
useTime: string[],
startTime: string,
@@ -347,10 +347,11 @@ interface RuleForm {
isSale: string,
isStock: string,
isHot: string,
stockNumber: Number,
packFee: Number,
stockNumber: any,
packFee: any,
sort: Number,
proGroupVo: any[],
selectSpecInfo: any
}
const ruleFormRef = ref<FormInstance>()
const ruleForm = reactive<RuleForm>({
@@ -404,6 +405,7 @@ const ruleForm = reactive<RuleForm>({
packFee: 0,
// 排序值
sort: 1,
selectSpecInfo: {}
})
const rules = reactive<FormRules<RuleForm>>({
name: [
@@ -509,14 +511,14 @@ function selectShopRes(res: Array<any>) {
// this.form.proGroupVo[this.addGroupIndex].count = newres.length
// this.form.proGroupVo[this.addGroupIndex].goods = newres
// } else {
// let arr = [...this.form.proGroupVo]
// arr.push({
// title: '',
// count: newres.length,
// number: '',
// goods: newres
// })
// this.form.proGroupVo = [...arr]
let arr = [...ruleForm.proGroupVo]
arr.push({
title: '',
count: newres.length,
number: '',
goods: newres
})
ruleForm.proGroupVo = [...arr]
// }
}
}
@@ -544,7 +546,10 @@ function createSkuHeader() {
}
datas.specTableHeaders = headers;
}
// 可选套餐弹窗
function addtaocan() {
(shopListRef.value as any)?.opens()
}
// 生成多规格表体
function createSkuBody() {
let bodys = [];
@@ -615,19 +620,20 @@ function changeTypeEnum(item: string) {
}
}
// 笛卡尔积算法
function cartesian(arr: any) {
function cartesian(arr: any[]) {
if (arr.length < 2) return arr[0] || [];
return [].reduce.call(arr, (col, set) => {
let res = [];
col.forEach((c) => {
set.forEach((s) => {
let t = [].concat(Array.isArray(c) ? c : [c]);
return [].reduce.call(arr, (col: any, set: any, index) => {
let res = <any>[];
col.forEach((c: any) => {
set.forEach((s: any) => {
let arr: any = Array.isArray(c) ? c : [c]
let t: any[] = [].concat(arr);
t.push(s);
res.push(t);
});
});
return res;
});
}, []);
}
// 套餐类型切换
function typeChange() {
@@ -671,10 +677,10 @@ const submitForm = async (formEl: FormInstance | undefined) => {
ruleForm.startTime = ruleForm.useTime[0]
ruleForm.endTime = ruleForm.useTime[1]
// 拿到sku数据
ruleForm.skuList = specificationAttributeRef.value.getdata()
ruleForm.skuList = (specificationAttributeRef.value as any)?.getdata()
// 多规格 selectSpecInfo 添加
if (ruleForm.type == 'sku') {
let obj = {}
let obj: any = {}
datas.selectSpeclist.forEach((item: any) => {
obj[item.name] = item.selectSpecResult
})
@@ -717,7 +723,7 @@ function closeSelectedTag(view: TagView) {
// 规格id过滤
const specIdFunction = (type: string) => {
if (type === 'single') {
return null
return ''
} else if (type === '2') {
return 2
} else if (type === '3') {
@@ -781,4 +787,10 @@ const resetForm = (formEl: FormInstance | undefined) => {
}
}
}
.group_wrap {
padding: 20px;
background-color: #F7F7FA;
margin-bottom: 20px;
}
</style>