Commit 73bc1c7f authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

🐞 fix(物流门户,渠道门户,店铺门户,加工门户): 门户链接选择

parent e11db7f2
......@@ -78,11 +78,7 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
// 根据站点获取商城信息
const fetchAllShop = () => {
const param: any = {
siteId,
type: 3
}
PublicApi.getManageShopFindShopsBySiteId(param).then(res => {
PublicApi.getManageShopFindByDoorType({ doorType: 2 }).then(res => {
if (res.code === 1000) {
setAllMallList(res.data)
}
......@@ -438,7 +434,7 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
<Select allowClear value={shopId} className={styles.form_item} onChange={handleMallSelectChange}>
{
allMallList.map(item => (
<Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
<Select.Option key={item.id} value={item.id} url={item.url}>{item.name}</Select.Option>
))
}
</Select>
......
......@@ -80,11 +80,7 @@ const HandlingInfo: React.FC<HandlingInfoPropsType> = (props) => {
// 根据站点获取商城信息
const fetchAllShop = () => {
const param: any = {
siteId,
type: 8
}
PublicApi.getManageShopFindShopsBySiteId(param).then(res => {
PublicApi.getManageShopFindByDoorType({ doorType: 5 }).then(res => {
if (res.code === 1000) {
setAllMallList(res.data)
}
......@@ -598,7 +594,7 @@ const HandlingInfo: React.FC<HandlingInfoPropsType> = (props) => {
<Select allowClear value={shopId} className={styles.form_item} onChange={handleMallSelectChange}>
{
allMallList.map(item => (
<Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
<Select.Option key={item.id} value={item.id} url={item.url}>{item.name}</Select.Option>
))
}
</Select>
......
......@@ -80,11 +80,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
// 根据站点获取商城信息
const fetchAllShop = () => {
const param: any = {
siteId,
type: 7
}
PublicApi.getManageShopFindShopsBySiteId(param).then(res => {
PublicApi.getManageShopFindByDoorType({doorType: 4}).then(res => {
if (res.code === 1000) {
setAllMallList(res.data)
}
......@@ -542,7 +538,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
<Select allowClear value={shopId} className={styles.form_item} onChange={handleMallSelectChange}>
{
allMallList.map(item => (
<Select.Option key={item.id} value={item.id} url={item.url}>{item.name}</Select.Option>
<Select.Option key={item.id} value={item.id} url={item.url}>{item.name}</Select.Option>
))
}
</Select>
......
......@@ -26,6 +26,8 @@ const defaultCityData = { index: 0, provinceCode: 0, province: '', cityCode: 0,
const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
const { siteUrl, siteId } = props.SiteStore
const [door, setDoor] = useState<string>('');
const [resUrl, setResUrl] = useState<string>('');
const [formIsHalfFilledOut, setFormIsHalfFilledOut] = useState(false)
const [form] = Form.useForm()
const [allMallList, setAllMallList] = useState([])
......@@ -74,11 +76,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
// 根据站点获取商城信息
const fetchAllShop = () => {
const param: any = {
siteId,
type: 1
}
PublicApi.getManageShopFindShopsBySiteId(param).then(res => {
PublicApi.getManageShopFindByDoorType({ doorType: 1 }).then(res => {
if (res.code === 1000) {
setAllMallList(res.data)
}
......@@ -257,62 +255,26 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
})
}
const handleMallSelectChange = (mallId: number) => {
setShopId(mallId)
if (!shopInfo) {
return null
}
if (shopInfo.shopId && shopInfo.memberId) {
const resUrl = getMallItemAndSetUrl(mallId)
setStoreUrl(resUrl)
} else {
setStoreUrl(null)
}
const handleFormValueChange = () => {
setFormIsHalfFilledOut(true)
}
const getMallItemAndSetUrl = (mallId) => {
let result = ""
const mallItem = allMallList.filter(item => item.id === mallId)[0]
if (!mallItem) {
return ""
}
if (mallItem.environment === 1) {
switch (mallItem.type) {
case 1:
result = `${REQUEST_HEADER}${mallItem.url}.${TOP_DOMAIN}/shop/${shopInfo.memberId}_${shopInfo.roleId}`
break
// case 2:
// result = `${REQUEST_HEADER}${mallItem.url}.${TOP_DOMAIN}/shop/${shopInfo.memberId}_${shopInfo.roleId}/integral`
// break
default:
result = ""
break
/** 获取店铺链接 */
const checkUrl = (url) => {
if (url && typeof url === 'string') {
if (url.indexOf('/') === 0) {
return url.replace('/', '').trim()
} else {
return `${url}`.trim()
}
} else {
result = ""
}
return result
}
const handleFormValueChange = () => {
setFormIsHalfFilledOut(true)
}
const getSelectMallStoreUrl = () => {
if (!shopInfo) {
return null
}
if (shopId && shopInfo.memberId) {
const resUrl = getMallItemAndSetUrl(shopId)
return resUrl ? (
<div className={styles.shop_url}>
<span>当前店铺链接:</span>
<label>{resUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(resUrl)} />
</div>
) : null
const handleMallSelectChange = (val, option) => {
setDoor(option.children);
if (option.url) {
checkUrl(option.url) ? setResUrl(`${checkUrl(option.url)}.${siteUrl}`) : setResUrl(`${siteUrl}`)
}
return null
}
return (
......@@ -461,13 +423,17 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
<Select allowClear value={shopId} className={styles.form_item} onChange={handleMallSelectChange}>
{
allMallList.map(item => (
<Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
<Select.Option key={item.id} value={item.id} url={item.url}>{item.name}</Select.Option>
))
}
</Select>
{
getSelectMallStoreUrl()
}
{resUrl && (
<div className={styles.shop_url}>
<span>当前{door}链接:</span>
<label>{resUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(resUrl)} />
</div>
)}
</Form.Item>
<Form.Item
label={<RequireItem label="" />}
......
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