Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica.cloud.web-education-admin
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
提交
打开侧边栏
com.pica.cloud.education.frontend
pica.cloud.web-education-admin
提交
148a5855
提交
148a5855
编写于
8月 18, 2020
作者:
chendeli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品管理 库存交互修改
上级
34ab990b
变更
1
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
118 行增加
和
11 行删除
+118
-11
create-good.vue
src/views/goods/create-good.vue
+118
-11
未找到文件。
src/views/goods/create-good.vue
浏览文件 @
148a5855
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
class=
"bg-uploader"
class=
"bg-uploader"
action=
"#"
action=
"#"
:show-file-list=
"false"
:show-file-list=
"false"
:before-upload=
"beforeUploadPic
1
"
:before-upload=
"beforeUploadPic"
>
>
<img
<img
v-if=
"formData.goods_image"
v-if=
"formData.goods_image"
...
@@ -366,9 +366,9 @@
...
@@ -366,9 +366,9 @@
<el-form-item
label=
"库存"
prop=
"name"
>
<el-form-item
label=
"库存"
prop=
"name"
>
<el-col
:span=
"20"
>
<el-col
:span=
"20"
>
<div
class=
"stock-com"
>
<div
class=
"stock-com"
>
<span
class=
"sp sp-l"
><i
class=
"el-icon-minus"
></i></span>
<span
class=
"sp sp-l"
@
click=
"changeStock(1)"
:class=
"
{'opac':formData.stock == 0}"
>
<i
class=
"el-icon-minus"
></i></span>
<span
class=
"sp sp-c"
>
{{
formData
.
stock
}}
</span>
<span
class=
"sp sp-c"
>
{{
formData
.
stock
}}
</span>
<span
class=
"sp sp-r"
><i
class=
"el-icon-plus"
></i></span>
<span
class=
"sp sp-r"
@
click=
"changeStock(2)"
><i
class=
"el-icon-plus"
></i></span>
</div>
</div>
<!--
<el-input
<!--
<el-input
size=
"small"
size=
"small"
...
@@ -411,6 +411,25 @@
...
@@ -411,6 +411,25 @@
/>
/>
</div>
</div>
</el-dialog>
</el-dialog>
<el-dialog
:title=
"stock.title"
:visible
.
sync=
"stockDio"
width=
"30%"
center
>
<div
class=
"stock-dia"
>
<div
class=
"stock-item"
>
更新库存后,将影响买家购买,请谨慎操作
</div>
<div
class=
"stock-item"
>
当前库存:
{{
formData
.
stock
}}
</div>
<div
class=
"demo-input-suffix"
>
{{
stock
.
type
==
1
?
'减少数量'
:
'增加数量'
}}
:
<el-input
v-model=
"stock.num"
:placeholder=
"stock.placeholderTxt"
style=
"width: 180px;"
></el-input>
</div>
</div>
<span
slot=
"footer"
class=
"dialog-footer"
style=
"text-align: right;"
>
<!--
<el-button
@
click=
"centerDialogVisible = false"
>
取 消
</el-button>
-->
<el-button
type=
"primary"
@
click=
"updateStock"
>
完成
</el-button>
</span>
</el-dialog>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -437,6 +456,13 @@
...
@@ -437,6 +456,13 @@
}
}
};
};
return{
return{
stock:{
title:'减少库存',
type:1,
placeholderTxt:'请输入减少的库存数量',
num:''
},
stockDio:false,
curmbFirst: '云鹊店铺',
curmbFirst: '云鹊店铺',
isGoods_image:true,
isGoods_image:true,
isSpecification_url:true,
isSpecification_url:true,
...
@@ -472,7 +498,7 @@
...
@@ -472,7 +498,7 @@
treat_disease:'',
treat_disease:'',
bar_code:'',
bar_code:'',
discount_price:'',
discount_price:'',
stock:
1
,
stock:
0
,
},
},
showCropper: false,
showCropper: false,
currentOption: {
currentOption: {
...
@@ -559,6 +585,49 @@
...
@@ -559,6 +585,49 @@
this.title = id == 'add' ? '新增商品' : '编辑商品'
this.title = id == 'add' ? '新增商品' : '编辑商品'
},
},
methods: {
methods: {
updateStock(){
let r = /^
\
+?[1-9][0-9]*$/;
if(!r.test(this.stock.num)){
return this.$message({
message: '库存数量必须正整数',
type: 'warning'
});
}
if(this.stock.type == 1){
if(this.stock.num > this.formData.stock){
return this.$message({
message: '减少库存数量不得大于当前库存',
type: 'warning'
});
}
}
//造假 接口来了删掉
if(this.stock.num <= 0){
return this.$message({
message: '增加库存数量不得为0',
type: 'warning'
});
}
this.formData.stock = this.stock.num
this.stockDio = false
},
changeStock(type){
if(this.formData.stock == 0 && type == 1){
return;
}
let str = type == 1 ? '减少' : '增加',
txt = `请输入${str}的库存数量`,
tit = str + '库存'
this.stock = {
title:tit,
type,
num:'',
placeholderTxt:txt
}
this.stockDio = true
},
complete() {
complete() {
let formName = "
formData
";
let formName = "
formData
";
...
@@ -590,9 +659,35 @@
...
@@ -590,9 +659,35 @@
}
}
});
});
this.$emit('returnIsNext', flag);
this.$emit('returnIsNext', flag);
},
beforeUploadPic(file) {
let vm = this;
let picTypes = ['image/jpeg','image/png']
//const isLt2M = file.size / 1024 / 1024 < fileLimit.size;
if (picTypes.indexOf(file.type) == -1) {
return this.$message.error("
请上传
jpeg
或
png
格式的图片
");
}
// if (!isLt2M) {
// vm.$message.error("
图片大小不符合规范,请根据规范上传图片
");
// return;
// }
let _img = new FileReader();
_img.readAsDataURL(file);
openLoading(vm);
doUpload(vm, file, getFilePath(file, null), "
preview4
", "
progress1
", 1).then(function (path) {
closeLoading(vm);
console.log('上传成功后路径', path);
vm.formData.goods_image = path.fullPath
vm.$message.success("
上传成功
");
});
},
},
//上传店铺logo
//上传店铺logo
beforeUploadPic1(file) {
beforeUploadPic1(file
,type
) {
this.currentOption.aspectRatio = 1/1;
this.currentOption.aspectRatio = 1/1;
this.currentOption.cropBoxResizable = true;
this.currentOption.cropBoxResizable = true;
this.currentOption.minCropBoxWidth = 160;
this.currentOption.minCropBoxWidth = 160;
...
@@ -833,34 +928,46 @@
...
@@ -833,34 +928,46 @@
.stock-com
{
.stock-com
{
width
:
158px
;
width
:
158px
;
height
:
32px
;
height
:
32px
;
border
:
1px
solid
#dcdfe6
;
border-radius
:
4px
;
border-radius
:
4px
;
overflow
:
hidden
;
overflow
:
hidden
;
.sp
{
.sp
{
display
:
inline-block
;
display
:
inline-block
;
float
:
left
;
float
:
left
;
color
:
#fff
;
}
}
.sp-c
{
.sp-c
{
line-height
:
3
2
px
;
line-height
:
3
0
px
;
width
:
92px
;
width
:
92px
;
text-align
:
center
;
text-align
:
center
;
color
:
#666
;
border-top
:
1px
solid
#449284
;
border-bottom
:
1px
solid
#449284
;
}
}
.sp-l
{
.sp-l
{
border-right
:
1px
solid
#
dcdfe6
;
border-right
:
1px
solid
#
449284
;
}
}
.sp-r
{
.sp-r
{
border-left
:
1px
solid
#
dcdfe6
;
border-left
:
1px
solid
#
449284
;
border-radius
:
0
4px
4px
0
;
}
}
.sp-l
,
.sp-r
{
.sp-l
,
.sp-r
{
width
:
32px
;
width
:
32px
;
text-align
:
center
;
text-align
:
center
;
line-height
:
32px
;
line-height
:
32px
;
font-size
:
13px
;
font-size
:
13px
;
background
:
#
f5f7fa
;
background
:
#
449284
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
.opac
{
opacity
:
0
.5
;
}
}
.stock-dia
{
.stock-item
{
padding-bottom
:
20px
;
}
}
}
</
style
>
</
style
>
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录