diff --git a/src/actions/CommonActions.js b/src/actions/CommonActions.js index 3773d0d..6e10b26 100644 --- a/src/actions/CommonActions.js +++ b/src/actions/CommonActions.js @@ -9,6 +9,14 @@ export const fetchSalesAgent = async (q) => { return errcode !== 0 ? [] : result.map((ele) => ({ ...ele, label: ele.cn_name, value: ele.op_id })); }; +/** + * 客人列表 + */ +export const fetchCustomerList = async (q) => { + const { errcode, result } = await fetchJSON(`${API_HOST}/GetWhatsappidList`, { search: q }); + return errcode !== 0 ? [] : result.map((ele) => ({ ...ele, label: ele.whatsapp_name, value: ele.whatsapp_phone_number })); +}; + /** * 上传单个文件 * @returns {object} { errcode, result: { file_url } } diff --git a/src/views/ChatHistory.jsx b/src/views/ChatHistory.jsx index edf0f63..649e182 100644 --- a/src/views/ChatHistory.jsx +++ b/src/views/ChatHistory.jsx @@ -6,7 +6,7 @@ import { isEmpty } from '@/utils/utils'; import useFormStore from '@/stores/FormStore'; import { useShallow } from 'zustand/react/shallow'; -import { fetchSalesAgent } from '@/actions/CommonActions'; +import { fetchSalesAgent, fetchCustomerList } from '@/actions/CommonActions'; import SearchInput from '@/components/SearchInput'; const { Sider, Content, Header, Footer } = Layout; @@ -19,7 +19,11 @@ const { RangePicker } = DatePicker; const SearchForm = memo(function ({ initialValues, onSubmit }) { const [form] = Form.useForm(); function handleSubmit(values) { - onSubmit?.({...values, travel: values?.agent?.value || -1}); + onSubmit?.({ + ...values, + travel: values?.agent?.value || '', + customer_name: values?.customer?.label || '', + }); } return (