Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yongxinda-admin
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
刘旭
yongxinda-admin
Commits
e940bf3f
提交
e940bf3f
authored
11月 01, 2022
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补全修改
上级
5edc9119
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
50 行增加
和
69 行删除
+50
-69
edit.vue
src/views/commodityManage/edit.vue
+22
-56
selectSpec.vue
src/views/commodityManage/selectSpec.vue
+17
-1
shelves.vue
src/views/commodityManage/shelves.vue
+11
-12
没有找到文件。
src/views/commodityManage/edit.vue
浏览文件 @
e940bf3f
...
...
@@ -79,8 +79,12 @@
</el-form-item>
<el-form-item
label=
"所属分类"
>
<el-cascader
v-model=
"categoryIds"
:options=
"categoryList"
expand-trigger=
"hover"
clearable
@
change=
"handleCategoryChange"
/>
<!-- <el-cascader v-model="categoryIds" :options="categoryList" expand-trigger="hover" clearable
@change="handleCategoryChange" /> -->
<el-select
v-model=
"goods.categoryId"
placeholder=
"请选择"
@
change=
"handleCategoryChange"
>
<el-option
v-for=
"item in categoryList"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"所属品牌商"
>
...
...
@@ -105,13 +109,7 @@
<h3>
商品规格
</h3>
<el-row
:gutter=
"20"
type=
"flex"
align=
"middle"
style=
"padding: 20px 0"
>
<el-col
:span=
"10"
>
<el-radio-group
v-model=
"multipleSpec"
@
change=
"specChanged"
>
<!-- <el-radio-button :label="false">默认标准规格</el-radio-button> -->
<el-radio-button
:label=
"true"
>
多规格支持
</el-radio-button>
</el-radio-group>
</el-col>
<el-col
v-if=
"multipleSpec"
:span=
"10"
>
<el-button
:plain=
"true"
type=
"primary"
@
click=
"handleSpecificationShow"
>
添加
</el-button>
<el-button
type=
"primary"
@
click=
"handleSpecificationShow"
>
添加
</el-button>
</el-col>
</el-row>
...
...
@@ -174,6 +172,9 @@
</el-dialog>
</el-card>
<selectSpec
ref=
"selectSpecRef"
:specData=
"specifications"
:products=
"products"
@
productsData=
"productsData"
/>
<el-card
class=
"box-card"
>
<h3>
商品参数
</h3>
<el-button
type=
"primary"
@
click=
"handleAttributeShow"
>
添加
</el-button>
...
...
@@ -221,6 +222,7 @@ import { ElMessageBox, ElMessage, ElNotification } from "element-plus";
import
richTextEditor
from
'@/components/richTextEditor.vue'
import
{
listGoods
}
from
"@/services/api/commodityManage/list"
;
import
{
getDictList
,
getDictItemList
}
from
'@/services/api/market/auxiliary'
import
selectSpec
from
'./selectSpec.vue'
let
editDrawer
=
ref
(
false
)
let
newKeywordVisible
=
ref
(
false
);
...
...
@@ -251,17 +253,9 @@ let specVisiable = ref(false);
let
specForm
=
ref
({
specification
:
""
,
value
:
""
,
picUrl
:
""
}
as
any
);
let
multipleSpec
=
ref
(
true
);
let
specifications
=
ref
([]
as
any
);
let
productVisiable
=
ref
(
false
);
let
productForm
=
ref
({
id
:
0
,
specifications
:
[],
price
:
0.0
,
number
:
0
,
url
:
""
,
});
let
products
=
ref
([
{
id
:
0
,
specifications
:
[
"标准"
],
price
:
0.0
,
number
:
0
,
url
:
""
},
]);
let
products
=
ref
([]);
let
selectSpecRef
=
ref
();
let
attributeVisiable
=
ref
(
false
);
let
attributeForm
=
ref
({
attribute
:
""
,
value
:
""
}
as
any
);
let
attributes
=
ref
([]
as
any
);
...
...
@@ -295,9 +289,6 @@ let init = (id: number) => {
for
(
let
s
in
res
.
data
.
parts
)
{
goodsParts
.
value
.
push
(
res
.
data
.
parts
[
s
].
partGoodsId
)
}
// partsList.value = res.data.parts
console
.
log
(
res
.
data
);
// 稍微调整一下前后端不一致
if
(
goods
.
value
?.
brandId
===
0
)
{
...
...
@@ -309,8 +300,8 @@ let init = (id: number) => {
specifications
.
value
=
res
.
data
.
specifications
;
products
.
value
=
res
.
data
.
products
;
attributes
.
value
=
res
.
data
.
attributes
;
selectSpecRef
.
value
.
setAttributes
(
res
.
data
.
products
)
categoryIds
.
value
=
res
.
data
.
categoryIds
;
galleryFileList
.
value
=
[];
for
(
var
i
=
0
;
i
<
goods
.
value
?.
gallery
.
length
;
i
++
)
{
galleryFileList
.
value
.
push
({
...
...
@@ -331,9 +322,12 @@ let init = (id: number) => {
let
htmlChange
=
(
value
:
any
)
=>
goods
.
value
.
detail
=
value
let
productsData
=
(
data
:
any
)
=>
{
products
.
value
=
data
}
let
handleCategoryChange
=
(
value
:
any
)
=>
{
goods
.
value
.
categoryId
=
value
[
value
.
length
-
1
];
//
goods.value.categoryId = value[value.length - 1];
}
let
handleCancel
=
()
=>
{
goods
.
value
=
{
...
...
@@ -353,7 +347,7 @@ let handleCancel = () => {
keywords
:
undefined
,
}
specifications
.
value
=
[]
products
.
value
=
[
{
id
:
0
,
specifications
:
[
"标准"
],
price
:
0.0
,
number
:
0
,
url
:
""
},
]
products
.
value
=
[]
goodsParts
.
value
=
[]
attributes
.
value
=
[]
editDrawer
.
value
=
false
...
...
@@ -434,19 +428,7 @@ let handleRemove = (file: any, fileList: any) => {
}
}
}
let
specChanged
=
(
label
:
any
)
=>
{
if
(
label
===
false
)
{
specifications
.
value
=
[
{
specification
:
"规格"
,
value
:
"标准"
,
picUrl
:
""
},
];
products
.
value
=
[
{
id
:
0
,
specifications
:
[
"标准"
],
price
:
0.0
,
number
:
0
,
url
:
""
},
];
}
else
{
specifications
.
value
=
[];
products
.
value
=
[];
}
}
let
uploadSpecPicUrl
=
(
res
:
any
)
=>
{
specForm
.
value
.
picUrl
=
res
.
data
.
url
;
}
...
...
@@ -573,23 +555,7 @@ let specToProduct = () => {
products
=
products
;
}
let
handleProductShow
=
(
row
:
any
)
=>
{
productForm
=
Object
.
assign
({},
row
);
productVisiable
.
value
=
true
;
}
let
uploadProductUrl
=
(
res
:
any
)
=>
{
productForm
.
value
.
url
=
res
.
data
.
url
;
}
let
handleProductEdit
=
()
=>
{
for
(
let
i
=
0
;
i
<
products
.
value
.
length
;
i
++
)
{
const
v
=
products
.
value
[
i
];
if
(
v
.
id
===
productForm
.
value
.
id
)
{
products
.
value
.
splice
(
i
,
1
,
productForm
.
value
);
break
;
}
}
productVisiable
.
value
=
false
;
}
let
handleAttributeShow
=
()
=>
{
attributeForm
.
value
=
{};
attributeVisiable
.
value
=
true
;
...
...
src/views/commodityManage/selectSpec.vue
浏览文件 @
e940bf3f
...
...
@@ -49,6 +49,10 @@ let props = defineProps({
specData
:
{
type
:
Object
,
default
:
[]
},
products
:
{
type
:
Object
,
default
:
[]
}
})
...
...
@@ -66,6 +70,7 @@ let data = computed(() => {
let
specList
=
ref
([]
as
any
)
let
attributes
=
ref
([]
as
any
)
var
specData
=
ref
([]
as
any
)
//符合条件的数据
watch
(
specData
.
value
,
(
newVlaue
:
any
)
=>
{
...
...
@@ -75,8 +80,13 @@ watch(specData.value, (newVlaue: any) => {
}
})
let
setAttributes
=
(
data
:
any
)
=>
{
if
(
data
)
attributes
.
value
=
data
}
// 每组只可以取一个
let
radioChange
=
(
e
:
any
,
item
:
any
)
=>
{
console
.
log
(
e
,
item
);
//
console.log(e, item);
item
.
values
.
forEach
((
res
:
any
)
=>
{
if
(
specList
.
value
.
indexOf
(
res
.
value
)
!=
-
1
)
{
let
s
=
specList
.
value
.
indexOf
(
res
.
value
)
...
...
@@ -86,6 +96,8 @@ let radioChange = (e: any, item: any) => {
}
})
if
(
specList
.
value
.
indexOf
(
e
)
==
-
1
)
specList
.
value
.
push
(
e
)
console
.
log
(
specList
.
value
,
'specList'
);
}
let
clickAdd
=
()
=>
{
...
...
@@ -173,6 +185,10 @@ let group = (data: any) => {
if
(
test1
.
length
===
0
)
return
poty
.
value
=
[...
specData
.
value
]
else
group
(
test1
)
}
defineExpose
({
setAttributes
})
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
src/views/commodityManage/shelves.vue
浏览文件 @
e940bf3f
...
...
@@ -77,8 +77,12 @@
</el-form-item>
<el-form-item
label=
"所属分类"
>
<el-cascader
:options=
"categoryList"
expand-trigger=
"hover"
clearable
@
change=
"handleCategoryChange"
/>
<!-- <el-cascader :options="categoryList" expand-trigger="hover" clearable
@change="handleCategoryChange" /> -->
<el-select
v-model=
"goods.categoryId"
placeholder=
"请选择"
@
change=
"handleCategoryChange"
>
<el-option
v-for=
"item in categoryList"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"所属品牌商"
>
...
...
@@ -164,7 +168,7 @@
</el-dialog>
</el-card>
<selectSpec
:specData=
"specifications"
@
productsData=
"productsData"
/>
<selectSpec
:specData=
"specifications"
@
productsData=
"productsData"
/>
<el-card
class=
"box-card"
>
<h3>
商品参数
</h3>
...
...
@@ -237,18 +241,12 @@ let goods = ref({
categoryId
:
undefined
,
keywords
:
undefined
,
});
let
cateId
=
ref
(
''
)
//分类值
let
goodsParts
=
ref
()
let
specVisiable
=
ref
(
false
);
let
specForm
=
ref
({
specification
:
""
,
value
:
""
,
picUrl
:
""
});
let
specifications
=
ref
([]
as
any
);
let
productVisiable
=
ref
(
false
);
let
productForm
=
ref
({
id
:
0
,
specifications
:
[],
price
:
0.0
,
number
:
0
,
url
:
""
,
});
let
headers
=
ref
({
'Authorization'
:
sessionStorage
.
getItem
(
"token"
)
})
let
products
=
ref
([]);
...
...
@@ -289,7 +287,8 @@ initList()
let
htmlChange
=
(
value
:
any
)
=>
goods
.
value
.
detail
=
value
let
handleCategoryChange
=
(
value
:
any
)
=>
{
goods
.
value
.
categoryId
=
value
[
value
.
length
-
1
];
// console.log(goods.value.categoryId);
// goods.value.categoryId = value[value.length - 1];
}
let
handleCancel
=
()
=>
{
goods
.
value
=
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论