Commit 05440b86 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents e0431a40 e3c22c44
......@@ -137,6 +137,7 @@ const ActivityProductDrawer: React.FC<Iprops> = (props: Iprops) => {
// useEffect(() => {})
const handleCancel = () => {
setSelectedActivityProductList([])
onCancel?.();
};
......@@ -240,6 +241,7 @@ const ActivityProductDrawer: React.FC<Iprops> = (props: Iprops) => {
rowSelection={rowSelection as any}
rowKey={(_record) => `${_record.activityId!}-${_record.id!}` }
loading={loading}
pagination={false}
columns={columns} dataSource={selectedActivityProductList}></Table>
</div>
<div className={styles.pagination}>
......
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { history } from 'umi';
import { Button, Tooltip } from 'antd';
import { Button, Tooltip, Input, Tag } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { cloneDeep } from 'lodash';
import { changeProps, updatePageConfig, PageConfigType } from '@lingxi-design/core';
import { getMarketingAdornActivityGoodsAdorn, getMarketingAdornMerchantActivityListAdorn, GetMarketingAdornPlatformActivityListAdornRequest } from '@/services/MarketingV2Api';
......@@ -9,22 +10,31 @@ import ActivityProductDrawer from '@/pages/editor/components/drawer/activityProd
import ActivityImage from '@/assets/couponIcons/ActivityImage.svg';
import { priceFormat } from '@/utils/numberFomat';
import styles from './index.less';
import { LAYOUT_TYPE } from '@/constants';
interface MarketingCardGoodProps {
id?: any,
actType?: any,
exType?: any
exType?: any,
tags?: any,
// 当前选中组件的key
selectedKey?: any,
pageConfig?: PageConfigType
pageConfig?: PageConfigType,
layoutType: LAYOUT_TYPE
}
const MarketingCardGood: React.FC<MarketingCardGoodProps> = (props: MarketingCardGoodProps) => {
const { id, actType, exType, pageConfig } = props;
const { id, actType, exType, tags = [], layoutType, pageConfig } = props;
const { query: { shopId } }: any = history.location;
const [record, setRecord] = useState<any>([]);
const [actVisible, setActVisible] = useState(false);
const saveEditInputRef = useRef<any>({});
const saveInputRef = useRef<any>({});
const [editInputIndex, setEditInputIndex] = useState(-1);
const [editInputValue, setEditInputValue] = useState<any>('');
const [inputValue, setInputValue] = useState<any>('');
const [inputVisible, setInputVisible] = useState(false);
useEffect(() => {
if (id && id != record[0]?.id) {
......@@ -210,6 +220,47 @@ const MarketingCardGood: React.FC<MarketingCardGoodProps> = (props: MarketingCar
setActVisible(false);
};
const _handleEditInputChange = (e: any) => {
setEditInputValue(e.target.value);
}
const _handleEditInputConfirm = () => {
const newTags = [...tags];
newTags[editInputIndex] = editInputValue;
setEditInputIndex(-1);
setEditInputValue('');
changeProps({
props: Object.assign({ ...props }, { tags: newTags })
});
}
const _handleInputChange = (e: any) => {
setInputValue(e.target.value);
}
const _handleClose = (removedTag: any) => {
const _tags = tags?.filter(tag => tag !== removedTag);
changeProps({
props: Object.assign({ ...props }, { tags: _tags })
});
};
const _handleInputConfirm = () => {
let _tags = tags ? [...tags] : [];
if (inputValue && _tags.indexOf(inputValue) === -1) {
_tags = [..._tags, inputValue];
}
setInputVisible(false);
setInputValue('');
changeProps({
props: Object.assign({ ...props }, { tags: _tags })
});
};
const _showInput = () => {
setInputVisible(true)
}
const _record = record[0];
return (
......@@ -234,7 +285,7 @@ const MarketingCardGood: React.FC<MarketingCardGoodProps> = (props: MarketingCar
<div className={styles['suggestProductCommodity-box-label']}>商品活动</div>
{_record?.activityList?.map((item, index) => {
return (
<div className={styles['suggestProductCommodity-activityList']} key={index} onClick={() => { window.open(`/marketing/marketingSearch/preview?id=${item.id}`); }}>
<div className={styles['suggestProductCommodity-activityList']} key={index} onClick={() => { window.open(`/memberCenter/marketingAbility/selfManagement/search/preview?id=${item.id}`); }}>
<img src={ActivityImage} />
<div className={styles['suggestProductCommodity-activityList-name']}>{item.name}</div>
<StatusTag title={item.type} type='danger' />
......@@ -242,6 +293,81 @@ const MarketingCardGood: React.FC<MarketingCardGoodProps> = (props: MarketingCar
);
})}
</div>
{
layoutType === LAYOUT_TYPE.shop && (
<div className={styles['suggestProductCommodity-box']}>
<div className={styles['suggestProductCommodity-box-label']}>活动标签</div>
<>
{tags?.map((tag, index) => {
if (editInputIndex === index) {
return (
<Input
ref={saveEditInputRef}
key={index}
size="small"
maxLength={16}
className={styles['tag-input']}
defaultValue={editInputValue}
onChange={_handleEditInputChange}
onBlur={_handleEditInputConfirm}
onPressEnter={_handleEditInputConfirm}
/>
);
}
const isLongTag = tag.length > 20;
const tagElem = (
<Tag
className={styles['edit-tag']}
key={tag}
closable
onClose={() => _handleClose(tag)}
color='red'
>
<span
onDoubleClick={e => {
if (index !== 0) {
setEditInputIndex(index);
setEditInputValue(tag);
e.preventDefault();
}
}}
>
{isLongTag ? `${tag.slice(0, 20)}...` : tag}
</span>
</Tag>
);
return isLongTag ? (
<Tooltip title={tag} key={tag}>
{tagElem}
</Tooltip>
) : (
tagElem
);
})}
{inputVisible && (
<Input
ref={saveInputRef}
type="text"
size="small"
maxLength={16}
className={styles['tag-input']}
defaultValue={inputValue}
onChange={_handleInputChange}
onBlur={_handleInputConfirm}
onPressEnter={_handleInputConfirm}
/>
)}
{(!inputVisible && tags.length < 3) && (
<Tag className={styles['site-tag-plus']} onClick={_showInput}>
<PlusOutlined /> 新增标签
</Tag>
)}
</>
</div>
)
}
</>
) : (<Button onClick={() => { setActVisible(true); }}>选择活动商品</Button>)}
<ActivityProductDrawer
......
......@@ -51,7 +51,7 @@ const MarketingCardHeader: React.FC<MarketingCardHeaderProps> = (props: Marketin
<div className={styles['marketingCardHeader']}>
<div className={styles['marketingCardHeader-box']}>
<div className={styles['marketingCardHeader-box-label']}>标题</div>
<Input key={`${selectedKey}-title`} defaultValue={title || _defaultInfo?.title} onBlur={_onChangeTitle} />
<Input key={`${selectedKey}-title`} maxLength={16} defaultValue={title || _defaultInfo?.title} onBlur={_onChangeTitle} />
</div>
{
layoutType !== LAYOUT_TYPE.shop && (
......
......@@ -141,7 +141,7 @@ const SuggestProductCommodity: React.FC<SuggestProductCommodityProps> = (props:
const _handleToDetailPage = (id, belongType) => {
if (belongType === 1) {
window.open(`/marketing/marketingSearch/preview?id=${id}`);
window.open(`/memberCenter/marketingAbility/selfManagement/search/preview?id=${id}`);
} else {
window.open(`/marketingManage/merchantMarketing/merchantMarketingSearch/preview?id=${id}`);
}
......
......@@ -194,6 +194,16 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
return result
}
const showTagsById = (id: number, tags: any[]) => {
if(tags) {
const currentTag = tags.filter((item) => item.id === id)[0]
if (currentTag) {
return currentTag?.tags || []
}
}
return []
}
const _getCommodityList = async (list: any[]) => {
let listRes: any = []
if (list && Array.isArray(list) && list.length > 0) {
......@@ -318,6 +328,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
direction: 'row',
name: item.productName,
img: item.productImgUrl,
tags: showTagsById(item.id, _details?.tags),
mode: 'horizontal',
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
......@@ -355,7 +366,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
name: item.productName,
img: item.productImgUrl,
mode: 'horizontal',
info: intl.formatMessage({ id: 'editor.marketing.label.plummet' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -392,7 +403,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
name: item.productName,
img: item.productImgUrl,
mode: 'horizontal',
info: intl.formatMessage({ id: 'editor.marketing.label.fullQuantitySub' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -429,7 +440,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.discount' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -466,7 +477,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
direction: 'row',
mode: 'horizontal',
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.fullQuantityDiscount' }),
tags: showTagsById(item.id, _details?.tags),
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
}
......@@ -502,7 +513,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.fullMoneySub' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -539,7 +550,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.fullMoneyDiscount' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -652,7 +663,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.morePiece' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -689,7 +700,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.combination' }),
tags: showTagsById(item.id, _details?.tags),
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
}
......@@ -800,7 +811,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.fullSwap' }),
tags: showTagsById(item.id, _details?.tags),
isnull: false
}
};
......@@ -835,7 +846,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.fullSwap' }),
tags: showTagsById(item.id, _details?.tags),
isnull: false
}
};
......@@ -870,7 +881,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.preSale' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -907,7 +918,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.attempt' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -1013,7 +1024,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.attempt' }),
tags: showTagsById(item.id, _details?.tags),
discountPrice: priceFormat(item.activityPrice),
isnull: false
}
......@@ -1070,7 +1081,6 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
...defaultConfig
}
const finalConfig = resolveMappingPageConfig(config, allState)
console.log(finalConfig, 'finalConfig')
setComponentConfigs(finalConfig)
setLoading(false)
updatePageConfig(finalConfig)
......
......@@ -280,6 +280,7 @@ export const marketingConfig_8 = {
style: {
margin: '8px',
},
shopColorType: 8
},
childNodes: ['11-8-1', '11-8-2'],
},
......@@ -323,6 +324,7 @@ export const marketingConfig_9 = {
style: {
margin: '8px',
},
shopColorType: 6
},
childNodes: ['11-9-1', '11-9-2'],
},
......@@ -363,6 +365,7 @@ export const marketingConfig_10 = {
style: {
margin: '8px',
},
shopColorType: 7
},
childNodes: ['11-10-1', '11-10-2'],
},
......@@ -398,6 +401,7 @@ export const marketingConfig_11 = {
style: {
margin: '8px',
},
shopColorType: 8
},
childNodes: ['11-11-1', '11-11-2'],
},
......@@ -432,6 +436,7 @@ export const marketingConfig_12 = {
style: {
margin: '8px',
},
shopColorType: 12
},
childNodes: ['11-12-1', '11-12-2'],
},
......@@ -467,6 +472,7 @@ export const marketingConfig_13 = {
style: {
margin: '8px',
},
shopColorType: 9
},
childNodes: ['11-13-1', '11-13-2'],
},
......@@ -500,6 +506,7 @@ export const marketingConfig_14 = {
style: {
margin: '8px',
},
shopColorType: 13
},
childNodes: ['11-14-1', '11-14-2'],
},
......@@ -535,6 +542,7 @@ export const marketingConfig_15 = {
style: {
margin: '8px',
},
shopColorType: 13
},
childNodes: ['11-15-1', '11-15-2'],
},
......@@ -570,6 +578,7 @@ export const marketingConfig_16 = {
style: {
margin: '8px',
},
shopColorType: 14
},
childNodes: ['11-16-1', '11-16-2'],
},
......@@ -604,6 +613,7 @@ export const marketingConfig_17 = {
style: {
margin: '8px',
},
shopColorType: 16
},
childNodes: ['11-17-1', '11-17-2'],
},
......@@ -679,7 +689,8 @@ export const marketingConfig_18 = {
props: {
style:{
margin: '0 12px'
}
},
shopColorType: 15
},
childComponentName: 'MarketingCard.PackageContainerTabsTabPane',
// addBtnText: '添加子套餐',
......
......@@ -235,6 +235,15 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
return listRes
}
const showTagsById = (id: number, tags: any[]) => {
if(tags) {
const currentTag = tags.filter((item) => item.id === id)[0]
if (currentTag) {
return currentTag?.tags || []
}
}
return []
}
const getComponentsConfig = async () => {
try {
......@@ -314,6 +323,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
direction: 'row',
name: item.productName,
img: item.productImgUrl,
tags: showTagsById(item.id, _details?.tags),
mode: 'horizontal',
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
......@@ -351,7 +361,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
name: item.productName,
img: item.productImgUrl,
mode: 'horizontal',
info: intl.formatMessage({ id: 'editor.marketing.label.plummet' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -388,7 +398,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
name: item.productName,
img: item.productImgUrl,
mode: 'horizontal',
info: intl.formatMessage({ id: 'editor.marketing.label.fullQuantitySub' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -425,7 +435,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.discount' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -462,7 +472,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
direction: 'row',
mode: 'horizontal',
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.fullQuantityDiscount' }),
tags: showTagsById(item.id, _details?.tags),
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
}
......@@ -498,7 +508,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.fullMoneySub' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -535,7 +545,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.fullMoneyDiscount' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -648,7 +658,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.morePiece' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -685,7 +695,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.combination' }),
tags: showTagsById(item.id, _details?.tags),
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
}
......@@ -796,7 +806,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.fullSwap' }),
tags: showTagsById(item.id, _details?.tags),
isnull: false
}
};
......@@ -831,7 +841,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.fullSwap' }),
tags: showTagsById(item.id, _details?.tags),
isnull: false
}
};
......@@ -866,7 +876,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.preSale' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -903,7 +913,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.attempt' }),
tags: showTagsById(item.id, _details?.tags),
originalPrice: item.activityPrice ? priceFormat(item.price) : undefined,
discountPrice: priceFormat(item.activityPrice ? item.activityPrice : item.price),
isnull: false
......@@ -1009,7 +1019,7 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
mode: 'horizontal',
name: item.productName,
img: item.productImgUrl,
info: intl.formatMessage({ id: 'editor.marketing.label.attempt' }),
tags: showTagsById(item.id, _details?.tags),
discountPrice: priceFormat(item.activityPrice),
isnull: false
}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-29 09:36:25
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-11-15 17:11:36
* @LastEditTime: 2021-12-01 09:57:37
* @Description: 发券明细
*/
import React, { useState, useMemo } from 'react';
......@@ -204,7 +204,7 @@ const DeliverCoupon: React.FC<IProps> = (props) => {
},
{
title: '适用用户',
dataIndex: 'memberAgeTypeName',
dataIndex: 'suitableMemberTypeName',
},
{
title: '会员类型',
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-28 18:06:53
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-02 11:16:15
* @LastEditTime: 2021-11-30 19:43:45
* @Description: 执行明细
*/
import React, { useRef, } from 'react';
......@@ -10,13 +10,13 @@ import { createFormActions } from '@formily/antd';
import { DatePicker } from '@formily/antd-components';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import moment from 'moment';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import NiceForm from '@/components/NiceForm';
import MellowCard, { MellowCardProps } from '@/components/MellowCard';
import { querySchema } from './schema';
import moment from 'moment';
import { getMarketingCouponWaiteExecuteDetailPage, getMarketingCouponWaiteExecuteDetailPageCondition } from '@/services/MarketingV2Api';
const formActions = createFormActions();
......@@ -175,19 +175,22 @@ const RunningInfo: React.FC<IProps> = (props) => {
},
{
title: '适用用户',
dataIndex: 'bransuitableMemberTypeNamed',
dataIndex: 'suitableMemberTypeName',
},
{
title: '领(发)放劵时间',
dataIndex: 'createTimeStart',
dataIndex: 'createTime',
render: (text) => text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '',
},
{
title: '劵有效期起始时间',
dataIndex: 'effectiveTimeStart',
dataIndex: 'validTimeStart',
render: (text) => text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '',
},
{
title: '券有效期截止时间',
dataIndex: 'effectiveTimeEnd',
dataIndex: 'validTimeEnd',
render: (text) => text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '',
},
{
title: '关联订单',
......@@ -204,7 +207,7 @@ const RunningInfo: React.FC<IProps> = (props) => {
{
title: '订单金额',
dataIndex: 'amount',
render: (text) => ${text || ''}`,
render: (text) => ${text || '0'}`,
},
{
title: '订单状态',
......
......@@ -40,7 +40,7 @@ const schema: ISchema = {
},
disabledDate: (current) => current && current < moment().startOf('day'),
disabledTime: (current, type) => {
if (type === 'start' && moment().isSame(current, 'day')) {
if ((type === 'start' || type === 'end') && moment().isSame(current, 'day')) {
return {
disabledHours: () => range(0, 24).splice(0, moment().get('hour')),
disabledMinutes: () => range(0, 60).splice(0, moment().get('minute')),
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:04:16
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-09-30 16:38:36
* @LastEditTime: 2021-11-30 20:07:59
* @Description:
*/
import { FormEffectHooks, FormPath, IFormActions } from '@formily/antd';
......@@ -298,17 +298,17 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
// 领(发)券起始时间
onFieldValueChange$('[releaseTimeStart, releaseTimeEnd]').subscribe(state => {
const { value } = state;
const releaseTimeStartValue = value?.[0];
const releaseTimeEndValue = value?.[1];
const effectiveTime = getFieldValue('[effectiveTimeStart, effectiveTimeEnd]'); // 券有效期
const effectiveTimeStartValue = effectiveTime?.[0];
if (
releaseTimeStartValue
releaseTimeEndValue
&& effectiveTimeStartValue
&& moment(releaseTimeStartValue) > moment(effectiveTimeStartValue)
&& moment(releaseTimeEndValue) > moment(effectiveTimeStartValue)
) {
setFieldState('[releaseTimeStart, releaseTimeEnd]', fieldState => {
FormPath.setIn(fieldState, 'errors', '领(发)券起始时间应该小于券有效期起始时间');
FormPath.setIn(fieldState, 'errors', '领(发)券截止时间应该小于券有效期起始时间');
});
} else {
actions.clearErrors('[releaseTimeStart, releaseTimeEnd]');
......@@ -320,15 +320,15 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
const { value } = state;
const effectiveTimeStartValue = value?.[0];
const releaseTime = getFieldValue('[releaseTimeStart, releaseTimeEnd]'); // 券有效期
const releaseTimeStartValue = releaseTime?.[0];
const releaseTimeEndValue = releaseTime?.[1];
if (
effectiveTimeStartValue
&& releaseTimeStartValue
&& moment(effectiveTimeStartValue) < moment(releaseTimeStartValue)
&& releaseTimeEndValue
&& moment(effectiveTimeStartValue) < moment(releaseTimeEndValue)
) {
setFieldState('[effectiveTimeStart, effectiveTimeEnd]', fieldState => {
FormPath.setIn(fieldState, 'errors', '券有效期起始时间应该大于等于领(发)券起始时间');
FormPath.setIn(fieldState, 'errors', '券有效期起始时间应该大于等于领(发)券截止时间');
});
} else {
actions.clearErrors('[effectiveTimeStart, effectiveTimeEnd]');
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:05:57
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-11-15 14:20:08
* @LastEditTime: 2021-11-30 20:16:53
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -106,7 +106,7 @@ const schema: ISchema = {
showTime: true,
disabledDate: (current) => current && current < moment().startOf('day'),
disabledTime: (current, type) => {
if (type === 'start' && moment().isSame(current, 'day')) {
if ((type === 'start' || type === 'end') && moment().isSame(current, 'day')) {
return {
disabledHours: () => range(0, 24).splice(0, moment().get('hour')),
disabledMinutes: () => range(0, 60).splice(0, moment().get('minute')),
......@@ -303,7 +303,7 @@ const schema: ISchema = {
showTime: true,
disabledDate: (current) => current && current < moment().startOf('day'),
disabledTime: (current, type) => {
if (type === 'start' && moment().isSame(current, 'day')) {
if ((type === 'start' || type === 'end') && moment().isSame(current, 'day')) {
return {
disabledHours: () => range(0, 24).splice(0, moment().get('hour')),
disabledMinutes: () => range(0, 60).splice(0, moment().get('minute')),
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 16:19:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-30 10:06:32
* @LastEditTime: 2021-11-30 19:49:02
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -15,7 +15,7 @@ export const querySchema: ISchema = {
type: 'object',
'x-component': 'mega-layout',
properties: {
name: {
commodityName: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
......
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