Commit b3192ef1 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 049d4e1f 6ece2210
......@@ -23,7 +23,7 @@ SELF_CONFIG.ichannelRootRoute = ichannelRootRoute // 渠道自有商城路由根
const getSrmdMallId = () => {
const shopInfo = SELF_CONFIG.web.shopInfo
const webMallList = shopInfo.filter((item: any) => item.isDefault === 1 && item.type === 6)
const webMallList = shopInfo.filter((item: any) => item.type === 6)
if (webMallList && webMallList.length > 0) {
const mallItem = webMallList[0]
return mallItem.id
......@@ -31,4 +31,6 @@ const getSrmdMallId = () => {
return undefined
}
SELF_CONFIG.srmMallId = getSrmdMallId()
export const GlobalConfig: GlobalConfigType = SELF_CONFIG
......@@ -526,7 +526,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
name={['activityDefined', 'assembleNum']}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^\+?[1-9]\d*$/;
const pattern = /^0*(?:[2-9]|[1-9]\d\d*)$/;
if (!value) {
return Promise.reject(new Error('请输入成团人数'));
}
......
......@@ -15,7 +15,23 @@ export const getTopDomainByHost = (url: string): string => {
export const TOP_DOMAIN = getTopDomainByHost(siteUrl);
export const getMenuData = (shopId: number) => {
export interface NavItemType {
link: string,
name: string,
status: boolean,
type: number,
}
const getStatusByType = (type: number, list: NavItemType[] | undefined) => {
if (!list) return true
const current = list.filter((item) => item.type === type)[0]
if (current) {
return current.status
}
return true
}
export const getMenuData = (shopId: number, list?: NavItemType[]) => {
const shopInfo = GlobalConfig.web.shopInfo;
const webMallList = shopInfo.filter((item: { id: number}) => item.id === shopId);
......@@ -27,43 +43,49 @@ export const getMenuData = (shopId: number) => {
"id": 0,
"link": `${REQUEST_HEADER}${SUB_DOMAIN}.${TOP_DOMAIN}`,
"name": "商城首页",
"status": true,
"status": getStatusByType(1, list),
"key": "shopHome",
type: 1,
},
{
"id": 1,
"link": `${REQUEST_HEADER}${SUB_DOMAIN}.${TOP_DOMAIN}/commodity`,
"name": "现货商品",
"status": true,
"status": getStatusByType(2, list),
"key": "shopCommodity",
type: 2,
},
{
"id": 2,
"link": `${REQUEST_HEADER}${SUB_DOMAIN}.${TOP_DOMAIN}/inquiry`,
"name": "询价商品",
"status": true,
"status": getStatusByType(3, list),
"key": "purchaseOnline",
type: 3,
},
{
"id": 3,
"link": `${REQUEST_HEADER}${SUB_DOMAIN}.${TOP_DOMAIN}/stores`,
"name": "优选店铺",
"status": true,
"status": getStatusByType(3, list),
"key": "shopPointsMall",
type: 4,
},
{
"id": 4,
"link": `${REQUEST_HEADER}${SUB_DOMAIN}.${TOP_DOMAIN}/integral`,
"name": "积分商城",
"key": "shops",
"status": true,
"status": getStatusByType(5, list),
type: 5,
},
{
"id": 5,
"link": INFO_CENTER_URL,
"name": "行情资讯",
"status": true,
"status": getStatusByType(6, list),
"key": "shopInfomation",
type: 6
},
];
}
......
......@@ -74,7 +74,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
const headers: any = {
shopId
}
getTemplateWebCategoryWebFindAllFirstCategory({ templateId: id }, { headers }).then(res => {
getTemplateWebCategoryWebFindAllFirstCategory({ templateId: String(id) }, { headers }).then(res => {
if (res.code === 1000) {
resolve(res.data);
} else {
......@@ -155,12 +155,8 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
const getComponentsConfig = async () => {
// 导航栏
const navData = await getMallNavData();
if (!isEmpty(navData)) {
mainNavConfig[mainNavConfig.key].props.menuData = navData;
} else {
mainNavConfig[mainNavConfig.key].props.menuData = getMenuData(Number(shopId));
}
const navData: any = await getMallNavData();
mainNavConfig[mainNavConfig.key].props.menuData = getMenuData(Number(shopId), navData);
// mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.mall
// mainNavConfig[mainNavConfig.key].props.categoryList = []
......
......@@ -64,7 +64,8 @@ const MallNav: React.FC<MallNavProps> = (props) => {
return {
name: item.name,
link: item.link,
status: item.status
status: item.status,
type: item.type
};
})
};
......@@ -211,8 +212,7 @@ const MallNav: React.FC<MallNavProps> = (props) => {
</ul>
))
}
</ReactSortable>
</ReactSortable>
</div>
</div>
</div>
......
......@@ -41,8 +41,6 @@ const PropsSettings: React.FC<PropsSettingsPropsType> = (props) => {
const renderDrawerComponent = () => {
const { props: initProps, propsConfig, selectedKey } = selectedInfo || {};
const componentType = propsConfig?.componentType;
console.log(selectedInfo, 'selectedInfo')
console.log(pageConfig, 'pageConfig')
if (componentType) {
switch (componentType.type) {
case PROPS_SETTING_TYPES.goods:
......
......@@ -68,10 +68,11 @@ const ModalLayout: React.FC<ModalProps> = ({
if (payChannel) {
handleChannelFind();
}
}, [payChannel])
}, [payChannel, visible])
const handleCancel = () => {
onCancel()
setFiles({})
form.resetFields()
}
......@@ -81,16 +82,17 @@ const ModalLayout: React.FC<ModalProps> = ({
...res,
key: channel.filter(item => item.code === res.code)[0].key,
})
setFiles({})
form.resetFields();
})
}
useEffect(() => {
if (!isEmpty(value)) {
if (visible) {
form.setFieldsValue({
...value
})
if (value?.code === 14) {
if (value?.code === 14 || value?.code === 41 || value?.code === 42) {
setFiles({
name: value.remark,
url: value.value
......@@ -153,7 +155,7 @@ const ModalLayout: React.FC<ModalProps> = ({
shouldUpdate={(prevValues, curValues) => prevValues.code !== curValues.code}
>
{({ getFieldValue }) =>
getFieldValue('code') === 14 ? (
(getFieldValue('code') === 14 || getFieldValue('code') === 41 || getFieldValue('code') === 42) ? (
<Form.Item name='value' label='退款证书' rules={[{ required: true, message: '请上传退款证书' }]}>
{!isEmpty(files) && (
<div className={style.upload_fileList}>
......
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