diff --git a/src/actions/EmailActions.js b/src/actions/EmailActions.js index e0599b3..3fe3a3f 100644 --- a/src/actions/EmailActions.js +++ b/src/actions/EmailActions.js @@ -1,6 +1,6 @@ import { fetchJSON, postForm, postJSON } from '@/utils/request'; import { API_HOST, EMAIL_HOST } from '@/config'; -import { isEmpty } from '@/utils/commons'; +import { buildTree, isEmpty, objectMapper } from '@/utils/commons'; const parseHTMLString = (html, needText = false) => { const parser = new DOMParser() @@ -142,73 +142,9 @@ export const fetchEmailBindOrderAction = async (params) => { * @param {object} { opi_sn } */ export const getEmailDirAction = async (params = { opi_sn: '' }) => { - return [ - { - "MDR_SN": 1474, - "MDR_Name": "收件箱", - "MDR_ParentSN": 1, - "MDR_Type": 1, - "MDR_Order": 1 - }, - { - "MDR_SN": 1475, - "MDR_Name": "未读邮件", - "MDR_ParentSN": 1, - "MDR_Type": 2, - "MDR_Order": 2 - }, - { - "MDR_SN": 1476, - "MDR_Name": "已发邮件", - "MDR_ParentSN": 1, - "MDR_Type": 3, - "MDR_Order": 3 - }, - { - "MDR_SN": 1477, - "MDR_Name": "待发邮件", - "MDR_ParentSN": 1, - "MDR_Type": 4, - "MDR_Order": 4 - }, - { - "MDR_SN": 1478, - "MDR_Name": "草稿", - "MDR_ParentSN": 1, - "MDR_Type": 5, - "MDR_Order": 5 - }, - { - "MDR_SN": 1479, - "MDR_Name": "垃圾邮件", - "MDR_ParentSN": 1, - "MDR_Type": 6, - "MDR_Order": 6 - }, - { - "MDR_SN": 1480, - "MDR_Name": "已处理邮件", - "MDR_ParentSN": 1, - "MDR_Type": 7, - "MDR_Order": 7 - }, - { - "MDR_SN": 1504, - "MDR_Name": "客户信息模板", - "MDR_ParentSN": 1, - "MDR_Type": 0, - "MDR_Order": 100 - }, - { - "MDR_SN": 1505, - "MDR_Name": "客户信息模板", - "MDR_ParentSN": 1474, - "MDR_Type": 0, - "MDR_Order": 100 - } -]; - - const { errcode, result } = await fetchJSON(`${EMAIL_HOST}/email/dir`, params); + const list = [{"VKey":-227001,"VName":"长线订单","VParent":2159,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-12,"VName":"12月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-11,"VName":"11月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-10,"VName":"10月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-9,"VName":"9月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-8,"VName":"8月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-7,"VName":"7月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-6,"VName":"6月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-5,"VName":"5月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-4,"VName":"4月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-3,"VName":"3月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-2,"VName":"2月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":-1,"VName":"1月","VParent":-227001,"ImageIndex":1,"COLI_SN":0,"OrderSourceType":0,"IsTrue":0,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":1,"VName":"李汉超(AH)","VParent":0,"ImageIndex":0,"COLI_SN":0,"OrderSourceType":0,"IsTrue":1,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":2159,"VName":"收件箱","VParent":1,"ImageIndex":3,"COLI_SN":0,"OrderSourceType":0,"IsTrue":1,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":2160,"VName":"未读邮件","VParent":1,"ImageIndex":11,"COLI_SN":0,"OrderSourceType":0,"IsTrue":1,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":2161,"VName":"已发邮件","VParent":1,"ImageIndex":4,"COLI_SN":0,"OrderSourceType":0,"IsTrue":1,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":2162,"VName":"待发邮件","VParent":1,"ImageIndex":2,"COLI_SN":0,"OrderSourceType":0,"IsTrue":1,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":2163,"VName":"草稿","VParent":1,"ImageIndex":5,"COLI_SN":0,"OrderSourceType":0,"IsTrue":1,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":2164,"VName":"垃圾邮件","VParent":1,"ImageIndex":7,"COLI_SN":0,"OrderSourceType":0,"IsTrue":1,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":2165,"VName":"已处理邮件","VParent":1,"ImageIndex":3,"COLI_SN":0,"OrderSourceType":0,"IsTrue":1,"ApplyDate":null,"IsSuccess":0,"COLI_OrderStartDate":null},{"VKey":1101593,"VName":"250104-LHC240621097(WX 1.3 老客人11人哈尔滨雪乡亚布力 全款已付)","VParent":-1,"ImageIndex":13,"COLI_SN":1101593,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-01-04","IsSuccess":1,"COLI_OrderStartDate":"2025-01-04"},{"VKey":1122677,"VName":"250113-LHC241104145(1.13 KIMI老客人哈尔滨成都 全款已付)","VParent":-1,"ImageIndex":13,"COLI_SN":1122677,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-01-14","IsSuccess":1,"COLI_OrderStartDate":"2025-01-14"},{"VKey":1129232,"VName":"250114-LHC241219062(1.13 老客人不丹 全款已付)","VParent":-1,"ImageIndex":13,"COLI_SN":1129232,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-01-14","IsSuccess":1,"COLI_OrderStartDate":"2025-01-14"},{"VKey":1125159,"VName":"250113-LHC241120012(WA 1.19 老客人成都西藏 全款已付)","VParent":-1,"ImageIndex":13,"COLI_SN":1125159,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-01-25","IsSuccess":1,"COLI_OrderStartDate":"2025-01-25"},{"VKey":992847,"VName":"240205-LHC230217002(25.1.26 印尼8老客人哈尔滨 全款已付)","VParent":-1,"ImageIndex":13,"COLI_SN":992847,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-01-26","IsSuccess":1,"COLI_OrderStartDate":"2025-01-26"},{"VKey":1138070,"VName":"250221-LHC250214061(2.21 北京一地 全款已付)","VParent":-2,"ImageIndex":13,"COLI_SN":1138070,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-02-21","IsSuccess":1,"COLI_OrderStartDate":"2025-02-21"},{"VKey":1121384,"VName":"250224-LHC241026054(2.24 新加坡云南 全款已付)","VParent":-2,"ImageIndex":13,"COLI_SN":1121384,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-02-24","IsSuccess":1,"COLI_OrderStartDate":"2025-02-24"},{"VKey":1027604,"VName":"250305-LHC230915012(3.5 美国教授京西上 全款已付)","VParent":-3,"ImageIndex":13,"COLI_SN":1027604,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-04","IsSuccess":1,"COLI_OrderStartDate":"2025-03-04"},{"VKey":1133974,"VName":"250306-LHC250120040(WA 3.6 俄罗斯给女儿问的云南 全款已付)","VParent":-3,"ImageIndex":13,"COLI_SN":1133974,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-06","IsSuccess":1,"COLI_OrderStartDate":"2025-03-06"},{"VKey":1138819,"VName":"250308-LHC250218116(3.8 北京一地 全款已付 推荐券USD100.0可用 总计:USD100.0)","VParent":-3,"ImageIndex":13,"COLI_SN":1138819,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-08","IsSuccess":1,"COLI_OrderStartDate":"2025-03-08"},{"VKey":1131907,"VName":"250310-LHC250107062(3.10 潮汕一地 全款已付)","VParent":-3,"ImageIndex":13,"COLI_SN":1131907,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-10","IsSuccess":1,"COLI_OrderStartDate":"2025-03-10"},{"VKey":1109383,"VName":"250315-LHC240811004(3.15 美国人京西上 全款已付)","VParent":-3,"ImageIndex":13,"COLI_SN":1109383,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-15","IsSuccess":1,"COLI_OrderStartDate":"2025-03-15"},{"VKey":1140248,"VName":"250315-LHC250227043(3.15 老客人内蒙古 全款已付)","VParent":-3,"ImageIndex":13,"COLI_SN":1140248,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-15","IsSuccess":1,"COLI_OrderStartDate":"2025-03-15"},{"VKey":1131785,"VName":"250316-LHC250106123(WA 3.16 老客人推荐北京一地 全款已付 推荐券USD200.0可用 总计:USD200.0)","VParent":-3,"ImageIndex":13,"COLI_SN":1131785,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-16","IsSuccess":1,"COLI_OrderStartDate":"2025-03-16"},{"VKey":1122705,"VName":"250319-LHC241105045(WA 3.19 英国人退休3周半自由行 全款已付)","VParent":-3,"ImageIndex":13,"COLI_SN":1122705,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-19","IsSuccess":1,"COLI_OrderStartDate":"2025-03-19"},{"VKey":1119363,"VName":"250322-LHC241012072(3.22 老客人广州桂林 全款已付)","VParent":-3,"ImageIndex":13,"COLI_SN":1119363,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-22","IsSuccess":1,"COLI_OrderStartDate":"2025-03-22"},{"VKey":1139524,"VName":"250325-LHC250223083(WA 3.26 九寨沟一地5人 全款已付)","VParent":-3,"ImageIndex":13,"COLI_SN":1139524,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-25","IsSuccess":1,"COLI_OrderStartDate":"2025-03-25"},{"VKey":1143130,"VName":"250328-LHC250314110(WA 3.28 老客人推荐北京一地 全款已付 推荐券USD100.0可用 总计:USD100.0)","VParent":-3,"ImageIndex":13,"COLI_SN":1143130,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-03-28","IsSuccess":1,"COLI_OrderStartDate":"2025-03-28"},{"VKey":1128795,"VName":"250402-LHC241216025(WA 4.2 德国人京西成桂港 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1128795,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-01","IsSuccess":1,"COLI_OrderStartDate":"2025-04-01"},{"VKey":1003324,"VName":"250401-LHC230417001(4.4 英国40人北京一地 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1003324,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-04","IsSuccess":1,"COLI_OrderStartDate":"2025-04-04"},{"VKey":1121686,"VName":"250404-LHC241028118(WX 4.4 老客人北京一地 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1121686,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-04","IsSuccess":1,"COLI_OrderStartDate":"2025-04-04"},{"VKey":1130283,"VName":"250404-LHC241228012(4.4 老客人北京承德 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1130283,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-04","IsSuccess":1,"COLI_OrderStartDate":"2025-04-04"},{"VKey":1146231,"VName":"250404-LHC250331006(4.4 老客人推荐北京一地 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1146231,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-04","IsSuccess":1,"COLI_OrderStartDate":"2025-04-04"},{"VKey":1141487,"VName":"250405-LHC250305088(4.5 老客人甘肃重庆西安 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1141487,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-05","IsSuccess":1,"COLI_OrderStartDate":"2025-04-05"},{"VKey":1143697,"VName":"250405-LHC250318036(4.5 故宫一日游 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1143697,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-05","IsSuccess":1,"COLI_OrderStartDate":"2025-04-05"},{"VKey":1105702,"VName":"250407-LHC240718072(4.7 澳洲人西藏一地含机票火车 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1105702,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-06","IsSuccess":1,"COLI_OrderStartDate":"2025-04-06"},{"VKey":1087509,"VName":"250409-LHC240410090(4.9 西藏林芝桃花+珠峰 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1087509,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-09","IsSuccess":1,"COLI_OrderStartDate":"2025-04-09"},{"VKey":1086414,"VName":"250410-LHC240404015(WA 4.12 南非豪华5星北京一地 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1086414,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-10","IsSuccess":1,"COLI_OrderStartDate":"2025-04-10"},{"VKey":1118529,"VName":"250412-LHC241008060(4.11 菲律宾6人京西上 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1118529,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-11","IsSuccess":1,"COLI_OrderStartDate":"2025-04-11"},{"VKey":1135638,"VName":"250411-LHC250130092(4.11 菲律宾4人北京西安 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1135638,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-11","IsSuccess":1,"COLI_OrderStartDate":"2025-04-11"},{"VKey":1114549,"VName":"250413-LHC240912040(4.13 澳洲4人京西上 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1114549,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-12","IsSuccess":1,"COLI_OrderStartDate":"2025-04-12"},{"VKey":1134815,"VName":"250412-LHC250125006(WA 4.13 菲律宾6人北京张家界 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1134815,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-12","IsSuccess":1,"COLI_OrderStartDate":"2025-04-12"},{"VKey":1109767,"VName":"250413-LHC240813029(4.14 美籍华人丝路新疆 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1109767,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-13","IsSuccess":1,"COLI_OrderStartDate":"2025-04-13"},{"VKey":1138076,"VName":"250415-LHC250214012(WA 4.15 墨西哥5星京西桂上 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1138076,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-15","IsSuccess":1,"COLI_OrderStartDate":"2025-04-15"},{"VKey":1116902,"VName":"250417-LHC240926040(4.17 意大利京西张桂上 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1116902,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-17","IsSuccess":1,"COLI_OrderStartDate":"2025-04-17"},{"VKey":1127599,"VName":"250418-LHC241206071(WA 4.18 老客人5星云南 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1127599,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-18","IsSuccess":1,"COLI_OrderStartDate":"2025-04-18"},{"VKey":1138390,"VName":"250418-LHC250216016(4.18 9人桂林一地 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1138390,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-18","IsSuccess":1,"COLI_OrderStartDate":"2025-04-18"},{"VKey":1129053,"VName":"250420-LHC241218024(4.19 塞尔维亚京西张桂上 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1129053,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-20","IsSuccess":1,"COLI_OrderStartDate":"2025-04-20"},{"VKey":1147711,"VName":"250420-LHC250409009(4.20 美国人成西京上 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1147711,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-20","IsSuccess":1,"COLI_OrderStartDate":"2025-04-20"},{"VKey":1096743,"VName":"250422-LHC240601010(4.22 美国4人京西成熊猫四姑娘山 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1096743,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-22","IsSuccess":1,"COLI_OrderStartDate":"2025-04-22"},{"VKey":1138355,"VName":"250422-LHC250216014(4.22 比利时人北京一地 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1138355,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-22","IsSuccess":1,"COLI_OrderStartDate":"2025-04-22"},{"VKey":1145009,"VName":"250426-LHC250325033(4.26 老客人北京一地 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1145009,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-26","IsSuccess":1,"COLI_OrderStartDate":"2025-04-26"},{"VKey":1129188,"VName":"250427-LHC241219004(4.27 北京一地 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1129188,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-27","IsSuccess":1,"COLI_OrderStartDate":"2025-04-27"},{"VKey":1094804,"VName":"250430-LHC240520047(4.30 新加坡老客人云南2天 全款已付)","VParent":-4,"ImageIndex":13,"COLI_SN":1094804,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-04-30","IsSuccess":1,"COLI_OrderStartDate":"2025-04-30"},{"VKey":1086829,"VName":"250505-LHC240406029(WA 5.5 老客人6人广东 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1086829,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-05","IsSuccess":1,"COLI_OrderStartDate":"2025-05-05"},{"VKey":1115111,"VName":"250505-LHC240915012(WA 5.5 美籍印度12人京西张桂上 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1115111,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-05","IsSuccess":1,"COLI_OrderStartDate":"2025-05-05"},{"VKey":1126002,"VName":"250505-LHC241125135(5.4 美国人14天5星儿子在武汉 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1126002,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-05","IsSuccess":1,"COLI_OrderStartDate":"2025-05-05"},{"VKey":1118669,"VName":"250509-LHC241008014(5.9 老客人推荐葡萄牙人15天 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1118669,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-09","IsSuccess":1,"COLI_OrderStartDate":"2025-05-09"},{"VKey":1129906,"VName":"250509-LHC241225014(WA 5.9 美国12人上云南桂 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1129906,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-09","IsSuccess":1,"COLI_OrderStartDate":"2025-05-09"},{"VKey":1143938,"VName":"250509-LHC250319084(WX 5.8 美国老客人长线 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1143938,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-09","IsSuccess":1,"COLI_OrderStartDate":"2025-05-09"},{"VKey":1106928,"VName":"250510-LHC240726046(WA 5.10 美国老客人中国香港越南 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1106928,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-10","IsSuccess":1,"COLI_OrderStartDate":"2025-05-10"},{"VKey":1122673,"VName":"250410-LHC241104135(WX 5.11 老客人西安北京 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1122673,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-11","IsSuccess":1,"COLI_OrderStartDate":"2025-05-11"},{"VKey":1106493,"VName":"250421-LHC240723070(WA 5.14 老客人湖南 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1106493,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-14","IsSuccess":1,"COLI_OrderStartDate":"2025-05-14"},{"VKey":1143709,"VName":"250514-LHC250318037(WA 5.14 桂林一地 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1143709,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-14","IsSuccess":1,"COLI_OrderStartDate":"2025-05-14"},{"VKey":1134816,"VName":"250515-LHC250125007(5.15 意大利人京西成贵张上 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1134816,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-15","IsSuccess":1,"COLI_OrderStartDate":"2025-05-15"},{"VKey":1127982,"VName":"250516-LHC241209102(5.16 老客人天津山东东北 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1127982,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-16","IsSuccess":1,"COLI_OrderStartDate":"2025-05-16"},{"VKey":1151792,"VName":"250518-LHC250430100(WA 5.18 老客人推荐北京西安 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1151792,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-18","IsSuccess":1,"COLI_OrderStartDate":"2025-05-18"},{"VKey":1140658,"VName":"250524-LHC250302012(5.24 美国人京西桂上 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1140658,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-24","IsSuccess":1,"COLI_OrderStartDate":"2025-05-24"},{"VKey":1036416,"VName":"250525-LHC231031091(5.25 湖南2人 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1036416,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-25","IsSuccess":1,"COLI_OrderStartDate":"2025-05-25"},{"VKey":1061633,"VName":"250527-LHC240125045(5.27 卢森堡张家界桂林 全款已付)","VParent":-5,"ImageIndex":13,"COLI_SN":1061633,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-05-27","IsSuccess":1,"COLI_OrderStartDate":"2025-05-27"},{"VKey":1157023,"VName":"250603-LHC250527101(6.3 老客人广州一地 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1157023,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-03","IsSuccess":1,"COLI_OrderStartDate":"2025-06-03"},{"VKey":1126193,"VName":"250531-LHC241127004(WA 6.4 骆老客人推荐8个新马人去新疆 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1126193,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-04","IsSuccess":1,"COLI_OrderStartDate":"2025-06-04"},{"VKey":1145376,"VName":"250607-LHC250327060(WA 6.7 老客人推荐九寨沟张家界 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1145376,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-07","IsSuccess":1,"COLI_OrderStartDate":"2025-06-07"},{"VKey":1136429,"VName":"250610-LHC250204114(WA 6.10 老客人新疆 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1136429,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-10","IsSuccess":1,"COLI_OrderStartDate":"2025-06-10"},{"VKey":1133294,"VName":"250612-LHC250115090(WA 6.12 美华日本 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1133294,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-12","IsSuccess":1,"COLI_OrderStartDate":"2025-06-12"},{"VKey":1134944,"VName":"250613-LHC250126065(6.13 意大利5星京西成上港 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1134944,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-13","IsSuccess":1,"COLI_OrderStartDate":"2025-06-13"},{"VKey":1141141,"VName":"250614-LHC250304034(6.14 美籍印度6人京西桂港 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1141141,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-14","IsSuccess":1,"COLI_OrderStartDate":"2025-06-14"},{"VKey":1130127,"VName":"250615-LHC241226069(WA 6.15 老客人重庆送三峡 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1130127,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-15","IsSuccess":1,"COLI_OrderStartDate":"2025-06-15"},{"VKey":1132507,"VName":"250616-LHC250111012(WA 6.14 新加坡家庭京西桂上 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1132507,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-16","IsSuccess":1,"COLI_OrderStartDate":"2025-06-16"},{"VKey":1153428,"VName":"250616-LHC250509099(WA 6.16 老客人推荐成都一地 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1153428,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-16","IsSuccess":1,"COLI_OrderStartDate":"2025-06-16"},{"VKey":1133201,"VName":"250621-LHC250115033(WA 6.21 美华一家7人5星20天 全款已付)","VParent":-6,"ImageIndex":13,"COLI_SN":1133201,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-06-21","IsSuccess":1,"COLI_OrderStartDate":"2025-06-21"},{"VKey":1095489,"VName":"250626-LHC240523076(7.1 老客人西安河南山东杭州 全款已付)","VParent":-7,"ImageIndex":13,"COLI_SN":1095489,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-07-01","IsSuccess":1,"COLI_OrderStartDate":"2025-07-01"},{"VKey":1120738,"VName":"250703-LHC241022034(WA 7.2 巴西3人京西成张上深港 全款已付)","VParent":-7,"ImageIndex":13,"COLI_SN":1120738,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-07-03","IsSuccess":1,"COLI_OrderStartDate":"2025-07-03"},{"VKey":1122337,"VName":"250706-LHC241102048(WA 7.7 京西上奶爸+4娃5星 全款已付)","VParent":-7,"ImageIndex":13,"COLI_SN":1122337,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-07-07","IsSuccess":1,"COLI_OrderStartDate":"2025-07-07"},{"VKey":1141434,"VName":"250708-LHC250305056(WA 7.8 美华5人云南 余款6.8)","VParent":-7,"ImageIndex":13,"COLI_SN":1141434,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-07-08","IsSuccess":1,"COLI_OrderStartDate":"2025-07-08"},{"VKey":1150871,"VName":"250709-LHC250425066(WA 7.8 肯尼亚印度人长线 余款6.8)","VParent":-7,"ImageIndex":13,"COLI_SN":1150871,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-07-09","IsSuccess":1,"COLI_OrderStartDate":"2025-07-09"},{"VKey":1115058,"VName":"250708-LHC240915011(7.8 英国人港上西京 余款6.8)","VParent":-7,"ImageIndex":13,"COLI_SN":1115058,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-07-10","IsSuccess":1,"COLI_OrderStartDate":"2025-07-10"},{"VKey":1156028,"VName":"250710-LHC250522082(WA 7.14 京西张墨西哥 余款6.14)","VParent":-7,"ImageIndex":13,"COLI_SN":1156028,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-07-10","IsSuccess":1,"COLI_OrderStartDate":"2025-07-10"},{"VKey":1135144,"VName":"250714-LHC250127018(WX 7.14 老客人云南 余款6.14)","VParent":-7,"ImageIndex":13,"COLI_SN":1135144,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-07-14","IsSuccess":1,"COLI_OrderStartDate":"2025-07-14"},{"VKey":1137033,"VName":"250808-LHC250208015(WA 8.8 意大利4人19天 余款7.8)","VParent":-8,"ImageIndex":13,"COLI_SN":1137033,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-08-08","IsSuccess":1,"COLI_OrderStartDate":"2025-08-08"},{"VKey":1121825,"VName":"250809-LHC241029090(WA 8.9 马耳他3周FB来单 余款7.9)","VParent":-8,"ImageIndex":13,"COLI_SN":1121825,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-08-09","IsSuccess":1,"COLI_OrderStartDate":"2025-08-09"},{"VKey":1152564,"VName":"250815-LHC250506139(WA 8.15 印度高端5星上张京 余款7.15)","VParent":-8,"ImageIndex":13,"COLI_SN":1152564,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-08-15","IsSuccess":1,"COLI_OrderStartDate":"2025-08-15"},{"VKey":1119643,"VName":"250828-LHC241014149(WA 8.28 老客人四川云南12天 余款7871 7.28)","VParent":-8,"ImageIndex":13,"COLI_SN":1119643,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-08-28","IsSuccess":1,"COLI_OrderStartDate":"2025-08-28"},{"VKey":1129858,"VName":"250831-LHC241224003(8.30 美国人京西上 余款7.30)","VParent":-8,"ImageIndex":13,"COLI_SN":1129858,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-08-31","IsSuccess":1,"COLI_OrderStartDate":"2025-08-31"},{"VKey":1123254,"VName":"250908-LHC241108084(9.8 老客人新疆+上海5星 余款8.8)","VParent":-9,"ImageIndex":13,"COLI_SN":1123254,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-09-07","IsSuccess":1,"COLI_OrderStartDate":"2025-09-07"},{"VKey":1132436,"VName":"250912-LHC250110047(9.11 意大利语老客人成都西安 余款8.10)","VParent":-9,"ImageIndex":13,"COLI_SN":1132436,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-09-12","IsSuccess":1,"COLI_OrderStartDate":"2025-09-12"},{"VKey":1131881,"VName":"251009-LHC250107061(10.10 美籍印度人京西桂上 余款9.10)","VParent":-10,"ImageIndex":13,"COLI_SN":1131881,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-10-09","IsSuccess":1,"COLI_OrderStartDate":"2025-10-09"},{"VKey":1127765,"VName":"251010-LHC241208010(10.10 斯洛伐克北京西安5星 余款9.10)","VParent":-10,"ImageIndex":13,"COLI_SN":1127765,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-10-10","IsSuccess":1,"COLI_OrderStartDate":"2025-10-10"},{"VKey":1146482,"VName":"251010-LHC250402029(10.10 美国2人深度游览古镇 余款9.10)","VParent":-10,"ImageIndex":13,"COLI_SN":1146482,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-10-10","IsSuccess":1,"COLI_OrderStartDate":"2025-10-10"},{"VKey":1122286,"VName":"251011-LHC241102005(10.11 德国人京西张桂上 余款9.11)","VParent":-10,"ImageIndex":13,"COLI_SN":1122286,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-10-11","IsSuccess":1,"COLI_OrderStartDate":"2025-10-11"},{"VKey":1143898,"VName":"251015-LHC250319026(10.15 美国京西上 余款9.15)","VParent":-10,"ImageIndex":13,"COLI_SN":1143898,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-10-15","IsSuccess":1,"COLI_OrderStartDate":"2025-10-15"},{"VKey":1150171,"VName":"251018-LHC250421121(WX 10.18 老客人solo桂林 余款9.18)","VParent":-10,"ImageIndex":13,"COLI_SN":1150171,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-10-18","IsSuccess":1,"COLI_OrderStartDate":"2025-10-18"},{"VKey":1088497,"VName":"251019-LHC240416069(WA 10.18 马来老客人16人四川深度游 余款9.18)","VParent":-10,"ImageIndex":13,"COLI_SN":1088497,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-10-19","IsSuccess":1,"COLI_OrderStartDate":"2025-10-19"},{"VKey":1146889,"VName":"261028-LHC250404015(10.29 西班牙6人15天含云南 余款9.29)","VParent":-10,"ImageIndex":13,"COLI_SN":1146889,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-10-29","IsSuccess":1,"COLI_OrderStartDate":"2025-10-29"},{"VKey":1154788,"VName":"251102-LHC250516014(WA 11.2 老客人推荐5星加拿大教授 余款10.2)","VParent":-11,"ImageIndex":13,"COLI_SN":1154788,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-11-02","IsSuccess":1,"COLI_OrderStartDate":"2025-11-02"},{"VKey":1147361,"VName":"251108-LHC250407085(11月 老客人云南 通用券USD50.0可用,生日券USD200.0可用,老客户券USD71.0可用 总计:USD321.0)","VParent":-11,"ImageIndex":13,"COLI_SN":1147361,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-11-08","IsSuccess":1,"COLI_OrderStartDate":"2025-11-08"},{"VKey":1082730,"VName":"251111-LHC240320059(11.11 美国人北京香港 余款10.10)","VParent":-11,"ImageIndex":13,"COLI_SN":1082730,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-11-11","IsSuccess":1,"COLI_OrderStartDate":"2025-11-11"},{"VKey":1108702,"VName":"250905-LHC240806092(11.17 老客人三峡张家界 余款10.17)","VParent":-11,"ImageIndex":13,"COLI_SN":1108702,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-11-17","IsSuccess":1,"COLI_OrderStartDate":"2025-11-17"},{"VKey":1150732,"VName":"251128-LHC250424096(WA 11.28 老客人上海苏州 余款10.28)","VParent":-11,"ImageIndex":13,"COLI_SN":1150732,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-11-28","IsSuccess":1,"COLI_OrderStartDate":"2025-11-28"},{"VKey":1156704,"VName":"251204-LHC250526111(WA 12.4 澳洲5人京上 余款11.4)","VParent":-12,"ImageIndex":13,"COLI_SN":1156704,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-12-04","IsSuccess":1,"COLI_OrderStartDate":"2025-12-04"},{"VKey":1129904,"VName":"(12.1 老客人西藏 余款11.1)","VParent":-12,"ImageIndex":13,"COLI_SN":1129904,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-12-05","IsSuccess":1,"COLI_OrderStartDate":"2025-12-05"},{"VKey":1150117,"VName":"251207-LHC250421084(WA 12月 老客人成都九寨沟 老客户券USD166.0可用 总计:RMB1206.0)","VParent":-12,"ImageIndex":13,"COLI_SN":1150117,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-12-07","IsSuccess":1,"COLI_OrderStartDate":"2025-12-07"},{"VKey":1151334,"VName":"251220-LHC250428004(12.20 老客人成都重庆 余款11.20 翻倍券USD34.0可用 总计:USD34.0)","VParent":-12,"ImageIndex":13,"COLI_SN":1151334,"OrderSourceType":227001,"IsTrue":0,"ApplyDate":"2025-12-20","IsSuccess":1,"COLI_OrderStartDate":"2025-12-20"}]; + return list; + const { errcode, result } = await fetchJSON(`${EMAIL_HOST}/v3/email_dir`, params); return errcode === 0 ? [] : result; } ; @@ -218,16 +154,9 @@ export const getEmailDirAction = async (params = { opi_sn: '' }) => { * @usage 订单的邮件列表 * @usage 高级搜索 */ -export const queryEmailListAction = async (params = { opi_sn: '', pagesize: 10, last_id: '', query: {}, order: {} }) => { - const { errcode, result } = await postJSON(`${EMAIL_HOST}/email/list`, params) - return errcode === 0 ? [] : result -} - -/** - * 获取收件箱下的订单目录 - */ -export const getEmailOrderListAction = async (params = { opi_sn: '', ordertype: 227001 }) => { - const { errcode, result } = await fetchJSON(`${EMAIL_HOST}/email/order`, params) +export const queryEmailListAction = async ({ opi_sn= '', pagesize= 10, last_id= '', query={}, order= {} }={}) => { + const _params = { ...order, ...query, opi_sn } + const { errcode, result } = await postJSON(`${EMAIL_HOST}/v3/mail_list`, _params) return errcode === 0 ? [] : result } diff --git a/src/assets/icons/archive-2-line.svg b/src/assets/icons/archive-2-line.svg new file mode 100644 index 0000000..9d6b0b9 --- /dev/null +++ b/src/assets/icons/archive-2-line.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/Icons.jsx b/src/components/Icons.jsx index d093358..d09ddf6 100644 --- a/src/components/Icons.jsx +++ b/src/components/Icons.jsx @@ -16,6 +16,7 @@ import MailDownloadLineSVG from '@/assets/icons/mail-download-line.svg?react'; import MailAddLineSVG from '@/assets/icons/mail-add-line.svg?react'; import MailCheckSVG from '@/assets/icons/mail-check-line.svg?react'; import MailUnreadSVG from '@/assets/icons/mail-unread-line.svg?react'; +import MailArchiveSVG from '@/assets/icons/archive-2-line.svg?react'; import TextSVG from '@/assets/icons/text.svg?react'; @@ -34,6 +35,7 @@ export const MailDownloadIcon = (props) => ; export const MailCheckIcon = (props) => ; export const MailUnreadIcon = (props) => ; +export const MailArchiveIcon = (props) => ; export const TextIcon = (props) => ; diff --git a/src/stores/OrderStore.js b/src/stores/OrderStore.js index 82d0afa..5db191f 100644 --- a/src/stores/OrderStore.js +++ b/src/stores/OrderStore.js @@ -2,7 +2,7 @@ import { create } from 'zustand' import { devtools } from 'zustand/middleware' import { fetchJSON, postForm } from '@/utils/request' import { API_HOST, EMAIL_HOST } from '@/config' -import { isNotEmpty, prepareUrl } from '@/utils/commons' +import { isNotEmpty, prepareUrl, uniqWith } from '@/utils/commons' const initialState = { orderList: [], @@ -45,8 +45,10 @@ export const useOrderStore = create(devtools((set, get) => ({ return fetchJSON(fetchOrderUrl, params) .then(json => { if (json.errcode === 0) { + const _result = json.result.map((order) => { return { ...order, key: order.COLI_ID } }) + const _result_unique = uniqWith(_result, (a, b) => a.COLI_SN === b.COLI_SN) set(() => ({ - orderList: json.result.map((order) => { return { ...order, key: order.COLI_ID } }), + orderList: _result_unique, })) } else { throw new Error(json?.errmsg + ': ' + json.errcode) diff --git a/src/utils/commons.js b/src/utils/commons.js index fd64c59..e79db44 100644 --- a/src/utils/commons.js +++ b/src/utils/commons.js @@ -592,6 +592,66 @@ export const TagColorStyle = (tag, outerStyle = false) => { return { color: `${color}`, ...outerStyleObj }; }; +// 数组去掉重复 +export function unique(arr) { + const x = new Set(arr); + return [...x]; +} +export const uniqWith = (arr, fn) => arr.filter((element, index) => arr.findIndex((step) => fn(element, step)) === index); + +/** + * Creates a new tree node object. + * @param {string} key - The unique identifier for the node. + * @param {string} name - The display name of the node. + * @param {string|null} parent - The key of the parent node, or null if it's a root. + * @returns {object} A plain JavaScript object representing the tree node. + */ +function createTreeNode(key, name, parent = null, _raw={}) { + return { + key: key, + title: name, + parent: parent, + icon: _raw?.icon, + _raw: _raw, + children: [] + }; +} +/** + * Builds a tree structure from a flat list of nodes. + * @returns {Array} An array of root tree nodes. + */ +export const buildTree = (list, keyMap={}) => { + if (!list || list.length === 0) { + return [] + } + + const nodeMap = new Map() + const treeRoots = [] + + list.forEach((item) => { + const node = createTreeNode(item[keyMap.key], item[keyMap.name], item[keyMap.parent], item) + nodeMap.set(item[keyMap.key], node) + }) + + list.forEach((item) => { + const node = nodeMap.get(item[keyMap.key]) + if (item[keyMap.parent] === keyMap.rootKey || item[keyMap.parent] === 0 || item[keyMap.parent] === 1 || item[keyMap.parent] === null || item[keyMap.parent] === undefined) { + // This is a root node + treeRoots.push(node) + } else { + const parentNode = nodeMap.get(item[keyMap.parent]) + if (parentNode) { + parentNode.children.push(node) + } else { + console.warn(`Parent with key '${item[keyMap.parent]}' not found for node '${item[keyMap.key]}'. This node will be treated as a root.`) + treeRoots.push(node) + } + } + }) + + return treeRoots +} + /** * */ @@ -835,3 +895,4 @@ function cleanOldData(database, storeName, dateKey = 'timestamp') { } export const clean7DaysWebsocketLog = cleanOldData('LogWebsocketData', 'LogStore'); + diff --git a/src/views/orders/Follow.jsx b/src/views/orders/Follow.jsx index 197b661..b5b2a46 100644 --- a/src/views/orders/Follow.jsx +++ b/src/views/orders/Follow.jsx @@ -1,88 +1,44 @@ -import { Conditional } from '@/components/Conditional' import useAuthStore from '@/stores/AuthStore' -import { PERM_IMPORT_EMAIL } from '@/stores/AuthStore' import useFormStore from '@/stores/FormStore' import { useOrderStore } from '@/stores/OrderStore' -import { copy, isNotEmpty, isEmpty, groupBy, cloneDeep, sortBy, sortArrayByOrder } from '@/utils/commons' -import { - WhatsAppOutlined, - ImportOutlined, - FileAddOutlined, - StarTwoTone, - StarOutlined, - MailOutlined, - PhoneOutlined, - UserOutlined, - FieldNumberOutlined, - SaveOutlined, - PlusOutlined, - SearchOutlined, - ReloadOutlined, - ReadOutlined, - CompassOutlined, - CheckSquareTwoTone, - CarryOutTwoTone, - CheckSquareOutlined, - MailTwoTone, - BookTwoTone, - RightSquareTwoTone, - SwitcherTwoTone, - FolderTwoTone, - CalendarTwoTone, - CalendarOutlined, - HeartTwoTone, - MoneyCollectTwoTone, FolderOutlined, DeleteOutlined, - SendOutlined, - ClockCircleOutlined, - FormOutlined, -} from '@ant-design/icons' -import { - App, - Badge, - Empty, - Flex, - Button, - Drawer, - Space, - Radio, - Table, - Tabs, - Divider, - Tag, - Tooltip, - List, - Dropdown, - Segmented, - Tree, - Typography, - Input, - Descriptions, - Checkbox, - Layout, - Row, - Col, -} from 'antd' -import dayjs from 'dayjs' -import { useCallback, useEffect, useState } from 'react' -import { InboxIcon, MailCheckIcon, MailUnreadIcon, SendPlaneFillIcon } from '@/components/Icons' -import { Link } from 'react-router-dom' +import { isEmpty, groupBy, buildTree } from '@/utils/commons' +import { StarTwoTone, CalendarTwoTone, FolderOutlined, DeleteOutlined, ClockCircleOutlined, FormOutlined, DatabaseOutlined } from '@ant-design/icons' +import { Flex, Drawer, Radio, Divider, Segmented, Tree, Typography, Checkbox, Layout, Row, Col } from 'antd' +import { useEffect, useMemo, useState } from 'react' +import { InboxIcon, MailUnreadIcon, SendPlaneFillIcon } from '@/components/Icons' import { useShallow } from 'zustand/react/shallow' -import { UNREAD_MARK } from '@/actions/ConversationActions' -import AdvanceSearchForm from './AdvanceSearchForm' import EmailDetailInline from '../Conversations/Online/Components/EmailDetailInline' -import { getEmailDirAction } from '@/actions/EmailActions' +import { getEmailDirAction, queryEmailListAction } from '@/actions/EmailActions' import OrderProfile from '@/components/OrderProfile' import Mailbox from './components/Mailbox' const EmailDirTypeIcons = { - '0': { component: FolderOutlined, color: '#ffe78f', className: 'text-blue-500' }, - '1': { component: InboxIcon, color: '', className: 'text-indigo-500' }, - '2': { component: MailUnreadIcon, color: '', className: 'text-indigo-500' }, - '3': { component: SendPlaneFillIcon, color: '', className: 'text-primary' }, - '4': { component: ClockCircleOutlined, color: '', className: 'text-yellow-500' }, - '5': { component: FormOutlined, color: '', className: 'text-blue-500' }, - '6': { component: DeleteOutlined, color: '', className: 'text-red-500' }, - '7': { component: MailCheckIcon, color: '', className: 'text-yellow-600' }, + 0: { component: FolderOutlined, color: '#ffe78f', className: 'text-blue-500' }, + 1: { component: FolderOutlined, color: '#ffe78f', className: 'text-blue-500' }, + 3: { component: InboxIcon, color: '', className: 'text-indigo-500' }, + 17: { component: InboxIcon, color: '', className: 'text-indigo-500' }, + 11: { component: MailUnreadIcon, color: '', className: 'text-indigo-500' }, + 4: { component: SendPlaneFillIcon, color: '', className: 'text-primary' }, + 2: { component: ClockCircleOutlined, color: '', className: 'text-yellow-500' }, + 5: { component: FormOutlined, color: '', className: 'text-blue-500' }, + 7: { component: DeleteOutlined, color: '', className: 'text-red-500' }, + // '3': { component: MailCheckIcon, color: '', className: 'text-yellow-600' }, + 12: { component: DatabaseOutlined, color: '', className: 'text-blue-600' }, + 13: { component: () => null, color: '', className: '' }, + 14: { component: () => '❗', color: '', className: '' }, // 240002 较重要/高品牌价值客户 + 15: { component: () => '❣️', color: '', className: '' }, // 240003 很重要/高订单价值客户 +} + +const todoTypes = { + // 1新订单;2未读消息;3需一催;4需二催;5需三催;6未处理邮件;入境提醒coli_ordertype=7,余款提醒coli_ordertype=8 + 1: '新订单', + 2: '未读', + 3: '一催', + 4: '二催', + 5: '三催', + 6: '未处理', + 7: '入境提醒', + 8: '余款提醒', } const deptMap = new Map([ @@ -118,8 +74,6 @@ const deptMap = new Map([ ['35', 'newsletter营销'], ]) -function OrderGroupTable({ formValues }) {} - function Follow() { const orderList = useOrderStore((state) => state.orderList) const fetchOrderList = useOrderStore((state) => state.fetchOrderList) @@ -127,118 +81,187 @@ function Follow() { const [openOrder, setOpenOrder] = useState(false) const [collapsed, setCollapsed] = useState(false) - const [formValues, setFormValues] = useFormStore(useShallow((state) => [state.orderFollowForm, state.setOrderFollowForm])) - const [advanceChecked, toggleAdvance] = useFormStore(useShallow((state) => [state.orderFollowAdvanceChecked, state.setOrderFollowAdvanceChecked])) - - const batchImportEmailMessage = useOrderStore((state) => state.batchImportEmailMessage) const [loginUser, isPermitted] = useAuthStore((state) => [state.loginUser, state.isPermitted]) - - const handleImportEmail = useCallback(() => { - batchImportEmailMessage() - }, []) - - const handleSubmit = useCallback((values) => { - setFormValues({ ...values, type: 'advance' }) - }, []) + const { accountList } = loginUser + const accountListDEIMapped = useMemo(() => accountList.reduce((a, c) => ({ ...a, [c.OPI_DEI_SN]: c }), {}), [accountList]) + const accountDEI = useMemo(() => { + return accountList.map((ele) => ({ key: ele.OPI_DEI_SN, value: ele.OPI_DEI_SN, label: deptMap.get(`${ele.OPI_DEI_SN}`) })) + }, [accountList]) + const defaultStickyTree = useMemo(() => { + return accountList.reduce( + (a, ele) => ({ + ...a, + [ele.OPI_DEI_SN]: [ + { + title: '今日任务', + key: ele.OPI_DEI_SN + '-today', + getMails: false, + icon: , + children: [], + }, + { + title: '待办任务', + key: ele.OPI_DEI_SN + '-todo', + getMails: false, + icon: , + children: [], + }, + ], + }), + {}, + ) + }, [accountList]) const [activeEmailId, setActiveEmailId] = useState(0) - const [mailboxDir, setMailboxDir] = useState([]); + const [mailboxDir, setMailboxDir] = useState([]) const DirTypeIcon = ({ type }) => { - const Icon = EmailDirTypeIcons[type || '0'].component - const className = EmailDirTypeIcons[type || '0'].className + const Icon = EmailDirTypeIcons[type || '0']?.component || EmailDirTypeIcons['0'].component + const className = EmailDirTypeIcons[type || '0']?.className || EmailDirTypeIcons['0'].className return } - const getOPIEmailDir = async (opi_sn=0) => { + const getOPIEmailDir = async (opi_sn = 0) => { + console.log('🌐requesting opi dir', opi_sn) const x = await getEmailDirAction(opi_sn) - const mailboxSort = x.sort(sortBy('MDR_Order')); + const mailboxSort = x //.sort(sortBy('MDR_Order')); const dirs = mailboxSort.map((ele) => { - return { ...ele, key: ele.MDR_SN, title: ele.MDR_Name, icon: } + return { ...ele, icon: ele.ImageIndex !== void 0 ? : false } }) - setMailboxDir(dirs) + let tree = buildTree(dirs, { key: 'VKey', parent: 'VParent', name: 'VName', rootKey: 1 }) + tree = tree.filter((ele) => ele.key !== 1) + // console.log(tree) + setMailboxDir(tree) + const level1 = tree.filter((ele) => !isEmpty(ele.children)).map((ele) => ele.key) + setExpandTree((pre) => [...pre, ...level1]) + } + + const getMailList = async ({ query, order }) => { + const opi_sn = accountListDEIMapped[activeAccount].OPI_SN + const x = await queryEmailListAction({ opi_sn, query, order }) + } + + const [deiStickyTree, setDeiStickyTree] = useState({}) + const [stickyTree, setStickyTree] = useState([]) + const [expandTree, setExpandTree] = useState([]) + const [activeAccount, setActiveAccount] = useState() + const handleSwitchAccount = (value) => { + setActiveAccount(value) + setStickyTree(deiStickyTree[value] || []) + setExpandTree([`${value}-today`, `${value}-todo`]) + const opi = accountListDEIMapped[value].OPI_SN + getOPIEmailDir(opi) + } + + const handleTreeSelectGetMails = (selectedKeys, { node }) => { + // console.info('selectedKeys: ', selectedKeys, node) + if (node?.COLI_SN || node?._raw?.COLI_SN) { + // 固定列表; 邮箱文件夹 + // get order mails + // console.log('get order mails', { order: { coli_sn: node?.COLI_SN || node?._raw?.COLI_SN, order_source_type: node?._raw?.OrderSourceType || 227001, vkey: node.key } }) + getMailList({ order: { coli_sn: node?.COLI_SN || node?._raw?.COLI_SN, order_source_type: node?._raw?.OrderSourceType || 227001, vkey: node.key } }) + } else if ([-227001, -227002].includes(node.key) || [-227001, -227002].includes(node.parent) || node?.getMails === false) { + // nothing, expand only + console.log('nothing') + } else { + // get mail list + console.log('get mail list') + getMailList({ query: { vkey: selectedKeys[0] } }) + } } - const [stickyTreeData, setStickyTreeData] = useState([{ title: '今日任务', key: 'today' }, { title: '待办任务', key: 'todo' }]); - const [deiStickyTree, setDeiStickyTree] = useState({}); useEffect(() => { fetchOrderList({ type: 'today' }, loginUser) - getOPIEmailDir(); + getOPIEmailDir() return () => {} }, []) // 1新订单;2未读消息;3需一催;4需二催;5需三催;6未处理邮件;入境提醒coli_ordertype=7,余款提醒coli_ordertype=8 useEffect(() => { - const byDEI = groupBy(orderList, 'OPI_DEI_SN'); + const byDEI = groupBy(orderList, 'OPI_DEI_SN') // console.log(byDEI, 'byDEI') const byState = Object.keys(byDEI).reduce((acc, key) => { // const stickyIndex0 = byDEI[key].filter(ele => [1, 2, 6].includes(ele.COLI_StateCode)) // const stickyIndex1 = byDEI[key].filter(ele => ![1, 2, 6].includes(ele.COLI_StateCode)) - const sticky = groupBy(byDEI[key], ele => [1, 2, 6].includes(ele.COLI_StateCode) ? 0 : 1); + const sticky = groupBy(byDEI[key], (ele) => ([1, 2, 6].includes(ele.coli_ordertype) ? 0 : 1)) // const sticky = groupBy(byDEI[key], ele => [1, 2, 6].includes(ele.COLI_StateCode) ? 'today' : 'todo'); // console.log(sticky, ';;;;'); - const deiName = deptMap.get(`${key}`); - const treeNode = [{ title: '今日任务', key: 'today', icon: ,children: (sticky[0]||[]).map(o => ({...o, key: o.COLI_SN, title: `(${o.COLI_State})${o.COLI_ID}`})) }, { title: '待办任务', key: 'todo', icon: ,children: (sticky[1] || []).map(o => ({...o, key: o.COLI_SN, title: `(${o.COLI_State})${o.COLI_ID}`})) }]; + // const deiName = deptMap.get(`${key}`); + const treeNode = [ + { + title: '今日任务', + key: key + '-today', + getMails: false, + icon: , + children: (sticky[0] || []).map((o) => ({ ...o, key: o.COLI_SN, title: `(${todoTypes[o.coli_ordertype] || o.COLI_State}) ${o.COLI_ID}` })), + }, + { + title: '待办任务', + key: key + '-todo', + getMails: false, + icon: , + children: (sticky[1] || []).map((o) => ({ ...o, key: o.COLI_SN, title: `(${todoTypes[o.coli_ordertype] || o.COLI_State}) ${o.COLI_ID}` })), + }, + ] // { key, title: deiName, children: sticky[0] }; - return {...acc, [key]: treeNode}; - }, {}); - setDeiStickyTree(byState); - console.log(byState, 'byState') - + return { ...acc, [key]: treeNode } + }, defaultStickyTree) + setDeiStickyTree(byState) + const first = accountDEI[0].value + setExpandTree([`${first}-today`, `${first}-todo`]) + setStickyTree(byState[first] || []) - return () => { - - } + return () => {} }, [orderList]) - - return ( <> - - - - { - console.info('selectedKeys: ', selectedKeys) - }} - defaultExpandedKeys={['0-0-today-task', '0-1-todo-list']} - defaultSelectedKeys={['0-0-0']} - treeData={[...deiStickyTree['28']||deiStickyTree['30']||[], ...mailboxDir] - - } - /> + + + + + setExpandTree(expandedKeys)} + expandedKeys={expandTree} + defaultExpandedKeys={expandTree} + defaultSelectedKeys={['today']} + treeData={[...(stickyTree || []), ...mailboxDir]} + titleRender={(node) => {node.title}} + /> + - - {/* }, - onClick={() => console.info('item: ', item)} - title={ setSubject(item.title)}>{item.title}} */} + - - - - - - + + + + - setCollapsed(value)} collapsedWidth={0} reverseArrow={true}> - - + setCollapsed(value)} + collapsedWidth={0} + reverseArrow={true}> + +