feat: 优化组件导入与样式调整

- 在多个组件中将 require 替换为 import,提升代码可读性和一致性。
- 在 App.vue 中添加分类树的 API 请求,优化分类数据的加载逻辑。
- 更新样式以适配 Element Plus 组件,确保界面一致性。
- 删除不再使用的样式文件,简化项目结构。
This commit is contained in:
田香琪
2026-07-07 19:50:07 +08:00
parent cc86430ea4
commit 6b61b86585
42 changed files with 303 additions and 1375 deletions

View File

@@ -94,7 +94,7 @@
width: 100%;
}
>.ivu-form {
>.el-form {
flex-wrap: wrap !important;
}
@@ -175,11 +175,11 @@ div.base-info-item {
justify-content: flex-start;
width: 100%;
>.ivu-card-body {
>.el-card__body {
width: 100%;
}
.ivu-card-body {
.el-card__body {
width: 100%;
justify-content: center;
align-items: flex-start;
@@ -344,7 +344,7 @@ div.base-info-item {
text-align: center;
z-index: 999;
>.ivu-btn {
>.el-button {
margin: 0 10px;
}
}

View File

@@ -78,6 +78,8 @@
</template>
<script>
import * as API_GOODS from "@/api/goods";
import goodsType1Img from "@/assets/goodsType1.png";
import goodsType2Img from "@/assets/goodsType2.png";
export default {
data() {
return {
@@ -85,14 +87,14 @@ export default {
goodsTypeWay: [
{
title: "实物商品",
img: require("@/assets/goodsType1.png"),
img: goodsType1Img,
desc: "零售批发,物流配送",
type: "PHYSICAL_GOODS",
check: false,
},
{
title: "虚拟商品",
img: require("@/assets/goodsType2.png"),
img: goodsType2Img,
desc: "虚拟核验,无需物流",
type: "VIRTUAL_GOODS",
check: false,

View File

@@ -10,10 +10,10 @@
<div class="form-item-view">
<el-form-item label="商品分类">
<span class="goods-category-name">{{
this.baseInfoForm.categoryName[0]
baseInfoForm.categoryName[0]
}}</span>
<span> &gt; {{ this.baseInfoForm.categoryName[1] }}</span>
<span> &gt; {{ this.baseInfoForm.categoryName[2] }}</span>
<span> &gt; {{ baseInfoForm.categoryName[1] }}</span>
<span> &gt; {{ baseInfoForm.categoryName[2] }}</span>
</el-form-item>
<el-form-item label="商品名称" prop="goodsName">
<el-input v-model="baseInfoForm.goodsName" clearable placeholder="商品名称" style="width: 260px" type="text" />
@@ -190,7 +190,7 @@
<el-collapse-item title="自定义规格项" name="1">
<div>
<div v-for="(item, $index) in skuInfo" :key="$index" class="sku-item-content">
<el-card class="ivu-card-body">
<el-card>
<template #header>
<el-button link type="danger" @click="handleCloseSkuItem($index, item)">删除规格项</el-button>
</template>
@@ -478,7 +478,7 @@
<div class="footer-btns">
<el-button type="primary" @click="pre">上一步</el-button>
<el-button :loading="submitLoading" type="primary" @click="save">
{{ this.$route.query.id ? "保存" : "保存商品" }}
{{ $route.query.id ? "保存" : "保存商品" }}
</el-button>
</div>
</div>
@@ -1310,7 +1310,12 @@ export default {
this.params_panel = [];
API_GOODS.getCategoryParamsListDataSeller(this.categoryId).then(
(response) => {
if (!response || response.length <= 0) {
const list = Array.isArray(response)
? response
: Array.isArray(response?.result)
? response.result
: [];
if (!list.length) {
return;
}
@@ -1355,15 +1360,15 @@ export default {
return undefined;
};
const isGrouped = response[0] && Array.isArray(response[0].params);
const isGrouped = list[0] && Array.isArray(list[0].params);
const flatParams = isGrouped
? response.reduce((acc, g) => {
? list.reduce((acc, g) => {
if (g && Array.isArray(g.params)) {
acc.push(...g.params);
}
return acc;
}, [])
: response;
: list;
this.goodsParams = flatParams
.map((p) => {
@@ -1547,7 +1552,7 @@ export default {
}
} else if (val._error) {
// 清除错误
this.$delete(val, '_error');
delete val._error;
if (this.skuInfo[groupIndex]) {
this.skuInfo[groupIndex].spec_values = this.skuInfo[groupIndex].spec_values.filter((i) => i.value !== "");
}
@@ -2316,7 +2321,7 @@ export default {
</style>
<style scoped>
.ivu-select .ivu-select-dropdown {
.el-select .el-select-dropdown {
overflow: hidden !important;
}