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
319a4ac9
Commit
319a4ac9
authored
Aug 21, 2022
by
lixiaomin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改商品配置
parent
bdffa312
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
429 deletions
+11
-429
src/views/goods/goods/components/SpecSetting.vue
+2
-17
src/views/goods/goods/components/Specification.vue
+9
-412
No files found.
src/views/goods/goods/components/SpecSetting.vue
View file @
319a4ac9
<
template
>
<
template
>
<div>
<div>
<el-dialog
title=
"
商品规格机器操作步骤详情
"
:visible
.
sync=
"open"
width=
"1000px"
append-to-body
>
<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
:data=
"special_tb_data"
style=
"width: 100%"
ref=
"special_tb"
@
row-click=
"specal_tb_row_click();"
>
<el-table-column
label=
""
type=
"expand"
>
<el-table-column
label=
""
type=
"expand"
>
...
@@ -60,14 +60,12 @@ export default {
...
@@ -60,14 +60,12 @@ export default {
}
}
},
},
mounted
:
function
(){
mounted
:
function
(){
console
.
log
(
"mounted mach_model_list"
);
this
.
spec_mach_model_list
();
this
.
spec_mach_model_list
();
},
},
methods
:
{
methods
:
{
/**提前将商品信息传入 */
/**提前将商品信息传入 */
setSpecGoods
(
p_goods
){
setSpecGoods
(
p_goods
){
this
.
goods
=
p_goods
;
this
.
goods
=
p_goods
;
console
.
log
(
"pgoods "
,
this
.
goods
);
},
},
findSpecNameById
(
p_specId
){
findSpecNameById
(
p_specId
){
let
specList
=
JSON
.
parse
(
this
.
goods
.
spec
);
let
specList
=
JSON
.
parse
(
this
.
goods
.
spec
);
...
@@ -90,8 +88,6 @@ export default {
...
@@ -90,8 +88,6 @@ export default {
},
},
/**打开规格详情配置,并初始化显示内容 */
/**打开规格详情配置,并初始化显示内容 */
async
showSpecial
(
isShow
,
p_goods
){
async
showSpecial
(
isShow
,
p_goods
){
console
.
log
(
"111 "
);
/** 根据商品获取sku list; 按原型组装数据*/
/** 根据商品获取sku list; 按原型组装数据*/
await
this
.
getSkuByGoodsId
(
this
.
goods
.
id
).
then
((
res
)
=>
{
await
this
.
getSkuByGoodsId
(
this
.
goods
.
id
).
then
((
res
)
=>
{
console
.
log
(
"getSkuByGoodsId response 123"
,
res
);
console
.
log
(
"getSkuByGoodsId response 123"
,
res
);
...
@@ -118,10 +114,6 @@ export default {
...
@@ -118,10 +114,6 @@ export default {
}).
catch
((
res
)
=>
{
}).
catch
((
res
)
=>
{
console
.
log
(
"getSkuByGoodsId 123"
,
res
);
console
.
log
(
"getSkuByGoodsId 123"
,
res
);
});
});
console
.
log
(
"333 "
);
console
.
log
(
"this.skuList "
,
this
.
skuList
);
console
.
log
(
"mach_model_list "
,
this
.
mach_model_list
);
// sku,和机器型号可能的数据放到一个数组里,后续只循环一个数组即可,也为方法抽取提供条件;
// sku,和机器型号可能的数据放到一个数组里,后续只循环一个数组即可,也为方法抽取提供条件;
let
t_special_tb_data
=
[]
let
t_special_tb_data
=
[]
for
(
let
i
=
0
;
i
<
this
.
skuList
.
length
;
i
++
){
for
(
let
i
=
0
;
i
<
this
.
skuList
.
length
;
i
++
){
...
@@ -204,9 +196,6 @@ export default {
...
@@ -204,9 +196,6 @@ export default {
}
}
this
.
special_tb_data
=
t_special_tb_data
;
this
.
special_tb_data
=
t_special_tb_data
;
console
.
log
(
"this.special_tb_data "
,
this
.
special_tb_data
);
console
.
log
(
"666 "
);
//回显历史数据
//回显历史数据
this
.
get_step_data
();
this
.
get_step_data
();
...
@@ -235,11 +224,9 @@ export default {
...
@@ -235,11 +224,9 @@ export default {
getSkuByGoodsId
(
goodsId
){
getSkuByGoodsId
(
goodsId
){
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
list_sku_byGoodsId
(
goodsId
).
then
((
response
)
=>
{
list_sku_byGoodsId
(
goodsId
).
then
((
response
)
=>
{
console
.
log
(
"222 "
);
resolve
(
response
);
resolve
(
response
);
}).
catch
((
response
)
=>
{
}).
catch
((
response
)
=>
{
console
.
log
(
"getSkuByGoodsId error"
,
response
);
console
.
log
(
"222 e"
);
reject
(
response
);
reject
(
response
);
});
});
});
});
...
@@ -249,10 +236,8 @@ export default {
...
@@ -249,10 +236,8 @@ export default {
getStepListByMidAndSkuId
(
p_queryParams
){
getStepListByMidAndSkuId
(
p_queryParams
){
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
list_step
(
p_queryParams
).
then
((
response
)
=>
{
list_step
(
p_queryParams
).
then
((
response
)
=>
{
console
.
log
(
"getStepListByMidAndSkuId 555 "
);
resolve
(
response
);
resolve
(
response
);
}).
catch
((
response
)
=>
{
}).
catch
((
response
)
=>
{
console
.
log
(
"getStepListByMidAndSkuId 555 error"
,
response
);
reject
(
response
);
reject
(
response
);
});
});
});
});
...
...
src/views/goods/goods/components/Specification.vue
View file @
319a4ac9
<
template
>
<
template
>
<div>
<div>
<el-dialog
title=
"规格详情"
:visible
.
sync=
"open"
width=
"1000px"
append-to-body
>
<el-dialog
title=
"规格详情"
:visible
.
sync=
"open"
width=
"1000px"
append-to-body
>
<el-table
:data=
"special_tb_data"
style=
"width: 100%"
ref=
"special_tb"
>
<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=
"scope.row.step_opts"
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
label=
"商品名称"
prop=
"goods_name"
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"商品规格"
prop=
"sku_spec_name"
>
<el-table-column
label=
"商品规格"
prop=
"sku_spec_name"
>
...
@@ -25,9 +10,9 @@
...
@@ -25,9 +10,9 @@
</el-table-column>
</el-table-column>
<el-table-column
label=
"操作"
>
<el-table-column
label=
"操作"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<el-button
v-if=
"spec_ShowBtn('set_sku',scope.row)"
@
click=
"specal_set(scope.row)"
type=
"text"
size=
"small"
>
配置制作步骤
</el-button>
<el-button
@
click=
"specal_set(scope.row)"
type=
"text"
size=
"small"
>
配置制作步骤
</el-button>
<el-button
v-if=
"s
pec_ShowBtn('del_sku',scope.row)"
@
click
.
native
.
prevent
=
"sku_del(scope.row)"
type=
"text"
size=
"small"
>
删除当前sku
</el-button>
<el-button
v-if=
"s
cope.row.sku_isDeleted==0"
@
click
=
"sku_del(scope.row)"
type=
"text"
size=
"small"
>
删除当前sku
</el-button>
<el-button
v-if=
"s
pec_ShowBtn('rec_sku',scope.row)"
@
click
.
native
.
prevent
=
"sku_rec(scope.row)"
type=
"text"
size=
"small"
>
恢复当前sku
</el-button>
<el-button
v-if=
"s
cope.row.sku_isDeleted==2"
@
click
=
"sku_rec(scope.row)"
type=
"text"
size=
"small"
>
恢复当前sku
</el-button>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -40,15 +25,13 @@
...
@@ -40,15 +25,13 @@
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
list_machine_model
,
list_s
tep
,
add_spec_step
,
list_data_spec_step
,
del_spec_step
,
list_s
ku_byGoodsId
,
del_sku_bySkuId
,
rec_sku_bySkuId
}
from
"@/api/system/specification.js"
;
import
{
list_machine_model
,
list_sku_byGoodsId
,
del_sku_bySkuId
,
rec_sku_bySkuId
}
from
"@/api/system/specification.js"
;
import
SpecSetting
from
'./SpecSetting.vue'
;
import
SpecSetting
from
'./SpecSetting.vue'
;
export
default
{
export
default
{
components
:
{
SpecSetting
},
components
:
{
SpecSetting
},
props
:
{
props
:
{
},
},
data
()
{
data
()
{
return
{
return
{
open
:
false
,
open
:
false
,
goods
:{},
goods
:{},
...
@@ -61,14 +44,12 @@ export default {
...
@@ -61,14 +44,12 @@ export default {
}
}
},
},
mounted
:
function
(){
mounted
:
function
(){
console
.
log
(
"mounted mach_model_list"
);
this
.
spec_mach_model_list
();
this
.
spec_mach_model_list
();
},
},
methods
:
{
methods
:
{
/**提前将商品信息传入 */
/**提前将商品信息传入 */
setSpecGoods
(
p_goods
){
setSpecGoods
(
p_goods
){
this
.
goods
=
p_goods
;
this
.
goods
=
p_goods
;
console
.
log
(
"pgoods "
,
this
.
goods
);
},
},
findSpecNameById
(
p_specId
){
findSpecNameById
(
p_specId
){
let
specList
=
JSON
.
parse
(
this
.
goods
.
spec
);
let
specList
=
JSON
.
parse
(
this
.
goods
.
spec
);
...
@@ -91,11 +72,8 @@ export default {
...
@@ -91,11 +72,8 @@ export default {
},
},
/**打开规格详情配置,并初始化显示内容 */
/**打开规格详情配置,并初始化显示内容 */
async
showSpecial
(
isShow
,
p_goods
){
async
showSpecial
(
isShow
,
p_goods
){
console
.
log
(
"111 "
);
/** 根据商品获取sku list; 按原型组装数据*/
/** 根据商品获取sku list; 按原型组装数据*/
await
this
.
getSkuByGoodsId
(
this
.
goods
.
id
).
then
((
res
)
=>
{
await
this
.
getSkuByGoodsId
(
this
.
goods
.
id
).
then
((
res
)
=>
{
console
.
log
(
"getSkuByGoodsId response 123"
,
res
);
let
t_skuList
=
[];
let
t_skuList
=
[];
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
){
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
){
let
sku
=
res
.
data
[
i
];
let
sku
=
res
.
data
[
i
];
...
@@ -122,10 +100,7 @@ export default {
...
@@ -122,10 +100,7 @@ export default {
}
}
this
.
skuList
=
t_skuList
;
this
.
skuList
=
t_skuList
;
});
});
console
.
log
(
"333 "
);
console
.
log
(
"this.skuList "
,
this
.
skuList
);
console
.
log
(
"mach_model_list "
,
this
.
mach_model_list
);
// sku,和机器型号可能的数据放到一个数组里,后续只循环一个数组即可,也为方法抽取提供条件;
// sku,和机器型号可能的数据放到一个数组里,后续只循环一个数组即可,也为方法抽取提供条件;
let
t_special_tb_data
=
[]
let
t_special_tb_data
=
[]
for
(
let
i
=
0
;
i
<
this
.
skuList
.
length
;
i
++
){
for
(
let
i
=
0
;
i
<
this
.
skuList
.
length
;
i
++
){
...
@@ -158,143 +133,11 @@ export default {
...
@@ -158,143 +133,11 @@ export default {
}
}
}
}
this
.
special_tb_data
=
t_special_tb_data
;
this
.
special_tb_data
=
t_special_tb_data
;
console
.
log
(
"this.special_tb_data "
,
this
.
special_tb_data
);
console
.
log
(
"666 "
);
//回显历史数据
//this.get_step_data();
//显示窗体
//显示窗体
this
.
open
=
isShow
this
.
open
=
isShow
},
},
/**打开规格详情配置,并初始化显示内容 */
async
showSpecial_bak
(
isShow
,
p_goods
){
console
.
log
(
"111 "
);
/** 根据商品获取sku list; 按原型组装数据*/
await
this
.
getSkuByGoodsId
(
this
.
goods
.
id
).
then
((
res
)
=>
{
console
.
log
(
"getSkuByGoodsId response 123"
,
res
);
let
t_skuList
=
[];
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
){
let
sku
=
res
.
data
[
i
];
//现在的sku状态字段为isDeleted 有两个值:0-未删除 1-已删除,2-手动删除
//如果状态是(1-已删除)的这里暂不显示
if
(
sku
.
isDeleted
==
1
)
continue
;
let
skuObj_ary
=
[];
let
ruleList
=
JSON
.
parse
(
sku
.
ruleList
);
for
(
let
j
=
0
;
j
<
ruleList
.
length
;
j
++
){
let
sku_spec_Obj
=
{};
let
rule
=
ruleList
[
j
];
let
specName
=
this
.
findSpecNameById
(
rule
.
specId
);
let
spec_RuleName
=
rule
.
name
;
sku_spec_Obj
.
specName
=
specName
;
sku_spec_Obj
.
spec_RuleName
=
spec_RuleName
;
skuObj_ary
.
push
(
sku_spec_Obj
);
}
let
skuObj
=
{};
skuObj
.
sku_id
=
sku
.
id
;
skuObj
.
isDeleted
=
sku
.
isDeleted
;
skuObj
.
skuAry
=
skuObj_ary
;
t_skuList
.
push
(
skuObj
);
}
this
.
skuList
=
t_skuList
;
});
console
.
log
(
"333 "
);
console
.
log
(
"this.skuList "
,
this
.
skuList
);
console
.
log
(
"mach_model_list "
,
this
.
mach_model_list
);
// sku,和机器型号可能的数据放到一个数组里,后续只循环一个数组即可,也为方法抽取提供条件;
let
t_special_tb_data
=
[]
for
(
let
i
=
0
;
i
<
this
.
skuList
.
length
;
i
++
){
let
skuObj
=
this
.
skuList
[
i
];
for
(
let
j
=
0
;
j
<
this
.
mach_model_list
.
length
;
j
++
){
let
mach_mode
=
this
.
mach_model_list
[
j
];
let
tb_data_item
=
{};
tb_data_item
.
mach_mode
=
mach_mode
;
tb_data_item
.
sku
=
skuObj
;
let
strName
=
this
.
buildSkuSpecName
(
skuObj
.
skuAry
);
let
sku_spec_model
=
{
"goods_code"
:
p_goods
.
code
,
"goods_name"
:
p_goods
.
name
,
"sku_id"
:
skuObj
.
sku_id
,
"sku_spec_name"
:
strName
,
"model_name"
:
mach_mode
.
model_name
,
"model_id"
:
mach_mode
.
id
,
"sku_isDeleted"
:
skuObj
.
isDeleted
,
"tb_steps"
:[{
"step_lab"
:
"步骤1"
,
"step_akv"
:[]
}],
"step_opts"
:[]
}
sku_spec_model
.
mach_mode
=
mach_mode
;
sku_spec_model
.
sku
=
skuObj
;
t_special_tb_data
.
push
(
sku_spec_model
);
}
}
/** sku,和机器型号 获取可能的步骤*/
for
(
let
i
=
0
;
i
<
t_special_tb_data
.
length
;
i
++
){
let
spec_sku_item
=
t_special_tb_data
[
i
];
// sku,和机器型号可能的数据;
let
queryParams
=
{
model_id
:
spec_sku_item
.
model_id
,
sku_id
:
spec_sku_item
.
sku_id
}
/**
* 注意!!!
* 可能的操作步骤是根据机器以及sku来获取的,当sku多的时候会循环多次向后台请求
* 当前采用同步方式,会比较慢。
* 先调试完成,再试试异步加载数据是否可行 / 或者如果数据都一样是不是用一份即可!!!
*/
//这个判断是先用一份数据
if
(
this
.
steps
.
length
==
0
){
await
this
.
getStepListByMidAndSkuId
(
queryParams
).
then
((
res
)
=>
{
console
.
log
(
"res"
,
res
);
let
step_opts
=
[];
for
(
let
obj
in
res
.
data
){
//console.log(obj,spec_model.step_list[obj]);
let
step_obj
=
{};
step_obj
=
res
.
data
[
obj
];
step_obj
.
step_key
=
obj
;
step_obj
.
label
=
step_obj
.
risc_desc
step_obj
.
value
=
step_obj
.
risc_id
let
children
=
[];
let
childrenObj
=
{};
let
options
=
JSON
.
parse
(
step_obj
.
options
);
for
(
let
opt
in
options
){
childrenObj
=
{};
childrenObj
.
label
=
opt
;
childrenObj
.
value
=
options
[
opt
];
children
.
push
(
childrenObj
);
}
step_obj
.
children
=
children
step_opts
.
push
(
step_obj
);
}
console
.
log
(
"step_opts"
,
step_opts
);
this
.
steps
=
step_opts
;
});
}
else
{
}
//还是要每个个对象里面加上可选步骤,以后即时改动,也不用调整页面模板,只需要调整js脚本
spec_sku_item
.
step_opts
=
this
.
steps
;
}
this
.
special_tb_data
=
t_special_tb_data
;
console
.
log
(
"this.special_tb_data "
,
this
.
special_tb_data
);
console
.
log
(
"666 "
);
//回显历史数据
this
.
get_step_data
();
//显示窗体
this
.
open
=
isShow
},
closeSpecial
(
tag
){
closeSpecial
(
tag
){
//检查有需要保存的项未提交,则提示是否确定关闭
//检查有需要保存的项未提交,则提示是否确定关闭
//TODO
//TODO
...
@@ -307,114 +150,12 @@ export default {
...
@@ -307,114 +150,12 @@ export default {
getSkuByGoodsId
(
goodsId
){
getSkuByGoodsId
(
goodsId
){
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
list_sku_byGoodsId
(
goodsId
).
then
((
response
)
=>
{
list_sku_byGoodsId
(
goodsId
).
then
((
response
)
=>
{
console
.
log
(
"222 "
);
resolve
(
response
);
}).
catch
((
response
)
=>
{
console
.
log
(
"getSkuByGoodsId error"
,
response
);
console
.
log
(
"222 e"
);
reject
(
response
);
});
});
},
/**可选制作步骤 list 组装数据结构供页面显示,使用同步加载,避免数据回显不正常*/
getStepListByMidAndSkuId
(
p_queryParams
){
return
new
Promise
((
resolve
,
reject
)
=>
{
list_step
(
p_queryParams
).
then
((
response
)
=>
{
console
.
log
(
"getStepListByMidAndSkuId 555 "
);
resolve
(
response
);
resolve
(
response
);
}).
catch
((
response
)
=>
{
}).
catch
((
response
)
=>
{
console
.
log
(
"getStepListByMidAndSkuId 555 error"
,
response
);
reject
(
response
);
reject
(
response
);
});
});
});
});
},
},
/**获取已保存的步骤数据 */
get_step_data
(){
this
.
queryParams
=
{
goods_id
:
this
.
goods
.
id
};
list_data_spec_step
(
this
.
queryParams
).
then
((
response
)
=>
{
this
.
initStepData
(
response
);
}).
catch
((
response
)
=>
{
console
.
log
(
"get_step_data error"
,
response
);
});
},
findSkuById
(
p_skuid
,
p_modelid
){
let
tb_data
=
null
;
for
(
let
i
=
0
;
i
<
this
.
special_tb_data
.
length
;
i
++
){
let
tb_item
=
this
.
special_tb_data
[
i
];
if
(
p_skuid
==
tb_item
.
sku_id
&&
p_modelid
==
tb_item
.
model_id
){
tb_data
=
tb_item
;
break
;
}
}
return
tb_data
;
},
/**初始化已保存的步骤数据 */
initStepData
(
pres
){
console
.
log
(
"initStepData response"
,
pres
);
//将后台返回的已保存的步骤数据初始化到数据结构里
//返回的数据是商品的所有sku的配置,需要循环对应后,把数据初始化;
for
(
let
i
=
0
;
i
<
pres
.
data
.
length
;
i
++
){
let
item
=
pres
.
data
[
i
];
let
tb_data
=
this
.
findSkuById
(
item
.
sku_id
,
item
.
model_id
);
console
.
log
(
"initStepData tb_data"
,
tb_data
);
let
step_data
=
item
.
data
;
console
.
log
(
"initStepData step_data"
,
step_data
);
let
tb_steps
=
tb_data
.
tb_steps
;
console
.
log
(
"initStepData tb_steps"
,
tb_steps
);
//如果返回的步骤有数据,则情况初始化默认的一个步骤,将回显步骤赋值
if
(
step_data
&&
step_data
.
length
>
0
){
tb_steps
=
[];
for
(
let
j
=
0
;
j
<
step_data
.
length
;
j
++
){
let
step_item
=
step_data
[
j
];
let
step_num
=
"步骤"
+
(
j
+
1
);
let
step_akv
=
[];
step_akv
.
push
(
step_item
.
risc_code
);
step_akv
.
push
(
step_item
.
result
);
tb_steps
.
push
({
'step_lab'
:
step_num
,
'step_akv'
:
step_akv
})
}
}
else
{
tb_steps
=
[{
"step_lab"
:
"步骤1"
,
"step_akv"
:[]
}]
}
tb_data
.
tb_steps
=
tb_steps
;
console
.
log
(
"initStepData tb_data.tb_steps 2"
,
tb_data
.
tb_steps
);
}
},
/**列表操作 */
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
);
this
.
spec_step_save
(
prow
);
}
if
(
tag
==
"del"
){
this
.
spec_step_del
(
prow
);
}
},
specal_tb_row_click
(
r
,
c
,
e
){
// this.testPromic(1,2823).then((response) => {
// console.log("xxxx",response);
// console.log("spec_mach_step_list",3)
// });
// console.log("spec_mach_step_list",2)
},
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
(){
spec_mach_model_list
(){
if
(
this
.
mach_model_list
.
length
==
0
){
if
(
this
.
mach_model_list
.
length
==
0
){
...
@@ -424,177 +165,33 @@ export default {
...
@@ -424,177 +165,33 @@ export default {
});
});
}
}
},
},
/**保存步骤 */
spec_step_save
(
prow
){
// {
// "sku_id": 1,
// "risc_id": 1,
// "risc_code": 1,
// "risc_desc": "取杯",
// "turn": 1,
// "model_id": 1,
// "result": 1
// }
let
step_ary
=
[];
for
(
let
i
=
0
;
i
<
prow
.
tb_steps
.
length
;
i
++
){
let
step_obj
=
{}
let
t_step
=
prow
.
tb_steps
[
i
];
//填充对应的值
step_obj
.
sku_id
=
prow
.
sku_id
;
step_obj
.
model_id
=
prow
.
model_id
;
step_obj
=
this
.
fillStepById
(
step_obj
,
t_step
,
prow
);
step_ary
.
push
(
step_obj
);
}
console
.
log
(
"step_ary "
,
step_ary
);
//提交到后台
add_spec_step
(
step_ary
).
then
((
response
)
=>
{
console
.
log
(
"response "
,
response
);
}).
catch
((
response
)
=>
{
console
.
log
(
"error "
,
response
);
});
},
/**删除步骤 */
spec_step_del
(
prow
){
console
.
log
(
"prow "
,
prow
);
this
.
queryParams
=
{
sku_id
:
prow
.
sku_id
,
model_id
:
prow
.
model_id
};
//提交到后台
del_spec_step
(
this
.
queryParams
).
then
((
response
)
=>
{
console
.
log
(
"response del_spec_step"
,
response
);
}).
catch
((
response
)
=>
{
console
.
log
(
"error del_spec_step"
,
response
);
});
},
fillStepById
(
step_obj
,
t_step
,
prow
){
//TODO
console
.
log
(
"step_obj"
,
step_obj
);
console
.
log
(
"t_step"
,
t_step
);
console
.
log
(
"prow"
,
prow
);
let
step_ak
=
t_step
.
step_akv
[
0
];
let
step_av
=
t_step
.
step_akv
[
1
];
step_obj
.
result
=
step_av
;
for
(
let
i
=
0
;
i
<
prow
.
step_opts
.
length
;
i
++
){
let
step_opt
=
prow
.
step_opts
[
i
];
if
(
step_opt
.
value
==
step_ak
){
step_obj
.
risc_id
=
step_opt
.
risc_id
step_obj
.
risc_code
=
step_opt
.
risc_code
step_obj
.
risc_desc
=
step_opt
.
risc_desc
step_obj
.
turn
=
step_opt
.
turn
// for(let j=0;j
<
step_opt
.
children
.
length
;
j
++
){
// if(step_opt.children[j].value == step_av){
// step_obj.result=step_av
// break;
// }
// }
break
;
}
}
return
step_obj
;
},
/**获取可能的步骤 */
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
);
});
},
testPromic
(
model_id
,
sku_id
){
var
param
=
{
model_id
:
model_id
,
sku_id
:
sku_id
};
return
new
Promise
(
function
(
resolve
,
reject
){
list_step
(
param
).
then
((
response
)
=>
{
resolve
(
response
);
});
}
).
then
(
function
(
res
){
return
res
;
}).
catch
(
function
(
cat
){
return
cat
})
},
specal_set
(
skuRow
){
specal_set
(
skuRow
){
console
.
log
(
"specal_set skuRow"
,
skuRow
);
this
.
$refs
.
SpecSetting
.
setSpecGoods
(
this
.
goods
);
this
.
$refs
.
SpecSetting
.
setSpecGoods
(
this
.
goods
);
this
.
$refs
[
'SpecSetting'
].
showSpecial
(
true
,
this
.
goods
);
this
.
$refs
[
'SpecSetting'
].
showSpecial
(
true
,
this
.
goods
);
//this.$parent.setGoodsConfig_skuStep(this.goods);
},
},
/**删除sku*/
/**删除sku*/
sku_del
(
skuRow
){
sku_del
(
skuRow
){
console
.
log
(
"sku_del skuRow"
,
skuRow
);
if
(
this
.
goods
.
state
==
3
){
this
.
$message
.
error
(
"需先下架商品之后才可删除!"
);
return
;
}
this
.
$modal
.
confirm
(
'是否确认删除当前SKU?商品上架后对应SKU将不可用'
).
then
(
function
()
{
this
.
$modal
.
confirm
(
'是否确认删除当前SKU?商品上架后对应SKU将不可用'
).
then
(
function
()
{
return
del_sku_bySkuId
(
skuRow
.
sku_id
);
return
del_sku_bySkuId
(
skuRow
.
sku_id
);
}).
then
(()
=>
{
}).
then
(()
=>
{
this
.
showSpecial
(
true
,
this
.
goods
)
this
.
showSpecial
(
true
,
this
.
goods
)
this
.
$modal
.
msgSuccess
(
"删除成功"
);
this
.
$modal
.
msgSuccess
(
"删除成功"
);
}).
catch
(()
=>
{
});
}).
catch
(()
=>
{
});
// del_sku_bySkuId(skuRow.sku_id).then((response) => {
// console.log("sku_del",response);
// this.showSpecial(true,this.goods)
// }).catch((response) => {
// console.log("del_sku_bySkuId error",response);
// reject(response);
// });
},
},
/**恢复sku*/
/**恢复sku*/
sku_rec
(
skuRow
){
sku_rec
(
skuRow
){
console
.
log
(
"sku_del skuRow"
,
skuRow
);
this
.
$modal
.
confirm
(
'是否确认恢复当前SKU?'
).
then
(
function
()
{
this
.
$modal
.
confirm
(
'是否确认恢复当前SKU?'
).
then
(
function
()
{
return
rec_sku_bySkuId
(
skuRow
.
sku_id
);
return
rec_sku_bySkuId
(
skuRow
.
sku_id
);
}).
then
(()
=>
{
}).
then
(()
=>
{
this
.
showSpecial
(
true
,
this
.
goods
)
this
.
showSpecial
(
true
,
this
.
goods
)
this
.
$modal
.
msgSuccess
(
"恢复成功"
);
this
.
$modal
.
msgSuccess
(
"恢复成功"
);
}).
catch
(()
=>
{
});
}).
catch
(()
=>
{
});
// rec_sku_bySkuId(skuRow.sku_id).then((response) => {
// console.log("sku_rec",response);
// this.showSpecial(true,this.goods)
// }).catch((response) => {
// console.log("sku_rec error",response);
// reject(response);
// });
},
},
spec_ShowBtn
(
btnTag
,
skuRow
){
if
(
btnTag
==
'del_sku'
){
//只有下架的商品 sku才能删除
if
(
this
.
goods
.
state
==
4
){
//如果sku状态是正常的显示删除按钮
if
(
skuRow
.
sku_isDeleted
==
0
){
return
true
;
}
}
return
false
;
}
else
if
(
btnTag
==
'rec_sku'
){
//只有下架的商品 sku才能恢复
if
(
this
.
goods
.
state
==
4
){
//如果sku状态是手动删除的显示恢复按钮
if
(
skuRow
.
sku_isDeleted
==
2
){
return
true
;
}
}
return
false
;
}
else
if
(
btnTag
==
'set_sku'
){
//如果sku状态是手动删除的显示恢复按钮
// if(skuRow.sku_isDeleted==0){
// return true;
// }
// return false;
return
true
;
}
}
}
}
...
...
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