Commit 3af3ebf1 authored by GuanHua's avatar GuanHua

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

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