123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639 |
- <?php defined('BASEPATH') OR exit('No direct script access allowed');
- class Fullorder extends Start_Controller {
- public function __construct(){
- parent::__construct();
- $this->load->library('session');
- $this->load->_model('Model_fullorder','fullorder');
- $this->load->_model('Model_fullordertt','fullordertt');
- $this->load->_model('Model_fullorderexcel','fullorderexcel');
- $this->load->_model('Model_shop','shop');
- $this->load->_model('Model_typeclass','typeclass');
- $this->load->_model('Model_express','express');
- $this->load->_model('Model_country','country');
- $this->load->_model('Model_productdescribe','productdescribe');
- $this->load->_model('Model_customs','customs');
- $this->load->_model('Model_detailed','detailed');
- $this->load->_model('Model_productdescription','productdescription');
- $this->load->_model('Model_logistics','logistics');
- $this->load->_model('Model_hl','hl');
- $this->load->_model('Model_excel','excel');
- $this->load->_model('Model_warehouse','warehouse');
- $this->load->_model('Model_customer','customer');
- $this->load->_model('Model_user','user');
- $this->load->_model('Model_dhl','dhl');
- $this->load->_model('Model_ali','ali');
- $this->load->_model('Model_notice','notice');
- $this->load->_model('Model_api','api');
- $this->load->_model('Model_usps','usps');
- $this->load->_model('Model_fullorder_smt','fullorder_smt');
- $this->load->_model('Model_whlabel','whlabel');
- $this->load->_model('Model_reset','fullreset');
- $this->load->_model('Model_specialstock','specialstock');
- $this->load->_model('Model_systemwigsout','systemwigsout');
- $this->load->_model('Model_colourorderts','colourorderts');
- $this->load->_model('Model_paypal','paypal');
- $this->load->_model('Model_ck','ck');
- $this->load->_model('Model_weight','weight');
- $this->load->_model('Model_pay','pay');
- $this->load->_model('Model_setting','setting');
- $this->load->_model('Model_whlabel_fc','whlabel_fc');
- $this->load->_model('Model_transfer','transfer');
- $this->load->_model('Model_systemtransfer','systemtransfer');
- $this->load->_model('Model_power','power');
- $this->load->_model('Model_awlgx','awlgx');
- $this->load->_model('Model_fullorderhb','fullorderhb');
- $this->load->_model('Model_notice','notice');
- $this->load->_model('Model_producttitle','producttitle');
- $this->load->_model('Model_emaildata','emaildata');
- $this->load->_model('Model_afspaypal','afspaypal');
- $this->load->_model('Model_returngoods','returngoods');
- $this->load->_model('Model_message','message');
- $this->load->_model("Model_logic_order","logic_order");
- $this->load->_model("Model_logic_ding","logic_ding");
- $this->load->_model("Model_fullordererrors","fullordererrors");
- }
- //定义方法的调用规则 获取URI第二段值
- public function _remap($arg,$arg_array)
- {
- if($arg == 'add')//添加
- {
- $this->_add();
- }
- else if($arg == 'edit')//修改
- {
- $this->_edit($arg_array);
- }
- else if($arg == 'readonly')//修改
- {
- $this->_readonly($arg_array);
- }
- else if($arg == 'readlist')
- {
- $this->_readlist();
- }
- else if($arg == 'readlistdown')
- {
- $this->_readlistdown();
- }
- else if($arg == 'del')//修改
- {
- $this->_del();
- }
- else if($arg == 'price')//价格明细
- {
- $this->_price();
- }
- else if($arg == 'customs')
- {
- $this->_customs();
- }
- else if($arg == 'express')
- {
- $this->_express();
- }
- else if($arg == 'hl')
- {
- $this->_hl();
- }
- else if($arg == 'repeat')
- {
- $this->_repeat();
- }
- else if($arg == 'operation')
- {
- $this->_operation();
- }
- else if($arg == 'merge')
- {
- $this->_merge();
- }
- else if($arg == 'fmexcel')
- {
- $this->_fmexcel();
- }
- else if($arg == 'fdexcel')
- {
- $this->_fdexcel();
- }
- else if($arg == 'fdfexcel')
- {
- $this->_fdfexcel();
- }
- else if($arg == 'evaluate')
- {
- $this->_evaluate();
- }
- else if($arg == 'state')
- {
- $this->_state();
- }
- else if($arg == 'wl')
- {
- $this->_wl();
- }
- else if($arg == 'wlbz')
- {
- $this->_wlbz($arg_array);
- }
- else if($arg == 'review')
- {
- $this->_review();
- }
- else if($arg == 'black')
- {
- $this->_black();
- }
- else if($arg == 'ryf')
- {
- $this->_ryf();
- }
- else if($arg == 'expresstype')
- {
- $this->_expresstype();
- }
- else if($arg == 'fsstate')
- {
- $this->_fsstate();
- }
- else if($arg == 'power')
- {
- $this->_power();
- }
- else if($arg == 'error')
- {
- $this->_error();
- }
- else if($arg == 'yzaddress')
- {
- $this->_yzaddress();
- }
- else if($arg == 'return')
- {
- $this->_return();
- }
- else if($arg == 'clearreturn')
- {
- $this->_clearreturn();
- }
- else if($arg == 'ali')
- {
- $this->_ali();
- }
- else if($arg == 'dqpm')
- {
- $this->_dqpm();
- }
- else if($arg == 'ddpmdata')
- {
- $this->_ddpmdata($arg_array);
- }
- else if($arg == 'dqpmprovince')
- {
- $this->_dqpmprovince($arg_array);
- }
- else if($arg == 'ddpmexcel')
- {
- $this->_ddpmexcel($arg_array);
- }
- else if($arg == 'statedc')
- {
- $this->_statedc();
- }
- else if($arg == 'statedcwl')
- {
- $this->_statedcwl();
- }
- else if($arg == 'waybillemail')
- {
- $this->_waybillemail();
- }
- else if($arg == 'khdd')
- {
- $this->_khdd();
- }
- else if($arg == 'klarnadata')
- {
- $this->_klarnadata();
- }
- else if($arg == 'epod')
- {
- $this->_epod();
- }
- else if($arg == 'zw')
- {
- $this->_zw($arg_array);
- }
- else if($arg == 'thxz')
- {
- $this->_thxz($arg_array);
- }
- else if($arg == 'dcdxyz')
- {
- $this->_dcdxyz();
- }
- else if($arg == 'ddcf')
- {
- $this->_ddcf();
- }
- else if($arg == 'cf')
- {
- $this->_cf();
- }
- else
- {
- $this->_index();
- }
- }
- //管理
- public function _index()
- {
- $dt = 0;$fgshop = "shop = 0";$sid = 'id = 0';
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $usersp = explode('|',trim($user['shop'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- if($user['vip'] == 1)
- {
- $vip = 1;
- }
- else
- {
- $vip = 0;
- }
- }
- else
- {
- $vip = 0;
- header('Location: /');exit;
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $warehouse = $this->input->post('warehouse',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $shop = $this->input->post('shop',true);
- $source = $this->input->post('source',true);
- $state = $this->input->post('state',true);
- $review = $this->input->post('review',true);
- $type = $this->input->post('type',true);
- $express = $this->input->post('express',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $user = $this->input->post('user',true);
- $client = $this->input->post('name',true);
- $waybill = $this->input->post('waybill',true);
- $number = $this->input->post('number',true);
- $email = $this->input->post('email',true);
- $phone = $this->input->post('phone',true);
- $dlz = $this->input->post('dlz',true);
- $print = $this->input->post('print',true);
- $library = $this->input->post('library',true);
- $js = $this->input->post('js',true);
- $exstate = $this->input->post('exstate',true);
- $xztime = $this->input->post('xztime',true);
- $libraryconfirm = $this->input->post('libraryconfirm',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $plorder = $this->input->post('pl',true);
- $paypal = $this->input->post('paypal',true);
- $pay = $this->input->post('pay',true);
- $klarna = $this->input->post('klarna',true);
- $zf = $this->input->post('zf',true);
- $where = "1=1 and (".rtrim($fgshop,'or').")";
- if($warehouse)
- {
- $where .= " and type = '$warehouse'";
- }
- if($timetk && $timetj)
- {
- $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($source)
- {
- if($source == '2d')
- {
- $where .= " and source >= '2'";
- }
- else
- {
- $where .= " and source = '$source'";
- }
- }
- if($state)
- {
- $where .= " and state = '$state'";
- }
- if($review)
- {
- $where .= " and review = '$review'";
- }
- if($type)
- {
- $where .= " and type = '$type'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo' and orderinfo != '0'";
- }
- if($user)
- {
- $where .= " and user = '$user'";
- }
- if($client)
- {
- $where .= " and client like '%$client%'";
- }
- if($waybill)
- {
- $where .= " and waybill like '%$waybill%'";
- }
- if($number)
- {
- $where .= " and number like '$number%'";
- }
- if($email)
- {
- $where .= " and email = '$email'";
- }
- if($phone)
- {
- $where .= " and phone like '%$phone%'";
- }
- if($library)
- {
- $where .= " and library = '$library'";
- }
- if($print)
- {
- $where .= " and print = '$print'";
- }
- if($dlz != '')
- {
- $where .= " and dlz = '$dlz'";
- }
- if($js)
- {
- $where .= " and js = '$js'";
- }
- if($exstate)
- {
- $where .= " and exstate = '$exstate'";
- }
- if($libraryconfirm)
- {
- $where .= " and libraryconfirm = '$libraryconfirm'";
- }
- if($klarna != '')
- {
- if($klarna == 2)
- {
- $where .= " and klarna >= '$klarna'";
- }
- else
- {
- $where .= " and klarna = '$klarna'";
- }
- }
- if($paypal)
- {
- $where .= " and paypal = '$paypal'";
- }
- if($pay)
- {
- $where .= " and pay = '$pay'";
- }
- if($zf)
- {
- if($zf == 1)
- {
- $where .= " and paypal not like '%-%-%-%'";
- }
- else
- {
- $where .= " and paypal like '%-%-%-%'";
- }
- }
- if($plorder)
- {
- $plorderinfo = '';$plnumber = '';$pln = 0;
- $plorder = explode(',',trim($plorder,','));
- foreach ($plorder as $value)
- {
- if(is_numeric($value))
- {
- $plorderinfo .= " orderinfo = ".$value." or";
- }
- else if($value != '')
- {
- $plorderinfo .= " number = '".$value."' or";
- }
- }
- if($pln > 0)
- {
- $where .= " and (".rtrim($plorderinfo,'or').") and (".rtrim($plnumber,'or').")";
- }
- else
- {
- $where .= " and (".rtrim($plorderinfo,'or').")";
- }
- }
- //数据排序
- $order_str = "dtime desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
-
- //取得信息列表id,shop,type,source,user,orderinfo,number,name,state,buytime,clientremarks,review,print,library,libraryconfirm,express,waybill,orderremarks,black
- $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,sname,email,state,buytime,review,libraryconfirm,express,waybill,orderremarks,library,black,clientremarks,waybillid',$order_str,$start,$perpage);
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- $rginfo = $this->returngoods->get_orderinfo($value['orderinfo']);
- if(!empty($rginfo)){
- $info_list[$key]['number'] = $value['number']."<br/>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="'.$rginfo['remark'].'"></i><p>';
-
- }
- $ud = $this->fullorder->read($value['id']);
- $ud['address'] = str_replace("'","’",$ud['address']);
- $ud['name'] = str_replace("'","’",$ud['name']);
- $customer = $this->customer->get_email($ud['email'],$value['shop']);
- $customernum = $this->fullorder->find_count("email = '".$ud['email']."' and shop = '".$value['shop']."' and extra_status = 0");
- preg_match_all('/[0-9]/u',$ud['phone'],$result);
- $numphone = join('',$result[0]);
- $hmdaddress1 = str_replace(array(' parkway',' drive',' street',' road',' avenue',' boulevard',' alley',' court',' place',' lane',' manor',' terrace',' trail',' view',' cove'),array(' pkwy',' dr',' st',' rd',' av',' blvd',' aly',' ct',' pl',' ln',' mnr',' ter',' trl',' vw',' cv'),strtolower($ud['address']));
- $hmdaddress2 = str_replace(array(' pkwy',' dr',' st',' rd',' av',' blvd',' aly',' ct',' pl',' ln',' mnr',' ter',' trl',' vw',' cv'),array(' parkway',' drive',' street',' road',' avenue',' boulevard',' alley',' court',' place',' lane',' manor',' terrace',' trail',' view',' cove'),strtolower($ud['address']));
- $hmdaddress3 = str_replace(array(' avenue',' ave',' av'),array(' ave',' avenue',' ave'),strtolower($ud['address']));
- if($numphone == '0')
- {
- $customerb = $this->customer->find_all("type = 2 and (email = '".$ud['email']."' or address = '".$ud['address']."' or address = '".$hmdaddress1."' or address = '".$hmdaddress2."' or address = '".$hmdaddress3."' or phone = '".$numphone."')",'*','id desc');
- }
- else
- {
- $customerb = $this->customer->find_all("type = 2 and (email = '".$ud['email']."' or address = '".$ud['address']."' or address = '".$hmdaddress1."' or address = '".$hmdaddress2."' or address = '".$hmdaddress3."' or numphone = '".$numphone."')",'*','id desc');
- }
- $customerc = $this->customer->find_all("type = 1 and shop = '".$ud['shop']."' and address = '".$ud['address']."' and numphone = '".$numphone."'",'*','id desc');
- $customerd = $this->customer->find_all("type = 2 and shop = '".$ud['shop']."' and email = '".$ud['email']."'",'*','id desc');
- //$a = array_column($customer, 'email'); //三维找其中健的数组
- //$a = array_flip($a); //键和值调换
- $djcount = '';
- $lkh = $value['sname'];
- $djlkh = 0;$djhmd = 0;
- if($customer)
- {
- if($customer['count'] != '' && $customernum < 2)
- {
- $count = '<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>';
- $djcount = $count;
- }
- if(($customer['type'] == 1 && $customernum > 1))// || $customerc['type'] == 1 && $customerc['num'] > 1
- {
- $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
- $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户(".$customer['num'].")</p>";
- $djlkh = 1;
- $djcount = $count;
- }
- else if(isset($customerc[0]['num']))
- {
- if($customerc[0]['num'] > 1)
- {
- $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
- $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户(".$customer['num'].")</p>";
- $djlkh = 1;
- $djcount = $count;
- }
- }
- }
- if($customerb)
- {
- $hmsp = $this->shop->read($customerb[0]['shop']);
- $count = $customerb[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerb[0]['count'].'"></i>':'';
- $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'>".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
- $djhmd = 1;
- if($customerd)
- {
- if($customerd[0]['num'] > 1)
- {
- $count = $customerd[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerd[0]['count'].'"></i>':'';
- $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";
- $djlkh = 1;
- $djcount = $count;
- $djlkh = 1;
- }
- }
- }
- if($djlkh == '1' && $djhmd == '1')
- {
- $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'><em style='color:#FF3333'>".$djcount."老客户</em> - ".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
- }
- if($djlkh != '1' && $djhmd != '1' && $djcount)
- {
- $info_list[$key]['sname'] = $lkh."<p style='color:#FF3333'>".$djcount."</p>";
- }
- else
- {
- $info_list[$key]['sname'] = $lkh;
- }
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- //$info_list[$key]['user'] = $shop['shopuser'];
- $warehouse = $this->warehouse->read($value['type']);
- $warehousetitle = $warehouse['title'];
- if($value['type'] != 13){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
- $info_list[$key]['type'] = $warehousetitle;
- if(empty($ud['send_email'])){
- $info_list[$key]['email'] = '<em style="font-size: 13px;">'.$value['email'].'</em><br />'.$ud['phone'];
- }else{
- $info_list[$key]['email'] = '<em style="font-size: 13px;">'.$value['email'].'</em><br />'.'<em style="font-size: 13px;">'.$ud['send_email'].'</em><br />'.$ud['phone'];
- }
-
- $typeclass = $this->typeclass->read($value['state']);
- $info_list[$key]['state'] = "<font style='font-size: 13px;'>".$typeclass['spare']."</font>";
- /**
- $wl = '';
- if($value['exstate'] == '99')
- {
- $wl = '<font style="color:#ccc">未获取到物流信息</font>';
- }
- else if($value['exstate'] == '1')
- {
- $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已揽收<font style="display: none">'.$ud['excontent'].'</font></font>';
- }
- else if($value['exstate'] == '2')
- {
- $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">在途中<font style="display: none">'.$ud['excontent'].'</font></font>';
- }
- else if($value['exstate'] == '3')
- {
- $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送中<font style="display: none">'.$ud['excontent'].'</font></font>';
- }
- else if($value['exstate'] == '4')
- {
- $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已签收<font style="display: none">'.$ud['excontent'].'</font></font>';
- }
- else if($value['exstate'] == '5')
- {
- $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送异常<font style="display: none">'.$ud['excontent'].'</font></font>';
- }
- $info_list[$key]['exstate'] = $wl.'<br />';
- **/
- if($ud['source'] == 1) //线下单用订单时间,其他用付款时间
- {
- $info_list[$key]['buytime'] = '<p style="font-size: 13px;">'.date('Y-m-d',$ud['dtime']).'</p><p style="font-size: 13px;">'.date('H:i:s',$ud['dtime']).'</p>';
- }
- else
- {
- $info_list[$key]['buytime'] = '<p style="font-size: 13px;">'.date('Y-m-d',$value['buytime']+$dt).'</p><p style="font-size: 13px;">'.date('H:i:s',$value['buytime']+$dt).'</p>';
- }
- if($value['review'] == 1)
- {
- $info_list[$key]['review'] = "<font style='font-size: 13px;'>未送审</font>";
- }
- else if($value['review'] == 2)
- {
- $info_list[$key]['review'] = "<font style='color:#555;font-size: 13px;'>待审核</font>";
- }
- else if($value['review'] == 3)
- {
- $info_list[$key]['review'] = "<font style='color:#f90f4b;font-size: 13px;'>不通过</font>";
- }
- else if($value['review'] == 4)
- {
- $info_list[$key]['review'] = "<font style='font-size: 13px;'>取消重审</font>";
- }
- else if($value['review'] == 5)
- {
- $info_list[$key]['review'] = "<font style='color:#2f80f9;font-size: 13px;'>审核通过</font>";
- }
- else if($value['review'] == 6)
- {
- $info_list[$key]['review'] = "<font style='color:#2f80f9;font-size: 13px;'>自动通过</font>";
- }
- if($ud['dlz'] == 1)
- {
- $dlz = "<p>独立站已更新</p>";
- }
- else if($ud['dlz'] == 3)
- {
- $dlz = "<p>不需要更新</p>";
- }
- else if($ud['dlz'] == 2)
- {
- $dlz = "<p style='color:#C3C'>独立站更新失败</p>";
- }
- else
- {
- $dlz = "";
- }
- if($value['waybill'] != "")
- {
- $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz;
- //如果是云尚快线那么需要展示一个可以查全程的运单号
-
- if( !empty($value['waybillid'])){
- $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz."<p>".$value['waybillid']."</p>";
- }
-
-
- }
-
- if($value['express'] != 0)
- {
- $express = $this->express->read($value['express']);
- $expressservicename = $express['servicename'];
- if($value['express'] != 1 && $value['express'] != 63)
- {
- $expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";
- }
- else if($value['express'] == 63)
- {
- $expressservicename = "<font style='color:#a910f8'>".$express['servicename']."</font>";
- }
- $info_list[$key]['express'] = $expressservicename;
- }
- else
- {
- $info_list[$key]['express'] = "无";
- }
- $x = "";
- if($value['libraryconfirm'] == 2 && $value['review'] > 4 && $ud['library'] == 1)
- {
- $x = "<p class='ckn'><b class='fojz' data-type='1'>禁止发货</b></p>";
- }
- else if(($value['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1)
- {
- $x = "<p class='ckn'><b class='fojzof' data-type='6' data-id='".$value['id']."'>允许发货</b></p>";
- }
- if(($value['review'] > 4) && $ud['print'] == 2)
- {
- $x = "<p class='ckn'><b class='fojzof' data-type='7' data-id='".$value['id']."'>禁止打印</b></p>";
- }
- else if($value['review'] >4 && $ud['print'] == 1)
- {
- $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
- }
- if($value['waybill'] == "" && $value['review'] > 4)
- {
- $x .= "<p><b class='kn' data-type='2'>填写运单号</b></p>";
- }
- else if($value['waybill'] != "" && $value['review'] > 4)
- {
- $x .= "<p><b class='kn' data-type='2'>修改运单号</b></p>";
- }
- if(($value['review'] == 1 || $value['review'] == 3) && $ud['express'] > 0 && $ud['dtsbjz'] != 0 && $ud['ts'] != 0 && $ud['zsbjz'] != 0 && $ud['zjs'] != 0 && $ud['ts'] != 0 && ($ud['merge'] == 0 || $ud['merge'] != 0 && $ud['merge'] == $ud['id']))
- {
- $x .= "<p><b class='focz' data-type='2' data-id='".$value['id']."'>提交审核</b></p>";
- }
- $x .= "<p><b class='window' data-h='/customer/edit/".$customer['id']."' data-t='客户信息 - 修改'>客户信息</b></p>";
- $info_list[$key]['black'] = $x;
- $tly = "";
- if($value['clientremarks'] != "")
- {
- $tly = "<p style='color:#FF3333'>有客户留言</p>";
- }
- if($value['review'] > 4 && $usp['vip'] != 1 && ($ud['merge'] == 0 || $ud['merge'] == $ud['id']))
- {
- $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/readonly/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
- }
- else if($ud['merge'] == 0 || $ud['merge'] == $ud['id'])
- {
- $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
- }
- else if($ud['merge'] != 0 && $ud['merge'] != $ud['id'])
- {
- $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."' style='color:#000'><p>".$value['orderinfo']."</p>".$tly."</h9>"."<p>合并订单</p>";
- }
- else
- {
- $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
- }
- if($value['library'] == 1 && $ud['printtype'] == 3)
- {
- $info_list[$key]['library'] = "不需要";
- }
- else if($value['library'] == 1 && $ud['printtype'] != 3)
- {
- $info_list[$key]['library'] = "未出库";
- }
- else if($value['library'] == 2)
- {
- $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'出库</p>';
- }
- else if($value['library'] == 3)
- {
- $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['retreattime']).'</p><p>'.date('H:i:s',$ud['retreattime']).'退库</p>';
- }
- unset($info_list[$key]['waybillid']);
- }
- $total = $this->fullorder->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $this->data['wlshop'] = $wlshop;
- $this->data['express'] = $this->express->find_all();
- $user = $this->user->get_api($_SESSION['api']);
- $powerid = $this->power->read($user['power']);
- $powertext = explode('|',trim($powerid['excelid'],'|'));
- $pid = '';
- foreach ($powertext as $v)
- {
- $pid .= " id = ".$v." or";
- }
- $fullorderexcel = $this->fullorderexcel->find_all("type = '100001' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板
- $this->data['fullorderexcel'] = $fullorderexcel;
- $error = $this->fullorder->find_count("failed !='' and mergeid = 0 and print != 3 and (".rtrim($fgshop,'or').") and dtime > '".(time()-90*24*3600)."'");
- $this->data['error'] = $error;
- $cs_num = $this->fullordererrors->find_count( " plat = 'fullorder' and error_type = 1 and (".rtrim($fgshop,'or'). " ) and error_time > '".(time()-90*24*3600)."'");
- $this->data['cs_num'] = $cs_num;
- $this->data['power'] = $vip;
- $this->_Template('fullorder',$this->data);
- }
-
- //筛选重复订单
- public function _repeat()
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user)
- {
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $shop = $this->input->post('shop',true);
- $email = $this->input->post('email',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "print != 999 and state = 207 and review = 1 and number NOT like '%-%-%-%' and (".rtrim($fgshop,'or').")";
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($email)
- {
- $where .= " and email = '$email'";
- }
- if($timetk && $timetj)
- {
- $where .= " and dtime > '$timetk' and dtime < '$timetj'";
- }
- //数据排序
- $order_str = "id desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,name,email,address,state,dtime,shipremarks,type,merge');
- $info = array();
- $len = count($info_list);
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- $ud = $this->fullorder->read($value['id']);
- $shop = $this->shop->read($value['shop']);
- $warehouse = $this->warehouse->read($value['type']);
- $info_list[$key]['shop'] = '<p>'.$shop['shopname'].'</p>'.'<p>'.$warehouse['title'].'</p>';
- $info_list[$key]['email'] = '<p>'.$value['email'].'</p>'.'<p>'.$ud['phone'].'</p>';
- $typeclass = $this->typeclass->read($value['state']);
- $info_list[$key]['state'] = $typeclass['spare'];
- $info_list[$key]['type'] = $ud['orderremarks'];
- $info_list[$key]['dtime'] = '<p>'.date('Y-m-d',$value['dtime']).'</p><p>'.date('H:i:s',$value['dtime']).'</p>';
- if($value['merge'] == 0)
- {
- $info_list[$key]['merge'] = "<p>可合并</p>";
- }
- else
- {
- if($value['merge'] == $value['id'])
- {
- if($ud['print'] < '3' && $ud['library'] == '1')
- {
- $info_list[$key]['merge'] = "<p><b class='cforder' data-id='".$value['id']."'>拆分订单</b></p>";
- }
- else
- {
- $info_list[$key]['merge'] = "已合并";
- }
- }
- else
- {
- $info_list[$key]['merge'] = "被合并";
- }
- }
- }
- /** 操作合并
- if($value['merge'] == 0)
- {
- $info_list[$key]['merge'] = "<p><b class='jd' data-type='5'>合并订单</b></p>";
- }
- else
- {
- if($value['merge'] == $value['id'])
- {
- $info_list[$key]['merge'] = "已合并";
- }
- else
- {
- $info_list[$key]['merge'] = "被合并";
- }
- }
- **/
- $asd = array();
- for($i=0;$i<$len;$i++)
- {
- for($j=$i+1;$j<$len;$j++)
- {
- if (strtolower($info_list[$i]['address']) == strtolower($info_list[$j]['address']) && stripos($info_list[$i]['number'],$info_list[$j]['number']) === false && stripos($info_list[$j]['number'],$info_list[$i]['number']) === false) //$info_list[$i]['email'] == $info_list[$j]['email']
- {
- if(!array_key_exists($j,$info))
- {
- $info[$j] = $info_list[$j];
- }
- if(!array_key_exists($i,$info))
- {
- $info[$i] = $info_list[$i];
- }
- }
- }
- }
- rsort($info);
- $total = count($info);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_slice($info,$start,$perpage)));
- echo json_encode($rows);exit;
- }
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $this->data['wlshop'] = $wlshop;
- $this->_Template('fullorder_repeat',$this->data);
- }
- //修改
- public function _edit($arg_array)
- {
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user['vip'] == 1)
- {
- $vip = 1;
- }
- else
- {
- $vip = 0;
- }
- $this->data['userid'] = $user['id'];
- }
- else
- {
- $this->data['userid'] = 0;
- $vip = 0;
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['id']))
- {
- // $dtsbjz = $this->input->post('dtsbjz',true);
- // $ts = $this->input->post('ts',true);
- // $dtsbjz = sprintf("%.2f",$dtsbjz);
- // $total_sbjz = $dtsbjz*$ts;
- // $tmp_zsbjz = $this->input->post('zsbjz',true);
- // $tmp_zsbjz = sprintf("%.2f",$tmp_zsbjz);
- // if($tmp_zsbjz*1 != $total_sbjz){
- // echo json_encode(array('msg'=>'单条申报价为2为小数!','success'=>false));exit;
- // }
- $id = $this->input->post('id',true);
- $data = $this->fullorder->read($id);
- $post['type'] = $this->input->post('warehouse',true);
- $post['country'] = $this->input->post('country',true);
- $currency = $this->country->read($post['country']);
- $post['al'] = $currency['lb'];
- $post['freight'] = $this->input->post('freight',true);
- $post['expressmoney'] = $this->input->post('expressmoney',true);
- $post['shouldmoney'] = $this->input->post('shouldmoney',true);
- $orderremarks = $this->input->post('orderremarks');
- $orderremarks = str_replace(array('%26','%2B'),array('&','+'),$orderremarks);
- $post['orderremarks'] = $orderremarks;
- $shipremarks = $this->input->post('shipremarks');
- $shipremarks = str_replace(array('%26','%2B'),array('&','+'),$shipremarks);
- $post['shipremarks'] = preg_replace('/( | | |\s)/',' ',$shipremarks);
- $email = $this->input->post('email',true);
- $post['email'] = preg_replace('/( | | |\s)/','',$email);
- //$post['paypal'] = $this->input->post('paypal',true);
- $name = $this->input->post('name',true);
- $post['name'] = str_replace("'","’",$name);
- $post['phone'] = $this->input->post('phone',true);
- $post['phone'] = preg_replace('/\D/s','',$post['phone']);
- $post['phone'] = preg_replace('/( | | |\s)/','',$post['phone']);
- $post['country'] = $this->input->post('country',true);
- $post['province'] = $this->input->post('province',true);//省、州
- $post['province'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['province']); //替换开头空字符
- $post['province'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['province']); //替换结尾空字符
- $post['city'] = $this->input->post('city',true);//城市
- $post['city'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['city']); //替换开头空字符
- $post['city'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['city']); //替换结尾空字符
- $post['zipcode'] = $this->input->post('zipcode',true);//邮编
- $post['zipcode'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['zipcode']); //替换开头空字符
- $post['zipcode'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['zipcode']); //替换结尾空字符
- $post['street'] = $this->input->post('street',true);
- $address = $this->input->post('address',true);
- $address = preg_replace('/( | | |\s)/',' ',$address);
- $post['address'] = str_replace("'","’",$address);
- $address2 = $this->input->post('address2',true);
- $address2 = preg_replace('/( | | |\s)/',' ',$address2);
- if($address2 == ' ')
- {
- $address2 = '';
- }
- $post['address2'] = str_replace("'","’",$address2);
- $post['express'] = $this->input->post('express',true);
- $post['printtype'] = $this->input->post('printtype',true);
- $fpdata = $this->input->post('fpdata');
- $fpdata = str_replace(array('%26','%2B'),array('&','+'),$fpdata);
- $post['fpdata'] = $fpdata;
- $post['waybill'] = $this->input->post('waybill',true);
- $post['msg'] = $this->input->post('msg',true);
- $post['zsbjz'] = $this->input->post('zsbjz',true);
- $post['refundy'] = $this->input->post('refundy',true);
- $post['refundj'] = $this->input->post('refundj',true);
- $rtime = $this->input->post('rtime',true);
- $post['rtime'] = strtotime($rtime);
- $post['rpaypal'] = $this->input->post('rpaypal',true);
- $post['rtext'] = $this->input->post('rtext',true);
- $post['sbpm'] = $this->input->post('sbpm',true);
- $post['edittime'] = time();
- $editstate = $this->input->post('state',true);
- if(!$editstate)
- {
- $editstate = $data['state'];
- }
- $whlabel = $this->input->post('whlabel',true);
- $fpcount = $this->input->post('fpcount',true);
- $post['ioss'] = $this->input->post('ioss',true);
- $post['waybill'] = preg_replace('/( | | | |\s)/','',$post['waybill']);
- $pay = $this->pay->get_typeclass($data['pay']);
- $yga = $post['shouldmoney'];
- $ygc = $data['estimaterate'];
- $post['budget'] = 0;
- if($post['email'] == $post['send_email']){
- $post['send_email'] = '';
- }
- $ifbudget = eval("return $yga*1.$ygc;");
- if($ifbudget > 0)
- {
- $post['budget'] = eval("return $yga*1.$ygc;");
- }
- $whlabeldata = explode('|',trim($whlabel,'|'));$way = 0;
- foreach ($whlabeldata as $va)
- {
- if(stripos($va,'z') !== false)
- {
- $way += 1;
- }
- }
- //如果备注中出现网红的两个字 ,那么在fpdata种的品名中必须有 WH这两个字 且美仓不用
- if($post['type'] !=5 ){
- if(stripos($post['shipremarks'],'网红') !== false){
- if(stripos($post['fpdata'],'-2090-') === false){
- echo json_encode(array('msg'=>'网红单请在商品名称中勾选WH!','success'=>false));exit;
- }
- }
- }
-
- if((($post['express'] == 2 || $post['express'] == 63 || $post['express'] == 64) && $post['type'] != 5) )
- {
- echo json_encode(array('msg'=>'此快递方式必须从美仓发货!','success'=>false));exit;
- }
- if( ($post['express'] != 2 && $post['express'] != 63 && $post['express'] != 64 && $post['type'] == 5)){
- echo json_encode(array('msg'=>'此快递方式不能美仓发货!','success'=>false));exit;
- }
- //仅独立站 地址美国对电话 10或者11位进行判断
- if($post['country'] == 192){
- if((strlen($post['phone'])!= 10) && (strlen($post['phone'])!= 11)){
- echo json_encode(array('msg'=>'美国电话号码应为10/11位!','success'=>false));exit;
- }
- }
-
- //减少代码复用吧
- $lo_ret = $this->logic_order->checkEditExpress($post);
- if($lo_ret['code'] != 1){
- echo json_encode(array('msg'=>$lo_ret['msg'],'success'=>false));exit;
- }
- //检测PayPal有但是为空的情况
- if(isset($post['paypal'])){
- if(empty($post['paypal'])){
- echo json_encode(array('msg'=>'交易号不可为空!','success'=>false));exit;
- }
- }else{
- $tmp_info = $this->fullorder->read($post['id']);
- if(empty($tmp_info)){
- echo json_encode(array('msg'=>'订单信息异常','success'=>false));exit;
- }
- if(empty($tmp_info['paypal'])){
- echo json_encode(array('msg'=>'交易号不可为空!','success'=>false));exit;
- }
- }
- // if($post['express'] == 42 && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods')//$post['express'] == 3 ||
- // {
- // echo json_encode(array('msg'=>'此快递方式必须选择Human Hair Wigs/Human Hair Goods!','success'=>false));exit;
- // }
- if($post['express'] == 24 && $post['sbpm'] != 'Hair Sample' && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods')//$post['express'] == 3 ||
- {
- echo json_encode(array('msg'=>'此快递方式必须选择Hair Sample/Human Hair Wigs/Human Hair Goods!','success'=>false));exit;
- }
- if($post['country'] != 192 && $post['express'] == 1 && $post['sbpm'] != 'Synthetic Hair Wigs' && $post['sbpm'] != 'Synthetic Hair Goods')//$post['express'] == 3 ||
- {
- echo json_encode(array('msg'=>'非美国选择官方DHL必须选择Synthetic Hair Wigs/Synthetic Hair Goods','success'=>false));exit;
- }
- if($way == count($whlabeldata) && $post['type'] != 12)
- {
- echo json_encode(array('msg'=>'必须选择特殊仓!','success'=>false));exit;
- }
- if($way == '0' && $post['type'] == 12)
- {
- echo json_encode(array('msg'=>'特殊仓必须包含特殊仓货物!','success'=>false));exit;
- }
- $post['review'] = 1;
- if($post['zsbjz'] < '0.01')
- {
- echo json_encode(array('msg'=>'总申报价错误!','success'=>false));exit;
- }
- if($data['library'] == 1)
- {
- if($data['print'] != 3)
- {
- $post['print'] = 1;
- $post['libraryconfirm'] = 1;
- $post['librarynot'] = "订单未打印,未审核或未通过";
- }
- else
- {
- $post['libraryconfirm'] = 1;
- $post['librarynot'] = "订单被修改或重新提交";
- }
- }
- if($data['yhs'] == 1)
- {
- echo json_encode(array('msg'=>'仓库货物验证中,请稍后再试!','success'=>false));exit;
- }
- if($post['express'] == 2 && (stripos($post['name'],'&') !== false || stripos($post['name'],"'") !== false))
- {
- echo json_encode(array('msg'=>'USPS收件人或公司名不可用特殊符号!','success'=>false));exit;
- }
- if(strlen($post['client']) > 34 || strlen($post['name']) > 34)//收件人姓名或公司名不允许超过35位
- {
- echo json_encode(array('msg'=>'收件人姓名或公司名不可超过34个字符!','success'=>false));exit;
- }
- if($post['express'] == '3' && $post['address2'] != '')//UPS不允许提交地址2
- {
- echo json_encode(array('msg'=>'UPS不允许提交地址2','success'=>false));exit;
- }
- if(($post['express'] == '5' || $post['express'] == '24' || $post['express'] == '42' || $post['express'] == '31') && $post['country'] != 192)
- {
- echo json_encode(array('msg'=>'非美国无法选择Fedex、DHL官方-美国!','success'=>false));exit;
- }
- if($post['express'] == '3' && $post['country'] != 192 && $post['country'] != 35)
- {
- echo json_encode(array('msg'=>'非美国和加拿大无法选择UPS!','success'=>false));exit;
- }
- if($post['country'] == 35 && $post['zsbjz'] > 20)
- {
- echo json_encode(array('msg'=>'加拿大最高申报不可超过20','success'=>false));exit;
- }
- if(($post['express'] == '28' || $post['express'] == '7') && $post['country'] != 191)
- {
- echo json_encode(array('msg'=>'非英国无法选择CNE和GES!','success'=>false));exit;
- }
- $express = $this->express->read($post['express']);
- if($express['ioss'] == 1 && $post['ioss'] == '')
- {
- echo json_encode(array('msg'=>'此快递方式必须选择IOSS!','success'=>false));exit;
- }
- if(strlen($post['address']) > $express['addresssize'] || strlen($post['address2']) > $express['addresssize'])
- {
- echo json_encode(array('msg'=>'此快递地址不可超出'.$express['addresssize'].'个字符','success'=>false));exit;
- }
- if(strlen($post['address']) < 5)
- {
- echo json_encode(array('msg'=>'地址不可留空!','success'=>false));exit;
- }
- if(($express['sbjz'] > 0) && ($post['zsbjz'] > $express['sbjz']))
- {
- echo json_encode(array('msg'=>'总申报价值不可超出'.$express['sbjz'],'success'=>false));exit;
- }
- if($post['shouldmoney'] > $express['shouldmoney'] && $express['shouldmoney'] != 0)
- {
- echo json_encode(array('msg'=>'订单金额不可超出'.$express['shouldmoney'],'success'=>false));exit;
- }
- if($post['express'] == '2' && $post['zzl'] > '16' && isset($post['js']) && $post['js'] == '0')
- {
- echo json_encode(array('msg'=>'重量大于16不可按Ground Advantage提交!','success'=>false));exit;
- }
- // if($post['express'] == '2' && isset($post['js']) && $post['js'] == '0'&& $post['qm'] == '1')
- // {
- // echo json_encode(array('msg'=>'Ground Advantage不可使用签名服务!','success'=>false));exit;
- // }
- if(isset($post['bx']))
- {
- if($post['express'] == '99' && $post['bx'] > 0)
- {
- echo json_encode(array('msg'=>'此物流不允许购买保险','success'=>false));exit;
- }
- }
- if(($post['express'] == '3' || $post['express'] == '42' || $post['express'] == '24') && $post['shouldmoney'] < 1)
- {
- //echo json_encode(array('msg'=>'零金额订单不可发 UPS/DHL官方-美国/Fedex(杭州)','success'=>false));exit;
- }
- if($post['express'] == '42' && $post['zsbjz'] < 1)
- {
- echo json_encode(array('msg'=>'零申报金额不可发 DHL官方-美国','success'=>false));exit;
- }
- if($post['express'] == '6' && $post['province'] == '')
- {
- echo json_encode(array('msg'=>'选择DPEX必须填写州信息','success'=>false));exit;
- }
- if(($post['express'] == '24' || $post['express'] == '3') && $post['shouldmoney'] == 0)
- {
- echo json_encode(array('msg'=>'0金额订单不可发UPS/Fedex(杭州)!!!','success'=>false));exit;
- }
- if($post['country'] == '35' && $post['zsbjz'] > 20)
- {
- echo json_encode(array('msg'=>'加拿大不可申报超过20美金!!!','success'=>false));exit;
- }
- if($post['printtype'] == 1)//如果是运单
- {
- $post['productdescription'] = $this->input->post('productdescription',true);
- $post['customs'] = $this->input->post('customs',true);
- }
- if($post['express'] == 2 && strlen($post['zipcode']) != 5)//如果usps 邮编不是5位
- {
- echo json_encode(array('msg'=>'USPS-USA的邮编需按5位数格式提交!','success'=>false));exit;
- }
- if(strlen($post['phone']) > 11 && $post['express'] == 63)
- {
- echo json_encode(array('msg'=>'美国联邦,电话号码不允许超过11位!','success'=>false));exit;
- }
- /**
- if($post['paypal'] != '')
- {
- $pp = $this->fullorder->get_paypal($post['paypal']);
- if(isset($pp['number']) && $pp['number'] != $data['number'])
- {
- echo json_encode(array('msg'=>'此交易号的订单已存在!-'.$pp['number'],'success'=>false));exit;
- }
- }
- **/
- /**
- if($editstate == 216 && $data['state'] != 216)
- {
- echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit;
- }
- **/
- $post['review'] = $data['review'];
- $post['state'] = $editstate;
- if($editstate == 216)
- {
- foreach ($post as $k=>$v)
- {
- if($k == 'shipremarks' || $k == 'whlabel' || $k == 'fpdata' || $k == 'fpcount' || $k == 'refundy' || $k == 'refundj' || $k == 'rtime' || $k == 'rpaypal' || $k == 'rtext' || $k == 'freight' || $k == 'expressmoney' || $k == 'edittime' || $k == 'librarynot' || $k == 'state' || $k == 'jweight' || $k == 'productdescription')
- {
- continue;
- }
- else
- {
- //当时不知道为会把 当前不可修改订单信息 给注释掉 但是 如果注释掉 这个判断就没意义了 还引起了报错 我这里就注释掉了
- // if($v != $data[$k])
- // {
- // //echo json_encode(array('msg'=>'当前不可修改订单信息','cs'=>$k,'success'=>false));exit;
- // }
- }
- }
- }
- /**
- if($editstate == 216 && $post['waybill'] != '' && $data['waybill'] != '')//if($editstate == 216 && preg_match('/\d/is',$post['waybill']) != true)
- {
- echo json_encode(array('msg'=>'当前信息不可修改订单状态','success'=>false));exit;
- }
- else
- {
- $post['review'] = $data['review'];
- $post['state'] = $editstate;
- }
- **/
-
- $thisdata = $this->fullorder->read($id);
- $warehouse = $this->warehouse->read($thisdata['type']);
- $warehousenew = $this->warehouse->read($post['type']);
- if($warehousenew['bdcountry'] != 0 && $post['country'] != $warehousenew['bdcountry'])
- {
- echo json_encode(array('msg'=>'当前国家无法选择'.$warehousenew['title'].'!','success'=>false));exit;
- }
- if(($warehouse['zd'] == '1' || stripos($thisdata['whlabel'],'z|') !== false) && $thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库
- {
- echo json_encode(array('msg'=>'此单已占用库存并出库,无法更改仓库!','success'=>false));exit;
- }
- $expt = $this->express->read($post['express']);
- if($expt['pt'] != '' && stripos($post['fpdata'],$expt['pt']) !== false)
- {
- echo json_encode(array('msg'=>$expt['ptts'],'success'=>false));exit;
- }
- if($expt['province'] != '' && stripos($expt['province'],$post['province'].'、') !== false)
- {
- echo json_encode(array('msg'=>'此省/州不可使用 '.$expt['servicename'],'success'=>false));exit;
- }
- /**
- if($warehouse['zd'] == '1' && $warehouse['ys'] != '1' && $thisdata['library'] == '2' && $post['fpdata'] != $thisdata['fpdata'])
- {
- echo json_encode(array('msg'=>'已扣减库存,无法更改产品!','success'=>false));exit;
- }
- **/
- //开始注释 xyxg
- /**
- $ft = array();
- $ftdata = explode('|',rtrim($fpcount,'|'));
- foreach ($ftdata as $va)
- {
- $ftitle = '';
- $va = explode('-',trim($va,'-'));
- foreach ($va as $v)
- {
- $v = $this->typeclass->read($v);
- $ftitle .= $v['title'].' ';
- }
- $ft[] = rtrim($ftitle,' ');
- }
- if($data['library'] == 1)
- {
- $tqkcyz = $this->_kcyz($post['type'],$whlabel,$id,$data['shop'],$data['number']);
- if(isset($tqkcyz[0]))
- {
- echo json_encode(array('t'=>2,'msg'=>"红色商品名库存匹配错误或库存不够扣减",'error'=>$tqkcyz,'success'=>false));exit;
- }
- if(stripos($whlabel,'z|') !== false || stripos($thisdata['whlabel'],'z|') !== false)
- {
- $tskcyz = $this->specialstock->get_kc($thisdata['state'],$post['state'],$whlabel,$thisdata['whlabel'],$thisdata['number']);
- if($tskcyz['t'] > '0')
- {
- echo $tskcyz['m'];exit;
- }
- }
- $kcyz = $this->whlabel->get_kc($thisdata['state'],$post['state'],$warehousenew['zd'],$warehousenew['ys'],$post['type'],$whlabel,$fpcount,$ft,$thisdata['number'],$thisdata['shop'],$thisdata['type'],$thisdata['whlabel']);//旧状态、新状态、仓库占单设置、仓库预设设置、新仓库、新产品简化数字、旧产品数字、旧产品名称、订单号、订单店铺、旧订单仓库、旧产品简化数字
- if($kcyz['t'] > '0')
- {
- echo $kcyz['m'];exit;
- }
- }
- //结束注释
- **/
- /** 重新写产品名称
- $dtctitle = array();
- $dictionaries = $this->typeclass->find_all();
- foreach ($dictionaries as $v)
- {
- $dtctitle[$v['id']] = array($v['title'],$v['bqsku']);
- }
- if(stripos($fpdata,'-128-') !== false || stripos($fpdata,'-127-') !== false)
- {
- $dfp = explode(';',trim($fpdata,';'));
- $fdata = '';
- foreach ($dfp as $k=>$v)
- {
- $ptitleb = '';
- $fp = explode('|',trim($v,'|'));
- $fp0 = explode(',',$fp[0]);
- $fp1 = explode('-',trim($fp0[1],'-'));
- foreach ($fp1 as $vv)
- {
- $ptitleb .= isset($dtctitle[$vv])?$dtctitle[$vv][0].' ':'';
- }
- $ptitleb .= $dtctitle[$fp0[0]][1].'inch ';
- $fp[1] = $ptitleb;
- $fdata .= implode("|",$fp).";";
- }
- $fpdata = $fdata;
- }
- **/
- $warehouse = $this->warehouse->read($post['type']);
- //未出库或者(已退库并且订单的状态不是等待买家收货和代发货状态)
- if($data['library'] == 1 || ($data['library'] != 2 && ($post['state'] != '207' || $post['state'] == '209')))
- {
- // echo "<pre>";
- // var_dump($post['state']);
- // var_dump($warehouse);
- // var_dump($thisdata['shop']);
- // var_dump($thisdata['number']);
- // var_dump($whlabel);
- // var_dump($fpdata);
- // die;
- $kcyz = $this->ck->get_kc($post['state'],$warehouse,$thisdata['shop'],$thisdata['number'],$whlabel,$fpdata);
- if($kcyz['t'] > '0')
- {
- echo $kcyz['m'];exit;
- }
- else if($kcyz['fpdata'] != '')
- {
- $post['whlabel'] = $kcyz['whlabel'];
- $post['fpdata'] = $kcyz['fpdata'];
- }
- }
- //$fl = $this->ck->get_fl($warehouse['hz'],$whlabel,$fpdata);
- //$post['sfxh'] = $fl['sfxh'];
- //$post['ckfl'] = $fl['ckfl'];
-
- //查询净重开始
- $post['jweight'] = $this->weight->get_weightcx($post['fpdata']);
- unset($post[0]);
-
- //查询净重结束
- if($this->fullorder->save($post,$id))
- {
- if($data['printtime'] == '0')
- {
- $xghz = ',将自动禁止打印';
- }
- else if($data['printtime'] > '0' && $data['librarytime'] == '0')
- {
- $q = '';
- if($data['libraryconfirm'] == 1)
- {
- $q = ',<em style="color: #F00;">改前状态为:禁止出库</em>';
- }
- $xghz = ',将自动禁止发货'.$q;
- }
- else
- {
- $xghz = '';
- }
- echo json_encode(array('msg'=>'修改成功'.$xghz,'id'=>$id,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
- }
-
- }
- $this->data['vip'] = $vip;
- $arg_array = $arg_array[0];$fpdata = array();
- $fullorder = $this->fullorder->read($arg_array);
- $returngoods = $this->returngoods->get_orderinfo($fullorder['orderinfo']);
- $this->data['returngoods'] = 0;
- if(!empty($returngoods)){
- if($returngoods['status'] != 120){
- $this->data['returngoods'] = 1;
- }
- }
- $fullorder['parameter'] = str_replace(",","---",$fullorder['parameter']);
- $country = $this->country->find_all('1=1','id,name','name asc');//所有国家信息
- $express = $this->express->find_all('1=1');//所有快递配置信息
- $this->data['fullorder'] = $fullorder;
- if($fullorder['express'] == 2)
- {
- $zzhl = 'oz';
- }
- else
- {
- $zzhl = 'kg';
- }
- $this->data['zzhl'] = $zzhl;
- $this->data['country'] = $country;
- $this->data['express'] = $express;
- $this->data['dtime'] = date('Y-m-d H:i:s',$fullorder['dtime']);
- $warehouse = $this->warehouse->read($fullorder['type']);
- if(stripos($fullorder['fpdata'],';') !== false)
- {
- $fpdata = explode(';',rtrim($fullorder['fpdata'],';'));
- foreach ($fpdata as $k=>$v)
- {
- $xxv = explode('|',$v);
- if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)
- {
- $xxv['zd'] = "<p>已占单</p>";
- $bdck = $warehouse['bdck'];
- if(stripos($xxv[9],'~') !== false)
- {
- $dxxv = explode('~',trim($xxv[9],'~'));
- foreach ($dxxv as $val)
- {
- $wzid = $this->$bdck->read(trim($val,$warehouse['hz']));
- if($wzid['details'] != '')
- {
- $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
- }
- }
- }
- else
- {
- $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));
- if($wzid['details'] != '')
- {
- $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
- }
- }
- }
- $fpdata[$k] = $xxv;
- }
- }
- $fpdata = $this->logic_order->checkOrderProduct($fpdata);
- $this->data['fpdata'] = $fpdata;
- $thfpdataxs = array();
- if($fullorder['thfpdata'] != '')
- {
- $thfpdata = explode(';',trim($fullorder['thfpdata'],';'));
- foreach ($thfpdata as $k=>$v)
- {
- $thxs = explode('~',trim($v,'~'));
- $thxs[0] = explode('|',trim($thxs[0],'|'));
- $thxs[1] = explode('|',trim($thxs[1],'|'));
- $thfpdataxs[] = array("<p>".$thxs[0][1]."<i class='fa fa-level-down'></i></p><p>".$thxs[1][1]."</p>","<p>".$thxs[0][2]."</p><p>".$thxs[1][2]."</p>","<p>旧</p><p>新</p>",$thxs[1][0]);
- }
- }
- $this->data['thfpdata'] = $thfpdataxs;
- $shop = $this->shop->read($fullorder['shop']);
- $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
- $is = 0;
- if($shop['type'] == 269 || $shop['type'] == 2768)//判断是否独立站,269是独立站
- {
- $is = 1;
- }
- $this->data['is'] = $is;
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user['vip'] == 1)
- {
- $vip = 1;
- }
- else
- {
- $vip = 0;
- }
- }
- else
- {
- $vip = 0;
- }
- $this->data['power'] = $vip;
- /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
- $downwaybill = '';$dwls = array();
- $oldwaybill = explode('-',ltrim($fullorder['oldwaybill'],'-'));
- if(isset($oldwaybill[0][1]))
- {
- $oldwaybill = array_reverse($oldwaybill); //调整顺序
- foreach ($oldwaybill as $v)
- {
- $dw = explode('/',$v);
- if(isset($dw[1]))
- {
- if(stripos($downwaybill,$dw[1]) === false)
- {
- $dwls[$dw[1]] = 1;
- $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
- }
- }
- }
- }
- if($fullorder['printtype'] == 1)
- {
- if($fullorder['waybill'] != '' && !isset($dwls[$fullorder['waybill']]))
- {
- $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullorder['printtime']).'/y-'.$fullorder['waybill'].'.pdf" target="_blank">'.$fullorder['waybill'].'</a>、'.$downwaybill;
- }
- }
- $this->data['downwaybill'] = rtrim($downwaybill,'、');
- /** 历史打印时间 **/
- $printtime = '';
- if($fullorder['oldprinttime'])
- {
- $pte = explode('-',rtrim($fullorder['oldprinttime'],'-'));
- foreach ($pte as $v)
- {
- if(!empty($v)){
- $printtime .= date('Y-m-d H:i:s',$v).'、';
- }
-
- }
- }
- $this->data['printtime'] = rtrim($printtime,'、');
- $product = '';
- $fullorder['product'] = str_replace("'","",$fullorder['product']);
- if($fullorder['link'] != '' && $fullorder['source'] != '1')
- {
- $pt = explode(',',$fullorder['product']);
- $lk = explode(',',$fullorder['link']);
- for($i=0;$i<count($pt);$i++)
- {
- if(isset($lk[$i]))
- {
- $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);
- }
- else
- {
- $octs = '';
- }
- $a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];
- //$a = (stripos($pt[$i],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($pt[$i],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($pt[$i],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($pt[$i],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($pt[$i],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($pt[$i],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($pt[$i],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($pt[$i],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($pt[$i],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$pt[$i].'</font>':$pt[$i];
- if(isset($lk[$i]))
- {
- $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';
- }
- else
- {
- $product .= ($product != '')?' , '.$a:$a;
- }
-
- }
- }
- else
- {
- $octs = $this->colourorderts->get_text($fullorder['product']);
- $a = $octs?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
- //$a = (stripos($fullorder['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullorder['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullorder['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullorder['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullorder['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullorder['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullorder['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullorder['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullorder['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
- $product = $a;
- }
- $this->data['product'] = $product;
- $out = $this->systemtransfer->find_all("number = '".$fullorder['number']."'");
- $outread = '';
- if($out)
- {
- foreach ($out as $val)
- {
- $list = '';
- $rk = explode('|',trim($val['rk'],'|'));
- $rktime = explode('|',trim($val['rktime'],'|'));
- $zw = array();
- $t = $this->transfer->find_all("1=1");
- foreach ($t as $v)
- {
- $zw[$v['id']] = $v['title'];
- }
- if($val['rk'] != '' && count($rk) > 0)
- {
- for($i=0;$i<count($rk);$i++)
- {
- if(!isset($rktime[$i]))
- {
- if(isset($cz[$i]))
- {
- $list .= $zw[$cz[$i]];
- }
- }
- else
- {
- $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';
- }
- }
- }
- $outread .= '<span style="color:#f00">'.$val['shipremarks'].'</span>:'.$list.'<br>';
- //$outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';
- }
- }
- else
- {
- $systemwigsout = $this->systemwigsout->find_all("number = '".$fullorder['number']."'");
- $outread = array();
- if($systemwigsout)
- {
- foreach ($systemwigsout as $v)
- {
- if($v['czwarehouse'] == 37)
- {
- $outread[] = '华荣厂';
- }
- else if($v['czwarehouse'] == 0)
- {
- $outread[] = '龙盈厂';
- }
- $cz = explode('|',trim($v['cz'],'|'));
- $cztime = explode('|',trim($v['cztime'],'|'));
- $zw = $this->transfer->get_list();
- if($v['cz'] != '' && count($cz) > 0)
- {
- for($i=0;$i<count($cz);$i++)
- {
- if(!isset($cztime[$i]))
- {
- $outread[] = $zw[$cz[$i]].' -> ';
- }
- else
- {
- $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -> ';
- }
- }
- $outread[] = '<br>';
- }
- }
- }
- }
- $klarnacolor = '';
- if($fullorder['klarnadata'] !='')
- {
- $klarnadata = explode('|',$fullorder['klarnadata']);
- if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')
- {
- $klarnadata[1] = json_decode($klarnadata[1],true);
- if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullorder['shouldmoney'] && $fullorder['pay'] == 1211)
- {
- $klarnacolor = 'style="color:#F00"';
- }
- }
- else if($klarnadata[0]!=1 && $fullorder['pay']!=26 && $fullorder['pay']!=27 && $fullorder['pay']!=1211)
- {
- $klarnacolor = 'style="color:#F00"';
- }
- if($fullorder['pay'] == 23)//klarna
- {
- $ToState = array('alabama'=>'AL','alaska'=>'AK','arizona'=>'AZ','arkansas'=>'AR','california'=>'CA','colorado'=>'CO','connecticut'=>'CT','delaware'=>'DE','florida'=>'FL','georgia'=>'GA','hawaii'=>'HI','idaho'=>'ID','illinois'=>'IL','indiana'=>'IN','iowa'=>'IA','kansas'=>'KS','kentucky'=>'KY','louisiana'=>'LA','maine'=>'ME','maryland'=>'MD','massachusetts'=>'MA','michigan'=>'MI','minnesota'=>'MN','mississippi'=>'MS','missouri'=>'MO','montana'=>'MT','nebraska'=>'NE','nevada'=>'NV','new hampshire'=>'NH','new jersey'=>'NJ','new mexico'=>'NM','new york'=>'NY','north carolina'=>'NC','north dakota'=>'ND','ohio'=>'OH','oklahoma'=>'OK','oregon'=>'OR','pennsylvania'=>'PA','rhode island'=>'RI','south carolina'=>'SC','south dakota'=>'SD','tennessee'=>'TN','texas'=>'TX','utah'=>'UT','vermont'=>'VT','virginia'=>'VA','washington'=>'WA','west virginia'=>'WV','wisconsin'=>'WI','wyoming'=>'WY','district of columbia'=>'DC','virgin islands'=>'VI','guam'=>'GU','puerto rico'=>'PR');
- $ToState = array_flip($ToState);
- $klarnadata3 = str_replace(' ','',$klarnadata[3]);
- $city = str_replace(' ','',$fullorder['city']);
- $klarnadataaddress = explode($city,$klarnadata3);
- if(isset($klarnadataaddress[1]))
- {
- $klarnadata3 = $city.$klarnadataaddress[1];
- $klarnadatacolor = explode(',',$klarnadata3);
- unset($klarnadatacolor[4]);
- unset($klarnadatacolor[6]);
- if(isset($ToState[$klarnadatacolor[1]]))
- {
- $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);
- }
- $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);
- }
- else
- {
- $klarnadata['color'] = $klarnadata3;
- }
- }
- }
- else
- {
- $klarnadata = '';
- }
- $p = explode('-',$fullorder['paypal']);
- $this->data['klarnacolor'] = $klarnacolor;
- $this->data['klarnadata'] = $klarnadata;
- $this->data['systemwigsout'] = $outread;
- $quantity = explode(';',trim($fullorder['quantity'],';'));
- $qc = 0;
- foreach ($quantity as $v)
- {
- if($v > 1)
- {
- $qc += 1;
- }
- }
- $this->data['qc'] = $qc;
- //新增row_total和sub_total
- $product_ids = $row_total = $sub_total = "";
- if(!empty($fullorder['extra_price'])){
- $extra_price = json_decode($fullorder['extra_price'],true);
- foreach($extra_price as $k=>$v){
- $row_total .= sprintf("%.2f",($v['qty']* $v['price'])).";";
- $sub_total .= sprintf("%.2f",$v['sub_total']).";";
- if(!empty($v['product_id'])){
- $product_ids .= $v['product_id'].";";
- }
- }
- }
- $this->data['row_total'] = trim($row_total,";");
- $this->data['sub_total'] = trim($sub_total,";");
- $this->data['product_ids'] = trim($product_ids,";");
- $this->_Template('fullorder_edit',$this->data);
- }
- //不可修改
- public function _readonly($arg_array)
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['id']))
- {
- $id = $this->input->post('id',true);
- $ud = $this->fullorder->read($id);
- $post['type'] = $this->input->post('warehouse',true);
- $post['orderremarks'] = $this->input->post('orderremarks',true);
- $post['state'] = $this->input->post('state',true);
- $post['msg'] = $this->input->post('msg',true);
- $post['refundy'] = $this->input->post('refundy',true);
- $post['refundj'] = $this->input->post('refundj',true);
- $fpdata = $this->input->post('fpdata');
- $fpdata = str_replace(array('%26','%2B'),array('&','+'),$fpdata);
- $post['fpdata'] = $fpdata;
- $rtime = $this->input->post('rtime',true);
- $post['rtime'] = strtotime($rtime);
- $post['rpaypal'] = $this->input->post('rpaypal',true);
- $post['rtext'] = $this->input->post('rtext',true);
- $post['express'] = $this->input->post('express',true);
- $whlabel = $this->input->post('whlabel',true);
- //$post['ioss'] = $this->input->post('ioss',true);
- $post['edittime'] = time();
- $editstate = $post['state'];
- if(!$editstate)
- {
- $editstate = $ud['state'];
- $post['state'] = $editstate;
- }
- /**
- if($post['state'] == 216 && $ud['state'] != 216)
- {
- echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit;
- }
- **/
- $whlabeldata = explode('|',trim($whlabel,'|'));$way = 0;
- foreach ($whlabeldata as $va)
- {
- if(stripos($va,'z') !== false)
- {
- $way += 1;
- }
- }
- if((($post['express'] == 2 || $post['express'] == 63 || $post['express'] == 64) && $post['type'] != 5) || ($post['express'] != 2 && $post['express'] != 63 && $post['express'] != 64 && $post['type'] == 5))
- {
- echo json_encode(array('msg'=>'此快递方式必须选择美仓!','success'=>false));exit;
- }
- if($way == count($whlabeldata) && $post['type'] != 12)
- {
- echo json_encode(array('msg'=>'必须选择特殊仓!','success'=>false));exit;
- }
- if($way == '0' && $post['type'] == 12)
- {
- echo json_encode(array('msg'=>'特殊仓必须包含特殊仓货物!','success'=>false));exit;
- }
- $fpcount = $this->input->post('fpcount',true);
- if(!$fpcount)
- {
- echo json_encode(array('msg'=>'需要先清理浏览器缓存,刷新当前页面后再试!','success'=>false));exit;
- }
- if($ud['library'] == 1)
- {
- if($ud['print'] != 3)
- {
- $post['print'] = 1;
- $post['libraryconfirm'] = 1;
- $post['librarynot'] = "订单未打印,未审核或未通过";
- }
- else
- {
- $post['libraryconfirm'] = 1;
- $post['librarynot'] = "订单被重新提交";
- }
- }
- if(($post['express'] == '5' || $post['express'] == '24' || $post['express'] == '42' || $post['express'] == '31') && $ud['country'] != 192)
- {
- echo json_encode(array('msg'=>'非美国无法选择Fedex、DHL官方-美国!','success'=>false));exit;
- }
- if($post['express'] == '3' && $ud['country'] != 192 && $ud['country'] != 35)
- {
- echo json_encode(array('msg'=>'非美国和加拿大无法选择UPS!','success'=>false));exit;
- }
-
- if(($post['express'] == '28' || $post['express'] == '7') && $ud['country'] != 191)
- {
- echo json_encode(array('msg'=>'非英国无法选择CNE和GES!','success'=>false));exit;
- }
- $express = $this->express->read($post['express']);
- /**
- if($express['ioss'] == 1 && $post['ioss'] == '')
- {
- echo json_encode(array('msg'=>'此快递方式必须选择IOSS!','success'=>false));exit;
- }
- **/
- $thisdata = $this->fullorder->read($id);
- $warehouse = $this->warehouse->read($thisdata['type']);
- $warehousenew = $this->warehouse->read($post['type']);
- if(($warehouse['zd'] == '1' || stripos($thisdata['whlabel'],'z|') !== false) && $thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库
- {
- echo json_encode(array('msg'=>'此单已占用库存并出库,无法更改仓库!','success'=>false));exit;
- }
- if($ud['yhs'] == 1)
- {
- echo json_encode(array('msg'=>'仓库货物验证中,请稍后再试!','success'=>false));exit;
- }
- $expt = $this->express->read($post['express']);
- if($expt['pt'] != '' && stripos($post['fpdata'],$expt['pt']) !== false)
- {
- echo json_encode(array('msg'=>$expt['ptts'],'success'=>false));exit;
- }
- if($expt['province'] != '' && stripos($expt['province'],$ud['province'].'、') !== false)
- {
- echo json_encode(array('msg'=>'此省/州不可使用 '.$expt['servicename'],'success'=>false));exit;
- }
- if($post['type'] != 5 && in_array($post['express'],[2,63,64]))
- {
- echo json_encode(array('msg'=>"此快递方式必须从美仓发货!",'success'=>false));exit;
- }
-
- if($post['type'] == 5 && !in_array($post['express'],[2,63,64]))
- {
- echo json_encode(array('msg'=>"此快递方式不能美仓发货!",'success'=>false));exit;
- }
- /**
- if($warehouse['zd'] == '1' && $warehouse['ys'] != '1' && $thisdata['library'] == '2' && $post['fpdata'] != $thisdata['fpdata'])
- {
- echo json_encode(array('msg'=>'已扣减库存,无法更改产品!','success'=>false));exit;
- }
- **/
- /**
- if($warehousenew['zd'] == '1' && $editstate != $thisdata['state'] && $thisdata['library'] == '1')//如果提交的仓库开启库存模式并且更改订单状态并且未出库,那么拒绝
- {
- echo json_encode(array('msg'=>'如需更改订单状态,请先把仓库选择为非开启库存模式仓库或等待订单出库!','success'=>false));exit;
- }
- if($warehousenew['zd'] == '1' && $editstate != '207' && $thisdata['library'] == '1')//如果提交的仓库开启库存模式并且更改订单状态并且未出库,那么拒绝
- {
- echo json_encode(array('msg'=>'非待发货状态,不允许修改为开启库存模式仓库','success'=>false));exit;
- }
- **/
- //开始注释 xyxg
- /**
- $ft = array();
- $ftdata = explode('|',rtrim($fpcount,'|'));
- foreach ($ftdata as $va)
- {
- $ftitle = '';
- $va = explode('-',trim($va,'-'));
- foreach ($va as $v)
- {
- $v = $this->typeclass->read($v);
- $ftitle .= $v['title'].' ';
- }
- $ft[] = rtrim($ftitle,' ');
- }
- $user = $this->user->get_api($_SESSION['api']);
- if($ud['library'] == 1)
- {
- $tqkcyz = $this->_kcyz($post['type'],$whlabel,$id,$ud['shop'],$ud['number']);
- if(isset($tqkcyz[0]))
- {
- echo json_encode(array('t'=>2,'msg'=>"红色商品名库存匹配错误或库存不够扣减",'error'=>$tqkcyz,'success'=>false));exit;
- }
- if(stripos($whlabel,'z|') !== false || stripos($thisdata['whlabel'],'z|') !== false)
- {
- $tskcyz = $this->specialstock->get_kc($thisdata['state'],$post['state'],$whlabel,$thisdata['whlabel'],$thisdata['number']);
- if($tskcyz['t'] > '0')
- {
- echo $tskcyz['m'];exit;
- }
- }
- $kcyz = $this->whlabel->get_kc($thisdata['state'],$post['state'],$warehousenew['zd'],$warehousenew['ys'],$post['type'],$whlabel,$fpcount,$ft,$thisdata['number'],$thisdata['shop'],$thisdata['type'],$thisdata['whlabel']);//旧状态、新状态、仓库占单设置、仓库预设设置、新仓库、新产品简化数字、旧产品数字、旧产品名称、订单号、订单店铺、旧订单仓库、旧产品简化数字
- if($kcyz['t'] > '0')
- {
- echo $kcyz['m'];exit;
- }
- }
- //结束注释
- **/
- if($ud['state'] == 216 && $post['fpdata'] != $ud['fpdata'])
- {
- echo json_encode(array('msg'=>'商品信息需要找梦体修改','success'=>false));exit;
- }
-
- $warehouse = $this->warehouse->read($post['type']);
- if($ud['library'] == 1 || ($ud['library'] != 2 && ($post['state'] != '207' || $post['state'] == '209')))
- {
- $kcyz = $this->ck->get_kc($post['state'],$warehouse,$thisdata['shop'],$thisdata['number'],$whlabel,$fpdata);
- if($kcyz['t'] > '0')
- {
- echo $kcyz['m'];exit;
- }
- else if($kcyz['fpdata'] != '')
- {
- $post['whlabel'] = $kcyz['whlabel'];
- $post['fpdata'] = $kcyz['fpdata'];
- }
- }
- $fl = $this->ck->get_fl($warehouse['hz'],$whlabel,$fpdata);
- $post['sfxh'] = $fl['sfxh'];
- $post['ckfl'] = $fl['ckfl'];
-
- //查询净重开始
- $post['jweight'] = $this->weight->get_weightcx($post['fpdata']);
- //查询净重结束
-
- if($this->fullorder->save($post,$id))
- {
- if($ud['printtime'] == '0')
- {
- $xghz = ',将自动禁止打印';
- }
- else if($ud['printtime'] > '0' && $ud['librarytime'] == '0')
- {
- $q = '';
- if($ud['libraryconfirm'] == 1)
- {
- $q = ',<em style="color: #F00;">改前状态为:禁止出库</em>';
- }
- $xghz = ',将自动禁止发货'.$q;
- }
- else
- {
- $xghz = '';
- }
- echo json_encode(array('msg'=>'修改成功'.$xghz,'id'=>$id,'cs'=>$ud['state'].' - '.$post['fpdata'].' - '.$ud['fpdata'],'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
- }
-
-
- }
- $arg_array = $arg_array[0];$fpdata = array();
- $fullorder = $this->fullorder->read($arg_array);
- $returngoods = $this->returngoods->get_orderinfo($fullorder['orderinfo']);
- $this->data['returngoods'] = $returngoods?1:0;
- $fullorder['shipremarks'] = str_replace(array('<','>'),array('<','>'),$fullorder['shipremarks']);
- $fullorder['parameter'] = str_replace(",","---",$fullorder['parameter']);
- $this->data['fullorder'] = $fullorder;
- if($fullorder['express'] == 2)
- {
- $zzhl = 'oz';
- }
- else
- {
- $zzhl = 'kg';
- }
- $this->data['zzhl'] = $zzhl;
- $this->data['countrys'] = $this->country->find_all();
- $this->data['express'] = $this->express->find_all();
- $warehouse = $this->warehouse->read($fullorder['type']);
- if(stripos($fullorder['fpdata'],';') !== false)
- {
- $fpdata = explode(';',rtrim($fullorder['fpdata'],';'));
- foreach ($fpdata as $k=>$v)
- {
- $xxv = explode('|',$v);
- if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)
- {
- $xxv['zd'] = "<p>已占单</p>";
- $bdck = $warehouse['bdck'];
- if(stripos($xxv[9],'~') !== false)
- {
- $dxxv = explode('~',trim($xxv[9],'~'));
- foreach ($dxxv as $val)
- {
- $wzid = $this->$bdck->read(trim($val,$warehouse['hz']));
- if($wzid['details'] != '')
- {
- $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
- }
- }
- }
- else
- {
- $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));
- if($wzid['details'] != '')
- {
- $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
- }
- }
- }
- $fpdata[$k] = $xxv;
- }
- }
- $this->data['fpdata'] = $fpdata;
- $this->data['fpdata'] = $fpdata;
- $thfpdataxs = array();
- if($fullorder['thfpdata'] != '')
- {
- $thfpdata = explode(';',trim($fullorder['thfpdata'],';'));
- foreach ($thfpdata as $k=>$v)
- {
- $thxs = explode('~',trim($v,'~'));
- $thxs[0] = explode('|',trim($thxs[0],'|'));
- $thxs[1] = explode('|',trim($thxs[1],'|'));
- $thfpdataxs[] = array("<p>".$thxs[0][1]."<i class='fa fa-level-down'></i></p><p>".$thxs[1][1]."</p>","<p>".$thxs[0][2]."</p><p>".$thxs[1][2]."</p>","<p>旧</p><p>新</p>",$thxs[1][0]);
- }
- }
- $this->data['thfpdata'] = $thfpdataxs;
- $shop = $this->shop->read($fullorder['shop']);
- $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
- $is = 0;
- if($shop['type'] == 269 || $shop['type']==2768 )//判断是否独立站,269是独立站
- {
- $is = 1;
- }
- $this->data['is'] = $is;
- //单项开始
- $warehouse = $this->warehouse->read($fullorder['warehouse']);//发货仓库
- $state = $this->typeclass->read($fullorder['state']);//订单状态
- $country = $this->country->read($fullorder['country']);//国家
- if($fullorder['capital'] == 1)
- {
- $capital = '暂未支付';
- }
- else if($fullorder['capital'] == 2)
- {
- $capital = '部分支付';
- }
- else if($fullorder['capital'] == 3)
- {
- $capital = '全部支付';
- }
- if($fullorder['printtype'] == 1)
- {
- $printtype = '运单';
- }
- else if($fullorder['printtype'] == 2)
- {
- $printtype = '发货单';
- }
- else if($fullorder['printtype'] == 3)
- {
- $printtype = '不打印单据';
- }
- else
- {
- $printtype = '未选择';
- }
- $this->data['warehouse'] = $warehouse['title'];
- $this->data['state'] = $state['title'];
- $this->data['capital'] = $capital;
- $this->data['country'] = $country['name'];
- $this->data['printtype'] = $printtype;
- //单项结束
- /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
- $downwaybill = '';$dwls = array();
- $oldwaybill = explode('-',ltrim($fullorder['oldwaybill'],'-'));
- if(isset($oldwaybill[0][1]))
- {
- $oldwaybill = array_reverse($oldwaybill); //调整顺序
- foreach ($oldwaybill as $v)
- {
- $dw = explode('/',$v);
- if(isset($dw[1]))
- {
- if(stripos($downwaybill,$dw[1]) === false)
- {
- $dwls[$dw[1]] = 1;
- $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
- }
- }
- }
- }
- if($fullorder['printtype'] == 1)
- {
- if($fullorder['waybill'] != '' && !isset($dwls[$fullorder['waybill']]))
- {
- $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullorder['printtime']).'/y-'.$fullorder['waybill'].'.pdf" target="_blank">'.$fullorder['waybill'].'</a>、'.$downwaybill;
- }
- }
- $this->data['downwaybill'] = rtrim($downwaybill,'、');
- /** 历史打印时间 **/
- $printtime = '';
- if($fullorder['oldprinttime'])
- {
- $pte = explode('-',rtrim($fullorder['oldprinttime'],'-'));
- foreach ($pte as $v)
- {
- $printtime .= date('Y-m-d H:i:s',$v).'、';
- }
- }
- $this->data['printtime'] = rtrim($printtime,'、');
- $product = '';
- $fullorder['product'] = str_replace("'","",$fullorder['product']);
- if($fullorder['link'] != '' && $fullorder['source'] != '1')
- {
- $pt = explode(',',$fullorder['product']);
- $lk = explode(',',$fullorder['link']);
- for($i=0;$i<count($pt);$i++)
- {
- if(isset($lk[$i]))
- {
- $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);
- }
- else
- {
- $octs = '';
- }
- $a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];
- //$a = (stripos($pt[$i],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($pt[$i],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($pt[$i],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($pt[$i],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($pt[$i],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($pt[$i],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($pt[$i],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($pt[$i],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($pt[$i],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$pt[$i].'</font>':$pt[$i];
- if(isset($lk[$i]))
- {
- $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';
- }
- else
- {
- $product .= ($product != '')?' , '.$a:$a;
- }
- }
- }
- else
- {
- $octs = $this->colourorderts->get_text($fullorder['product']);
- $a = $octs?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
- //$a = (stripos($fullorder['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullorder['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullorder['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullorder['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullorder['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullorder['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullorder['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullorder['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullorder['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
- $product = $a;
- }
- $this->data['product'] = $product;
- $out = $this->systemtransfer->find_all("number = '".$fullorder['number']."'");
- $outread = '';
- if($out)
- {
- foreach ($out as $val)
- {
- $list = '';
- $rk = explode('|',trim($val['rk'],'|'));
- $rktime = explode('|',trim($val['rktime'],'|'));
- $zw = array();
- $t = $this->transfer->find_all("1=1");
- foreach ($t as $v)
- {
- $zw[$v['id']] = $v['title'];
- }
- if($val['rk'] != '' && count($rk) > 0)
- {
- for($i=0;$i<count($rk);$i++)
- {
- if(!isset($rktime[$i]))
- {
- $list .= $zw[$cz[$i]];
- }
- else
- {
- $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';
- }
- }
- }
- $outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';
- }
- }
- else
- {
- $systemwigsout = $this->systemwigsout->find_all("number = '".$fullorder['number']."'");
- $outread = array();
- if($systemwigsout)
- {
- foreach ($systemwigsout as $v)
- {
- if($v['czwarehouse'] == 37)
- {
- $outread[] = '华荣厂';
- }
- else if($v['czwarehouse'] == 0)
- {
- $outread[] = '龙盈厂';
- }
- $cz = explode('|',trim($v['cz'],'|'));
- $cztime = explode('|',trim($v['cztime'],'|'));
- $zw = $this->transfer->get_list();
- if($v['cz'] != '' && count($cz) > 0)
- {
- for($i=0;$i<count($cz);$i++)
- {
- if(!isset($cztime[$i]))
- {
- $outread[] = $zw[$cz[$i]].' -> ';
- }
- else
- {
- $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -> ';
- }
- }
- $outread[] = '<br>';
- }
- }
- }
- }
- $klarnacolor = '';
- if($fullorder['klarnadata'] !='')
- {
- $klarnadata = explode('|',$fullorder['klarnadata']);
- if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')
- {
- $klarnadata[1] = json_decode($klarnadata[1],true);
- if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullorder['shouldmoney'] && $fullorder['pay'] == 1211)
- {
- $klarnacolor = 'style="color:#F00"';
- }
- }
- else if($klarnadata[0]!=1 && $fullorder['pay']!=26 && $fullorder['pay']!=27 && $fullorder['pay']!=1211)
- {
- $klarnacolor = 'style="color:#F00"';
- }
- if($fullorder['pay'] == 23)//klarna
- {
- $ToState = array('alabama'=>'AL','alaska'=>'AK','arizona'=>'AZ','arkansas'=>'AR','california'=>'CA','colorado'=>'CO','connecticut'=>'CT','delaware'=>'DE','florida'=>'FL','georgia'=>'GA','hawaii'=>'HI','idaho'=>'ID','illinois'=>'IL','indiana'=>'IN','iowa'=>'IA','kansas'=>'KS','kentucky'=>'KY','louisiana'=>'LA','maine'=>'ME','maryland'=>'MD','massachusetts'=>'MA','michigan'=>'MI','minnesota'=>'MN','mississippi'=>'MS','missouri'=>'MO','montana'=>'MT','nebraska'=>'NE','nevada'=>'NV','new hampshire'=>'NH','new jersey'=>'NJ','new mexico'=>'NM','new york'=>'NY','north carolina'=>'NC','north dakota'=>'ND','ohio'=>'OH','oklahoma'=>'OK','oregon'=>'OR','pennsylvania'=>'PA','rhode island'=>'RI','south carolina'=>'SC','south dakota'=>'SD','tennessee'=>'TN','texas'=>'TX','utah'=>'UT','vermont'=>'VT','virginia'=>'VA','washington'=>'WA','west virginia'=>'WV','wisconsin'=>'WI','wyoming'=>'WY','district of columbia'=>'DC','virgin islands'=>'VI','guam'=>'GU','puerto rico'=>'PR');
- $ToState = array_flip($ToState);
- $klarnadata3 = str_replace(' ','',$klarnadata[3]);
- $city = str_replace(' ','',$fullorder['city']);
- $klarnadataaddress = explode($city,$klarnadata3);
- if(isset($klarnadataaddress[1]))
- {
- $klarnadata3 = $city.$klarnadataaddress[1];
- $klarnadatacolor = explode(',',$klarnadata3);
- unset($klarnadatacolor[4]);
- unset($klarnadatacolor[6]);
- if(isset($ToState[$klarnadatacolor[1]]))
- {
- $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);
- }
- $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);
- }
- else
- {
- $klarnadata['color'] = $klarnadata3;
- }
- }
- }
- else
- {
- $klarnadata = '';
- }
- $p = explode('-',$fullorder['paypal']);
- $this->data['klarnacolor'] = $klarnacolor;
- $this->data['klarnadata'] = $klarnadata;
- $this->data['systemwigsout'] = $outread;
- $quantity = explode(';',trim($fullorder['quantity'],';'));
- $qc = 0;
- foreach ($quantity as $v)
- {
- if($v > 1)
- {
- $qc += 1;
- }
- }
- $this->data['qc'] = $qc;
- //新增row_total和sub_total
- $product_ids = $row_total = $sub_total = "";
- if(!empty($fullorder['extra_price'])){
- $extra_price = json_decode($fullorder['extra_price'],true);
- foreach($extra_price as $k=>$v){
- $row_total .= sprintf("%.2f",($v['qty']* $v['price'])).";";
- $sub_total .= sprintf("%.2f",$v['sub_total']).";";
- if(!empty($v['product_id'])){
- $product_ids .= $v['product_id'].";";
- }
- }
- }
- $this->data['row_total'] = trim($row_total,";");
- $this->data['sub_total'] = trim($sub_total,";");
- $this->data['product_ids'] = trim($product_ids,";");
-
- $this->_Template('fullorder_readonly',$this->data);
- }
- //浏览列表
- public function _readlist()
- {
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $usersp = explode('|',trim($user['shop'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $shop = $this->input->post('shop',true);
- $warehouse = $this->input->post('warehouse',true);
- $express = $this->input->post('express',true);
- $state = $this->input->post('state',true);
- $print = $this->input->post('print',true);
- $libraryconfirm = $this->input->post('libraryconfirm',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $client = $this->input->post('name',true);
- $email = $this->input->post('email',true);
- $number = $this->input->post('number',true);
- $waybill = $this->input->post('waybill',true);
- $authorid = $this->input->post('authorid',true);
- $sourcecontentid = $this->input->post('sourcecontentid',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($warehouse)
- {
- $where .= " and type = '$warehouse'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($state)
- {
- $where .= " and state = '$state'";
- }
- if($print)
- {
- $where .= " and print = '$print'";
- }
- if($libraryconfirm)
- {
- $where .= " and libraryconfirm = '$libraryconfirm'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($client)
- {
- $where .= " and client like '%$client%'";
- }
- if($email)
- {
- $where .= " and email = '$email'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($waybill)
- {
- $where .= " and waybill = '$waybill'";
- }
- if($authorid)
- {
- $where .= " and authorid = '$authorid'";
- }
- if($sourcecontentid)
- {
- $where .= " and sourcecontentid = '$sourcecontentid'";
- }
- if($timetk && $timetj)
- {
- $timetj = $timetj+24*3600;
- $where .= " and dtime > '$timetk' and dtime < '$timetj'";
- }
- //数据排序
- $order_str = "dtime desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,sname,state,buytime,review,libraryconfirm,express,waybill,exstate,orderremarks,library,clientremarks,waybillid',$order_str,$start,$perpage);
- //格式化数据
- $dt = 0;
- foreach ($info_list as $key=>$value)
- {
- $ud = $this->fullorder->read($value['id']);
- $ud['address'] = str_replace("'","’",$ud['address']);
- $ud['name'] = str_replace("'","’",$ud['name']);
- $customer = $this->customer->get_email($ud['email'],$value['shop']);
- $customernum = $this->fullorder->find_count("email = '".$ud['email']."' and shop = '".$value['shop']."'");
- preg_match_all('/[0-9]/u',$ud['phone'],$result);
- $numphone = join('',$result[0]);
- $customerb = $this->customer->find_all("type = 2 and (email = '".$ud['email']."' or address = '".$ud['address']."' or numphone = '".$numphone."')",'*','id desc');
- $customerc = $this->customer->find_all("type = 1 and shop = '".$ud['shop']."' and address = '".$ud['address']."' and numphone = '".$numphone."'",'*','id desc');
- //$a = array_column($customer, 'email'); //三维找其中健的数组
- //$a = array_flip($a); //键和值调换
- $lkh = $value['sname'];
- $djlkh = 0;$djhmd = 0;
- if($customer)
- {
- if(($customer['type'] == 1 && $customernum > 1))// || $customerc['type'] == 1 && $customerc['num'] > 1
- {
- $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
- $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";
- $djlkh = 1;
- $djcount = $count;
- }
- else if(isset($customerc[0]['num']))
- {
- if($customerc[0]['num'] > 1)
- {
- $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
- $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";
- $djlkh = 1;
- $djcount = $count;
- }
- }
- }
- if($customerb)
- {
- $hmsp = $this->shop->read($customerb[0]['shop']);
- $count = $customerb[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerb[0]['count'].'"></i>':'';
- $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'>".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
- $djhmd = 1;
- }
- if($djlkh == '1' && $djhmd == '1')
- {
- $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'><em style='color:#FF3333'>".$djcount."老客户</em> - ".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
- }
- $info_list[$key]['sname'] = $lkh;
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- //$info_list[$key]['user'] = $shop['shopuser'];
- $warehouse = $this->warehouse->read($value['type']);
- $warehousetitle = $warehouse['title'];
- if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
- $info_list[$key]['type'] = $warehousetitle;
- $typeclass = $this->typeclass->read($value['state']);
- $info_list[$key]['state'] = $typeclass['spare'];
- $wl = '';
- if($value['exstate'] == '99')
- {
- $wl = '<font style="color:#ccc">未获取到物流信息</font>';
- }
- else if($value['exstate'] == '1')
- {
- $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已揽收<font style="display: none">'.$ud['excontent'].'</font></font>';
- }
- else if($value['exstate'] == '2')
- {
- $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">在途中<font style="display: none">'.$ud['excontent'].'</font></font>';
- }
- else if($value['exstate'] == '3')
- {
- $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送中<font style="display: none">'.$ud['excontent'].'</font></font>';
- }
- else if($value['exstate'] == '4')
- {
- $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已签收<font style="display: none">'.$ud['excontent'].'</font></font>';
- }
- else if($value['exstate'] == '5')
- {
- $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送异常<font style="display: none">'.$ud['excontent'].'</font></font>';
- }
- $info_list[$key]['exstate'] = $wl.'<br />';
- if($ud['source'] == 1) //线下单用订单时间,其他用付款时间
- {
- $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$ud['dtime']).'</p><p>'.date('H:i:s',$ud['dtime']).'</p>';
- }
- else
- {
- $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$value['buytime']+$dt).'</p><p>'.date('H:i:s',$value['buytime']+$dt).'</p>';
- }
- if($value['review'] == 1)
- {
- $info_list[$key]['review'] = "未送审";
- }
- else if($value['review'] == 2)
- {
- $info_list[$key]['review'] = "<font style='color:#555'>待审核</font>";
- }
- else if($value['review'] == 3)
- {
- $info_list[$key]['review'] = "<font style='color:#f90f4b'>不通过</font>";
- }
- else if($value['review'] == 4)
- {
- $info_list[$key]['review'] = "取消重审";
- }
- else if($value['review'] == 5)
- {
- $info_list[$key]['review'] = "<font style='color:#2f80f9'>审核通过</font>";
- }
- else if($value['review'] == 6)
- {
- $info_list[$key]['review'] = "<font style='color:#2f80f9'>自动通过</font>";
- }
- if($ud['dlz'] == 1)
- {
- $dlz = "<p>独立站已更新</p>";
- }
- else if($ud['dlz'] == 3)
- {
- $dlz = "<p>不需要更新</p>";
- }
- else if($ud['dlz'] == 2)
- {
- $dlz = "<p style='color:#C3C'>独立站更新失败</p>";
- }
- else
- {
- $dlz = "";
- }
- if($value['waybill'] != "")
- {
- $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz;
-
- if( !empty($value['waybillid'])){
- $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz."<p>".$value['waybillid']."</p>";
- }
-
-
-
- }
- if($value['express'] != 0)
- {
- $express = $this->express->read($value['express']);
- $expressservicename = $express['servicename'];
- if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
- $info_list[$key]['express'] = $expressservicename;
- }
- else
- {
- $info_list[$key]['express'] = "无";
- }
- $tly = "";
- if($value['clientremarks'] != "")
- {
- $tly = "<p style='color:#FF3333'>有客户留言</p>";
- }
- if($value['library'] == 1 && $ud['printtype'] == 3)
- {
- $info_list[$key]['library'] = "不需要";
- }
- else if($value['library'] == 1 && $ud['printtype'] != 3)
- {
- $info_list[$key]['library'] = "未出库";
- }
- else if($value['library'] == 2)
- {
- $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'出库</p>';
- }
- else if($value['library'] == 3)
- {
- $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['retreattime']).'</p><p>'.date('H:i:s',$ud['retreattime']).'退库</p>';
- }
- if($ud['authorid'] != '' && $ud['authorid'] != 0)
- {
- $info_list[$key]['orderremarks'] = '<p>'.$value['orderremarks'].'</p><p style="border-top: 1px dashed #C2C2C2;">author_id:</p><p>'.$ud['authorid'].'</p><p>source_content_id:</p><p>'.$ud['sourcecontentid'].'</p>';
- }
- unset($info_list[$key]['waybillid']);
- }
- $total = $this->fullorder->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $this->data['wlshop'] = $wlshop;
- $this->_Template('fullorder_readlist',$this->data);
- }
-
-
- public function _readlistdown()
- {
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $usersp = explode('|',trim($user['shop'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->get(NULL, TRUE);
- if(isset($post['excel']))
- {
- $shop = $this->input->get('shop',true);
- $warehouse = $this->input->get('warehouse',true);
- $express = $this->input->get('express',true);
- $state = $this->input->get('state',true);
- $print = $this->input->get('print',true);
- $libraryconfirm = $this->input->get('libraryconfirm',true);
- $orderinfo = $this->input->get('orderinfo',true);
- $client = $this->input->get('name',true);
- $email = $this->input->get('email',true);
- $number = $this->input->get('number',true);
- $waybill = $this->input->get('waybill',true);
- $authorid = $this->input->get('authorid',true);
- $sourcecontentid = $this->input->get('sourcecontentid',true);
- $timetk = $this->input->get('timetk',true);
- $timetj = $this->input->get('timetj',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($warehouse)
- {
- $where .= " and type = '$warehouse'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($state)
- {
- $where .= " and state = '$state'";
- }
- if($print)
- {
- $where .= " and print = '$print'";
- }
- if($libraryconfirm)
- {
- $where .= " and libraryconfirm = '$libraryconfirm'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($client)
- {
- $where .= " and client like '%$client%'";
- }
- if($email)
- {
- $where .= " and email = '$email'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($waybill)
- {
- $where .= " and waybill = '$waybill'";
- }
- if($authorid)
- {
- $where .= " and authorid = '$authorid'";
- }
- if($sourcecontentid)
- {
- $where .= " and sourcecontentid = '$sourcecontentid'";
- }
- if($timetk && $timetj)
- {
- $timetj = $timetj+24*3600;
- $where .= " and dtime > '$timetk' and dtime < '$timetj'";
- }
- //数据排序
- $order_str = "dtime desc";
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'shop,number,orderinfo,buytime,name,express,waybill,email,shipremarks,shouldmoney,orderremarks,librarytime,authorid,sourcecontentid',$order_str);
- //格式化数据
- $dt = 0;
- foreach ($info_list as $key=>$value)
- {
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- $info_list[$key]['buytime'] = date('Y-m-d H:i:s',$value['buytime']);
- if($value['librarytime'] > 0)
- {
- $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);
- }
- if($value['express'] != 0)
- {
- $express = $this->express->read($value['express']);
- $info_list[$key]['express'] = $express['servicename'];
- }
- else
- {
- $info_list[$key]['express'] = "无";
- }
-
- }
- $title = "订单列表 ".date("Y-m-d");
- $titlename = "<table border=1>
- <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
- <tr>
- <td>店铺</td>
- <td>编号</td>
- <td>订单号</td>
- <td>订单日期</td>
- <td>客户姓名</td>
- <td>快递方式</td>
- <td>运单号</td>
- <td>邮箱</td>
- <td>仓库品名</td>
- <td>订单金额</td>
- <td>订单备注</td>
- <td>出库时间</td>
- <td>author_id</td>
- <td>source_content_id</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "\n";
- $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
- }
- }
- //删除
- public function _del()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['s']))
- {
- $id_arr = $this->input->post('s');
- $id_arr = explode(',',$id_arr);
- if(!$id_arr)
- {
- echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
- }
- //循环删除记录
- foreach ($id_arr as $v)
- {
- $this->fullorder->remove($v);
- }
- echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
- }
- }
- //查找商品价格
- public function _price()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['data']))
- {
- $data = $this->input->post('data');
- $data = explode('-',$data);
- $number = '';$num = count($data);
- //循环删除记录
- for($i=0;$i<$num-1;$i++)
- {
- if($data[$i] != 0)
- {
- $number=$number.$data[$i];
- if($i == 2)
- {
- $number=$number.$data[$num-1];
- }
- }
- }
- $list = $this->productdescribe->get_number($number);
- if($list)
- {
- echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));
- }
- else
- {
- $list = array('purchase'=>0,'cost'=>0,'salesprice'=>0);
- //echo json_encode(array('msg'=>'此信息没有配置价格!','n'=>$data[$num-1],'success'=>false));exit;
- echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));exit;
- }
- }
- }
-
- public function _customs()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['e']))
- {
- $e = $this->input->post('e');//快递信息
- $c = $this->input->post('c');//国家信息
- $data = $this->customs->find_all('express = "'.$e.'" and country = "'.$c.'"');
- $list = $this->productdescription->find_all('express = "'.$e.'" and country = "'.$c.'"');
- $rows = array();
- foreach ($data as $key=>$value)
- {
- $detailed = explode('|',trim($value['detailed'],'|'));
- //此处未对比重量选择价值,暂直接选择第一条海关价值
- $detailed = $this->detailed->read($detailed[0]);
- $money = $detailed['customsval'];//找到海关价值
- }
- foreach ($list as $key=>$value)
- {
- $description = $this->typeclass->read($value['description']);
- $list[$key]['title'] = $description['title'];//产品描述名称
-
- }
- if(!$data && !$list)
- {
- echo json_encode(array('msg'=>'无此快递配置信息!','success'=>false));exit;
- }
- else
- {
- //$list-title -description 取值
- echo json_encode(array('money'=>sprintf("%.2f",$money),'msg'=>$list,'success'=>true));
- }
- }
- }
- public function _express()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['e']))
- {
- $e = $this->input->post('e');//快递信息
- $c = $this->input->post('c');//国家信息
- $data = $this->logistics->find_all('express = "'.$e.'" and country = "'.$c.'"');
- if(!$data)
- {
- echo json_encode(array('success'=>false));exit;
- }
- else
- {
- echo json_encode(array('money'=>sprintf("%.2f",$data[0]['firstmoney']),'success'=>true));
- }
- }
- }
- public function _hl()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['cy']))
- {
- $hl = 0;
- $cy = $this->input->post('cy');//币种ID
- $cy = $this->typeclass->read($cy);
- $gethl = $this->hl->get_hl();
- foreach ($gethl as $v)
- {
- $code = str_replace(" ","",$v['code']);
- if($code == $cy['title'])
- {
- $hl = $v['refePrice']/100;
- }
-
- }
- echo json_encode(array('msg'=>$hl,'success'=>true));
- }
- }
- public function _operation()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['type']))
- {
- $type = $this->input->post('type');
- $id = $this->input->post('id');
- $msg = $this->input->post('msg');
- $d = $this->fullorder->read($id);
- $time = time();
- if($type == 1)//禁止发货
- {
-
- if($d['library'] != 1)
- {
- echo json_encode(array('msg'=>'操作失败,订单非未出库状态!','success'=>false));exit;
- }
- if($msg == "")
- {
- echo json_encode(array('msg'=>'必须填写禁止原因!','success'=>false));exit;
- }
- if($d['print'] < 3)
- {
- $a = "订单未打印,";
- }
- else
- {
- $a = "";
- }
- if($this->fullorder->save(array('libraryconfirm'=>1,'librarynot'=>$a.$msg),$id))
- {
- echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- }
- if($type == 6)//允许发货
- {
-
- if($d['library'] > 1)
- {
- echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;
- }
- if($d['print'] < 3)
- {
- $a = "订单未打印,";
- }
- else
- {
- $a = "";
- }
- if($this->fullorder->save(array('libraryconfirm'=>2,'librarynot'=>$a.$msg),$id))
- {
- echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- }
- if($type == 7)//禁止打印
- {
-
- if($d['printtime'] != 0)
- {
- echo json_encode(array('msg'=>'订单已打印,操作失败','success'=>false));exit;
- }
- if($d['library'] > 1)
- {
- echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;
- }
- if($d['print'] < 3)
- {
- $a = "订单未打印,";
- }
- else
- {
- $a = "";
- }
- if($this->fullorder->save(array('print'=>1),$id))
- {
- echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- }
- if($type == 8)//允许打印
- {
-
- /**
- if($d['printtime'] != 0)
- {
- echo json_encode(array('msg'=>'订单已打印,操作失败','success'=>false));exit;
- }
- **/
- if($d['library'] > 1)
- {
- echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;
- }
- if($d['print'] < 3)
- {
- $a = "订单未打印,";
- }
- else
- {
- $a = "";
- }
- if($d['printtime'] == '0')
- {
- $bcprint = 2;
- }
- else
- {
- $bcprint = 3;
- }
- if($this->fullorder->save(array('print'=>$bcprint,'failed'=>''),$id))
- {
- echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- }
- if($type == 9)//关闭
- {
- if($this->fullorder->save(array('failed'=>''),$id))
- {
- echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- }
- if($type == 2)//填写运单、修改运单
- {
-
- if($d['express'] == 0)
- {
- echo json_encode(array('msg'=>'操作失败,未选择物流方式!','success'=>false));exit;
- }
- if($d['library'] == 3 || ($d['print'] == 3 && $d['libraryconfirm'] == 1))
- {
- echo json_encode(array('msg'=>'操作失败,不允许填写运单号!','success'=>false));exit;
- }
- if($msg == '')
- {
- echo json_encode(array('msg'=>'运单号不能为空!','success'=>false));exit;
- }
- $ckemail = '';
- $d['waybill'] = $msg;
- $xg = $this->fullorder->read($id);
- $shop = $this->shop->read($xg['shop']);
- $ex = $this->express->read($xg['express']);
- $fs = $this->notice->find_all("shop = '".$d['shop']."' and message = '1' and state = '1' and type = '4' and ktime < '$time' and jtime > '$time'");
- if(isset($fs[0]))
- {
- $fs = $fs[0];
- $fs['email'] = $this->emaildata->read($fs['email']);
- if(($xg['dlzemail'] == 1 && $msg != $xg['waybill']) || $xg['dlzemail'] == 0)
- {
- $warehouse = $this->warehouse->read($xg['type']);
- $ck = $this->notice->get_god($d,$shop,$ex,$fs);
- if($ck == 1)
- {
- $ckemail = '邮件发送成功,';
- $this->fullorder->save(array('dlzemail'=>1,'dlzemailtime'=>time()),$id);
- }
- }
- }
- if( $msg )
- {
- if($xg['source'] != 1)
- {
- $ms = $this->message->find_all("express like '%,".$xg['express'].",%'");
- if(!isset($ms[0]))
- {
- $ms = $this->message->read(2);
- }
- else
- {
- $ms = $ms[0];
- }
- if($xg['shop'] == 5){
- $ddh = $xg['orderinfo'];
- }else{
- $ddh = substr($xg['orderinfo'],1);
- }
-
- $shopifyid = $xg['shopify'];
- //独立站地址更新订单状态、物流信息
- $shopname = $shop['brandname']; //店铺名
- $buyername = $xg['bname']; //Bill Name
- $email_call = $shop['shopid']; //发货人邮箱;
- $phone = $shop['shopphone']; //发货人电话
- $track_type = $ex['title']; //快递名称
- $service = $ex['title']; //快递追踪名称
- $track_link = $ex['url']; //快递查询网址
- $logistics_number = $msg; //运单号
- $t= array('%buyername%','%email_call%','%track_type%','%service%','%track_link%','%logistics_number%','%shop%','%phone%','%jtime%');
- $h= array($buyername,$email_call,$track_type,$service,$track_link,$logistics_number,$shopname,$phone,$ex['yjtime']);
- $remark = str_replace($t,$h,$ms['content']);
- $gx = $this->api->get_gx($ddh,$msg,$xg,$shop,$ex,$remark,$shopifyid);
- }
- else if($xg['source'] == 1)
- {
- $gx['res'] = 3;
- $gx['state'] = 216;
- $gx['cw'] = 'a';
- }
- }
- else
- {
- $gx['res'] = $xg['dlz'];
- $gx['state'] = $xg['state'];
- $gx['cw'] = 'b';
- }
- $xg['iscode'] = $ex['title'];
- $xg['url'] = $shop['shopname'];
- $xg['waybill'] = $msg;
- @$chuanshu = $this->api->get_paypal($xg);
- $this->afspaypal->insert(array('number'=>$xg['number'],'cs'=>$chuanshu));
- $msg = preg_replace('/( | | | |\s)/','',$msg);
- if($this->fullorder->save(array('waybill'=>$msg,'state'=>$gx['state'],'dlz'=>$gx['res']),$id))
- {
- if($gx['res'] == 2)
- {
- echo json_encode(array('msg'=>$ckemail.'传输独立站失败!','cs'=>$gx['state'].' - '.$gx['res'].' - '.$gx['cw'],'success'=>false));exit;
- }
- echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- }
- }
- }
- public function _merge()
- {
-
-
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['s']))
- {
- $id_arr = $this->input->post('s');
- $id_arr = explode(',',trim( $id_arr,','));
- $id_arr = array_reverse($id_arr);
- if(!$id_arr)
- {
- echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
- }
- if(count($id_arr) < 2)
- {
- echo json_encode(array('msg'=>'缺少可合并单!','success'=>false));exit;
- }
- $post = array();
- $u = $this->fullorder->read($id_arr[0]);
- unset($id_arr[0]);
- $this->db->trans_begin();
- $hd = $this->fullorderhb->get_orderinfo($u['orderinfo']);
- if(!$hd)
- {
- $this->fullorderhb->insert($u);
- }
- //相加
- $post['shouldmoney'] = $u['shouldmoney'];//购买应收金额
- $post['budget'] = $u['budget'];//预估到帐金额
- $post['expressmoney']= $u['expressmoney'];//物流金额
- //$post['refundy'] = $u['refundy'];//补/退原额
- //$post['refundj'] = $u['refundj'];//补/退净额
- $post['cost'] = $u['cost'];//成本金额
- //$post['zzl'] = $u['zzl'];//总重量
- //$post['zsbjz'] = $u['zsbjz'];//总申报价值
- $post['ts'] = $u['ts'];//条数
- $post['cost'] = $u['cost'];//成本金额
- //追加
- $post['rpaypal'] = $u['rpaypal'];//补/退交易号
- $post['rtext'] = $u['rtext'];//补/退原因
- $post['pay'] = $u['pay'];//付款方式
- $post['paypal'] = $u['paypal'];//交易号
- $post['clientremarks'] = $u['clientremarks'];//客户留言
- $post['product'] = $u['product'];//商品名称
- //$post['issku'] = $u['issku'];//sku
- //$post['orderremarks'] = $u['orderremarks'];//订单备注
- $post['shipremarks'] = $u['shipremarks'];//仓库品名
- //产品追加
- $post['fpdata'] = $u['fpdata'];//产品内容
- $post['whlabel'] = $u['whlabel'];//产品对应库存码
-
- $merge = $u['id'];
- $d = array($u['id']);$order = '';
- $zsl = 0;$zccsl = 0;
- foreach ($id_arr as $v)
- {
- $v = $this->fullorder->read($v);
- if($u['type'] != $v['type'])
- {
- echo json_encode(array('msg'=>'仓库不一致,无法合并!','success'=>false));exit;
- }
- if($v['shop'] = $u['shop'])
- {
- $hd = $this->fullorderhb->get_orderinfo($v['orderinfo']);
- if(!$hd)
- {
- $this->fullorderhb->insert($v);
- }
- $post['shouldmoney'] += $v['shouldmoney'];//购买应收金额
- $post['budget'] += $v['budget'];//预估到帐金额
- $post['expressmoney'] += $v['expressmoney'];//物流金额
- //$post['refundy'] += $v['refundy'];//补/退原额
- //$post['refundj'] += $v['refundj'];//补/退净额
- $post['cost'] += $v['cost'];//成本金额
- //$post['zzl'] += $v['zzl'];//总重量
- //$post['zsbjz'] += $v['zsbjz'];//总申报价值
- $post['ts'] += $v['ts'];//条数
-
- //$post['rpaypal'] .= $v['rpaypal'];//补/退交易号
- //$post['rtext'] .= $v['rtext'];//补/退原因
- //$post['pay'] .= (stripos($post['pay'],$v['pay']) !== false)?'':';'.$v['pay'];//付款方式
- //$post['paypal'] .= $v['paypal'];//交易号
- $post['clientremarks'] .= $v['clientremarks'];//客户留言
- $post['product'] .= $v['product'];//商品名称
- //$post['issku'] .= $v['issku'];//sku
- //$post['orderremarks'] .= $v['orderremarks'];//订单备注
- $post['shipremarks'] .= $v['shipremarks'];//仓库品名
-
- $post['fpdata'] .= $v['fpdata'];//产品内容
- $post['whlabel'] .= ltrim($v['whlabel'],'|');//产品对应库存码
-
- $d[] = $v['id'];
- $order .= $v['orderinfo'].'('.$v['number'].')、';
-
- $wl = $this->whlabel->find_all("zd = '".$v['number']."'");//查找是否有占用库存情况
- $i = 0;
- if($wl)//如果有那么清除所有占用
- {
- foreach ($wl as $val)
- {
- if($val['sku'] == 'Preset' && $val['state'] == '9')
- {
- $this->whlabel->remove($val['id']);//删除预设
- $i++;
- }
- else
- {
- $this->whlabel->save(array('zd'=>''),$val['id']);//专属
- $i++;
- }
- }
- }
- $zsl += count($wl);
- $zccsl += $i;
- $this->fullorder->save(array('merge'=>$u['id'],'mergeid'=>1,'orderremarks'=>' 《合并信息》:'.'已合并到'.$u['orderinfo'].'('.$u['number'].')中; '.$v['orderremarks'],'shouldmoney'=>0,'print'=>1,'libraryconfirm'=>1,'shouldmoney'=>0,'budget'=>0,'whlabel'=>'','fpdata'=>'','shipremarks'=>''),$v['id']);
- }
- }
- //计算出单条价值
- /**
- if($post['zsbjz'] < 1 || $post['ts'] < 1)
- {
- //$post['dtsbjz'] = 0;
- }
- else
- {
- //$post['dtsbjz'] = $post['zsbjz']/$post['ts'];//单条申报价
- }
- **/
- $post['orderremarks'] = ' 《合并信息》:由'.rtrim($order,'、').'合并而来; '.$u['orderremarks'];;
-
- $post['merge'] = $u['id'];
-
- //$post['mergeid'] = 1;
-
- //合并重复项
- $hbcfw = explode('|',trim($post['whlabel'],'|'));
- $hbcff = explode(';',trim($post['fpdata'],';'));
- $c = 0;
- $hbw = array();
- $hbf = array();
- for($i=0;$i<count($hbcfw);$i++)
- {
- $w = explode('-',$hbcfw[$i]);
- $f = explode('|',$hbcff[$i]);
- if(isset($w[2]))
- {
- $w2 = ($w[2]==0)?0:'';
- }
- else
- {
- $w2 = '';
- }
- if(!isset($hbw[$w[0].$w2]))
- {
- $hbw[$w[0].$w2] = $hbcfw[$i];
- $hbf[$w[0].$w2] = $hbcff[$i];
- }
- else
- {
- $c++;
- $cw = explode('-',$hbw[$w[0].$w2]);
- $cf = explode('|',$hbf[$w[0].$w2]);
- if($cw[2] != 0 && $w[2] != 0)
- {
- $cf[2] += $f[2];
- $cf[9] .= '~'.$f[9];
- $hbf[$w[0].$w2] = implode("|",$cf);
- $cw[1] += $f[2];
- $cw[2] .= '~'.$f[9];
- $hbw[$w[0].$w2] = implode("-",$cw);
- }
- else if($cw[2] == 0 && $w[2] == 0)
- {
- $cf[2] += $f[2];
- $hbf[$w[0].$w2] = implode("|",$cf);
- $cw[1] += $f[2];
- $hbw[$w[0].$w2] = implode("-",$cw);
- }
- else
- {
- $hbw[] = $hbcfw[$i];
- $hbf[] = $hbcff[$i];
- }
- }
- }
- if($c > 0)
- {
- $post['fpdata'] = implode(";",$hbf).';';
- $post['whlabel'] = '|'.implode("|",$hbw).'|';
- }
- //合并重复项结束
-
- $this->fullorder->save($post,$u['id']);
- if ($this->db->trans_status() === FALSE)
- {
- $this->db->trans_commit();
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- else
- {
- $this->db->trans_commit();
- echo json_encode(array('msg'=>'操作成功','d'=>($d),'b'=>$u['id'],'success'=>true));
- }
- }
- /**
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['type']))
- {
- $type = $this->input->post('type');
- $id = $this->input->post('id');
- $u = $this->fullorder->read($id);
- $rows = $this->fullorder->find_all('name = "'.$u['name'].'" or email = "'.$u['email'].'" or address = "'.$u['address'].'"','*','id desc');
- if(count($rows)>1)
- {
- $this->db->trans_begin();
- $fpdata=$rows[0]['fpdata'];//购买产品
- $shouldmoney=$rows[0]['shouldmoney'];//购买应收金额
- $budget=$rows[0]['budget'];//预估到帐金额
- $cost=$rows[0]['cost'];//成本金额
- $merge=$rows[0]['id'];
- $d = array($rows[0]['id']);
- for($i=1;$i<count($rows);$i++)
- {
- $fpdata=$fpdata.$rows[$i]['fpdata'];
- $shouldmoney=$shouldmoney+$rows[$i]['shouldmoney'];
- $budget=$budget+$rows[$i]['budget'];
- $cost=$cost+$rows[$i]['cost'];
- $d[] = $rows[$i]['id'];
- $this->fullorder->save(array('merge'=>$rows[0]['id'],'mergeid'=>1),$rows[$i]['id']);
- }
- $this->fullorder->save(array('fpdata'=>$fpdata,'shouldmoney'=>$shouldmoney,'budget'=>$budget,'cost'=>$cost,'merge'=>$merge),$rows[0]['id']);
- if ($this->db->trans_status() === FALSE)
- {
- $this->db->trans_commit();
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- else
- {
- $this->db->trans_commit();
- echo json_encode(array('msg'=>'操作成功','d'=>($d),'b'=>$rows[0]['id'],'success'=>true));
- }
-
- }
- }
- **/
- }
- //评价管理
- public function _evaluate()
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user)
- {
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $shop = $this->input->post('shop',true);
- $where = "1=1 and evaluate = 0 and (".rtrim($fgshop,'or').")";
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- //数据排序
- $order_str = "id desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,operation',$order_str,$start,$perpage);
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- $info_list[$key]['operation'] = "评价";
- }
- $total = $this->fullorder->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }
- $this->_Template('fullorder_evaluate',$this->data);
- }
-
- //订单消息
- public function _state()
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user)
- {
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $shop = $this->input->post('shop',true);
- $expressstate = $this->input->post('expressstate',true);
- $fs = $this->input->post('fs',true);
- $state = $this->input->post('state',true);
- $express = $this->input->post('express',true);
- $review = $this->input->post('review',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $number = $this->input->post('number',true);
- $waybill = $this->input->post('waybill',true);
- $xztime = $this->input->post('xztime',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
- if($timetk && $timetj)
- {
- $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
- }
- if($xztime == 'librarytime')
- {
- $order_str = "librarytime desc";
- }
- else if($xztime == 'dtime')
- {
- $order_str = "dtime desc";
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($expressstate)
- {
- $where .= " and expressstate = '$expressstate'";
- }
- if($review)
- {
- $where .= " and review = '$review'";
- }
- if($fs)
- {
- if($fs == '2')
- {
- $where .= " and exstateerror != ''";
- }
- else
- {
- $where .= " and exstateerror = ''";
- }
- }
- if($state)
- {
- $where .= " and state = '$state'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($waybill)
- {
- $where .= " and waybill = '$waybill'";
- }
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,country,library,librarytime,express,waybill,content,orderremarks,exstateerror',$order_str,$start,$perpage);
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- $country = $this->country->read($value['country']);
- $info_list[$key]['country'] = $country['name'];
- //$state = $this->typeclass->read($value['state']);
- //$info_list[$key]['state'] = $state['title'];
- if($value['library'] == 1)
- {
- $info_list[$key]['library'] = "未出库";
- }
- else if($value['library'] == 2)
- {
- $info_list[$key]['library'] = "已出库";
- }
- else if($value['library'] == 3)
- {
- $info_list[$key]['library'] = "已退库";
- }
- if($value['librarytime'] == '0')
- {
- $info_list[$key]['librarytime'] = '无';
- }
- else
- {
- $info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']);
- }
- $express = $this->express->read($value['express']);
- $info_list[$key]['express'] = $express['servicename'];
- }
- $total = $this->fullorder->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }
- $notice = $this->notice->find_all("type = '1' and (".rtrim($fgshop,'or').")");
- $this->data['notice'] = $notice;
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $this->data['wlshop'] = $wlshop;
- $this->data['express'] = $this->express->find_all();
- $this->_Template('fullorder_state',$this->data);
- }
-
- //物流信息
- public function _wl()
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user)
- {
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $shop = $this->input->post('shop',true);
- $expressstate = $this->input->post('expressstate',true);
- $fs = $this->input->post('fs',true);
- $state = $this->input->post('state',true);
- $express = $this->input->post('express',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $number = $this->input->post('number',true);
- $waybill = $this->input->post('waybill',true);
- $wlyc = $this->input->post('wlyc',true);
- $wltype = $this->input->post('wltype',true);
- $source = $this->input->post('source',true);
- $xztime = $this->input->post('xztime',true);
- $wlbz = $this->input->post('wlbz',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
- if($timetk && $timetj)
- {
- $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
- }
- if($xztime == 'librarytime')
- {
- $order_str = "librarytime desc";
- }
- else if($xztime == 'dtime')
- {
- $order_str = "dtime desc";
- }
- else if ($xztime == 'wlfstime')
- {
- $order_str = "wlfstime desc";
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($fs)
- {
- if($fs == '1')
- {
- $where .= " and wlcontent != ''";
- }
- if($fs == '2')
- {
- $where .= " and wlerror != ''";
- }
- if($fs == '3')
- {
- $where .= " and wlcontent = '' and shouldmoney > 100";
- }
- else if($fs == '4')
- {
- $where .= " and wltype = '1'";
- }
- }
- if($state)
- {
- $where .= " and state = '$state'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($waybill)
- {
- $where .= " and waybill = '$waybill'";
- }
- if($wlbz)
- {
- $where .= " and wlbz like '%$wlbz%'";
- }
- if($wlyc!='')
- {
- $where .= " and wlyc = '$wlyc'";
- }
- if($wltype!='')
- {
- $where .= " and wltype = '$wltype'";
- }
- if($source)
- {
- if($source == 1)
- {
- $where .= " and source = '$source'";
- }
- else
- {
- $where .= " and source != '1'";
- }
- }
- if($expressstate != '')
- {
- if($expressstate == 99)
- {
- $cxid = '';
- $sjcc = $this->awlgx->find_all("time < '".(time()-3*24*3600)."' and exstate != 6",'number');
- foreach ($sjcc as $v)
- {
- $cxid .= "number = '".$v['number']."' or ";
- }
- $where .= ' and ('.rtrim($cxid,'or ').')';
- }
- else
- {
- $where .= " and expressstate = '$expressstate'";
- }
- }
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,orderinfo,number,country,library,librarytime,expressstate,express,waybill,wlbz,orderremarks,wlcontent,wlerror,excontent,wltype',$order_str,$start,$perpage);
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- $f = $this->fullorder->read($value['id']);
- $info_list[$key]['number'] = "<p>".$value['number']."</p>"."<p>".$f['email']."</p>";
- $country = $this->country->read($value['country']);
- $info_list[$key]['country'] = "<p>".$country['name']."</p><p>".$f['phone']."</p>";
- //$state = $this->typeclass->read($value['state']);
- //$info_list[$key]['state'] = $state['title'];
- if($value['library'] == 1)
- {
- $info_list[$key]['library'] = "未出库";
- }
- else if($value['library'] == 2)
- {
- $info_list[$key]['library'] = "已出库";
- }
- else if($value['library'] == 3)
- {
- $info_list[$key]['library'] = "已退库";
- }
- if($value['librarytime'] == '0')
- {
- $info_list[$key]['librarytime'] = '无';
- }
- else
- {
- $info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']).'<br>'.$f['shouldmoney'];
- }
- if($value['expressstate'] == 0)
- {
- $info_list[$key]['expressstate'] = "无信息";
- }
- else if($value['expressstate'] == 2)
- {
- $info_list[$key]['expressstate'] = "已取件";
- }
- else if($value['expressstate'] == 3)
- {
- $info_list[$key]['expressstate'] = "在途中";
- }
- /**
- else if($value['expressstate'] == 4)
- {
- $info_list[$key]['expressstate'] = "到达目的地国".$value['expressstate'];
- }
- **/
- else if($value['expressstate'] == 4 || $value['expressstate'] == 5)
- {
- $info_list[$key]['expressstate'] = "即将派送";
- }
- else if($value['expressstate'] == 6)
- {
- $info_list[$key]['expressstate'] = "已签收";
- }
- else if($value['expressstate'] == 1)
- {
- $info_list[$key]['expressstate'] = "派送异常";
- }
- $express = $this->express->read($value['express']);
- $info_list[$key]['express'] = $express['servicename'];
- if($value['wltype'] == '0')
- {
- $info_list[$key]['wltype'] = "<p class='ckn'><b class='wlfsxx' data-id='".$value['id']."' data-q='1'>禁止发送</b></p>";
- }
- else
- {
- $info_list[$key]['wltype'] = "<p class='ckn'><b class='wlfsxx' data-id='".$value['id']."' data-q='1'>允许发送</b></p>";
- }
- if($f['wlyc'] == '0')
- {
- $info_list[$key]['wltype'] .= "<p class='yc'><b class='wlyc' data-id='".$value['id']."' data-t='1'>加入异常处理中</b></p>";
- }
- else if($f['wlyc'] == '1')
- {
- $info_list[$key]['wltype'] .= "<p class='yc'><b class='wlyc' data-id='".$value['id']."' data-t='2'>移入异常已处理</b></p>";
- $info_list[$key]['wltype'] .= "<p class='yc'><b class='ycyc' data-id='".$value['id']."' data-c='2'>移出异常处理中</b></p>";
- }
- else if($f['wlyc'] == '2')
- {
- $info_list[$key]['wltype'] .= "<p><b>异常已处理</b></p>";
- }
- if(stripos($value['excontent'],'<br />') !== false)
- {
- $excontent = explode('<br />',$value['excontent']);
- $info_list[$key]['excontent'] = '<i class="method fa fa-list-ul" data-t="'.$value['excontent'].'"></i> '.$excontent[0];
- }
- }
- $total = $this->fullorder->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list),'cs'=>$where);
- echo json_encode($rows);exit;
- }
- if(isset($post['q']))
- {
- $id = $this->input->post('id',true);
- $f = $this->fullorder->read($id);
- $wl = ($f['wltype']=='0')?1:0;
- $wltitle = ($f['wltype']=='0')?'已禁发送':'已允发送';
- if($this->fullorder->save(array('wltype'=>$wl),$id))
- {
- echo json_encode(array('msg'=>'ckn','id'=>$id,'wltitle'=>$wltitle,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'失败,请重试','id'=>$id,'wltitle'=>$wltitle,'success'=>false));exit;
- }
- }
- if(isset($post['t']))
- {
- $id = $this->input->post('id',true);
- $f = $this->fullorder->read($id);
- $t = $this->input->post('t',true);
- $yc = ($f['wlyc']=='0')?1:2;
- $yctitle = ($f['wlyc']=='0')?'移入成功':'异常已处理';
- if($this->fullorder->save(array('wlyc'=>$yc),$id))
- {
- echo json_encode(array('msg'=>'yc','id'=>$id,'wltitle'=>$yctitle,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'失败,请重试','id'=>$id,'wltitle'=>$yctitle,'success'=>false));exit;
- }
- }
- if(isset($post['c']))
- {
- $id = $this->input->post('id',true);
- $f = $this->fullorder->read($id);
- $t = $this->input->post('t',true);
- $yc = 0;
- $yctitle = '移出成功';
- if($this->fullorder->save(array('wlyc'=>$yc),$id))
- {
- echo json_encode(array('msg'=>'yc','id'=>$id,'wltitle'=>$yctitle,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'失败,请重试','id'=>$id,'wltitle'=>$yctitle,'success'=>false));exit;
- }
- }
-
- $notice = $this->notice->find_all("type = '2' and (".rtrim($fgshop,'or').")");
- $this->data['notice'] = $notice;
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $this->data['wlshop'] = $wlshop;
- $this->data['express'] = $this->express->find_all();
- $this->_Template('fullorder_wl',$this->data);
- }
-
- //审核订单
- public function _review()
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user)
- {
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $sid .= " id = ".$value." or";
- $fgshop .= " shop = ".$value." or";
- }
- $fgshop = " and (".rtrim($fgshop,'or').")";
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $source = $this->input->post('source',true);
- $warehouse = $this->input->post('warehouse',true);
- $express = $this->input->post('express',true);
- $orderremarks = $this->input->post('orderremarks',true);
- $shop = $this->input->post('shop',true);
- $review = $this->input->post('review',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $shipremarks = $this->input->post('shipremarks',true);
- $number = $this->input->post('number',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "mergeid = 0 and state = '207'".$fgshop;
- if($timetk && $timetj)
- {
- $where .= " and dtime > '$timetk' and dtime < '$timetj'";
- }
- if($source)
- {
- if($source == '2d')
- {
- $where .= " and source >= '2'";
- }
- else
- {
- $where .= " and source = '$source'";
- }
- }
- if($review)
- {
- $where .= " and review = '$review'";
- }
- else
- {
- $where .= " and ((review = '2' and source = '1') or (review = '1' and source >= '2'))";
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($warehouse)
- {
- $where .= " and type = '$warehouse'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($orderremarks)
- {
- $where .= " and orderremarks like '%$orderremarks%'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($shipremarks)
- {
- $where .= " and shipremarks like '%$shipremarks%'";
- }
- //数据排序
- $order_str = "id desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,client,express,buytime,shouldmoney,review,orderremarks');
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- $lr = $this->fullorder->read($value['id']);
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- $warehouse = $this->warehouse->read($value['type']);
- $info_list[$key]['type'] = $warehouse['title'];
- $express = $this->express->read($value['express']);
- $info_list[$key]['express'] = $express['servicename'];
- $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$value['buytime']).'</p><p>'.date('H:i:s',$value['buytime']).'</p>';
- if($value['review'] == 1)
- {
- $info_list[$key]['review'] = "未送审";
- }
- else if($value['review'] == 2)
- {
- $info_list[$key]['review'] = "待审核";
- }
- else if($value['review'] == 3)
- {
- $info_list[$key]['review'] = "不通过";
- }
- else if($value['review'] == 4)
- {
- $info_list[$key]['review'] = "取消重审";
- }
- else if($value['review'] == 5)
- {
- $info_list[$key]['review'] = "审核通过";
- }
- else if($value['review'] == 6)
- {
- $info_list[$key]['review'] = "自动通过";
- }
- /**
- $info_list[$key]['library'] = "";
- if($value['review'] == 1)
- {
- $info_list[$key]['library'] = "<p><b class='focz' data-type='6' data-id='".$value['id']."'>审核通过</b></p>";
- }
- if($value['review'] == 2)
- {
- $info_list[$key]['library'] = "<p><b class='focz' data-type='5' data-id='".$value['id']."'>审核通过</b></p><p><b class='focz' data-type='3' data-id='".$value['id']."'>不通过</b></p>";
- }
- else if($value['review'] == 3)
- {
- $info_list[$key]['library'] = "<p><b class='fullorderreview' data-type='5' data-id='".$value['id']."'>审核通过</b></p>";
- }
- else if($value['review'] == 5)
- {
- $info_list[$key]['library'] = "<p><b class='fullorderreview' data-type='3' data-id='".$value['id']."'>不通过</b></p>";
- }
- $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$lr['currencytitle'];
- $lr['hl'] = $lr['hl']==0?6.71:$lr['hl'];
- $cost = $lr['cost']/$lr['hl'];
- $currencytitle = $lr['budget']-$lr['refundj']-$cost-$lr['expressmoney'];
- $info_list[$key]['currencytitle'] = sprintf("%.2f",$currencytitle).' '.$lr['currencytitle'];
- **/
- }
- $total = $this->fullorder->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $this->data['shop'] = $wlshop;
- $this->_Template('fullorder_review',$this->data);
- }
-
-
- public function _wlbz($arg_array)
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['id']))
- {
- $id = $this->input->post('id',true);
- $post['wlbz'] = $this->input->post('wlbz',true);
- if($post['wlbz'] == '')
- {
- echo json_encode(array('msg'=>'备注不能为空','success'=>false));exit;
- }
- if($this->fullorder->save($post,$id))
- {
- echo json_encode(array('msg'=>'修改成功','id'=>$id,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
- }
- }
- $arg_array = $arg_array[0];
- $fullorder = $this->fullorder->read($arg_array);
- $this->data['fullorder'] = $fullorder;
- $this->_Template('fullorder_wlbz',$this->data);
- }
-
-
- //导出资金统计excel
- public function _fmexcel()
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user)
- {
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- if(isset($_GET['excel']))
- {
- $timetk = $this->input->get('timetk',true);
- $timetj = $this->input->get('timetj',true);
- $shop = $this->input->get('shop',true);
- $source = $this->input->get('source',true);
- $state = $this->input->get('state',true);
- $type = $this->input->get('type',true);
- $orderinfo = $this->input->get('orderinfo',true);
- $user = $this->input->get('user',true);
- $name = $this->input->get('name',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
- if($timetk && $timetj)
- {
- $where .= " and buytime > '$timetk' and buytime < '$timetj'";
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($source)
- {
- $where .= " and source = '$source'";
- }
- if($state)
- {
- if($state == 1)
- {
- $where .= " and state = '$state'";
- }
- }
- if($type)
- {
- $where .= " and type = '$type'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($user)
- {
- $where .= " and user = '$user'";
- }
- if($name)
- {
- $where .= " and name = '$name'";
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,shop,user,number,orderinfo,client,country,dtime,ftime,express,waybill,shouldmoney,refund,currency,budget,fpdata,hl,currencytitle');
- //格式化数据
- $i = 1;$shouldmoney = 0;$refund = 0;$budget = 0;$currency = 0;$hl=1;
- foreach ($info_list as $key=>$value)
- {
- $info_list[$key]['id'] = $i;
-
- if($value['currencytitle'] != "CNY")
- {
- $hl=$value['hl'];
- }
- $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl);
- $budget=$budget+($value['budget']*$hl);
- $currency=$currency+(($value['shouldmoney']-$value['budget'])*$hl);
- $refund=$refund+($value['refund']*$hl);
-
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- $info_list[$key]['user'] = $shop['shopuser'];
- $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);
- $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']);
- $country = $this->country->read($value['country']);
- $info_list[$key]['country'] = $country['name'];
- $express = $this->express->read($value['express']);
- $info_list[$key]['express'] = $express['servicename'];
- $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle'];
- $info_list[$key]['refund'] = $value['refund'].' '.$value['currencytitle'];
- $info_list[$key]['budget'] = $value['budget'].' '.$value['currencytitle'];
- $info_list[$key]['currency'] = sprintf("%.2f",$value['shouldmoney']-$value['budget']).' '.$value['currencytitle'];
- $fpdata = array();
- if(stripos($value['fpdata'],';') !== false)
- {
- $fpdata = explode(';',rtrim($value['fpdata'],';'));
- foreach ($fpdata as $ke=>$va)
- {
- $v = explode('|',rtrim($va,'|'));
- $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数
- }
- }
- $info_list[$key]['fpdata'] = $fpdata;
- $i++;
- }
- $data = array($shouldmoney.' CNY',$refund.' CNY',$currency.' CNY',$budget.' CNY');
- $title = "订单资金信息";
- $titlename = "<table border=1>
- <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
- <tr>
- <td>NO.</td>
- <td>店铺</td>
- <td>负责人</td>
- <td>编号</td>
- <td>订单号</td>
- <td>客户姓名</td>
- <td>国家</td>
- <td>订单日期</td>
- <td>发货日期</td>
- <td>快递公司</td>
- <td>运单号</td>
- <td>订单金额</td>
- <td>退款金额</td>
- <td>手续费</td>
- <td>预估金额</td>
- <td>
- <table border=1>
- <tr><td colspan='3' align='center'>订单产品信息</td></tr>
- <tr>
- <td>产品</td>
- <td>条数</td>
- <td>数量</td>
- </tr>
- </table>
- </td>
- <td>总条数</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>合计:</td><td>".$data[0]."</td><td>".$data[1]."</td><td>".$data[2]."</td><td>".$data[3]."</td></tr>\n";
- $this->excel->get_fz($info_list,$titlename,$filename,$tail);
- }
- }
- //导出订单excel
- public function _fdexcel()
- {
- if(isset($_GET['excel']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $shop = $this->input->post('shop',true);
- $source = $this->input->post('source',true);
- $state = $this->input->post('state',true);
- $review = $this->input->post('review',true);
- $express = $this->input->post('express',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $user = $this->input->post('user',true);
- $name = $this->input->post('name',true);
- $waybill = $this->input->post('waybill',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "1=1 and mergeid = 0";
- if($timetk && $timetj)
- {
- $where .= " and buytime > '$timetk' and buytime < '$timetj'";
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($source)
- {
- $where .= " and source = '$source'";
- }
- if($state)
- {
- $where .= " and state = '$state'";
- }
- if($review)
- {
- $where .= " and review = '$review'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($user)
- {
- $where .= " and user = '$user'";
- }
- if($name)
- {
- $where .= " and name = '$name'";
- }
- if($waybill)
- {
- $where .= " and waybill = '$waybill'";
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,shop,number,orderinfo,source,client,name,address,city,zipcode,province,country,phone,dtime,ftime,state,shouldmoney,express,waybill,orderremarks,clientremarks,fpdata,hl,currencytitle');
- //格式化数据
- $i = 1;$shouldmoney = 0;$hl=1;
- foreach ($info_list as $key=>$value)
- {
- $info_list[$key]['id'] = $i;
- if($value['source'] == 1)
- {
- $info_list[$key]['source'] = "线下订单";
- }
- else if($value['source'] == 2)
- {
- $info_list[$key]['source'] = "PC订单";
- }
- else if($value['source'] == 3)
- {
- $info_list[$key]['source'] = "手机订单";
- }
-
- if($value['currencytitle'] != "CNY")
- {
- $hl=$value['hl'];
- }
- $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl);
-
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);
- $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']);
- $state = $this->typeclass->read($value['state']);
- $info_list[$key]['state'] = $state['title'];
- $country = $this->country->read($value['country']);
- $info_list[$key]['country'] = $country['name'];
- $express = $this->express->read($value['express']);
- $info_list[$key]['express'] = $express['servicename'];
- $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle'];
- $fpdata = array();
- if(stripos($value['fpdata'],';') !== false)
- {
- $fpdata = explode(';',rtrim($value['fpdata'],';'));
- foreach ($fpdata as $ke=>$va)
- {
- $v = explode('|',rtrim($va,'|'));
- $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数
- }
- }
- $info_list[$key]['fpdata'] = $fpdata;
- $i++;
- }
- $data = array($shouldmoney.' CNY');
- $title = "订单信息表";
- $titlename = "<table border=1>
- <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
- <tr>
- <td>NO.</td>
- <td>店铺</td>
- <td>编号</td>
- <td>订单号</td>
- <td>订单类型</td>
- <td>客户姓名</td>
- <td>收件人名称</td>
- <td>收货人地址</td>
- <td>城市</td>
- <td>邮编</td>
- <td>州</td>
- <td>国家</td>
- <td>收件电话</td>
- <td>订单日期</td>
- <td>发货日期</td>
- <td>订单状态</td>
- <td>订单金额</td>
- <td>快递公司</td>
- <td>运单号</td>
- <td>订单备注</td>
- <td>客户备注</td>
- <td>
- <table border=1>
- <tr><td colspan='3' align='center'>订单产品信息</td></tr>
- <tr>
- <td>产品</td>
- <td>条数</td>
- <td>数量</td>
- </tr>
- </table>
- </td>
- <td>总条数</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>合计:</td><td>".$data[0]."</td></tr>\n";
- $this->excel->get_fz($info_list,$titlename,$filename,$tail);
- }
- }
- public function _black()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['bd']))
- {
- $bd = $this->input->post('bd',true);
- $rows = $this->fullorder->read($bd);
- $post['shop'] = $rows['shop'];
- $post['source'] = 1;
- $post['name'] = $rows['client'];
- $post['email'] = $rows['email'];
- $post['phone'] = $rows['phone'];
- $post['country'] = $rows['country'];
- $post['money'] = $rows['shouldmoney'];
- $post['num'] = 1;
- $post['time'] = $rows['dtime'];
- $post['province'] = $rows['province'];
- $post['city'] = $rows['city'];
- $post['street'] = $rows['street'];
- $post['address'] = $rows['address'];
- $post['address2'] = $rows['address2'];
- $post['zipcode'] = $rows['zipcode'];
- $post['type'] = 2;
- if($this->customer->insert($post))
- {
- $this->fullorder->save(array('black'=>1),$bd);
- echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- }
- }
- public function _ryf()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['bd']))
- {
- $bd = $this->input->post('bd',true);
- $d = $this->fullorder->read($bd);
- if($d['state'] == 207 || $d['state'] == 207)//订单状态为等待发货或等待部分发货才可更改为允许发货
- {
- if($d['print'] < 3)//打印状态为未打印
- {
- $print = 1;//未打印
- $libraryconfirm = 1;//不允许出库
- $a = "订单未打印,";
- }
- else//已打印订单
- {
- $libraryconfirm = 2;//允许出库
- $a = "";
- }
- if($this->fullorder->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd))
- {
- echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- }
- if($this->fullorder->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd))
- {
- echo json_encode(array('msg'=>'操作失败!订单未非发货状态','success'=>false));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
- }
- }
- }
- public function _fsstate()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['s']))
- {
- $id_arr = $this->input->post('s');
- $id_arr = explode(',',$id_arr);
- if(!$id_arr)
- {
- echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
- }
- foreach ($id_arr as $v)
- {
- $data = $this->fullorder->read($v);
- $warehouse = $this->warehouse->read($data['type']);
- $fs = $this->notice->get_ordertatus($data['state']);
- if($fs)
- {
- $ck = $this->_email($fs['content'],$data,$warehouse['company']);
- if($ck == 1)
- {
- $this->fullorder->save(array('fscontent'=>date('Y-m-d H:i:s',time()).'已发送:'.$fs['title'].' - '),$v);
- }
- }
- }
- echo json_encode(array('msg'=>'发送完成!','success'=>true));exit;
- }
- }
- public function _power()
- {
- $user = $this->user->get_api($_SESSION['api']);
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['id']))
- {
- $id = $this->input->post('id',true);
- $fullorder = $this->fullorder->read($id);
- $express = $this->express->read($fullorder['express']);
- $warehouse = $this->warehouse->read($fullorder['type']);
- if(($warehouse['zd'] == '1' || stripos($fullorder['whlabel'],'z|') !== false) && $fullorder['library'] == '2')
- {
- echo json_encode(array('msg'=>'需要先退库释放库存后才可重置!','success'=>false));exit;
- }
- /**
- if($fullorder['print'] == '3' && isset($express['iscode']) && ($express['iscode'] == 'ARAMEX' || $express['iscode'] == 'TOLL' || $express['iscode'] == 'FEDEX'))
- {
- $lj = $this->ali->get_lj($fullorder['number'],2,'订单修改');
- if($lj != '1' && $lj != '订单不存在')
- {
- echo json_encode(array('msg'=>$lj,'success'=>false));exit;
- }
- }
- **/
- $warehouse = $this->warehouse->read($fullorder['warehouse']);
- $typeclass = $this->typeclass->read($fullorder['state']);
- $express = $this->express->read($fullorder['express']);
- $printtype = array(1=>'运单',2=>'发货单',3=>'不打印单据');
- $teset['number']=$fullorder['number'];
- $teset['orderinfo']=$fullorder['orderinfo'];
- $teset['shop']=$fullorder['shop'];
- $teset['user']=$user['userid'];
- $teset['ip']=$this->input->ip_address();
- $teset['time']=time();
- $teset['warehouse']=(isset($warehouse['title']))?$warehouse['title']:'未选择';
- $teset['state']=(isset($typeclass['title']))?$typeclass['spare']:'未选择';
- $teset['express']=(isset($express['title']))?$express['servicename']:'未选择';
- $teset['printtype']=(isset($printtype[$fullorder['printtype']]))?$printtype[$fullorder['printtype']]:'未选择';
- $teset['reviewtime']=($fullorder['reviewtime'] > '0')?date('Y-m-d H:i:s',$fullorder['reviewtime']):'无';
- $teset['printtime']=($fullorder['printtime'] > '0')?date('Y-m-d H:i:s',$fullorder['printtime']):'无';
- $teset['librarytime']=($fullorder['librarytime'] > '0')?date('Y-m-d H:i:s',$fullorder['librarytime']):'无';
- $teset['shipremarks']=$fullorder['shipremarks'];
- $teset['fpdata']=$fullorder['fpdata'];
- $teset['oldwaybill']=$fullorder['oldwaybill'];
- $teset['oldprinttime']=$fullorder['oldprinttime'];
- if($fullorder['printtype'] == 1)
- {
- if($fullorder['waybill'] != '' && stripos($fullorder['oldwaybill'],$fullorder['waybill']) === false)
- {
- $teset['oldwaybill'] .= '-'.date('Ymd',$fullorder['printtime']).'/'.$fullorder['waybill'];
- $teset['oldprinttime'] .= '-'.$fullorder['printtime'];
- }
- }
- $review = ($fullorder['source']==1)?2:1;//线下单审核状态直接为待审核
- if(!$this->fullreset->insert($teset))
- {
- echo json_encode(array('msg'=>'重置失败,请重试','success'=>true));exit;
- }
-
- if($this->fullorder->save(array('library'=>1,'librarytime'=>0,'libraryconfirm'=>2,'print'=>1,'printtime'=>0,'printnumber'=>0,'retreattime'=>0,'librarynot'=>'订单未打印,未审核或未通过','review'=>$review,'reviewtime'=>0,'state'=>207,'waybill'=>'','waybill2'=>'','waybillid'=>'','oldwaybill'=>$teset['oldwaybill'],'oldprinttime'=>$teset['oldprinttime'],'dlzemail'=>0,'yhs'=>0,'failed'=>''),$id))
- {
- echo json_encode(array('msg'=>'重置成功!如需再次提交,请先保存、再提交','success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'重置失败,请重试','success'=>false));exit;
- }
- }
- }
- public function _expresstype()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['id']))
- {
- $id = $this->input->post('id',true);
- $data = $this->express->read($id);
- echo json_encode(array('msg'=>$data['type'],'success'=>true));exit;
- }
- }
- public function _email($content,$data,$shopname)
- {
- $express = $this->express->read($data['express']);
- $t= array('$userName','$orderid','$trackingNumber','$expressCompany','$contactPerson','$mobileNo','$zip','$recipientAddress');//需要被替换的内容
- $h= array($data['client'],$data['orderinfo'],$data['waybill'],$express['servicename'],$data['name'],$data['phone'],$data['zipcode'],$data['address']);//替换的内容
- $content = str_replace($t,$h,$content);
- $this->load->library('email');
- $config['protocol'] = 'smtp';
- $config['smtp_host'] = 'smtpdm-ap-southeast-1.aliyun.com';
- $config['smtp_port'] = 465;
- $config['smtp_user'] = 'service@email.supernovahair.com';
- $config['smtp_pass'] = 'LONGyihair374';
- $config['smtp_crypto'] = 'ssl';
- $config['crlf'] = "\r\n";
- $config['newline'] = "\r\n";
- $this->email->initialize($config);
- $this->email->from('service@email.supernovahair.com',$shopname);
- $this->email->to($data['email']);//收件
- $this->email->subject('The product you purchased has a new progress');//标题
- $this->email->message($content);//内容
- if ( ! $this->email->send())
- {
- return 2;
- }
- else
- {
- return 1;
- }
- }
- public function _error()
- {
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $waybill = $this->input->post('waybill',true);
- $number = $this->input->post('number',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "failed !='' and mergeid = 0 and print != 3 and (".rtrim($fgshop,'or').")";
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($waybill)
- {
- $where .= " and waybill = '$waybill'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($timetk && $timetj)
- {
- $timetj = $timetj+24*3600;
- $where .= " and dtime > '$timetk' and dtime < '$timetj'";
- }
- //数据排序
- $order_str = "dtime desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,express,failed,operation',$order_str,$start,$perpage);
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- $ud = $this->fullorder->read($value['id']);
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'>".$value['orderinfo']."<p>";
- $warehouse = $this->warehouse->read($value['type']);
- $warehousetitle = $warehouse['title'];
- if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
- $info_list[$key]['type'] = $warehousetitle;
- if($value['express'] != 0)
- {
- $express = $this->express->read($value['express']);
- $expressservicename = $express['servicename'];
- if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
- $info_list[$key]['express'] = $expressservicename;
- }
- else
- {
- $info_list[$key]['express'] = "无";
- }
- $x = "";
- if($ud['review'] >4 && $ud['print'] == 1)
- {
- $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
- }
- else
- {
- $x = "<p class='ckn'><b class='fojzof' data-type='9' data-id='".$value['id']."'>关闭</b></p>";
- }
- $info_list[$key]['operation'] = $x;
- }
- $total = $this->fullorder->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $this->data['wlshop'] = $wlshop;
- $this->data['express'] = $this->express->find_all();
- $user = $this->user->get_api($_SESSION['api']);
- $powerid = $this->power->read($user['power']);
- $powertext = explode('|',trim($powerid['excelid'],'|'));
- $pid = '';
- foreach ($powertext as $v)
- {
- $pid .= " id = ".$v." or";
- }
- $fullorderexcel = $this->fullorderexcel->find_all("type = '100001' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板
- $this->data['fullorderexcel'] = $fullorderexcel;
- $this->_Template('fullorder_error',$this->data);
- }
- //验证地址
- public function _yzaddress()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['address']))
- {
- $address = $this->input->post('address',true);
- $address2 = $this->input->post('address2',true);
- $city = $this->input->post('city',true);
- $province = $this->input->post('province',true);
- $zipcode = $this->input->post('zipcode',true);
- $barcode = $this->usps->get_address(array('address'=>$address,'address2'=>$address2,'city'=>$city,'province'=>$province,'zipcode'=>$zipcode));
- //$this->logic_ding->sendToDing("usps地址验证返回数据".$barcode);
- echo $barcode;
- }
- }
- //清除退货信息
- public function _clearreturn()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['orderinfo']))
- {
- $orderinfo = $this->input->post('orderinfo',true);
- $data = $this->fullorder->get_orderinfo($orderinfo);
- $fu = 'fullorder';
- if(!$data)
- {
- $data = $this->fullorder_smt->get_orderinfo($orderinfo);
- $fu = 'fullorder_smt';
- }
- $this->$fu->save(array('library'=>'2','retreattime'=>'0','returndata'=>''),$data['id']);
- echo json_encode(array('msg'=>'清除成功!','success'=>true));exit;
- }
- }
-
- //订单退货
- public function _return()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['orderinfo']))
- {
- $orderinfo = $this->input->post('orderinfo',true);
- $data = $this->fullorder->get_orderinfo($orderinfo);
- $fu = 'fullorder';
- if(!$data)
- {
- $data = $this->fullorder_smt->get_orderinfo($orderinfo);
- $fu = 'fullorder_smt';
- }
- $bctime = date('Ymd',time());
- if($data['library'] != 2){
- echo json_encode(array('msg'=>'此单不是出库状态,不允许退货','success'=>false));exit;
- }
- if($data['returndata'] != "")
- {
- echo json_encode(array('msg'=>'请求失败,已有Return Label信息!','success'=>false));exit;
- }
- $barcode = $this->usps->get_return($data);
- // if(isset($barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription']))
- // {
- // echo json_encode(array('msg'=>$barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription'],'success'=>false));exit;
- // }
- // else if(isset($barcode['TrackingNumber']))
- // {
- // $pdf = $this->_pdf($barcode['ReturnLabel'],'t-'.$barcode['TrackingNumber'],$bctime);
- // $read = 'PostalRouting:'.$barcode['PostalRouting'].' - TrackingNumber:<a href="/data/pdf/'.$bctime.'/'.'t-'.$barcode['TrackingNumber'].'.pdf" target="_blank">'.$barcode['TrackingNumber'].'</a>';
- // $this->$fu->save(array('returndata'=>$read),$data['id']);
- // echo json_encode(array('msg'=>'生成Return Label成功!','data'=>$read,'success'=>true));exit;
- // }
- // else
- // {
- // echo json_encode(array('msg'=>'请求失败,请稍后重试!','cs'=>$barcode,'success'=>false));exit;
- // }
- if(isset($barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription']))
- {
- echo json_encode(array('msg'=>$barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription'],'success'=>false));exit;
- }
- else if(isset($barcode['trackingNumber']))
- {
- $pdf = $this->_pdf($barcode['returnLabelImage'],'t-'.$barcode['trackingNumber'],$bctime);
- $read = 'PostalRouting:'.$barcode['routingInformation'].' - TrackingNumber:<a href="/data/pdf/'.$bctime.'/'.'t-'.$barcode['trackingNumber'].'.pdf" target="_blank">'.$barcode['trackingNumber'].'</a>';
- $this->$fu->save(array('returndata'=>$read),$data['id']);
- echo json_encode(array('msg'=>'生成Return Label成功!','data'=>$read,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'请求失败,请稍后重试!'.json_encode($barcode),'cs'=>$barcode,'success'=>false));exit;
- }
- }
- /**
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['orderinfo']))
- {
- $orderinfo = $this->input->post('orderinfo',true);
- $data = $this->fullorder->get_orderinfo($orderinfo);
- $fu = 'fullorder';
- if(!$data)
- {
- $data = $this->fullorder_smt->get_orderinfo($orderinfo);
- $fu = 'fullorder_smt';
- }
- $bctime = date('Ymd',time());
- if($data['returndata'] != "")
- {
- echo json_encode(array('msg'=>'请求失败,已有Return Label信息!','success'=>false));exit;
- }
- $barcode = $this->usps->get_return($data);
- if(isset($barcode['error']['message']))
- {
- echo json_encode(array('msg'=>$barcode['error']['message'],'success'=>false));exit;
- }
- else if(isset($barcode['trackingNumber']))
- {
- $pdf = $this->_pdf($barcode['returnLabelImage'],'t-'.$barcode['trackingNumber'],$bctime);
- $read = 'trackingNumber:<a href="/data/pdf/'.$bctime.'/'.'t-'.$barcode['trackingNumber'].'.pdf" target="_blank">'.$barcode['trackingNumber'].'</a>';
- $this->$fu->save(array('returndata'=>$read),$data['id']);
- echo json_encode(array('msg'=>'生成Return Label成功!','data'=>$read,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'请求失败,请稍后重试!','cs'=>$barcode,'success'=>false));exit;
- }
-
- }**/
- }
- public function _pdf($pdf,$title,$bctime)
- {
- $pdf_path = './data/pdf/'.$bctime.'/';
- $file_base64 = $pdf;
- $file_base64 = preg_replace('/data:.*;base64,/i', '', $file_base64);
- $file_base64 = base64_decode($file_base64);
- if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建
- file_put_contents($pdf_path.$title.'.pdf',$file_base64);
- return $bctime;
- }
-
- public function _find($find)
- {
- preg_match_all('/\d+/',$find,$n);
- $a = '';
- foreach($n[0] as $v)
- {
- $a .= $v;
- }
- return $a;
- }
- public function _dqpm()
- {
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $usersp = explode('|',trim($user['shop'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "mergeid = 0 and (".rtrim($fgshop,'or').")";
- if($timetk && $timetj)
- {
- $where .= " and dtime > '$timetk' and dtime < '$timetj'";
- }
- //数据排序
- $order_str = "dtime desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- $continentdata = '';
- $continent = array();//陆地板块
- $num = $this->fullorder->find_count($where);//订单总数量
- $country = $this->country->find_all('1=1','id,continent,ename,zname');
- foreach ($country as $k=>$v)
- {
- $tc = $this->typeclass->read($v['continent']);
- $continent[$v['continent']] = array(0=>$tc['title'],1=>0,2=>'');
- }
- foreach ($country as $k=>$v)
- {
- $n = $this->fullorder->find_count($where.' and country = "'.$v['id'].'"');
- $country[$k]['continent'] = $continent[$v['continent']][0];//此国家数量
- $country[$k]['zname'] = '<a href="/fullorder/dqpmprovince/'.$v['id'].'/'.$timetk.'/'.$timetj.'">'.$v['zname'].'</a>';//此国家数量
- $country[$k]['num'] = $n;//此国家数量
- $country[$k]['zb'] = (sprintf("%.4f",$n/$num)*100).'%';//此国家占比
- $continent[$v['continent']]['1'] += $n;//此洲数量增加;
- }
- array_multisort(array_column($continent, '1'), SORT_DESC, $continent);
- array_multisort(array_column($country, 'num'), SORT_DESC, $country);
- foreach ($continent as $k=>$v)
- {
- $continentdata .= $v['0'].' 总量:'.$v['1'].' 占比:'.(sprintf("%.4f",$v['1']/$num)*100).'% - ';
- }
- echo json_encode(array('ewnr'=>$continentdata,'rows'=>$country,'total'=>count($country),'over'=>0,'pagenum'=>1,'success'=>true));exit;
- }
- $this->_Template('fullorder_dqpm',$this->data);
- }
- public function _dqpmprovince($arg_array)
- {
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $usersp = explode('|',trim($user['shop'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $country = $this->input->post('country',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";
- $province = array();
- $city_list = $this->fullorder->find_all($where,'id,province');
- $ToState = array('AL'=>'alabama','AK'=>'alaska','AZ'=>'arizona','AR'=>'arkansas','CA'=>'california','CO'=>'colorado','CT'=>'connecticut','DE'=>'delaware','FL'=>'florida','GA'=>'georgia','HI'=>'hawaii','ID'=>'idaho','IL'=>'illinois','IN'=>'indiana','IA'=>'iowa','KS'=>'kansas','KY'=>'kentucky','LA'=>'louisiana','ME'=>'maine','MD'=>'maryland','MA'=>'massachusetts','MI'=>'michigan','MN'=>'minnesota','MS'=>'mississippi','MO'=>'missouri','MT'=>'montana','NE'=>'nebraska','NV'=>'nevada','NH'=>'new hampshire','NJ'=>'new jersey','NM'=>'new mexico','NY'=>'new york','NC'=>'north carolina','ND'=>'north dakota','OH'=>'ohio','OK'=>'oklahoma','OR'=>'oregon','PA'=>'pennsylvania','RI'=>'rhode island','SC'=>'south carolina','SD'=>'south dakota','TN'=>'tennessee','TX'=>'texas','UT'=>'utah','VT'=>'vermont','VA'=>'virginia','WA'=>'washington','WV'=>'west virginia','WI'=>'wisconsin','WY'=>'wyoming','DC'=>'district of columbia','VI'=>'virgin islands');
- foreach ($city_list as $k=>$v)
- {
- $v['province'] = strtoupper(trim($v['province'],' '));
- if(isset($ToState[$v['province']]))
- {
- $v['province'] = $ToState[$v['province']];
- }
- if(!isset($province[$v['province']]))
- {
- $province[$v['province']] = array('id'=>$v['id'],'province'=>'<a href="/fullorder/ddpmdata/'.$country.'/'.$timetk.'/'.$timetj.'/'.strtoupper($v['province']).'">'.$v['province'].'</a>','num'=>0,'zb'=>'');
- }
- $province[$v['province']]['num'] += 1;
-
- }
- array_multisort(array_column($province, 'num'), SORT_DESC, $province);
- $province = array_values($province);
- foreach ($province as $k=>$v)
- {
- $province[$k]['zb'] = (sprintf("%.4f",$v['num']/count($city_list))*100).'%';
- }
- echo json_encode(array('rows'=>($province),'total'=>count($province),'over'=>0,'pagenum'=>1,'success'=>true));exit;
- }
- $this->data['arg_array'] = $arg_array;
- $this->_Template('fullorder_dqpmprovince',$this->data);
- }
- public function _ddpmdata($arg_array)
- {
- $arg_array[3] = str_replace('%20',' ',$arg_array[3]);
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $usersp = explode('|',trim($user['shop'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $province = $this->input->post('province',true);
- $timetk = $this->input->post('timetk',true);;
- $timetj = $this->input->post('timetj',true);;
- $country = $this->input->post('country',true);;
- $where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";
- if($province)
- {
- $where .= " and province = '$province'";
- }
- $order_str = "dtime desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- $info_list = $this->fullorder->find_all($where,'id,orderinfo,number,shipremarks,shouldmoney',$order_str,$start,$perpage);
- $total = $this->fullorder->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }
- $province = array();
- $city_list = $this->fullorder->find_all("mergeid = 0 and dtime > '$arg_array[1]' and dtime < '$arg_array[2]' and country = '$arg_array[0]' and (".rtrim($fgshop,'or').")",'province');
- $ToState = array('AL'=>'alabama','AK'=>'alaska','AZ'=>'arizona','AR'=>'arkansas','CA'=>'california','CO'=>'colorado','CT'=>'connecticut','DE'=>'delaware','FL'=>'florida','GA'=>'georgia','HI'=>'hawaii','ID'=>'idaho','IL'=>'illinois','IN'=>'indiana','IA'=>'iowa','KS'=>'kansas','KY'=>'kentucky','LA'=>'louisiana','ME'=>'maine','MD'=>'maryland','MA'=>'massachusetts','MI'=>'michigan','MN'=>'minnesota','MS'=>'mississippi','MO'=>'missouri','MT'=>'montana','NE'=>'nebraska','NV'=>'nevada','NH'=>'new hampshire','NJ'=>'new jersey','NM'=>'new mexico','NY'=>'new york','NC'=>'north carolina','ND'=>'north dakota','OH'=>'ohio','OK'=>'oklahoma','OR'=>'oregon','PA'=>'pennsylvania','RI'=>'rhode island','SC'=>'south carolina','SD'=>'south dakota','TN'=>'tennessee','TX'=>'texas','UT'=>'utah','VT'=>'vermont','VA'=>'virginia','WA'=>'washington','WV'=>'west virginia','WI'=>'wisconsin','WY'=>'wyoming','DC'=>'district of columbia','VI'=>'virgin islands');
- foreach ($city_list as $k=>$v)
- {
- $v['province'] = strtoupper(trim($v['province'],' '));
- if(isset($ToState[$v['province']]))
- {
- $v['province'] = $ToState[$v['province']];
- }
- $province[$v['province']] = array('province'=>$v['province']);
- }
- $this->data['province'] = $province;
- $this->data['arg_array'] = $arg_array;
- $this->_Template('fullorder_ddpmdata',$this->data);
- }
- public function _ddpmexcel($arg_array)
- {
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $usersp = explode('|',trim($user['shop'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $province = $this->input->get('province',true);
- $timetk = $arg_array[1];
- $timetj = $arg_array[2];
- $country = $arg_array[0];
- $where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";
- if($province)
- {
- $where .= " and province = '$province'";
- }
- $order_str = "dtime desc";
- $info_list = $this->fullorder->find_all($where,'orderinfo,number,shipremarks,shouldmoney',$order_str);
- $country = $this->country->read($arg_array[0]);
- $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
- $titlename = "<table border=1>
- <tr><th colspan='4' align='left'><h3>".$title."<h3></th></tr>
- <tr>
- <td>订单号</td>
- <td>订单编号</td>
- <td>仓库品名</td>
- <td>订单金额</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "\n";
- $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
- }
-
- public function _statedc()
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user)
- {
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->get(NULL, TRUE);
- if(isset($post['timetk']))
- {
- $page = $this->input->get('page',true);
- $perpage = $this->input->get('perpage',true);
- $timetk = $this->input->get('timetk',true);
- $timetj = $this->input->get('timetj',true);
- $shop = $this->input->get('shop',true);
- $source = $this->input->get('source',true);
- $state = $this->input->get('state',true);
- $review = $this->input->get('review',true);
- $express = $this->input->get('express',true);
- $fs = $this->input->get('fs',true);
- $orderinfo = $this->input->get('orderinfo',true);
- $number = $this->input->get('number',true);
- $user = $this->input->get('user',true);
- $name = $this->input->get('name',true);
- $waybill = $this->input->get('waybill',true);
- $expressstate = $this->input->get('expressstate',true);
- $wltype = $this->input->get('wltype',true);
- $wlyc = $this->input->get('wlyc',true);
- $xztime = $this->input->get('xztime',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
- if($timetk && $timetj)
- {
- $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
- }
- if($xztime == 'librarytime')
- {
- $order_str = "librarytime desc";
- }
- else if($xztime == 'dtime')
- {
- $order_str = "dtime desc";
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($source)
- {
- if($source == 11)
- {
- $where .= " and source != '1'";
- }
- else
- {
- $where .= " and source = '$source'";
- }
- }
- if($fs)
- {
- if($fs == '2')
- {
- $where .= " and exstateerror != ''";
- }
- else
- {
- $where .= " and exstateerror = ''";
- }
- }
- if($state)
- {
- $where .= " and state = '$state'";
- }
- if($review)
- {
- $where .= " and review = '$review'";
- }
- if($expressstate != "")
- {
- $where .= " and expressstate = '$expressstate'";
- }
- if($wltype != "")
- {
- $where .= " and wltype = '$wltype'";
- }
- if($wlyc != "")
- {
- $where .= " and wlyc = '$wlyc'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($user)
- {
- $where .= " and user = '$user'";
- }
- if($name)
- {
- $where .= " and name = '$name'";
- }
- if($waybill)
- {
- $where .= " and waybill = '$waybill'";
- }
-
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'shop,number,country,library,librarytime,expressstate,express,waybill,content,exstateerror,excontent',$order_str);
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- $country = $this->country->read($value['country']);
- $info_list[$key]['country'] = $country['name'];
- //$state = $this->typeclass->read($value['state']);
- //$info_list[$key]['state'] = $state['title'];
- if($value['library'] == 1)
- {
- $info_list[$key]['library'] = "未出库";
- }
- else if($value['library'] == 2)
- {
- $info_list[$key]['library'] = "已出库";
- }
- else if($value['library'] == 3)
- {
- $info_list[$key]['library'] = "已退库";
- }
- if($value['librarytime'] == '0')
- {
- $info_list[$key]['librarytime'] = '无';
- }
- else
- {
- $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);
- }
- if($value['expressstate'] == 0)
- {
- $info_list[$key]['expressstate'] = "无信息";
- }
- else if($value['expressstate'] == 2)
- {
- $info_list[$key]['expressstate'] = "已取件";
- }
- else if($value['expressstate'] == 3)
- {
- $info_list[$key]['expressstate'] = "在途中";
- }
- /**
- else if($value['expressstate'] == 4)
- {
- $info_list[$key]['expressstate'] = "到达目的地国";
- }
- **/
- else if($value['expressstate'] == 4 || $value['expressstate'] == 5)
- {
- $info_list[$key]['expressstate'] = "即将派送";
- }
- else if($value['expressstate'] == 6)
- {
- $info_list[$key]['expressstate'] = "已签收";
- }
- else if($value['expressstate'] == 1)
- {
- $info_list[$key]['expressstate'] = "派送异常";
- }
- $express = $this->express->read($value['express']);
- $info_list[$key]['express'] = $express['servicename'];
- }
- }
- $title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
- $titlename = "<table border=1>
- <tr>
- <td>店铺名称</td>
- <td>编号</td>
- <td>收件人国家</td>
- <td>出库状态</td>
- <td>发货时间</td>
- <td>物流状态</td>
- <td>快递公司</td>
- <td>运单号</td>
- <td>消息状态</td>
- <td>错误提示</td>
- <td>物流信息</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "\n";
- $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
- }
-
- public function _statedcwl()
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user)
- {
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->get(NULL, TRUE);
- if(isset($post['timetk']))
- {
- $dowid = $this->input->get('a');
- $wid = "";
- if($dowid != "")
- {
- $id_arr = explode(',',rtrim($dowid,','));
- $wid .= " id = 0 or";
- foreach ($id_arr as $v)
- {
- $wid .= " id = '$v' or";
- }
- $wid = " and".rtrim($wid,'or');
- }
- $page = $this->input->get('page',true);
- $perpage = $this->input->get('perpage',true);
- $timetk = $this->input->get('timetk',true);
- $timetj = $this->input->get('timetj',true);
- $shop = $this->input->get('shop',true);
- $expressstate = $this->input->get('expressstate',true);
- $fs = $this->input->get('fs',true);
- $state = $this->input->get('state',true);
- $express = $this->input->get('express',true);
- $orderinfo = $this->input->get('orderinfo',true);
- $number = $this->input->get('number',true);
- $waybill = $this->input->get('waybill',true);
- $wlyc = $this->input->get('wlyc',true);
- $wltype = $this->input->get('wltype',true);
- $source = $this->input->get('source',true);
- $xztime = $this->input->get('xztime',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
- if($timetk && $timetj)
- {
- $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
- }
- if($xztime == 'librarytime')
- {
- $order_str = "librarytime desc";
- }
- else if($xztime == 'dtime')
- {
- $order_str = "dtime desc";
- }else if($xztime == 'wlfstime'){
- $order_str = "wlfstime desc";
- }
-
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($expressstate)
- {
- $where .= " and expressstate = '$expressstate'";
- }
- if($fs)
- {
- if($fs == '1')
- {
- $where .= " and wlcontent != ''";
- }
- if($fs == '2')
- {
- $where .= " and wlerror != ''";
- }
- if($fs == '3')
- {
- $where .= " and wlcontent = '' and shouldmoney > 100";
- }
- else if($fs == '4')
- {
- $where .= " and wltype = '1'";
- }
- }
- if($state)
- {
- $where .= " and state = '$state'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($waybill)
- {
- $where .= " and waybill = '$waybill'";
- }
- if($wlyc!='')
- {
- $where .= " and wlyc = '$wlyc'";
- }
- if($wltype!='')
- {
- $where .= " and wltype = '$wltype'";
- }
- if($source)
- {
- if($source == 1)
- {
- $where .= " and source = '$source'";
- }
- else
- {
- $where .= " and source != '1'";
- }
- }
- $info_list = $this->fullorder->find_all($where.$wid,'orderinfo,number,country,library,librarytime,expressstate,express,waybill,wlbz,orderremarks,shipremarks,wlfstime,email,phone,wlcontent,wlerror,excontent',$order_str);
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- $country = $this->country->read($value['country']);
- $info_list[$key]['country'] = $country['name'];
- //$state = $this->typeclass->read($value['state']);
- //$info_list[$key]['state'] = $state['title'];
- if($value['library'] == 1)
- {
- $info_list[$key]['library'] = "未出库";
- }
- else if($value['library'] == 2)
- {
- $info_list[$key]['library'] = "已出库";
- }
- else if($value['library'] == 3)
- {
- $info_list[$key]['library'] = "已退库";
- }
- if($value['librarytime'] == '0')
- {
- $info_list[$key]['librarytime'] = '无';
- }
- else
- {
- $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);
- }
- if($value['expressstate'] == 0)
- {
- $info_list[$key]['expressstate'] = "无信息";
- }
- else if($value['expressstate'] == 2)
- {
- $info_list[$key]['expressstate'] = "已取件";
- }
- else if($value['expressstate'] == 3)
- {
- $info_list[$key]['expressstate'] = "在途中";
- }
- /**
- else if($value['expressstate'] == 4)
- {
- $info_list[$key]['expressstate'] = "到达目的地国";
- }
- **/
- else if($value['expressstate'] == 4 || $value['expressstate'] == 5)
- {
- $info_list[$key]['expressstate'] = "即将派送";
- }
- else if($value['expressstate'] == 6)
- {
- $info_list[$key]['expressstate'] = "已签收";
- }
- else if($value['expressstate'] == 1)
- {
- $info_list[$key]['expressstate'] = "派送异常";
- }
- $info_list[$key]['wlfstime'] = date('Y-m-d H:i:s',$value['wlfstime']);
- $express = $this->express->read($value['express']);
- $info_list[$key]['express'] = $express['servicename'];
- $info_list[$key]['excontent'] = str_replace('<br />','',$value['excontent']);
- }
- }
- $title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
- $titlename = "<table border=1>
- <tr>
- <td>订单号</td>
- <td>编号</td>
- <td>收件人国家</td>
- <td>出库状态</td>
- <td>出库时间</td>
- <td>物流状态</td>
- <td>快递公司</td>
- <td>运单号</td>
- <td>物流备注</td>
- <td>订单备注</td>
- <td>仓库品名</td>
- <td>发送时间</td>
- <td>邮箱</td>
- <td>电话</td>
- <td>邮件发送</td>
- <td>错误提示</td>
- <td>物流信息</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "\n";
- $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
- }
-
-
- public function _waybillemail()
- {
- $user = $this->user->get_api($_SESSION['api']);
- if($user)
- {
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $shop = $this->input->post('shop',true);
- $source = $this->input->post('source',true);
- $expressstate = $this->input->post('expressstate',true);
- $fs = $this->input->post('fs',true);
- $state = $this->input->post('state',true);
- $express = $this->input->post('express',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $number = $this->input->post('number',true);
- $waybill = $this->input->post('waybill',true);
- $dlzemail = $this->input->post('dlzemail',true);
- $xztime = $this->input->post('xztime',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
- if($timetk && $timetj)
- {
- $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
- }
- $order_str = $xztime." desc";
- if($source)
- {
- if($source == '2d')
- {
- $where .= " and source >= '2' and shop != 19";
- }
- else
- {
- $where .= " and source = '$source'";
- }
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($expressstate)
- {
- $where .= " and expressstate = '$expressstate'";
- }
- if($state)
- {
- $where .= " and state = '$state'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($waybill)
- {
- $where .= " and waybill = '$waybill'";
- }
- if($dlzemail != '')
- {
- $where .= " and dlzemail = '$dlzemail'";
- }
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,country,library,librarytime,express,waybill,dlzemail,dlzemailtime',$order_str,$start,$perpage);
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- $country = $this->country->read($value['country']);
- $info_list[$key]['country'] = $country['name'];
- //$state = $this->typeclass->read($value['state']);
- //$info_list[$key]['state'] = $state['title'];
- if($value['library'] == 1)
- {
- $info_list[$key]['library'] = "未出库";
- }
- else if($value['library'] == 2)
- {
- $info_list[$key]['library'] = "已出库";
- }
- else if($value['library'] == 3)
- {
- $info_list[$key]['library'] = "已退库";
- }
- if($value['librarytime'] == '0')
- {
- $info_list[$key]['librarytime'] = '无';
- }
- else
- {
- $info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']);
- }
- $express = $this->express->read($value['express']);
- $info_list[$key]['express'] = $express['servicename'];
- if($value['dlzemail'] == '1')
- {
- $info_list[$key]['dlzemail'] = '发送成功';
- }
- else if ($value['dlzemail'] == '2')
- {
- $info_list[$key]['dlzemail'] = '发送失败';
- }
- else
- {
- $info_list[$key]['dlzemail'] = '';
- }
- $info_list[$key]['dlzemailtime'] = ($value['dlzemailtime']>0)?date('Y-m-d H:i:s',$value['dlzemailtime']):'';
- }
- $total = $this->fullorder->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }
- $notice = $this->notice->find_all("type = '2' and (".rtrim($fgshop,'or').")");
- $this->data['notice'] = $notice;
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $this->data['wlshop'] = $wlshop;
- $this->data['express'] = $this->express->find_all();
- $this->_Template('fullorder_waybillemail',$this->data);
- }
-
-
- public function _khdd()
- {
- $dt = 0;$fgshop = "shop = 0";$sid = 'id = 0';
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $usersp = explode('|',trim($user['shop'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- if($user['vip'] == 1)
- {
- $vip = 1;
- }
- else
- {
- $vip = 0;
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($_GET['excel']))
- {
- $page = $this->input->get('page',true);
- $perpage = $this->input->get('perpage',true);
- $warehouse = $this->input->get('warehouse',true);
- $timetk = $this->input->get('timetk',true);
- $timetj = $this->input->get('timetj',true);
- $shop = $this->input->get('shop',true);
- $source = $this->input->get('source',true);
- $state = $this->input->get('state',true);
- $review = $this->input->get('review',true);
- $type = $this->input->get('type',true);
- $express = $this->input->get('express',true);
- $orderinfo = $this->input->get('orderinfo',true);
- $user = $this->input->get('user',true);
- $client = $this->input->get('name',true);
- $waybill = $this->input->get('waybill',true);
- $number = $this->input->get('number',true);
- $email = $this->input->get('email',true);
- $phone = $this->input->get('phone',true);
- $dlz = $this->input->get('dlz',true);
- $print = $this->input->get('print',true);
- $library = $this->input->get('library',true);
- $js = $this->input->get('js',true);
- $exstate = $this->input->get('exstate',true);
- $xztime = $this->input->get('xztime',true);
- $libraryconfirm = $this->input->get('libraryconfirm',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $plorder = $this->input->get('pl',true);
- $paypal = $this->input->get('paypal',true);
- $zf = $this->input->get('zf',true);
- $pay = $this->input->get('pay',true);
- $excel = $this->input->get('excel',true);
- $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
- if($warehouse)
- {
- $where .= " and type = '$warehouse'";
- }
- if($timetk && $timetj)
- {
- $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($source)
- {
- if($source == '2d')
- {
- $where .= " and source >= '2'";
- }
- else
- {
- $where .= " and source = '$source'";
- }
- }
- if($state)
- {
- $where .= " and state = '$state'";
- }
- if($review)
- {
- $where .= " and review = '$review'";
- }
- if($type)
- {
- $where .= " and type = '$type'";
- }
- if($express)
- {
- $where .= " and express = '$express'";
- }
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($user)
- {
- $where .= " and user = '$user'";
- }
- if($client)
- {
- $where .= " and client like '%$client%'";
- }
- if($waybill)
- {
- $where .= " and waybill = '$waybill'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($email)
- {
- $where .= " and email = '$email'";
- }
- if($phone)
- {
- $where .= " and phone like '%$phone%'";
- }
- if($library)
- {
- $where .= " and library = '$library'";
- }
- if($print)
- {
- $where .= " and print = '$print'";
- }
- if($dlz != '')
- {
- $where .= " and dlz = '$dlz'";
- }
- if($js)
- {
- $where .= " and js = '$js'";
- }
- if($exstate)
- {
- $where .= " and exstate = '$exstate'";
- }
- if($libraryconfirm)
- {
- $where .= " and libraryconfirm = '$libraryconfirm'";
- }
- if($paypal)
- {
- $where .= " and paypal = '$paypal'";
- }
- if($pay)
- {
- $where .= " and pay = '$pay'";
- }
- if($zf)
- {
- if($zf == 1)
- {
- $where .= " and paypal not like '%-%-%-%'";
- }
- else
- {
- $where .= " and paypal like '%-%-%-%'";
- }
- }
- if($plorder)
- {
- $plorderinfo = '';$plnumber = '';$pln = 0;
- $plorder = explode(',',trim($plorder,','));
- foreach ($plorder as $value)
- {
- if(is_numeric($value))
- {
- $plorderinfo .= " orderinfo = ".$value." or";
- }
- else if($value != '')
- {
- $plorderinfo .= " number = '".$value."' or";
- }
- }
- if($pln > 0)
- {
- $where .= " and (".rtrim($plorderinfo,'or').") and (".rtrim($plnumber,'or').")";
- }
- else
- {
- $where .= " and (".rtrim($plorderinfo,'or').")";
- }
- }
- //数据排序
- $order_str = "dtime desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- if($excel == '1')
- {
- $shop = array();
- $shopdata = $this->shop->find_all("type = '269'");
- foreach ($shopdata as $v)
- {
- $shop[$v['id']] = array('t'=>$v['brandname'],'z'=>0,'l'=>0,'x'=>0);//店铺名称,总客户,老客户,新客户
- }
- $oldnumber = 0;$newnumber = 0;
- $info_list = $this->db->query('select distinct shop,email from crowd_fullorder where '.$where)->result_array();
- foreach ($info_list as $key=>$v)
- {
- $shop[$v['shop']]['z'] += 1;
- $num = $this->fullorder->find_count("email = '".$v['email']."' and shop = '".$v['shop']."' and ".$xztime." < '$timetj'");
- if($num > 1)
- {
- $shop[$v['shop']]['l'] += 1;
- }
- else
- {
- $shop[$v['shop']]['x'] += 1;
- }
- if(isset($v['email']) && $usp['excelpass'] == '1')
- {
- $emailpass = $this->setting->get_excelpass($v['email']);
- $info_list[$key]['email'] = $emailpass;
- }
- }
- $title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
- $titlename = "<table border=1>
- <tr>
- <td>店铺</td>
- <td>客户数</td>
- <td>老客户数</td>
- <td>新客户数</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "\n";
- $this->excel->get_fz2($shop,$titlename,$filename,$tail);
- }
- else if($excel == '2' || $excel == '3')
- {
- $kh = array();
- $info_list = $this->db->query('select distinct shop,email from crowd_fullorder where email != "" and '.$where)->result_array();
- foreach ($info_list as $key=>$v)
- {
- $k = $this->fullorder->find_all("shop = '".$v['shop']."' and email = '".$v['email']."' and ".$xztime." < '$timetj'",'name,email,dtime,shouldmoney','dtime desc');
- if($excel == 2 && count($k) > 1)
- {
- $kh[] = array($k[0]['name'],$k[0]['email'],date("Y-m-d H:i:s",$k[0]['dtime']),count($k),array_sum(array_column($k,'shouldmoney')));
- }
- if($excel == 3 && count($k) < 2)
- {
- $kh[] = array($k[0]['name'],$k[0]['email'],date("Y-m-d H:i:s",$k[0]['dtime']),count($k),array_sum(array_column($k,'shouldmoney')));
- }
- if(isset($v['email']) && $usp['excelpass'] == '1')
- {
- $emailpass = $this->setting->get_excelpass($v['email']);
- $info_list[$key]['email'] = $emailpass;
- }
- }
- $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
- $titlename = "<table border=1>
- <tr>
- <td>名称</td>
- <td>邮箱</td>
- <td>最后购买时间</td>
- <td>购买次数</td>
- <td>购买总额</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "\n";
- $this->excel->get_fz2($kh,$titlename,$filename,$tail);
- }
- else if($excel == '4' || $excel == '5')
- {
- $kh = array();
- $info_list = $this->db->query('select distinct shop,email from crowd_fullorder where email != "" and '.$where)->result_array();
- foreach ($info_list as $key=>$value)
- {
- $k = $this->fullorder->find_all("shop = '".$value['shop']."' and email = '".$value['email']."' and ".$xztime." < '$timetj'",'orderinfo,state,product,name,email,dtime,shouldmoney','dtime desc');
- if($excel == 4 && count($k) > 1)
- {
- foreach ($k as $v)
- {
- $typeclass = $this->typeclass->read($v['state']);
- $kh[] = array($v['orderinfo'],$typeclass['spare'],$v['product'],$v['name'],$v['email'],date("Y-m-d H:i:s",$v['dtime']),$v['shouldmoney']);
- }
- }
- if($excel == 5 && count($k) < 2)
- {
- if(!isset($k[0]['state']))
- {
- $typeclass = $k[0]['state'].'-数据字典无此信息';
- }
- else
- {
- $typeclass = $this->typeclass->read($k[0]['state']);
- }
- $kh[] = array($k[0]['orderinfo'],$typeclass['spare'],$k[0]['product'],$k[0]['name'],$k[0]['email'],date("Y-m-d H:i:s",$k[0]['dtime']),$k[0]['shouldmoney']);
- }
- if(isset($value['email']) && $usp['excelpass'] == '1')
- {
- $emailpass = $this->setting->get_excelpass($value['email']);
- $info_list[$key]['email'] = $emailpass;
- }
- }
- $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
- $titlename = "<table border=1>
- <tr>
- <td>订单号</td>
- <td>订单状态</td>
- <td>产品名</td>
- <td>客户名</td>
- <td>客户邮箱</td>
- <td>下单时间</td>
- <td>订单金额</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "\n";
- $this->excel->get_fz2($kh,$titlename,$filename,$tail);
- }
- }
- }
-
- public function _klarnadata()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['number']))
- {
- $number = $this->input->post('number',true);
- $data = $this->fullorder->get_number($number);
- $shop = $this->shop->read($data['shop']);
- $f = '';
- if($data['pay'] == '23')
- {
- $url = 'https://api-na.klarna.com/ordermanagement/v1/orders/'.$data['paypal'];
- $header[] = "Content-Type:application/json";
- $header[] = "Authorization: Basic ".base64_encode($shop['klarnaname'].":".$shop['klarnapass']);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- $res = curl_exec($ch);
- curl_close($ch);
- $res = json_decode($res,true);
- if(isset($res['fraud_status']) && $shop['klarnaname'] != '')
- {
- $f = (($res['fraud_status'] == 'ACCEPTED')?1:2).'|<strong>'.$res['purchase_currency'].($res['order_amount']/100).'</strong> , '.(($res['fraud_status'] != 'ACCEPTED')?'<font style="color:#f00">'.$res['fraud_status'].'</font>':$res['fraud_status']).' , description:'.$res['initial_payment_method']['description'].' , number of installments:'.$res['initial_payment_method']['number_of_installments'].'|'.$res['billing_address']['street_address'].(($res['billing_address']['street_address2']!='')?' '.$res['billing_address']['street_address2']:'').','.$res['billing_address']['city'].','.$res['billing_address']['region'].','.$res['billing_address']['postal_code'].','.$res['billing_address']['country'].','.$res['billing_address']['given_name'].' '.$res['billing_address']['family_name'].','.$res['billing_address']['phone'].','.$res['billing_address']['email'].'|'.$res['shipping_address']['street_address'].(($res['shipping_address']['street_address2']!='')?' '.$res['shipping_address']['street_address2']:'').','.$res['shipping_address']['city'].','.$res['shipping_address']['region'].','.$res['shipping_address']['postal_code'].','.$res['shipping_address']['country'].','.$res['shipping_address']['given_name'].' '.$res['shipping_address']['family_name'].','.$res['shipping_address']['phone'].','.$res['shipping_address']['email'];
- }
- }
- else if(($data['pay'] == '22' || $data['pay'] == '7') && $shop['paypalname'] != '')
- {
- $f = $this->paypal->data($data['paypal'],$shop);
- }
- else if(($data['pay'] == '26') && $shop['afterpayname'] != '')
- {
- $url = 'https://global-api.afterpay.com/v2/payments?ids='.$data['paypal'];
- $header[] = "Accept:application/json";
- $header[] = "User-Agent: Readme.io API Simulator'";
- $header[] = "Authorization: Basic ".base64_encode($shop['afterpayname'].":".$shop['afterpaypass']);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- $res = curl_exec($ch);
- curl_close($ch);
- $res = json_decode($res,true);
- if(isset($res['results'][0]['orderDetails']['consumer']['email']))
- {
- $f = $res['results'][0]['orderDetails']['consumer']['email'].'|'.$res['results'][0]['orderDetails']['billing']['line1'].','.$res['results'][0]['orderDetails']['billing']['line2'].','.$res['results'][0]['orderDetails']['billing']['area1'].','.$res['results'][0]['orderDetails']['billing']['region'].','.$res['results'][0]['orderDetails']['billing']['postcode'].','.$res['results'][0]['orderDetails']['billing']['countryCode'].','.$res['results'][0]['orderDetails']['billing']['name'].','.$res['results'][0]['orderDetails']['billing']['phoneNumber'].'|'.$res['results'][0]['orderDetails']['shipping']['line1'].','.$res['results'][0]['orderDetails']['shipping']['line2'].','.$res['results'][0]['orderDetails']['shipping']['area1'].','.$res['results'][0]['orderDetails']['shipping']['region'].','.$res['results'][0]['orderDetails']['shipping']['postcode'].','.$res['results'][0]['orderDetails']['shipping']['countryCode'].','.$res['results'][0]['orderDetails']['shipping']['name'].','.$res['results'][0]['orderDetails']['shipping']['phoneNumber'];
- $f = str_replace(',,',',',$f);
- }
- }
- else if(($data['pay'] == '27') && $shop['clearpayname'] != '')
- {
- $url = 'https://global-api.afterpay.com/v2/payments?ids='.$data['paypal'];
- $header[] = "Accept:application/json";
- $header[] = "User-Agent: Readme.io API Simulator'";
- $header[] = "Authorization: Basic ".base64_encode($shop['clearpayname'].":".$shop['clearpaypass']);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- $res = curl_exec($ch);
- curl_close($ch);
- $res = json_decode($res,true);
- if(isset($res['results'][0]['orderDetails']['consumer']['email']))
- {
- $f = $res['results'][0]['orderDetails']['consumer']['email'].'|'.$res['results'][0]['orderDetails']['billing']['line1'].','.$res['results'][0]['orderDetails']['billing']['line2'].','.$res['results'][0]['orderDetails']['billing']['area1'].','.$res['results'][0]['orderDetails']['billing']['region'].','.$res['results'][0]['orderDetails']['billing']['postcode'].','.$res['results'][0]['orderDetails']['billing']['countryCode'].','.$res['results'][0]['orderDetails']['billing']['name'].','.$res['results'][0]['orderDetails']['billing']['phoneNumber'].'|'.$res['results'][0]['orderDetails']['shipping']['line1'].','.$res['results'][0]['orderDetails']['shipping']['line2'].','.$res['results'][0]['orderDetails']['shipping']['area1'].','.$res['results'][0]['orderDetails']['shipping']['region'].','.$res['results'][0]['orderDetails']['shipping']['postcode'].','.$res['results'][0]['orderDetails']['shipping']['countryCode'].','.$res['results'][0]['orderDetails']['shipping']['name'].','.$res['results'][0]['orderDetails']['shipping']['phoneNumber'];
- $f = str_replace(',,',',',$f);
- }
- }
- else if($data['pay'] == '1211')
- {
- $url = 'https://api.stripe.com/v1/payment_intents/'.$data['paypal'];
- $header[] = "Authorization:Bearer ".$shop['stripe'];
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- $res = curl_exec($ch);
- curl_close($ch);
- $res = json_decode($res,true);
- $f = '';
- if(isset($res['shipping']['name']))
- {
- $line = ($res['shipping']['address']['line2'] != '')?$res['shipping']['address']['line1'].' '.$res['shipping']['address']['line2']:$res['shipping']['address']['line1'];
- $f = 'stripe|'.json_encode(array('name'=>$res['shipping']['name'],'email'=>$res['receipt_email'],'address'=>$line.','.$res['shipping']['address']['city'].','.$res['shipping']['address']['state'].','.$res['shipping']['address']['postal_code'].','.$res['shipping']['address']['country'].','.$res['shipping']['phone'],'shouldmoney'=>$res['amount']/100));
- }
- }
- else
- {
- echo json_encode(array('msg'=>'此店铺没有对接信息','success'=>false));exit;
- }
- if($f != '')
- {
- if($this->fullorder->save(array('klarnadata'=>$f),$data['id']))
- {
- echo json_encode(array('msg'=>'获取成功,请关闭此页重新打开','success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'写入失败,请重试','success'=>false));exit;
- }
- }
- else
- {
- echo json_encode(array('msg'=>'获取失败,请稍后重试','cl'=>base64_encode($shop['afterpayname'].":".$shop['afterpaypass']),'a'=>$data['paypal'],'success'=>false));exit;
- }
- }
- }
-
- public function _kcyz($warehouse,$whlabel,$id,$shop,$number)
- {
- if(!$whlabel || $whlabel == '|')
- {
- return array('t'=>1,'m'=>json_encode(array('t'=>1,'msg'=>'请先添加产品信息!','success'=>false)));exit;
- }
- $w = $this->warehouse->read($warehouse);
- if($w['zd'] != 1)
- {
- return 1;
- }
- $pp = explode('|',trim($whlabel,'|'));
- $x = 0;$save = array();
- foreach ($pp as $va)
- {
- $num = explode('-',$va);
- if($number)
- {
- $whlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and (zd = '$number' or zd = '') and (shop IS NULL or shop = '')");//通用
- $shopwhlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and (zd = '$number' or zd = '') and shop like '%,".$shop.",%'");//专属
- }
- else
- {
- $whlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and zd = '' and (shop IS NULL or shop = '')");//通用
- $shopwhlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and zd = '' and shop like '%,".$shop.",%'");//专属
- }
- $x++;
- if(count($whlabel)+count($shopwhlabel) < $num[1])
- {
- $save[] = $x-1;continue;//提前先加X不然出错,所以要减1
- }
- }
- return $save;
- }
-
- public function _epod()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['number']))
- {
- $number = $this->input->post('number',true);
- $data = $this->fullorder->get_number($number);
- if(is_file('./data/epod/'.date('Y',time()).'/epod-'.$data['waybill'].'.pdf'))
- {
- echo json_encode(array('msg'=>'http://'.$_SERVER['HTTP_HOST'].'/data/epod/'.date('Y',time()).'/epod-'.$data['waybill'].'.pdf','success'=>true));exit;
- }
- else
- {
- $epod = $this->dhl->get_epod($data);
- if($epod['c'] == 1)
- {
- echo json_encode(array('msg'=>'http://'.$_SERVER['HTTP_HOST'].$epod['d'],'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>$epod['d'],'success'=>false));exit;
- }
- }
- }
- }
-
- public function _zw($arg_array)
- {
- $arg_array = $arg_array[0];$fpdata = array();
- $fullorder = $this->fullorder->read($arg_array);
- $fullorder['shipremarks'] = str_replace(array('<','>'),array('<','>'),$fullorder['shipremarks']);
- $fullorder['parameter'] = str_replace(",","---",$fullorder['parameter']);
- $this->data['fullorder'] = $fullorder;
- $this->data['countrys'] = $this->country->find_all();
- $this->data['express'] = $this->express->find_all();
- $warehouse = $this->warehouse->read($fullorder['type']);
- if(stripos($fullorder['fpdata'],';') !== false)
- {
- $fpdata = explode(';',rtrim($fullorder['fpdata'],';'));
- foreach ($fpdata as $k=>$v)
- {
- $xxv = explode('|',$v);
- if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)
- {
- $xxv['zd'] = "<p>已占单</p>";
- $bdck = $warehouse['bdck'];
- if(stripos($xxv[9],'~') !== false)
- {
- $dxxv = explode('~',trim($xxv[9],'~'));
- foreach ($dxxv as $val)
- {
- $wzid = $this->$bdck->read(trim($val,$warehouse['hz']));
- if($wzid['details'] != '')
- {
- $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
- }
- }
- }
- else
- {
- $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));
- if($wzid['details'] != '')
- {
- $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
- }
- }
- }
- $fpdata[$k] = $xxv;
- }
- }
- $this->data['fpdata'] = $fpdata;
- $this->data['fpdata'] = $fpdata;
- $thfpdataxs = array();
- if($fullorder['thfpdata'] != '')
- {
- $thfpdata = explode(';',trim($fullorder['thfpdata'],';'));
- foreach ($thfpdata as $k=>$v)
- {
- $thxs = explode('~',trim($v,'~'));
- $thxs[0] = explode('|',trim($thxs[0],'|'));
- $thxs[1] = explode('|',trim($thxs[1],'|'));
- $thfpdataxs[] = array("<p>".$thxs[0][1]."<i class='fa fa-level-down'></i></p><p>".$thxs[1][1]."</p>","<p>".$thxs[0][2]."</p><p>".$thxs[1][2]."</p>","<p>旧</p><p>新</p>",$thxs[1][0]);
- }
- }
- $this->data['thfpdata'] = $thfpdataxs;
- $shop = $this->shop->read($fullorder['shop']);
- $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
- $is = 0;
- if($shop['type'] == 269 || $shop['type'] == 2678)//判断是否独立站,269是独立站
- {
- $is = 1;
- }
- $this->data['is'] = $is;
- //单项开始
- $warehouse = $this->warehouse->read($fullorder['warehouse']);//发货仓库
- $state = $this->typeclass->read($fullorder['state']);//订单状态
- $country = $this->country->read($fullorder['country']);//国家
- if($fullorder['capital'] == 1)
- {
- $capital = '暂未支付';
- }
- else if($fullorder['capital'] == 2)
- {
- $capital = '部分支付';
- }
- else if($fullorder['capital'] == 3)
- {
- $capital = '全部支付';
- }
- if($fullorder['printtype'] == 1)
- {
- $printtype = '运单';
- }
- else if($fullorder['printtype'] == 2)
- {
- $printtype = '发货单';
- }
- else if($fullorder['printtype'] == 3)
- {
- $printtype = '不打印单据';
- }
- else
- {
- $printtype = '未选择';
- }
- $this->data['warehouse'] = $warehouse['title'];
- $this->data['state'] = $state['title'];
- $this->data['capital'] = $capital;
- $this->data['country'] = $country['name'];
- $this->data['printtype'] = $printtype;
- //单项结束
- /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
- $downwaybill = '';$dwls = array();
- $oldwaybill = explode('-',ltrim($fullorder['oldwaybill'],'-'));
- if(isset($oldwaybill[0][1]))
- {
- $oldwaybill = array_reverse($oldwaybill); //调整顺序
- foreach ($oldwaybill as $v)
- {
- $dw = explode('/',$v);
- if(isset($dw[1]))
- {
- if(stripos($downwaybill,$dw[1]) === false)
- {
- $dwls[$dw[1]] = 1;
- $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
- }
- }
- }
- }
- if($fullorder['printtype'] == 1)
- {
- if($fullorder['waybill'] != '' && !isset($dwls[$fullorder['waybill']]))
- {
- $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullorder['printtime']).'/y-'.$fullorder['waybill'].'.pdf" target="_blank">'.$fullorder['waybill'].'</a>、'.$downwaybill;
- }
- }
- $this->data['downwaybill'] = rtrim($downwaybill,'、');
- /** 历史打印时间 **/
- $printtime = '';
- if($fullorder['oldprinttime'])
- {
- $pte = explode('-',rtrim($fullorder['oldprinttime'],'-'));
- foreach ($pte as $v)
- {
- $printtime .= date('Y-m-d H:i:s',$v).'、';
- }
- }
- $this->data['printtime'] = rtrim($printtime,'、');
- $product = '';
- $fullorder['product'] = str_replace("'","",$fullorder['product']);
- if($fullorder['link'] != '' && $fullorder['source'] != '1')
- {
- $pt = explode(',',$fullorder['product']);
- $lk = explode(',',$fullorder['link']);
- for($i=0;$i<count($pt);$i++)
- {
- if(isset($lk[$i]))
- {
- $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);
- }
- else
- {
- $octs = '';
- }
- $a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];
- //$a = (stripos($pt[$i],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($pt[$i],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($pt[$i],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($pt[$i],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($pt[$i],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($pt[$i],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($pt[$i],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($pt[$i],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($pt[$i],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$pt[$i].'</font>':$pt[$i];
- if(isset($lk[$i]))
- {
- $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';
- }
- else
- {
- $product .= ($product != '')?' , '.$a:$a;
- }
- }
- }
- else
- {
- $octs = $this->colourorderts->get_text($fullorder['product']);
- $a = $octs?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
- //$a = (stripos($fullorder['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullorder['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullorder['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullorder['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullorder['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullorder['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullorder['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullorder['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullorder['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
- $product = $a;
- }
- $this->data['product'] = $product;
- $out = $this->systemtransfer->find_all("number = '".$fullorder['number']."'");
- $outread = '';
- if($out)
- {
- foreach ($out as $val)
- {
- $list = '';
- $rk = explode('|',trim($val['rk'],'|'));
- $rktime = explode('|',trim($val['rktime'],'|'));
- $zw = array();
- $t = $this->transfer->find_all("1=1");
- foreach ($t as $v)
- {
- $zw[$v['id']] = $v['title'];
- }
- if($val['rk'] != '' && count($rk) > 0)
- {
- for($i=0;$i<count($rk);$i++)
- {
- if(!isset($rktime[$i]))
- {
- $list .= $zw[$cz[$i]];
- }
- else
- {
- $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';
- }
- }
- }
- $outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';
- }
- }
- else
- {
- $systemwigsout = $this->systemwigsout->find_all("number = '".$fullorder['number']."'");
- $outread = array();
- if($systemwigsout)
- {
- foreach ($systemwigsout as $v)
- {
- if($v['czwarehouse'] == 37)
- {
- $outread[] = '华荣厂';
- }
- else if($v['czwarehouse'] == 0)
- {
- $outread[] = '龙盈厂';
- }
- $cz = explode('|',trim($v['cz'],'|'));
- $cztime = explode('|',trim($v['cztime'],'|'));
- $zw = $this->transfer->get_list();
- if($v['cz'] != '' && count($cz) > 0)
- {
- for($i=0;$i<count($cz);$i++)
- {
- if(!isset($cztime[$i]))
- {
- $outread[] = $zw[$cz[$i]].' -> ';
- }
- else
- {
- $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -> ';
- }
- }
- $outread[] = '<br>';
- }
- }
- }
- }
- $klarnacolor = '';
- if($fullorder['klarnadata'] !='')
- {
- $klarnadata = explode('|',$fullorder['klarnadata']);
- if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')
- {
- $klarnadata[1] = json_decode($klarnadata[1],true);
- if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullorder['shouldmoney'] && $fullorder['pay'] == 1211)
- {
- $klarnacolor = 'style="color:#F00"';
- }
- }
- else if($klarnadata[0]!=1 && $fullorder['pay']!=26 && $fullorder['pay']!=27 && $fullorder['pay']!=1211)
- {
- $klarnacolor = 'style="color:#F00"';
- }
- if($fullorder['pay'] == 23)//klarna
- {
- $ToState = array('alabama'=>'AL','alaska'=>'AK','arizona'=>'AZ','arkansas'=>'AR','california'=>'CA','colorado'=>'CO','connecticut'=>'CT','delaware'=>'DE','florida'=>'FL','georgia'=>'GA','hawaii'=>'HI','idaho'=>'ID','illinois'=>'IL','indiana'=>'IN','iowa'=>'IA','kansas'=>'KS','kentucky'=>'KY','louisiana'=>'LA','maine'=>'ME','maryland'=>'MD','massachusetts'=>'MA','michigan'=>'MI','minnesota'=>'MN','mississippi'=>'MS','missouri'=>'MO','montana'=>'MT','nebraska'=>'NE','nevada'=>'NV','new hampshire'=>'NH','new jersey'=>'NJ','new mexico'=>'NM','new york'=>'NY','north carolina'=>'NC','north dakota'=>'ND','ohio'=>'OH','oklahoma'=>'OK','oregon'=>'OR','pennsylvania'=>'PA','rhode island'=>'RI','south carolina'=>'SC','south dakota'=>'SD','tennessee'=>'TN','texas'=>'TX','utah'=>'UT','vermont'=>'VT','virginia'=>'VA','washington'=>'WA','west virginia'=>'WV','wisconsin'=>'WI','wyoming'=>'WY','district of columbia'=>'DC','virgin islands'=>'VI','guam'=>'GU','puerto rico'=>'PR');
- $ToState = array_flip($ToState);
- $klarnadata3 = str_replace(' ','',$klarnadata[3]);
- $city = str_replace(' ','',$fullorder['city']);
- $klarnadataaddress = explode($city,$klarnadata3);
- if(isset($klarnadataaddress[1]))
- {
- $klarnadata3 = $city.$klarnadataaddress[1];
- $klarnadatacolor = explode(',',$klarnadata3);
- unset($klarnadatacolor[4]);
- unset($klarnadatacolor[6]);
- if(isset($ToState[$klarnadatacolor[1]]))
- {
- $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);
- }
- $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);
- }
- else
- {
- $klarnadata['color'] = $klarnadata3;
- }
- }
- }
- else
- {
- $klarnadata = '';
- }
- $p = explode('-',$fullorder['paypal']);
- $this->data['klarnacolor'] = $klarnacolor;
- $this->data['klarnadata'] = $klarnadata;
- $this->data['systemwigsout'] = $outread;
- $this->_Template('fullorder_zw',$this->data);
- }
-
-
- public function _dcdxyz()
- {
- $post = $this->input->get(NULL, TRUE);
- if(isset($post['timetk']))
- {
- $timetk = $this->input->get('timetk',true);
- $timetj = $this->input->get('timetj',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "oldwaybill != ''";
- if($timetk && $timetj)
- {
- $where .= " and dtime > '$timetk' and dtime < '$timetj'";
- }
- //数据排序
- $order_str = "dtime desc";
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'orderinfo,number,oldwaybill',$order_str);
- $data = array();
- foreach ($info_list as $key=>$value)
- {
- $ob = '';
- $oldwaybill = explode('-',trim($value['oldwaybill'],'-'));
- if(count($oldwaybill) < 2)
- {
- continue;
- }
- $oldwaybill = array_reverse($oldwaybill); //调整顺序
- foreach ($oldwaybill as $v)
- {
- $dw = explode('/',$v);
- if(isset($dw[1]))
- {
- $dwls[$dw[1]] = 1;
- $ob .= $dw[1].'、';
-
- }
- }
- $info_list[$key]['oldwaybill'] = trim($ob,'、');
- $data[] = $info_list[$key];
- }
- $title = "多运单信息 ".date("Y-m-d");
- $titlename = "<table border=1>
- <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
- <tr>
- <td>订单号</td>
- <td>编号</td>
- <td>运单号</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "\n";
- $this->excel->get_fz2($data,$titlename,$filename,$tail);
- }
- }
-
- public function _thxz()
- {
- $post = $this->input->get(NULL, TRUE);
- if(isset($post['timetk']))
- {
- $timetk = $this->input->get('timetk',true);
- $timetj = $this->input->get('timetj',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "returndata != ''";
- if($timetk && $timetj)
- {
- $where .= " and dtime > '$timetk' and dtime < '$timetj'";
- }
- //数据排序
- $order_str = "dtime desc";
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'orderinfo,number,returndata',$order_str);
- foreach ($info_list as $key=>$value)
- {
- $ydh = explode('">',$value['returndata']);
- $ydh = explode('</a>',$ydh[1]);
- $info_list[$key]['returndata'] = $ydh[0];
- $time = explode('pdf/',$value['returndata']);
- $time = explode('/',$time[1]);
- $info_list[$key]['time'] = $time[0];
- }
- $title = "退货订单信息 ".date("Y-m-d");
- $titlename = "<table border=1>
- <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
- <tr>
- <td>订单号</td>
- <td>编号</td>
- <td>退货运单号</td>
- <td>退货时间</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "\n";
- $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
- }
- }
-
- public function _ddcf()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['number']))
- {
- $number = $this->input->post('number',true);
- $data = $this->fullorder->get_number($number);
- if(!$data)
- {
- echo json_encode(array('msg'=>'没有找到此订单','success'=>false));exit;
- }
- if($data['review'] != 1 && $data['review'] != 2)
- {
- echo json_encode(array('msg'=>'必须是 待审核 状态才能拆分','success'=>false));exit;
- }
- if($data['merge'] != 0)
- {
- echo json_encode(array('msg'=>'已合并的订单无法使用此拆分功能','success'=>false));exit;
- }
- $cfnum = explode('-',trim($number,'-'));
- // if((count($cfnum) > 3 && stripos($number,'-PF-') === false))
- // {
- // echo json_encode(array('msg'=>'只能在原单操作拆分','success'=>false));exit;
- // }
- if(count($cfnum) > 4 && stripos($number,'-PF-') !== false)
- {
- echo json_encode(array('msg'=>'只能在原单操作拆分','success'=>false));exit;
- }
- $num = $this->fullorder->find_count("number like '".$number."%'");
- $data['number'] = $data['number'].'-'.$num;
- $data['orderinfo'] = $data['shop'].date('ymdHis',time()).rand(0,1);;
- $data['shouldmoney'] = 0;
- $data['budget'] = 0;
- $data['shipremarks'] = '';
- $data['source'] = 1;
- //$data['review'] = 2;
- $data['extra_status'] = 1;//拆分的订单
-
- unset($data['id']);
- unset($data['jweight']);
- unset($data['fpcount']);
- unset($data['returndata']);
- unset($data['waybill']);
- unset($data['oldwaybill']);
- unset($data['printtime']);
- if($this->fullorder->insert($data))
- {
- echo json_encode(array('msg'=>'拆分成功!新订单编号:'.$data['number'],'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'拆分失败,请重试','success'=>false));exit;
- }
- }
- }
-
- public function _cf() //合并订单拆分
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['id']))
- {
- $id = $this->input->post('id',true);
- $b = $this->fullorder->read($id);
- $order = array();
- if($b['merge'] == $b['id'])
- {
- $data = $this->fullorder->find_all("merge = '".$b['merge']."'");
- foreach ($data as $v)
- {
- $a = $this->fullorderhb->get_orderinfo($v['orderinfo']);
- if($a)
- {
- $this->fullorder->save($a,$v['id']);
- }
- $order[] = $v['id'];
- }
- echo json_encode(array('msg'=>'拆分成功!','d'=>$order,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'拆分条件错误!','success'=>false));exit;
- }
- }
- }
- }
|