Commit 240c84e8 authored by Bill's avatar Bill

Merge branch 'v2' of 10.0.0.22:lingxi/lingxi-business-system into v2

parents f161c026 72794fa7
......@@ -16,7 +16,7 @@
// import demandQuoteOrderRoute from './demandQuoteOrderRoute' //需求报价单管理
// import logisticsRoutes from './logisticsRoutes'
// import memberAbility from './memberAbility'
import ruleSettingRoutes from './ruleSettingRoutes'
// import ruleSettingRoutes from './ruleSettingRoutes'
// import authConfig from './authConfig'
// import rfqRoute from './rfqRoute' // 询价单路由
// import rfqOfferRoute from './rfqOfferRoute' // 询价单路由
......@@ -109,7 +109,7 @@ const router = [
// ...routeList,
// merchantMarketingRoute,
// ruleSettingRoutes,
// marketingRoutes,
marketingRoutes,
// platformCouponManageRoute,
...asyncRoutes,
// purchaseBidRoute,
......
......@@ -26,6 +26,15 @@ const marketingRoutes = {
component: '@/pages/marketing/waitAddedMarketing',
},
{
/** 待新增平台营销活动 - preview */
path: '/marketing/waitAddedMarketing/preview',
name: '待新增平台营销活动详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketing/detail',
},
{
/** 新增平台营销活动 - add */
path: '/marketing/waitAddedMarketing/add',
name: '新增平台营销活动',
......@@ -49,6 +58,24 @@ const marketingRoutes = {
component: '@/pages/marketing/waitAuditApply',
},
{
/** 待审核报名 - preview */
path: '/marketing/waitAuditApply/preview',
name: '待审核报名详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketing/detail',
},
{
/** 待审核报名 - detail */
path: '/marketing/waitAuditApply/detail',
name: '待审核报名详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketing/detail',
},
{
/** 待提交审核平台营销活动 - waitSubmitMarketing */
path: '/marketing/waitSubmitMarketing',
name: '待提交审核平台营销活动',
......
......@@ -39,8 +39,9 @@ const router = {
{
path: '/ruleSettingManager/paySetting',
name: 'paySetting',
component: '@/pages/ruleSettingManage/paySetting/settingIndex',
hidePageHeader: true
component: '@/pages/ruleSettingManage/paySetting',
hidePageHeader: true,
noMargin: true,
},
{
path: '/ruleSettingManager/transactionRules',
......
/** 详情通用 - 基本信息 */
import React from 'react';
import { Row, Col } from 'antd';
import Card from '../../../card';
import Card from '../../../Card';
import style from './index.less';
export interface BasicInfoProps {
......
......@@ -13,6 +13,8 @@ export type tabLink = {
}
export interface IProps {
/** 返回按钮 */
onBack?: boolean,
/** 单号 */
no?: string | React.ReactNode,
/** 详情描述 */
......@@ -29,6 +31,7 @@ export interface IProps {
const PeripheralLayout: React.FC<IProps> = (props: any) => {
const {
onBack,
no,
detail,
tabLink,
......@@ -71,7 +74,7 @@ const PeripheralLayout: React.FC<IProps> = (props: any) => {
<div style={{ flex: 1 }}>
<div className={style.title}>
<div className={style.titleBox}>
<ArrowLeftOutlined className={style.goBack} onClick={() => history.goBack()} />
{!onBack && <ArrowLeftOutlined className={style.goBack} onClick={() => history.goBack()} />}
<span className={style.titleContext}>
{detail ? detail : dataSource.details}
&nbsp;{!hideBreak && '|'}&nbsp;
......
......@@ -14,7 +14,7 @@ export interface IProps {
title: string,
visible: boolean,
id: number,
modalType: 'audit' | 'abandon',
modalType: 'audit' | 'abandon' | 'merkeingAudit',
onCancel?: () => void,
onOk?: () => void,
fetch?: () => Promise<unknown>,
......@@ -44,6 +44,17 @@ const ModalOperate: React.FC<IProps> = (props: any) => {
})
})
}
if (modalType === 'merkeingAudit') {
onFieldChange$('isPass').subscribe(({ value }) => {
setFieldState('opinion', state => {
if (value == 1) {
state.visible = false
} else {
state.visible = true
}
})
})
}
}
const disabledDate = (current) => {
......@@ -62,29 +73,48 @@ const ModalOperate: React.FC<IProps> = (props: any) => {
required
x-component="Radio"
x-component-props={{}}
/> :
<Field
title="作废时间"
name="reasonTime"
required
x-component="DatePicker"
x-component-props={{
format: 'YYYY-MM-DD HH:mm:ss',
disabledDate,
}}
/>
/> : modalType === 'merkeingAudit' ?
<Field
enum={
[
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 }
]}
name='isPass'
required
x-component="Radio"
x-component-props={{}}
/>
:
<Field
title="作废时间"
name="reasonTime"
required
x-component="DatePicker"
x-component-props={{
format: 'YYYY-MM-DD HH:mm:ss',
disabledDate,
}}
/>
const handleSubmit = (val: any) => {
let value = { ...val }
let params: any = {}
if (modalType === 'audit') {
params.id = id;
params.state = value.state;
value.state !== 1 && (params.auditOpinion = value.auditOpinion);
} else if (modalType === 'merkeingAudit') {
params.signUpId = id,
params.isPass = value.isPass;
params.opinion = value.opinion;
} else {
params.id = id;
params.reason = value.reason
params.reasonTime = new Date(value.reasonTime).getTime();
}
fetch({id, ...params}).then(res => {
fetch({ ...params }).then(res => {
if (res.code === 1000) {
onOk()
}
......@@ -118,13 +148,14 @@ const ModalOperate: React.FC<IProps> = (props: any) => {
effects={() => useFormEffects()}
onSubmit={(values) => handleSubmit(values)}
initialValues={{
state: 1
state: 1,
isPass: 1,
}}
>
{modalNode}
<Field
title={modalText}
name={modalType === 'audit' ? 'auditOpinion' : 'reason'}
name={modalType === 'audit' ? 'auditOpinion' : modalType === 'merkeingAudit' ? 'opinion' : 'reason'}
x-component="TextArea"
required
x-component-props={{
......
import React, { Fragment, useCallback, useMemo, useState } from 'react';
import { Button } from 'antd';
import { history } from 'umi';
import { Context } from '@/components/detailLayout/components/context';
import PeripheralLayout from '@/components/detailLayout';
import { Context } from '@/components/DetailLayout/components/context';
import PeripheralLayout from '@/components/DetailLayout';
import { _data } from './data';
import ProgressLayout from '@/components/detailLayout/components/progressLayout';
import GeneralLayout from '@/components/detailLayout/components/generalLayout';
import RecordLyout from '@/components/detailLayout/components/recordLyout';
import BasicLayout from '@/components/detailLayout/components/basicLayout';
import ProgressLayout from '@/components/DetailLayout/components/progressLayout';
import GeneralLayout from '@/components/DetailLayout/components/generalLayout';
import RecordLyout from '@/components/DetailLayout/components/recordLyout';
import BasicLayout from '@/components/DetailLayout/components/basicLayout';
import moment from 'moment';
import { useEffect } from 'react';
import { ACTIVITYTYPENAME, GeneralEffect } from './constants';
import ActivityUserLayout from '../components/activityUserLayout';
import DemandLayout from '../components/demandLayout';
import ListLayout from '@/components/detailLayout/components/listLayout';
import ListLayout from '@/components/DetailLayout/components/listLayout';
import { Columns } from './columns';
import { PublicApi } from '@/services/api';
import { isEmpty } from 'lodash';
import { CheckCircleOutlined } from '@ant-design/icons';
import ModalOperate from '@/pages/demand/components/modalOperate';
const TABLINK = [
{ id: 'progressLayout', title: '流转进度' },
......@@ -156,10 +157,20 @@ const DetialLayout = () => {
return Columns(dataSource.activityType || 1)
}, [dataSource.activityType])
const fetchLink = () => {
let fetchSoure: any = null;
switch (pathPci) {
case 'waitAuditApply':
fetchSoure = PublicApi.postMarketingPlatformActivityExamineSignUp
break;
}
return fetchSoure
}
return (
<Context.Provider value={dataSource}>
<PeripheralLayout
no={dataSource.activityId}
no={dataSource.id}
detail={dataSource.activityName}
tabLink={TABLINK}
effect={
......@@ -188,8 +199,8 @@ const DetialLayout = () => {
/>
<ListLayout
anchor="activityProductLayout"
done
data={[]}
fetch={PublicApi.getMarketingPlatformActivityDetailGoodsPage}
ids={{activityId: id}}
title="活动商品"
columns={columns}
/>
......@@ -199,6 +210,16 @@ const DetialLayout = () => {
</Fragment>
}
/>
{/* 审核 */}
<ModalOperate
id={signUpId}
title="单据审核"
modalType="merkeingAudit"
visible={visible}
fetch={fetchLink()}
onCancel={() => setVisible(false)}
onOk={() => history.goBack()}
/>
</Context.Provider>
)
}
......
......@@ -143,12 +143,18 @@ export const LADDERBOLIST = (int, type=1) => {
tooltip: type === 1 ? '优惠金额为最后订单总额减去的优惠金额' : '折扣为最后订单总额的折扣,输入数字,如85折,输入85,9折输入90',
label: `满量${type ===1 ? '减' : '折'}`,
message: `请新增满量${type ===1 ? '减' : '折'}`,
addon: '数量' ,
addonAfter: type === 1 ? '减' : '打',
addonBefore: type === 1 ? '元' : '折',
}
case 5:
return {
tooltip: type === 1 ? '优惠金额为最后订单总额减去的优惠金额' : '折扣为最后订单总额的折扣,输入数字,如85折,输入85,9折输入90',
label: `满额${type ===1 ? '减' : '折'}`,
message: `请新增满额${type ===1 ? '减' : '折'}`,
addon: '元' ,
addonAfter: type === 1 ? '减' : '打',
addonBefore: type === 1 ? '元' : '折',
}
case 7:
return {
......
......@@ -17,7 +17,13 @@ interface RulesLayoutProps {
const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
const { option, form } = props;
const [data, setData] = useState<any>({});
console.log(data)
const [ladderType, setLadderType] = useState<number>(1)
const handleActivityDefinedBO = (e) => {
const { value } = e.target
setLadderType(Number(value));
}
/** 叠加活动类型 */
const allowActivity = (int) => {
switch (int) {
......@@ -121,8 +127,9 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
label={PROMOTIONTYPE(int)?.label}
rules={[{ required: true, message: PROMOTIONTYPE(int)?.message }]}
className={style.rulesLayout}
initialValue={1}
>
<Radio.Group>
<Radio.Group onChange={handleActivityDefinedBO}>
{PROMOTIONTYPE(int)?.radio.map(item => (
<Radio.Button key={item.value} value={item.value}>{item.label}</Radio.Button>
))}
......@@ -191,7 +198,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
}
}
/** 满量/额减 */
const ladderBOList = (int, type = 1) => {
const ladderBOList = (int, type) => {
switch (int) {
/** 满量促销 */
case 4:
......@@ -205,9 +212,8 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
rules={[
{
validator: async (_, ladderBOList) => {
console.log(ladderBOList, 10086)
if (!ladderBOList || isEmpty(ladderBOList)) {
return Promise.reject(new Error(LADDERBOLIST(int)?.message));
return Promise.reject(new Error(LADDERBOLIST(int, type)?.message));
}
},
},
......@@ -215,8 +221,8 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
>
{(fields, { add, remove }, { errors }) => (
<Form.Item
tooltip={LADDERBOLIST(int)?.tooltip}
label={LADDERBOLIST(int)?.label}
tooltip={LADDERBOLIST(int, type)?.tooltip}
label={LADDERBOLIST(int, type)?.label}
required
>
{fields.map(({ key, name, fieldKey, ...restField }) => (
......@@ -229,9 +235,9 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
fieldKey={[fieldKey, `${int === 7 ? 'num' : 'key'}`]}
rules={[{ required: true, message: '请输入' }]}
>
<Input addonAfter="个" />
<Input addonAfter={LADDERBOLIST(int, type)?.addon} />
</Form.Item>
{LADDERBOLIST(int, type)?.addonAfter}
<Form.Item
{...restField}
style={{ margin: 0 }}
......@@ -239,7 +245,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
fieldKey={[fieldKey, `${int === 7 ? 'discount' : 'value'}`]}
rules={[{ required: true, message: '请输入' }]}
>
<Input addonAfter="个" />
<Input addonAfter={LADDERBOLIST(int, type)?.addonBefore} />
</Form.Item>
<Button icon={<MinusOutlined />} onClick={() => remove(name)} />
</Space>
......@@ -480,7 +486,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
>
{type(Number(data.value) || 1)}
{restrictNum(Number(data.value) || 1)}
{ladderBOList(Number(data.value) || 1)}
{ladderBOList(Number(data.value) || 1, ladderType)}
{giftType(Number(data.value) || 1)}
{swapType(Number(data.value) || 1)}
{allowActivity(Number(data.value) || 1)}
......
......@@ -63,7 +63,7 @@ const WaitAddedMarketing = () => {
title: '活动名称',
key: 'activityName',
dataIndex: 'activityName',
render: (text, record) => <EyePreview url={`/memberCenter/marketingAbility/paltformSign/search/detail?activityId=${record.activityId}`}>{text}</EyePreview>
render: (text, record) => <EyePreview url={`/marketing/waitAddedMarketing/preview?id=${record.id}`}>{text}</EyePreview>
},
{
title: '活动类型',
......
/** 待审核报名 */
import React from 'react';
import { Button } from 'antd';
import { history } from 'umi';
import TableLayout from '@/components/TableLayout';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ColumnType } from 'antd/lib/table/interface';
......@@ -23,7 +24,7 @@ const WaitAuditApply = () => {
title: '活动名称',
key: 'activityName',
dataIndex: 'activityName',
render: (text, record) => <EyePreview>{text}</EyePreview>
render: (text, record) => <EyePreview url={`/marketing/waitAuditApply/preview?id=${record.id}`}>{text}</EyePreview>
},
{
title: '活动类型',
......@@ -74,7 +75,7 @@ const WaitAuditApply = () => {
title: '操作',
key: 'state',
dataIndex: 'state',
render: (text, record) => <Button type='link'>审核报名</Button>
render: (text, record) => <Button type='link' onClick={() => history.push(`/marketing/waitAuditApply/detail?id=${record.id}&signUpId=${record.signUpId}`)}>审核报名</Button>
}
]
......
import { PageConfigType } from '@lingxi-disign/core';
export const paramsClient = (
templateId: number,
pageConfig: PageConfigType,
) => {
let _params: any = {
templateId,
adornContent: {},
categoryAdornContent: {},
};
const _root: any = pageConfig['0'].childNodes;
_root?.forEach(item => {
if (item != '1') {
switch (item) {
case '2':
_params.adornContent.advert = {
sort: 1,
style: 0,
status: true,
details: [],
};
if (pageConfig['2'].childNodes?.length) {
for (let key in pageConfig['2'].childNodes) {
_params.adornContent.advert.details.push({
id: pageConfig[key]?.props?.id,
img: pageConfig[key]?.props?.img,
name: pageConfig[key]?.props?.name,
type: pageConfig[key]?.props?.type,
});
}
}
break;
case '12':
_params.adornContent.bottom = {
sort: 1,
style: 0,
status: true,
details: [],
};
if (pageConfig['12'].childNodes?.length) {
for (let key in pageConfig['12'].childNodes) {
_params.adornContent.bottom.details.push({
defaultIcon: pageConfig[key]?.props?.defaultIcon,
selectIcon: pageConfig[key]?.props?.selectIcon,
name: pageConfig[key]?.props?.name,
type: pageConfig[key]?.props?.type,
});
}
}
break;
case '13':
_params.adornContent.coupon = {
sort: 1,
style: 0,
status: true,
details: {
title: pageConfig['13']?.props?.title,
id: [],
},
};
if (pageConfig['13'].childNodes?.length) {
for (let key in pageConfig['13'].childNodes) {
_params.adornContent.coupon.details.id.push(pageConfig[key]?.props?.id);
}
}
break;
default:
break;
}
}
});
};
import {
ComponentSchemaType,
PROPS_SETTING_TYPES,
PROPS_TYPES,
} from '@lingxi-disign/core';
const MobileNavCard: ComponentSchemaType = {
propsConfig: {
children: {
label: '内容',
type: PROPS_TYPES.string,
},
},
};
const MobileNavCardNavItem: ComponentSchemaType = {
fatherNodesRule: ['MobileNavCard.children'],
propsConfig: {
children: {
label: '内容',
type: PROPS_TYPES.string,
},
componentType: {
type: PROPS_SETTING_TYPES.mobileNavCardNavItem,
},
},
};
export default {
MobileNavCard,
'MobileNavCard.NavItem': MobileNavCardNavItem,
};
import {
ComponentSchemaType,
PROPS_SETTING_TYPES,
PROPS_TYPES,
} from '@lingxi-disign/core';
const SuggestProduct: ComponentSchemaType = {
propsConfig: {
children: {
label: '内容',
type: PROPS_TYPES.string,
},
},
};
const SuggestProductItems: ComponentSchemaType = {
fatherNodesRule: ['SuggestProduct.children'],
propsConfig: {
children: {
label: '内容',
type: PROPS_TYPES.string,
},
componentType: {
type: PROPS_SETTING_TYPES.suggestProductItems,
},
},
};
export default {
SuggestProduct,
'SuggestProduct.Items': SuggestProductItems,
};
......@@ -45,6 +45,8 @@ import BottomNavigation from './BottomNavigation';
import CouponsModal from './CouponsModal';
import Banner from './Banner';
import HeaderNav from './HeaderNav';
import MobileNavCard from './MobileNavCard';
import SuggestProduct from './SuggestProduct';
export default {
View,
......@@ -93,5 +95,7 @@ export default {
...BottomNavigation,
...CouponsModal,
...Banner,
...HeaderNav
...HeaderNav,
...MobileNavCard,
...SuggestProduct
};
......@@ -15,7 +15,7 @@ export const mallLayoutConfig = {
position: 'relative',
},
},
childNodes: ['1', '2', '12', '13'],
childNodes: ['1', '2', '3', '10','12', '13'],
},
};
......@@ -26,7 +26,7 @@ export const headerConfig = {
canHide: true,
componentName: 'HeaderNav',
props: {},
childNodes: ['1-1','1-2'],
childNodes: ['1-1', '1-2'],
childComponentName: 'HeaderNav.ActionItem',
},
'1-1': {
......@@ -69,8 +69,8 @@ export const bannerConfig = {
componentName: 'Banner',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: [],
childComponentName: 'Banner.Items',
......@@ -78,6 +78,23 @@ export const bannerConfig = {
},
};
export const categoryGuidanceConfig = {
'3': {
title: '品类导航',
canEdit: false,
canHide: true,
componentName: 'MobileNavCard',
props: {
style: {
margin: '8px',
},
},
childNodes: [],
childComponentName: 'MobileNavCard.NavItem',
addBtnText: '添加导航',
},
};
export const marketingConfig = {
'11': {
title: '活动',
......@@ -97,8 +114,8 @@ export const marketingConfig_1 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-1-1', '11-1-2'],
},
......@@ -129,8 +146,8 @@ export const marketingConfig_2 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-2-1', '11-2-2'],
},
......@@ -161,8 +178,8 @@ export const marketingConfig_3 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-3-1', '11-3-2'],
},
......@@ -193,8 +210,8 @@ export const marketingConfig_4 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-4-1', '11-4-2'],
},
......@@ -225,8 +242,8 @@ export const marketingConfig_5 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-5-1', '11-5-2'],
},
......@@ -257,8 +274,8 @@ export const marketingConfig_6 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-6-1', '11-6-2'],
},
......@@ -289,8 +306,8 @@ export const marketingConfig_7 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-7-1', '11-7-2'],
},
......@@ -321,8 +338,8 @@ export const marketingConfig_8 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-8-1', '11-8-2'],
},
......@@ -353,8 +370,8 @@ export const marketingConfig_9 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-9-1', '11-9-2'],
},
......@@ -385,8 +402,8 @@ export const marketingConfig_10 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-10-1', '11-10-2'],
},
......@@ -417,8 +434,8 @@ export const marketingConfig_11 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-11-1', '11-11-2'],
},
......@@ -448,8 +465,8 @@ export const marketingConfig_12 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-12-1', '11-12-2'],
},
......@@ -480,8 +497,8 @@ export const marketingConfig_13 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-13-1', '11-13-2'],
},
......@@ -511,8 +528,8 @@ export const marketingConfig_14 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-14-1', '11-14-2'],
},
......@@ -542,8 +559,8 @@ export const marketingConfig_15 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-15-1', '11-15-2'],
},
......@@ -573,8 +590,8 @@ export const marketingConfig_16 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-16-1', '11-16-2'],
},
......@@ -604,8 +621,8 @@ export const marketingConfig_17 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-17-1', '11-17-2'],
},
......@@ -635,8 +652,8 @@ export const marketingConfig_18 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-18-1', '11-18-2'],
},
......@@ -710,8 +727,8 @@ export const marketingConfig_19 = {
componentName: 'MarketingCard',
props: {
style: {
margin: '8px'
}
margin: '8px',
},
},
childNodes: ['11-19-1', '11-19-2'],
},
......@@ -735,6 +752,29 @@ export const marketingConfig_19 = {
},
};
export const suggestProductConfig = {
'10': {
title: '推荐商品',
componentName: 'SuggestProduct',
props: {},
childNodes: [],
childComponentName: 'SuggestProduct.Items',
addBtnText: '添加分类',
canEdit: false,
canHide: true,
childProps: {
title: '商品容器',
canEdit: false,
canHide: true,
componentName: 'SuggestProduct.Items',
props: {},
childComponentName: 'Commodity',
addBtnText: '添加商品',
childNodes: [],
},
},
}
export const bottomNavigationConfig = {
'12': {
title: '底部标签',
......
......@@ -37,6 +37,8 @@ import {
marketingConfig_18,
marketingConfig_19,
bannerConfig,
categoryGuidanceConfig,
suggestProductConfig,
bottomNavigationConfig,
couponsModalConfig
} from './config';
......@@ -107,6 +109,7 @@ const mobileClientEdit: React.FC<ShopPreviewPropsType> = (props) => {
let _bannerConfig: any = { ...bannerConfig };
let _bottomNavigationConfig: any = { ...bottomNavigationConfig };
let _couponsModalConfig: any = { ...couponsModalConfig };
let _categoryGuidanceConfig: any = { ...categoryGuidanceConfig }
// 活动专区
let _other = {};
let _marketingConfig_1: any = { ...marketingConfig_1 };
......@@ -142,6 +145,20 @@ const mobileClientEdit: React.FC<ShopPreviewPropsType> = (props) => {
}
}
}
if (appConfig?.adornContent?.categoryGuidance) {
// 品类导航
const _list = appConfig?.adornContent?.categoryGuidance?.details;
for (let key in _list) {
const _childKey: any = `3-${Number(key) + 1}`;
!_categoryGuidanceConfig['3'].childNodes.includes(_childKey) && _categoryGuidanceConfig['3'].childNodes.push(_childKey)
_categoryGuidanceConfig[_childKey] = {
key: _childKey,
title: _list[key].name,
componentName: 'MobileNavCard.NavItem',
props: { ..._list[key] },
}
}
}
if (appConfig?.adornContent?.specialOffer) {
// 特价促销
const _details = appConfig?.adornContent?.advert?.details;
......@@ -332,12 +349,20 @@ const mobileClientEdit: React.FC<ShopPreviewPropsType> = (props) => {
// 优惠券弹窗
const _details = appConfig?.adornContent?.coupon?.details;
_couponsModalConfig['13'].props.title = _details.title;
// if (_details.id.length > 0) {
// for (let key in _details.id) {
// const _childKey: any = `13-${Number(key) + 1}`;
// !_couponsModalConfig['13'].childNodes.includes(_childKey) && _couponsModalConfig['13'].childNodes.push(_childKey)
// }
// }
}
const config = cloneDeep({
..._mallLayoutConfig,
...headerConfig,
..._bannerConfig,
// ..._categoryGuidanceConfig,
...suggestProductConfig,
..._other,
..._bottomNavigationConfig,
..._couponsModalConfig
......
......@@ -82,25 +82,25 @@ const BottomNavigationClient: React.FC<BottomNavigationClientProps> = (props: Bo
const _val = e.target.value;
changeProps({
title: _val || '',
props: Object.assign({ ...props }, { name: _val, isNull: _isNull([defaultIcon, selectIcon, _val, type]) })
props: Object.assign({ ...props }, { name: _val, isnull: _isNull([defaultIcon, selectIcon, _val, type]) })
});
}
const _onChangeType = (value: any) => {
changeProps({
props: Object.assign({ ...props }, { type: value, isNull: _isNull([defaultIcon, selectIcon, name, value]) })
props: Object.assign({ ...props }, { type: value, isnull: _isNull([defaultIcon, selectIcon, name, value]) })
});
}
const _onChangeDefaultIcon = (url: any) => {
changeProps({
props: Object.assign({ ...props }, { defaultIcon: url, isNull: _isNull([url, selectIcon, name, type]) })
props: Object.assign({ ...props }, { defaultIcon: url, isnull: _isNull([url, selectIcon, name, type]) })
});
}
const _onChangeSelectIcon = (url: any) => {
changeProps({
props: Object.assign({ ...props }, { selectIcon: url, isNull: _isNull([defaultIcon, url, name, type]) })
props: Object.assign({ ...props }, { selectIcon: url, isnull: _isNull([defaultIcon, url, name, type]) })
});
}
......
@import "../../common.less";
.suggestProduct {
&-box {
margin-bottom: 16px;
&-label {
font-size: 12px;
color: #91959B;
margin-bottom: 8px;
}
}
}
import React from 'react';
import { Input, Radio,Space } from 'antd';
import { changeProps } from '@lingxi-disign/core';
import styles from './index.less';
interface SuggestProductProps {
title?: string,
explain?: string,
type?: number,
num?: number,
customize?: any,
// 当前选中组件的key
selectedKey?: any
}
const SuggestProduct: React.FC<SuggestProductProps> = (props: SuggestProductProps) => {
const { title, explain, type, num, customize, selectedKey } = props;
const _isNull = (list) => {
let _flag = true;
for (let key in list) {
if (list[key]) {
_flag = false
}
}
return _flag;
}
const _onChangeTitle = (e: any) => {
const _val = e.target.value;
changeProps({
title: _val || '',
props: Object.assign({ ...props }, { title: _val, isnull: _isNull([_val, explain, type]) })
});
}
const _onChangeExplain = (e: any) => {
const _val = e.target.value;
changeProps({
props: Object.assign({ ...props }, { explain: _val, isnull: _isNull([title, _val, type]) })
});
}
const _onChangeType = (e: any) => {
const _val = e.target.value;
changeProps({
props: Object.assign({ ...props }, { type: _val, isnull: _isNull([title, explain, _val]) })
});
}
const _onChangeNum = (e: any) => {
const _val = e.target.value.replace(/[^\d]/g,'');
changeProps({
props: Object.assign({ ...props }, { num: _val, isnull: _isNull([title, explain, _val]) })
});
}
return (
<div className={styles['suggestProduct']}>
<div className={styles['suggestProduct-box']}>
<div className={styles['suggestProduct-box-label']}>标题</div>
<Input key={`${selectedKey}-title`} defaultValue={title} onChange={_onChangeTitle} maxLength={8} />
</div>
<div className={styles['suggestProduct-box']}>
<div className={styles['suggestProduct-box-label']}>标题说明</div>
<Input key={`${selectedKey}-explain`} defaultValue={explain} onChange={_onChangeExplain} maxLength={16} />
</div>
<div className={styles['suggestProduct-box']}>
<div className={styles['suggestProduct-box-label']}>商品展示</div>
<Radio.Group key={`${selectedKey}-type`} onChange={_onChangeType} defaultValue={type}>
<Space direction="vertical">
<Radio value={1}>自动按销量排行展示 (从高到低)</Radio>
<Radio value={2}>自动按上架时间排序 (从新到旧)</Radio>
<Radio value={3}>自定义商品</Radio>
</Space>
</Radio.Group>
</div>
<div className={styles['suggestProduct-box']}>
<div className={styles['suggestProduct-box-label']}>展示数量</div>
<Input key={`${selectedKey}-num`} defaultValue={num} onChange={_onChangeNum} />
</div>
</div>
)
}
export default SuggestProduct
......@@ -12,6 +12,7 @@ import MarketingCardCoupon from './components/marketingCardCoupon';
import BottomNavigationClient from './components/bottomNavigationClient';
import CouponsModal from './components/couponsModal';
import BannerClient from './components/bannerClient';
import SuggestProduct from './components/suggestProduct';
import styles from './index.less';
interface PropsSettingsPropsType {
......@@ -51,6 +52,8 @@ const PropsSettings: React.FC<PropsSettingsPropsType> = (props) => {
return <CouponsModal {..._props} />
case PROPS_SETTING_TYPES.bannerItems:
return <BannerClient {..._props} />
case PROPS_SETTING_TYPES.suggestProductItems:
return <SuggestProduct {..._props} />
default:
return null;
}
......
......@@ -123,7 +123,10 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
const param: any = {
templateId: id
};
PublicApi.getTemplateWebCategoryWebFindEnterpriseCategoryTree(param).then(res => {
const headers: any = {
shopId
}
PublicApi.getTemplateWebCategoryWebFindEnterpriseCategoryTree(param, { headers }).then(res => {
if (res.code === 1000) {
resolve(res.data);
}
......
......@@ -57,6 +57,24 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
getPlatformConfig();
}, []);
const getDefaultEnterprise = () => {
const shopInfo = GlobalConfig.web.shopInfo;
const webMallList = shopInfo.filter(
(item: { environment: number; type: number }) =>
item.environment === 1 && item.type === 1,
);
const defaultMall = webMallList.filter(item => item.isDefault === 1)[0];
let result: any = undefined;
if (defaultMall) {
result = defaultMall;
} else {
if (webMallList && webMallList.length > 0) {
result = webMallList[0];
}
}
return result;
};
/**
* 获取平台首页装修信息
*/
......@@ -88,10 +106,15 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
*/
const getCategoryTree = () => {
return new Promise((resolve) => {
const defaultMallInfo = getDefaultEnterprise()
const param: any = {
templateId: id
};
PublicApi.getTemplateWebCategoryWebFindEnterpriseCategoryTree(param).then(res => {
const headers: any = {
shopId: defaultMallInfo.id
};
PublicApi.getTemplateWebCategoryWebFindEnterpriseCategoryTree(param, { headers }).then(res => {
if (res.code === 1000) {
resolve(res.data);
} else {
......
/** 详情通用 - 基本信息 */
import React from 'react';
import { Row, Col } from 'antd';
import Card from '../../../card';
import Card from '../../../Card';
import style from './index.less';
export interface BasicInfoProps {
......
......@@ -2,7 +2,7 @@ import React from 'react';
import { Row, Col, Divider, Tooltip } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import Card from '../../../card';
import Card from '../../../Card';
import selfStyles from './index.less';
......@@ -140,4 +140,4 @@ const BidCommonLayout: React.FC<BidCommonLayoutProps> = (props: any) => {
)
}
export default BidCommonLayout
\ No newline at end of file
export default BidCommonLayout
import React, { useContext, useEffect, useState } from 'react';
import { Tabs, Table, Row, Col, Space, Typography, Button } from 'antd';
import { Context } from '../context';
import Card from '../../../card';
import Card from '../../../Card';
import { PublicApi } from '@/services/api';
import style from './index.less';
import { CaretDownOutlined, CaretRightOutlined } from '@ant-design/icons';
......
/** 详情通用 - 交易条件 */
import React from 'react';
import { Row, Col } from 'antd';
import Card from '../../../card';
import Card from '../../../Card';
import style from './index.less';
export interface ConditionProps {
......
......@@ -3,7 +3,7 @@ import { Space, Button, Tabs, Divider, Skeleton, Typography, message, Row, Col }
import { StandardTable } from 'god';
import { history } from 'umi';
import moment from 'moment';
import Card from '../../../card';
import Card from '../../../Card';
import { PRICECONTRAST_TYPE } from '../../../../constants';
import style from './index.less';
import EyePreview from '@/components/EyePreview';
......
import React, { useContext, useEffect, useState } from 'react';
import Card from '../../../card';
import Card from '../../../Card';
import { PRICECONTRAST_TYPE } from '../../../../constants';
import { Tabs, message, Row, Col, Typography, Skeleton, Divider, Empty, Pagination } from 'antd';
import { FilePdfOutlined } from '@ant-design/icons';
......
import React, { useContext } from 'react';
import { Row, Col, Image, Table, Tooltip, Switch, Typography } from 'antd';
import Card from '../../../card';
import Card from '../../../Card';
import { Context } from '../context';
import style from './index.less';
import { QuestionCircleOutlined } from '@ant-design/icons';
......
import React, { useRef, useState } from 'react';
import { StandardTable } from 'god';
import Card from '../../../card';
import Card from '../../../Card';
import EyePreview from '@/components/EyePreview';
import DetailDrawer from '../../../detailDrawer';
......
/** 详情通用 - 基本信息 */
import React from 'react';
import { Row, Col } from 'antd';
import Card from '../../../card';
import Card from '../../../Card';
import style from './index.less';
export interface OtherInfoProps {
......
/** 详情通用 - 流转进度 */
import React, { useEffect, useState } from 'react';
import { Radio, Steps } from 'antd';
import Card from '../../../card';
import Card from '../../../Card';
export interface ProgressProps {
......
......@@ -2,7 +2,7 @@
import React, { useContext, useState } from 'react';
import { Radio, Steps } from 'antd';
import { Context } from '../context';
import Card from '../../../card';
import Card from '../../../Card';
import style from './index.less';
const LOGSTATESTYPE = {
......
......@@ -4,7 +4,7 @@ import { StandardTable } from 'god';
import StatusTag from '@/components/StatusTag';
import Card from '../../../card';
import Card from '../../../Card';
import { Context } from '../context';
import style from './index.less';
import { QuestionCircleOutlined } from '@ant-design/icons';
......
......@@ -8,7 +8,7 @@ import { formatTimeString } from '@/utils'
import { Context } from '../context';
import Card from '../../../card';
import Card from '../../../Card';
const LOGSTATESTYPE = {
/** 外部流转 */
......
......@@ -2,7 +2,7 @@
import React, { useContext, useState } from 'react';
import { Radio, Table } from 'antd';
import { Context } from '../context';
import Card from '../../../card';
import Card from '../../../Card';
import {
EXTERNALLOGS,
INTERNALLOGS,
......
import React, { useCallback, useEffect, useState } from 'react';
import { Modal, Form, Select, Input } from 'antd';
import { PublicApi } from '@/services/api';
import { isEmpty } from '@/components/NiceForm/components/AntUpload/shared';
const { Option } = Select;
const { TextArea } = Input;
const layout: any = {
colon: false,
labelCol: { style: { width: '100px' } },
labelAlign: "left"
};
interface ModalProps {
/** 支付渠道 */
payChannel: string,
/** 显示隐藏 */
visible?: boolean,
/** 编辑回显数据 */
value?: {
/** 支付参数枚举值 */
code?: number,
/** 支付参数Key名称 */
key?: string,
/** 支付参数内容 */
value?: string,
/** 描述 */
remark?: String
},
/** 确定 */
onConfirm: (e) => void,
/** 取消 */
onCancel: () => void,
}
type channel = {
/** 参数枚举值 */
code?: number,
/** 参数Key名称 */
key: string,
}[]
const ModalLayout: React.FC<ModalProps> = ({
payChannel,
visible,
value,
onConfirm,
onCancel,
}) => {
const [form] = Form.useForm();
const [channel, setChannel] = useState<channel>([]);
const handleChannelFind = useCallback(async () => {
await PublicApi.getOrderPlatformPaymentParameterChannelFind({ payChannel }).then(res => {
if (res.code !== 1000) {
return
}
setChannel(res.data);
})
}, [payChannel])
useEffect(() => {
if (payChannel) {
handleChannelFind();
}
}, [payChannel])
const handleCancel = () => {
onCancel()
form.resetFields()
}
const handleConfirm = () => {
form.validateFields().then(res => {
onConfirm({
...res,
key: channel.filter(item => item.code === res.code)[0].key,
})
form.resetFields();
})
}
useEffect(() => {
if (!isEmpty(value)) {
console.log(value)
form.setFieldsValue({
...value
})
}
}, [value])
return (
<Modal
width={576}
title='新增参数配置'
visible={visible}
onOk={handleConfirm}
onCancel={handleCancel}
>
<Form
form={form}
{...layout}
>
<Form.Item name='code' label='参数代码' rules={[{ required: true, message: '请选择参数代码' }]}>
<Select>
{
channel.map((item: any) => (
<Option key={item.code} value={item.code}>{item.key}</Option>
))
}
</Select>
</Form.Item>
<Form.Item name='value' label='参数值' rules={[{ required: true, message: '请输入参数值' }]}>
<Input maxLength={200} />
</Form.Item>
<Form.Item name='remark' label='参数描述'>
<TextArea maxLength={200} rows={4} />
</Form.Item>
</Form>
</Modal>
)
}
export default ModalLayout;
import React, { useState, useEffect } from 'react';
import { Space, Radio, Form } from 'antd';
import "../index.less";
interface params {
name: string,
value: number,
selectId: number,
onChange: Function
}
const PayWayRadio: React.FC<params> = (props) => {
const { value, selectId, onChange, name } = props;
const [form] = Form.useForm();
useEffect(() => {
form.resetFields()
}, [value])
const options = [{ label: '是', value: 1 }, { label: '否', value: 0 }]
return (
<Space size={49}>
<span>是否开启{name}</span>
<Form form={form}>
<Form.Item
name={`radio-${selectId}`}
noStyle
initialValue={value}
>
<Radio.Group
options={options}
className='radio-group-box'
size="small"
buttonStyle="solid"
optionType="button"
onChange={(e) => onChange(e)}
/>
</Form.Item>
</Form>
</Space>
)
}
export default PayWayRadio;
import React, { useState } from 'react';
import { Table, Button } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import { PlusOutlined } from '@ant-design/icons';
import SetUpModal from './setUpModal';
interface payWayTableParams {
name?: string,
payWayId?: number,
payParametersList?: any,
payParametersListResponses?: any,
visible?: boolean,
onGet: Function,
onType?: number,
onDel: Function,
onEdit: Function,
id?: number
}
const PayWayTable: React.FC<payWayTableParams> = (props) => {
const [modalvisible, setmodalvisible] = useState<boolean>(false);
const [type, setType] = useState<any>(); // 1.
const [edit, setedit] = useState<any>({});
const [modifyIndex, setModifyIndex] = useState<any>(0)
const [modify, setmodify] = useState<boolean>(false);
const { name, payParametersListResponses, payParametersList, visible, onType, onGet, onDel, onEdit, id, payWayId } = props;
const columns: ColumnType<any>[] = [
{
title: '参数代码',
key: 'code',
dataIndex: 'code'
},
{
title: '参数值',
key: 'value',
dataIndex: 'value'
},
{
title: '参数描述',
key: 'describe',
dataIndex: 'describe'
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any, index: number) => <>
<Button type='link' onClick={() => { setedit(record); setmodalvisible(true); setModifyIndex(index); setmodify(true) }}>编辑</Button>
<Button type='link' onClick={() => onDel(record.type, index)}>删除</Button>
</>
}
]
const handleOk = (value: any, idx: number) => {
let idType: number = 1;
switch (type) {
case 1:
idType = 1
break;
case 2:
idType = 3
break;
case 3:
idType = 2
break;
}
if (!modify) {
onGet(value, idType)
} else {
onEdit(value, idType, modifyIndex)
}
setedit({});
setmodalvisible(false);
}
return (
<>
{
visible &&
<>
<div style={{ borderLeft: '2px solid #00B37A', margin: '41px 0 8px', padding: '1px 5px' }}>{name}参数配置</div>
<Table
columns={columns}
dataSource={payParametersListResponses}
rowKey={(record: any, index: any) => index}
pagination={false}
/>
<Button style={{ marginBottom: 16, marginTop: 24 }} block icon={<PlusOutlined />} onClick={() => { setmodalvisible(true); setType(id); setmodify(false) }} type='dashed'>新增参数配置</Button>
{
payWayId !== 2 &&
<>
<div style={{ borderLeft: '2px solid #00B37A', margin: '41px 0 8px', padding: '1px 5px' }}>{name}转账到银行卡参数配置</div>
<Table
columns={columns}
dataSource={payParametersList}
rowKey={(record: any, index: any) => index}
pagination={false}
/>
<Button style={{ marginBottom: 16, marginTop: 24 }} block icon={<PlusOutlined />} onClick={() => { setmodalvisible(true); setType(3); setmodify(false) }} type='dashed'>新增参数配置</Button>
</>
}
</>
}
<SetUpModal
onType={onType}
type={type}
modalvisible={modalvisible}
edit={edit}
onOK={(value) => handleOk(value, type)}
onCancel={() => { setmodalvisible(false); setedit({}) }}
/>
</>
)
}
export default PayWayTable;
import React, { useEffect, useState } from 'react';
import { Modal, Form, Select, Input } from 'antd';
import usePayTypeEnum from './usePayTypeEnum';
const { Option } = Select;
const { TextArea } = Input;
interface setUpModalParams {
type?: number,
modalvisible?: boolean,
onOK: Function,
onCancel: Function,
onType?: number,
edit?: any
}
const layout: any = {
colon: false,
labelCol: { style: { width: '100px' } },
labelAlign: "left"
};
const SetUpModal: React.FC<setUpModalParams> = (props) => {
const [form] = Form.useForm();
const { payTypeEnum } = usePayTypeEnum();
const { modalvisible, onOK, onCancel, type, edit } = props;
const [option, setOption] = useState<any>({})
const handleOk = () => {
form.validateFields().then(res => {
console.log(type)
let idType: number = 1;
switch (type) {
case 1:
idType = 1
break;
case 2:
idType = 3
break;
case 3:
idType = 2
break;
}
const obj = {
id: edit.id ? edit.id : undefined,
code: option.children ? option.children : edit.code,
value: res.value,
describe: res.describe,
type: idType,
payWayCodeTypeEnum: res.code
}
onOK(obj)
form.resetFields();
}).catch(error => {
console.log(error)
})
}
const handleChange = (e: any, option: any) => {
setOption(option)
}
useEffect(() => {
if (Object.keys(edit).length > 0) {
console.log(edit, 10086)
form.setFieldsValue({
code: edit.payWayCodeTypeEnum,
value: edit.value,
describe: edit.describe
})
}
}, [edit])
return (
<Modal
width={576}
title='新增参数配置'
visible={modalvisible}
onOk={handleOk}
onCancel={() => { onCancel();form.resetFields(); }}
>
<Form
form={form}
{...layout}
>
<Form.Item name='code' label='参数代码' rules={[{ required: true, message: '请选择参数代码' }]}>
<Select onChange={handleChange}>
{
payTypeEnum.map(item => (
<Option key={item.value} payWayCodeTypeEnum={item.value} value={item.value}>{item.label}</Option>
))
}
</Select>
</Form.Item>
<Form.Item name='value' label='参数值' rules={[{ required: true, message: '请输入参数值' }]}>
<Input maxLength={200} />
</Form.Item>
<Form.Item name='describe' label='参数描述'>
<TextArea maxLength={200} rows={4} />
</Form.Item>
</Form>
</Modal>
)
}
export default SetUpModal;
import { PublicApi } from '@/services/api';
import React, { useState, useEffect, useRef } from 'react';
const usePayTypeEnum = () => {
const [payTypeEnum, setPayTypeEnum] = useState<any>([])
const ref = useRef(payTypeEnum);
useEffect(() => {
const getPayWayType = async () => {
await PublicApi.getPayGetPayWayCodeTypeEnum().then(res => {
if(res.code === 1000) {
const { data } = res;
const payWay: any[] = []
data.forEach(v => {
payWay.push({
label: v.name,
value: v.type
})
})
ref.current = payWay
setPayTypeEnum(ref.current)
}
})
}
getPayWayType();
},[])
return { payTypeEnum };
}
export default usePayTypeEnum;
.radio-group-box {
.ant-radio-button-wrapper {
width: 80px !important;
text-align: center;
.tabsLayout {
:global {
.ant-tabs-top > .ant-tabs-nav::before, .ant-tabs-top > div > .ant-tabs-nav::before {
border-bottom: none;
}
.ant-tabs-tab {
border-radius: 4px;
border: 1px solid #EDEEEF;
margin: 0px 16px 0px 0px;
padding: 6px 16px;
}
.ant-tabs-tab-btn {
height: 18px;
}
.ant-tabs-tab-active {
border-radius: 4px;
border: 1px solid #00B37A;
}
.ant-tabs-ink-bar {
display: none;
}
.ant-radio-group {
.ant-radio-button-wrapper {
width: 80px !important;
text-align: center;
}
}
.ant-space-item {
display: flex;
align-items: center;
}
}
.anchor {
color: #909399;
font-size: 14px;
position: relative;
padding-left: 6px;
margin-bottom: 16px;
&::after {
content: '';
height: 14px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
border-left: 2px solid @main-color;
transform: scaleY(1);
opacity: 1;
transition: transform .15s cubic-bezier(.645,.045,.355,1),opacity .15s cubic-bezier(.645,.045,.355,1);
}
}
}
/*
* @Author: HJX
* @Date: 2020-11-19 15:25:54
* @LastEditors: HJX
* @LastEditTime: 2020-11-19 15:25:54
*/
import React, { useState, useEffect } from 'react';
import { history } from 'umi';
import { Button, Card, Tabs, Space, Input, InputNumber, message } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PublicApi } from '@/services/api';
import PayWayRadio from './components/payWayRadio';
import PayWayTable from './components/payWayTable';
const { TabPane } = Tabs
const PayWaySetTemplate: React.FC<{}> = () => {
const [config, setconfig] = useState<any>([]);
const [payItem, setPayItem] = useState<any>([]);
// const [step, setStep] = useState<Array<number>>([]);
const [obj, setObj] = useState<any>({});
const payWayConfigInfo = () => {
// 支付配置信息
return new Promise(resolve => {
PublicApi.getPayQueryPlatformDetails().then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
useEffect(() => {
// 支付配置信息
payWayConfigInfo().then((res: any) => {
const arr: any[] = [];
console.log(res)
res.forEach((item: any) => {
arr.push({
id: item.id,
way: item.way,
payWayId: item.payWayId,
isPitchOn: item.isPitchOn ? item.isPitchOn : 0,
payType: item.payType,
payParametersList: item.payParametersList ? item.payParametersList : [],
payParametersAddListRequests: item.payParametersListResponses ? item.payParametersListResponses : []
})
})
setconfig([...res]);
setPayItem([...arr]);
})
}, [])
const onChangeRaido = (e: any, index: number) => {
const data = [...payItem];
payItem[index].isPitchOn = e.target.value;
setPayItem(data);
}
const onGet = (value: any, type: number, idx: number) => {
console.log(value, type)
const data = [...payItem];
if (type === 2) {
data[idx].payParametersList = [...data[idx].payParametersList, value]
} else {
data[idx].payParametersAddListRequests = [...data[idx].payParametersAddListRequests, value]
}
setPayItem(data);
}
/**删除 */
const onDel = (value: any, index: number, idx: number) => {
console.log(value, index, idx, 10086)
const data = [...payItem];
if (Number(value) === 2) {
data[idx].payParametersList.splice(index, 1);
data[idx].payParametersList = [...data[idx].payParametersList]
} else {
data[idx].payParametersAddListRequests.splice(index, 1);
data[idx].payParametersAddListRequests = [...data[idx].payParametersAddListRequests]
}
setPayItem([...data]);
}
/**编辑 */
const onEdit = (value: any, type: number, index: number, idx: number) => {
console.log(value, type, index, idx)
const data = [...payItem];
if (type === 2) {
data[idx].payParametersList[index] = { ...value };
data[idx].payParametersList = [...data[idx].payParametersList]
} else {
data[idx].payParametersAddListRequests[index] = { ...value };
data[idx].payParametersAddListRequests = [...data[idx].payParametersAddListRequests]
}
console.log(data, 10086)
setPayItem(data);
}
/**保存更新 */
const onHnadleSubmit = () => {
let conditions = false;
let wayName = '';
try {
payItem.forEach(item => {
if (item.payWayId === 2 && item.isPitchOn === 1) {
console.log(1)
if (item.payParametersAddListRequests.length > 0) {
conditions = true
} else {
conditions = false
wayName = `${item.way}缺少支付参数配置`
throw new Error
}
} else if (item.payWayId === 1 && item.isPitchOn === 1) {
if (item.payParametersAddListRequests.length > 0 && item.payParametersList.length > 0) {
conditions = true
} else {
conditions = false
wayName = `${item.way}缺少支付参数配置`
throw new Error
}
} else if (item.payWayId === 6 && item.isPitchOn === 1) {
if (item.payParametersAddListRequests.length > 0) {
const data = item.payParametersAddListRequests[0]
if (data.code && data.value && data.describe) {
conditions = true
} else {
conditions = false
wayName = `请配置${item.way}的参数`
throw new Error
}
}
} else {
conditions = true
}
})
} catch {
message.error(wayName)
}
if (conditions) {
PublicApi.postPayCollectionParametersAdd({
platformPayWays: payItem
}).then(res => {
if (res.code === 1000) {
history.push('/ruleSettingManager/paySetting')
}
})
}
}
/** */
const handleBlur = (e, name, idx) => {
const data = [...payItem]
const payParametersAddListRequests = data[idx].payParametersAddListRequests;
if (payParametersAddListRequests.length === 0) {
payParametersAddListRequests.push({ code: '', value: '', describe: '' })
}
payParametersAddListRequests.map(item => {
for (let key in item) {
if (key === name) {
if (name === 'value') {
item[key] = e
} else {
item[key] = e.target.value
}
} else {
if (name === 'value') {
item[name] = e
} else {
item[name] = e.target.value
}
}
}
item.type = 6;
})
data[idx].payParametersAddListRequests = [...payParametersAddListRequests]
console.log(payParametersAddListRequests, 10086)
setPayItem(data)
}
return (
<PageHeaderWrapper
extra={<Button type='primary' onClick={onHnadleSubmit}>保存</Button>}
>
<Card>
<Tabs type="card">
{config.map((item: any, idx: number) =>
<TabPane tab={item.way} key={item.id} forceRender>
<>
{
payItem.length > 0 &&
<>
<PayWayRadio
name={payItem[idx].way}
value={payItem[idx].isPitchOn}
selectId={payItem[idx].id}
onChange={(value) => onChangeRaido(value, idx)}
/>
{(payItem[idx].payWayId === 1 || payItem[idx].payWayId === 2) &&
<PayWayTable
id={payItem[idx].id}
payWayId={payItem[idx].payWayId}
onType={payItem[idx].payType}
name={payItem[idx].way}
payParametersList={payItem[idx].payParametersList}
payParametersListResponses={payItem[idx].payParametersAddListRequests}
visible={!!payItem[idx].isPitchOn}
onGet={(value, t) => onGet(value, t, idx)}
onDel={(value, index) => onDel(value, index, idx)}
onEdit={(value, type, index) => onEdit(value, type, index, idx)}
/>
}
{
(payItem[idx].payWayId === 6 && !!payItem[idx].isPitchOn) &&
<div style={{ marginTop: 42 }}>
<Space direction="horizontal" size={16}>
初始申请额度不超过
<Input onChange={(e) => handleBlur(e, 'code', idx)} value={payItem[idx].payParametersAddListRequests.length > 0 ? payItem[idx].payParametersAddListRequests[0].code : undefined} addonBefore="¥" />
允许满<InputNumber min={1} onChange={(e) => handleBlur(e, 'value', idx)} value={payItem[idx].payParametersAddListRequests.length > 0 ? payItem[idx].payParametersAddListRequests[0].value : undefined} />
天后申请上调<Input onChange={(e) => handleBlur(e, 'describe', idx)} value={payItem[idx].payParametersAddListRequests.length > 0 ? payItem[idx].payParametersAddListRequests[0].describe : undefined} addonAfter="%" />
</Space>
</div>
}
</>
}
</>
</TabPane>
)}
</Tabs>
</Card>
</PageHeaderWrapper>
)
};
export default PayWaySetTemplate;
......@@ -88,7 +88,7 @@ const List: React.FC<{}> = () => {
<Card>
<StandardTable
currentRef={ref}
tableProps={{ rowKey: 'id' }}
tableProps={{ rowKey: 'paymentId' }}
columns={columns}
fetchTableData={(params: any) => fetchData(params)}
formilyLayouts={{
......
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