Commit 39b9be9e authored by GuanHua's avatar GuanHua

fix: 收藏管理自营商城商品详情链接跳转问题修复

parent f5da3f56
......@@ -12,6 +12,7 @@ import { RootObject } from './global'
interface NewRootObject extends RootObject {
channelRootRoute: string;
ichannelRootRoute: string;
getSelfMallUrl: () => string
}
const channelRootRoute = 'channel'
......@@ -26,4 +27,13 @@ export const getShopInfoById = (shopId: number) => {
}
export const getSelfMallUrl = () => {
const selfMallItem = SELF_CONFIG.web.shopInfo.filter((item) => item.environment === 1
&& item.property === 3
&& item.self === 1
&& item.isDefault === 1
)[0]
return selfMallItem ? selfMallItem?.url : 'own'
}
export const GlobalConfig: NewRootObject = SELF_CONFIG
......@@ -4,13 +4,15 @@ import { Button, message, Modal, Pagination } from 'antd'
import { StarFilled } from '@ant-design/icons'
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ShopCredit from '@/components/ShopCredit'
import { getShopInfoById } from '@/global/config'
import { getShopInfoById, getSelfMallUrl } from '@/global/config'
import { numFormat } from '@/utils/numberFomat'
import moment from 'moment'
import { COMMODITY_TYPE, CHANNEL_CENTER_URL, ENTERPRISE_CENTER_URL, REQUEST_HEADER, TOP_DOMAIN } from '@/constants'
import { COMMODITY_TYPE, REQUEST_HEADER, TOP_DOMAIN } from '@/constants'
import { postManageWebShopWebAll, PostManageWebShopWebAllResponse } from '@/services/ManageV2Api'
import styles from './index.less'
import { getSearchShopCommodityCollectGetCommodityCollectList, postSearchShopCommodityCollectChannelDeleteCommodityCollectById, postSearchShopCommodityCollectDeleteCommodityCollectById } from '@/services/SearchV2Api';
import { useIntl} from 'umi'
import { getAuth } from '@/utils/auth';
const Commodity: React.FC = () => {
const intl = useIntl();
......@@ -40,33 +42,43 @@ const Commodity: React.FC = () => {
})
}
const linkToDetail = (detail) => {
const linkToDetail = async (detail) => {
if (detail.isPublish) {
const el = document.createElement('a')
const shopInfo = getShopInfoById(detail.shopId)
if (!shopInfo) return
const mallUrl = `${REQUEST_HEADER}${shopInfo.url}.${TOP_DOMAIN}`
if (detail.channelMemberId) {
switch (detail.commodity.priceType) {
case 1:
case 2:
el.href = `${mallUrl}/${detail.channelMemberId}/commodity/detail/${detail.commodity.id}`;
break
case 3:
el.href = `${mallUrl}/${detail.channelMemberId}/integral/detail/${detail.commodity.id}`;
break
if (shopInfo) {
const mallUrl = `${REQUEST_HEADER}${shopInfo.url}.${TOP_DOMAIN}`
if (detail.channelMemberId) {
switch (detail.commodity.priceType) {
case 1:
case 2:
el.href = `${mallUrl}/${detail.channelMemberId}/commodity/detail/${detail.commodity.id}`;
break
case 3:
el.href = `${mallUrl}/${detail.channelMemberId}/integral/detail/${detail.commodity.id}`;
break
}
} else {
switch (detail.commodity.priceType) {
case 1:
case 2:
el.href = `${mallUrl}/shop/${detail.commodity.memberId}_${detail.commodity.memberRoleId}/commodity/detail/${detail.commodity.id}`;
break
case 3:
el.href = `${mallUrl}/shop/${detail.commodity.memberId}_${detail.commodity.memberRoleId}/integral/detail/${detail.commodity.id}`;
break
}
}
} else {
switch (detail.commodity.priceType) {
case 1:
case 2:
el.href = `${mallUrl}/shop/${detail.commodity.memberId}_${detail.commodity.memberRoleId}/commodity/detail/${detail.commodity.id}`;
break
case 3:
el.href = `${mallUrl}/shop/${detail.commodity.memberId}_${detail.commodity.memberRoleId}/integral/detail/${detail.commodity.id}`;
break
const selfMallUrl = getSelfMallUrl()
if (selfMallUrl) {
const url = `${REQUEST_HEADER}${selfMallUrl}.${TOP_DOMAIN}`
el.href = `${url}/${detail.commodity.memberId}/commodity/detail/${detail.commodity.id}`;
} else {
return
}
}
el.target = '_blank';
el.id = detail.commodity.id
// 防止反复添加
......
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