Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica.cloud.web-education-admin
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
提交
打开侧边栏
com.pica.cloud.education.frontend
pica.cloud.web-education-admin
提交
b1469a82
提交
b1469a82
编写于
11月 11, 2020
作者:
tao.wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
resolve
上级
dabd6ef5
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
361 行增加
和
246 行删除
+361
-246
index.js
src/utils/goods/index.js
+9
-0
create-good.vue
src/views/goods/create-good.vue
+352
-246
未找到文件。
src/utils/goods/index.js
浏览文件 @
b1469a82
...
@@ -43,6 +43,15 @@ export const updateGoods = (params) => {
...
@@ -43,6 +43,15 @@ export const updateGoods = (params) => {
description
:
'创建/更新商品'
,
description
:
'创建/更新商品'
,
})
})
};
};
export
const
updateGoodsV2
=
(
params
)
=>
{
return
fetch
({
headers
,
url
:
getBaseUrl
(
`store/goods/medical/service/upsert`
),
method
:
'post'
,
data
:
params
,
description
:
'创建/更新商品'
,
})
};
///dosage/all
///dosage/all
export
const
dosageAll
=
(
parm
)
=>
{
export
const
dosageAll
=
(
parm
)
=>
{
return
fetch
({
return
fetch
({
...
...
src/views/goods/create-good.vue
浏览文件 @
b1469a82
...
@@ -96,7 +96,7 @@
...
@@ -96,7 +96,7 @@
<!--
<p
class=
"upload-message"
v-if=
"uploadImgMessage1"
>
请上传商品头图
</p>
-->
<!--
<p
class=
"upload-message"
v-if=
"uploadImgMessage1"
>
请上传商品头图
</p>
-->
</div>
</div>
<div
class=
"basic-item-icon"
v-if=
"isMedic"
>
<div
class=
"basic-item-icon"
v-if=
"isMedic
&& !isCheckServe
"
>
<div
class=
"part-tit"
>
药品信息
</div>
<div
class=
"part-tit"
>
药品信息
</div>
<el-form-item
label=
"条形码"
prop=
"barCode"
>
<el-form-item
label=
"条形码"
prop=
"barCode"
>
<el-col
:span=
"18"
>
<el-col
:span=
"18"
>
...
@@ -365,14 +365,25 @@
...
@@ -365,14 +365,25 @@
<!-- =========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start========================================================= -->
<div
class=
"basic-item-icon"
v-if=
"!isMedic && isCheckServe"
>
<div
class=
"basic-item-icon"
v-if=
"isCheckServe"
>
<div
class=
"part-tit"
>
服务信息
</div>
<div
class=
"part-tit"
>
服务信息
</div>
<el-form-item
label=
"条形码"
prop=
"barCode"
>
<el-form-item
label=
"条形码"
prop=
"barCode"
>
<el-col
:span=
"18"
>
<el-col
:span=
"18"
>
...
@@ -385,21 +396,14 @@
...
@@ -385,21 +396,14 @@
<span
class=
"word-num"
>
(点击可快速录入下面的药品信息)
</span>
<span
class=
"word-num"
>
(点击可快速录入下面的药品信息)
</span>
</el-col>
</el-col>
</el-form-item>
</el-form-item>
<el-form-item
label=
"检测登记表"
prop=
"checkPackageId"
>
<
!--
<
el-form-item
label=
"检测登记表"
prop=
"checkPackageId"
>
<el-select
<el-select
v-model=
"formData.checkPackageId"
v-model=
"formData.checkPackageId"
placeholder=
"请选择"
placeholder=
"请选择"
size=
"small"
size=
"small"
>
>
<!-- @change="getGoodsTypes" -->
<!--
<el-option
v-for=
"(item,index) in oneLever"
:key=
"index"
:label=
"item.categoryName"
:value=
"item.id"
></el-option>
-->
</el-select>
</el-select>
</el-form-item>
</el-form-item>
-->
<el-form-item
label=
"检测名称"
prop=
"checkName"
>
<el-form-item
label=
"检测名称"
prop=
"checkName"
>
<el-col
:span=
"13"
>
<el-col
:span=
"13"
>
<el-input
<el-input
...
@@ -467,7 +471,7 @@
...
@@ -467,7 +471,7 @@
<span
class=
"sp sp-l"
@
click=
"formData.useCount>0?formData.useCount--:''"
:class=
"
{'opac':formData.useCount == 0}">
<i
class=
"el-icon-minus"
></i></span>
<span
class=
"sp sp-l"
@
click=
"formData.useCount>0?formData.useCount--:''"
:class=
"
{'opac':formData.useCount == 0}">
<i
class=
"el-icon-minus"
></i></span>
<span
class=
"sp sp-c"
>
<span
class=
"sp sp-c"
>
<el-input
<el-input
type=
"
text
"
type=
"
number
"
rows=
"4"
rows=
"4"
size=
"small"
size=
"small"
v-model=
"formData.useCount"
v-model=
"formData.useCount"
...
@@ -494,9 +498,9 @@
...
@@ -494,9 +498,9 @@
></el-option>
></el-option>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"适用人群"
prop=
"suitable"
>
<el-form-item
label=
"适用人群"
prop=
"suitable
Str
"
>
<el-select
<el-select
v-model=
"formData.suitable"
v-model=
"formData.suitable
Str
"
:multiple=
"true"
:multiple=
"true"
placeholder=
"请选择"
placeholder=
"请选择"
size=
"small"
size=
"small"
...
@@ -528,36 +532,36 @@
...
@@ -528,36 +532,36 @@
size=
"small"
size=
"small"
type=
"datetime"
type=
"datetime"
placeholder=
"请选择商品使用日期"
placeholder=
"请选择商品使用日期"
value-format=
"yyyy
/MM/dd HH:mm:ss
"
value-format=
"yyyy
-MM-dd HH:mm:ss.SSS
"
format=
"yyyy
/MM/
dd HH:mm:ss"
format=
"yyyy
-MM-
dd HH:mm:ss"
></el-date-picker>
></el-date-picker>
</el-form-item>
</el-form-item>
<el-form-item
label=
"检测说明"
prop=
"goodsCheckImages"
class=
"required-label"
>
<el-form-item
label=
"检测说明"
class=
"required-label"
>
<el-upload
<el-upload
:file-list=
"
fileGoods
List"
:file-list=
"
goodsCheck
List"
class=
"bg-uploader"
class=
"bg-uploader"
:show-file-list=
"isShowFileList"
:show-file-list=
"isShowFileList"
action=
"#"
action=
"#"
:before-upload=
"beforeUploadPic"
:before-upload=
"beforeUploadPic
2
"
>
>
<div
class=
"file-pics"
:key=
"index"
v-for=
"(item,index) in
fileGoods
List"
>
<div
class=
"file-pics"
:key=
"index"
v-for=
"(item,index) in
goodsCheck
List"
>
<img
:src=
"item.url"
@
mouseover
.
stop=
"headIndex=index"
class=
"bg-img"
/>
<img
:src=
"item.url"
@
mouseover
.
stop=
"headIndex=index"
class=
"bg-img"
/>
<div
<div
class=
"img-delete"
class=
"img-delete"
v-if=
"headIndex==index"
v-if=
"headIndex==index"
@
click
.
stop=
"deleteImg(item,
fileGoods
List)"
@
click
.
stop=
"deleteImg(item,
goodsCheck
List)"
@
mouseout
.
stop=
"headIndex=-1"
@
mouseout
.
stop=
"headIndex=-1"
>
>
<i
class=
"el-icon-delete"
></i>
<i
class=
"el-icon-delete"
></i>
</div>
</div>
</div>
</div>
<img
class=
"bg-img"
src=
"../../assets/image/small.png"
v-if=
"
fileGoods
List.length
<10
"
/>
<img
class=
"bg-img"
src=
"../../assets/image/small.png"
v-if=
"
goodsCheck
List.length
<10
"
/>
<div
class=
"limit-text"
>
<div
class=
"limit-text"
>
<p>
尺寸:686 * 高度不变
</p>
<p>
尺寸:686 * 高度不变
</p>
<p>
支持jpeg, png格式
</p>
<p>
支持jpeg, png格式
</p>
</div>
</div>
</el-upload>
</el-upload>
<p
class=
"upload-message"
v-if=
"!isgoodsImages"
>
请上传
商品头
图
</p>
<p
class=
"upload-message"
v-if=
"!isgoodsImages"
>
请上传
检测说明
图
</p>
</el-form-item>
</el-form-item>
</div>
</div>
...
@@ -565,7 +569,21 @@
...
@@ -565,7 +569,21 @@
<!-- =========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start=========================================================
=========================================================调试新增检测服务 start========================================================= -->
...
@@ -656,9 +674,198 @@
...
@@ -656,9 +674,198 @@
let
vm
=
null
;
let
vm
=
null
;
import
{
openLoading
,
closeLoading
}
from
"../../utils/utils"
;
import
{
openLoading
,
closeLoading
}
from
"../../utils/utils"
;
import
{
doUpload
,
getFilePath
}
from
"../../utils/qiniu-util"
;
import
{
doUpload
,
getFilePath
}
from
"../../utils/qiniu-util"
;
import
{
updateGoods
,
updateStock
,
dosageAll
,
getDeparts
,
getGoodsList
}
from
'@/utils/goods'
;
import
{
updateGoods
,
updateStock
,
dosageAll
,
getDeparts
,
getGoodsList
,
updateGoodsV2
}
from
'@/utils/goods'
;
import
Cropper
from
'@/components/common/cropper.vue'
import
Cropper
from
'@/components/common/cropper.vue'
import
{
mapGetters
}
from
"vuex"
;
import
{
mapGetters
}
from
"vuex"
;
const
checkBarcode
=
(
rule
,
value
,
cb
)
=>
{
const
valedBarcode
=
new
RegExp
(
"[
\\
u4E00-
\\
u9FFF]+"
,
"g"
);
if
(
value
&&
valedBarcode
.
test
(
value
))
cb
(
new
Error
(
'条形码不能输入中文'
));
cb
();
}
const
checkNumber
=
(
rule
,
value
,
cb
)
=>
{
const
val
=
String
(
value
);
const
isInt
=
/^
([
1-9
][
0-9
]
*
)
$/
;
if
(
val
&&
!
isInt
.
test
(
val
))
cb
(
new
Error
(
'请输入正整数'
));
cb
();
}
const
checkProjectStr
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
.
indexOf
(
"
\
\"
) != -1) {
//存在
callback(new Error("
请勿输入字符“
\\
”
"));
} else if (value.indexOf("
.
") != -1) {
callback(new Error("
请勿输入字符“
.
”
"));
} else {
callback();
}
};
const form1 = {
categoryIdLevel2: '',
categoryIdLevel3: '',
categoryIdLevel4: '',
categoryIdLevel5: '',
medicCommonName:'',
medicGoodsName:'',
size:'',
dosageId:null,
usage:'',
otc1:'1',
approvalNumber:'',
manufacturer:'',
department:'',
expiredTime:'',
specification_url:'',
treatDisease:'',
}
const rules1 = {
medicCommonName:[
{ required: true, message: "
请输入商品通用名称
", trigger: "
blur
" }
],
size:[
{ required: true, message: "
请输入商品规格
", trigger: "
blur
" }
],
manufacturer:[
{ required: true, message: "
请输入生产厂家
", trigger: "
blur
" }
],
approvalNumber:[
{ required: true, message: "
请输入批准文号
", trigger: "
blur
" }
],
dosageId:[
{ required: true, message: "
请选择剂型
", trigger: "
change
" }
],
categoryIdLevel2:[
{ required: true, message: "
请选择药品类型
", trigger: "
blur
" }
],
categoryIdLevel3:[
{ required: true, message: "
请选择一级类目
", trigger: "
blur
" }
],
categoryIdLevel4:[
{ required: true, message: "
请选择二级类目
", trigger: "
blur
" }
],
categoryIdLevel5:[
{ required: true, message: "
请选择三级类目
", trigger: "
blur
" }
],
specification_url:[
{ required: true, message: "
请上传药品说明书
", trigger: "
blur
" }
],
// barCode: [
// { required: true, message: "
请输入条形码
", trigger: "
blur
" },
// { validator: checkBarcode, trigger: "
blur
" }
// ],
otc:[
{ required: true, message: "
请选择是否是处方
", trigger: "
blur
" }
],
dynamicFlag: [
{ required: true, message: "
请选择内容发布权
", trigger: "
blur
" },
],
}
const form2 = {
// checkPackageId: '', // 检测登记表,暂无,先隐藏!!!!!!!!!!!
checkName: '',
hospitalName: '',
hospitalType: '',
hospitalId: 0,
goodsId: 0, // 新增时传0,更新时必需>0
medicalServiceId: 0, // 新增时传0,更新时必需>0
goodsCheckImages: [],
checkItem: '',
checkStandard: '',
useCount: 0,
checkType: '',
suitable: '',
suitableStr: '',
accessorialService: '',
endTime: '',
goodsStock:0,
stock: 0
}
const rules2 = {
checkName: [{ required: true, message: "
请输入检测名称
", trigger: "
blur
" }],
hospitalName: [{ required: true, message: "
请输入医疗机构名称
", trigger: "
blur
" }],
hospitalType: [{ required: true, message: "
请选择医疗机构类型
", trigger: "
blur
" }],
checkItem: [{ required: true, message: "
请输入检测项目
", trigger: "
blur
" }],
checkStandard: [{ required: true, message: "
请输入检测指标
", trigger: "
blur
" }],
useCount: [{ required: true, message: "
请输入使用人数
", trigger: "
blur
" },{validator: checkNumber, trigger: "
blur
"}],
checkType: [{ required: true, message: "
请选择检测类型
", trigger: "
blur
" }],
suitableStr: [{ required: true, message: "
请选择适用人群
", trigger: "
blur
" }],
endTime: [{ required: true, message: "
请选择商品使用日期
", trigger: "
blur
" }],
// goodsCheckImages: [
// { required: true, message: "
请上传检测说明图
", trigger: "
blur
" }
// ],
}
const form = {
// medicationId: 0,
id: 0,
// categoryId:'',
goodsName:'',
goodsDescription:'',
goodsHeaderImages:[],
goodsType:'',
barCode: '',
// otc:false,
// discountPrice:'',
// stock:0,
// goodsStock:0,
// specificationImages:[],
costPrice:0,
decrStock:0,//减少库存
incrStock:'',//增加库存
storeId: '',
optPrice:0,
};
const rules = {
barCode: [
{ required: true, message: "
请输入条形码
", trigger: "
blur
" },
{ validator: checkBarcode, trigger: "
blur
" }
],
goodsName: [
{ required: true, message: "
请输入商品名称
", trigger: "
blur
" },
{ validator: checkProjectStr, trigger: "
blur
" }
],
goodsHeaderImages: [
{ required: true, message: "
请上传商品头图
", trigger: "
blur
" }
],
goodsType:[
{ required: true, message: "
请选择商品类型
", trigger: "
change
" }
],
optPrice: [
{ required: true, message: "
请输入零售价
", trigger: "
blur
" },
],
// introduce: [
// { required: true, message: "
请输入圈子介绍
", trigger: "
blur
" },
// {
// min: 2,
// max: 40,
// message: "
输入长度为
2
-
40
的内容,可包含中英文、数字及特殊符号
",
// trigger: "
blur
"
// },
// { validator: checkProjectStr, trigger: "
blur
" }
// ],
}
const originForm1 = JSON.parse(JSON.stringify(form1));
const originRules1 = JSON.parse(JSON.stringify(rules1));
const originForm2 = JSON.parse(JSON.stringify(form2));
const originRules2 = JSON.parse(JSON.stringify(rules2));
const originForm = JSON.parse(JSON.stringify(form));
const originRules = JSON.parse(JSON.stringify(rules));
export default {
export default {
components: {
components: {
BreadCrumb,
BreadCrumb,
...
@@ -677,17 +884,8 @@
...
@@ -677,17 +884,8 @@
};
};
const checkNumber = (rule, value, cb) => {
const isInt = /^([1-9][0-9]*)$/;
if(value && !isInt.test(value)) cb(new Error('请输入正整数'));
cb();
}
const checkBarcode = (rule, value, cb) => {
const valedBarcode = new RegExp("
[
\\
u4E00
-
\\
u9FFF
]
+
","
g
");
if(value && valedBarcode.test(value)) cb(new Error('条形码不能输入中文'));
cb();
}
return{
return{
stock:{
stock:{
...
@@ -698,6 +896,7 @@
...
@@ -698,6 +896,7 @@
},
},
doseAll:[],
doseAll:[],
fileGoodsList:[],
fileGoodsList:[],
goodsCheckList: [],
fileIntrList:[],
fileIntrList:[],
intrIndex:-1,
intrIndex:-1,
isShowFileList:false,
isShowFileList:false,
...
@@ -740,59 +939,19 @@
...
@@ -740,59 +939,19 @@
hospitalTypeList: [{label:'村卫生室',value:'1'},{label:'乡镇卫生院/中心',value:'2'}], // 医疗机构类型
hospitalTypeList: [{label:'村卫生室',value:'1'},{label:'乡镇卫生院/中心',value:'2'}], // 医疗机构类型
checkTypeList: [{label:'常规检测',value:'1'}], // 检测类型
checkTypeList: [{label:'常规检测',value:'1'}], // 检测类型
suitableList: [{label:'儿童',value:'1'},{label:'青年',value:'2'},{label:'中年',value:'3'},{label:'老年',value:'4'}], // 适用人群
suitableList: [{label:'儿童',value:'1'},{label:'青年',value:'2'},{label:'中年',value:'3'},{label:'老年',value:'4'}], // 适用人群
// 不同类型服务的表单通用字段
// 不同类型服务的表单通用字段
// 不同类型服务的表单通用字段
formData: {
formData: {
medicationId: 0,
optPrice:0,
id:'',
categoryId:'',
categoryIdLevel2: '',
categoryIdLevel3: '',
categoryIdLevel4: '',
categoryIdLevel5: '',
goodsName:'',
goodsDescription:'',
goodsImages:[],
goodsType:'',
medicCommonName:'',
medicGoodsName:'',
size:'',
dosageId:null,
usage:'',
otc:false,
otc1:'1',
approvalNumber:'',
manufacturer:'',
department:'',
expiredTime:'',
specification_url:'',
treatDisease:'',
barCode:'',
discountPrice:'',
stock:0,
goodsStock:0,
specificationImages:[],
goodsId:'',
costPrice:'',
decrStock:'',//减少库存
incrStock:'',//增加库存
storeId: '',
// 检测服务新增 !!!!!!!!!!!!!!!!!!!! 1103
// 检测服务新增 !!!!!!!!!!!!!!!!!!!! 1103
// 检测服务新增 !!!!!!!!!!!!!!!!!!!! 1103
barCode: '',
checkPackageId: '',
checkName: '',
hospitalName: '',
hospitalType: '',
checkItem: '',
checkStandard: '',
useCount: '',
checkType: '',
suitable: '',
accessorialService: '',
endTime: '',
goodsCheckImages: [],
},
},
rules: {
},
// 不同类型服务的表单通用字段
// 不同类型服务的表单通用字段
// 不同类型服务的表单通用字段
showCropper: false,
showCropper: false,
currentOption: {
currentOption: {
offset_x: 120,
offset_x: 120,
...
@@ -811,96 +970,10 @@
...
@@ -811,96 +970,10 @@
slide2: {
slide2: {
oriUrl: '', // 原图
oriUrl: '', // 原图
},
},
rules: {
goodsName: [
{ required: true, message: "
请输入商品名称
", trigger: "
blur
" },
{
// min: 2,
// max: 14,
//message: "
输入长度为
2
-
14
的内容,可包含中英文、数字及特殊符号
",
trigger: "
blur
"
},
{ validator: checkProjectStr, trigger: "
blur
" }
],
introduce: [
{ required: true, message: "
请输入圈子介绍
", trigger: "
blur
" },
{
min: 2,
max: 40,
message: "
输入长度为
2
-
40
的内容,可包含中英文、数字及特殊符号
",
trigger: "
blur
"
},
{ validator: checkProjectStr, trigger: "
blur
" }
],
goodsImages: [
{ required: true, message: "
请上传商品头图
", trigger: "
blur
" }
],
goodsType:[
{ required: true, message: "
请选择商品类型
", trigger: "
change
" }
],
medicCommonName:[
{ required: true, message: "
请输入商品通用名称
", trigger: "
blur
" }
],
size:[
{ required: true, message: "
请输入商品规格
", trigger: "
blur
" }
],
manufacturer:[
{ required: true, message: "
请输入生产厂家
", trigger: "
blur
" }
],
approvalNumber:[
{ required: true, message: "
请输入批准文号
", trigger: "
blur
" }
],
dosageId:[
{ required: true, message: "
请选择剂型
", trigger: "
change
" }
],
categoryIdLevel2:[
{ required: true, message: "
请选择药品类型
", trigger: "
blur
" }
],
categoryIdLevel3:[
{ required: true, message: "
请选择一级类目
", trigger: "
blur
" }
],
categoryIdLevel4:[
{ required: true, message: "
请选择二级类目
", trigger: "
blur
" }
],
categoryIdLevel5:[
{ required: true, message: "
请选择三级类目
", trigger: "
blur
" }
],
otc:[
{ required: true, message: "
请选择是否是处方
", trigger: "
blur
" }
],
specification_url:[
{ required: true, message: "
请上传药品说明书
", trigger: "
blur
" }
],
barCode: [
{ required: true, message: "
请输入条形码
", trigger: "
blur
" },
{ validator: checkBarcode, trigger: "
blur
" }
],
optPrice: [
{ required: true, message: "
请输入零售价
", trigger: "
blur
" },
],
dynamicFlag: [
{ required: true, message: "
请选择内容发布权
", trigger: "
blur
" },
],
// 检测服务新增 !!!!!!!!!!!!!!!!!!!! 1103
// 检测服务新增 !!!!!!!!!!!!!!!!!!!! 1103
// 检测服务新增 !!!!!!!!!!!!!!!!!!!! 1103
checkPackageId: [{ required: true, message: "
请选择检测登记表
", trigger: "
blur
" }],
checkName: [{ required: true, message: "
请输入检测名称
", trigger: "
blur
" }],
hospitalName: [{ required: true, message: "
请输入医疗机构名称
", trigger: "
blur
" }],
hospitalType: [{ required: true, message: "
请选择医疗机构类型
", trigger: "
blur
" }],
checkItem: [{ required: true, message: "
请输入检测项目
", trigger: "
blur
" }],
checkStandard: [{ required: true, message: "
请输入检测指标
", trigger: "
blur
" }],
useCount: [{ required: true, message: "
请输入使用人数
", trigger: "
blur
" },{validator: checkNumber, trigger: "
blur
"}],
checkType: [{ required: true, message: "
请选择检测类型
", trigger: "
blur
" }],
suitable: [{ required: true, message: "
请选择适用人群
", trigger: "
blur
" }],
// accessorialService: [{ required: true, message: "
请输入附加服务
", trigger: "
blur
" }],
endTime: [{ required: true, message: "
请选择商品使用日期
", trigger: "
blur
" }],
// goodsCheckImages: [{ required: true, message: "
请选择检测说明
", trigger: "
blur
" }],
},
imgMouseOver1: false,
imgMouseOver1: false,
uploadImgMessage1: false,//未上传图片,校验提示语
uploadImgMessage1: false,//未上传图片,校验提示语
isMedic:false,
isMedic:false,
// 商品类型选择【药品】时!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
isCheckServe: false,
isCheckServe: false,
// 商品类型选择【检测服务】时!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
}
},
},
computed: {
computed: {
...
@@ -909,7 +982,10 @@
...
@@ -909,7 +982,10 @@
created() {
created() {
vm = this;
vm = this;
const {id, storeId} = this.$route.query
this.formData = originForm;
this.rules = originRules;
const {id, storeId} = this.$route.query;
this.jumPathThird = '/goods-manage?storeId='+storeId
this.jumPathThird = '/goods-manage?storeId='+storeId
//this.jumPathThird = '/create-good?id=add&storeId=46'
//this.jumPathThird = '/create-good?id=add&storeId=46'
this.title = id == 'add' ? '新增商品' : '编辑商品'
this.title = id == 'add' ? '新增商品' : '编辑商品'
...
@@ -927,6 +1003,7 @@
...
@@ -927,6 +1003,7 @@
// let goods = Object.assign(this.goodsInfo,{})
// let goods = Object.assign(this.goodsInfo,{})
// this.formData = {...goods}
// this.formData = {...goods}
// console.log(goods)
// console.log(goods)
this.formData.goodsId = id;
this.getDetailByEdit(id)
this.getDetailByEdit(id)
}
}
...
@@ -962,6 +1039,7 @@
...
@@ -962,6 +1039,7 @@
this.fileGoodsList = this.getImges(goodsList[0].goodsImgList,1)
this.fileGoodsList = this.getImges(goodsList[0].goodsImgList,1)
this.fileIntrList = this.getImges(goodsList[0].medicImgList,2)
this.fileIntrList = this.getImges(goodsList[0].medicImgList,2)
this.isMedic = this.formData.goodsType == 5 ? true : false
this.isMedic = this.formData.goodsType == 5 ? true : false
// this.isCheckServe = this.formData.goodsType == 337 ? true : false
this.formData.stock = this.formData.goodsStock
this.formData.stock = this.formData.goodsStock
console.log(this.formData.otc)
console.log(this.formData.otc)
this.formData.otc1 = this.formData.otc ? '1' : '0'
this.formData.otc1 = this.formData.otc ? '1' : '0'
...
@@ -1073,18 +1151,61 @@
...
@@ -1073,18 +1151,61 @@
});
});
},
},
getGoodsTypes(id,type){
getGoodsTypes(id,type){
this.formData = originForm;
this.rules = originRules;
if(id == 5 ){
if(id == 5 ){
this.isMedic = true;
this.isMedic = true;
this.isCheckServe = false;
this.isCheckServe = false;
this.formData = {
...this.formData,
...originForm1
};
this.rules = {
...this.rules,
...originRules1
};
this.getLever(id,type)
this.getLever(id,type)
} else if( id ==
11
){
} else if( id ==
337
){
this.isMedic = false;
this.isMedic = false;
this.isCheckServe = true;
this.isCheckServe = true;
this.formData = {
...this.formData,
...originForm2
};
this.rules = {
...this.rules,
...originRules2
};
console.log(`=========================================================调试新增检测服务 start=========================================================`);
console.log(this.formData);
console.log(this.rules);
console.log(`=========================================================调试新增检测服务 end=========================================================`);
}else{
}else{
this.isMedic = false;
this.isMedic = false;
this.isCheckServe = false;
this.isCheckServe = false;
this.formData = {
...this.formData,
...originForm1
};
this.rules = {
...this.rules,
...originRules1
};
}
}
},
},
defaultArr(){
defaultArr(){
let a = [
let a = [
{
{
...
@@ -1103,18 +1224,6 @@
...
@@ -1103,18 +1224,6 @@
if(type == 1){
if(type == 1){
this.oneLever = res.data
this.oneLever = res.data
this.oneLever = [...this.oneLever, {
categoryDescription: "",
categoryLive: 1,
categoryName: "
检测服务
",
createdId: 0,
createdTime: "
2020
-
08
-
15
11
:
55
:
27
",
deleteFlag: 1,
id: 11,
modifiedId: 0,
modifiedTime: "
2020
-
08
-
15
11
:
55
:
27
",
parentId: 0
}]
}else if(type == 2){
}else if(type == 2){
//console.log(res)
//console.log(res)
...
@@ -1149,7 +1258,6 @@
...
@@ -1149,7 +1258,6 @@
}
}
});
});
},
},
updateStock(){
updateStock(){
let r = /^
\
+?[1-9][0-9]*$/;
let r = /^
\
+?[1-9][0-9]*$/;
//造假 接口来了删掉
//造假 接口来了删掉
...
@@ -1184,8 +1292,6 @@
...
@@ -1184,8 +1292,6 @@
//this.formData.goodsStock = this.formData.stock
//this.formData.goodsStock = this.formData.stock
this.stockDio = false
this.stockDio = false
},
},
changeStock(type){
changeStock(type){
if(this.formData.stock == 0 && type == 1){
if(this.formData.stock == 0 && type == 1){
return;
return;
...
@@ -1201,16 +1307,8 @@
...
@@ -1201,16 +1307,8 @@
}
}
this.stockDio = true
this.stockDio = true
},
},
complete() {
complete() {
let formName = "
formData
";
let formName = "
formData
";
// let goodsImgList = this.fileGoodsList.map((item, index) => {
// item.imageSort = index+1;
// })
// console.log(this.fileGoodsList)
// let specificationImgList = this.fileIntrList.map((item, index) => {
// item.imageSort = index+1;
// })
for(let i=0;i<this.fileGoodsList.length;i++){
for(let i=0;i<this.fileGoodsList.length;i++){
this.fileGoodsList[i].imageSort = i+1
this.fileGoodsList[i].imageSort = i+1
}
}
...
@@ -1218,26 +1316,30 @@
...
@@ -1218,26 +1316,30 @@
this.fileIntrList[j].imageSort = j+1
this.fileIntrList[j].imageSort = j+1
}
}
this.formData.goodsImages = this.fileGoodsList;
this.formData.goods
Header
Images = this.fileGoodsList;
this.formData.specificationImages = this.fileIntrList;
this.formData.specificationImages = this.fileIntrList;
this.isgoodsImages = this.formData.goodsImages.length == 0 ? false :true;
this.isgoodsImages = this.formData.goods
Header
Images.length == 0 ? false :true;
// this.isSpecification_url = this.formData.specificationImages.length == 0 ? false : true
// this.isSpecification_url = this.formData.specificationImages.length == 0 ? false : true
this.formData.categoryId = this.formData.goodsType
this.formData.categoryId = this.formData.goodsType
this.formData.otc = this.formData.otc1 == 1 ? true : false
this.formData.otc = this.formData.otc1 == 1 ? true : false
this.isgoodStock = this.formData.stock > 0 ? true : false
this.isgoodStock = this.formData.stock > 0 ? true : false
console.log(this.isgoodStock)
console.log(this.isgoodStock);
// 如果是【药品】类型的商品
if(this.isMedic){
if(this.isMedic){
if(!this.isgoodsImages){
if(!this.isgoodsImages){
return;
return;
}
}
// if(!this.isSpecification_url){
// return;
// }
}
}
// 如果是【检测服务】类型的商品
if(this.isCheckServe){
this.formData.goodsCheckImages = this.goodsCheckList;
const { suitableStr } = this.formData;
this.formData.suitable = suitableStr.join(',');
}
if(!this.isgoodStock){
if(!this.isgoodStock){
return;
return;
}
}
this.$refs[formName].validate((valid) => {
this.$refs[formName].validate((valid) => {
if (valid) {
if (valid) {
//alert('submit!');
//alert('submit!');
...
@@ -1248,22 +1350,21 @@
...
@@ -1248,22 +1350,21 @@
}
}
});
});
},
},
//更新商品
//更新商品
updateGoodsInfo(){
updateGoodsInfo(){
//this.formData.incrStock = 1000
this.formData.costPrice = this.formData.optPrice*100
this.formData.costPrice = this.formData.optPrice*100
this.formData.hasChanged = true;
this.formData.hasChanged = true;
console.log('提交值',this.formData);
console.log('提交值',this.formData);
updateGoods(this.formData).then((res)=>{
const submieFn = this.isCheckServe ? updateGoodsV2 : updateGoods;
submieFn(this.formData).then((res)=>{
if (res.code !== '000000') {
if (res.code !== '000000') {
// return this.$message.error(res.message);
return this.$message({
return this.$message({
message: res.message,
message: res.message,
type: 'error'
type: 'error'
});
});
}
}
vm.$message.success("
操作成功
");
vm.$message.success("
操作成功
");
this.$router.push({
this.$router.push({
path: '/goods-manage',
path: '/goods-manage',
...
@@ -1284,12 +1385,7 @@
...
@@ -1284,12 +1385,7 @@
const isLt200k = file.size / 1024 < 200;
const isLt200k = file.size / 1024 < 200;
if (picTypes.indexOf(file.type) == -1) {
if (picTypes.indexOf(file.type) == -1) {
return this.$message.error("
请上传
jpeg
或
png
格式的图片
");
return this.$message.error("
请上传
jpeg
或
png
格式的图片
");
}
}
// if (!isLt200k) {
// return vm.$message.error("
图片大小请控制在
200
kb
以内
");
// }
let _img = new FileReader();
let _img = new FileReader();
_img.readAsDataURL(file);
_img.readAsDataURL(file);
...
@@ -1300,39 +1396,49 @@
...
@@ -1300,39 +1396,49 @@
image.onload = function () {
image.onload = function () {
let _this = this;
let _this = this;
console.log(_this.width,_this.height)
console.log(_this.width,_this.height)
// if (_this.width != fileLimit.width || _this.height != fileLimit.height) {
//if (_this.width == 750 && _this.height == 420) {
openLoading(vm);
openLoading(vm);
doUpload(vm, file, getFilePath(file, null), "
preview4
", "
progress1
", 1).then(function (path) {
doUpload(vm, file, getFilePath(file, null), "
preview4
", "
progress1
", 1).then(function (path) {
closeLoading(vm);
closeLoading(vm);
console.log('上传成功后路径', path);
console.log('上传成功后路径', path);
// if (fileLimit.show == "
uploadImgMessage1
") {
// vm.uploadImgMessage1 = false;
// } else if (fileLimit.show == "
uploadImgMessage2
") {
// vm.uploadImgMessage2 = false;
// }
let len = vm.fileGoodsList.length;
let len = vm.fileGoodsList.length;
vm.fileGoodsList.push({url:path.fullPath,imageUrl:path.fullPath,imageName:'',imageSort: len+1,imageType: 2,id: null,})
vm.fileGoodsList.push({ url: path.fullPath, goodsImgUrl: path.fullPath, imgSort: len+1, goodsId: vm.formData.goodsId });
//vm.formData.goodsImages = path.fullPath
vm.$message.success("
上传成功
");
vm.$message.success("
上传成功
");
});
});
// } else {
// return vm.$message.error("
图片尺寸不符合规范,请根据规范上传图片
");
// }
};
};
};
};
// openLoading(vm);
},
// doUpload(vm, file, getFilePath(file, null), "
preview4
", "
progress1
", 1).then(function (path) {
// 上传检测说明图
// closeLoading(vm);
beforeUploadPic2(file) {
// console.log('上传成功后路径', path);
if(this.fileGoodsList.length > 10){
// vm.formData.goodsImages = path.fullPath
return ;
}
// vm.$message.success("
上传成功
")
;
let vm = this
;
// });
let picTypes = ['image/jpeg','image/png']
const isLt200k = file.size / 1024 < 200;
if (picTypes.indexOf(file.type) == -1) {
return this.$message.error("
请上传
jpeg
或
png
格式的图片
");
}
let _img = new FileReader();
_img.readAsDataURL(file);
_img.onload = function (theFile) {
let image = new Image()
image.src = theFile.target.result
vm.slide2.oriUrl = theFile.target.result;
image.onload = function () {
let _this = this;
console.log(_this.width,_this.height)
openLoading(vm);
doUpload(vm, file, getFilePath(file, null), "
preview4
", "
progress1
", 1).then(function (path) {
closeLoading(vm);
console.log('上传成功后路径', path);
let len = vm.goodsCheckList.length;
vm.goodsCheckList.push({ url: path.fullPath, imageUrl: path.fullPath, imageSort: len+1, id: vm.formData.goodsId });
vm.$message.success("
上传成功
");
});
};
};
},
},
//上传药品说明
//上传药品说明
beforeUploadPic1(file,type) {
beforeUploadPic1(file,type) {
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录