fix: 合并代码

This commit is contained in:
duan 2025-04-21 15:26:19 +08:00
commit 2993c1375f
8 changed files with 351 additions and 263 deletions

View File

@ -22,6 +22,16 @@ url: jdbc:mysql://192.168.1.31:3306/czg_cashier?useUnicode=true&characterEncodin
username: root
password: Chaozg123.
## linux XTerminal连接
下载地址
<https://xterminal.cn/>
连接
地址192.168.1.31
端口号22
登录用户root
登录密码123456.
## linux命令
sudo nginx -t # 检查一下配置文件有没有写错别字之类的小毛病

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,14 @@
<svg width="121" height="120" viewBox="0 0 121 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_5_38)">
<circle cx="60.2939" cy="60" r="58.5" stroke="white" stroke-width="3"/>
<circle cx="60.2938" cy="60" r="51.1997" stroke="white" stroke-width="2" stroke-dasharray="2 2"/>
<line x1="19.8277" y1="50.637" x2="82.4435" y2="27.8676" stroke="white"/>
<line x1="36.7388" y1="93.3029" x2="99.3547" y2="70.5335" stroke="white"/>
<path d="M22.4599 62.0201C23.1265 62.5176 23.7976 63.0902 24.4821 63.7599L32.6011 60.8049L33.2304 62.3625L16.5189 68.445L18.5688 73.5186C20.4655 78.4692 21.3126 82.6787 21.0559 86.1414L19.2488 85.4463C19.4643 82.4581 18.6888 78.6819 16.8999 74.126L14.2207 67.4948L22.7005 64.4084C22.0609 63.8499 21.4032 63.3746 20.7815 62.9883L22.4599 62.0201ZM22.7471 66.8928L24.4471 66.6825C24.4958 67.3794 24.5266 68.0319 24.5574 68.6843L33.3529 65.483L33.9193 66.8849L24.56 70.2914C24.5039 71.9454 24.3398 73.4601 24.0676 74.8353L28.285 73.3004L27.1971 70.6078L28.8209 70.0168L29.9088 72.7093L34.938 70.8789L35.5224 72.3253L30.4932 74.1558L31.5001 76.648L38.2433 74.1937L38.8367 75.6623L32.0935 78.1167L33.514 81.6326L31.8902 82.2236L30.4697 78.7077L22.3282 81.671L21.7348 80.2023L29.8763 77.239L28.8694 74.7468L22.9606 76.8974L22.0649 75.6409C22.4993 74.2831 22.7672 72.7051 22.846 70.9153L19.4405 72.1547L18.8741 70.7528L22.8659 69.2999C22.8353 68.5198 22.7957 67.7175 22.7471 66.8928ZM35.6949 60.0106L41.8292 57.7779C41.8077 56.8924 41.7637 56.015 41.6655 55.1319L43.3928 54.7329C43.464 55.5493 43.5261 56.3435 43.5658 57.1459L55.1127 52.9431L55.742 54.5008L43.5862 58.9252C43.5249 61.1426 43.1977 63.2781 42.6272 65.3235L47.2034 76.65L45.6247 77.2246L41.8217 67.8118C41.3876 68.9143 40.9129 69.9804 40.3616 71.0489L38.8343 70.1499C40.6237 66.7675 41.6063 63.2448 41.8045 59.5736L36.3242 61.5683L35.6949 60.0106ZM45.8068 68.1992L52.3471 65.8187L51.511 63.7492C52.5088 62.5693 53.394 61.3027 54.1711 59.8967L45.6913 62.9831L45.089 61.4922L55.6436 57.6506L56.246 59.1415C55.4777 60.6974 54.5335 62.2662 53.4045 63.8258L53.9709 65.2277L59.609 63.1756L60.2294 64.711L54.5912 66.7631L56.2905 70.9688C56.8209 72.2817 56.414 73.1955 55.0834 73.6798L52.2644 74.7059L51.2245 73.3487C52.0454 73.0754 52.9114 72.7858 53.836 72.4492C54.5126 72.203 54.7296 71.7156 54.4599 71.048L52.9674 67.3541L46.4272 69.7346L45.8068 68.1992ZM57.6942 50.7528L76.9993 43.7263L77.6286 45.284L70.2313 47.9764C70.194 49.0365 70.08 50.099 69.8894 51.1638L70.303 52.1874C74.7565 52.9658 78.7948 54.125 82.4178 55.6651L81.8432 57.3802C78.698 55.8704 75.0971 54.7051 70.9862 53.8786L75.967 66.2065L74.2981 66.8139L69.1555 54.0855C68.0785 57.4384 66.217 60.7705 63.5756 64.0291L61.9582 63.0352C65.9314 58.2709 68.0832 53.4803 68.4271 48.6331L58.3236 52.3105L57.6942 50.7528ZM82.9851 41.1903L97.1482 36.0354L100.205 43.6012L94.1383 45.8093L95.6308 49.5032L103.073 46.7944L103.702 48.3521L96.2601 51.0609L98.1391 55.7116C99.4425 55.4159 100.989 54.955 102.749 54.3147C104.44 53.6991 105.843 53.1374 106.989 52.6438L107.185 54.4102C105.809 54.9109 104.56 55.3401 103.446 55.7201C99.3998 57.1671 96.5271 57.8043 94.796 57.6176C93.2813 57.4542 91.6187 56.6044 89.8622 55.0741C89.8232 57.5387 89.4373 59.7211 88.6821 61.6296L87.1322 60.7388C88.2721 57.6694 88.4342 54.0369 87.5961 49.8496L89.2916 49.5643C89.5381 50.8784 89.7124 52.1423 89.8056 53.3335C91.7197 55.0617 93.4544 55.9618 95.0413 56.0478C95.4336 56.0582 95.8709 56.0522 96.3669 55.9993L92.492 46.4085L86.0419 48.7561L82.9851 41.1903ZM97.9473 42.6873L96.1222 38.17L85.2293 42.1347L87.0544 46.652L97.9473 42.6873Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_5_38">
<rect width="120" height="120" fill="white" transform="translate(0.293854)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -587,7 +587,7 @@ export const useCartsStore = defineStore("carts", () => {
WebSocketManager.subscribeToTopic(initParams, (msg) => {
console.log("收到消息:", msg);
if (msg.hasOwnProperty('status') && msg.status != 1) {
return ElMessage.error(msg.message || '操作失败')
return ElMessage.error(msg.message || msg.msg || '操作失败')
}
if (msg && msg.data) {
if (Array.isArray(msg.data) && msg.data.length && msg.data[0].table_code) {

View File

@ -63,7 +63,7 @@
</el-radio-group>
</el-form-item>
<el-form-item label="套餐商品" v-if="ruleForm.type == 'package'">
<div style="display: block;width: 100%;">
<div style="display: block; width: 100%">
<div class="head-container">
<el-radio-group v-model="ruleForm.groupType" @change="typeChange">
<el-radio-button :label="0">固定套餐</el-radio-button>
@ -73,7 +73,7 @@
<div v-if="ruleForm.groupType == '0'">
<el-table border :data="item.goods" v-for="(item, index) in ruleForm.proGroupVo" :key="index">
<el-table-column label="名称" prop="proName"></el-table-column>
<el-table-column label="规格" prop="skuName"> </el-table-column>
<el-table-column label="规格" prop="skuName"></el-table-column>
<el-table-column label="价格" prop="price"></el-table-column>
<el-table-column label="数量" prop="number">
<template v-slot="scope">
@ -82,7 +82,9 @@
</el-table-column>
<el-table-column width="150">
<template #header>
<el-button type="primary" @click="addgoods(-1)" :disabled="isSyncStatus()">添加商品</el-button>
<el-button type="primary" @click="addgoods(-1)" :disabled="isSyncStatus()">
添加商品
</el-button>
</template>
<template v-slot="scope">
<el-button type="text" :disabled="scope.row.type != 'sku' && isSyncStatus()"
@ -103,10 +105,12 @@
<el-input v-model="item.number" :disabled="isSyncStatus()" />
</el-form-item>
<el-form-item>
<el-button @click="ruleForm.proGroupVo.splice(index, 1)" :disabled="isSyncStatus()">删除</el-button>
<el-button @click="ruleForm.proGroupVo.splice(index, 1)" :disabled="isSyncStatus()">
删除
</el-button>
</el-form-item>
</el-form>
<div style="margin-top: 20px;">
<div style="margin-top: 20px">
<el-table border :data="item.goods">
<el-table-column label="名称" prop="proName"></el-table-column>
<el-table-column label="规格" prop="skuName"></el-table-column>
@ -118,7 +122,9 @@
</el-table-column>
<el-table-column width="150">
<template #header>
<el-button type="primary" @click="addgoods(index);" :disabled="isSyncStatus()">添加商品</el-button>
<el-button type="primary" @click="addgoods(index)" :disabled="isSyncStatus()">
添加商品
</el-button>
</template>
<template v-slot="scope">
<el-button type="text" :disabled="scope.row.type != 'sku' && isSyncStatus()"
@ -130,7 +136,9 @@
</el-table>
</div>
</div>
<el-button type="primary" @click="addtaocan" :disabled="isSyncStatus()">添加套餐组</el-button>
<el-button type="primary" @click="addtaocan" :disabled="isSyncStatus()">
添加套餐组
</el-button>
</div>
</div>
</el-form-item>
@ -157,7 +165,7 @@
:info="ruleForm" :list="list" ref="specificationAttributeRef"></SpecificationAttribute>
<el-form-item label="重量">
<el-col :span="12">
<div style="display: block;">
<div style="display: block">
<el-input v-model="ruleForm.weight" placeholder="" :disabled="isSyncStatus()">
<template #append>千克</template>
</el-input>
@ -223,9 +231,7 @@
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm(ruleFormRef)">
确定
</el-button>
<el-button type="primary" @click="submitForm(ruleFormRef)">确定</el-button>
<el-button @click="resetForm(ruleFormRef)">取消</el-button>
</el-form-item>
</el-form>
@ -254,31 +260,33 @@
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
import { reactive, ref } from "vue";
import type { FormInstance, FormRules } from "element-plus";
//
import SpecificationAttribute from './SpecificationAttribute.vue'
import SpecificationAttribute from "./SpecificationAttribute.vue";
import { isSyncStatus } from "@/utils/index";
import UserAPI from "@/api/product/productclassification";
import UserAPI2 from "@/api/product/commonUnits";
import UserAPI3 from "@/api/product/index";
import UserAPI4 from "@/api/product/specificationsconfig";
import shopList from "@/components/mycomponents/shopList.vue";
import AddImg from '@/components/mycomponents/addImg.vue';
import { useRouter } from 'vue-router';
import AddImg from "@/components/mycomponents/addImg.vue";
import { useRouter } from "vue-router";
import { useTagsViewStore } from "@/store";
const tagsViewStore = useTagsViewStore();
const router = useRouter();
let list = ref<any[]>([{
"originPrice": 0,
"costPrice": 0,
"salePrice": 0,
"memberPrice": 0,
"suitNum": 1,
"coverImg": "",
"weight": 0,
"barCode": "88888888888888888888"
}]);
let list = ref<any[]>([
{
originPrice: 0,
costPrice: 0,
salePrice: 0,
memberPrice: 0,
suitNum: 1,
coverImg: "",
weight: 0,
barCode: "88888888888888888888",
},
]);
let datas = reactive<datasForm>({
cycle: [
{ label: "周一", value: "Monday" },
@ -287,7 +295,7 @@ let datas = reactive<datasForm>({
{ label: "周四", value: "Thursday" },
{ label: "周五", value: "Friday" },
{ label: "周六", value: "Saturday" },
{ label: "周七", value: "Sunday" }
{ label: "周七", value: "Sunday" },
],
Company: [],
classification: [],
@ -295,14 +303,14 @@ let datas = reactive<datasForm>({
specificationsconfig: [],
selectSpeclist: [],
defaultSku: {
"originPrice": 0,
"costPrice": 0,
"salePrice": 0,
"memberPrice": 0,
"suitNum": 1,
"coverImg": "",
"weight": 0,
"barCode": "88888888888888888888"
originPrice: 0,
costPrice: 0,
salePrice: 0,
memberPrice: 0,
suitNum: 1,
coverImg: "",
weight: 0,
barCode: "88888888888888888888",
},
specTableHeaders: [],
// -index
@ -311,78 +319,79 @@ let datas = reactive<datasForm>({
showSelectSku: false,
selectSkuItem: {},
addGroupIndex: -1,
})
let shopListRef = ref(null)
let addImg = ref(null)
let isedit = ref(true)
});
let shopListRef = ref(null);
let addImg = ref(null);
let isedit = ref(true);
interface datasForm {
cycle: { label: string, value: string }[],
Company: any[],
classification: any[],
specificationsconfig: any[],
selectSpeclist: any[],
defaultSku: any,
specTableHeaders: any[],
selectSkuTableIndex: any,
selectSkuConfirmIndex: number,
showSelectSku: boolean,
selectSkuItem: any,
addGroupIndex: any,
cycle: { label: string; value: string }[];
Company: any[];
classification: any[];
specificationsconfig: any[];
selectSpeclist: any[];
defaultSku: any;
specTableHeaders: any[];
selectSkuTableIndex: any;
selectSkuConfirmIndex: number;
showSelectSku: boolean;
selectSkuItem: any;
addGroupIndex: any;
}
interface RuleForm {
name: string,
shortTitle: string,
unitId: string,
categoryId: string,
coverImg: string,
images: string[],
type: string,
specId: any,
groupType: any,
skuList: string[],
weight: any,
isAllowTempModifyPrice: any,
days: any,
useTime: string[],
startTime: string,
endTime: string,
isSale: string,
isStock: string,
isHot: string,
stockNumber: any,
packFee: any,
sort: Number,
proGroupVo: any[],
selectSpecInfo: any
name: string;
shortTitle: string;
unitId: string;
categoryId: string;
coverImg: string;
images: string[];
type: string;
specId: any;
groupType: any;
skuList: string[];
weight: any;
isAllowTempModifyPrice: any;
days: any;
useTime: string[];
startTime: string;
endTime: string;
isSale: string;
isStock: string;
isHot: string;
stockNumber: any;
packFee: any;
sort: Number;
proGroupVo: any[];
selectSpecInfo: any;
}
const ruleFormRef = ref<FormInstance>()
const ruleFormRef = ref<FormInstance>();
const ruleForm = reactive<RuleForm>({
//
name: '',
name: "",
//
shortTitle: '',
shortTitle: "",
// id
unitId: '',
unitId: "",
// id
categoryId: '',
categoryId: "",
// url
coverImg: '',
coverImg: "",
// urls
images: [],
//
type: 'single',
type: "single",
// id
specId: '',
specId: "",
//
groupType: '0',
groupType: "0",
//
proGroupVo: [{
title: '',
count: '',
number: '',
goods: []
}],
proGroupVo: [
{
title: "",
count: "",
number: "",
goods: [],
},
],
// sku
skuList: [],
//
@ -390,10 +399,10 @@ const ruleForm = reactive<RuleForm>({
//
isAllowTempModifyPrice: 1,
//
days: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
useTime: ['00:00:00', '23:59:59'],
days: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
useTime: ["00:00:00", "23:59:59"],
//
startTime: '',
startTime: "",
//
endTime: "",
//
@ -408,37 +417,34 @@ const ruleForm = reactive<RuleForm>({
packFee: 0,
//
sort: 1,
selectSpecInfo: {}
})
selectSpecInfo: {},
});
const rules = reactive<FormRules<RuleForm>>({
name: [
{ required: true, message: '请输入商品名称', trigger: 'blur' },
],
name: [{ required: true, message: "请输入商品名称", trigger: "blur" }],
unitId: [
{
required: true,
message: '请选择单位',
trigger: 'change',
message: "请选择单位",
trigger: "change",
},
],
categoryId: [
{
required: true,
message: '请选择商品分类',
trigger: 'change',
message: "请选择商品分类",
trigger: "change",
},
],
images: [
{
required: true,
message: '请选择图片',
trigger: 'change',
message: "请选择图片",
trigger: "change",
},
],
})
});
onMounted(() => {
getList()
getList();
if (router.currentRoute.value.query.goods_id) {
tbProductGetDetail(router.currentRoute.value.query.goods_id);
}
@ -446,54 +452,51 @@ onMounted(() => {
watch(() => router.currentRoute.value.query.goods_id, (val) => {
tbProductGetDetail(val);
})
function pickerOptions(d) {
console.log(d, '11111111');
}
async function tbProductGetDetail(id: any) {
//
const res = await UserAPI3.getDetail(id);
changeTypeEnum(res.type)
changeTypeEnum(res.type);
for (const key in res) {
if (key !== 'images' && key !== 'days') {
if (key !== "images" && key !== "days") {
(ruleForm as any)[key] = res[key];
}
}
ruleForm.images = res.images.map((item: any, index: number) => item);
ruleForm.days = res.days.split(',');
ruleForm.days = res.days.split(",");
ruleForm.useTime = [res.startTime, res.endTime];
ruleForm.proGroupVo = res.groupSnap
ruleForm.proGroupVo = res.groupSnap;
if (res.type === "sku") {
await tbProductSpecGet()
selectSpecHandle(ruleForm.specId)
await tbProductSpecGet();
selectSpecHandle(ruleForm.specId);
datas.selectSpeclist.forEach((item: any) => {
item.selectSpecResult = res.selectSpecInfo[item.name]
item.selectSpecResult = res.selectSpecInfo[item.name];
// if (item.name === res.selectSpecInfo.name
// ) { }
// item.children.forEach((ele: any) => {
// item.selectSpecResult.push(ele.name)
// })
})
selectSpecResultChange()
});
selectSpecResultChange();
} else {
list.value = ruleForm.skuList
list.value = ruleForm.skuList;
}
}
// sku
function selectSkuHandle(item: any, index: number) {
// false
datas.selectSkuItem.skuList.map((item: any, index: number) => {
let nitem = { ...item }
nitem.active = false
datas.selectSkuItem.skuList[index] = nitem
})
let nitem = { ...item };
nitem.active = false;
datas.selectSkuItem.skuList[index] = nitem;
});
if (item.active) {
item.active = false
item.active = false;
} else {
item.active = true
item.active = true;
}
datas.selectSkuItem.skuList[index] = { ...item }
datas.selectSkuItem.skuList[index] = { ...item };
// let arr = datas.selectSkuItem.skuList.filter((item:any) => item.active)
@ -508,33 +511,39 @@ function addimgEvent() {
ElMessage.error('当前同步启用状态下不可修改')
return
}
(addImg.value as any)?.show()
(addImg.value as any)?.show();
}
//
function showSelectSkuConfirm() {
let item = datas.selectSkuItem.skuList.filter((item: any) => item.active)
ruleForm.proGroupVo[datas.selectSkuTableIndex].goods[datas.selectSkuConfirmIndex] = { ...ruleForm.proGroupVo[datas.selectSkuTableIndex].goods[datas.selectSkuConfirmIndex], skuId: item[0].id }
ruleForm.proGroupVo[datas.selectSkuTableIndex].goods[datas.selectSkuConfirmIndex] = { ...ruleForm.proGroupVo[datas.selectSkuTableIndex].goods[datas.selectSkuConfirmIndex], skuName: item[0].specInfo }
datas.showSelectSku = false
let item = datas.selectSkuItem.skuList.filter((item: any) => item.active);
ruleForm.proGroupVo[datas.selectSkuTableIndex].goods[datas.selectSkuConfirmIndex] = {
...ruleForm.proGroupVo[datas.selectSkuTableIndex].goods[datas.selectSkuConfirmIndex],
skuId: item[0].id,
};
ruleForm.proGroupVo[datas.selectSkuTableIndex].goods[datas.selectSkuConfirmIndex] = {
...ruleForm.proGroupVo[datas.selectSkuTableIndex].goods[datas.selectSkuConfirmIndex],
skuName: item[0].specInfo,
};
datas.showSelectSku = false;
}
//
function showSelectSkuHandle(row: any, index: any, tabIndex: any) {
datas.selectSkuTableIndex = tabIndex
datas.selectSkuConfirmIndex = index
datas.showSelectSku = true
datas.selectSkuTableIndex = tabIndex;
datas.selectSkuConfirmIndex = index;
datas.showSelectSku = true;
let obj = { ...row }
let obj = { ...row };
obj.skuList.map((item: any) => {
item.active = false
})
item.active = false;
});
datas.selectSkuItem = obj
datas.selectSkuItem = obj;
}
//
function addgoods(index: number = -1) {
datas.addGroupIndex = index;
(shopListRef.value as any)?.opens()
(shopListRef.value as any)?.opens();
}
function deleteEvent(d: any) {
if (isSyncStatus()) {
@ -549,45 +558,45 @@ function successEvent(d: any) {
}
//
function selectShopRes(res: Array<any>) {
let newres = res.map(item => {
item.proId = item.id
item.proName = item.name
item.price = item.lowPrice
item.skuId = item.skuList[0].id
item.skuName = ''
item.number = 1
let newres = res.map((item) => {
item.proId = item.id;
item.proName = item.name;
item.price = item.lowPrice;
item.skuId = item.skuList[0].id;
item.skuName = "";
item.number = 1;
// skuid
return item
})
return item;
});
if (ruleForm.groupType == '0') {
if (ruleForm.groupType == "0") {
let obj = {
title: '',
title: "",
count: newres.length,
number: '',
goods: newres
}
ruleForm.proGroupVo = [{ ...obj }]
number: "",
goods: newres,
};
ruleForm.proGroupVo = [{ ...obj }];
} else {
if (datas.addGroupIndex != -1) {
ruleForm.proGroupVo[datas.addGroupIndex].count = newres.length
ruleForm.proGroupVo[datas.addGroupIndex].goods = newres
ruleForm.proGroupVo[datas.addGroupIndex].count = newres.length;
ruleForm.proGroupVo[datas.addGroupIndex].goods = newres;
} else {
let arr = [...ruleForm.proGroupVo]
let arr = [...ruleForm.proGroupVo];
arr.push({
title: '',
title: "",
count: newres.length,
number: '',
goods: newres
})
ruleForm.proGroupVo = [...arr]
number: "",
goods: newres,
});
ruleForm.proGroupVo = [...arr];
}
}
}
//
async function getList() {
datas.Company = (await UserAPI2.getList(null)) as any[]
datas.classification = (await UserAPI.getList(null)) as any[]
datas.Company = (await UserAPI2.getList(null)) as any[];
datas.classification = (await UserAPI.getList(null)) as any[];
}
//
function selectSpecResultChange() {
@ -611,7 +620,7 @@ function createSkuHeader() {
//
function addtaocan() {
datas.addGroupIndex = -1;
(shopListRef.value as any)?.opens()
(shopListRef.value as any)?.opens();
}
//
function createSkuBody() {
@ -641,7 +650,6 @@ function createSkuBody() {
for (let key in v) {
obj[`${key}`] = v[key];
specSnap.push(v[key]);
}
}
let specSnapStr = specSnap.join(",");
@ -669,18 +677,18 @@ function createSkuBody() {
}
if (ruleForm.skuList.length) {
if (isedit.value) {
let arr: any[] = []
let arr: any[] = [];
ruleForm.skuList.forEach((item: any, index: number) => {
newarr.forEach((val: any, i: number) => {
if (item.specInfo == val.specInfo) {
// newarr[i] = item
Object.assign(val, item)
arr.push(val)
Object.assign(val, item);
arr.push(val);
}
});
});
list.value = arr
isedit.value = false
list.value = arr;
isedit.value = false;
} else {
list.value = newarr;
}
@ -691,13 +699,13 @@ function createSkuBody() {
//
function changeTypeEnum(item: string) {
// single- sku- package- weight- coupon-
list.value = []
if (item == 'sku') {
list.value = [];
if (item == "sku") {
tbProductSpecGet();
} else {
ruleForm.specId = ""
datas.selectSpeclist = []
list.value = [datas.defaultSku]
ruleForm.specId = "";
datas.selectSpeclist = [];
list.value = [datas.defaultSku];
}
}
//
@ -718,114 +726,116 @@ function cartesian(arr) {
//
function typeChange() {
// ruleForm.typeEnum = 'normal'
if (ruleForm.groupType == '0') {
ruleForm.proGroupVo = []
if (ruleForm.groupType == "0") {
ruleForm.proGroupVo = [];
ruleForm.proGroupVo[0] = {
title: '',
count: '',
title: "",
count: "",
number: 1,
goods: []
}
goods: [],
};
} else {
ruleForm.proGroupVo = []
ruleForm.proGroupVo = [];
}
// this.changeTypeEnum()
}
//
async function tbProductSpecGet() {
datas.specificationsconfig = (await UserAPI4.getPage(null)) as []
datas.specificationsconfig = (await UserAPI4.getPage(null)) as [];
}
//
function selectSpecHandle(e: any) {
const selectSpec = JSON.parse(JSON.stringify(datas.specificationsconfig.find((item) => item.id == e).children));
const selectSpec = JSON.parse(
JSON.stringify(datas.specificationsconfig.find((item) => item.id == e).children)
);
for (let item in selectSpec) {
selectSpec[item].selectSpecResult = [];
}
datas.selectSpeclist = selectSpec;
}
const specificationAttributeRef = ref(null)
const specificationAttributeRef = ref(null);
const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return
if (!formEl) return;
await formEl.validate(async (valid, fields) => {
if (valid) {
<<<<<<< HEAD
=======
>>>>>>> 2602916201f0e12ac5cb51e5a88d69cfaaeb7baf
//
ruleForm.coverImg = ruleForm.images[0]
ruleForm.coverImg = ruleForm.images[0];
// id
// ruleForm.specId = specIdFunction(ruleForm.type)
let selectTitle = false
ruleForm.proGroupVo.forEach((item: any) => {
})
let selectTitle = false;
ruleForm.proGroupVo.forEach((item: any) => { });
if (selectTitle) {
ElMessage.error('请填写组名和几选几')
return
ElMessage.error("请填写组名和几选几");
return;
}
// sku
ruleForm.skuList = (specificationAttributeRef.value as any)?.getdata()
ruleForm.skuList = (specificationAttributeRef.value as any)?.getdata();
// selectSpecInfo
if (ruleForm.type == 'sku') {
let obj: any = {}
if (ruleForm.type == "sku") {
let obj: any = {};
datas.selectSpeclist.forEach((item: any) => {
obj[item.name] = item.selectSpecResult
})
ruleForm.selectSpecInfo = obj
} else if (ruleForm.type == 'package') {
obj[item.name] = item.selectSpecResult;
});
ruleForm.selectSpecInfo = obj;
} else if (ruleForm.type == "package") {
// console.log(ruleForm, '')
}
//
if (ruleForm.type == "package") {
if (ruleForm.groupType == '1') {
let selectTitle = false
if (ruleForm.groupType == "1") {
let selectTitle = false;
ruleForm.proGroupVo.forEach((item: any) => {
if (item.number == '' || item.title == '') {
selectTitle = true
if (item.number == "" || item.title == "") {
selectTitle = true;
}
})
});
if (selectTitle) {
ElMessage.error('请填写组名和几选几')
return
ElMessage.error("请填写组名和几选几");
return;
}
}
}
ruleForm.days = ruleForm.days.join(',')
setTimeout(() => {
ruleForm.days = ruleForm.days.split(',')
ruleForm.days = ruleForm.days.split(",");
}, 200);
if (ruleForm.type == 'weight') {
ruleForm.specId = ''
if (ruleForm.type == "weight") {
ruleForm.specId = "";
}
if (ruleForm.id) {
let res = await UserAPI3.update(ruleForm)
let res = await UserAPI3.update(ruleForm);
if (res.code == 200) {
ElMessage.success("修改成功");
}
} else {
let res = await UserAPI3.addunit(ruleForm)
let res = await UserAPI3.addunit(ruleForm);
if (res.code == 200) {
ElMessage.success("添加成功");
}
}
setTimeout(() => {
closeSelectedTag({
"name": "addgoods",
"title": "新增商品",
"path": "/product/addgoods",
"fullPath": "/product/addgoods",
})
name: "addgoods",
title: "新增商品",
path: "/product/addgoods",
fullPath: "/product/addgoods",
});
}, 500);
setTimeout(() => {
router.push({ path: '/product/index' });
router.push({ path: "/product/index" });
}, 1000);
} else {
ElMessage.error("请填写完整信息");
console.log('error submit!', fields)
console.log("error submit!", fields);
}
})
}
});
};
//
function closeSelectedTag(view: TagView) {
@ -837,31 +847,31 @@ function closeSelectedTag(view: TagView) {
}
// id
const specIdFunction = (type: string) => {
if (type === 'single') {
return ''
} else if (type === '2') {
return 2
} else if (type === '3') {
return 3
} else if (type === '4') {
return 4
} else if (type === '5') {
return 5
if (type === "single") {
return "";
} else if (type === "2") {
return 2;
} else if (type === "3") {
return 3;
} else if (type === "4") {
return 4;
} else if (type === "5") {
return 5;
}
}
};
const resetForm = (formEl: FormInstance | undefined) => {
closeSelectedTag({
"name": "addgoods",
"title": "新增商品",
"path": "/product/addgoods",
"fullPath": "/product/addgoods",
"affix": false,
"keepAlive": true,
"query": {}
})
if (!formEl) return
formEl.resetFields()
}
name: "addgoods",
title: "新增商品",
path: "/product/addgoods",
fullPath: "/product/addgoods",
affix: false,
keepAlive: true,
query: {},
});
if (!formEl) return;
formEl.resetFields();
};
</script>
<style scoped lang="scss">
.addgoods {
@ -884,7 +894,7 @@ const resetForm = (formEl: FormInstance | undefined) => {
}
.tag {
background-color: #F7F7FA;
background-color: #f7f7fa;
padding: 6px 12px;
margin-right: 10px;
border-radius: 4px;
@ -895,7 +905,7 @@ const resetForm = (formEl: FormInstance | undefined) => {
}
&.active {
background-color: #46A6FF;
background-color: #46a6ff;
color: #fff;
}
}
@ -905,7 +915,7 @@ const resetForm = (formEl: FormInstance | undefined) => {
.group_wrap {
padding: 20px;
background-color: #F7F7FA;
background-color: #f7f7fa;
margin-bottom: 20px;
}

View File

@ -13,17 +13,18 @@
</div>
<div class="">{{ item.lowPrice }}</div>
</div>
<div class="status" v-if="item.isSoldStock || !item.isSale || !item.isSaleTime">
<svg-icon
@click="ElMessage.error('该商品已售罄')"
v-if="item.isSoldStock"
iconClass="shouqing"
color="#fff"
size="60"
></svg-icon>
<div
class="status"
v-if="
item.isSoldStock ||
!item.isSale ||
!item.isSaleTime ||
(item.isStock && item.stockNumber * 1 <= 0)
"
>
<svg-icon
@click="ElMessage.error('该商品已下架')"
v-else-if="!item.isSale"
v-if="!item.isSale"
iconClass="yi-xiajia"
color="#fff"
size="60"
@ -35,6 +36,20 @@
color="#fff"
size="60"
></svg-icon>
<svg-icon
@click="ElMessage.error('该商品已售罄')"
v-else-if="item.isSoldStock"
iconClass="shouqing"
color="#fff"
size="60"
></svg-icon>
<svg-icon
@click="ElMessage.error('库存不足')"
v-else-if="item.isStock && item.stockNumber * 1 <= 0"
iconClass="stock_null"
color="#fff"
size="60"
></svg-icon>
</div>
</div>
</template>