Commit c8d80a89 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents a1df5c2f de9187bf
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-08-20 16:15:59 * @Date: 2020-08-20 16:15:59
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-16 11:45:36 * @LastEditTime: 2021-07-28 17:39:18
* @Description: 可以带查询的表格,内置 formily,如果需要其他Form可以传入 customRenderSearchForm 配合 reload() 实现查询 * @Description: 可以带查询的表格,内置 formily,如果需要其他Form可以传入 customRenderSearchForm 配合 reload() 实现查询
*/ */
import React, { useState, useEffect, useRef, useImperativeHandle } from 'react'; import React, { useState, useEffect, useRef, useImperativeHandle } from 'react';
...@@ -90,6 +90,7 @@ const NormalTable: React.ForwardRefRenderFunction<NormalTableRefHandleType, Norm ...@@ -90,6 +90,7 @@ const NormalTable: React.ForwardRefRenderFunction<NormalTableRefHandleType, Norm
return { return {
...prevState, ...prevState,
data: props.dataSource as T[], data: props.dataSource as T[],
totalCount: props.dataSource.length,
} }
}); });
} }
...@@ -141,7 +142,7 @@ const NormalTable: React.ForwardRefRenderFunction<NormalTableRefHandleType, Norm ...@@ -141,7 +142,7 @@ const NormalTable: React.ForwardRefRenderFunction<NormalTableRefHandleType, Norm
reload, reload,
})); }));
const totalCount = tableData.totalCount || pagination?.total || 0; const totalCount = pagination?.total || tableData.totalCount || 0;
const paginationProps: PaginationProps = pagination ? { const paginationProps: PaginationProps = pagination ? {
current: current, current: current,
......
...@@ -47,3 +47,22 @@ export const MERCHANT_COUPON_RECEIVE_ACTIVITY = 3; ...@@ -47,3 +47,22 @@ export const MERCHANT_COUPON_RECEIVE_ACTIVITY = 3;
* 会员运营用券 * 会员运营用券
*/ */
export const MERCHANT_COUPON_RECEIVE_OPERATE = 4; export const MERCHANT_COUPON_RECEIVE_OPERATE = 4;
/* --------------------------------- 商家优惠券适用用户 -------------------------------- */
/**
* 新用户(不包含会员)
*/
export const SUITABLE_TYPE_NEW_USER = 1;
/**
* 老用户(不包含会员)
*/
export const SUITABLE_TYPE_OLD_USER = 2;
/**
* 新会员(仅会员用户)
*/
export const SUITABLE_TYPE_NEW_MEMBER = 3;
/**
* 老会员(仅会员用户)
*/
export const SUITABLE_TYPE_OLD_MEMBER = 4;
\ No newline at end of file
...@@ -24,6 +24,7 @@ const Roles: React.FC = () => { ...@@ -24,6 +24,7 @@ const Roles: React.FC = () => {
}, []); }, []);
const handleSelect = (item: MemberRole) => { const handleSelect = (item: MemberRole) => {
console.log(item)
const { memberRoleId } = item; const { memberRoleId } = item;
if (memberRoleId === curRole.memberRoleId) { if (memberRoleId === curRole.memberRoleId) {
return; return;
......
...@@ -283,6 +283,7 @@ const Create = () => { ...@@ -283,6 +283,7 @@ const Create = () => {
}, []) }, [])
const handleBeforeProductChecked = useCallback(async (record: GetProductCommodityCommonGetCommodityListByBuyerResponseDetail, selected: boolean, list: GetProductCommodityCommonGetCommodityListByBuyerResponseDetail[]) => { const handleBeforeProductChecked = useCallback(async (record: GetProductCommodityCommonGetCommodityListByBuyerResponseDetail, selected: boolean, list: GetProductCommodityCommonGetCommodityListByBuyerResponseDetail[]) => {
if (selected) {
const postData = list.map((item) => { const postData = list.map((item) => {
return { return {
/** * 这里指的是skuid, 而接口getProductCommodityCommonGetCommodityListByBuyer 的主键id 就是skuid, 不是(commodityId)*/ /** * 这里指的是skuid, 而接口getProductCommodityCommonGetCommodityListByBuyer 的主键id 就是skuid, 不是(commodityId)*/
...@@ -296,6 +297,8 @@ const Create = () => { ...@@ -296,6 +297,8 @@ const Create = () => {
}) })
const { flag } = await checkProcessEnum(postData); const { flag } = await checkProcessEnum(postData);
return flag; return flag;
}
return true
}, []) }, [])
/** @review 总感觉这个接口有大问题,能力中心没办法拿到shopId,不知道这个shopId 的意义在哪里 */ /** @review 总感觉这个接口有大问题,能力中心没办法拿到shopId,不知道这个shopId 的意义在哪里 */
...@@ -982,7 +985,7 @@ const Create = () => { ...@@ -982,7 +985,7 @@ const Create = () => {
}} }}
components={{Cascader}} components={{Cascader}}
effects={($, actions) => { effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'name', FORM_FILTER_PATH); useStateFilterSearchLinkageEffect($, actions, 'orderNo', FORM_FILTER_PATH);
}} }}
mode={"checkbox"} mode={"checkbox"}
beforeChecked={handleBeforeOrderChecked} beforeChecked={handleBeforeOrderChecked}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:35 * @Date: 2021-01-06 11:36:35
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-19 10:06:58 * @LastEditTime: 2021-07-28 10:02:03
* @Description: 会员基础信息详情 * @Description: 会员基础信息详情
*/ */
import React from 'react'; import React from 'react';
...@@ -70,7 +70,7 @@ const MemberBasicInfo: React.FC<MemberBasicInfoProps> = ({ ...@@ -70,7 +70,7 @@ const MemberBasicInfo: React.FC<MemberBasicInfoProps> = ({
{/* 渠道信息 */} {/* 渠道信息 */}
{/* 平台录入的会员不需要填渠道信息的 */} {/* 平台录入的会员不需要填渠道信息的 */}
{/* { {
memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE
|| memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL || memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
? ( ? (
...@@ -87,7 +87,7 @@ const MemberBasicInfo: React.FC<MemberBasicInfoProps> = ({ ...@@ -87,7 +87,7 @@ const MemberBasicInfo: React.FC<MemberBasicInfoProps> = ({
</Col> </Col>
) )
: null : null
} */} }
{/* 其他注册信息 */} {/* 其他注册信息 */}
{ {
......
...@@ -112,16 +112,16 @@ const MemberQueryDetailed: React.FC<QueryProps> = props => { ...@@ -112,16 +112,16 @@ const MemberQueryDetailed: React.FC<QueryProps> = props => {
key: 'basicInfo', key: 'basicInfo',
name: '基本信息', name: '基本信息',
}, },
// // 平台录入的会员不需要填渠道信息的 // 平台录入的会员不需要填渠道信息的
// ( (
// memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE
// || memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL || memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
// ? { ? {
// key: 'channelInfo', key: 'channelInfo',
// name: '渠道信息', name: '渠道信息',
// } }
// : null : null
// ), ),
...( ...(
memberInfo && memberInfo.groups memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => ({ ? memberInfo.groups.map((item, index) => ({
......
...@@ -228,9 +228,7 @@ const InquiryProductLayout: React.FC<InquiryProductLayoutProps> = (props: any) = ...@@ -228,9 +228,7 @@ const InquiryProductLayout: React.FC<InquiryProductLayoutProps> = (props: any) =
rowKey="productId" rowKey="productId"
columns={columns} columns={columns}
dataSource={dataSource} dataSource={dataSource}
pagination={{ pagination={false}
size: 'small'
}}
/> />
</Form.Item> </Form.Item>
<TableModal <TableModal
......
...@@ -96,7 +96,9 @@ const ApplicableGoods: React.FC<IProps> = (props) => { ...@@ -96,7 +96,9 @@ const ApplicableGoods: React.FC<IProps> = (props) => {
dataIndex: 'unitPrice', dataIndex: 'unitPrice',
render: (text) => { render: (text) => {
const unitPrice = normalizeUnitPrice(text); const unitPrice = normalizeUnitPrice(text);
return ${unitPrice[0]?.price}~${unitPrice[unitPrice.length - 1]?.price}`; const start = unitPrice[0]?.price;
const end = unitPrice[unitPrice.length - 1].price;
return start !== end ? ${start}~${end}` : ${start}`;
}, },
}, },
]; ];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-06-29 09:36:35 * @Date: 2021-06-29 09:36:35
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-29 10:18:11 * @LastEditTime: 2021-07-28 17:49:07
* @Description: * @Description:
*/ */
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
...@@ -31,7 +31,7 @@ export const querySchema: ISchema = { ...@@ -31,7 +31,7 @@ export const querySchema: ISchema = {
'x-component': 'Search', 'x-component': 'Search',
'x-component-props': { 'x-component-props': {
placeholder: '搜索', placeholder: '搜索',
tip: '输入 优惠劵名称 进行搜索', tip: '输入 会员名称 进行搜索',
}, },
}, },
}, },
...@@ -45,33 +45,48 @@ export const querySchema: ISchema = { ...@@ -45,33 +45,48 @@ export const querySchema: ISchema = {
}, },
}, },
properties: { properties: {
id: { memberId: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '优惠劵ID', placeholder: '会员ID',
allowClear: true, allowClear: true,
style: {
width: 160,
}, },
}, },
memberType: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '会员类型(所有)',
allowClear: true,
},
}, },
'[startTime2, endTime2]': { level: {
type: 'object', type: 'string',
'x-component': 'RangePicker', default: undefined,
enum: [],
'x-component-props': { 'x-component-props': {
placeholder: ['劵有效期起始时间', '劵有效期截止时间'], placeholder: '会员等级(所有)',
showTime: true, allowClear: true,
}, },
}, },
type: { suitableMemberType: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [], enum: [],
'x-component-props': { 'x-component-props': {
placeholder: '优惠劵类型(所有)', placeholder: '适用用户(所有)',
allowClear: true, allowClear: true,
}, },
}, },
'[startTime2, endTime2]': {
type: 'string',
'x-component': 'RangePicker',
'x-component-props': {
placeholder: ['成为会员起始时间', '成为会员截止时间'],
showTime: true,
},
},
submit: { submit: {
'x-component': 'Submit', 'x-component': 'Submit',
'x-mega-props': { 'x-mega-props': {
...@@ -105,17 +120,19 @@ export const drawerSchema: ISchema = { ...@@ -105,17 +120,19 @@ export const drawerSchema: ISchema = {
'x-component': 'Mega-Layout', 'x-component': 'Mega-Layout',
'x-component-props': { 'x-component-props': {
grid: true, grid: true,
full: true,
autoRow: true,
columns: 4, columns: 4,
}, },
properties: { properties: {
id: { memberId: {
type: 'string', type: 'string',
'x-component': 'NumberPicker',
'x-component-props': { 'x-component-props': {
placeholder: '会员ID', placeholder: '会员ID',
allowClear: true,
}, },
}, },
memberType: { memberTypeEnum: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [], enum: [],
...@@ -124,7 +141,7 @@ export const drawerSchema: ISchema = { ...@@ -124,7 +141,7 @@ export const drawerSchema: ISchema = {
allowClear: true, allowClear: true,
}, },
}, },
memberLevel: { level: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [], enum: [],
...@@ -133,7 +150,7 @@ export const drawerSchema: ISchema = { ...@@ -133,7 +150,7 @@ export const drawerSchema: ISchema = {
allowClear: true, allowClear: true,
}, },
}, },
applicable: { suitableMemberType: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [], enum: [],
...@@ -142,7 +159,7 @@ export const drawerSchema: ISchema = { ...@@ -142,7 +159,7 @@ export const drawerSchema: ISchema = {
allowClear: true, allowClear: true,
}, },
}, },
'[startTime2, endTime2]': { '[becomeTimeStart, becomeTimeEnd]': {
type: 'string', type: 'string',
'x-component': 'RangePicker', 'x-component': 'RangePicker',
'x-component-props': { 'x-component-props': {
......
...@@ -2,15 +2,21 @@ ...@@ -2,15 +2,21 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-06-28 17:51:33 * @Date: 2021-06-28 17:51:33
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-06 14:07:32 * @LastEditTime: 2021-07-28 17:33:55
* @Description: * @Description: 商家优惠劵发劵
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { import {
Row, Row,
Col, Col,
Spin, Spin,
Button,
message,
} from 'antd'; } from 'antd';
import {
SendOutlined,
} from '@ant-design/icons';
import { history } from 'umi';
import { usePageStatus } from '@/hooks/usePageStatus'; import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { GetMarketingCouponWaiteExecuteGetResponse } from '@/services/MarketingApi'; import { GetMarketingCouponWaiteExecuteGetResponse } from '@/services/MarketingApi';
...@@ -19,18 +25,21 @@ import AnchorPage from '@/layouts/AnchorPage'; ...@@ -19,18 +25,21 @@ import AnchorPage from '@/layouts/AnchorPage';
import AuditProcess from '@/components/AuditProcess'; import AuditProcess from '@/components/AuditProcess';
import BacisInfo from '../../components/BacisInfo'; import BacisInfo from '../../components/BacisInfo';
import CouponRules from '../../components/CouponRules'; import CouponRules from '../../components/CouponRules';
import DeliverCoupon from '../../components/DeliverCoupon'; import DeliverCoupon, { SuitableMemberType } from '../../components/DeliverCoupon';
const MerchantCouponAnalysisDeliver: React.FC<{}> = () => { const MerchantCouponAnalysisDeliver: React.FC<{}> = () => {
const { id } = usePageStatus(); const { id } = usePageStatus();
const [couponInfo, setCouponInfo] = useState<GetMarketingCouponWaiteExecuteGetResponse>(null); const [couponInfo, setCouponInfo] = useState<GetMarketingCouponWaiteExecuteGetResponse>(null);
const [infoLoading, setInfoLoaading] = useState(false); const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const deliverRef = useRef<SuitableMemberType[]>([]);
const getBasicInfo = () => { const getBasicInfo = () => {
if (!id) { if (!id) {
return; return;
} }
setInfoLoaading(true); setInfoLoading(true);
PublicApi.getMarketingCouponWaiteExecuteGet({ PublicApi.getMarketingCouponWaiteExecuteGet({
id, id,
}).then(res => { }).then(res => {
...@@ -38,7 +47,7 @@ const MerchantCouponAnalysisDeliver: React.FC<{}> = () => { ...@@ -38,7 +47,7 @@ const MerchantCouponAnalysisDeliver: React.FC<{}> = () => {
setCouponInfo(res.data); setCouponInfo(res.data);
} }
}).finally(() => { }).finally(() => {
setInfoLoaading(false); setInfoLoading(false);
}); });
}; };
...@@ -46,6 +55,34 @@ const MerchantCouponAnalysisDeliver: React.FC<{}> = () => { ...@@ -46,6 +55,34 @@ const MerchantCouponAnalysisDeliver: React.FC<{}> = () => {
getBasicInfo(); getBasicInfo();
}, []); }, []);
const handleDeliverChange = (value: SuitableMemberType[]) => {
deliverRef.current = value;
};
const handleSubmit = () => {
if (!id) {
return;
}
if (!deliverRef.current.length) {
message.warning('未选择任何会员');
return;
}
setSubmitLoading(true);
PublicApi.postMarketingCouponWaiteExecuteGrant({
id: +id,
grantMembers: deliverRef.current.map((item) => ({ subMemberId: item.memberId, subRoleId: item.roleId })),
}).then(res => {
if (res.code !== 1000) {
return;
}
setTimeout(() => {
history.goBack();
}, 800);
}).finally(() => {
setSubmitLoading(false);
});
};
const anchorsArr = [ const anchorsArr = [
{ {
key: 'verifySteps', key: 'verifySteps',
...@@ -70,6 +107,16 @@ const MerchantCouponAnalysisDeliver: React.FC<{}> = () => { ...@@ -70,6 +107,16 @@ const MerchantCouponAnalysisDeliver: React.FC<{}> = () => {
<AnchorPage <AnchorPage
title={couponInfo?.name} title={couponInfo?.name}
anchors={anchorsArr} anchors={anchorsArr}
extra={(
<Button
type="primary"
icon={<SendOutlined style={{ transform: `rotate(-45deg)`, position: 'relative', top: -2 }} />}
onClick={handleSubmit}
loading={submitLoading}
>
提交
</Button>
)}
> >
<Row gutter={[16, 16]}> <Row gutter={[16, 16]}>
{/* 流转记录 */} {/* 流转记录 */}
...@@ -121,6 +168,7 @@ const MerchantCouponAnalysisDeliver: React.FC<{}> = () => { ...@@ -121,6 +168,7 @@ const MerchantCouponAnalysisDeliver: React.FC<{}> = () => {
{/* 优惠券规则 */} {/* 优惠券规则 */}
<Col span={24}> <Col span={24}>
<DeliverCoupon <DeliverCoupon
onChange={handleDeliverChange}
id="deliverCoupon" id="deliverCoupon"
/> />
</Col> </Col>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-07-19 14:19:31 * @Date: 2021-07-19 14:19:31
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-19 18:18:38 * @LastEditTime: 2021-07-28 11:01:30
* @Description: 适用商品 Form Item * @Description: 适用商品 Form Item
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
...@@ -70,7 +70,9 @@ const ApplicableGoodsFormItem = (props) => { ...@@ -70,7 +70,9 @@ const ApplicableGoodsFormItem = (props) => {
align: 'center', align: 'center',
render: (text) => { render: (text) => {
const unitPrice = normalizeUnitPrice(text); const unitPrice = normalizeUnitPrice(text);
return ${unitPrice[0]?.price}~${unitPrice[unitPrice.length - 1]?.price}`; const start = unitPrice[0]?.price;
const end = unitPrice[unitPrice.length - 1].price;
return start !== end ? ${start}~${end}` : ${start}`;
}, },
}, },
( (
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-06-24 14:03:34 * @Date: 2021-06-24 14:03:34
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-08 16:35:58 * @LastEditTime: 2021-07-28 14:58:01
* @Description: * @Description:
*/ */
import { FormPath, FormEffectHooks } from '@formily/antd'; import { FormPath, FormEffectHooks } from '@formily/antd';
...@@ -25,7 +25,10 @@ const fetchCouponTypes = async () => { ...@@ -25,7 +25,10 @@ const fetchCouponTypes = async () => {
type: data.map(item => ({ label: item.name, value: item.value })), type: data.map(item => ({ label: item.name, value: item.value })),
}; };
} }
return {}; return {
data: [],
totalCount: 0,
};
}; };
// 初始化 领券方式 // 初始化 领券方式
...@@ -38,7 +41,10 @@ const fetchCouponGetWay = async () => { ...@@ -38,7 +41,10 @@ const fetchCouponGetWay = async () => {
getWay: data.map(item => ({ label: item.name, value: item.value })), getWay: data.map(item => ({ label: item.name, value: item.value })),
}; };
} }
return {}; return {
data: [],
totalCount: 0,
};
}; };
// 初始化 适用用户角色 // 初始化 适用用户角色
...@@ -60,7 +66,26 @@ const fetchApplicationUserRole = async () => { ...@@ -60,7 +66,26 @@ const fetchApplicationUserRole = async () => {
applicationUserRole: options, applicationUserRole: options,
}; };
} }
return {}; return {
data: [],
totalCount: 0,
};
};
// 初始化 适用用户
const fetchSuitableUser = async () => {
const res = await PublicApi.getMarketingCouponSuitableMemberTypeList();
if (res.code === 1000) {
const { data = [] } = res;
return {
suitableMemberTypes: data.map(item => ({ label: item.name, value: item.value })),
};
}
return {
data: [],
totalCount: 0,
};
}; };
// 获取 实用会员选项 // 获取 实用会员选项
...@@ -80,6 +105,10 @@ const fetchMemberOtions: (params: { current: string, pageSize: string, levelConf ...@@ -80,6 +105,10 @@ const fetchMemberOtions: (params: { current: string, pageSize: string, levelConf
totalCount: res.data.totalCount, totalCount: res.data.totalCount,
}; };
} }
return {
data: [],
totalCount: 0,
};
}; };
export const createEffects = (context, actions) => { export const createEffects = (context, actions) => {
...@@ -93,6 +122,8 @@ export const createEffects = (context, actions) => { ...@@ -93,6 +122,8 @@ export const createEffects = (context, actions) => {
useAsyncInitSelect(['applicationUserRole'], fetchApplicationUserRole); useAsyncInitSelect(['applicationUserRole'], fetchApplicationUserRole);
useAsyncInitSelect(['suitableMemberTypes'], fetchSuitableUser);
// 初始化 品牌数据 // 初始化 品牌数据
onFieldMount$('applicableBrands').subscribe(() => { onFieldMount$('applicableBrands').subscribe(() => {
PublicApi.getProductSelectGetSelectBrand().then((res) => { PublicApi.getProductSelectGetSelectBrand().then((res) => {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-06-24 14:04:16 * @Date: 2021-06-24 14:04:16
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-23 17:36:48 * @LastEditTime: 2021-07-28 14:33:19
* @Description: * @Description:
*/ */
import { FormEffectHooks, FormPath, IFormActions } from '@formily/antd'; import { FormEffectHooks, FormPath, IFormActions } from '@formily/antd';
...@@ -16,6 +16,10 @@ import { ...@@ -16,6 +16,10 @@ import {
MERCHANT_COUPON_RECEIVE_DESIGNATED, MERCHANT_COUPON_RECEIVE_DESIGNATED,
MERCHANT_COUPON_RECEIVE_ACTIVITY, MERCHANT_COUPON_RECEIVE_ACTIVITY,
MERCHANT_COUPON_RECEIVE_OPERATE, MERCHANT_COUPON_RECEIVE_OPERATE,
SUITABLE_TYPE_NEW_USER,
SUITABLE_TYPE_OLD_USER,
SUITABLE_TYPE_NEW_MEMBER,
SUITABLE_TYPE_OLD_MEMBER,
} from '@/constants/marketing'; } from '@/constants/marketing';
const { const {
...@@ -31,8 +35,6 @@ export const useBusinessEffects = (context, actions: IFormActions) => { ...@@ -31,8 +35,6 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
// 优惠券类型 // 优惠券类型
onFieldInputChange$('type').subscribe(state => { onFieldInputChange$('type').subscribe(state => {
const { value } = state; const { value } = state;
const denominationValue = getFieldValue('denomination'); // 券面额
const useConditionMoneyValue = getFieldValue('useConditionMoney'); // 使用条件
// 0元抵扣券 // 0元抵扣券
if (value === MERCHANT_COUPON_TYPE_VOUCHER) { if (value === MERCHANT_COUPON_TYPE_VOUCHER) {
...@@ -192,8 +194,8 @@ export const useBusinessEffects = (context, actions: IFormActions) => { ...@@ -192,8 +194,8 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
value === MERCHANT_COUPON_RECEIVE_DESIGNATED value === MERCHANT_COUPON_RECEIVE_DESIGNATED
|| value === MERCHANT_COUPON_RECEIVE_OPERATE || value === MERCHANT_COUPON_RECEIVE_OPERATE
) && ( ) && (
newItem.value === 1 newItem.value === SUITABLE_TYPE_NEW_USER
|| newItem.value === 2 || newItem.value === SUITABLE_TYPE_OLD_USER
) )
) { ) {
newItem.disabled = true; newItem.disabled = true;
...@@ -233,7 +235,7 @@ export const useBusinessEffects = (context, actions: IFormActions) => { ...@@ -233,7 +235,7 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
const { value } = state; const { value } = state;
// 包含新会员(仅会员用户) 或者 老会员(仅会员用户),展示 适用用户角色 与 会员等级列表 // 包含新会员(仅会员用户) 或者 老会员(仅会员用户),展示 适用用户角色 与 会员等级列表
if (value && (value.includes(3) || value.includes(4))) { if (value && (value.includes(SUITABLE_TYPE_NEW_MEMBER) || value.includes(SUITABLE_TYPE_OLD_MEMBER))) {
linkage.show('*(applicationUserRole,applicationMemberLevel)'); linkage.show('*(applicationUserRole,applicationMemberLevel)');
} else { } else {
linkage.hide('*(applicationUserRole,applicationMemberLevel)'); linkage.hide('*(applicationUserRole,applicationMemberLevel)');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-06-24 14:05:57 * @Date: 2021-06-24 14:05:57
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-19 17:20:56 * @LastEditTime: 2021-07-28 14:38:37
* @Description: * @Description:
*/ */
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
...@@ -441,28 +441,7 @@ const schema: ISchema = { ...@@ -441,28 +441,7 @@ const schema: ISchema = {
suitableMemberTypes: { suitableMemberTypes: {
title: '适用用户', title: '适用用户',
type: 'string', type: 'string',
enum: [ enum: [],
{
label: '新用户(不包含会员)',
value: 1,
disabled: false,
},
{
label: '老用户(不包含会员)',
value: 2,
disabled: false,
},
{
label: '新会员(仅会员用户)',
value: 3,
disabled: false,
},
{
label: '老会员(仅会员用户)',
value: 4,
disabled: false,
},
],
default: [], default: [],
required: true, required: true,
'x-component': 'TofuCheckGroup', 'x-component': 'TofuCheckGroup',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-06-24 16:11:55 * @Date: 2021-06-24 16:11:55
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-20 10:29:12 * @LastEditTime: 2021-07-28 14:13:43
* @Description: 商品选择抽屉 * @Description: 商品选择抽屉
*/ */
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
...@@ -101,13 +101,16 @@ const GoodsDrawer: React.FC<IProps> = (props) => { ...@@ -101,13 +101,16 @@ const GoodsDrawer: React.FC<IProps> = (props) => {
}, [checkeds]); }, [checkeds]);
const fetchData = async (params: ExtraFetchType) => { const fetchData = async (params: ExtraFetchType) => {
let res = await PublicApi.getProductCommodityGetCommoditySkuListByShopId({ const res = await PublicApi.getProductCommodityGetCommoditySkuListByShopId({
...params, ...params,
current: `${params.current}`, current: `${params.current}`,
pageSize: `${params.pageSize}`, pageSize: `${params.pageSize}`,
shopId: `${shopIds[0] || ''}`, shopId: `${shopIds[0] || ''}`,
}); });
if (res.code === 1000) {
return res.data; return res.data;
}
return { data: [], totalCount: 0 };
}; };
const handleClose = () => { const handleClose = () => {
...@@ -150,11 +153,13 @@ const GoodsDrawer: React.FC<IProps> = (props) => { ...@@ -150,11 +153,13 @@ const GoodsDrawer: React.FC<IProps> = (props) => {
}, },
{ {
title: '商品价格', title: '商品价格',
dataIndex: 'price', dataIndex: 'unitPrice',
align: 'center', align: 'center',
render: (text) => { render: (text) => {
const unitPrice = normalizeUnitPrice(text); const unitPrice = normalizeUnitPrice(text);
return ${unitPrice[0]?.price}~${unitPrice[unitPrice.length - 1]?.price}`; const start = unitPrice[0]?.price;
const end = unitPrice[unitPrice.length - 1].price;
return start !== end ? ${start}~${end}` : ${start}`;
}, },
}, },
]; ];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-06-24 16:19:18 * @Date: 2021-06-24 16:19:18
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-24 16:19:18 * @LastEditTime: 2021-07-28 10:54:23
* @Description: * @Description:
*/ */
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
...@@ -26,11 +26,12 @@ export const querySchema: ISchema = { ...@@ -26,11 +26,12 @@ export const querySchema: ISchema = {
}, },
[FORM_FILTER_PATH]: { [FORM_FILTER_PATH]: {
type: 'object', type: 'object',
'x-component': 'flex-layout', 'x-component': 'mega-layout',
'x-component-props': { 'x-component-props': {
colStyle: { grid: true,
marginLeft: 20, full: true,
}, autoRow: true,
columns: 6,
}, },
properties: { properties: {
category: { category: {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-07-20 10:10:55 * @Date: 2021-07-20 10:10:55
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-23 15:00:55 * @LastEditTime: 2021-07-28 16:48:48
* @Description: * @Description:
*/ */
import { OptionItemType } from '../components/ApplicableList'; import { OptionItemType } from '../components/ApplicableList';
...@@ -69,6 +69,9 @@ export type BrandItemType = { ...@@ -69,6 +69,9 @@ export type BrandItemType = {
} }
export function normalizeUnitPrice(unitPrice: UnitPriceType): UnitPriceType[] { export function normalizeUnitPrice(unitPrice: UnitPriceType): UnitPriceType[] {
if (!unitPrice) {
return;
}
const ret = []; const ret = [];
const objKeys = Object.keys(unitPrice).sort((a, b) => parseFloat(a) - parseFloat(b)); const objKeys = Object.keys(unitPrice).sort((a, b) => parseFloat(a) - parseFloat(b));
......
import React, { Fragment, useState } from 'react'; import React, { Fragment, useCallback, useState } from 'react';
import { Space, Tooltip } from 'antd'; import { Space, Tooltip } from 'antd';
import { history } from 'umi';
import { Context } from '@/pages/transaction/components/detailLayout/components/context'; import { Context } from '@/pages/transaction/components/detailLayout/components/context';
import PeripheralLayout from '@/pages/transaction/components/detailLayout'; import PeripheralLayout from '@/pages/transaction/components/detailLayout';
import { _data } from './data'; import { _data } from './data';
...@@ -16,6 +17,7 @@ import DemandLayout from '../../components/demandLayout'; ...@@ -16,6 +17,7 @@ import DemandLayout from '../../components/demandLayout';
import ListLayout from '@/pages/transaction/components/detailLayout/components/listLayout'; import ListLayout from '@/pages/transaction/components/detailLayout/components/listLayout';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import { QuestionCircleOutlined } from '@ant-design/icons'; import { QuestionCircleOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
const TABLINK = [ const TABLINK = [
{ id: 'progressLayout', title: '流转进度' }, { id: 'progressLayout', title: '流转进度' },
...@@ -28,6 +30,9 @@ const TABLINK = [ ...@@ -28,6 +30,9 @@ const TABLINK = [
] ]
const DetialLayout = () => { const DetialLayout = () => {
const { query: { activityId }, pathname } = history.location;
const [path] = useState(pathname.split('/')[pathname.split('/').length - 1]);
const [pathPci] = useState(pathname.split('/')[pathname.split('/').length - 2]);
const format = (text, fmt?: string) => { const format = (text, fmt?: string) => {
return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</> return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</>
} }
...@@ -40,24 +45,23 @@ const DetialLayout = () => { ...@@ -40,24 +45,23 @@ const DetialLayout = () => {
setBasicEffect([ setBasicEffect([
{ {
col: [ col: [
{ label: '活动ID', extra: data.activityId }, { label: '活动ID', extra: data.id },
{ label: '活动名称', extra: data.activityName }, { label: '活动名称', extra: data.activityName },
{ label: '外部状态', extra: data.externalStateName }, { label: '外部状态', extra: data.outerStatusName },
{ label: '内部状态', extra: data.interiorStateName }, { label: '内部状态', extra: data.innerStatusName },
] ]
}, },
{ {
col: [ col: [
{ label: '活动类型', extra: ACTIVITYTYPENAME[data.activityType] }, { label: '活动类型', extra: data.activityTypeName },
{ label: '下单模式', extra: data.orderModal }, { label: '活动参与类型', extra: data.activitySignUpTypeName },
{ label: '活动开始时间', extra: format(data.activityStartTime) }, { label: '活动开始时间', extra: format(data.startTime) },
{ label: '活动结束时间', extra: format(data.activityEndTime) }, { label: '活动结束时间', extra: format(data.endTime) },
] ]
}, },
{ {
col: [ col: [
{ label: '会员名称', extra: data.membersName }, { label: '要求报名时间', extra: <>{format(data.signUpStartTime)}~{format(data.signUpEndTime)}</> },
{ label: '创建时间', extra: format(data.creationTime) },
] ]
}, },
]) ])
...@@ -161,8 +165,17 @@ const DetialLayout = () => { ...@@ -161,8 +165,17 @@ const DetialLayout = () => {
}, },
] ]
const fetchDataSource = useCallback(async () => {
await PublicApi.getMarketingPlatformActivitySignupDetail({ activityId }).then(res => {
if (res.code !== 1000) {
return
}
handleBasicEffect(res.data)
}).catch(() => {})
}, [])
useEffect(() => { useEffect(() => {
handleBasicEffect(_data); fetchDataSource();
handleGeneralEffect(_data); handleGeneralEffect(_data);
}, []) }, [])
......
...@@ -21,7 +21,7 @@ const Search = () => { ...@@ -21,7 +21,7 @@ const Search = () => {
title: '活动名称', title: '活动名称',
key: 'activityName', key: 'activityName',
dataIndex: 'activityName', dataIndex: 'activityName',
render: (text) => <EyePreview>{text}</EyePreview> render: (text, record) => <EyePreview url={`/memberCenter/marketingAbility/paltformSign/search/detail?activityId=${record.activityId}`}>{text}</EyePreview>
}, },
{ {
title: '活动类型', title: '活动类型',
......
...@@ -260,6 +260,7 @@ const Material: React.FC<Materialprops> = (props: any) => { ...@@ -260,6 +260,7 @@ const Material: React.FC<Materialprops> = (props: any) => {
rowKey="id" rowKey="id"
columns={columns} columns={columns}
dataSource={dataSource} dataSource={dataSource}
pagination={false}
/> />
{/* 选择货品 */} {/* 选择货品 */}
<SelectProduct <SelectProduct
......
...@@ -166,22 +166,23 @@ const Demand: React.FC<Iprops> = (props: any) => { ...@@ -166,22 +166,23 @@ const Demand: React.FC<Iprops> = (props: any) => {
/** 获取会员列表 */ /** 获取会员列表 */
const handleMenberList = (e: any) => { const handleMenberList = (e: any) => {
const RowCtl = e.selectRow; const RowCtl = e.selectRow;
console.log(e)
if (RowCtl.length > 0) { if (RowCtl.length > 0) {
setMenberVidible(false) setMenberVidible(false)
const data: any = [] const data: any = []
RowCtl.forEach(item => { RowCtl.forEach(item => {
data.push({ data.push({
id: item.id, id: item.id,
isSubMember: 1, isSubMember: item.isSubMember || 1,
memberId: item.memberId, memberId: item.memberId,
memberName: item.name, memberName: item.name || item.memberName,
memberTypeName: item.memberTypeName, memberTypeName: item.memberTypeName,
roleId: item.roleId, roleId: item.roleId,
roleName: item.roleName, roleName: item.roleName,
levelTag: item.levelTag, levelTag: item.levelTag,
membershipOrNot: 1, membershipOrNot: item.membershipOrNot || 1,
state: 1, state: item.state || 1,
type: 2, type: item.type || 2,
}) })
}) })
form.setFieldsValue({ "rowCol": data }) form.setFieldsValue({ "rowCol": data })
...@@ -313,6 +314,7 @@ const Demand: React.FC<Iprops> = (props: any) => { ...@@ -313,6 +314,7 @@ const Demand: React.FC<Iprops> = (props: any) => {
<Table <Table
columns={columns} columns={columns}
dataSource={rowCtl} dataSource={rowCtl}
pagination={false}
/> />
</Form.Item> </Form.Item>
)} )}
......
...@@ -24,7 +24,7 @@ interface Iprops { ...@@ -24,7 +24,7 @@ interface Iprops {
const SelectMenber: React.FC<Iprops> = (props: any) => { const SelectMenber: React.FC<Iprops> = (props: any) => {
const ref = useRef({}); const ref = useRef({});
const { visible, onclose, confirm, rowCtl } = props; const { visible, onclose, confirm, rowCtl } = props;
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id' }); const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'memberId' });
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
title: '会员ID', title: '会员ID',
...@@ -65,8 +65,9 @@ const SelectMenber: React.FC<Iprops> = (props: any) => { ...@@ -65,8 +65,9 @@ const SelectMenber: React.FC<Iprops> = (props: any) => {
useEffect(() => { useEffect(() => {
if (rowCtl) { if (rowCtl) {
console.log(rowCtl)
RowCtl.setSelectRow(rowCtl) RowCtl.setSelectRow(rowCtl)
RowCtl.setSelectedRowKeys(rowCtl.map(v => v.id)) RowCtl.setSelectedRowKeys(rowCtl.map(v => v.memberId))
} }
}, [visible]) }, [visible])
...@@ -94,7 +95,7 @@ const SelectMenber: React.FC<Iprops> = (props: any) => { ...@@ -94,7 +95,7 @@ const SelectMenber: React.FC<Iprops> = (props: any) => {
<StandardTable <StandardTable
currentRef={ref} currentRef={ref}
columns={columns} columns={columns}
tableProps={{ rowKew: 'id' }} tableProps={{ rowKey: 'memberId' }}
rowSelection={rowSelection} rowSelection={rowSelection}
fetchTableData={(params) => fetchGoodsData(params)} fetchTableData={(params) => fetchGoodsData(params)}
formilyProps={ formilyProps={
......
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