Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
63990eda
Commit
63990eda
authored
May 09, 2024
by
侯体倬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指定商品逻辑优化
parent
8d46dd9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
16 deletions
+29
-16
static/nativeComponents/GoodsList/index.js
+29
-16
No files found.
static/nativeComponents/GoodsList/index.js
View file @
63990eda
...
...
@@ -367,25 +367,36 @@ const componentOptions = {
}
},
async
briefProduct
(
query
)
{
await
goodsApi
.
queryBriefProductInfo
(
query
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
let
data
=
res
.
data
.
data
.
list
;
let
ids
=
data
.
map
(
element
=>
{
let
goodsList
=
this
.
render
?
res
.
data
.
list
:
res
.
data
.
data
.
list
;
return
element
.
terminalProductId
;
});
const
storageIds
=
this
.
getStorageSync
(
'ids'
);
storageIds
[
this
.
data
.
goodsListIndex
]
=
query
.
terminalProductIds
;
this
.
setStorageSync
(
'ids'
,
storageIds
);
const
storageDatasList
=
this
.
getStorageSync
(
'storageDatasList'
);
storageDatasList
[
this
.
data
.
goodsListIndex
]
=
this
.
data
.
datas
.
componentData
;
this
.
setStorageSync
(
'storageDatasList'
,
storageDatasList
);
this
.
moreProduct
(
true
);
// FIXME: 原来逻辑
// await goodsApi.queryBriefProductInfo(query).then(res => {
// if (res.data.code == 200) {
// let data = res.data.data.list;
// let ids = data.map(element => {
// let goodsList = this.render ? res.data.list : res.data.data.list;
// return element.terminalProductId;
// });
let
storageIds
=
this
.
getStorageSync
(
'ids'
)
storageIds
[
this
.
data
.
goodsListIndex
]
=
ids
this
.
setStorageSync
(
'ids'
,
storageIds
)
//
let storageIds = this.getStorageSync('ids')
//
storageIds[this.data.goodsListIndex] = ids
//
this.setStorageSync('ids',storageIds)
let
storageDatasList
=
this
.
getStorageSync
(
'storageDatasList'
)
storageDatasList
[
this
.
data
.
goodsListIndex
]
=
this
.
data
.
datas
.
componentData
this
.
setStorageSync
(
'storageDatasList'
,
storageDatasList
)
//
let storageDatasList = this.getStorageSync('storageDatasList')
//
storageDatasList[this.data.goodsListIndex] = this.data.datas.componentData
//
this.setStorageSync('storageDatasList',storageDatasList)
this
.
moreProduct
(
true
);
}
});
//
this.moreProduct(true);
//
}
//
});
},
async
moreProduct
(
flag
)
{
...
...
@@ -419,6 +430,8 @@ const componentOptions = {
goodsList
=
res
.
data
.
data
;
let
pageGoodsList
=
this
.
data
.
pageGoodsList
[
this
.
data
.
goodsListIndex
]
||
[];
this
.
goodsListVal
(
goodsList
,
1
,
flag
);
}
else
{
this
.
setData
({
scrollLoading
:
false
});
}
});
},
...
...
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