Commit 3af3ebf1 authored by GuanHua's avatar GuanHua

fix: 商品列表和详情请求头添加type参数

parent ffcb2060
......@@ -141,7 +141,9 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
}
setLoading(true)
let getFn;
let headers = {}
let headers = {
type: 1
}
switch (layoutType) {
case LAYOUT_TYPE.mall:
getFn = PublicApi.postSearchShopEnterpriseGetCommodityList
......
......@@ -95,6 +95,9 @@ const CommoditySearch: React.FC<CommodityPropsType> = (props) => {
}
setLoading(true)
let getFn;
const headers: { type: number } = {
type: 1
}
switch (layoutType) {
case LAYOUT_TYPE.mall:
getFn = PublicApi.postSearchShopEnterpriseGetCommodityList
......@@ -104,16 +107,18 @@ const CommoditySearch: React.FC<CommodityPropsType> = (props) => {
getFn = PublicApi.postSearchShopStoreGetCommodityList
break
case LAYOUT_TYPE.channel:
headers.type = 3
param.channelMemberId = memberId
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
headers.type = 4
param.channelMemberId = memberId
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
}
getFn && getFn(param).then(res => {
getFn && getFn(param, { headers }).then(res => {
setLoading(false)
if (res.code === 1000) {
message.destroy()
......
......@@ -31,12 +31,15 @@ const Interested: React.FC<InterestedPropsType> = (props) => {
current: 1,
pageSize: 5
}
const headers: any = {}
const headers: any = {
type: 1
}
switch (layoutType) {
case LAYOUT_TYPE.shop:
case LAYOUT_TYPE.mall:
param.storeId = shopInfo.id
if (priceType === COMMODITY_TYPE.integral) {
headers.type = 2
param.priceTypeList = [3]
getFn = PublicApi.postSearchShopScoreGetCommodityList
} else if (priceType === COMMODITY_TYPE.inquiry) {
......
......@@ -124,6 +124,9 @@ const CommodityDetail = (props) => {
switch (layoutType) {
case LAYOUT_TYPE.shop:
param.storeId = shopId
headers = {
type: 1
}
switch (priceType) {
case COMMODITY_TYPE.prompt:
param.priceTypeList = [1]
......@@ -134,6 +137,9 @@ const CommodityDetail = (props) => {
getListFn = PublicApi.postSearchShopStoreGetCommodityList
break
case COMMODITY_TYPE.integral:
headers = {
type: 2
}
param.priceTypeList = [3]
getListFn = PublicApi.postSearchShopScoreGetCommodityList
break
......@@ -219,6 +225,15 @@ const CommodityDetail = (props) => {
getDetailFn = PublicApi.getSearchShopChannelGetCommodityDetail
break
default:
if(type === "3") {
headers = {
type: 2
}
} else {
headers = {
type: 1
}
}
getDetailFn = PublicApi.getSearchShopStoreGetCommodityDetail
break
}
......
......@@ -37,7 +37,7 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
for (const id of categoryIds) {
const resList: any = await getListById(id)
result = [...result, ...resList]
if (result && result.length >= 5) {
if (result && result.length > 0) {
setList(result)
break
}
......@@ -66,24 +66,23 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
pageSize: 5,
customerCategoryId: categoryId,
}
let headers = {}
const headers: { type: number } = {
type: 1
}
let getListFn
switch (layoutType) {
case LAYOUT_TYPE.channel:
headers = {
type: 3
}
headers.type = 3
param.channelMemberId = memberId
getListFn = PublicApi.postSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
headers = {
type: 4
}
headers.type = 4
param.channelMemberId = memberId
getListFn = PublicApi.postSearchShopChannelGetCommodityList
break
default:
headers.type = 1
getListFn = PublicApi.postSearchShopEnterpriseGetCommodityList
break
}
......
......@@ -81,7 +81,9 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
param = Object.assign(param, filterParam)
}
setLoading(true)
let headers = {}
let headers = {
type: 2
}
let getFn
switch (layoutType) {
case LAYOUT_TYPE.channel:
......
......@@ -57,21 +57,20 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
*/
const fetchPurchaseList = () => {
let getFn
let headers = {}
const headers: { type: number} = {
type: 1
}
switch (layoutType) {
case LAYOUT_TYPE.channel:
headers = {
type: 3
}
headers.type = 3
getFn = PublicApi.getSearchShopPurchaseChannelGetPurchaseList
break;
case LAYOUT_TYPE.ichannel:
headers = {
type: 4
}
headers.type = 4
getFn = PublicApi.getSearchShopPurchaseChannelGetPurchaseList
break;
default:
headers.type = 1
getFn = PublicApi.getSearchShopPurchaseGetPurchaseList
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment