Commit 8ceb2997 authored by GuanHua's avatar GuanHua

fix: 平台首页装修品牌选择问题

parent 933da47a
......@@ -41,7 +41,7 @@ export interface ShopInfo {
describe: string;
state: number;
url: string;
isDefault: number;
isDefault?: any;
}
export interface OrderMode {
......@@ -60,7 +60,7 @@ export interface SiteInfo {
name: string;
logo: string;
siteUrl: string;
symbol: string;
symbol?: any;
}
export interface Site {
......
......@@ -70,7 +70,10 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
PublicApi.getTemplateWebCategoryWebFindAllFirstCategory().then(res => {
const headers: any = {
shopId
}
PublicApi.getTemplateWebCategoryWebFindAllFirstCategory({}, { headers }).then(res => {
if (res.code === 1000) {
resolve(res.data);
} else {
......
......@@ -69,7 +69,10 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
PublicApi.getTemplateWebCategoryWebFindAllFirstCategory().then(res => {
const headers: any = {
shopId
}
PublicApi.getTemplateWebCategoryWebFindAllFirstCategory({}, { headers }).then(res => {
if (res.code === 1000) {
resolve(res.data);
} else {
......
......@@ -9,6 +9,7 @@ export interface BrandItemType {
brandLogo: string,
brandName: string,
describe: string,
shopId: number,
}
interface BrandItemPropsType {
......
......@@ -22,6 +22,7 @@ interface NewSelectItemType {
label: string,
}
const PlatformBrand: React.FC<PlatformGoodsProps> = (props) => {
const { templateId } = props;
const [confirmLoading, setConfirmLoading] = useState<boolean>(false);
......@@ -31,6 +32,7 @@ const PlatformBrand: React.FC<PlatformGoodsProps> = (props) => {
const [selectedRowKeys, setSelectedRowKeys] = useState<number[]>([]);
const [selectedRows, setSelectedRows] = useState<BrandItemType[]>([]);
const [mallSelectList, setMallSelectList] = useState<NewSelectItemType[]>([]);
const [shopId, setShopId] = useState<number>()
const ref = useRef<any>({});
const initMallList = (mallList: any[]) => {
......@@ -45,6 +47,11 @@ const PlatformBrand: React.FC<PlatformGoodsProps> = (props) => {
};
newList.push(tempItem);
}
if (newList && newList.length > 0) {
setShopId(newList[0].value)
}
return newList;
};
......@@ -113,6 +120,9 @@ const PlatformBrand: React.FC<PlatformGoodsProps> = (props) => {
params.templateId = templateId;
const idList = dataList.map((item) => item.brandId);
params.brandIdList = idList || [];
if (params.shopId) {
setShopId(params.shopId)
}
PublicApi.getTemplateAdornWebPlatformFindBrandList(params).then(res => {
const { data } = res;
resolve(data);
......@@ -149,7 +159,8 @@ const PlatformBrand: React.FC<PlatformGoodsProps> = (props) => {
brandId: item.brandId,
brandName: item.brandName,
describe: '',
brandLogo: item.brandLogo
brandLogo: item.brandLogo,
shopId: shopId || 1
});
}
changeNewProps('dataList', [...dataList, ...newList]);
......@@ -255,7 +266,7 @@ const PlatformBrand: React.FC<PlatformGoodsProps> = (props) => {
properties: {
shopId: {
type: 'string',
defaultValue: (mallSelectList && mallSelectList.length > 0) ? mallSelectList[0].value : undefined,
default: (mallSelectList && mallSelectList.length > 0) ? mallSelectList[0].value : undefined,
enum: mallSelectList,
'x-component-props': {
placeholder: '商城',
......
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