diff --git a/src/config.js b/src/config.js
index 9d36563..de8b202 100644
--- a/src/config.js
+++ b/src/config.js
@@ -21,6 +21,7 @@ export const EMAIL_HOST = 'https://p9axztuwd7x8a7.mycht.cn/mail-server/service-m
export const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_server/v2';
export const WS_URL = 'wss://p9axztuwd7x8a7.mycht.cn/whatsapp_server'; // prod:
export const VONAGE_URL = 'https://p9axztuwd7x8a7.mycht.cn/vonage-server'; // 语音和视频接口:
+export const HT3 = process.env.NODE_ENV === 'production' ? 'https://p9axztuwd7x8a7.mycht.cn/ht3' : 'http://127.0.0.1:8000';
export const DATE_FORMAT = 'YYYY-MM-DD';
export const DATETIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
diff --git a/src/main.jsx b/src/main.jsx
index 3435123..ca5dd95 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -30,6 +30,8 @@ import DingdingAuthCode from '@/views/dingding/AuthCode'
import useAuthStore from '@/stores/AuthStore'
import '@/assets/index.css'
+import CustomerRelation from '@/views/customer_relation/index'
+
useAuthStore.getState().loadUserSession()
const isMobileApp =
@@ -81,6 +83,7 @@ const router = createBrowserRouter([
{ path: 'chat/unassign', element: },
{ path: 'callcenter/call', element: },
{ path: 'callcenter/call/:phonenumber', element: },
+ { path: 'customer_relation/index', element: },
],
},
],
diff --git a/src/stores/AuthStore.js b/src/stores/AuthStore.js
index 18c44d0..2bd5d37 100644
--- a/src/stores/AuthStore.js
+++ b/src/stores/AuthStore.js
@@ -157,7 +157,8 @@ const useAuthStore = create(devtools((set, get) => ({
},
loadUserSession: () => {
- let sessionData = window.sessionStorage.getItem('GLOBAL_SALES_LOGIN_USER')
+ //let sessionData = window.sessionStorage.getItem('GLOBAL_SALES_LOGIN_USER')
+ let sessionData ='{"userId":"155","userIdStr":"155","emailList":[],"whatsAppBusiness":"+8617607730395","whatsAppNo":null,"username":"尹诚诚","avatarUrl":"https://static-legacy.dingtalk.com/media/lADPBE1XYG_HAcDNAgDNAgA_512_512.jpg","mobile":"+86-18507832160","email":"ycc@hainatravel.com","openId":"K8BNXMf8ESSr1DzLVUrX7wiEiE","accountList":[{"OPI_SN":155,"OPI_Code":"YCC","OPI_NameCN":"尹诚诚","OPI_DEI_SN":1,"OPI_NameEN":"Yin Chengcheng"}]}'
// if (window.location.hostname === '202.103.68.93' && window.location.port === '4173' && isEmpty(sessionData)) {
// sessionData = `{"userId":"383","userIdStr":"383,609","emailList":[{"opi_sn":383,"mat_sn":760,"email":"lyj@asiahighlights.com","default":false,"backup":false},{"opi_sn":383,"mat_sn":759,"email":"lyj@chinahighlights.com","default":true,"backup":false},{"opi_sn":383,"mat_sn":758,"email":"lyj@hainatravel.com","default":false,"backup":false}],"username":"廖一军","avatarUrl":"https://static-legacy.dingtalk.com/media/lALPBDDrhXr716HNAoDNAoA_640_640.png","mobile":"+86-18777396951","email":"lyj@hainatravel.com","whatsAppBusiness":"8617458471254","openId":"iioljiPmZ4RPoOYpkFiSn7IKAiEiE","accountList":[{"OPI_SN":383,"OPI_Code":"LYJ","OPI_NameCN":"廖一军","OPI_DEI_SN":7,"OPI_NameEN":"Jimmy Liow"},{"OPI_SN":609,"OPI_Code":"LYJAH","OPI_NameCN":"廖一军(ah)","OPI_DEI_SN":28,"OPI_NameEN":"Jimmy Liow"}]}`
diff --git a/src/stores/CustomerRelationStore.js b/src/stores/CustomerRelationStore.js
new file mode 100644
index 0000000..4645ff3
--- /dev/null
+++ b/src/stores/CustomerRelationStore.js
@@ -0,0 +1,41 @@
+import { create } from 'zustand'
+import { devtools } from 'zustand/middleware'
+import { fetchJSON, postForm } from '@/utils/request'
+import { HT3, EMAIL_HOST } from '@/config'
+import { isNotEmpty, prepareUrl } from '@/utils/commons'
+
+export const useCustomerRelationStore = create((set, get) => ({
+ loading: false,
+ setLoading: (loading) => set({ loading }),
+
+ tasksList: [],
+
+ fetchSearchTasks: async (data) => {
+ set({ loading: true })
+ const formData = new FormData()
+ for (const key in data) {
+ formData.append(key, data[key])
+ }
+ fetch(`${HT3}/customerrelation/search_tasks`, {
+ method: 'POST',
+ body: formData,
+ })
+ .then((res) => {
+ if (!res.ok) {
+ throw new Error(`HTTP error! status: ${res.status}`)
+ }
+ return res.json()
+ })
+ .then((data) => {
+ set({ tasksList: data })
+ })
+ .catch((error) => {
+ console.error('Fetch error:', error)
+ })
+ .finally(() => {
+ set({ loading: false })
+ })
+ },
+}))
+
+export default useCustomerRelationStore
diff --git a/src/views/Conversations/History/SearchForm.jsx b/src/views/Conversations/History/SearchForm.jsx
index 0315086..a90d12b 100644
--- a/src/views/Conversations/History/SearchForm.jsx
+++ b/src/views/Conversations/History/SearchForm.jsx
@@ -57,6 +57,7 @@ const SearchForm = memo(function ({ initialValues, onSubmit, onReset }) {
+
diff --git a/src/views/DesktopApp.jsx b/src/views/DesktopApp.jsx
index a94568b..e4990ac 100644
--- a/src/views/DesktopApp.jsx
+++ b/src/views/DesktopApp.jsx
@@ -177,6 +177,10 @@ function DesktopApp() {
key: '/chat/history',
label:
聊天记录,
},
+ {
+ key: '/customer_relation/index',
+ label:
客户运营,
+ },
]}
/>
diff --git a/src/views/customer_relation/index.jsx b/src/views/customer_relation/index.jsx
new file mode 100644
index 0000000..20407fb
--- /dev/null
+++ b/src/views/customer_relation/index.jsx
@@ -0,0 +1,119 @@
+import React, { useState } from 'react'
+import { Form, Input, Button, DatePicker, Select, Table } from 'antd'
+import dayjs from 'dayjs'
+import useCustomerRelationStore from '@/stores/CustomerRelationStore'
+
+const { RangePicker } = DatePicker
+const { Option } = Select
+
+const Index = () => {
+ const { loading, tasksList, fetchSearchTasks } = useCustomerRelationStore()
+
+ // 定义默认值
+ const initialFormValues = {
+ crt_coli_id: '', // 客人名字默认空
+ dateRange: [dayjs().startOf('M'), dayjs().endOf('M')], // 默认本月
+ crt_status: '', // 状态默认所有
+ }
+
+ // 搜索表单提交
+ const onFinish = (values) => {
+ const formattedValues = {
+ ...values,
+ start_date: values.dateRange ? values.dateRange[0].format('YYYY-MM-DD') : '',
+ end_date: values.dateRange ? values.dateRange[1].endOf('day').format('YYYY-MM-DD HH:mm:ss') : '',
+ }
+ fetchSearchTasks(formattedValues)
+ }
+
+ const DATE_RANGE_PRESETS = [
+ {
+ label: '本周',
+ value: [dayjs().startOf('w'), dayjs().endOf('w')],
+ },
+ {
+ label: '上周',
+ value: [dayjs().startOf('w').subtract(7, 'days'), dayjs().endOf('w').subtract(7, 'days')],
+ },
+ {
+ label: '本月',
+ value: [dayjs().startOf('M'), dayjs().endOf('M')],
+ },
+ {
+ label: '上月',
+ value: [dayjs().subtract(1, 'M').startOf('M'), dayjs().subtract(1, 'M').endOf('M')],
+ },
+ {
+ label: '前三月',
+ value: [dayjs().subtract(2, 'M').startOf('M'), dayjs().endOf('M')],
+ },
+ {
+ label: '本年',
+ value: [dayjs().startOf('y'), dayjs().endOf('y')],
+ },
+ ]
+ // 表格列定义
+ const columns = [
+ { title: '团号', dataIndex: 'crt_coli_id', key: 'crt_coli_id' },
+ { title: '客人', dataIndex: 'crt_mei_firstname', key: 'crt_mei_firstname', render: (text, record) => record.crt_mei_firstname + ' ' + record.crt_mei_lastname },
+ { title: '国家', dataIndex: 'crt_coi2_country', key: 'crt_coi2_country' },
+ // { title: '时区', dataIndex: 'ct_coi_code', key: 'ct_coi_code' },
+
+ {
+ title: '状态',
+ dataIndex: 'crt_status',
+ key: 'crt_status',
+ render: (status) => {
+ if (status == '0') {
+ return '待发送'
+ } else if (status == '99') {
+ return '已发送'
+ }
+ return '失败'
+ },
+ },
+ { title: '发送时间', dataIndex: 'crt_send_datetime', key: 'crt_send_datetime' },
+ { title: '模板', dataIndex: 'crt_template', key: 'crt_template' },
+ { title: 'WhatsApp', dataIndex: 'crt_whatsapp', key: 'crt_whatsapp' },
+ { title: '会话ID', dataIndex: 'crt_conversation_id', key: 'crt_conversation_id' },
+ { title: '消息ID', dataIndex: 'crt_message_id', key: 'crt_message_id' },
+ // { title: '邮箱', dataIndex: 'crt_mei_maillist', key: 'crt_mei_maillist' },
+ // { title: '创建时间', dataIndex: 'ct_datetime', key: 'ct_datetime' },
+ // { title: '客人国家', dataIndex: 'crt_mei_country', key: 'crt_mei_country' },
+
+ ]
+
+ return (
+ <>
+ {/* 搜索栏 */}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/* 搜索结果 */}
+
+
搜索结果总数: {tasksList && tasksList.length}
+
+
+ >
+ )
+}
+
+export default Index