Commit 6018a75e authored by 前端-许佳敏's avatar 前端-许佳敏
parents b7b6eacb 37945cb4
......@@ -36,7 +36,7 @@ export default defineConfig({
'process.env.SOCKET_URL': process.env.SOCKET_URL
},
esbuild: {},
// mfsu: {},
mfsu: {},
locale: {
antd: true,
// 默认情况下,当前语言环境的识别按照:localStorage 中 umi_locale 值 > 浏览器检测 > default 设置的默认语言 > 中文
......
......@@ -103,7 +103,7 @@ module.exports = {
ssh: JSON.stringify({
user: "root",
// Password optional, prompted if none given
password: "123456",
password: "SsyLingxi@test666",
host: "10.0.0.17",
port: 22,
localRoot: path.resolve('./dist/'),
......
......@@ -8,14 +8,15 @@ import { history , useLocation, Link } from 'umi';
import { BgColorsOutlined, CheckCircleOutlined, SaveOutlined } from '@ant-design/icons';
import { FormEffectHooks, createFormActions, FormPath } from '@formily/antd';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import moment from 'moment';
import moment, { Moment } from 'moment';
import { usePageStatus } from '@/hooks/usePageStatus';
import { GlobalConfig } from '@/global/config';
import schema from './schema';
import styles from './index.less';
import FormilyTemplateDrawer from '../components/TemplateDrawer/formilyTemplateDrawer';
import { getTemplateWebActivityPageGet, postTemplateWebActivityPageAdd, postTemplateWebActivityPageUpdate } from '@/services/TemplateV2Api';
import { getTemplateWebActivityPageGet, GetTemplateWebActivityPageGetResponse, postTemplateWebActivityPageAdd, postTemplateWebActivityPageUpdate } from '@/services/TemplateV2Api';
import { postManageWebShopWebAll } from '@/services/ManageV2Api';
import { WEB } from '@/constants/const/environment';
const actions = createFormActions();
......@@ -41,13 +42,29 @@ type SubmitType = {
}
}
type ValueDataType = Omit<GetTemplateWebActivityPageGetResponse, 'startTime' | 'endTime' | 'templateId' | 'templateName' | 'templatePicUrl'> & {
template: {
templateId: number,
templateName: string,
templatePicUrl: string,
}
startTime: Moment,
endTime: Moment
}
const WEB_FIXTURE_LINK = "/marketingManage/marketing/activitiesManagement/webFixtures"
const APP_FIXTURE_LINK = "/marketingManage/marketing/activitiesManagement/fixtures"
const Add = () => {
const { id, } = usePageStatus();
const { pathname } = useLocation();
const isEdit = useMemo(() => id !== '' && pathname.includes("edit"), [id]);
const isView = useMemo(() => id !== '' && pathname.includes("view"), [id]);
const [initialValue, setInitialValue] = useState<any>(null);
const [initialValue, setInitialValue] = useState<ValueDataType | null>(null);
const fixtureLink = initialValue?.environment === WEB ? WEB_FIXTURE_LINK : APP_FIXTURE_LINK;
const [loading, setLoading] = useState<boolean>(false);
const onSubmit = async (values: SubmitType) => {
......@@ -84,7 +101,8 @@ const Add = () => {
okText: '立即装修',
cancelText: '稍后',
onOk: () => {
history.push(`/marketingManage/marketing/activitiesManagement/fixtures?id=${data}`);
const jumpLink = values.environment === WEB ? WEB_FIXTURE_LINK : APP_FIXTURE_LINK;
history.push(`${jumpLink}?id=${data}`);
},
onCancel: () => {
history.goBack();
......@@ -111,7 +129,7 @@ const Add = () => {
templateName,
templatePicUrl,
},
startTime: moment(startTime),
startTime: moment(startTime) ,
endTime: moment(endTime),
});
actions.setFieldState('*(environment,template,shopId)', state => {
......@@ -131,7 +149,7 @@ const Add = () => {
FormPath.setIn(state, 'props.x-component-props', {environment: initialValue.environment});
});
async function setMall() {
const data = await fetchMallData({environment: initialValue.environment.toString(), siteId: GlobalConfig.global.siteInfo.id} as any);
const data = await fetchMallData({environment: initialValue?.environment.toString(), siteId: GlobalConfig.global.siteInfo.id} as any);
actions.setFieldState("shopId", state => {
state.props.enum = data;
});
......@@ -162,6 +180,7 @@ const Add = () => {
return "新增活动页";
};
return (
<PageHeaderWrapper
title={renderTitle()}
......@@ -172,7 +191,7 @@ const Add = () => {
<Space>
{
isEdit && (
<Link to={`/marketingManage/marketing/activitiesManagement/fixtures?id=${id}`}>
<Link to={`${fixtureLink}?id=${id}`}>
<Button icon={<BgColorsOutlined />}>活动页装修</Button>
</Link>
)
......
......@@ -76,7 +76,7 @@ const ActiveItem: React.FC<Iprops> = (props: Iprops) => {
<img className={styles.image} src={templatePicUrl} />
<div className={styles.infoContainer}>
<div className={styles.header}>
<Link to={`/marketingManage/marketing/activitiesManagement/view?id=${id}`}>{title}</Link>
<Link to={`/marketingManage/marketing/activitiesManagement/edit?id=${id}`}>{title}</Link>
<div className={styles.status}>
<StatusTag type="success" title={statusName} />
</div>
......
......@@ -54,7 +54,6 @@ const formatProps = {
const useGetSameKeys = () => {
const { pageConfig } = useSelector<any, any>(['pageConfig']);
console.log("pageConfig", pageConfig);
const sameKeys = useMemo(() => {
if (pageConfig === null || Object.keys(pageConfig).length === 0) {
return {};
......
......@@ -156,7 +156,7 @@ function useSaveData(options: Options) {
const { data, code, ...rest } = await postTemplateWebActivityPageAdorn({
id: id,
adornContent: result
adornContent: withThemeStyle
} as any, {ctlType: 'none'});
setSaving(false);
if (code === 1000) {
......
......@@ -21,7 +21,7 @@ type SettingPanelType = {
}
const formActions = createFormActions();
/** 请求口type, 请求列表接口需要带上type */
/** 请求口type, 请求列表接口需要带上type */
const ACTIVITY_MAP = {
"specialOfferItem": 1,
/** 直降促销 */
......@@ -98,9 +98,7 @@ const EditPanelForm = () => {
imageUrl: [{ name: '广告图', url: selectedInfo?.props?.imageUrl }]
},
couponItem: {
coupon: {
...selectedInfo.props
}
coupon: selectedInfo.props
},
hotItem: {
product: {
......@@ -111,6 +109,7 @@ const EditPanelForm = () => {
title: selectedInfo.props?.title,
},
};
console.log("================================", selectedInfo.props)
/** 如果是活动子集, 那么现实选择活动商品 */
if(activityListItem.includes(componentType) || componentType === 'hotItem' || componentType === 'suggestProductItem') {
setFormValue({
......@@ -120,6 +119,7 @@ const EditPanelForm = () => {
});
setSchema(activityProducts);
} else {
// 如果是 top 或者是 活动容器,那么需要修改他的容器卡片名称
const schemaMap = {
top: activityImageSchema,
couponItem: couponSchema,
......@@ -133,7 +133,7 @@ const EditPanelForm = () => {
: propsMapToValue?.[componentType];
setSchema(tempSchema);
setFormValue(tempFormValue);
setFormValue({ ...tempFormValue });
}
/** 16 种活动,请求是需要带上活动类型 */
const activityType = ACTIVITY_MAP[componentType] ? { activityType: ACTIVITY_MAP[componentType] } : {};
......
......@@ -92,6 +92,11 @@ const FormilyCoupon: React.FC<Iprops> & { isFieldComponent: boolean } = (props:
// setInnerValue(value);
// }, [value]);
const handleClose = () => {
setRadioValue(PLATFORM);
setDrawerVisible(false)
}
const onChange = (e) => {
setRadioValue(e.target.value);
const pageInfo = (ref?.current as any)?.getPaginationInfo();
......@@ -115,6 +120,7 @@ const FormilyCoupon: React.FC<Iprops> & { isFieldComponent: boolean } = (props:
// setInnerValue(selectedRow[0]);
props.mutators.change(selectedRow[0]);
setDrawerVisible(false);
setRadioValue(PLATFORM)
});
};
......@@ -166,7 +172,8 @@ const FormilyCoupon: React.FC<Iprops> & { isFieldComponent: boolean } = (props:
</div>
<CouponSelect
visible={drawerVisible}
onCancel={() => setDrawerVisible(false)}
// onCancel={() => setDrawerVisible(false)}
onCancel={handleClose}
mode="radio"
formExtra={formExtra}
ref={ref as any}
......
......@@ -101,6 +101,11 @@ const minTypeToTwo = ["fullQuantityDiscountItem", "fullMoneyDiscountItem", "give
const activityListItem = Object.keys(ACTIVITY_MAP);
const activityList = activityListItem.map((_item) => _item.substring(0, _item.length - 4));
/**
* TODO 有时间将EditPanel 合并
*/
const EditPanelForm = () => {
const { selectedInfo, pageConfig } = useSelector<SettingPanelType, STATE_PROPS>(['selectedInfo', 'pageConfig']);
const {state: visible, toggle: setVisible } = useToggle(false);
......@@ -132,9 +137,7 @@ const EditPanelForm = () => {
imageUrl: [{ name: '广告图', url: selectedInfo?.props?.imageUrl }]
},
couponItem: {
coupon: {
...selectedInfo.props
}
coupon: {...selectedInfo.props}
},
hotItem: {
product: {
......@@ -150,7 +153,8 @@ const EditPanelForm = () => {
setFormValue({
product: {
...selectedInfo.props,
}
},
uuid: Math.random()
});
setSchema(activityProducts);
} else {
......@@ -158,16 +162,16 @@ const EditPanelForm = () => {
top: activityImageSchema,
couponItem: couponSchema,
};
const isContainer = activityList.includes(componentType) || componentType === 'hot' || componentType === 'suggestProduct' || componentType === 'coupon';
/** 如果是 suggestProduct, 或者是hot 或者是活动父级,那么直接设置他的卡片名称 */
const tempSchema = activityList.includes(componentType) || componentType === 'hot' || componentType === 'suggestProduct' || componentType === 'coupon' ? cardSchema : schemaMap?.[componentType];
const tempFormValue = activityList.includes(componentType) || componentType === 'hot' || componentType === 'suggestProduct' || componentType === 'coupon'
? {
title: selectedInfo.props.title
}
const tempSchema = isContainer ? cardSchema : schemaMap?.[componentType];
const tempFormValue = isContainer
? { title: selectedInfo.props.title}
: propsMapToValue?.[componentType];
setSchema(tempSchema);
setFormValue(tempFormValue);
// 这里加uuid 是为了解决这个bug http://chandao.shushangyun.com/index.php?m=bug&f=view&bugID=19739,formily value 改变不触发更新,
setFormValue({...tempFormValue, uuid: Math.random()});
}
/** 16 种活动,请求是需要带上活动类型 */
const activityType = ACTIVITY_MAP[componentType] ? { activityType: ACTIVITY_MAP[componentType] } : {};
......
......@@ -11,12 +11,12 @@ import { DeleteOutlined, SaveOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { Radio, DatePicker, ArrayTable } from '@formily/antd-components';
import { history, Prompt } from 'umi';
import moment from 'moment';
import moment, { Moment } from 'moment';
import {
MERCHANT_COUPON_TYPE_VOUCHER,
} from '@/constants/const/marketing';
import AnchorPage from '@/components/AnchorPage';
import { getMarketingCouponPlatformWaitAuditGet, postMarketingCouponPlatformWaitAuditAdd } from '@/services/MarketingV2Api';
import { getMarketingCouponPlatformWaitAuditGet, postMarketingCouponPlatformWaitAuditAdd, postMarketingCouponPlatformWaitAuditUpdate } from '@/services/MarketingV2Api';
import NiceForm from '@/components/NiceForm';
import FormilyRangeTime from '@/components/RangeTime/FormilyRangeTime';
import schema from './schema';
......@@ -57,11 +57,11 @@ export type SubmitValueType = {
/**
* 领(发)劵起始时间
*/
releaseTimeStart: string,
releaseTimeStart: Moment,
/**
* 领(发)劵结束时间
*/
releaseTimeEnd: string,
releaseTimeEnd: Moment,
/**
* 领券方式
*/
......@@ -86,11 +86,11 @@ export type SubmitValueType = {
/**
* 劵有效期起始时间
*/
effectiveTimeStart: string,
effectiveTimeStart: Moment | null,
/**
* 劵有效期结束时间
*/
effectiveTimeEnd: string,
effectiveTimeEnd: Moment | null,
/**
* 自领取后多少天内失效
*/
......@@ -192,10 +192,10 @@ const CouponForm: React.FC<IProps> = (props) => {
suitableMallTypes: suitableMallTypes?.map((item) => item.id),
denomination: `${denomination}`,
quantity: `${quantity}`,
releaseTimeStart: releaseTimeStart ? moment(releaseTimeStart).format('YYYY-MM-DD HH:mm:ss') : '',
releaseTimeEnd: releaseTimeEnd ? moment(releaseTimeEnd).format('YYYY-MM-DD HH:mm:ss') : '',
effectiveTimeStart: effectiveTimeStart ? moment(effectiveTimeStart).format('YYYY-MM-DD HH:mm:ss') : '',
effectiveTimeEnd: effectiveTimeEnd ? moment(effectiveTimeEnd).format('YYYY-MM-DD HH:mm:ss') : '',
releaseTimeStart: moment(releaseTimeStart),
releaseTimeEnd: moment(releaseTimeEnd),
effectiveTimeStart: effectiveTimeStart ? moment(effectiveTimeStart) : null,
effectiveTimeEnd: effectiveTimeEnd ? moment(effectiveTimeEnd) : null,
invalidDay: invalidDay !== null ? `${invalidDay}` : undefined,
useConditionMoney: `${useConditionMoney}`,
receiveCondition: {
......@@ -289,10 +289,10 @@ const CouponForm: React.FC<IProps> = (props) => {
quantity: +quantity,
invalidDay: +(invalidDay as string),
denomination: +denomination,
releaseTimeStart: moment(releaseTimeStart).valueOf(),
releaseTimeEnd: moment(releaseTimeEnd).valueOf(),
effectiveTimeStart: effectiveTimeStart ? moment(effectiveTimeStart).valueOf() : undefined,
effectiveTimeEnd: effectiveTimeEnd ? moment(effectiveTimeEnd).valueOf() : undefined,
releaseTimeStart: releaseTimeStart.valueOf(),
releaseTimeEnd: releaseTimeEnd.valueOf(),
effectiveTimeStart: effectiveTimeStart ? effectiveTimeStart.valueOf() : undefined,
effectiveTimeEnd: effectiveTimeEnd ? effectiveTimeEnd.valueOf() : undefined,
suitableMemberLevelTypes: applicationMemberLevel,
suitableCommoditySkuList,
...restValue,
......
......@@ -214,7 +214,7 @@ const PlatformCouponUnsubmitted: React.FC = () => {
});
};
const ControllerBtns = () => (
const ControllerBtns1 = () => (
<Space size={16}>
<Button
type="primary"
......@@ -250,7 +250,7 @@ const PlatformCouponUnsubmitted: React.FC = () => {
<NiceForm
actions={formActions}
components={{
ControllerBtns,
ControllerBtns1,
RangePicker: DatePicker.RangePicker,
}}
onSubmit={values => ref.current.reload(values)}
......
/*
* @Author: XieZhiXiong
* @Date: 2021-06-23 17:41:57
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-23 17:41:58
* @Description:
*/
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const querySchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'ControllerBtns',
},
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
tip: '输入 优惠劵名称 进行搜索',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
colStyle: {
marginLeft: 20,
},
},
properties: {
id: {
type: 'string',
'x-component-props': {
placeholder: '优惠劵ID',
allowClear: true,
},
},
'[effectiveTimeStart, effectiveTimeEnd]': {
type: 'object',
'x-component': 'RangePicker',
'x-component-props': {
placeholder: ['劵有效期起始时间', '劵有效期截止时间'],
},
},
type: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '优惠劵类型(所有)',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2021-06-23 17:41:57
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-23 17:41:58
* @Description:
*/
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const querySchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'ControllerBtns1',
},
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
tip: '输入 优惠劵名称 进行搜索',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
colStyle: {
marginLeft: 20,
},
},
properties: {
id: {
type: 'string',
'x-component-props': {
placeholder: '优惠劵ID',
allowClear: true,
},
},
'[effectiveTimeStart, effectiveTimeEnd]': {
type: 'object',
'x-component': 'RangePicker',
'x-component-props': {
placeholder: ['劵有效期起始时间', '劵有效期截止时间'],
},
},
type: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '优惠劵类型(所有)',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
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