Commit 8ceb2997 authored by GuanHua's avatar GuanHua

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

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