Browse Source

会员修改

tags/小炒逻辑变更前
gwbvipvip 2 years ago
parent
commit
19fe84cff0
3 changed files with 89 additions and 17 deletions
  1. +28
    -8
      src/pages/member/memberInfo/components/CreateForm.jsx
  2. +52
    -9
      src/pages/member/memberInfo/index.jsx
  3. +9
    -0
      src/pages/member/memberInfo/service.js

+ 28
- 8
src/pages/member/memberInfo/components/CreateForm.jsx View File

@@ -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 (
<Modal
@@ -65,13 +65,33 @@ const CreateForm = (props) => {
<Input placeholder="请输入会员昵称" />
</Form.Item>
<Form.Item name="phone" label="电话号码"
rules= {[ { pattern: '^1[0-9]{10}$', message: '请输入正确的电话号码'} ]}
rules={[{ required: true, pattern: '^1[0-9]{10}$', message: '请输入正确的电话号码' }]}
>
<Input placeholder="" disabled={props.platformType == 0 ? true : false} />
</Form.Item>

<Form.Item
noStyle
shouldUpdate={(prevValues, currentValues) => prevValues.platformType !== currentValues.platformType}
>
{({ getFieldValue }) =>
!getFieldValue('id') ? (
<Form.Item name="platformType" disabled={true} label="平台" rules={[{ required: true }]} >
<Select style={{ width: 120 }} >
<Option value="1" disabled>微信</Option>
<Option value="2" disabled>支付宝</Option>
<Option value="3">POS</Option>
<Option value="4">储值卡</Option>
</Select>
</Form.Item>
) : null
}
</Form.Item>

<Form.Item name="headImgUrl" label="头像" rules={[{ max: 500 }]}>
<Input placeholder="请输入会员昵称" />
</Form.Item>

<Form.Item style={{ height: 32 }}>
<Form.Item name="birthday" label="出生日期" style={{ float: 'left', marginLeft: 40 }}>
<DatePicker />
@@ -99,14 +119,14 @@ const CreateForm = (props) => {
</Form.Item>
<Form.Item label="地区" style={{ height: 32 }}>
<Form.Item name="province" style={{ float: 'left' }}>
<Input style={{width:'150px'}} placeholder="请输入省" />
<Input style={{ width: '150px' }} placeholder="请输入省" />
</Form.Item>
<Form.Item name="city" style={{ float: 'left', marginLeft: 10 }}>
<Input style={{width:'150px'}} placeholder="请输入市" />
<Input style={{ width: '150px' }} placeholder="请输入市" />
</Form.Item>

<Form.Item name="county" style={{ float: 'left', marginLeft: 10 }}>
<Input style={{width:'150px'}} placeholder="请输入县(区)" />
<Input style={{ width: '150px' }} placeholder="请输入县(区)" />
</Form.Item>
</Form.Item>

@@ -125,7 +145,7 @@ const CreateForm = (props) => {
</Form.Item>

<Form.Item>
<Button type="primary" htmlType="submit" style={{ float: 'right' }}>
<Button disabled={props.isLook} type="primary" htmlType="submit" style={{ float: 'right' }}>
保存
</Button>
</Form.Item>


+ 52
- 9
src/pages/member/memberInfo/index.jsx View File

@@ -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 = [
<a
key="primary"
type="primary"
onClick={() => {
SetCreateModalVisible(true);
setCurrentRow(() => {
record.birthday = moment(record.birthday);
setIsLook(true);
return record;
});
}}
>
详情
</a>,
<a
key="primary"
type="primary"
@@ -227,6 +264,7 @@ const MemberManage = () => {
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);
}}
>
<PlusOutlined /> 同步会员
<PlusOutlined /> 添加会员
</Button>,
]}
expandable={{ expandedRowRender }}
@@ -445,14 +488,14 @@ const MemberManage = () => {

{/* 修改会员 */}
<CreateForm
isLook={isLook}
onFinish={async (value) => {
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);


+ 9
- 0
src/pages/member/memberInfo/service.js View File

@@ -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`, {


Loading…
Cancel
Save