|
|
|
@ -13,6 +13,8 @@ export const ConversationItemForm = ({ initialValues, onFormInstanceReady }) =>
|
|
|
|
|
const [formatPhone, setFormatPhone] = useState('');
|
|
|
|
|
const [formatVisible, setFormatVisible] = useState(false);
|
|
|
|
|
|
|
|
|
|
const [contactValidateStatus, setContactValidateStatus] = useState('success');
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
onFormInstanceReady(form);
|
|
|
|
|
setFormatPhone(phoneNumberToWAID(initialValues.phone_number || ''));
|
|
|
|
@ -29,42 +31,45 @@ export const ConversationItemForm = ({ initialValues, onFormInstanceReady }) =>
|
|
|
|
|
setFormatPhone(_t);
|
|
|
|
|
setFormatVisible(_t !== changeValues.phone_number);
|
|
|
|
|
}
|
|
|
|
|
setContactValidateStatus((isEmpty(allValues.email) && isEmpty(allValues.phone_number) )? 'error' : 'success');
|
|
|
|
|
};
|
|
|
|
|
return (
|
|
|
|
|
<Form layout='horizontal' form={form} name='form_in_modal' initialValues={{ ...fromCurrent, ...initialValues, wa_id: formatPhone }} onValuesChange={onValuesChange} labelCol={{span: 4}} labelWrap={true} >
|
|
|
|
|
{/* {!initialValues.is_current_order && ( */}
|
|
|
|
|
<Form.Item name={'name'} label='名称' rules={[{ required: true, message: '请输入联系人名称' },]} >
|
|
|
|
|
<Input placeholder='请输入联系人名称' />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
{/* )} */}
|
|
|
|
|
<Form.Item name={'remark'} label='备注' rules={[{type: 'string', max: 500, message: '备注最多500字' }]}>
|
|
|
|
|
<Form
|
|
|
|
|
layout='horizontal'
|
|
|
|
|
form={form}
|
|
|
|
|
name='form_in_modal'
|
|
|
|
|
initialValues={{ ...fromCurrent, ...initialValues, wa_id: formatPhone }}
|
|
|
|
|
onValuesChange={onValuesChange}
|
|
|
|
|
labelCol={{ span: 4 }}
|
|
|
|
|
labelWrap={true}>
|
|
|
|
|
<Form.Item name={'name'} label='名称' rules={[{ required: true, message: '请输入联系人名称' }]}>
|
|
|
|
|
<Input placeholder='请输入联系人名称' />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item name={'remark'} label='备注' rules={[{ type: 'string', max: 500, message: '备注最多500字' }]}>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
name={'phone_number'}
|
|
|
|
|
label='手机'
|
|
|
|
|
validateStatus={formatVisible ? 'warning' : undefined}
|
|
|
|
|
validateStatus={contactValidateStatus === 'success' ? (formatVisible ? 'warning' : undefined) : contactValidateStatus}
|
|
|
|
|
help={formatVisible ? `WhatsApp格式: ${formatPhone}` : undefined}
|
|
|
|
|
rules={[{ required: true, message: '请输入联系人手机号' }]}>
|
|
|
|
|
rules={[{ required: false, message: '请输入联系人手机号' }]}>
|
|
|
|
|
<Input placeholder='请输入联系人手机号' disabled={!initialValues.is_new && isNotEmpty(initialValues.phone_number)} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label='WhatsApp' name={'wa_id'} dependencies={['phone_number']} >
|
|
|
|
|
<Form.Item label='WhatsApp' name={'wa_id'} dependencies={['phone_number']}>
|
|
|
|
|
<Input disabled={!initialValues.is_new && isNotEmpty(initialValues.wa_id)} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
{/* <Form.Item name={'phone'} label='手机号码'>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item> */}
|
|
|
|
|
<Form.Item name={'email'} label='邮箱' rules={[{ type: 'email', message: '请输入正确的邮箱地址' }]}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
name={'email'}
|
|
|
|
|
label='邮箱'
|
|
|
|
|
validateStatus={contactValidateStatus}
|
|
|
|
|
help={contactValidateStatus === 'success' ? '' : '手机号或邮箱至少输入一个, 否则无法发送消息'}
|
|
|
|
|
rules={[{ type: 'email', message: '请输入正确的邮箱地址' }]}>
|
|
|
|
|
<Input disabled={!initialValues.is_new && isNotEmpty(initialValues.email)} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
{initialValues.is_current_order && (
|
|
|
|
|
<>
|
|
|
|
|
<Form.Item
|
|
|
|
|
name={'coli_id'}
|
|
|
|
|
label={'关联当前订单'}
|
|
|
|
|
rules={[{ required: true, message: '关联的订单' }]}
|
|
|
|
|
validateStatus='warning'
|
|
|
|
|
help='请务必确认关联的订单是否正确'>
|
|
|
|
|
<Form.Item name={'coli_id'} label={'关联当前订单'} rules={[{ required: true, message: '关联的订单' }]} validateStatus='warning' help='请务必确认关联的订单是否正确'>
|
|
|
|
|
<Input placeholder='请先关联订单' disabled={initialValues.is_current_order} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item name={'coli_sn'} label='订单SN' hidden={initialValues.is_current_order} rules={[{ required: true, message: '订单SN' }]}>
|
|
|
|
@ -74,7 +79,7 @@ export const ConversationItemForm = ({ initialValues, onFormInstanceReady }) =>
|
|
|
|
|
)}
|
|
|
|
|
{/* <div className=' text-neutral-500 italic'>如果会话已存在, 将直接切换</div> */}
|
|
|
|
|
</Form>
|
|
|
|
|
);
|
|
|
|
|
)
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* 新建会话弹窗
|
|
|
|
|