Commit 1077daac authored by GuanHua's avatar GuanHua

fix: 商品收藏管理再次购买跳转商城链接问题修复

parent 4f7dc6fe
......@@ -20,4 +20,10 @@ const ichannelRootRoute = 'ichannel'
SELF_CONFIG.channelRootRoute = channelRootRoute // 渠道商城路由根路径
SELF_CONFIG.ichannelRootRoute = ichannelRootRoute // 渠道自有商城路由根路径
export const getShopInfoById = (shopId: number) => {
return SELF_CONFIG.web.shopInfo.filter((item) => item.id === shopId)[0]
}
export const GlobalConfig: NewRootObject = SELF_CONFIG
......@@ -4,9 +4,10 @@ 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 { numFormat } from '@/utils/numberFomat'
import moment from 'moment'
import { COMMODITY_TYPE, CHANNEL_CENTER_URL, ENTERPRISE_CENTER_URL } from '@/constants'
import { COMMODITY_TYPE, CHANNEL_CENTER_URL, ENTERPRISE_CENTER_URL, REQUEST_HEADER, TOP_DOMAIN } from '@/constants'
import styles from './index.less'
import { getSearchShopCommodityCollectGetCommodityCollectList, postSearchShopCommodityCollectChannelDeleteCommodityCollectById, postSearchShopCommodityCollectDeleteCommodityCollectById } from '@/services/SearchV2Api';
import { useIntl} from 'umi'
......@@ -42,24 +43,27 @@ const Commodity: React.FC = () => {
const linkToDetail = (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 = `${CHANNEL_CENTER_URL}/m${detail.channelMemberId}/commodity/detail/${detail.commodity.id}`;
el.href = `${mallUrl}/m${detail.channelMemberId}/commodity/detail/${detail.commodity.id}`;
break
case 3:
el.href = `${CHANNEL_CENTER_URL}/m${detail.channelMemberId}/integral/detail/${detail.commodity.id}`;
el.href = `${mallUrl}/m${detail.channelMemberId}/integral/detail/${detail.commodity.id}`;
break
}
} else {
switch (detail.commodity.priceType) {
case 1:
case 2:
el.href = `${ENTERPRISE_CENTER_URL}/shop/${detail.commodity.memberId}_${detail.commodity.memberRoleId}/commodity/detail/${detail.commodity.id}`;
el.href = `${mallUrl}/shop/${detail.commodity.memberId}_${detail.commodity.memberRoleId}/commodity/detail/${detail.commodity.id}`;
break
case 3:
el.href = `${ENTERPRISE_CENTER_URL}/shop/${detail.commodity.memberId}_${detail.commodity.memberRoleId}/integral/detail/${detail.commodity.id}`;
el.href = `${mallUrl}/shop/${detail.commodity.memberId}_${detail.commodity.memberRoleId}/integral/detail/${detail.commodity.id}`;
break
}
}
......
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