From 19fe84cff050ec4fcf2c3395d1eadef9048d5723 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Tue, 13 Sep 2022 16:07:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../memberInfo/components/CreateForm.jsx | 36 ++++++++--- src/pages/member/memberInfo/index.jsx | 61 ++++++++++++++++--- src/pages/member/memberInfo/service.js | 9 +++ 3 files changed, 89 insertions(+), 17 deletions(-) diff --git a/src/pages/member/memberInfo/components/CreateForm.jsx b/src/pages/member/memberInfo/components/CreateForm.jsx index 3631546..a702ee3 100644 --- a/src/pages/member/memberInfo/components/CreateForm.jsx +++ b/src/pages/member/memberInfo/components/CreateForm.jsx @@ -6,11 +6,11 @@ const CreateForm = (props) => { const [options, setoptions] = useState(); - const couponType = async () => {}; + const couponType = async () => { }; //初始化数据 useEffect(() => { - const initcouponType = async (value) => {}; + const initcouponType = async (value) => { }; initcouponType(); }, []); @@ -27,7 +27,7 @@ const CreateForm = (props) => { }, }, }; - const onTimeTypeChange = (value) => {}; + const onTimeTypeChange = (value) => { }; return ( { + + prevValues.platformType !== currentValues.platformType} + > + {({ getFieldValue }) => + !getFieldValue('id') ? ( + + + + ) : null + } + + + @@ -99,14 +119,14 @@ const CreateForm = (props) => { - + - + - + @@ -125,7 +145,7 @@ const CreateForm = (props) => { - diff --git a/src/pages/member/memberInfo/index.jsx b/src/pages/member/memberInfo/index.jsx index c91b93d..ae47ea9 100644 --- a/src/pages/member/memberInfo/index.jsx +++ b/src/pages/member/memberInfo/index.jsx @@ -13,7 +13,9 @@ import { GetMemberTagAndInfo, UpdateMemberTag, SyncMember, - GetPlatformMemberList + GetPlatformMemberList, + post, + CreateMemberInfo } from './service'; import { get, set } from 'lodash-es'; @@ -39,7 +41,7 @@ const MemberManage = () => { const [memberTagAndInfo, SetMemberTagAndInfo] = useState([]); //选中的标签 const [checkedTagList, setCheckedTagList] = React.useState(); - + const [isLook, setIsLook] = useState(false); const PlatformMemberList = async (memberId) => { @@ -48,6 +50,27 @@ const MemberManage = () => { }); } + //添加会员信息 + const AddMemberInfo = async (fields) => { + message.loading('正在添加...', key); + try { + await CreateMemberInfo(JSON.stringify(fields)).then((r) => { + message.destroy(key); + if (r.data) { + message.success('添加成功'); + } else { + message.error('添加失败'); + } + }); + //刷新数据 + actionRef.current.reload(); + return true; + } catch (error) { + message.destroy(key); + message.error('添加失败请重试!'); + return false; + } + }; //修改会员信息 const updateMemberInfo = async (fields) => { @@ -220,6 +243,20 @@ const MemberManage = () => { valueType: 'option', render: (_, record) => { let template = [ + { + SetCreateModalVisible(true); + setCurrentRow(() => { + record.birthday = moment(record.birthday); + setIsLook(true); + return record; + }); + }} + > + 详情 + , { SetCreateModalVisible(true); setCurrentRow(() => { record.birthday = moment(record.birthday); + setIsLook(false); return record; }); }} @@ -292,6 +330,8 @@ const MemberManage = () => { valueEnum: { 1: { text: '微信' }, 2: { text: '支付宝' }, + 3: { text: 'POS' }, + 4: { text: '储值卡' }, }, }, { @@ -418,12 +458,15 @@ const MemberManage = () => { type="primary" key="primary" onClick={() => { - SyncMember(1).then((r) => { - message.success('启动同步,稍后请刷新页面'); - }); + // SyncMember(1).then((r) => { + // message.success('启动同步,稍后请刷新页面'); + // }); + setIsLook(false); + setCurrentRow({}); + SetCreateModalVisible(true); }} > - 同步会员 + 添加会员 , ]} expandable={{ expandedRowRender }} @@ -445,14 +488,14 @@ const MemberManage = () => { {/* 修改会员 */} { var success = false; + value.MemberInfo_Id = value.id; if (value.id) { - if (value.platformType == 0) { - value.MemberInfo_Id = value.id; - } success = updateMemberInfo(value); } else { + success = AddMemberInfo(value); } if (success) { SetCreateModalVisible(false); diff --git a/src/pages/member/memberInfo/service.js b/src/pages/member/memberInfo/service.js index 01f2c00..075d8e6 100644 --- a/src/pages/member/memberInfo/service.js +++ b/src/pages/member/memberInfo/service.js @@ -22,6 +22,7 @@ export function UpdateMemberStatus(data) { }); } + //获取会员标签 和绑定详情 export function GetMemberTagAndInfo(memberinfoid, platformtype) { return request(`/kitchen/api/member/member-tag-and-info/${memberinfoid}/${platformtype}`, { @@ -37,6 +38,14 @@ export function UpdateMemberInfo(data) { }); } +//添加会员 +export function CreateMemberInfo(data) { + return request(`/kitchen/api/member/member`, { + method: 'post', + data: data, + }); +} + //修改会员标签 export function UpdateMemberTag(data) { return request(`/kitchen/api/member/member-tag`, {