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
7bf4d85a
Commit
7bf4d85a
authored
Feb 27, 2023
by
lixiaomin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
店铺商品信息特惠
parent
94de8bc8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
140 additions
and
36 deletions
+140
-36
src/views/shop/shop/components/commodity.vue
+4
-4
src/views/shop/shop/components/preferential.vue
+136
-32
No files found.
src/views/shop/shop/components/commodity.vue
View file @
7bf4d85a
...
@@ -25,10 +25,10 @@
...
@@ -25,10 +25,10 @@
<span>
{{
scope
.
row
.
name
}}
</span>
<span>
{{
scope
.
row
.
name
}}
</span>
</div>
</div>
<div
style=
"margin-left: 8px;margin-right: 8px"
>
<div
style=
"margin-left: 8px;margin-right: 8px"
>
<el-button
v-show=
"scope.row.recommend=='
0
'"
type=
"text"
>
荐
</el-button>
<el-button
v-show=
"scope.row.recommend=='
1
'"
type=
"text"
>
荐
</el-button>
</div>
</div>
<div>
<div>
<el-button
style=
"color:red"
v-show=
"scope.row.preferential=='
0
'"
type=
"text"
>
惠
</el-button>
<el-button
style=
"color:red"
v-show=
"scope.row.preferential=='
1
'"
type=
"text"
>
惠
</el-button>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -78,10 +78,10 @@
...
@@ -78,10 +78,10 @@
</el-table-column>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-button
size=
"mini"
@
click=
"addRecommend(scope.row)"
type=
"text"
>
<el-button
size=
"mini"
@
click=
"addRecommend(scope.row)"
type=
"text"
v-show=
"scope.row.recommend=='0'"
>
推荐
推荐
</el-button>
</el-button>
<el-button
@
click=
"preferential(scope.row)"
size=
"mini"
type=
"text"
>
<el-button
@
click=
"preferential(scope.row)"
size=
"mini"
type=
"text"
v-show=
"scope.row.preferential=='0'"
>
特惠
特惠
</el-button>
</el-button>
</
template
>
</
template
>
...
...
src/views/shop/shop/components/preferential.vue
View file @
7bf4d85a
<
template
>
<
template
>
<el-dialog
title=
"特惠"
:visible
.
sync=
"open"
width=
"600px"
append-to-body
>
<el-dialog
title=
"特惠"
:visible
.
sync=
"open"
width=
"600px"
append-to-body
>
<!-- 添加或修改店铺对话框 -->
<!-- 添加或修改店铺对话框 -->
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"120px"
>
<el-form
:model=
"form"
label-width=
"120px"
>
<el-form-item
label=
"商品名称"
>
<el-row>
{{
form
.
goodsName
}}
<el-col
:span=
"8"
>
</el-form-item>
<el-form-item
label=
"商品名称"
>
<el-form-item
label=
"原售价"
>
{{
form
.
goodsName
}}
{{
form
.
price
}}
</el-form-item>
</el-form-item>
</el-col>
<el-form-item
label=
"折扣价"
>
<el-col
:span=
"8"
>
{{
form
.
discount
}}
<el-form-item
label=
"原售价"
>
</el-form-item>
{{
form
.
price
}}
</el-form>
</el-form-item>
</el-col>
<el-col
:span=
"8"
>
<el-form-item
label=
"折扣价"
>
{{
form
.
discount
}}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-form-item
label=
"特惠价格"
>
<el-input
v-model=
"form.recommendPrice"
placeholder=
"请输入特惠价格"
/>
</el-form-item>
</el-row>
<el-row>
<el-form-item
label=
"特惠标签"
>
<div
style=
"border: 1px solid #ccc;height: 70px"
>
<el-tag
:key=
"tag"
v-for=
"tag in recommendTagList"
closable
:disable-transitions=
"false"
@
close=
"handleClose(tag)"
>
{{
tag
}}
</el-tag>
<el-input
class=
"input-new-tag"
v-if=
"inputVisible"
v-model=
"inputValue"
ref=
"saveTagInput"
size=
"small"
@
keyup
.
enter
.
native=
"handleInputConfirm"
@
blur=
"handleInputConfirm"
/>
<el-button
v-else
class=
"button-new-tag"
size=
"small"
@
click=
"showInput"
>
+添加标签
</el-button>
</div>
</el-form-item>
</el-row>
</el-form>
<div
class=
"dialog-footer"
>
<div
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
...
@@ -25,33 +62,84 @@ export default {
...
@@ -25,33 +62,84 @@ export default {
props
:
[
'shopId'
],
props
:
[
'shopId'
],
data
()
{
data
()
{
return
{
return
{
form
:
{},
form
:
{
goodsName
:
""
,
shopId
:
null
,
goodsId
:
null
,
price
:
null
,
discount
:
null
,
type
:
null
,
recommendPrice
:
null
,
recommendTagList
:[]
},
open
:
false
,
open
:
false
,
rules
:
{
tagValues
:
""
,
name
:
[
inputVisible
:
false
,
{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"change"
},
inputValue
:
''
,
],
recommendTagList
:[],
desc
:
[
goodsTagList
:[],
{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"change"
},
goodsTagValue
:
""
],
pic
:
[
{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"change"
},
],
},
}
}
},
},
methods
:
{
methods
:
{
handleClose
(
tag
)
{
this
.
recommendTagList
.
splice
(
this
.
recommendTagList
.
indexOf
(
tag
),
1
);
if
(
this
.
recommendTagList
.
length
==
0
){
this
.
tagValues
=
""
;
}
else
{
this
.
tagValues
=
this
.
tagValues
.
replace
(
tag
,
""
);
}
},
handleInputConfirm
()
{
let
length
=
0
;
let
inputValues
=
this
.
inputValue
;
if
(
inputValues
)
{
if
(
this
.
recommendTagList
.
indexOf
(
inputValues
)
==-
1
&&
this
.
goodsTagList
.
indexOf
(
inputValues
)
==-
1
){
length
=
this
.
recommendTagList
.
length
+
this
.
goodsTagList
.
length
;
if
(
length
>=
3
){
this
.
$message
.
error
(
'标签个数最多添加三个!'
);
}
else
{
this
.
tagValues
=
this
.
tagValues
+
inputValues
;
if
((
this
.
goodsTagValue
.
length
+
this
.
tagValues
.
length
)
>
13
){
this
.
$message
.
error
(
'标签总字符数量最大13!'
);
this
.
tagValues
=
this
.
tagValues
.
replace
(
inputValues
,
""
);
}
else
{
this
.
recommendTagList
.
push
(
inputValues
);
}
}
}
else
{
this
.
$message
.
error
(
'请重新添加标签,该标签已存在!'
);
}
}
this
.
inputVisible
=
false
;
this
.
inputValue
=
''
;
},
showInput
()
{
this
.
inputVisible
=
true
;
this
.
$nextTick
(
_
=>
{
this
.
$refs
.
saveTagInput
.
$refs
.
input
.
focus
();
});
},
/** 提交按钮 */
/** 提交按钮 */
submitForm
()
{
submitForm
()
{
this
.
$refs
[
"form"
].
validate
((
valid
)
=>
{
let
obj
=
Object
.
assign
({},
this
.
form
)
if
(
valid
)
{
if
(
obj
.
recommendPrice
!=
null
){
addRecommend
(
this
.
form
).
then
((
res
)
=>
{
var
regular
=
/
(
^
[
+
]{0,1}([
0-9
]
+
)
$
)
|
(
^
[
+
]{0,1}([
0-9
]
+
)[\.]{1}[
0-9
]{2}
$
)
/
;
//正数 ,小数可有可无,最多2位
this
.
$modal
.
msgSuccess
(
"成功"
);
if
(
!
regular
.
test
(
obj
.
recommendPrice
)){
this
.
open
=
false
;
this
.
$message
.
error
(
"请输入大于0的正数,最多保留2位小数!"
);
});
return
;
}
}
});
}
else
{
obj
.
recommendPrice
=
obj
.
discount
}
obj
.
recommendTagList
=
this
.
recommendTagList
addRecommend
(
obj
).
then
((
res
)
=>
{
if
(
res
.
code
==
"200"
){
this
.
$modal
.
msgSuccess
(
"成功"
);
this
.
open
=
false
;
this
.
$parent
.
getList
();
}
});
},
},
// 取消按钮
// 取消按钮
cancel
()
{
cancel
()
{
...
@@ -64,12 +152,22 @@ export default {
...
@@ -64,12 +152,22 @@ export default {
this
.
resetForm
(
"form"
);
this
.
resetForm
(
"form"
);
},
},
openModal
(
data
)
{
openModal
(
data
)
{
console
.
log
(
"data"
,
data
);
this
.
goodsTagValue
=
""
;
this
.
form
.
goodsName
=
data
.
name
this
.
form
.
goodsName
=
data
.
name
this
.
form
.
shopId
=
this
.
shopId
this
.
form
.
shopId
=
this
.
shopId
this
.
form
.
goodsId
=
data
.
id
this
.
form
.
goodsId
=
data
.
id
this
.
form
.
price
=
data
.
price
this
.
form
.
price
=
data
.
price
this
.
form
.
discount
=
data
.
discount
this
.
form
.
discount
=
data
.
discount
this
.
form
.
type
=
2
this
.
form
.
type
=
2
this
.
form
.
recommendPrice
=
data
.
recommendPrice
this
.
goodsTagList
=
data
.
goodsTagList
;
this
.
recommendTagList
=
data
.
recommendTagList
;
if
(
this
.
goodsTagList
.
length
>
0
){
for
(
let
i
=
0
;
i
<
this
.
goodsTagList
.
length
;
i
++
){
this
.
goodsTagValue
=
this
.
goodsTagValue
+
this
.
goodsTagList
[
i
];
}
}
this
.
open
=
true
this
.
open
=
true
}
}
...
@@ -87,4 +185,9 @@ export default {
...
@@ -87,4 +185,9 @@ export default {
width
:
48%
;
width
:
48%
;
}
}
.input-new-tag
{
width
:
90px
;
margin-left
:
10px
;
vertical-align
:
bottom
;
}
</
style
>
</
style
>
\ No newline at end of file
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