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
2e4a2738
Commit
2e4a2738
authored
Jul 30, 2022
by
赵永成
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
specification
parent
5c07148c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
209 additions
and
4 deletions
+209
-4
src/api/system/specification.js
+19
-0
src/views/goods/goods/components/Specification.vue
+173
-0
src/views/goods/goods/index.vue
+17
-4
No files found.
src/api/system/specification.js
0 → 100644
View file @
2e4a2738
import
request
from
"@/utils/request"
;
// 查询机型列表
export
function
list_machine_model
(
query
)
{
return
request
({
url
:
"/v1/machine/model"
,
method
:
"get"
,
params
:
query
,
});
}
// 可选制作步骤
export
function
list_step
(
query
)
{
return
request
({
url
:
"/v1/machine/make/step"
,
method
:
"get"
,
params
:
query
,
});
}
src/views/goods/goods/components/Specification.vue
0 → 100644
View file @
2e4a2738
<
template
>
<div>
<el-dialog
title=
"规格详情"
:visible
.
sync=
"open"
width=
"1000px"
append-to-body
>
<el-table
:data=
"special_tb_data"
style=
"width: 100%"
ref=
"special_tb"
@
row-click=
"specal_tb_row_click();"
>
<el-table-column
label=
""
type=
"expand"
>
<template
slot-scope=
"scope"
>
<el-form
label-position=
"left"
inline
>
<el-row
v-for=
"(step,step_idx) in scope.row.tb_steps"
:key=
step_idx
style=
"margin-top:5px;"
>
<span>
{{
step
.
step_lab
}}
:
</span>
<el-cascader
:options=
"steps"
v-model=
"step.step_akv"
style=
"margin-left:10px"
></el-cascader>
<el-button
@
click
.
prevent=
"spec_add_step(scope.row)"
style=
"margin-left:10px"
>
增加步骤
</el-button>
</el-row>
</el-form>
</
template
>
</el-table-column>
<el-table-column
label=
"商品名称"
prop=
"goods_name"
>
</el-table-column>
<el-table-column
label=
"商品规格"
prop=
"spec_name"
>
</el-table-column>
<el-table-column
label=
"机器型号"
prop=
"model_name"
>
</el-table-column>
<el-table-column
label=
"操作"
>
<
template
slot-scope=
"scope"
>
<el-button
@
click=
"specal_opt(scope.$index,scope.row,'view_step')"
type=
"text"
size=
"small"
>
查看步骤
</el-button>
<el-button
@
click
.
native
.
prevent=
"specal_opt(scope.$index,scope.row,'save')"
type=
"text"
size=
"small"
>
保存
</el-button>
<el-button
@
click
.
native
.
prevent=
"specal_opt(scope.$index,scope.row,'del')"
type=
"text"
size=
"small"
>
删除
</el-button>
<el-button
@
click
.
native
.
prevent=
"specal_opt(scope.$index,scope.row,'restore')"
type=
"text"
size=
"small"
>
恢复
</el-button>
</
template
>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<
script
>
import
{
list_machine_model
,
list_step
}
from
"@/api/system/specification.js"
;
import
{
stringify
}
from
"querystring"
;
export
default
{
props
:
{
},
data
()
{
return
{
open
:
false
,
crowext
:
false
,
special_tb_data
:[],
steps
:[{
"step_key"
:
1
,
"risc_id"
:
1
,
"risc_code"
:
1
,
"risc_desc"
:
"取杯"
,
label
:
"取杯"
,
value
:
1
,
"turn"
:
1
,
"model_id"
:
1
,
"check"
:
"radio"
,
"options"
:
{
"冷杯"
:
1
,
"热杯"
:
2
},
"children"
:[
{
label
:
"冷杯"
,
value
:
1
},{
label
:
"热杯"
,
value
:
2
}]
},{
"step_key"
:
3
,
"risc_id"
:
3
,
"risc_code"
:
3
,
"risc_desc"
:
"加冰"
,
label
:
"加冰"
,
value
:
3
,
"turn"
:
3
,
"model_id"
:
1
,
"check"
:
"radio"
,
"options"
:
{
"冰"
:
86
},
"children"
:[
{
label
:
"冰"
,
value
:
86
}]
}],
queryParams
:{},
mach_model_list
:[]
}
},
mounted
:
function
(){
this
.
spec_mach_model_list
();
},
methods
:
{
/**打卡规格详情配置,并初始化显示内容 */
showSpecial
(
isShow
,
pgoods
){
// 样例
// {
// "goods_code":"G169",
// "goods_name":"青提茉莉",
// "spec_code":"PS239",
// "spec_name":"糖度",
// "model_name":"HY001001",
// "tb_steps":[{
// "step_lab":"步骤1",
// "step_akv":[]
// }]
// }
//商品规格,和机器型号组合
let
spec_str
=
pgoods
.
spec
;
let
spec
=
JSON
.
parse
(
spec_str
);
console
.
log
(
"spec.length"
,
spec
.
length
);
for
(
let
i
=
0
;
i
<
spec
.
length
;
i
++
){
for
(
let
j
=
0
;
j
<
this
.
mach_model_list
.
length
;
j
++
){
let
spec_model
=
{
"goods_code"
:
pgoods
.
code
,
"goods_name"
:
pgoods
.
name
,
"spec_id"
:
spec
[
i
].
id
,
"spec_code"
:
spec
[
i
].
code
,
"spec_name"
:
spec
[
i
].
name
,
"model_name"
:
this
.
mach_model_list
[
j
].
model_name
,
"model_id"
:
this
.
mach_model_list
[
j
].
id
,
"tb_steps"
:[{
"step_lab"
:
"步骤1"
,
"step_akv"
:[]
}]
}
//理论上,初始化时根据规格和型号获取可能的步骤会比较靠谱,省的以后步骤不一样用同一个数据源麻烦;
//this.spec_mach_step_list(spec_model.model_id,spec_model.spec_id);
this
.
spec_mach_step_list
(
spec_model
.
model_id
,
2823
);
this
.
special_tb_data
.
push
(
spec_model
);
}
}
console
.
log
(
this
.
special_tb_data
);
this
.
open
=
isShow
;
},
specal_opt
(
pindex
,
prow
,
tag
){
if
(
tag
==
"view_step"
){
this
.
crowext
=
!
this
.
crowext
;
this
.
$refs
.
special_tb
.
toggleRowExpansion
(
prow
,
this
.
crowext
)
console
.
log
(
"click view step"
);
}
if
(
tag
==
"save"
){
console
.
log
(
"special_tb_data"
,
this
.
special_tb_data
);
}
},
specal_tb_row_click
(
r
,
c
,
e
){
console
.
log
(
r
,
c
,
e
);
},
spec_add_step
(
prow
){
let
step_i
=
prow
.
tb_steps
.
length
+
1
prow
.
tb_steps
.
push
({
"step_lab"
:
"步骤"
+
step_i
,
"step_akv"
:[]
}
);
},
/**获取机型列表 */
spec_mach_model_list
(){
if
(
this
.
mach_model_list
.
length
==
0
){
this
.
queryParams
=
{};
list_machine_model
(
this
.
queryParams
).
then
((
response
)
=>
{
console
.
log
(
"response"
,
response
);
this
.
mach_model_list
=
response
.
data
;
});
}
},
/**获取可能的步骤 */
spec_mach_step_list
(
model_id
,
sku_id
){
this
.
queryParams
=
{
model_id
:
model_id
,
sku_id
:
sku_id
};
list_step
(
this
.
queryParams
).
then
((
response
)
=>
{
console
.
log
(
"response"
,
response
);
console
.
log
(
"spec_mach_step_list"
,
1
)
});
console
.
log
(
"spec_mach_step_list"
,
2
)
}
}
}
</
script
>
\ No newline at end of file
src/views/goods/goods/index.vue
View file @
2e4a2738
...
...
@@ -50,10 +50,17 @@
<el-table-column
label=
"商品分类"
align=
"center"
prop=
"categoryName"
width=
"100"
/>
<el-table-column
label=
"简介"
align=
"center"
prop=
"desc"
width=
"150"
/>
<el-table-column
label=
"售价"
align=
"center"
prop=
"price"
/>
<el-table-column
label=
"总销量"
align=
"center"
prop=
"salesVolume"
width=
"150"
/>
<el-table-column
label=
"总销量"
align=
"center"
prop=
"salesVolume"
width=
"100"
/>
<el-table-column
label=
"规格详情"
align=
"center"
width=
"100"
>
<
template
slot-scope=
"scope"
>
<el-button
@
click
.
native
.
prevent=
"setGoodsConfig(scope.row)"
type=
"text"
size=
"small"
>
配置
</el-button>
</
template
>
</el-table-column>
<el-table-column
label=
"创建时间"
align=
"center"
prop=
"createdAt"
width=
"150"
/>
<el-table-column
label=
"上架时间"
align=
"center"
prop=
"shelfAt"
width=
"150"
/>
<el-table-column
label=
"状态"
align=
"center"
prop=
"state"
width=
"1
5
0"
>
<el-table-column
label=
"状态"
align=
"center"
prop=
"state"
width=
"1
0
0"
>
<
template
slot-scope=
"scope"
>
<span
v-if=
"scope.row.state == 1"
>
已创建
</span>
<span
v-if=
"scope.row.state == 2"
>
已完成编程
</span>
...
...
@@ -62,7 +69,7 @@
<span
v-if=
"scope.row.state == 5"
>
已删除
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
width=
"250"
class-name=
"small-padding fixed-width"
>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<el-button
size=
"mini"
type=
"text"
@
click=
"handleUpdateState(scope.row)"
v-if=
"authBtn(['1'], scope.row.state)"
v-hasPermi=
"['system:goods:finish']"
>
已完成编程
</el-button>
...
...
@@ -81,6 +88,7 @@
<pagination
v-show=
"total > 0"
:total=
"total"
:page
.
sync=
"queryParams.pageNum"
:limit
.
sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<Form
ref=
"Form"
:getList=
"getList"
/>
<Specification
ref=
"Specification"
></Specification>
</div>
</template>
...
...
@@ -90,9 +98,10 @@ import PutShopOffShop from './components/putShopOffShop.vue'
import
Form
from
"./components/Form.vue"
;
import
SelectCategory
from
"@/components/SelectCategory"
;
import
SpecsSelect
from
'../spec/SpecsSelect.vue'
;
import
Specification
from
'./components/Specification.vue'
;
export
default
{
name
:
"Spu"
,
components
:
{
Form
,
PutShopOffShop
,
SelectCategory
,
SpecsSelect
},
components
:
{
Form
,
PutShopOffShop
,
SelectCategory
,
SpecsSelect
,
Specification
},
data
()
{
return
{
// 遮罩层
...
...
@@ -237,6 +246,10 @@ export default {
this
.
getList
()
})
},
setGoodsConfig
(
prow
){
console
.
log
(
"prow"
,
prow
);
this
.
$refs
.
Specification
.
showSpecial
(
true
,
prow
);
}
},
};
...
...
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