Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
web
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
web
Commits
2bcecb99
提交
2bcecb99
authored
2月 03, 2024
作者:
ZhangLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:品牌商家列表
上级
398a18be
流水线
#8170
已通过 于阶段
in 5 分 43 秒
变更
5
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
371 行增加
和
1 行删除
+371
-1
mall.ts
src/api/interface/mall.ts
+80
-1
mall.ts
src/api/modules/mall.ts
+10
-0
index.tsx
src/components/home-comp/home-product/index.tsx
+9
-0
_storeProductItem.tsx
src/pages/store/product/comp/_storeProductItem.tsx
+143
-0
index.tsx
src/pages/store/product/index.tsx
+129
-0
没有找到文件。
src/api/interface/mall.ts
浏览文件 @
2bcecb99
import
{
InterDataType
,
InterFunction
}
from
'@/api/interface'
;
import
{
InterDataType
,
InterFunction
,
InterListFunction
,
}
from
'@/api/interface'
;
// 小程序分类信息--含一二级分类
// 小程序分类信息--含一二级分类
export
type
GetAppCategoryInfo
=
InterFunction
<
export
type
GetAppCategoryInfo
=
InterFunction
<
...
@@ -216,3 +220,78 @@ export type LeaseTermInfoType = InterFunction<
...
@@ -216,3 +220,78 @@ export type LeaseTermInfoType = InterFunction<
any
,
any
,
{
id
:
number
;
leaseDate
:
string
}[]
{
id
:
number
;
leaseDate
:
string
}[]
>
;
>
;
// 合作商家列表-根据合作标签id获取
export
type
ListCompanyInfoByCoopIdType
=
InterListFunction
<
{
coopId
?:
number
;
lat
?:
number
;
lon
?:
number
;
// pageNo: number;
// pageSize: number;
},
{
address
:
string
;
brandLogo
:
string
;
brandName
:
string
;
companyName
:
string
;
companyType
:
number
;
companyUserName
:
string
;
content
:
string
;
creditCode
:
string
;
fullName
:
string
;
id
:
number
;
lat
:
number
;
leader
:
number
;
licenseImg
:
string
;
lon
:
number
;
phoneNum
:
number
;
remark
:
string
;
score
:
string
;
userAccountId
:
number
;
backImg
:
string
;
city
:
string
;
distance
:
number
;
district
:
string
;
province
:
string
;
backUserAccountId
:
number
;
}
>
;
// 品牌店铺列表
export
type
BrandStoreListType
=
InterFunction
<
number
[],
{
mallGoodsVOList
:
Array
<
{
categoryPrimaryId
:
number
;
categorySubId
:
number
;
createTime
:
string
;
description
:
string
;
goodsDetails
:
string
;
goodsLabel
:
string
;
id
:
number
;
labelShow
:
number
;
priceStock
:
Array
<
{
channelPrice
:
number
;
id
:
number
;
productSpec
:
string
;
salePrice
:
number
;
skuImage
:
string
;
skuNo
:
string
;
stock
:
number
;
}
>
;
resourcesList
:
Array
<
{
id
:
number
;
type
:
number
;
url
:
string
;
}
>
;
shelfStatus
:
number
;
specAttrList
:
Array
<
{
id
:
number
;
specName
:
string
;
specValuesList
:
Array
<
null
>
;
}
>
;
tradeName
:
string
;
userAccountId
:
number
;
}
>
;
userAccountId
:
number
;
}[]
>
;
src/api/modules/mall.ts
浏览文件 @
2bcecb99
...
@@ -5,6 +5,8 @@ import {
...
@@ -5,6 +5,8 @@ import {
GetCompanyInfoByBUId
,
GetCompanyInfoByBUId
,
LeaseGoodsDetailsType
,
LeaseGoodsDetailsType
,
LeaseTermInfoType
,
LeaseTermInfoType
,
ListCompanyInfoByCoopIdType
,
BrandStoreListType
,
}
from
'@/api/interface/mall'
;
}
from
'@/api/interface/mall'
;
import
request
from
'../request'
;
import
request
from
'../request'
;
...
@@ -32,4 +34,12 @@ export class MallAPI {
...
@@ -32,4 +34,12 @@ export class MallAPI {
// 租赁-商品-租期信息
// 租赁-商品-租期信息
static
getLeaseTermInfo
:
LeaseTermInfoType
=
()
=>
static
getLeaseTermInfo
:
LeaseTermInfoType
=
()
=>
request
.
post
(
'/pms/lease/goods/getLeaseTermInfo'
);
request
.
post
(
'/pms/lease/goods/getLeaseTermInfo'
);
// 合作商家列表-根据合作标签id获取
static
listCompanyInfoByCoopId
:
ListCompanyInfoByCoopIdType
=
(
params
)
=>
request
.
get
(
'/userapp/cooperation/listCompanyInfoByCoopId'
,
{
params
});
// 品牌店铺列表
static
brandStoreList
:
BrandStoreListType
=
(
params
)
=>
request
.
post
(
'/pms/app/goods/brandStoreList'
,
params
);
}
}
src/components/home-comp/home-product/index.tsx
浏览文件 @
2bcecb99
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useDispatch
}
from
'react-redux'
;
import
styled
from
'styled-components'
;
import
styled
from
'styled-components'
;
import
{
HomeAPI
}
from
'@/api'
;
import
{
HomeAPI
}
from
'@/api'
;
import
{
InterDataType
}
from
'@/api/interface'
;
import
{
InterDataType
}
from
'@/api/interface'
;
import
{
RecommendGoodsType
}
from
'@/api/interface/home'
;
import
{
RecommendGoodsType
}
from
'@/api/interface/home'
;
import
{
setGlobalData
}
from
'@/store/module/globalData'
;
// 列表类型
// 列表类型
type
ListType
=
InterDataType
<
RecommendGoodsType
>
;
type
ListType
=
InterDataType
<
RecommendGoodsType
>
;
...
@@ -11,6 +13,8 @@ type ListType = InterDataType<RecommendGoodsType>;
...
@@ -11,6 +13,8 @@ type ListType = InterDataType<RecommendGoodsType>;
const
HomeProductView
=
()
=>
{
const
HomeProductView
=
()
=>
{
// 路由钩子
// 路由钩子
const
router
=
useRouter
();
const
router
=
useRouter
();
// store
const
dispatch
=
useDispatch
();
// 推荐商品列表
// 推荐商品列表
const
[
recommendGoodsList
,
setRecommendGoodsList
]
=
useState
<
const
[
recommendGoodsList
,
setRecommendGoodsList
]
=
useState
<
ListType
[
0
][
'mallGoodsList'
]
ListType
[
0
][
'mallGoodsList'
]
...
@@ -38,6 +42,11 @@ const HomeProductView = () => {
...
@@ -38,6 +42,11 @@ const HomeProductView = () => {
};
};
// 跳转详情
// 跳转详情
const
handleDetail
=
(
item
:
ListType
[
0
][
'mallGoodsList'
][
0
])
=>
{
const
handleDetail
=
(
item
:
ListType
[
0
][
'mallGoodsList'
][
0
])
=>
{
dispatch
(
setGlobalData
({
loadingSpinnerVisible
:
true
,
}),
);
router
.
push
(
`/mall/product/
${
item
.
id
}
`
).
then
();
router
.
push
(
`/mall/product/
${
item
.
id
}
`
).
then
();
};
};
// 组件挂载
// 组件挂载
...
...
src/pages/store/product/comp/_storeProductItem.tsx
0 → 100644
浏览文件 @
2bcecb99
import
React
from
'react'
;
import
{
Button
,
Rate
}
from
'antd'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useDispatch
}
from
'react-redux'
;
import
styled
from
'styled-components'
;
import
{
InterDataType
,
InterListType
}
from
'@/api/interface'
;
import
{
BrandStoreListType
,
ListCompanyInfoByCoopIdType
,
}
from
'@/api/interface/mall'
;
import
{
setGlobalData
}
from
'@/store/module/globalData'
;
// 详情类型
type
DetailType
=
InterListType
<
ListCompanyInfoByCoopIdType
>
[
0
];
// 商品列表
type
StoreType
=
InterDataType
<
BrandStoreListType
>
;
const
StoreProductItem
:
React
.
FC
<
{
detail
:
DetailType
&
{
mallGoodsVOList
:
StoreType
[
0
][
'mallGoodsVOList'
]
};
}
>
=
({
detail
})
=>
{
// 路由钩子
const
router
=
useRouter
();
// store
const
dispatch
=
useDispatch
();
// 跳转商品
const
handleProductDetail
=
(
data
:
StoreType
[
0
][
'mallGoodsVOList'
][
0
])
=>
{
dispatch
(
setGlobalData
({
loadingSpinnerVisible
:
true
,
}),
);
router
.
push
(
`/mall/product/
${
data
?.
id
}
`).then();
};
return (
<StoreProductWrap>
<div className="item-head">
<img
src={`
$
{
detail
?.
brandLogo
||
detail
?.
backImg
}?
x
-
oss
-
process
=
image
/
quality
,
q_25
`}
alt={detail?.companyName}
className="head-img"
/>
<div className="head-content">
<div className="name">{detail?.companyName}</div>
<div className="star">
<Rate
disabled
defaultValue={Number(detail?.score) || 4}
className="text-xs text-primary"
/>
<div className="type">无人机厂家</div>
</div>
</div>
<Button type="primary" shape="round" className="head-action">
进店
</Button>
</div>
<div className="item-media flex w-3/4 flex-wrap items-start justify-start">
{detail?.mallGoodsVOList?.length
? detail?.mallGoodsVOList?.map((i, j) => (
<div
className={'image'}
key={j}
onClick={() => handleProductDetail(i)}
>
<img
className={'img'}
src={`
$
{
i
?.
resourcesList
?.
find
((
v
)
=>
v
.
type
===
0
)
?.
url
}?
x
-
oss
-
process
=
image
/
quality
,
Q_50
`}
alt="图片"
/>
</div>
))
: undefined}
</div>
</StoreProductWrap>
);
};
export default StoreProductItem;
// 样式
const StoreProductWrap = styled.div`
position
:
relative
;
width
:
100
%
;
box
-
sizing
:
border
-
box
;
border
-
bottom
:
0.02
rem
solid
#
e3e3e3
;
padding
:
1
rem
;
.
item
-
head
{
position
:
relative
;
width
:
100
%
;
box
-
sizing
:
border
-
box
;
display
:
flex
;
align
-
items
:
center
;
justify
-
content
:
flex
-
start
;
margin
-
bottom
:
1
rem
;
.
head
-
img
{
width
:
2.5
rem
;
height
:
2.5
rem
;
border
-
radius
:
50
%
;
margin
-
right
:
0.5
rem
;
}
.
head
-
content
{
.
name
{
color
:
#
333
;
font
-
weight
:
bold
;
margin
-
bottom
:
0.25
rem
;
}
.
star
{
display
:
flex
;
align
-
items
:
center
;
justify
-
content
:
flex
-
start
;
.
type
{
margin
-
left
:
1
rem
;
font
-
size
:
10
px
;
color
:
#
999
;
}
}
}
.
head
-
action
{
position
:
absolute
;
top
:
0
;
right
:
0.5
rem
;
}
}
.
item
-
media
{
.
image
{
width
:
calc
((
100
%
-
0.67
rem
*
3
)
/
4
);
height
:
8.6
rem
;
margin
:
0
0.67
rem
0.67
rem
0
;
border
-
radius
:
0.5
rem
;
overflow
:
hidden
;
.
img
{
width
:
100
%
;
height
:
100
%
;
object
-
fit
:
cover
;
}
&
:
nth
-
child
(
4
n
)
{
margin
-
right
:
0
;
}
}
}
`;
src/pages/store/product/index.tsx
0 → 100644
浏览文件 @
2bcecb99
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Empty
,
Segmented
}
from
'antd'
;
import
styled
from
'styled-components'
;
import
{
InterDataType
,
InterListType
,
InterReqType
}
from
'@/api/interface'
;
import
{
BrandStoreListType
,
ListCompanyInfoByCoopIdType
,
}
from
'@/api/interface/mall'
;
import
{
MallAPI
}
from
'@/api/modules/mall'
;
import
LayoutView
from
'@/components/layout'
;
import
ProductListView
from
'@/components/productList'
;
import
StoreProductItem
from
'@/pages/store/product/comp/_storeProductItem'
;
// 列表类型
type
ListType
=
InterListType
<
ListCompanyInfoByCoopIdType
>
;
// 请求类型
type
ReqType
=
InterReqType
<
ListCompanyInfoByCoopIdType
>
;
// 商品列表
type
StoreType
=
InterDataType
<
BrandStoreListType
>
;
// 任务列表筛选
const
actionList
=
[
{
label
:
'综合顺序'
,
value
:
0
,
data
:
{}
},
{
label
:
'销量优先'
,
value
:
1
,
data
:
{}
},
{
label
:
'好评优先'
,
value
:
2
,
data
:
{}
},
];
const
StoreProductListPage
=
()
=>
{
// 分页数据
const
[
pagination
,
setPagination
]
=
useState
({
pageNo
:
1
,
pageSize
:
10
,
totalCount
:
0
,
totalPage
:
0
,
});
// 商家列表
const
[
companyList
,
setCompanyList
]
=
useState
<
Array
<
ListType
[
0
]
&
{
mallGoodsVOList
:
StoreType
[
0
][
'mallGoodsVOList'
]
}
>
>
();
// 获取商家列表
const
getListCompanyInfoByCoopId
=
async
(
data
?:
ReqType
)
=>
{
const
res
=
await
MallAPI
.
listCompanyInfoByCoopId
({
coopId
:
1
,
lat
:
30
,
lon
:
120
,
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
...
data
,
});
if
(
res
&&
res
.
code
===
'200'
)
{
const
{
list
,
pageNo
,
totalPage
,
totalCount
}
=
res
.
result
;
setPagination
({
...
pagination
,
pageNo
,
totalPage
,
totalCount
,
});
// 获取所有店铺的id
const
companyIdList
=
list
?.
map
((
i
)
=>
i
.
backUserAccountId
)
||
[];
// const companyList = [57]
// 如果没有id则不请求
if
(
companyIdList
.
length
<=
0
)
return
;
// 获取店铺商品列表
const
productList
=
await
MallAPI
.
brandStoreList
(
companyIdList
);
// 将商品列表添加到品牌列表中
const
brandList
=
list
?.
map
((
i
)
=>
({
...
i
,
mallGoodsVOList
:
productList
?.
result
?.
find
(
(
n
)
=>
n
.
userAccountId
===
i
.
backUserAccountId
,
)?.
mallGoodsVOList
||
[],
}));
setCompanyList
(
brandList
||
[]);
// // 将科比特提前到第一个
// const kbt = companyBrandList.value?.filter((i) => i.companyName.includes('科比特'))
// const other = companyBrandList.value?.filter((i) => !i.companyName.includes('科比特'))
// // 合并数据
// companyBrandList.value = [...kbt, ...other]
}
};
// 翻页事件
const
handlePageChange
=
async
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
await
getListCompanyInfoByCoopId
({
pageNo
,
pageSize
});
};
// 组件挂载
useEffect
(()
=>
{
getListCompanyInfoByCoopId
().
then
();
},
[]);
return
(
<
LayoutView
contentTitle=
{
'全部品牌'
}
>
<
StoreProductListWrap
>
<
div
className=
"tab"
>
<
Segmented
options=
{
actionList
?.
map
((
i
)
=>
i
?.
label
)
}
size=
"large"
defaultValue=
{
'附近'
}
// onChange={handleSelectAction}
/>
</
div
>
<
ProductListView
pagination=
{
pagination
}
onChange=
{
handlePageChange
}
>
{
companyList
?.
length
?
(
companyList
?.
map
((
i
,
j
)
=>
<
StoreProductItem
key=
{
j
}
detail=
{
i
}
/>)
)
:
(
<
div
className=
"list-empty flex-center"
>
<
Empty
/>
</
div
>
)
}
</
ProductListView
>
</
StoreProductListWrap
>
</
LayoutView
>
);
};
export
default
StoreProductListPage
;
// 样式
const
StoreProductListWrap
=
styled
.
div
`
position: relative;
max-width: 1190px;
box-sizing: border-box;
padding: 1rem 0 0 0;
margin: 0 auto;
.tab {
position: relative;
width: 100%;
display: flex;
justify-content: flex-end;
margin-bottom: 1rem;
}
`
;
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论