Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
user
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
mp
user
Commits
dfe5c97c
Commit
dfe5c97c
authored
Jun 22, 2022
by
宋冰琦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改首页加购逻辑
parent
2837aad0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
menuSubPackage/pages/goodsDetail/goodsDetail.vue
+9
-2
pages/menu/menu.vue
+7
-5
No files found.
menuSubPackage/pages/goodsDetail/goodsDetail.vue
View file @
dfe5c97c
...
...
@@ -135,7 +135,7 @@ export default {
uni
.
removeStorageSync
(
'goodsList'
);
const
goodsInfo
=
JSON
.
parse
(
uni
.
getStorageSync
(
'goodsInfo'
));
this
.
goodInfo
=
goodsInfo
;
console
.
log
(
this
.
goodInfo
);
console
.
log
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
goodInfo
))
);
const
skus
=
goodsInfo
.
skus
;
if
(
skus
)
{
const
sku
=
skus
.
find
(
v
=>
v
.
isDefault
==
1
&&
v
.
state
==
1
)
||
skus
.
find
(
v
=>
v
.
isDefault
==
0
&&
v
.
state
==
1
);
...
...
@@ -274,7 +274,14 @@ export default {
}
const
{
goods
}
=
this
;
const
{
data
}
=
await
Order
.
checkSku
({
skuId
:
goods
.
skuId
})
if
(
data
.
data
&&
data
.
data
.
state
===
2
){
const
{
state
,
goods
:
newgoods
}
=
data
.
data
const
newInfo
=
JSON
.
parse
(
JSON
.
stringify
(
newgoods
))
newInfo
.
skus
.
map
(
res
=>
res
.
state
=
2
)
this
.
goodInfo
=
{...
newInfo
}
console
.
log
(
this
.
goodInfo
)
if
(
state
==
1
){
this
.
showToast
({
title
:
'本商品已经售罄'
,
icon
:
'none'
});
return
;
}
else
{
...
...
pages/menu/menu.vue
View file @
dfe5c97c
...
...
@@ -265,16 +265,18 @@ export default {
let
itemCopy
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
const
sku
=
itemCopy
.
skus
.
find
(
v
=>
v
.
isDefault
==
1
&&
v
.
state
!=
2
)
||
itemCopy
.
skus
.
find
(
v
=>
v
.
isDefault
==
0
&&
v
.
state
!=
2
);
const
{
data
}
=
await
Order
.
checkSku
({
skuId
:
sku
.
skuId
})
if
(
data
.
data
&&
data
.
data
.
state
===
2
){
const
{
goods
}
=
data
.
data
const
newsku
=
goods
.
skus
.
find
(
v
=>
v
.
isDefault
==
1
&&
v
.
state
!=
2
)
||
goods
.
skus
.
find
(
v
=>
v
.
isDefault
==
0
&&
v
.
state
!=
2
);
if
(
!
newsku
){
this
.
showToast
({
title
:
'本商品已经售罄'
,
icon
:
'none'
});
return
;
}
else
{
if
(
sku
.
isDefault
!=
1
){
if
(
new
sku
.
isDefault
!=
1
){
this
.
showToast
({
title
:
'默认规格已售罄,已添加其他规格'
,
icon
:
'none'
});
}
itemCopy
.
skus
=
[
sku
];
itemCopy
.
sku
=
sku
itemCopy
.
skuId
=
sku
?.
skuId
itemCopy
.
skus
=
[
new
sku
];
itemCopy
.
sku
=
new
sku
itemCopy
.
skuId
=
new
sku
?.
skuId
itemCopy
.
num
=
1
;
itemCopy
.
flag
=
true
;
itemCopy
.
categoryId
=
category
.
id
;
...
...
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