Commit c5ffa9e8 authored by GuanHua's avatar GuanHua

fix: 自营商城装修商城id问题

parent e3e08214
......@@ -71,7 +71,7 @@
"@linkseeks/design-core": "^1.0.0",
"@linkseeks/design-react": "^1.0.2",
"@linkseeks/design-react-web": "^1.0.0",
"@linkseeks/design-ui": "^1.0.10",
"@linkseeks/design-ui": "^1.0.11",
"@linkseeks/god": "^1.0.0",
"@linkseeks/umi-plugin-yapi": "1.0.1",
"@turf/turf": "^6.4.0",
......
......@@ -26,7 +26,7 @@ import Loading from '../components/Loading'
import { GlobalConfig } from '@/global/config'
import { getAuth } from '@/utils/auth'
import styles from './index.less'
import { getManageContentInformationFindAllByRecommendLabel } from '@/services/ManageV2Api'
import { getManageContentInformationFindAllByRecommendLabel, postManageWebShopWebAll } from '@/services/ManageV2Api'
import { getSearchShopSelfGetCustomerCategoryTree } from '@/services/SearchV2Api'
import { getTemplateAdornWebSelfFindAdvertsByType, getTemplateAdornWebSelfFindAllFirstCategory, getTemplateAdornWebSelfFindColumn, getTemplateAdornWebSelfMemberCategoryAdorn } from '@/services/TemplateV2Api'
import useBrickAsync from '../hooks/useBrickAsync'
......@@ -42,7 +42,8 @@ interface ShopEditPropsType {
* 模板名称
*/
template: string;
shopId: number
shopId: number,
property: string,
}
}
}
......@@ -50,7 +51,7 @@ interface ShopEditPropsType {
const TemplateList = ['science']
const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
const { query: { id, template, shopId } } = props.location
const { query: { id, template, shopId, property } } = props.location
const [loading, setLoading] = useState<boolean>(true)
const [theme, setTheme] = useState<string>('theme-ownmall-science')
const [componentConfigs, setComponentConfigs] = useState({})
......@@ -176,14 +177,33 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
});
};
const getMemberSelfMallInfo = async () => {
const params = {
siteId: GlobalConfig.global.siteInfo.id,
environment: 1,
type: 1,
hasMemberType: 1,
memberId: memberId,
roleId: memberRoleId,
}
const res = await postManageWebShopWebAll(params)
message.destroy()
if (res.code === 1000 && res.data && Array.isArray(res.data) && res.data.length > 0) {
const selfMall = res.data.filter((item) => item.self === 1 && item.property === Number(property))[0]
if (selfMall) {
return selfMall
}
}
return {}
}
const getComponentsConfig = async () => {
//商城信息
const shopList = GlobalConfig.web.shopInfo
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
// 商城信息
const mallInfo: any = await getMemberSelfMallInfo()
// 导航栏
const navData: any = await getOwnMallNavData();
const mallPath = `${REQUEST_HEADER}${webMallInfo?.url}.${TOP_DOMAIN}`
const mallPath = `${REQUEST_HEADER}${mallInfo?.url}.${TOP_DOMAIN}`
mainNavConfig[mainNavConfig.key].props.menuData = getDefaultMenuData(mallPath, memberId, navData)
mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.shop
mainNavConfig[mainNavConfig.key].props.categoryList = await getCategoryTree()
......@@ -197,8 +217,8 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
// 四号位广告
fourBannerConfig[fourBannerConfig.key].props.advertList = await findAdvertsByType(4)
topBarConfig[topBarConfig.key].props.shopname = webMallInfo?.name
headerConfig[headerConfig.key].props.logoUrl = webMallInfo?.logoUrl
topBarConfig[topBarConfig.key].props.shopname = mallInfo?.name
headerConfig[headerConfig.key].props.logoUrl = mallInfo?.logoUrl
// 行情资讯
InformationConfig[InformationConfig.key].props.newsList = await fetchNewByLabel('4');
......
......@@ -26,7 +26,7 @@ import Loading from '../components/Loading'
import { GlobalConfig } from '@/global/config'
import { getAuth } from '@/utils/auth'
import styles from './index.less'
import { getManageContentInformationFindAllByRecommendLabel } from '@/services/ManageV2Api'
import { getManageContentInformationFindAllByRecommendLabel, postManageWebShopWebAll } from '@/services/ManageV2Api'
import { getSearchShopSelfGetCustomerCategoryTree } from '@/services/SearchV2Api'
import { getTemplateAdornWebSelfFindAdvertsByType, getTemplateAdornWebSelfFindAllFirstCategory, getTemplateAdornWebSelfFindColumn, getTemplateAdornWebSelfMemberCategoryAdorn } from '@/services/TemplateV2Api'
......@@ -41,7 +41,8 @@ interface ShopEditPropsType {
* 模板名称
*/
template: string;
shopId: number
shopId: number,
property: number
}
}
}
......@@ -49,7 +50,7 @@ interface ShopEditPropsType {
const TemplateList = ['science']
const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
const { query: { id, template, shopId } } = props.location
const { query: { id, template, shopId, property } } = props.location
const [loading, setLoading] = useState<boolean>(true)
const [theme, setTheme] = useState<string>('theme-ownmall-science')
const [componentConfigs, setComponentConfigs] = useState({})
......@@ -174,19 +175,34 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
});
};
const getMemberSelfMallInfo = async () => {
const params = {
siteId: GlobalConfig.global.siteInfo.id,
environment: 1,
type: 1,
hasMemberType: 1,
memberId: memberId,
roleId: memberRoleId,
}
const res = await postManageWebShopWebAll(params)
message.destroy()
if (res.code === 1000 && res.data && Array.isArray(res.data) && res.data.length > 0) {
const selfMall = res.data.filter((item) => item.self === 1 && item.property === Number(property))[0]
if (selfMall) {
return selfMall
}
}
return {}
}
const getComponentsConfig = async () => {
// 导航栏
const navData = await getOwnMallNavData();
//商城信息
const shopList = GlobalConfig.web.shopInfo
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
// 商城信息
const mallInfo: any = await getMemberSelfMallInfo()
if(!isEmpty(navData)) {
mainNavConfig[mainNavConfig.key].props.menuData = navData;
} else {
const mallPath = `${REQUEST_HEADER}${webMallInfo?.url}.${TOP_DOMAIN}`
mainNavConfig[mainNavConfig.key].props.menuData = mainNavConfig[mainNavConfig.key].props.menuData = getDefaultMenuData(mallPath, memberId);;
}
// 导航栏
const navData: any = await getOwnMallNavData();
const mallPath = `${REQUEST_HEADER}${mallInfo?.url}.${TOP_DOMAIN}`
mainNavConfig[mainNavConfig.key].props.menuData = getDefaultMenuData(mallPath, memberId, navData)
mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.shop
mainNavConfig[mainNavConfig.key].props.categoryList = await getCategoryTree()
......@@ -199,8 +215,8 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
// 四号位广告
fourBannerConfig[fourBannerConfig.key].props.advertList = await findAdvertsByType(4)
topBarConfig[topBarConfig.key].props.shopname = webMallInfo.name
headerConfig[headerConfig.key].props.logoUrl = webMallInfo.logoUrl
topBarConfig[topBarConfig.key].props.shopname = mallInfo?.name
headerConfig[headerConfig.key].props.logoUrl = mallInfo?.logoUrl
// 行情资讯
InformationConfig[InformationConfig.key].props.newsList = await fetchNewByLabel('4');
......
/*
* @Author: ghua
* @Date: 2021-02-22 17:02:20
* @LastEditTime: 2021-03-01 11:37:34
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-02-16 18:45:16
* @LastEditors: GHua
* @Description: app渠道商城装修
* @FilePath: /lingxi-business-paltform/src/pages/mobileTemplate/channelTemplateEdit/index.tsx
*/
......@@ -56,7 +56,7 @@ import MobileSettingPanel from '../../editor/mobileSettingPanel';
import { getAuth } from '@/utils/auth';
import styles from './index.less';
import { getMarketingAdornActivityGoodsAdorn, getMarketingAdornGoodsListAdorn, postMarketingCouponActivityPageSelectDetail } from '@/services/MarketingV2Api';
import { getManageMemberInformationListAdorn } from '@/services/ManageV2Api';
import { getManageMemberInformationListAdorn, postManageWebShopWebAll } from '@/services/ManageV2Api';
import { getSearchCommodityTemplateGetBrandList, getSearchCommodityTemplateGetFirstCategoryListByMemberId } from '@/services/SearchV2Api';
import { getTemplateAdornAppSelfFind } from '@/services/TemplateV2Api';
import useBrickAsync from '@/pages/editor/hooks/useBrickAsync'
......@@ -75,6 +75,7 @@ interface ShopPreviewPropsType {
type: number;
shopId: number;
environment: number;
property: number,
};
};
}
......@@ -83,7 +84,7 @@ const TemplateList = ['science'];
const OwnMallTempleteEdit: React.FC<ShopPreviewPropsType> = props => {
const {
query: { id, template, type, shopId, environment = 4 },
query: { id, template, shopId, environment = 4, property },
} = props.location;
const [loading, setLoading] = useState<boolean>(true);
const [theme, setTheme] = useState<string>('theme-mall-science');
......@@ -199,16 +200,35 @@ const OwnMallTempleteEdit: React.FC<ShopPreviewPropsType> = props => {
return label
}
const getMemberSelfMallInfo = async () => {
const params = {
siteId: GlobalConfig.global.siteInfo.id,
environment: Number(environment),
type: 1,
hasMemberType: 1,
memberId: memberId,
roleId: memberRoleId,
}
const res = await postManageWebShopWebAll(params)
message.destroy()
if (res.code === 1000 && res.data && Array.isArray(res.data) && res.data.length > 0) {
const selfMall = res.data.filter((item) => item.self === 1 && item.property === Number(property))[0]
if (selfMall) {
return selfMall
}
}
return undefined
}
const getComponentsConfig = async () => {
try {
const appConfig = await getAppConfig();
// 商城信息
const shopList = GlobalConfig.web.shopInfo
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
const mallInfo = await getMemberSelfMallInfo()
const _mallLayoutConfig: any = cloneDeep(channelLayoutConfig);
const allState = {
channelName: webMallInfo?.name,
channelName: mallInfo ? mallInfo.name : '',
categoryList: await getFirstCategoryList(),
navList: appConfig?.navList ? appConfig?.navList.details : [],
advert: appConfig?.advert ? appConfig?.advert.details : [],
......
/*
* @Author: ghua
* @Date: 2021-02-22 17:02:20
* @LastEditTime: 2021-03-01 11:37:34
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-02-16 18:45:23
* @LastEditors: GHua
* @Description: app渠道商城装修
* @FilePath: /lingxi-business-paltform/src/pages/mobileTemplate/channelTemplateEdit/index.tsx
*/
......@@ -55,7 +55,7 @@ import { LAYOUT_TYPE } from '@/constants';
import { getAuth } from '@/utils/auth';
import styles from './index.less';
import { getMarketingAdornActivityGoodsAdorn, getMarketingAdornChannelGoodsListAdorn } from '@/services/MarketingV2Api';
import { getManageContentInformationPage } from '@/services/ManageV2Api';
import { getManageContentInformationPage, postManageWebShopWebAll } from '@/services/ManageV2Api';
import { getSearchCommodityTemplateGetBrandList, getSearchCommodityTemplateGetFirstCategoryListByMemberId } from '@/services/SearchV2Api';
import { getTemplateAdornAppSelfFind } from '@/services/TemplateV2Api';
......@@ -72,6 +72,8 @@ interface ShopPreviewPropsType {
template: string;
type: number;
shopId: number;
environment: number,
property: number,
};
};
}
......@@ -80,7 +82,7 @@ const TemplateList = ['science'];
const OwnMallTempletePreview: React.FC<ShopPreviewPropsType> = props => {
const {
query: { id, template, type, shopId },
query: { id, template, type, shopId, environment, property },
} = props.location;
const [loading, setLoading] = useState<boolean>(true);
const [theme, setTheme] = useState<string>('theme-mall-science');
......@@ -186,16 +188,35 @@ const OwnMallTempletePreview: React.FC<ShopPreviewPropsType> = props => {
return '';
};
const getMemberSelfMallInfo = async () => {
const params = {
siteId: GlobalConfig.global.siteInfo.id,
environment: Number(environment),
type: 1,
hasMemberType: 1,
memberId: memberId,
roleId: memberRoleId,
}
const res = await postManageWebShopWebAll(params)
message.destroy()
if (res.code === 1000 && res.data && Array.isArray(res.data) && res.data.length > 0) {
const selfMall = res.data.filter((item) => item.self === 1 && item.property === Number(property))[0]
if (selfMall) {
return selfMall
}
}
return undefined
}
const getComponentsConfig = async () => {
try {
const appConfig = await getAppConfig();
// 商城信息
const shopList = GlobalConfig.web.shopInfo
const webMallInfo = shopList.filter(item => item.id === Number(shopId))[0]
const mallInfo = await getMemberSelfMallInfo()
const _mallLayoutConfig: any = cloneDeep(channelLayoutConfig);
const allState = {
channelName: webMallInfo?.name,
channelName: mallInfo ? mallInfo.name : '',
categoryList: await getFirstCategoryList(),
navList: appConfig?.navList ? appConfig?.navList.details : [],
advert: appConfig?.advert ? appConfig?.advert.details : [],
......
......@@ -8,6 +8,9 @@ import UseModal from '../components/useModal'
import { Environment_Status } from '@/constants'
import styles from './index.less'
import { getTemplateWebPageTemplateWebFindSelfTemplateDetails, postTemplateWebPageTemplateWebUseSelfTemplate } from '@/services/TemplateV2Api'
import { postManageWebShopWebAll } from '@/services/ManageV2Api'
import { getAuth } from '@/utils/auth'
import { GlobalConfig } from '@/global/config'
interface TemplateDetailPropsType {
location: {
......@@ -24,18 +27,44 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
const [useModalVisible, setUseModalVisible] = useState<boolean>(false)
const [confirmLoading, setConfirmLoading] = useState(false)
const intl = useIntl()
const userInfo = getAuth()
const getMemberShopAll = async (environment: number, property: number) => {
const params = {
siteId: GlobalConfig.global.siteInfo.id,
environment,
type: 1,
hasMemberType: 1,
memberId: userInfo.memberId,
roleId: userInfo.memberRoleId,
}
const res = await postManageWebShopWebAll(params)
message.destroy()
if (res.code === 1000 && res.data && Array.isArray(res.data) && res.data.length > 0) {
console.log(res.data.filter((item) => item.self === 1 && item.property === property), 'selfMalllist')
const selfMall = res.data.filter((item) => item.self === 1 && item.property === property)[0]
if (selfMall) {
return selfMall.id
}
}
}
useEffect(() => {
fetchDetail()
}, [])
const fetchDetail = () => {
const fetchDetail = async () => {
const param: any = {
id
}
getTemplateWebPageTemplateWebFindSelfTemplateDetails(param).then(res => {
getTemplateWebPageTemplateWebFindSelfTemplateDetails(param).then(async (res) => {
if (res.code === 1000) {
setDetailInfo(res.data)
const shopId = await getMemberShopAll(res.data.environment, res.data.property)
setDetailInfo({
...res.data,
selfShopId: shopId,
})
}
})
}
......@@ -62,10 +91,10 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
const handleLinkEdit = () => {
if(detailInfo?.environment === 1) {
// 自营商城装修
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.shopId}`
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${ detailInfo.selfShopId || detailInfo.shopId}&property=${detailInfo?.property}`
} else if(detailInfo?.environment === 4 || detailInfo?.environment === 3 || detailInfo?.environment === 2) {
// 自营商城装修
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/mobile/edit?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.shopId}&environment=${detailInfo?.environment}`
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/mobile/edit?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.selfShopId || detailInfo.shopId}&environment=${detailInfo?.environment}&property=${detailInfo?.property}`
} else {
message.info(intl.formatMessage({ id: 'shop.template.edit.tip' }))
}
......@@ -73,9 +102,9 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
const handleLinkPreview = () => {
if(detailInfo?.environment === 1) {
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.shopId}`
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.selfShopId || detailInfo.shopId}&property=${detailInfo?.property}`
} else if(detailInfo?.environment === 4 || detailInfo?.environment === 3 || detailInfo?.environment === 2) {
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/mobile/preview?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.shopId}&environment=${detailInfo?.environment}`
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/mobile/preview?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.selfShopId || detailInfo.shopId}&environment=${detailInfo?.environment}&property=${detailInfo?.property}`
} else {
message.info(intl.formatMessage({ id: 'shop.template.preview.tip' }))
}
......@@ -86,7 +115,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
message.info(intl.formatMessage({ id: 'shop.template.edit.tip' }))
return
}
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/categoryNavigation?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.shopId}&isSelf=1`
window.location.href = `/memberCenter/ownMallAbility/ownMallManager/template/categoryNavigation?id=${detailInfo.id}&template=${detailInfo.fileName}&shopId=${detailInfo.selfShopId || detailInfo.shopId}&isSelf=1&property=${detailInfo?.property}`
}
return (
......
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