Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
xianyu-ufo-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
shuaiguo
5 years ago
Commit
ffb6886df5767a27824776c073766cecf42ead66
1 parent
1e449073
feat(商品详情): 出售限制提示
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
4 deletions
apps/common/create-api-server.js
apps/pages/product/product-detail.vue
apps/store/product/actions.js
config/product-api-map.js
apps/common/create-api-server.js
View file @
ffb6886
...
...
@@ -107,6 +107,7 @@ export const createApi = (context, store) => {
.
then
(
resolve
({
context
,
store
,
reqParams
}))
.
catch
(
err
=>
{
console
.
log
(
'----create----api--server--get---'
,
err
);
return
err
;
});
},
post
(
url
,
reqParams
=
{})
{
...
...
@@ -119,6 +120,7 @@ export const createApi = (context, store) => {
.
then
(
resolve
({
context
,
store
,
reqParams
}))
.
catch
(
err
=>
{
console
.
log
(
'----create----api--server--post---'
,
err
);
return
err
;
});
},
};
...
...
apps/pages/product/product-detail.vue
View file @
ffb6886
...
...
@@ -547,6 +547,17 @@ export default {
return;
}
// 商品是否指定出售
const limitInfo = get(this.productDetail, 'limitInfo', {});
if(limitInfo.isLimit === '1') {
this.$createDialog({
type: "alert",
title: "商品出售限制",
content: limitInfo.tip || '',
confirmBtn: { text: "我知道了" }
}).show();
return;
}
/**
* 数据埋点
* 商品详情页点击出售/购买/求购按钮
...
...
apps/store/product/actions.js
View file @
ffb6886
...
...
@@ -8,7 +8,7 @@ export default {
return
state
.
products
[
productId
];
},
async
fetchProductInfo
({
commit
,
state
},
{
productId
})
{
const
queryTasks
=
[
''
,
'/resource'
,
'/activity'
,
'/recommend'
].
map
(
path
=>
{
const
queryTasks
=
[
''
,
'/resource'
,
'/activity'
,
'/recommend'
,
'/limit/info'
].
map
(
path
=>
{
let
params
=
{
product_id
:
productId
};
if
(
path
===
'/resource'
)
{
...
...
@@ -25,14 +25,16 @@ export default {
});
});
let
[
detail
,
resource
,
activity
,
recommend
]
=
await
Promise
.
all
(
queryTasks
);
let
[
detail
,
resource
,
activity
,
recommend
,
limitInfo
]
=
await
Promise
.
all
(
queryTasks
);
resource
=
get
(
resource
,
'[0].data[0]'
,
{});
commit
(
Types
.
UPDATE_PRODUCT_DETAIL
,
Object
.
assign
(
detail
.
product_info
,
{
const
{
product_info
=
{}}
=
detail
||
{};
commit
(
Types
.
UPDATE_PRODUCT_DETAIL
,
Object
.
assign
(
product_info
,
{
resource
,
activity
:
activity
||
[],
recommend
:
recommend
&&
recommend
.
product_list
||
[],
limitInfo
:
limitInfo
||
{}
}));
},
async
fetchRecommendProduct
({
commit
},
{
productId
})
{
...
...
config/product-api-map.js
View file @
ffb6886
...
...
@@ -124,4 +124,14 @@ module.exports = {
skup
:
{
type
:
Number
},
},
},
// 商品限制信息查询
'/api/ufo/product/limit/info'
:
{
ufo
:
true
,
auth
:
true
,
api
:
'ufo.product.limitInfo'
,
params
:
{
product_id
:
{
type
:
Number
},
// 商品id
},
},
};
...
...
Please
register
or
login
to post a comment