Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
welfare
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
达摩4.0重构
welfare
Commits
ae7b542f
Commit
ae7b542f
authored
May 28, 2021
by
caoyanzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复单规格商品保存后库存丢失的bug
parent
5db0caf0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
real-gift-detail.vue
src/views/gift-manage/real-gift-detail.vue
+16
-11
No files found.
src/views/gift-manage/real-gift-detail.vue
View file @
ae7b542f
...
...
@@ -428,7 +428,6 @@ export default {
uploadAction
:
'https://four.gicdev.com/api-marketing/upload/upload-image'
,
// uploadAction: '/welfare/upload/upload-image',
openStorePick
:
0
,
btnLoading
:
false
,
loading
:
false
,
enterpriseName
:
''
,
// 商户名称
handleData
:
{
...
...
@@ -446,6 +445,7 @@ export default {
relationId
:
''
,
// 账号分组relationId
isEcho
:
false
,
// 控制操作人权限是否回显数据
sceneType
:
10
,
// 场景值,现在测试使用,后期提供确定的
singleSkuList
:
[],
// 单规格的商品skuList
};
},
mounted
()
{
...
...
@@ -563,6 +563,7 @@ export default {
let
skuList
=
resResult
.
skuList
||
[];
// 礼品规格值信息
if
(
this
.
goodsStandardInfo
.
length
>
0
){
// 多规格商品
if
(
skuList
.
length
>
1
){
let
arr2
=
[];
for
(
let
key1
in
skuList
){
...
...
@@ -580,6 +581,9 @@ export default {
}
}
else
{
this
.
goodsForm
.
costPrice
=
Number
(
resResult
.
costPrice
).
toFixed
(
2
);
// 单规格商品
// 缓存单规格商品的skuList,为将来保存时提交的数据做准备
this
.
singleSkuList
=
skuList
;
}
let
mapData
=
[];
let
skuSellObj
=
{};
...
...
@@ -627,7 +631,7 @@ export default {
}
else
{
this
.
$message
.
error
(
res
.
message
);
}
}).
finally
(()
=>
this
.
$emit
(
'updateLoading'
));
}).
finally
(()
=>
this
.
$emit
(
'updateLoading'
,
false
));
},
// 上传前
beforeUpload
(
file
)
{
...
...
@@ -1253,7 +1257,6 @@ export default {
},
// 保存
submitForm
(
goodsForm
)
{
if
(
this
.
btnLoading
)
return
;
if
(
this
.
goodsStandardInfo
.
length
>
0
)
{
for
(
let
item
of
this
.
goodsStandardInfo
)
{
if
(
item
.
specId
==
''
)
{
...
...
@@ -1345,10 +1348,16 @@ export default {
}
}
}
else
{
skuList
=
[];
// 编辑单sku商品为单sku时,需要传skuList
// 处理单sku的数据
skuList
=
this
.
singleSkuList
.
map
(
el
=>
{
el
.
stockAlter
=
Math
.
abs
(
this
.
goodsForm
.
stock
-
el
.
totalStock
);
// 库存变动的数量
el
.
stockType
=
this
.
goodsForm
.
stock
>
el
.
totalStock
?
1
:
0
;
// 0:减少库存 1:增加库存
el
.
stock
=
this
.
goodsForm
.
stock
;
return
el
;
});
}
// this.btnLoading = true;
this
.
$emit
(
'updateLoading'
);
let
params
=
{
giftId
:
this
.
giftId
,
giftType
:
1
,
// 实物礼品
...
...
@@ -1375,16 +1384,14 @@ export default {
shopCodeList
:
this
.
diliveryData
.
shopCodeList
,
// 门店CodeList
stockUseType
:
this
.
goodsForm
.
stockUseType
,
// 库存使用类型
};
this
.
btnLoading
=
true
;
console
.
log
(
params
);
this
.
$emit
(
'updateLoading'
);
if
(
this
.
isEdit
)
{
// params.giftId = this.giftId;
giftUpdate
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
'0000'
)
{
this
.
$router
.
push
({
path
:
'/gift-manage/real-gift'
});
this
.
btnLoading
=
false
;
}
else
{
this
.
btnLoading
=
false
;
this
.
$message
.
error
(
res
.
message
);
}
}).
finally
(()
=>
this
.
$emit
(
'updateLoading'
,
false
));
...
...
@@ -1394,9 +1401,7 @@ export default {
if
(
res
.
code
===
'0000'
)
{
this
.
$store
.
commit
(
'updateShowCornerCanUseApp'
,
true
);
this
.
$router
.
push
({
path
:
'/gift-manage/real-gift'
});
this
.
btnLoading
=
false
;
}
else
{
this
.
btnLoading
=
false
;
this
.
$message
.
error
(
res
.
message
);
}
let
callbackId
=
this
.
$route
.
query
.
callbackId
;
...
...
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