{"version":3,"file":"interface.5048b7c9.js","sources":["../../src/pages/order/interface.ts"],"sourcesContent":["import {ISelect} from \"@/components/Select/helper\";\r\n\r\n\r\nexport interface IOrderItem {\r\n topPath: ITopPath;\r\n business: string;\r\n fee: IFee;\r\n status: string;\r\n}\r\n\r\nexport interface IFee {\r\n fee: number;\r\n weight: number;\r\n count: number;\r\n}\r\n\r\nexport interface ITopPath {\r\n from: string;\r\n to: string;\r\n topType: string;\r\n}\r\n// 订单状态\r\nexport const orderStatMap = {\r\n 0: '全部',\r\n 20: '国内待取',\r\n 40: '国内在途',\r\n 60: '国内签收',\r\n 80: '海外发货',\r\n 90: '延误',\r\n 91: '丢货',\r\n 92: '签收未上架',\r\n 100: '完成',\r\n 150: '已赔付',\r\n 200: '作废'\r\n}\r\n\r\nexport const payStatMap = {\r\n 0:'全部',\r\n 10:'未支付',\r\n 20:'已支付',\r\n 100:'已退款'\r\n}\r\n\r\n\r\nexport const getStatMap = (params: any) => {\r\n return Object.keys(params).reduce((result:ISelect[],i:string,index: number) => {\r\n result[index]={\r\n label: params[i],\r\n value: i\r\n }\r\n return result\r\n },[])\r\n}\r\n\r\n// 颜色\r\nexport const colorMap = {\r\n 1: '#FF5100',\r\n 2: '#999999',\r\n 3: '',\r\n 4: '',\r\n 5: '',\r\n 6: '',\r\n 7: '#45b97c',\r\n 97:'',\r\n 98:'#999999',\r\n 99:'#999999'\r\n}\r\n// 物流类型\r\n\r\nexport const logisticsMap = {\r\n 1: '快递',\r\n 2: '空派',\r\n 3: '海运',\r\n 4: '卡航',\r\n 5: '铁路'\r\n}\r\n\r\nexport const logisticsType = [\r\n {label: '快递', value: 1},\r\n {label: '空派', value: 2},\r\n {label: '海运', value: 3},\r\n {label: '卡航', value: 4},\r\n {label: '铁路', value: 5},\r\n]\r\n\r\nexport const getOrderStat = (source: any,type: number) => {\r\n let total: number = 0;\r\n const types:ISelect[] = type === 1 && getStatMap(orderStatMap) || getStatMap(payStatMap)\r\n return types.reduce((result:ISelect[],i:ISelect,index: number) => {\r\n let a = source.find((sub: any) => sub[type === 1 && 'orderState' || 'paymentState'] == i.value);\r\n if(a){\r\n result[index] = {\r\n ...i,\r\n count:a.count\r\n }\r\n result[0] = {\r\n ...types[0],\r\n count: total += Number(a?.count ?? 0)\r\n }\r\n } else {\r\n result[index] = i\r\n }\r\n return result\r\n }, [])\r\n}\r\n// 根据code 获取省市区名称\r\n// pid code | type 0 省市区 1市区 2 区\r\nexport const getCity = (params: { pid: string, type?: number, source: any }) => {\r\n const {pid = '', type = 0, source} = params\r\n return pid.split('/').reduce((result: string, item: string, index) => {\r\n if (index >= type) {\r\n result += source?.find?.((i: any) => i?.code === item)?.name ?? ''\r\n }\r\n return result\r\n }, '')\r\n}"],"names":["orderStatMap","payStatMap","getStatMap","params","Object","keys","reduce","result","i","index","label","value","logisticsMap","logisticsType","getOrderStat","source","type","total","types","a","find","sub","count","Number","getCity","pid","split","item","code","name"],"mappings":"kbAsBaA,GAAe,GACrB,kBACC,8BACA,8BACA,8BACA,8BACA,kBACA,kBACA,qCACC,mBACA,yBACA,gBAGIC,EAAa,GACpB,kBACC,wBACA,yBACC,sBAIKC,EAAa,AAACC,GAChBC,OAAOC,KAAKF,GAAQG,OAAO,CAACC,EAAiBC,EAASC,OAClDA,GAAO,CACVC,MAAOP,EAAOK,GACdG,MAAOH,GAEJD,GACT,IAkBOK,EAAe,GACrB,iBACA,iBACA,iBACA,iBACA,gBAGMC,EAAgB,CACzB,CAACH,MAAO,eAAMC,MAAO,GACrB,CAACD,MAAO,eAAMC,MAAO,GACrB,CAACD,MAAO,eAAMC,MAAO,GACrB,CAACD,MAAO,eAAMC,MAAO,GACrB,CAACD,MAAO,eAAMC,MAAO,IAGZG,EAAe,CAACC,EAAYC,IAAiB,IAClDC,GAAgB,OACdC,GAAkBF,IAAS,GAAKd,EAAWF,IAAiBE,EAAWD,SACtEiB,GAAMZ,OAAO,CAACC,EAAiBC,EAAUC,IAAkB,UAC1DU,GAAIJ,EAAOK,KAAK,AAACC,GAAaA,EAAIL,IAAS,GAAK,cAAgB,iBAAmBR,EAAEG,aACtFQ,MACQV,GAAS,OACTD,GADS,CAEZc,MAAMH,EAAEG,UAEL,GAAK,OACLJ,EAAM,IADD,CAERI,MAAOL,GAASM,OAAOJ,oBAAGG,QAAHH,OAAY,QAGhCV,GAASD,EAEbD,GACR,KAIMiB,EAAU,AAACrB,GAAwD,MACtE,CAACsB,MAAM,GAAIT,OAAO,EAAGD,UAAUZ,QAC9BsB,GAAIC,MAAM,KAAKpB,OAAO,CAACC,EAAgBoB,EAAclB,IAAU,iBAC9DA,IAASO,OACCD,0BAAQK,OAARL,qBAAe,AAACP,GAAWA,kBAAGoB,QAASD,KAAvCZ,cAA8Cc,OAA9Cd,OAAsD,IAE7DR,GACR"}