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
94de8bc8
Commit
94de8bc8
authored
Feb 27, 2023
by
lixiaomin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
店铺商品信息新增规格
parent
1e6fd284
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
131 additions
and
37 deletions
+131
-37
src/api/system/shop.js
+16
-0
src/views/goods/category/index.vue
+1
-0
src/views/shop/shop/components/commodity.vue
+112
-36
src/views/shop/shop/setShop.vue
+2
-1
No files found.
src/api/system/shop.js
View file @
94de8bc8
...
@@ -174,3 +174,19 @@ export function checkMachine(id) {
...
@@ -174,3 +174,19 @@ export function checkMachine(id) {
method
:
"get"
,
method
:
"get"
,
});
});
}
}
// 获取规格选项状态
export
function
getSpecState
(
shopId
,
goodsId
)
{
return
request
({
url
:
"/system/shop/getShopGoodsSpecs?shopId="
+
shopId
+
"&goodsId="
+
goodsId
,
method
:
"get"
,
});
}
// 修改规格选项状态
export
function
updateSpecState
(
shopId
,
goodsId
,
ruleId
,
state
)
{
return
request
({
url
:
"/system/shop/updateShopGoodsSpecState?shopId="
+
shopId
+
"&goodsId="
+
goodsId
+
"&ruleId="
+
ruleId
+
"&state="
+
state
,
method
:
"get"
,
});
}
src/views/goods/category/index.vue
View file @
94de8bc8
...
@@ -246,6 +246,7 @@ export default {
...
@@ -246,6 +246,7 @@ export default {
.
catch
(()
=>
{
});
.
catch
(()
=>
{
});
},
},
/** 修改按钮操作 */
/** 修改按钮操作 */
handleUpdate
(
row
)
{
handleUpdate
(
row
)
{
this
.
reset
();
this
.
reset
();
...
...
src/views/shop/shop/components/commodity.vue
View file @
94de8bc8
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
</el-button>
</el-button>
</el-col>
</el-col>
<el-col
:span=
"6"
>
<el-col
:span=
"6"
>
<el-button
type=
"primary"
@
click=
"openSelectGoos"
plain
icon=
"el-icon-plus"
size=
"small"
:disabled=
"showButton"
>
添加商品
<el-button
type=
"primary"
@
click=
"openSelectGoos"
plain
icon=
"el-icon-plus"
size=
"small"
>
添加商品
</el-button>
</el-button>
<el-button
type=
"danger"
@
click=
"soldOutGoos"
plain
icon=
"el-icon-minus"
size=
"small"
>
下架商品
</el-button>
<el-button
type=
"danger"
@
click=
"soldOutGoos"
plain
icon=
"el-icon-minus"
size=
"small"
>
下架商品
</el-button>
</el-col>
</el-col>
...
@@ -45,10 +45,23 @@
...
@@ -45,10 +45,23 @@
<el-table-column
label=
"折扣价"
align=
"center"
prop=
"discount"
/>
<el-table-column
label=
"折扣价"
align=
"center"
prop=
"discount"
/>
<el-table-column
label=
"总销量"
align=
"center"
prop=
"salesVolume"
/>
<el-table-column
label=
"总销量"
align=
"center"
prop=
"salesVolume"
/>
<el-table-column
label=
"上架时间"
align=
"center"
prop=
"shelfAt"
width=
"150"
/>
<el-table-column
label=
"上架时间"
align=
"center"
prop=
"shelfAt"
width=
"150"
/>
<el-table-column
label=
"状态"
align=
"center"
prop=
"state
"
width=
"150"
>
<el-table-column
label=
"规格"
align=
"center"
prop=
"
"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span
v-if=
"scope.row.state == 1"
>
售卖
</span>
<div
v-for=
"(item,index) in getSpecList(scope.row.spec)"
:key=
"index"
>
<span
v-if=
"scope.row.state == 2"
>
告罄
</span>
<el-tooltip
effect=
"dark"
placement=
"right-start"
>
<div
slot=
"content"
>
<div
v-for=
"ru in item.specRules"
:key=
"ru.id"
style=
"display: flex;align-items: center;"
>
<div
style=
"margin-right: 20px;"
>
{{
ru
.
name
}}
</div>
<div>
{{
ru
.
amount
}}
</div>
</div>
</div>
<div>
<el-button
style=
"height:30px"
>
{{
item
.
name
}}
</el-button>
</div>
</el-tooltip>
</div>
<div
style=
"text-align:center;"
>
已售罄(
{{
scope
.
row
.
selloutCount
}}
/
{{
scope
.
row
.
skuCount
}}
)
</div>
<div><el-button
size=
"mini"
type=
"text"
@
click=
"clickView(scope.row)"
>
查看
</el-button></div>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"排序"
>
<el-table-column
label=
"排序"
>
...
@@ -84,14 +97,49 @@
...
@@ -84,14 +97,49 @@
layout=
"total, sizes, prev, pager, next,jumper"
layout=
"total, sizes, prev, pager, next,jumper"
:total=
"totalNum"
>
:total=
"totalNum"
>
</el-pagination>
</el-pagination>
<el-dialog
title=
"查看规格"
:visible
.
sync=
"viewSpecDialog"
width=
"1000px"
append-to-body
>
<div
style=
"margin-bottom: 10px;"
>
<el-row>
<el-col
:span=
'2'
>
商品名称
</el-col>
<el-col
:span=
'22'
>
{{goodsName}}
</el-col>
</el-row>
</div>
<div
style=
"display:flex;flex-direction:row;flex-wrap:wrap;width:1000px;margin-bottom: 10px;"
>
<div
style=
"width:480px;"
v-for=
"(item,index) in specList"
:key=
"index"
>
<el-row
style=
"margin-bottom: 10px;"
>
<el-col
:span=
'4'
>
规格组名
</el-col>
<el-col
:span=
'20'
>
{{item.name}}
</el-col>
</el-row>
<el-row>
<el-col
:span=
'4'
>
选项值
</el-col>
<el-col
:span=
'20'
>
<el-table
:data=
"item.specRules"
>
<el-table-column
label=
"选项名称"
prop=
"name"
/>
<el-table-column
label=
"售罄"
>
<
template
slot-scope=
"scope"
>
<div
@
click=
"changeState(scope.row)"
><el-switch
v-model=
"scope.row.state"
/>
</div>
<span
v-if=
"scope.row.state == false"
>
售罄
</span>
<span
v-if=
"scope.row.state == true"
>
在售
</span>
</
template
>
</el-table-column>
</el-table>
</el-col>
</el-row>
</div>
</div>
<div
class=
"dialog-footer"
style=
"text-align: center"
>
<el-button
@
click=
"cancel"
type=
"primary"
>
关闭
</el-button>
</div>
</el-dialog>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
getCategoryGoods
,
addGoods
,
offGoods
,
turnList
,
checkMachin
e
}
from
"@/api/system/shop"
;
import
{
getCategoryGoods
,
addGoods
,
offGoods
,
turnList
,
getSpecState
,
updateSpecStat
e
}
from
"@/api/system/shop"
;
import
SelectGoods
from
'@/components/SelectGoods'
;
import
SelectGoods
from
'@/components/SelectGoods'
;
import
AddRecommend
from
'./addRecommend.vue'
import
AddRecommend
from
'./addRecommend.vue'
import
Preferential
from
'./preferential.vue'
;
import
Preferential
from
'./preferential.vue'
;
import
{
TagsView
}
from
'../../../../layout/components'
;
export
default
{
export
default
{
props
:
[
'shopId'
],
props
:
[
'shopId'
],
...
@@ -116,13 +164,48 @@ export default {
...
@@ -116,13 +164,48 @@ export default {
outIds
:
''
,
outIds
:
''
,
total
:
null
,
total
:
null
,
goodsList
:[],
goodsList
:[],
showButton
:
true
viewSpecDialog
:
false
,
}
specList
:[],
specState
:
true
,
goodsId
:
null
,
goodsName
:
""
}
},
},
mounted
()
{
mounted
()
{
//this.getList()
//this.getList()
},
},
methods
:
{
methods
:
{
cancel
(){
this
.
viewSpecDialog
=
false
;
},
changeState
(
row
){
let
tag
=
2
;
if
(
row
.
state
){
tag
=
1
;
}
updateSpecState
(
this
.
shopId
,
this
.
goodsId
,
row
.
id
,
tag
).
then
((
response
)
=>
{
if
(
response
.
code
==
"200"
){
this
.
$modal
.
msgSuccess
(
"修改状态成功!"
);
}
})
},
clickView
(
row
){
this
.
viewSpecDialog
=
true
;
this
.
goodsId
=
row
.
id
;
this
.
goodsName
=
row
.
name
;
getSpecState
(
this
.
shopId
,
row
.
id
).
then
((
response
)
=>
{
if
(
response
.
code
==
"200"
){
for
(
let
i
=
0
;
i
<
response
.
data
.
length
;
i
++
){
let
itemI
=
response
.
data
[
i
];
for
(
let
j
=
0
;
j
<
itemI
.
specRules
.
length
;
j
++
){
let
itemJ
=
itemI
.
specRules
[
j
];
itemJ
.
state
=
(
itemJ
.
state
==
1
?
true
:
false
);
}
}
this
.
specList
=
response
.
data
}
});
},
turnClick
(
row
,
tag
){
turnClick
(
row
,
tag
){
turnList
({
"shopId"
:
this
.
shopId
,
"goodsId"
:
row
.
id
,
"pointer"
:
tag
}).
then
((
response
)
=>
{
turnList
({
"shopId"
:
this
.
shopId
,
"goodsId"
:
row
.
id
,
"pointer"
:
tag
}).
then
((
response
)
=>
{
if
(
response
.
code
==
"200"
){
if
(
response
.
code
==
"200"
){
...
@@ -155,36 +238,27 @@ export default {
...
@@ -155,36 +238,27 @@ export default {
},
},
getList
()
{
getList
()
{
if
(
!
this
.
shopId
)
return
;
if
(
!
this
.
shopId
)
return
;
checkMachine
(
this
.
shopId
).
then
(({
data
})
=>
{
this
.
list
=
[];
if
(
data
){
getCategoryGoods
(
this
.
shopId
).
then
(({
data
})
=>
{
this
.
showButton
=
false
;
if
(
data
&&
data
.
length
>
0
)
{
this
.
list
=
[];
this
.
options
=
data
;
getCategoryGoods
(
this
.
shopId
).
then
(({
data
})
=>
{
if
(
this
.
btnId
==
''
){
if
(
data
&&
data
.
length
>
0
)
{
this
.
list
=
data
[
0
].
goodsList
;
this
.
options
=
data
;
this
.
btnId
=
data
[
0
].
id
;
if
(
this
.
btnId
==
''
){
}
else
{
this
.
list
=
data
[
0
].
goodsList
;
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
){
this
.
btnId
=
data
[
0
].
id
;
if
(
this
.
btnId
==
data
[
i
].
id
){
}
else
{
this
.
list
=
data
[
i
].
goodsList
;
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
){
if
(
this
.
btnId
==
data
[
i
].
id
){
this
.
list
=
data
[
i
].
goodsList
;
}
}
}
}
this
.
goodsList
=
this
.
list
;
this
.
total
=
this
.
list
.
length
;
this
.
totalNum
=
this
.
list
.
length
;
}
else
{
this
.
options
=
[];
}
}
})
}
}
else
{
this
.
goodsList
=
this
.
list
;
this
.
$message
.
error
(
'请先绑定店铺机器!'
);
this
.
total
=
this
.
list
.
length
;
this
.
showButton
=
true
;
this
.
totalNum
=
this
.
list
.
length
;
}
else
{
this
.
options
=
[];
}
}
})
})
},
},
// 多选框选中数据
// 多选框选中数据
handleSelectionChange
(
selection
)
{
handleSelectionChange
(
selection
)
{
...
@@ -259,6 +333,9 @@ export default {
...
@@ -259,6 +333,9 @@ export default {
this
.
pageSize
=
this
.
pageSize
;
this
.
pageSize
=
this
.
pageSize
;
this
.
getPageList
();
this
.
getPageList
();
},
},
getSpecList
(
value
){
return
JSON
.
parse
(
value
);
}
}
}
}
}
</
script
>
</
script
>
...
@@ -270,4 +347,4 @@ export default {
...
@@ -270,4 +347,4 @@ export default {
text-align
:
right
;
text-align
:
right
;
}
}
</
style
>
</
style
>
\ No newline at end of file
src/views/shop/shop/setShop.vue
View file @
94de8bc8
...
@@ -39,12 +39,13 @@ export default {
...
@@ -39,12 +39,13 @@ export default {
},
},
watch
:
{
watch
:
{
activeName
(
value
)
{
activeName
(
value
)
{
if
(
value
==
'second'
)
{
if
(
value
==
'second'
)
{
this
.
$refs
.
Machine
.
getList
()
this
.
$refs
.
Machine
.
getList
()
}
}
if
(
value
==
'third'
)
{
if
(
value
==
'third'
)
{
this
.
$refs
.
Commodity
.
btnId
=
''
;
this
.
$refs
.
Commodity
.
btnId
=
''
;
this
.
$refs
.
Commodity
.
getList
()
this
.
$refs
.
Commodity
.
getList
(
1
)
}
}
if
(
value
==
'fourth'
)
{
if
(
value
==
'fourth'
)
{
this
.
$refs
.
Recommend
.
getList
()
this
.
$refs
.
Recommend
.
getList
()
...
...
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