Commit a2bc0d68 authored by GuanHua's avatar GuanHua

fix: 企业商城模板信息接口更换,修复商品详情库存显示问题

parent eca4ffe3
......@@ -53,12 +53,12 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
}, [shopInfo])
const findFirstAdvertsByType = (templateId) => {
let params = {
const params: any = {
templateId,
type: 1,
memberId
}
//@ts-ignore
PublicApi.getTemplateChannelFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
setFirstAdvertList(res.data)
......@@ -67,12 +67,12 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
}
const findSecondAdvertsByType = (templateId) => {
let params = {
const params: any = {
templateId,
type: 2,
memberId
}
//@ts-ignore
PublicApi.getTemplateChannelFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
setSecondAdvertList(res.data)
......@@ -85,9 +85,11 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
const params: any = {
memberId
}
//@ts-ignore
PublicApi.getTemplateChannelFindAllFirstCategory({ memberId }).then(res => {
PublicApi.getTemplateChannelFindAllFirstCategory(params).then(res => {
if (res.code === 1000) {
setCategoryList(res.data)
resolve(res.data)
......@@ -101,13 +103,12 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
*/
const fetchCategoryById = (categoryId, templateId) => {
return new Promise((resolve) => {
let param = {
const param: any = {
templateId: templateId,
categoryId,
memberId
}
// @ts-ignore
PublicApi.getTemplateChannelFindFirstCategoryDetail(param).then(res => {
if(res.code === 1000) {
resolve(res.data)
......@@ -117,11 +118,11 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
}
const getCategoryComponents = async (templateId) => {
let result = []
let firstCategory: any = await fetchFirstCategory()
const result = []
const firstCategory: any = await fetchFirstCategory()
for (let item of firstCategory) {
let categoryDetail: any = await fetchCategoryById(item.id, templateId)
for (const item of firstCategory) {
const categoryDetail: any = await fetchCategoryById(item.id, templateId)
result.push(
<ShopFloorLine
linkUrl={`${GlobalConfig.channelRootRoute}/commodity?channelId=${shopUrlParam}&categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
......
......@@ -709,15 +709,19 @@ const CommodityDetail = (props) => {
}
}
}
if(unitPricePicList.lenght > 0) {
setCurrentPriceRange(sortUnitPrice(unitPricePicList[0].unitPrice))
if(unitPricePicList.length > 0) {
setCurrentPriceRange(sortUnitPrice(unitPricePicList[0].unitPrice))
initStockCount(unitPricePicList)
}
// setStockCount(unitPricePicList[0].stockCount)
setCommodityImgList(tempImgList)
setAttributeList(tempAttrList)
}
/**
* 初始化库存信息 每个规格库存总和
* @param unitPricePicList
*/
const initStockCount = (unitPricePicList: any) => {
if (!unitPricePicList) {
return
......
......@@ -40,7 +40,7 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
templateId: mallTemplateId,
type: 1
}
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
PublicApi.getTemplateAdornWebEnterpriseFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
setFirstAdvertList(res.data)
}
......@@ -52,7 +52,7 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
templateId: mallTemplateId,
type: 2
}
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
PublicApi.getTemplateAdornWebEnterpriseFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
setSecondAdvertList(res.data)
}
......@@ -64,7 +64,7 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
PublicApi.getTemplatePlatformFindAllFirstCategory().then(res => {
PublicApi.getTemplateWebCategoryWebFindAllFirstCategory().then(res => {
if (res.code === 1000) {
setCategoryList(res.data)
resolve(res.data)
......@@ -83,7 +83,7 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
categoryId
}
PublicApi.getTemplatePlatformFindFirstCategoryDetail(param).then(res => {
PublicApi.getTemplateAdornWebEnterpriseCategoryAdorn(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
......
......@@ -58,7 +58,8 @@ const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => {
const params: any = {
templateId: shopInfo.templateId,
type: 2,
memberId
memberId,
roleId: shopInfo.roleId
}
PublicApi.getTemplateShopFindAdvertsByType(params).then(res => {
......
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