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
16d5dcb4
提交
16d5dcb4
authored
10月 24, 2022
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改商品规格
上级
53a25e71
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
127 行增加
和
68 行删除
+127
-68
edit.vue
src/views/commodityManage/edit.vue
+64
-32
shelves.vue
src/views/commodityManage/shelves.vue
+63
-36
没有找到文件。
src/views/commodityManage/edit.vue
浏览文件 @
16d5dcb4
...
...
@@ -37,8 +37,8 @@
<el-form-item
label=
"商品图片"
>
<el-upload
:action=
"uploadPath"
:show-file-list=
"false"
:headers=
"headers"
:on-success=
"uploadPicUrl"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<
img
v-if=
"goods.picUrl"
:src=
"goods.picUrl"
class=
"avatar"
/
>
<
!-- <img v-if="goods.picUrl" :src="'http://192.168.0.23' + goods.picUrl" class="avatar" /> --
>
<
!-- <img v-if="goods.picUrl" :src="goods.picUrl" class="avatar" /> --
>
<
img
v-if=
"goods.picUrl"
:src=
"'http://192.168.0.23' + goods.picUrl"
class=
"avatar"
/
>
<el-icon
v-else
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
...
...
@@ -105,7 +105,7 @@
<el-col
:span=
"10"
>
<el-radio-group
v-model=
"multipleSpec"
@
change=
"specChanged"
>
<!-- <el-radio-button :label="false">默认标准规格</el-radio-button> -->
<el-radio-button
:label=
"
fals
e"
>
多规格支持
</el-radio-button>
<el-radio-button
:label=
"
tru
e"
>
多规格支持
</el-radio-button>
</el-radio-group>
</el-col>
<el-col
v-if=
"multipleSpec"
:span=
"10"
>
...
...
@@ -115,14 +115,14 @@
<el-table
:data=
"specifications"
>
<el-table-column
property=
"specification"
label=
"规格名"
/>
<el-table-column
property=
"value"
label=
"规格值"
>
<el-table-column
property=
"value"
label=
"规格值"
align=
"center"
>
<
template
#
default=
"scope"
>
<el-tag
type=
"primary"
>
{{
scope
.
row
.
value
}}
</el-tag>
</
template
>
</el-table-column>
<el-table-column
property=
"picUrl"
label=
"规格图片"
>
<el-table-column
property=
"picUrl"
label=
"规格图片"
align=
"center"
>
<
template
#
default=
"scope"
>
<img
v-if=
"scope.row.picUrl"
:src=
"scope.row.picUrl"
width=
"40"
/>
</
template
>
...
...
@@ -140,16 +140,28 @@
<el-form
ref=
"specRef"
:rules=
"rules"
:model=
"specForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left: 50px"
>
<el-form-item
label=
"规格名"
prop=
"specification"
>
<el-input
v-model=
"specForm.specification"
/>
<el-select
v-model=
"specForm.specification"
class=
"m-2"
placeholder=
"请选择规格名"
@
change=
"dictChange"
>
<el-option
v-for=
"item in dictList"
:key=
"item.id"
:label=
"item.dictName"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"规格值"
prop=
"value"
>
<el-input
v-model=
"specForm.value"
/>
<el-select
v-model=
"specForm.value"
multiple
collapse-tags
collapse-tags-tooltip
placeholder=
"请选择规格值"
style=
"width: 240px"
@
change=
"dictItemChange"
>
<el-option
v-for=
"item in dictItemList"
:key=
"item.id"
:label=
"item.itemText"
:value=
"item.itemText"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"规格图片"
prop=
"picUrl"
>
<el-upload
:action=
"uploadPath"
:show-file-list=
"false"
:headers=
"headers"
:on-success=
"uploadSpecPicUrl"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<img
v-if=
"specForm.picUrl"
:src=
"specForm.picUrl"
class=
"avatar"
/>
<i
v-else
class=
"el-icon-plus avatar-uploader-icon"
/>
<div
v-if=
"specForm.picUrl"
>
<img
:src=
"'http://192.168.0.23' + specForm.picUrl"
class=
"avatar"
/>
</div>
<el-icon
v-else
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
</el-upload>
</el-form-item>
</el-form>
...
...
@@ -206,6 +218,7 @@ import { uploadPath } from "@/services/api/storage";
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'
let
editDrawer
=
ref
(
false
)
let
newKeywordVisible
=
ref
(
false
);
...
...
@@ -234,7 +247,7 @@ let goods = ref({
let
goodsParts
=
ref
()
let
specVisiable
=
ref
(
false
);
let
specForm
=
ref
({
specification
:
""
,
value
:
""
,
picUrl
:
""
}
as
any
);
let
multipleSpec
=
ref
(
fals
e
);
let
multipleSpec
=
ref
(
tru
e
);
let
specifications
=
ref
([]
as
any
);
let
productVisiable
=
ref
(
false
);
let
productForm
=
ref
({
...
...
@@ -429,33 +442,52 @@ let specChanged = (label: any) => {
let
uploadSpecPicUrl
=
(
res
:
any
)
=>
{
specForm
.
value
.
picUrl
=
res
.
data
.
url
;
}
let
dictList
=
ref
()
let
handleSpecificationShow
=
()
=>
{
specForm
.
value
=
{
specification
:
""
,
value
:
""
,
picUrl
:
""
};
specVisiable
.
value
=
true
;
getDictList
().
then
((
res
:
any
)
=>
{
if
(
res
.
code
===
200
)
{
dictList
.
value
=
res
.
data
.
records
specForm
.
value
=
{
specification
:
""
,
value
:
""
,
picUrl
:
""
};
specVisiable
.
value
=
true
;
}
})
}
let
handleSpecificationAdd
=
()
=>
{
let
index
=
specifications
.
value
.
length
-
1
;
for
(
let
i
=
0
;
i
<
specifications
.
value
.
length
;
i
++
)
{
const
v
=
specifications
.
value
[
i
];
if
(
v
.
specification
===
specForm
.
value
.
specification
)
{
if
(
v
.
value
===
specForm
.
value
)
{
ElMessage
({
type
:
"warning"
,
message
:
"已经存在规格值:"
+
v
.
value
,
});
specForm
.
value
=
{};
specVisiable
.
value
=
false
;
return
;
}
else
{
index
=
i
;
let
dictItemList
=
ref
()
let
dictName
=
ref
()
let
dictValue
=
ref
()
let
dictChange
=
(
id
:
any
)
=>
{
getDictItemList
({
dictId
:
id
}).
then
((
res
:
any
)
=>
{
if
(
res
.
code
===
200
)
{
dictItemList
.
value
=
res
.
data
.
records
for
(
let
s
of
dictList
.
value
)
{
if
(
s
.
id
===
id
)
dictName
.
value
=
s
.
dictName
}
}
})
}
let
dictItemChange
=
(
val
:
[])
=>
{
dictValue
.
value
=
val
}
let
handleSpecificationAdd
=
()
=>
{
if
(
!
dictName
.
value
)
return
ElMessage
({
type
:
'warning'
,
message
:
'请选择规格名'
})
if
(
dictValue
.
value
)
{
for
(
let
s
of
dictValue
.
value
)
{
specifications
.
value
.
push
({
specification
:
dictName
.
value
,
value
:
s
})
}
specVisiable
.
value
=
false
;
specToProduct
();
}
else
{
ElMessage
({
type
:
'warning'
,
message
:
'请选择规格值'
})
}
specifications
.
value
.
splice
(
index
+
1
,
0
,
specForm
);
specVisiable
.
value
=
false
;
specToProduct
();
}
let
handleSpecificationDelete
=
(
row
:
any
)
=>
{
const
index
=
specifications
.
value
.
indexOf
(
row
);
...
...
src/views/commodityManage/shelves.vue
浏览文件 @
16d5dcb4
...
...
@@ -113,12 +113,12 @@
</el-row>
<el-table
:data=
"specifications"
>
<el-table-column
property=
"specification"
label=
"规格名"
/>
<el-table-column
property=
"value"
label=
"规格值"
>
<el-table-column
property=
"specification"
label=
"规格名"
align=
"left"
/>
<el-table-column
property=
"value"
label=
"规格值"
align=
"center"
>
<
template
#
default=
"scope"
>
<
!--
<el-tag
type=
"primary"
>
--
>
{{
scope
.
row
.
value
}}
<
!--
</el-tag>
--
>
<
el-tag
type=
"primary"
>
{{
scope
.
row
.
value
}}
<
/el-tag
>
</
template
>
</el-table-column>
<el-table-column
property=
"picUrl"
label=
"规格图片"
>
...
...
@@ -139,20 +139,28 @@
<el-form
ref=
"specRef"
:rules=
"rules"
:model=
"specForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left: 50px"
>
<el-form-item
label=
"规格名"
prop=
"specification"
>
<el-input
v-model=
"specForm.specification"
/>
<el-select
v-model=
"specForm.specification"
class=
"m-2"
placeholder=
"请选择规格名"
@
change=
"dictChange"
>
<el-option
v-for=
"item in dictList"
:key=
"item.id"
:label=
"item.dictName"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"规格值"
prop=
"value"
>
<el-input
v-model=
"specForm.value"
/>
<el-select
v-model=
"specForm.value"
multiple
collapse-tags
collapse-tags-tooltip
placeholder=
"请选择规格值"
style=
"width: 240px"
@
change=
"dictItemChange"
>
<el-option
v-for=
"item in dictItemList"
:key=
"item.id"
:label=
"item.itemText"
:value=
"item.itemText"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"规格图片"
prop=
"picUrl"
>
<el-upload
:action=
"uploadPath"
:show-file-list=
"false"
:headers=
"headers"
:on-success=
"uploadSpecPicUrl"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<div
v-if=
"specForm.picUrl"
>
<!-- <img v-if="specForm.picUrl.split('http').length > 1" :src="specForm.picUrl"
class="avatar" /> -->
<img
:src=
"'http://192.168.0.23' + specForm.picUrl"
class=
"avatar"
/>
</div>
<i
v-else
class=
"el-icon-plus avatar-uploader-icon"
/>
<el-icon
v-else
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
</el-upload>
</el-form-item>
</el-form>
...
...
@@ -209,6 +217,7 @@ import { uploadPath } from "@/services/api/storage";
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'
let
shelvesDrawer
=
ref
(
false
)
let
newKeywordVisible
=
ref
(
false
);
...
...
@@ -402,44 +411,62 @@ let specChanged = (label: any) => {
}
}
let
uploadSpecPicUrl
=
(
res
:
any
)
=>
{
specForm
.
value
.
picUrl
=
res
.
data
.
url
;
console
.
log
(
'上传成功'
);
// specForm.value.picUrl = res.data.url;
}
let
dictList
=
ref
()
let
handleSpecificationShow
=
()
=>
{
specForm
.
value
=
{
specification
:
""
,
value
:
""
,
picUrl
:
""
};
specVisiable
.
value
=
true
;
getDictList
().
then
((
res
:
any
)
=>
{
if
(
res
.
code
===
200
)
{
dictList
.
value
=
res
.
data
.
records
specForm
.
value
=
{
specification
:
""
,
value
:
""
,
picUrl
:
""
};
specVisiable
.
value
=
true
;
}
})
}
let
handleSpecificationAdd
=
()
=>
{
console
.
log
(
specifications
.
value
);
console
.
log
(
specForm
.
value
);
let
index
=
specifications
.
value
.
length
-
1
;
for
(
let
i
=
0
;
i
<
specifications
.
value
.
length
;
i
++
)
{
const
v
=
specifications
.
value
[
i
];
if
(
v
.
specification
===
specForm
.
value
.
specification
)
{
if
(
v
.
value
===
specForm
.
value
)
{
ElMessage
({
type
:
"warning"
,
message
:
"已经存在规格值:"
+
v
.
value
,
});
specForm
.
value
=
{
specification
:
""
,
value
:
""
,
picUrl
:
""
};
specVisiable
.
value
=
false
;
return
;
}
else
{
index
=
i
;
}
if
(
!
dictName
.
value
)
return
ElMessage
({
type
:
'warning'
,
message
:
'请选择规格名'
})
if
(
dictValue
.
value
)
{
for
(
let
s
of
dictValue
.
value
)
{
specifications
.
value
.
push
({
specification
:
dictName
.
value
,
value
:
s
})
}
specVisiable
.
value
=
false
;
specToProduct
();
}
else
{
ElMessage
({
type
:
'warning'
,
message
:
'请选择规格值'
})
}
specifications
.
value
.
splice
(
index
+
1
,
0
,
specForm
.
value
);
specVisiable
.
value
=
false
;
specToProduct
();
}
let
handleSpecificationDelete
=
(
row
:
any
)
=>
{
const
index
=
specifications
.
value
.
indexOf
(
row
);
specifications
.
value
.
splice
(
index
,
1
);
specToProduct
();
}
let
dictItemList
=
ref
()
let
dictName
=
ref
()
let
dictValue
=
ref
()
let
dictChange
=
(
id
:
any
)
=>
{
getDictItemList
({
dictId
:
id
}).
then
((
res
:
any
)
=>
{
if
(
res
.
code
===
200
)
{
dictItemList
.
value
=
res
.
data
.
records
for
(
let
s
of
dictList
.
value
)
{
if
(
s
.
id
===
id
)
dictName
.
value
=
s
.
dictName
}
}
})
}
let
dictItemChange
=
(
val
:
[])
=>
{
dictValue
.
value
=
val
}
let
specToProduct
=
()
=>
{
if
(
specifications
.
value
.
length
===
0
)
{
return
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论