Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
S
shop-new
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
王天霸
shop-new
Commits
ee67d0b6
提交
ee67d0b6
authored
7月 28, 2021
作者:
huaxinzhu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加商品 提测
上级
0cf89f67
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
220 行增加
和
132 行删除
+220
-132
goods.js
src/api/module/goods.js
+20
-2
goodsaftersale.vue
src/views/system/goods/add/components/goodsaftersale.vue
+1
-1
goodsimg.vue
src/views/system/goods/add/components/goodsimg.vue
+9
-8
goodsinfomation.vue
src/views/system/goods/add/components/goodsinfomation.vue
+28
-20
goodsparameter.vue
src/views/system/goods/add/components/goodsparameter.vue
+10
-8
goodsspecifications.vue
...views/system/goods/add/components/goodsspecifications.vue
+28
-30
index.vue
src/views/system/goods/add/index.vue
+124
-63
没有找到文件。
src/api/module/goods.js
浏览文件 @
ee67d0b6
...
...
@@ -17,6 +17,15 @@ export function GetCategory(query) {
params
:
query
})
}
// 经营类目
export
function
NewGetCategory
(
query
)
{
return
request
({
url
:
'/system/goodsNew/businessList'
,
method
:
'get'
,
params
:
query
})
}
// 查询运费模板
// export function GetFreight(query) {
// return request({
...
...
@@ -48,10 +57,19 @@ export function Onsale(data) {
})
}
// 新增goods
// 新增goods - old
// export function addGoods(data) {
// return request({
// url: '/system/goods/add',
// method: 'post',
// data: data
// })
// }
// 新增商品
export
function
addGoods
(
data
)
{
return
request
({
url
:
'/system/goods
/add
'
,
url
:
'/system/goods
New/addGoods
'
,
method
:
'post'
,
data
:
data
})
...
...
src/views/system/goods/add/components/goodsaftersale.vue
浏览文件 @
ee67d0b6
...
...
@@ -86,7 +86,7 @@
// let query = { page: 1, limit: 50 };
GetFreight
().
then
(
res
=>
{
if
(
res
.
data
)
{
this
.
freightOptions
=
res
.
data
.
list
;
this
.
freightOptions
=
res
.
data
;
}
else
{
this
.
freightOptions
=
''
}
...
...
src/views/system/goods/add/components/goodsimg.vue
浏览文件 @
ee67d0b6
<
template
>
<div
class=
"goods-img"
>
<el-form
ref=
"goodsDeForm"
:model=
"goodsDeForm"
label-width=
"150px"
size=
"small"
>
<el-form-item
label=
"商品详情:"
prop=
"
spxq
"
>
<el-form-item
label=
"商品详情:"
prop=
"
description
"
>
<span
class=
"tip-span up-img-tip"
style=
"display: block;line-height: 34px;"
>
上传图片详情,用于商品详情页展示
</span>
<el-upload
class=
"avatar-uploader2"
...
...
@@ -14,7 +14,7 @@
><i
class=
"el-icon-plus"
/>
</el-upload>
<input
class=
"uploadImg"
style=
"display: none;"
type=
"file"
ref=
"file"
accept=
"image/*"
@
change=
"fileChange($event)"
name=
"file"
multiple
id=
"file"
>
<quill-editor
class=
"quill-editor-class"
ref=
"myTextEditor"
v-model=
"description"
:options=
"editorOption"
@
change=
"onEditorChange"
style=
"height:500px;margin-bottom:20px;"
></quill-editor>
<quill-editor
class=
"quill-editor-class"
ref=
"myTextEditor"
v-model=
"
goodsDeForm.
description"
:options=
"editorOption"
@
change=
"onEditorChange"
style=
"height:500px;margin-bottom:20px;"
></quill-editor>
</el-form-item>
</el-form>
</div>
...
...
@@ -43,12 +43,13 @@
return
{
loading
:
false
,
goodsDeForm
:
{
spxq
:
''
description
:
''
,
},
// goodsDeRules: {
//
spxq
:[{required: true, message: '请上传商品详情图片', validator: checkImg}]
//
description
:[{required: true, message: '请上传商品详情图片', validator: checkImg}]
// },
description
:
''
,
goodsDetailsImgFileList
:
[],
editorOption
:
{
placeholder
:
''
,
...
...
@@ -90,10 +91,10 @@
let
result
=
res
.
split
(
","
);
this
.
Base64img
=
result
[
1
];
let
data
=
{
"img_data"
:
this
.
Base64img
}
debugger
//
debugger
// this.loading = true;
UploadImg
(
data
).
then
(
res
=>
{
debugger
//
debugger
if
(
res
&&
res
.
code
===
1
)
{
this
.
index
++
;
this
.
goodsDetailsImgFileList
.
push
({
'url'
:
res
.
data
.
image_url
});
...
...
@@ -119,7 +120,7 @@
},
//
onEditorChange
({
editor
,
html
,
text
})
{
this
.
description
=
html
;
this
.
goodsDeForm
.
description
=
html
;
},
onEditorBlur
(){
//失去焦点事件
...
...
src/views/system/goods/add/components/goodsinfomation.vue
浏览文件 @
ee67d0b6
...
...
@@ -143,23 +143,25 @@
categoryList
:
[],
// 商品分类 id集合的数组
goods_des
:
''
,
// 关键词
goods_name
:
''
,
// 商品标题
//
category_id: '',
category_id
:
''
,
producing_area
:
''
,
// 产地
deliver_area
:
''
,
// 发货地
unit
:
''
,
// 单位
goods_brand
:
''
,
// 品牌
web_url
:
''
,
// 外部链接
out_goods_id
:
''
,
// 商品编码
imgs
:
''
// 商品图片
imgs
:
[]
// 商品图片
},
goodsInfoRules
:
{
categoryStr
:
[{
required
:
true
,
message
:
'商品分类不能为空'
,
trigger
:
'blur'
}],
goods_name
:
[
{
required
:
true
,
message
:
'请输入商品名称'
,
trigger
:
'blur'
},
{
min
:
3
,
max
:
30
,
message
:
'商品标题限制在3
0字以内
'
,
trigger
:
'blur'
}
{
min
:
3
,
max
:
30
,
message
:
'商品标题限制在3
字符以上,30个字符以下
'
,
trigger
:
'blur'
}
],
goods_des
:
[{
required
:
true
,
message
:
'商品关键词不能为空'
,
trigger
:
'blur'
}],
producing_area
:[{
required
:
true
,
message
:
'请选择商品产地'
,
trigger
:
'change'
}],
deliver_area
:
[{
required
:
true
,
message
:
'请选择商品发货地'
,
trigger
:
'change'
}],
unit
:
[{
required
:
true
,
message
:
'商品单位不能为空'
,
trigger
:
'blur'
}],
goods_brand
:
[{
required
:
true
,
message
:
'请选择商品品牌'
,
trigger
:
'change'
}],
imgs
:
[{
required
:
true
,
message
:
'请上传商品图片'
,
validator
:
categoryIdCheck
}]
},
...
...
@@ -184,22 +186,22 @@
},
components
:
{},
watch
:
{
'goodsImgFileList'
:
{
handler
(
val
,
oldVal
)
{
if
(
val
.
length
>
0
)
{
this
.
goodsInfoForm
.
imgs
=
''
;
let
imgArr
=
[];
val
.
forEach
(
item
=>
{
imgArr
.
push
(
item
.
url
);
})
this
.
goodsInfoForm
.
imgs
=
imgArr
.
toString
();
}
else
if
(
val
.
length
===
0
){
this
.
goodsInfoForm
.
imgs
=
''
;
}
console
.
log
(
123
,
this
.
goodsInfoForm
.
imgs
);
},
deep
:
true
}
//
'goodsImgFileList': {
//
handler(val, oldVal) {
//
if(val.length > 0) {
//
this.goodsInfoForm.imgs = '';
//
let imgArr = [];
//
val.forEach(item => {
//
imgArr.push(item.url);
//
})
//
this.goodsInfoForm.imgs = imgArr.toString();
//
}else if(val.length === 0){
//
this.goodsInfoForm.imgs = '';
//
}
// //
console.log(123,this.goodsInfoForm.imgs);
//
},
//
deep: true
//
}
// serviceagsTags: {
// handler(val, oldVal) {
// this.$set(this.goodsInfoForm, 'serviceagsTags', val)
...
...
@@ -211,6 +213,7 @@
//深拷贝一份最开始的数据,为初始化准备
this
.
goodsInfoDataClone
=
this
.
deepClone
(
this
.
goodsinfodata
);
this
.
goodsInfoForm
.
categoryStr
=
this
.
goodsinfodata
.
categoryStr
;
this
.
goodsInfoForm
.
categoryList
=
this
.
goodsinfodata
.
categoryList
;
// console.log("父组件传过来的",this.goodsinfodata)
// console.log("1111",this.goodsInfoForm)
// 获取 省
...
...
@@ -256,6 +259,7 @@
// console.log(222,this.SSQGoodsList);
},
lazyLoad
(
node
,
resolve
)
{
//debugger
this
.
getSSQArea
(
node
,
resolve
);
},
getSSQArea
(
node
,
resolve
)
{
...
...
@@ -368,7 +372,7 @@
},
// 上传 商品图片
uploadGoodsImg
(
param
)
{
console
.
log
(
327
,
param
);
//
console.log(327,param);
this
.
getBase64
(
param
.
file
).
then
(
res
=>
{
let
result
=
res
.
split
(
","
);
this
.
Base64img
=
result
[
1
];
...
...
@@ -378,6 +382,9 @@
if
(
res
.
data
)
{
urlObj
.
url
=
res
.
data
.
image_url
;
this
.
goodsImgFileList
.
push
(
urlObj
);
this
.
goodsImgFileList
.
forEach
(
item
=>
{
this
.
goodsInfoForm
.
imgs
.
push
(
item
.
url
)
})
this
.
$message
({
type
:
'success'
,
message
:
'图片上传成功'
});
// 只清除一次,不浪费哦
if
(
this
.
goodsImgFileList
.
length
===
1
)
{
...
...
@@ -409,6 +416,7 @@
for
(
let
i
=
0
;
i
<
this
.
goodsImgFileList
.
length
;
i
++
)
{
if
(
file
.
uid
===
this
.
goodsImgFileList
[
i
].
uid
)
{
this
.
goodsImgFileList
.
splice
(
i
,
1
)
this
.
goodsImgFileList
.
imgs
.
splice
(
i
,
1
);
}
}
if
(
this
.
goodsImgFileList
.
length
===
0
)
{
...
...
src/views/system/goods/add/components/goodsparameter.vue
浏览文件 @
ee67d0b6
...
...
@@ -44,7 +44,7 @@
<el-input
size=
"mini"
style=
"width:90%"
v-model=
"scope.row.weight"
placeholder=
"请输入重量"
></el-input>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
prop=
"imgs"
label=
"图片"
>
<el-table-column
align=
"center"
prop=
"imgs
9
"
label=
"图片"
>
<
template
slot-scope=
"scope"
>
<!-------------->
<el-upload
...
...
@@ -66,11 +66,11 @@
<div
v-show=
"orgGoodsPam.pamTableList.length > 0"
v-for=
"(item,index) in orgGoodsPam.pamTableList"
:key=
"index"
class=
"single-spe-con"
>
<p
style=
"margin: 10px 0;color: #333;font-size: 14px;font-weight: 400;"
>
<span
v-show=
"orgGoodsPam.pamNameList.length === 1"
>
{{ orgGoodsPam.pamNameList[0].spec
N
ame }}
<span>
:
</span>
{{ orgGoodsPam.pamDataList[index]}}
{{ orgGoodsPam.pamNameList[0].spec
_n
ame }}
<span>
:
</span>
{{ orgGoodsPam.pamDataList[index]}}
</span>
<span
v-show=
"orgGoodsPam.pamNameList.length > 1"
>
<span
v-for=
"(itemv,indexv) in orgGoodsPam.pamNameList"
style=
"margin-right:20px;"
>
{{ orgGoodsPam.pamNameList[indexv].spec
N
ame }}
<span>
:
</span>
{{ orgGoodsPam.pamDataList[index][indexv]}}
{{ orgGoodsPam.pamNameList[indexv].spec
_n
ame }}
<span>
:
</span>
{{ orgGoodsPam.pamDataList[index][indexv]}}
</span>
</span>
</p>
...
...
@@ -178,7 +178,7 @@ export default {
sc_price
:
''
,
// 市场价
stock
:
''
,
// 库存
weight
:
''
,
// 重量 g
imgs
:
''
,
// 图片
imgs
9
:
[]
,
// 图片
}
],
singleSpecImgList
:
[],
...
...
@@ -188,6 +188,8 @@ export default {
'parameterdata'
:
function
(
val
)
{
//debugger
this
.
orgGoodsPam
=
val
;
// this.orgGoodsPam
//console.log(175,this.orgGoodsPam);
},
},
...
...
@@ -214,9 +216,9 @@ export default {
// this.loading = false;
if
(
res
&&
res
.
code
==
1
)
{
this
.
singleSpecImgList
.
push
({
url
:
res
.
data
.
image_url
});
this
.
singleSpecTable
[
0
].
imgs
=
[];
this
.
singleSpecTable
[
0
].
imgs
9
=
[];
this
.
singleSpecImgList
.
forEach
(
item
=>
{
this
.
singleSpecTable
[
0
].
imgs
.
push
(
item
.
url
)
this
.
singleSpecTable
[
0
].
imgs
9
.
push
(
item
.
url
)
})
this
.
$message
({
message
:
'上传成功'
,
type
:
'success'
});
...
...
@@ -233,7 +235,7 @@ export default {
for
(
let
i
=
0
;
i
<
this
.
singleSpecImgList
.
length
;
i
++
)
{
if
(
file
.
uid
===
this
.
singleSpecImgList
[
i
].
uid
)
{
this
.
singleSpecImgList
.
splice
(
i
,
1
);
this
.
singleSpecTable
[
0
].
imgs
.
splice
(
i
,
1
);
this
.
singleSpecTable
[
0
].
imgs
9
.
splice
(
i
,
1
);
}
}
this
.
$message
({
type
:
'success'
,
message
:
'删除成功!'
});
...
...
@@ -281,7 +283,7 @@ export default {
});
console
.
log
(
3333
,
file
);
//
console.log(3333,file);
},
hxz
()
{
...
...
src/views/system/goods/add/components/goodsspecifications.vue
浏览文件 @
ee67d0b6
...
...
@@ -7,13 +7,13 @@
<div>
<el-select
:ref=
"'speNameDom' + index "
v-model=
"speItem.spec
N
ame"
v-model=
"speItem.spec
_n
ame"
size=
"small"
style=
"width: 300px"
filterable
default-first-option
:clearable=
"true"
@
change=
"speNameChange(speItem.spec
N
ame,index)"
@
change=
"speNameChange(speItem.spec
_n
ame,index)"
@
visible-change=
'bv=> visibleChange(bv,"speNameDom",index)'
>
<el-option
...
...
@@ -31,7 +31,7 @@
<!--
<span>
数据填写不完整
</span>
-->
</div>
<div
class=
"spe-params-con"
>
<div
style=
"display: inline-block"
v-for=
"(itemSV,indexSV) in speItem.spec
V
alue"
:key=
"indexSV"
>
<div
style=
"display: inline-block"
v-for=
"(itemSV,indexSV) in speItem.spec
_v
alue"
:key=
"indexSV"
>
<el-input
v-model=
"itemSV.value"
size=
"small"
placeholder=
"请输入规格参数"
class=
"spe-params-input-item"
@
blur=
"paramNameInputBlur(index,indexSV)"
>
<i
v-if=
"indexSV !== 0"
slot=
"suffix"
class=
"el-input__icon el-icon-delete el-icon-delete-h"
@
click=
"deleteSpeParam(index,indexSV)"
></i>
</el-input>
...
...
@@ -88,9 +88,8 @@ export default {
return
{
speData
:
[],
// 商品规格总数据
specsGroup
:
{
specName
:
''
,
// 规格名称
score
:
''
,
specValue
:
[]
spec_name
:
''
,
// 规格名称
spec_value
:
[]
},
speParamName
:{
...
...
@@ -111,10 +110,10 @@ export default {
};
},
created
()
{
this
.
$set
(
this
.
specsGroup
.
spec
Value
,
this
.
specsGroup
.
specV
alue
.
length
,
this
.
speParamName
);
this
.
$set
(
this
.
specsGroup
.
spec
_value
,
this
.
specsGroup
.
spec_v
alue
.
length
,
this
.
speParamName
);
this
.
speData
=
[];
this
.
$set
(
this
.
speData
,
this
.
speData
.
length
,
this
.
specsGroup
);
//console.log(71,this.specsGroup.spec
V
alue);
//console.log(71,this.specsGroup.spec
_v
alue);
},
mounted
()
{
/** 先获取 本地存储的localStorage **/
...
...
@@ -131,9 +130,8 @@ export default {
/** 添加规格*/
addSpe
()
{
let
specsGroup
=
{
specName
:
''
,
// 规格名称
score
:
''
,
specValue
:
[{
value
:
''
}]
spec_name
:
''
,
// 规格名称
spec_value
:
[{
value
:
''
}]
};
this
.
$set
(
this
.
speData
,
this
.
speData
.
length
,
specsGroup
);
},
...
...
@@ -158,8 +156,8 @@ export default {
coypSpeData
=
this
.
speData
.
concat
();
coypSpeData
.
splice
(
index
,
1
);
for
(
let
i
=
0
;
i
<
coypSpeData
.
length
;
i
++
)
{
if
(
val
===
coypSpeData
[
i
].
spec
N
ame
)
{
this
.
speData
[
index
].
spec
N
ame
=
''
;
if
(
val
===
coypSpeData
[
i
].
spec
_n
ame
)
{
this
.
speData
[
index
].
spec
_n
ame
=
''
;
this
.
$message
({
type
:
'error'
,
message
:
'此规格名称已经使用,请重新选取或新增其他规格名称'
});
break
;
}
...
...
@@ -173,16 +171,16 @@ export default {
// 添加规格参数
addSpeParam
(
index
)
{
let
valueObj
=
{
value
:
''
}
this
.
$set
(
this
.
speData
[
index
].
spec
Value
,
this
.
speData
[
index
].
specV
alue
.
length
,
valueObj
);
this
.
$set
(
this
.
speData
[
index
].
spec
_value
,
this
.
speData
[
index
].
spec_v
alue
.
length
,
valueObj
);
},
/** 删除 规格参数 */
deleteSpeParam
(
index
,
indexSV
)
{
// 先判断,删除前是否有值,如果是空,则没有必要再次计算
if
(
this
.
speData
[
index
].
spec
V
alue
[
indexSV
].
value
)
{
this
.
speData
[
index
].
spec
V
alue
.
splice
(
indexSV
,
1
);
if
(
this
.
speData
[
index
].
spec
_v
alue
[
indexSV
].
value
)
{
this
.
speData
[
index
].
spec
_v
alue
.
splice
(
indexSV
,
1
);
this
.
specCalcResult
();
}
else
{
this
.
speData
[
index
].
spec
V
alue
.
splice
(
indexSV
,
1
);
this
.
speData
[
index
].
spec
_v
alue
.
splice
(
indexSV
,
1
);
}
},
/**
...
...
@@ -281,7 +279,7 @@ export default {
/** 规格参数 失焦时,进行笛卡尔积算法,并渲染 商品售价 */
paramNameInputBlur
(
index
,
indexSV
)
{
// // 如果失焦的input中有值,才再次计算
// if( this.speData[index].spec
V
alue[indexSV].value ) {
// if( this.speData[index].spec
_v
alue[indexSV].value ) {
this
.
specCalcResult
();
// }
},
...
...
@@ -295,13 +293,13 @@ export default {
// 需要将 所有规格名称,提出一个数组集合,
this
.
speNameList
=
[];
orgSpeData
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
spec
N
ame
)
{
let
obj
=
{
spec
N
ame
:
''
};
// 注意, item.spec
V
alue是否一定为一个长度大于 1 的数组
if
(
item
.
spec
V
alue
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
item
.
spec
V
alue
.
length
;
i
++
)
{
if
(
item
.
spec
V
alue
[
i
].
value
)
{
obj
.
spec
Name
=
item
.
specN
ame
;
if
(
item
.
spec
_n
ame
)
{
let
obj
=
{
spec
_n
ame
:
''
};
// 注意, item.spec
_v
alue是否一定为一个长度大于 1 的数组
if
(
item
.
spec
_v
alue
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
item
.
spec
_v
alue
.
length
;
i
++
)
{
if
(
item
.
spec
_v
alue
[
i
].
value
)
{
obj
.
spec
_name
=
item
.
spec_n
ame
;
this
.
speNameList
.
push
(
obj
);
break
;
}
...
...
@@ -331,7 +329,7 @@ export default {
goodsPam
.
pamDataList
=
goodsParametersList
;
goodsParametersList
.
forEach
((
item
)
=>
{
let
prePamTable
=
[
{
js_price
:
''
,
sl_price
:
''
,
price
:
''
,
sc_price
:
''
,
stock
:
''
,
weight
:
''
,
thumb
:
''
}
{
js_price
:
''
,
sl_price
:
''
,
price
:
''
,
sc_price
:
''
,
stock
:
''
,
weight
:
''
,
thumb
:
''
,
spec_values
:
[]
}
];
goodsPam
.
pamTableList
.
push
(
prePamTable
)
});
...
...
@@ -346,10 +344,10 @@ export default {
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
)
{
let
childList
=
[];
if
(
list
[
i
].
spec
N
ame
)
{
for
(
let
j
=
0
;
j
<
list
[
i
].
spec
V
alue
.
length
;
j
++
)
{
if
(
list
[
i
].
spec
V
alue
[
j
].
value
)
{
childList
.
push
(
list
[
i
].
spec
V
alue
[
j
].
value
);
if
(
list
[
i
].
spec
_n
ame
)
{
for
(
let
j
=
0
;
j
<
list
[
i
].
spec
_v
alue
.
length
;
j
++
)
{
if
(
list
[
i
].
spec
_v
alue
[
j
].
value
)
{
childList
.
push
(
list
[
i
].
spec
_v
alue
[
j
].
value
);
}
}
}
...
...
src/views/system/goods/add/index.vue
浏览文件 @
ee67d0b6
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论