Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
web
soss
Commits
d936250a
Commit
d936250a
authored
May 20, 2022
by
lixiaomin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改规格
parent
9814bf55
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
src/views/goods/spec/SpecsSelect.vue
+3
-3
src/views/goods/spec/index.vue
+14
-6
No files found.
src/views/goods/spec/SpecsSelect.vue
View file @
d936250a
...
...
@@ -12,12 +12,12 @@
<el-checkbox
true-label=
"1"
false-label=
"0"
v-model=
"scope.row.isRecommend"
></el-checkbox>
</
template
>
</el-table-column>
<el-table-column
label=
"名称"
width=
"1
0
0"
align=
"center"
prop=
"name"
>
<el-table-column
label=
"名称"
width=
"1
2
0"
align=
"center"
prop=
"name"
>
<
template
slot-scope=
"scope"
>
<el-input
placeholder=
"名称"
v-model=
"scope.row.name"
></el-input>
<el-input
placeholder=
"名称"
v-model=
"scope.row.name"
wi
></el-input>
</
template
>
</el-table-column>
<el-table-column
label=
"价格"
width=
"
8
0"
align=
"center"
prop=
"amount"
>
<el-table-column
label=
"价格"
width=
"
12
0"
align=
"center"
prop=
"amount"
>
<
template
slot-scope=
"scope"
>
<el-input
placeholder=
"价格"
v-model=
"scope.row.amount"
>
</el-input>
</
template
>
...
...
src/views/goods/spec/index.vue
View file @
d936250a
...
...
@@ -65,7 +65,7 @@
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"900px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"名称"
prop=
"name"
>
<el-input
v-model=
"form.name"
placeholder=
"请输入规格名称"
/>
<el-input
v-model=
"form.name"
placeholder=
"请输入规格名称"
maxlength=
"100"
/>
</el-form-item>
<el-form-item
label=
"必须原料"
>
<el-switch
v-model=
"form.isNeccessary"
:active-value=
"2"
:inactive-value=
"1"
>
...
...
@@ -74,6 +74,9 @@
<el-form-item
label=
"选项"
prop=
"specRules"
>
<SpecsSelect
:initData=
"form.specRules"
ref=
"specsSelect"
/>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remarks"
>
<el-input
v-model=
"form.remarks"
type=
"textarea"
placeholder=
"请输入内容"
maxlength=
"500"
show-word-limit
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
...
...
@@ -97,10 +100,9 @@ export default {
components
:
{
SpecsSelect
},
data
()
{
var
validateSpecRules
=
(
rule
,
value
,
callback
)
=>
{
let
SpecRulesValue
=
this
.
form
.
specRules
;
if
(
SpecRulesValue
.
length
==
0
)
{
if
(
value
.
length
==
0
)
{
callback
(
new
Error
(
'请添加选项'
));
}
else
if
(
SpecRulesV
alue
.
length
<
2
){
}
else
if
(
v
alue
.
length
<
2
){
callback
(
new
Error
(
'请最少添加2个选项'
));
}
else
{
callback
();
...
...
@@ -242,6 +244,8 @@ export default {
},
/** 提交按钮 */
submitForm
()
{
let
regular
=
/^
[
+
]{0,1}([
0-9
]
+
)
$|^
[
+
]{0,1}(\d
+
\.\d{2})
$/
//正数(保留2位小数)
this
.
$refs
[
"form"
].
validate
((
valid
)
=>
{
if
(
valid
)
{
let
specsSelectList
=
this
.
$refs
.
specsSelect
.
list
;
...
...
@@ -251,10 +255,14 @@ export default {
this
.
$modal
.
msgSuccess
(
'选项列表中的第'
+
index
+
'行名称不能为空'
);
return
;
}
if
(
specsSelectList
[
i
].
amount
==
""
||
specsSelectList
[
i
].
amount
==
0
){
this
.
$modal
.
msgSuccess
(
'选项列表中的第'
+
index
+
'行价格不能为空或0'
);
if
(
specsSelectList
[
i
].
amount
==
""
){
this
.
$modal
.
msgSuccess
(
'选项列表中的第'
+
index
+
'行价格不能为空'
);
}
else
{
if
(
!
regular
.
test
(
specsSelectList
[
i
].
amount
)){
this
.
$modal
.
msgSuccess
(
'选项列表中的第'
+
index
+
'行价格不是大于等于0的两位小数'
);
return
;
}
}
if
(
!
specsSelectList
[
i
].
isRecommend
){
specsSelectList
[
i
].
isRecommend
=
"0"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment