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
670c4d03
Commit
670c4d03
authored
Aug 20, 2022
by
赵永成
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spec
parent
e36da6cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
27 deletions
+99
-27
src/api/system/specification.js
+15
-0
src/views/goods/goods/components/Specification.vue
+84
-27
No files found.
src/api/system/specification.js
View file @
670c4d03
...
...
@@ -59,4 +59,18 @@ export function getSpu(id) {
url
:
"/system/goods/"
+
id
,
method
:
"get"
,
});
}
// 删除指定sku
export
function
del_sku_bySkuId
(
id
)
{
return
request
({
url
:
'/system/goods/sku/delete/'
+
id
,
method
:
'get'
})
}
// 恢复指定sku
export
function
rec_sku_bySkuId
(
id
)
{
return
request
({
url
:
'/system/goods/sku/recover/'
+
id
,
method
:
'get'
})
}
\ No newline at end of file
src/views/goods/goods/components/Specification.vue
View file @
670c4d03
...
...
@@ -25,14 +25,9 @@
</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>
<el-button
@
click=
"specal_set(scope.$index,scope.row,'view_step')"
type=
"text"
size=
"small"
>
配置制作步骤
</el-button>
<el-button
@
click
.
native
.
prevent=
"sku_del(scope.$index,scope.row,'save')"
type=
"text"
size=
"small"
>
删除当前sku
</el-button>
<el-button
v-if=
"spec_ShowBtn('set_sku',scope.row)"
@
click=
"specal_set(scope.$index,scope.row,'view_step')"
type=
"text"
size=
"small"
>
配置制作步骤
</el-button>
<el-button
v-if=
"spec_ShowBtn('del_sku',scope.row)"
@
click
.
native
.
prevent=
"sku_del(scope.row)"
type=
"text"
size=
"small"
>
删除当前sku
</el-button>
<el-button
v-if=
"spec_ShowBtn('rec_sku',scope.row)"
@
click
.
native
.
prevent=
"sku_rec(scope.row)"
type=
"text"
size=
"small"
>
恢复当前sku
</el-button>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -44,7 +39,7 @@
</div>
</template>
<
script
>
import
{
list_machine_model
,
list_step
,
add_spec_step
,
list_data_spec_step
,
del_spec_step
,
list_sku_byGoodsId
}
from
"@/api/system/specification.js"
;
import
{
list_machine_model
,
list_step
,
add_spec_step
,
list_data_spec_step
,
del_spec_step
,
list_sku_byGoodsId
,
del_sku_bySkuId
,
rec_sku_bySkuId
}
from
"@/api/system/specification.js"
;
import
{
stringify
}
from
"querystring"
;
export
default
{
props
:
{
...
...
@@ -100,7 +95,11 @@ export default {
console
.
log
(
"getSkuByGoodsId response 123"
,
res
);
let
t_skuList
=
[];
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
){
let
sku
=
res
.
data
[
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
++
){
...
...
@@ -114,6 +113,7 @@ export default {
}
let
skuObj
=
{};
skuObj
.
sku_id
=
sku
.
id
;
skuObj
.
isDeleted
=
sku
.
isDeleted
;
skuObj
.
skuAry
=
skuObj_ary
;
t_skuList
.
push
(
skuObj
);
}
...
...
@@ -140,6 +140,7 @@ export default {
"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"
:[]
...
...
@@ -218,8 +219,7 @@ export default {
},
openSpecial
(
tag
){
this
.
open
=
true
;
},
},
/**获取商品对应的sku list 组装数据结构供页面显示,使用同步加载,避免数据回显不正常*/
getSkuByGoodsId
(
goodsId
){
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -233,7 +233,6 @@ export default {
});
});
},
/**可选制作步骤 list 组装数据结构供页面显示,使用同步加载,避免数据回显不正常*/
getStepListByMidAndSkuId
(
p_queryParams
){
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -246,8 +245,6 @@ export default {
});
});
},
/**获取已保存的步骤数据 */
get_step_data
(){
this
.
queryParams
=
{
goods_id
:
this
.
goods
.
id
};
...
...
@@ -255,9 +252,7 @@ export default {
this
.
initStepData
(
response
);
}).
catch
((
response
)
=>
{
console
.
log
(
"get_step_data error"
,
response
);
});
});
},
findSkuById
(
p_skuid
,
p_modelid
){
let
tb_data
=
null
;
...
...
@@ -294,8 +289,7 @@ export default {
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"
,
...
...
@@ -304,8 +298,7 @@ export default {
}
tb_data
.
tb_steps
=
tb_steps
;
console
.
log
(
"initStepData tb_data.tb_steps 2"
,
tb_data
.
tb_steps
);
}
}
},
/**列表操作 */
specal_opt
(
pindex
,
prow
,
tag
){
...
...
@@ -322,8 +315,7 @@ export default {
if
(
tag
==
"del"
){
this
.
spec_step_del
(
prow
);
}
}
},
specal_tb_row_click
(
r
,
c
,
e
){
// this.testPromic(1,2823).then((response) => {
...
...
@@ -391,7 +383,6 @@ export default {
}).
catch
((
response
)
=>
{
console
.
log
(
"error del_spec_step"
,
response
);
});
},
fillStepById
(
step_obj
,
t_step
,
prow
){
...
...
@@ -445,11 +436,77 @@ export default {
specal_set
(){
},
sku_del
(){
/**删除sku*/
sku_del
(
skuRow
){
console
.
log
(
"sku_del skuRow"
,
skuRow
);
this
.
$modal
.
confirm
(
'是否确认删除当前SKU?商品上架后对应SKU将不可用'
).
then
(
function
()
{
return
del_sku_bySkuId
(
skuRow
.
sku_id
);
}).
then
(()
=>
{
this
.
showSpecial
(
true
,
this
.
goods
)
this
.
$modal
.
msgSuccess
(
"删除成功"
);
}).
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_rec
(
skuRow
){
console
.
log
(
"sku_del skuRow"
,
skuRow
);
this
.
$modal
.
confirm
(
'是否确认恢复当前SKU?'
).
then
(
function
()
{
return
rec_sku_bySkuId
(
skuRow
.
sku_id
);
}).
then
(()
=>
{
this
.
showSpecial
(
true
,
this
.
goods
)
this
.
$modal
.
msgSuccess
(
"恢复成功"
);
}).
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