Fullordertt.php 233 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Fullordertt extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_fullorder','fullorder');
  7. $this->load->_model('Model_fullordertt','fullordertt');
  8. $this->load->_model('Model_fullorderexcel','fullorderexcel');
  9. $this->load->_model('Model_shop','shop');
  10. $this->load->_model('Model_typeclass','typeclass');
  11. $this->load->_model('Model_express','express');
  12. $this->load->_model('Model_country','country');
  13. $this->load->_model('Model_productdescribe','productdescribe');
  14. $this->load->_model('Model_customs','customs');
  15. $this->load->_model('Model_detailed','detailed');
  16. $this->load->_model('Model_productdescription','productdescription');
  17. $this->load->_model('Model_logistics','logistics');
  18. $this->load->_model('Model_hl','hl');
  19. $this->load->_model('Model_excel','excel');
  20. $this->load->_model('Model_warehouse','warehouse');
  21. $this->load->_model('Model_customertt','customertt');
  22. $this->load->_model('Model_user','user');
  23. $this->load->_model('Model_dhl','dhl');
  24. $this->load->_model('Model_ali','ali');
  25. $this->load->_model('Model_notice','notice');
  26. $this->load->_model('Model_api','api');
  27. $this->load->_model('Model_usps','usps');
  28. $this->load->_model('Model_fullorder_smt','fullorder_smt');
  29. $this->load->_model('Model_whlabel','whlabel');
  30. $this->load->_model('Model_reset','fullreset');
  31. $this->load->_model('Model_specialstock','specialstock');
  32. $this->load->_model('Model_systemwigsout','systemwigsout');
  33. $this->load->_model('Model_colourorderts','colourorderts');
  34. $this->load->_model('Model_paypal','paypal');
  35. $this->load->_model('Model_ck','ck');
  36. $this->load->_model('Model_weight','weight');
  37. $this->load->_model('Model_pay','pay');
  38. $this->load->_model('Model_setting','setting');
  39. $this->load->_model('Model_whlabel_fc','whlabel_fc');
  40. $this->load->_model('Model_transfer','transfer');
  41. $this->load->_model('Model_systemtransfer','systemtransfer');
  42. $this->load->_model('Model_power','power');
  43. $this->load->_model('Model_fullordertthb','fullordertthb');
  44. $this->load->_model('Model_returngoods','returngoods');
  45. $this->load->_model("Model_logic_order","logic_order");
  46. $this->load->_model("Model_excelnew",'excelnew');
  47. $this->load->_model("Model_fullordererrors","fullordererrors");
  48. $this->load->_model("Model_express_tt","express_tt");
  49. }
  50. //定义方法的调用规则 获取URI第二段值
  51. public function _remap($arg,$arg_array)
  52. {
  53. if($arg == 'add')//添加
  54. {
  55. $this->_add();
  56. }
  57. else if($arg == 'edit')//修改
  58. {
  59. $this->_edit($arg_array);
  60. }
  61. else if($arg == 'readonly')//修改
  62. {
  63. $this->_readonly($arg_array);
  64. }
  65. else if($arg == 'readlist')
  66. {
  67. $this->_readlist();
  68. }
  69. else if($arg == 'readlistdown')
  70. {
  71. $this->_readlistdown();
  72. }
  73. else if($arg == 'del')//修改
  74. {
  75. $this->_del();
  76. }
  77. else if($arg == 'price')//价格明细
  78. {
  79. $this->_price();
  80. }
  81. else if($arg == 'customs')
  82. {
  83. $this->_customs();
  84. }
  85. else if($arg == 'express')
  86. {
  87. $this->_express();
  88. }
  89. else if($arg == 'hl')
  90. {
  91. $this->_hl();
  92. }
  93. else if($arg == 'repeat')
  94. {
  95. $this->_repeat();
  96. }
  97. else if($arg == 'operation')
  98. {
  99. $this->_operation();
  100. }
  101. else if($arg == 'merge')
  102. {
  103. $this->_merge();
  104. }
  105. else if($arg == 'fmexcel')
  106. {
  107. $this->_fmexcel();
  108. }
  109. else if($arg == 'fdexcel')
  110. {
  111. $this->_fdexcel();
  112. }
  113. else if($arg == 'fdfexcel')
  114. {
  115. $this->_fdfexcel();
  116. }
  117. else if($arg == 'evaluate')
  118. {
  119. $this->_evaluate();
  120. }
  121. else if($arg == 'state')
  122. {
  123. $this->_state();
  124. }
  125. else if($arg == 'wl')
  126. {
  127. $this->_wl();
  128. }
  129. else if($arg == 'wlbz')
  130. {
  131. $this->_wlbz($arg_array);
  132. }
  133. else if($arg == 'review')
  134. {
  135. $this->_review();
  136. }
  137. else if($arg == 'black')
  138. {
  139. $this->_black();
  140. }
  141. else if($arg == 'ryf')
  142. {
  143. $this->_ryf();
  144. }
  145. else if($arg == 'expresstype')
  146. {
  147. $this->_expresstype();
  148. }
  149. else if($arg == 'fsstate')
  150. {
  151. $this->_fsstate();
  152. }
  153. else if($arg == 'power')
  154. {
  155. $this->_power();
  156. }
  157. else if($arg == 'error')
  158. {
  159. $this->_error();
  160. }
  161. else if($arg == 'yc')
  162. {
  163. $this->_yc();
  164. }
  165. else if($arg == 'yzaddress')
  166. {
  167. $this->_yzaddress();
  168. }
  169. else if($arg == 'return')
  170. {
  171. $this->_return();
  172. }
  173. else if($arg == 'clearreturn')
  174. {
  175. $this->_clearreturn();
  176. }
  177. else if($arg == 'ali')
  178. {
  179. $this->_ali();
  180. }
  181. else if($arg == 'dqpm')
  182. {
  183. $this->_dqpm();
  184. }
  185. else if($arg == 'ddpmdata')
  186. {
  187. $this->_ddpmdata($arg_array);
  188. }
  189. else if($arg == 'dqpmprovince')
  190. {
  191. $this->_dqpmprovince($arg_array);
  192. }
  193. else if($arg == 'ddpmexcel')
  194. {
  195. $this->_ddpmexcel($arg_array);
  196. }
  197. else if($arg == 'statedc')
  198. {
  199. $this->_statedc();
  200. }
  201. else if($arg == 'statedcwl')
  202. {
  203. $this->_statedcwl();
  204. }
  205. else if($arg == 'waybillemail')
  206. {
  207. $this->_waybillemail();
  208. }
  209. else if($arg == 'khdd')
  210. {
  211. $this->_khdd();
  212. }
  213. else if($arg == 'klarnadata')
  214. {
  215. $this->_klarnadata();
  216. }
  217. else if($arg == 'epod')
  218. {
  219. $this->_epod();
  220. }
  221. else if($arg == 'zw')
  222. {
  223. $this->_zw($arg_array);
  224. }
  225. else if($arg == 'thxz')
  226. {
  227. $this->_thxz($arg_array);
  228. }
  229. else if($arg == 'dcdxyz')
  230. {
  231. $this->_dcdxyz();
  232. }
  233. else if($arg == 'ddcf')
  234. {
  235. $this->_ddcf();
  236. }
  237. else if($arg == 'cf')
  238. {
  239. $this->_cf();
  240. }
  241. else if($arg == 'pljzzd')
  242. {
  243. $this->_pljzzd();
  244. }
  245. else if($arg == 'cbtlabel'){
  246. $this->_cbtlabel($arg_array);
  247. }
  248. else
  249. {
  250. $this->_index();
  251. }
  252. }
  253. //管理
  254. public function _index()
  255. {
  256. $dt = 0;$fgshop = "shop = 0";$sid = 'id = 0';
  257. if(isset($_SESSION['api']))
  258. {
  259. $user = $this->user->get_api($_SESSION['api']);
  260. $usp = $user;
  261. $fgshop = "";$sid = "";
  262. $usersp = explode('|',trim($user['shop'],'|'));
  263. foreach ($usersp as $value)
  264. {
  265. $fgshop .= " shop = ".$value." or";
  266. $sid .= " id = ".$value." or";
  267. }
  268. if($user['vip'] == 1)
  269. {
  270. $vip = 1;
  271. }
  272. else
  273. {
  274. $vip = 0;
  275. }
  276. }
  277. else
  278. {
  279. $vip = 0;
  280. header('Location: /');exit;
  281. }
  282. $post = $this->input->post(NULL, TRUE);
  283. if(isset($post['page']))
  284. {
  285. $page = $this->input->post('page',true);
  286. $perpage = $this->input->post('perpage',true);
  287. $warehouse = $this->input->post('warehouse',true);
  288. $timetk = $this->input->post('timetk',true);
  289. $timetj = $this->input->post('timetj',true);
  290. $shop = $this->input->post('shop',true);
  291. $source = $this->input->post('source',true);
  292. $state = $this->input->post('state',true);
  293. $review = $this->input->post('review',true);
  294. $type = $this->input->post('type',true);
  295. $express = $this->input->post('express',true);
  296. $orderinfo = $this->input->post('orderinfo',true);
  297. $user = $this->input->post('user',true);
  298. $client = $this->input->post('name');
  299. $waybill = $this->input->post('waybill',true);
  300. $waybillid = $this->input->post('waybillid',true);
  301. $number = $this->input->post('number',true);
  302. $email = $this->input->post('email',true);
  303. $phone = $this->input->post('phone',true);
  304. $dlz = $this->input->post('dlz',true);
  305. $print = $this->input->post('print',true);
  306. $library = $this->input->post('library',true);
  307. $js = $this->input->post('js',true);
  308. $exstate = $this->input->post('exstate',true);
  309. $xztime = $this->input->post('xztime',true);
  310. $libraryconfirm = $this->input->post('libraryconfirm',true);
  311. $timetk = strtotime($timetk);
  312. $timetj = strtotime($timetj);
  313. $plorder = $this->input->post('pl',true);
  314. $paypal = $this->input->post('paypal',true);
  315. $orderremarks = $this->input->post('orderremarks',true);
  316. $pay = $this->input->post('pay',true);
  317. $klarna = $this->input->post('klarna',true);
  318. $zf = $this->input->post('zf',true);
  319. $where = "1=1 and (".rtrim($fgshop,'or').")";
  320. if($warehouse)
  321. {
  322. $where .= " and type = '$warehouse'";
  323. }
  324. if($timetk && $timetj)
  325. {
  326. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  327. }
  328. if($shop)
  329. {
  330. $where .= " and shop = '$shop'";
  331. }
  332. if($source)
  333. {
  334. if($source == '2d')
  335. {
  336. $where .= " and source >= '2'";
  337. }
  338. else
  339. {
  340. $where .= " and source = '$source'";
  341. }
  342. }
  343. if($state)
  344. {
  345. $where .= " and state = '$state'";
  346. }
  347. if($review)
  348. {
  349. $where .= " and review = '$review'";
  350. }
  351. if($type)
  352. {
  353. $where .= " and type = '$type'";
  354. }
  355. if($express)
  356. {
  357. $where .= " and express = '$express'";
  358. }
  359. if($orderinfo)
  360. {
  361. $where .= " and orderinfo = '$orderinfo' and orderinfo != '0'";
  362. }
  363. if($user)
  364. {
  365. $where .= " and user = '$user'";
  366. }
  367. if($client)
  368. {
  369. $where .= " and client like '%$client%'";
  370. }
  371. if($waybill)
  372. {
  373. $where .= " and waybill = '$waybill'";
  374. }
  375. if($waybillid){
  376. $where .= " and waybillid like '%".$waybillid."%'";
  377. }
  378. if($number)
  379. {
  380. $where .= " and number like '$number%'";
  381. }
  382. if($email)
  383. {
  384. $where .= " and email = '$email'";
  385. }
  386. if($phone)
  387. {
  388. $where .= " and phone like '%$phone%'";
  389. }
  390. if($library)
  391. {
  392. $where .= " and library = '$library'";
  393. }
  394. if($print)
  395. {
  396. $where .= " and print = '$print'";
  397. }
  398. if($dlz != '')
  399. {
  400. $where .= " and dlz = '$dlz'";
  401. }
  402. if($js)
  403. {
  404. $where .= " and js = '$js'";
  405. }
  406. if($exstate)
  407. {
  408. $where .= " and exstate = '$exstate'";
  409. }
  410. if($libraryconfirm)
  411. {
  412. $where .= " and libraryconfirm = '$libraryconfirm'";
  413. }
  414. if($klarna != '')
  415. {
  416. if($klarna == 2)
  417. {
  418. $where .= " and klarna >= '$klarna'";
  419. }
  420. else
  421. {
  422. $where .= " and klarna = '$klarna'";
  423. }
  424. }
  425. if($paypal)
  426. {
  427. $where .= " and paypal = '$paypal'";
  428. }
  429. if($orderremarks){
  430. $where .= " and orderremarks like '%$orderremarks%'";
  431. }
  432. if($pay)
  433. {
  434. $where .= " and pay = '$pay'";
  435. }
  436. if($zf)
  437. {
  438. if($zf == 1)
  439. {
  440. $where .= " and paypal not like '%-%-%-%'";
  441. }
  442. else
  443. {
  444. $where .= " and paypal like '%-%-%-%'";
  445. }
  446. }
  447. if($plorder)
  448. {
  449. $plorderinfo = '';$plnumber = '';$pln = 0;
  450. $plorder = explode(',',trim($plorder,','));
  451. foreach ($plorder as $value)
  452. {
  453. if(is_numeric($value))
  454. {
  455. $plorderinfo .= " orderinfo = ".$value." or";
  456. }
  457. else if($value != '')
  458. {
  459. $plorderinfo .= " number = '".$value."' or";
  460. }
  461. }
  462. if($pln > 0)
  463. {
  464. $where .= " and (".rtrim($plorderinfo,'or').") and (".rtrim($plnumber,'or').")";
  465. }
  466. else
  467. {
  468. $where .= " and (".rtrim($plorderinfo,'or').")";
  469. }
  470. }
  471. //数据排序
  472. $order_str = "dtime desc";
  473. if(empty($page))
  474. {
  475. $start = 0;
  476. $perpage = 1;
  477. }
  478. else
  479. {
  480. $start = ($page - 1)*$perpage;
  481. }
  482. //取得信息列表id,shop,type,source,user,orderinfo,number,name,state,buytime,clientremarks,review,print,library,libraryconfirm,express,waybill,orderremarks,black
  483. $info_list = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,sname,phone,state,dtime,review,libraryconfirm,express,waybill,orderremarks,library,black,clientremarks,waybillid',$order_str,$start,$perpage);
  484. //格式化数据
  485. foreach ($info_list as $key=>$value)
  486. {
  487. $ud = $this->fullordertt->read($value['id']);
  488. $ud['address'] = str_replace("'","’",$ud['address']);
  489. $ud['name'] = str_replace("'","’",$ud['name']);
  490. $customer = $this->customertt->get_email($ud['email'],$value['shop']);
  491. $customernum = $this->fullordertt->find_count("email = '".$ud['email']."' and shop = '".$value['shop']."' and extra_status = 0");
  492. preg_match_all('/[0-9]/u',$ud['phone'],$result);
  493. $numphone = join('',$result[0]);
  494. $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']));
  495. $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']));
  496. $hmdaddress3 = str_replace(array(' avenue',' ave',' av'),array(' ave',' avenue',' ave'),strtolower($ud['address']));
  497. if($numphone == '0')
  498. {
  499. $customerb = $this->customertt->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');
  500. }
  501. else
  502. {
  503. $customerb = $this->customertt->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');
  504. }
  505. $customerc = $this->customertt->find_all("type = 1 and shop = '".$ud['shop']."' and address = '".$ud['address']."' and numphone = '".$numphone."'",'*','id desc');
  506. $customerd = $this->customertt->find_all("type = 2 and shop = '".$ud['shop']."' and email = '".$ud['email']."'",'*','id desc');
  507. //$a = array_column($customer, 'email'); //三维找其中健的数组
  508. //$a = array_flip($a); //键和值调换
  509. $djcount = '';
  510. $lkh = $value['sname'];
  511. $djlkh = 0;$djhmd = 0;
  512. if($customer)
  513. {
  514. if($customer['count'] != '' && $customernum < 2)
  515. {
  516. $count = '<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>';
  517. $djcount = $count;
  518. }
  519. if(($customer['type'] == 1 && $customernum > 1))// || $customerc['type'] == 1 && $customerc['num'] > 1
  520. {
  521. $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
  522. $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户(".$customer['num'].")</p>";
  523. $djlkh = 1;
  524. $djcount = $count;
  525. }
  526. else if(isset($customerc[0]['num']))
  527. {
  528. if($customerc[0]['num'] > 1)
  529. {
  530. $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
  531. $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户(".$customer['num'].")</p>";
  532. $djlkh = 1;
  533. $djcount = $count;
  534. }
  535. }
  536. }
  537. if($customerb)
  538. {
  539. $hmsp = $this->shop->read($customerb[0]['shop']);
  540. $count = $customerb[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerb[0]['count'].'"></i>':'';
  541. $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'>".$count."黑名单</p><p style='color:#9900CC' data-id='".$customerb[0]['id']."'>来自".$hmsp['shopname']."</p>";
  542. $djhmd = 1;
  543. if($customerd)
  544. {
  545. if($customerd[0]['num'] > 1)
  546. {
  547. $count = $customerd[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerd[0]['count'].'"></i>':'';
  548. $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";
  549. $djlkh = 1;
  550. $djcount = $count;
  551. $djlkh = 1;
  552. }
  553. }
  554. }
  555. if($djlkh == '1' && $djhmd == '1')
  556. {
  557. $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'><em style='color:#FF3333'>".$djcount."老客户</em> - ".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
  558. }
  559. if($djlkh != '1' && $djhmd != '1' && $djcount)
  560. {
  561. $info_list[$key]['sname'] = $lkh."<p style='color:#FF3333'>".$djcount."</p>";
  562. }
  563. else
  564. {
  565. $info_list[$key]['sname'] = $lkh;
  566. }
  567. // $rginfo_list = $this->returngoods->find_all("email = '".$ud['email']."'");
  568. // if(!empty($rginfo_list))
  569. // {
  570. // $tmp_str = '';
  571. // foreach ($rginfo_list as $k => $v) {
  572. // $tmp_str .= $v['remark'].'<br/>';
  573. // }
  574. // $info_list[$key]['sname'] = $info_list[$key]['sname']."<br/>售后单(".count($rginfo_list).")".'<p style="color:blue"><i class="method fa fa-list-ul" data-t="'.$tmp_str.'"></i><p>';
  575. // }
  576. $shop = $this->shop->read($value['shop']);
  577. $info_list[$key]['shop'] = $shop['shopname'];
  578. //$info_list[$key]['user'] = $shop['shopuser'];
  579. $warehouse = $this->warehouse->read($value['type']);
  580. $warehousetitle = $warehouse['title'];
  581. if($value['type'] != 13){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  582. $info_list[$key]['type'] = $warehousetitle;
  583. $info_list[$key]['phone'] = $value['phone'];
  584. $typeclass = $this->typeclass->read($value['state']);
  585. $info_list[$key]['state'] = "<font style='font-size: 13px;'>".$typeclass['spare']."</font>";
  586. /**
  587. $wl = '';
  588. if($value['exstate'] == '99')
  589. {
  590. $wl = '<font style="color:#ccc">未获取到物流信息</font>';
  591. }
  592. else if($value['exstate'] == '1')
  593. {
  594. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已揽收<font style="display: none">'.$ud['excontent'].'</font></font>';
  595. }
  596. else if($value['exstate'] == '2')
  597. {
  598. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">在途中<font style="display: none">'.$ud['excontent'].'</font></font>';
  599. }
  600. else if($value['exstate'] == '3')
  601. {
  602. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送中<font style="display: none">'.$ud['excontent'].'</font></font>';
  603. }
  604. else if($value['exstate'] == '4')
  605. {
  606. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已签收<font style="display: none">'.$ud['excontent'].'</font></font>';
  607. }
  608. else if($value['exstate'] == '5')
  609. {
  610. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送异常<font style="display: none">'.$ud['excontent'].'</font></font>';
  611. }
  612. $info_list[$key]['exstate'] = $wl.'<br />';
  613. **/
  614. if($ud['source'] == 1) //线下单用订单时间,其他用付款时间
  615. {
  616. $info_list[$key]['dtime'] = '<p style="font-size: 13px;">'.date('Y-m-d',$ud['dtime']).'</p><p style="font-size: 13px;">'.date('H:i:s',$ud['dtime']).'</p>';
  617. }
  618. else
  619. {
  620. $info_list[$key]['dtime'] = '<p style="font-size: 13px;">'.date('Y-m-d',$value['dtime']+$dt).'</p><p style="font-size: 13px;">'.date('H:i:s',$value['dtime']+$dt).'</p>';
  621. }
  622. if($value['review'] == 1)
  623. {
  624. $info_list[$key]['review'] = "<font style='font-size: 13px;'>未送审</font>";
  625. }
  626. else if($value['review'] == 2)
  627. {
  628. $info_list[$key]['review'] = "<font style='color:#555;font-size: 13px;'>待审核</font>";
  629. }
  630. else if($value['review'] == 3)
  631. {
  632. $info_list[$key]['review'] = "<font style='color:#f90f4b;font-size: 13px;'>不通过</font>";
  633. }
  634. else if($value['review'] == 4)
  635. {
  636. $info_list[$key]['review'] = "<font style='font-size: 13px;'>取消重审</font>";
  637. }
  638. else if($value['review'] == 5)
  639. {
  640. $info_list[$key]['review'] = "<font style='color:#2f80f9;font-size: 13px;'>审核通过</font>";
  641. }
  642. else if($value['review'] == 6)
  643. {
  644. $info_list[$key]['review'] = "<font style='color:#2f80f9;font-size: 13px;'>自动通过</font>";
  645. }
  646. if($ud['dlz'] == 1)
  647. {
  648. $dlz = "<p>独立站已更新</p>";
  649. }
  650. else if($ud['dlz'] == 3)
  651. {
  652. $dlz = "<p>不需要更新</p>";
  653. }
  654. else if($ud['dlz'] == 2)
  655. {
  656. $dlz = "<p style='color:#C3C'>独立站更新失败</p>";
  657. }
  658. else
  659. {
  660. $dlz = "";
  661. }
  662. if($value['waybill'] != "")
  663. {
  664. $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz;
  665. if( !empty($value['waybillid'])){
  666. $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz."<p>".$value['waybillid']."</p>";
  667. }
  668. }
  669. if($value['express'] != 0)
  670. {
  671. $express = $this->express->read($value['express']);
  672. $expressservicename = $express['servicename'];
  673. if($value['express'] != 1 && $value['express'] != 63)
  674. {
  675. $expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";
  676. }
  677. else if($value['express'] == 63)
  678. {
  679. $expressservicename = "<font style='color:#a910f8'>".$express['servicename']."</font>";
  680. }
  681. $info_list[$key]['express'] = $expressservicename;
  682. }
  683. else
  684. {
  685. $info_list[$key]['express'] = "无";
  686. }
  687. $x = "";
  688. if($value['libraryconfirm'] == 2 && $value['review'] > 4 && $ud['library'] == 1)
  689. {
  690. $x = "<p class='ckn'><b class='fojz' data-type='1'>禁止发货</b></p>";
  691. }
  692. else if(($value['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1)
  693. {
  694. $x = "<p class='ckn'><b class='fojzof' data-type='6' data-id='".$value['id']."'>允许发货</b></p>";
  695. }
  696. if(($value['review'] > 4) && $ud['print'] == 2)
  697. {
  698. $x = "<p class='ckn'><b class='fojzof' data-type='7' data-id='".$value['id']."'>禁止打印</b></p>";
  699. }
  700. else if($value['review'] >4 && $ud['print'] == 1)
  701. {
  702. $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
  703. }
  704. if($value['waybill'] == "" && $value['review'] > 4)
  705. {
  706. $x .= "<p><b class='kn' data-type='2'>填写运单号</b></p>";
  707. }
  708. else if($value['waybill'] != "" && $value['review'] > 4)
  709. {
  710. $x .= "<p><b class='kn' data-type='2'>修改运单号</b></p>";
  711. }
  712. 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)
  713. {
  714. $x .= "<p><b class='focz' data-type='2' data-id='".$value['id']."'>提交审核</b></p>";
  715. }
  716. $x .= "<p><b class='window' data-h='/customertt/edit/".$customer['id']."' data-t='客户信息 - 修改'>客户信息</b></p>";
  717. $info_list[$key]['black'] = $x;
  718. if($ud['express'] == 83){
  719. $extra_text = json_decode($ud['extra_text'],true);
  720. if(!isset($extra_text['label_info'])){
  721. $info_list[$key]['black'] .= "<p><b style='background-color:#f64b4b' class='create_label' data-id='".$value['id']."'>创建CBT面单</b></p>";
  722. }
  723. }
  724. $tly = "";
  725. if($value['clientremarks'] != "")
  726. {
  727. $tly = "<p style='color:#FF3333'>有客户留言</p>";
  728. }
  729. if($value['review'] > 4 && $usp['vip'] != 1 && ($ud['merge'] == 0 || $ud['merge'] == $ud['id']))
  730. {
  731. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullordertt/readonly/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
  732. }
  733. else if($ud['merge'] == 0 || $ud['merge'] == $ud['id'])
  734. {
  735. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullordertt/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
  736. }
  737. else if($ud['merge'] != 0 && $ud['merge'] != $ud['id'])
  738. {
  739. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullordertt/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."' style='color:#000'><p>".$value['orderinfo']."</p>".$tly."</h9>"."<p>合并订单</p>";
  740. }
  741. if($value['library'] == 1 && $ud['printtype'] == 3)
  742. {
  743. $info_list[$key]['library'] = "不需要";
  744. }
  745. else if($value['library'] == 1 && $ud['printtype'] != 3)
  746. {
  747. $info_list[$key]['library'] = "未出库";
  748. }
  749. else if($value['library'] == 2)
  750. {
  751. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'出库</p>';
  752. }
  753. else if($value['library'] == 3)
  754. {
  755. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['retreattime']).'</p><p>'.date('H:i:s',$ud['retreattime']).'退库</p>';
  756. }
  757. unset($info_list[$key]['waybillid']);
  758. }
  759. $total = $this->fullordertt->find_count($where);
  760. $pagenum = ceil($total/$perpage);
  761. $over = $total-($start+$perpage);
  762. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  763. echo json_encode($rows);exit;
  764. }
  765. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  766. $this->data['wlshop'] = $wlshop;
  767. $this->data['express'] = $this->express->find_all();
  768. $user = $this->user->get_api($_SESSION['api']);
  769. $powerid = $this->power->read($user['power']);
  770. $powertext = explode('|',trim($powerid['excelid'],'|'));
  771. $pid = '';
  772. foreach ($powertext as $v)
  773. {
  774. $pid .= " id = ".$v." or";
  775. }
  776. $fullorderexcel = $this->fullorderexcel->find_all("type = '100006' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板
  777. $this->data['fullorderexcel'] = $fullorderexcel;
  778. $error = $this->fullordertt->find_count("failed !='' and mergeid = 0 and print != 3 and (".rtrim($fgshop,'or').") and dtime > '".(time()-90*24*3600)."'");
  779. $this->data['error'] = $error;
  780. $yc = $this->fullordertt->find_count("library = 2 and state = 214 and (".rtrim($fgshop,'or').")");
  781. $this->data['yc'] = $yc;
  782. $cs_num = $this->fullordererrors->find_count( "plat = 'fullordertt' and error_type = 1 and (".rtrim($fgshop,'or'). " ) and error_time > '".(time()-90*24*3600)."'");
  783. $this->data['cs_num'] = $cs_num;
  784. $this->data['power'] = $vip;
  785. $this->_Template('fullordertt',$this->data);
  786. }
  787. //筛选重复订单
  788. public function _repeat()
  789. {
  790. $user = $this->user->get_api($_SESSION['api']);
  791. if($user)
  792. {
  793. $fgshop = "";$sid = "";
  794. $user = explode('|',trim($user['shop'],'|'));
  795. foreach ($user as $value)
  796. {
  797. $fgshop .= " shop = ".$value." or";
  798. $sid .= " id = ".$value." or";
  799. }
  800. }
  801. $post = $this->input->post(NULL, TRUE);
  802. if(isset($post['page']))
  803. {
  804. $page = $this->input->post('page',true);
  805. $perpage = $this->input->post('perpage',true);
  806. $shop = $this->input->post('shop',true);
  807. $timetk = $this->input->post('timetk',true);
  808. $timetj = $this->input->post('timetj',true);
  809. $timetk = strtotime($timetk);
  810. $timetj = strtotime($timetj);
  811. $where = "print != 999 and state = 207 and review = 1 and number NOT like '%-%-%-%-%' and (".rtrim($fgshop,'or').")";
  812. if($shop)
  813. {
  814. $where .= " and shop = '$shop'";
  815. }
  816. if($timetk && $timetj)
  817. {
  818. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  819. }
  820. //数据排序
  821. $order_str = "id desc";
  822. if(empty($page))
  823. {
  824. $start = 0;
  825. $perpage = 1;
  826. }
  827. else
  828. {
  829. $start = ($page - 1)*$perpage;
  830. }
  831. //取得信息列表
  832. $info_list = $this->fullordertt->find_all($where,'id,shop,orderinfo,number,name,phone,address,state,dtime,shipremarks,type,merge');
  833. $info = array();
  834. $len = count($info_list);
  835. //格式化数据
  836. foreach ($info_list as $key=>$value)
  837. {
  838. $ud = $this->fullordertt->read($value['id']);
  839. $shop = $this->shop->read($value['shop']);
  840. $warehouse = $this->warehouse->read($value['type']);
  841. $info_list[$key]['shop'] = '<p>'.$shop['shopname'].'</p>'.'<p>'.$warehouse['title'].'</p>';
  842. $typeclass = $this->typeclass->read($value['state']);
  843. $info_list[$key]['state'] = $typeclass['spare'];
  844. $info_list[$key]['type'] = $ud['orderremarks'];
  845. $info_list[$key]['dtime'] = '<p>'.date('Y-m-d',$value['dtime']).'</p><p>'.date('H:i:s',$value['dtime']).'</p>';
  846. if($value['merge'] == 0)
  847. {
  848. $info_list[$key]['merge'] = "<p>可合并</p>";
  849. }
  850. else
  851. {
  852. if($value['merge'] == $value['id'])
  853. {
  854. if($ud['print'] < '3' && $ud['library'] == '1')
  855. {
  856. $info_list[$key]['merge'] = "<p><b class='cforder' data-id='".$value['id']."'>拆分订单</b></p>";
  857. }
  858. else
  859. {
  860. $info_list[$key]['merge'] = "已合并";
  861. }
  862. }
  863. else
  864. {
  865. $info_list[$key]['merge'] = "被合并";
  866. }
  867. }
  868. }
  869. /** 操作合并
  870. if($value['merge'] == 0)
  871. {
  872. $info_list[$key]['merge'] = "<p><b class='jd' data-type='5'>合并订单</b></p>";
  873. }
  874. else
  875. {
  876. if($value['merge'] == $value['id'])
  877. {
  878. $info_list[$key]['merge'] = "已合并";
  879. }
  880. else
  881. {
  882. $info_list[$key]['merge'] = "被合并";
  883. }
  884. }
  885. **/
  886. $asd = array();
  887. for($i=0;$i<$len;$i++)
  888. {
  889. for($j=$i+1;$j<$len;$j++)
  890. {
  891. 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']
  892. {
  893. if(!array_key_exists($j,$info))
  894. {
  895. $info[$j] = $info_list[$j];
  896. }
  897. if(!array_key_exists($i,$info))
  898. {
  899. $info[$i] = $info_list[$i];
  900. }
  901. }
  902. }
  903. }
  904. rsort($info);
  905. $total = count($info);
  906. $pagenum = ceil($total/$perpage);
  907. $over = $total-($start+$perpage);
  908. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_slice($info,$start,$perpage)));
  909. echo json_encode($rows);exit;
  910. }
  911. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  912. $this->data['wlshop'] = $wlshop;
  913. $this->_Template('fullordertt_repeat',$this->data);
  914. }
  915. //修改
  916. public function _edit($arg_array)
  917. {
  918. if(isset($_SESSION['api']))
  919. {
  920. $user = $this->user->get_api($_SESSION['api']);
  921. if($user['vip'] == 1)
  922. {
  923. $vip = 1;
  924. $this->data['userid'] = $user['id'];
  925. }
  926. else
  927. {
  928. $vip = 0;
  929. $this->data['userid'] = 0;
  930. }
  931. }
  932. else
  933. {
  934. $this->data['userid'] = 0;
  935. $vip = 0;
  936. }
  937. $post = $this->input->post(NULL, TRUE);
  938. if(isset($post['id']))
  939. {
  940. $id = $this->input->post('id',true);
  941. $data = $this->fullordertt->read($id);
  942. $post['type'] = $this->input->post('warehouse',true);
  943. $post['country'] = $this->input->post('country',true);
  944. $currency = $this->country->read($post['country']);
  945. $post['al'] = $currency['lb'];
  946. $post['freight'] = $this->input->post('freight',true);
  947. $post['expressmoney'] = $this->input->post('expressmoney',true);
  948. $post['shouldmoney'] = $this->input->post('shouldmoney',true);
  949. $orderremarks = $this->input->post('orderremarks');
  950. $orderremarks = str_replace(array('%26','%2B'),array('&','+'),$orderremarks);
  951. $post['orderremarks'] = $orderremarks;
  952. $shipremarks = $this->input->post('shipremarks');
  953. $shipremarks = str_replace(array('%26','%2B'),array('&','+'),$shipremarks);
  954. $post['shipremarks'] = preg_replace('/( | | |\s)/',' ',$shipremarks);
  955. $post['email'] = $this->input->post('email',true);
  956. //$post['paypal'] = $this->input->post('paypal',true);
  957. $name = $this->input->post('name',true);
  958. $post['name'] = str_replace("'","’",$name);
  959. $post['phone'] = $this->input->post('phone',true);
  960. $post['phone'] = preg_replace('/\D/s','',$post['phone']);
  961. $post['country'] = $this->input->post('country',true);
  962. $post['province'] = $this->input->post('province',true);//省、州
  963. $post['province'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['province']); //替换开头空字符
  964. $post['province'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['province']); //替换结尾空字符
  965. $post['city'] = $this->input->post('city',true);//城市
  966. $post['city'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['city']); //替换开头空字符
  967. $post['city'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['city']); //替换结尾空字符
  968. $post['zipcode'] = $this->input->post('zipcode',true);//邮编
  969. $post['zipcode'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['zipcode']); //替换开头空字符
  970. $post['zipcode'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['zipcode']); //替换结尾空字符
  971. $post['street'] = $this->input->post('street',true);
  972. $address = $this->input->post('address',true);
  973. $address = preg_replace('/( | | |\s)/',' ',$address);
  974. $post['address'] = str_replace("'","’",$address);
  975. $address2 = $this->input->post('address2',true);
  976. $address2 = preg_replace('/( | | |\s)/',' ',$address2);
  977. if($address2 == ' ')
  978. {
  979. $address2 = '';
  980. }
  981. $post['address2'] = str_replace("'","’",$address2);
  982. $post['express'] = $this->input->post('express',true);
  983. $post['printtype'] = $this->input->post('printtype',true);
  984. $fpdata = $this->input->post('fpdata');
  985. $fpdata = str_replace(array('%26','%2B'),array('&','+'),$fpdata);
  986. $post['fpdata'] = $fpdata;
  987. $post['waybill'] = $this->input->post('waybill',true);
  988. $post['msg'] = $this->input->post('msg',true);
  989. $post['zsbjz'] = $this->input->post('zsbjz',true);
  990. $post['refundy'] = $this->input->post('refundy',true);
  991. $post['refundj'] = $this->input->post('refundj',true);
  992. $rtime = $this->input->post('rtime',true);
  993. $post['rtime'] = strtotime($rtime);
  994. $post['rpaypal'] = $this->input->post('rpaypal',true);
  995. $post['rtext'] = $this->input->post('rtext',true);
  996. $post['sbpm'] = $this->input->post('sbpm',true);
  997. $post['edittime'] = time();
  998. $editstate = $this->input->post('state',true);
  999. $whlabel = $this->input->post('whlabel',true);
  1000. $fpcount = $this->input->post('fpcount',true);
  1001. $post['ioss'] = $this->input->post('ioss',true);
  1002. $post['waybill'] = preg_replace('/( | | | |\s)/','',$post['waybill']);
  1003. $pay = $this->pay->get_typeclass($data['pay']);
  1004. $yga = $post['shouldmoney'];
  1005. $ygc = $data['estimaterate'];
  1006. $post['budget'] = $this->input->post('newbudget',true);
  1007. //$post['budget'] = $this->input->post('newbudget',true);
  1008. /**
  1009. $post['budget'] = 0;
  1010. $ifbudget = eval("return $yga*1.$ygc;");
  1011. if($ifbudget > 0)
  1012. {
  1013. $post['budget'] = eval("return $yga*1.$ygc;");
  1014. }
  1015. **/
  1016. $whlabeldata = explode('|',trim($whlabel,'|'));$way = 0;
  1017. foreach ($whlabeldata as $va)
  1018. {
  1019. if(stripos($va,'z') !== false)
  1020. {
  1021. $way += 1;
  1022. }
  1023. }
  1024. //如果备注中出现网红的两个字 ,那么在fpdata种的品名中必须有 WH这两个字 且美仓不用
  1025. if($post['type'] !=5 ){
  1026. if(stripos($post['shipremarks'],'网红') !== false){
  1027. if(stripos($post['fpdata'],'-2090-') === false){
  1028. echo json_encode(array('msg'=>'网红单请在商品名称中勾选WH!','success'=>false));exit;
  1029. }
  1030. }
  1031. }
  1032. if((($post['express'] == 2 || $post['express'] == 63 || $post['express'] == 64 || $post['express'] == 81 || $post['express'] == 83) && $post['type'] != 5) || ($post['express'] != 2 && $post['express'] != 63 && $post['express'] != 64 && $post['express'] != 81 && $post['express'] != 83 && $post['type'] == 5))
  1033. {
  1034. echo json_encode(array('msg'=>'此快递方式不可从美仓发货!','success'=>false));exit;
  1035. }
  1036. // if($post['express'] == 42 && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods' && $post['type'] != 34)//$post['express'] == 3 ||
  1037. // {
  1038. // echo json_encode(array('msg'=>'此快递方式必须选择Human Hair Wigs/Human Hair Goods!','success'=>false));exit;
  1039. // }
  1040. //减少代码复用吧
  1041. if($post['type'] != 34){
  1042. $lo_ret = $this->logic_order->checkEditExpress($post);
  1043. if($lo_ret['code'] != 1){
  1044. echo json_encode(array('msg'=>$lo_ret['msg'],'success'=>false));exit;
  1045. }
  1046. }
  1047. if($post['express'] == 24 && $post['sbpm'] != 'Hair Sample' && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods' && $post['type'] != 34)//$post['express'] == 3 ||
  1048. {
  1049. echo json_encode(array('msg'=>'此快递方式必须选择Hair Sample/Human Hair Wigs/Human Hair Goods!','success'=>false));exit;
  1050. }
  1051. if($post['country'] != 192 && $post['express'] == 1 && $post['sbpm'] != 'Synthetic Hair Wigs' && $post['sbpm'] != 'Synthetic Hair Goods' && $post['type'] != 34)//$post['express'] == 3 ||
  1052. {
  1053. echo json_encode(array('msg'=>'非美国选择官方DHL必须选择Synthetic Hair Wigs/Synthetic Hair Goods','success'=>false));exit;
  1054. }
  1055. if($way == count($whlabeldata) && $post['type'] != 12)
  1056. {
  1057. echo json_encode(array('msg'=>'必须选择特殊仓!','success'=>false));exit;
  1058. }
  1059. if($way == '0' && $post['type'] == 12)
  1060. {
  1061. echo json_encode(array('msg'=>'特殊仓必须包含特殊仓货物!','success'=>false));exit;
  1062. }
  1063. $post['review'] = 1;
  1064. if($post['zsbjz'] < '0.01' && $post['type'] != 34)
  1065. {
  1066. echo json_encode(array('msg'=>'总申报价错误!'.$post['type'],'success'=>false));exit;
  1067. }
  1068. if($data['library'] == 1)
  1069. {
  1070. if($data['print'] != 3)
  1071. {
  1072. $post['print'] = 1;
  1073. $post['libraryconfirm'] = 1;
  1074. $post['librarynot'] = "订单未打印,未审核或未通过";
  1075. }
  1076. else
  1077. {
  1078. $post['libraryconfirm'] = 1;
  1079. $post['librarynot'] = "订单被修改或重新提交";
  1080. }
  1081. }
  1082. if($data['yhs'] == 1)
  1083. {
  1084. echo json_encode(array('msg'=>'仓库货物验证中,请稍后再试!','success'=>false));exit;
  1085. }
  1086. if($post['express'] == 2 && (stripos($post['name'],'&') !== false || stripos($post['name'],"'") !== false))
  1087. {
  1088. echo json_encode(array('msg'=>'USPS收件人或公司名不可用特殊符号!','success'=>false));exit;
  1089. }
  1090. if(strlen($post['client']) > 34 || strlen($post['name']) > 34)//收件人姓名或公司名不允许超过35位
  1091. {
  1092. echo json_encode(array('msg'=>'收件人姓名或公司名不可超过34个字符!','success'=>false));exit;
  1093. }
  1094. if($post['express'] == '3' && $post['address2'] != '')//UPS不允许提交地址2
  1095. {
  1096. echo json_encode(array('msg'=>'UPS不允许提交地址2','success'=>false));exit;
  1097. }
  1098. if(($post['express'] == '5' || $post['express'] == '24' || $post['express'] == '42' || $post['express'] == '31') && $post['country'] != 192 && $post['type'] != 34)
  1099. {
  1100. echo json_encode(array('msg'=>'非美国无法选择Fedex、DHL官方-美国!','success'=>false));exit;
  1101. }
  1102. if($post['express'] == '3' && $post['country'] != 192 && $post['country'] != 35)
  1103. {
  1104. echo json_encode(array('msg'=>'非美国和加拿大无法选择UPS!','success'=>false));exit;
  1105. }
  1106. if($post['country'] == 35 && $post['zsbjz'] > 20)
  1107. {
  1108. echo json_encode(array('msg'=>'加拿大最高申报不可超过20','success'=>false));exit;
  1109. }
  1110. if(($post['express'] == '28' || $post['express'] == '7') && $post['country'] != 191)
  1111. {
  1112. echo json_encode(array('msg'=>'非英国无法选择CNE和GES!','success'=>false));exit;
  1113. }
  1114. $express = $this->express->read($post['express']);
  1115. if($express['ioss'] == 1 && $post['ioss'] == '')
  1116. {
  1117. echo json_encode(array('msg'=>'此快递方式必须选择IOSS!','success'=>false));exit;
  1118. }
  1119. if(strlen($post['address']) > $express['addresssize'] || strlen($post['address2']) > $express['addresssize'])
  1120. {
  1121. echo json_encode(array('msg'=>'此快递地址不可超出'.$express['addresssize'].'个字符','success'=>false));exit;
  1122. }
  1123. // 根据禁用处理32长度
  1124. // if(strlen($post['address']) > 32 && ($post['express'] == 2 || $post['express'] == 16))
  1125. // {
  1126. // echo json_encode(array('msg'=>'此快递地址不可超出32个字符','success'=>false));exit;
  1127. // }
  1128. if(strlen($post['address']) < 5)
  1129. {
  1130. echo json_encode(array('msg'=>'地址不可留空!','success'=>false));exit;
  1131. }
  1132. if(($express['sbjz'] > 0) && ($post['zsbjz'] > $express['sbjz']))
  1133. {
  1134. echo json_encode(array('msg'=>'总申报价值不可超出'.$express['sbjz'],'success'=>false));exit;
  1135. }
  1136. if($post['shouldmoney'] > $express['shouldmoney'] && $express['shouldmoney'] != 0)
  1137. {
  1138. echo json_encode(array('msg'=>'订单金额不可超出'.$express['shouldmoney'],'success'=>false));exit;
  1139. }
  1140. if($post['express'] == '2' && $post['zzl'] > '16' && isset($post['js']) && $post['js'] == '0')
  1141. {
  1142. echo json_encode(array('msg'=>'重量大于16不可按Ground Advantage提交!','success'=>false));exit;
  1143. }
  1144. if($post['express'] == '2' && isset($post['js']) && $post['js'] == '0'&& $post['qm'] == '1')
  1145. {
  1146. echo json_encode(array('msg'=>'Ground Advantage不可使用签名服务!','success'=>false));exit;
  1147. }
  1148. if(isset($post['bx']))
  1149. {
  1150. if($post['express'] == '99' && $post['bx'] > 0)
  1151. {
  1152. echo json_encode(array('msg'=>'此物流不允许购买保险','success'=>false));exit;
  1153. }
  1154. }
  1155. if(($post['express'] == '3' || $post['express'] == '42' || $post['express'] == '24') && $post['shouldmoney'] < 1)
  1156. {
  1157. //echo json_encode(array('msg'=>'零金额订单不可发 UPS/DHL官方-美国/Fedex(杭州)','success'=>false));exit;
  1158. }
  1159. if($post['express'] == '42' && $post['zsbjz'] < 1)
  1160. {
  1161. echo json_encode(array('msg'=>'零申报金额不可发 DHL官方-美国','success'=>false));exit;
  1162. }
  1163. if($post['express'] == '6' && $post['province'] == '')
  1164. {
  1165. echo json_encode(array('msg'=>'选择DPEX必须填写州信息','success'=>false));exit;
  1166. }
  1167. if(($post['express'] == '24' || $post['express'] == '3') && $post['shouldmoney'] == 0)
  1168. {
  1169. echo json_encode(array('msg'=>'0金额订单不可发UPS/Fedex(杭州)!!!','success'=>false));exit;
  1170. }
  1171. if($post['country'] == '35' && $post['zsbjz'] > 20)
  1172. {
  1173. echo json_encode(array('msg'=>'加拿大不可申报超过20美金!!!','success'=>false));exit;
  1174. }
  1175. if($post['printtype'] == 1)//如果是运单
  1176. {
  1177. $post['productdescription'] = $this->input->post('productdescription',true);
  1178. $post['customs'] = $this->input->post('customs',true);
  1179. }
  1180. if($post['express'] == 2 && strlen($post['zipcode']) != 5)//如果usps 邮编不是5位
  1181. {
  1182. echo json_encode(array('msg'=>'USPS-USA的邮编需按5位数格式提交!','success'=>false));exit;
  1183. }
  1184. if(strlen($post['phone']) > 11 && $post['express'] == 63)
  1185. {
  1186. echo json_encode(array('msg'=>'美国联邦,电话号码不允许超过11位!','success'=>false));exit;
  1187. }
  1188. /**
  1189. if($post['paypal'] != '')
  1190. {
  1191. $pp = $this->fullordertt->get_paypal($post['paypal']);
  1192. if(isset($pp['number']) && $pp['number'] != $data['number'])
  1193. {
  1194. echo json_encode(array('msg'=>'此交易号的订单已存在!-'.$pp['number'],'success'=>false));exit;
  1195. }
  1196. }
  1197. **/
  1198. /**
  1199. if($editstate == 216 && $data['state'] != 216)
  1200. {
  1201. echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit;
  1202. }
  1203. **/
  1204. if($editstate == 216 && preg_match('/\d/is',$post['waybill']) != true)
  1205. {
  1206. //echo json_encode(array('msg'=>'当前信息不可修改订单状态','success'=>false));exit;
  1207. }
  1208. else
  1209. {
  1210. $post['review'] = $data['review'];
  1211. $post['state'] = $editstate;
  1212. }
  1213. $thisdata = $this->fullordertt->read($id);
  1214. $warehouse = $this->warehouse->read($thisdata['type']);
  1215. $warehousenew = $this->warehouse->read($post['type']);
  1216. if($warehousenew['bdcountry'] != 0 && $post['country'] != $warehousenew['bdcountry'])
  1217. {
  1218. echo json_encode(array('msg'=>'当前国家无法选择'.$warehousenew['title'].'!','success'=>false));exit;
  1219. }
  1220. /**
  1221. if(($warehouse['zd'] == '1' || stripos($thisdata['whlabel'],'z|') !== false) && $thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库
  1222. {
  1223. echo json_encode(array('msg'=>'此单已占用库存并出库,无法更改仓库!','success'=>false));exit;
  1224. }
  1225. **/
  1226. if($thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库
  1227. {
  1228. echo json_encode(array('msg'=>'此单已出库,无法更改仓库!','success'=>false));exit;
  1229. }
  1230. $expt = $this->express->read($post['express']);
  1231. if($expt['pt'] != '' && stripos($post['fpdata'],$expt['pt']) !== false && $post['type'] != 34)
  1232. {
  1233. echo json_encode(array('msg'=>$expt['ptts'],'success'=>false));exit;
  1234. }
  1235. if($expt['province'] != '' && stripos($expt['province'],$post['province'].'、') !== false)
  1236. {
  1237. echo json_encode(array('msg'=>'此省/州不可使用 '.$expt['servicename'],'success'=>false));exit;
  1238. }
  1239. /**
  1240. if($warehouse['zd'] == '1' && $warehouse['ys'] != '1' && $thisdata['library'] == '2' && $post['fpdata'] != $thisdata['fpdata'])
  1241. {
  1242. echo json_encode(array('msg'=>'已扣减库存,无法更改产品!','success'=>false));exit;
  1243. }
  1244. **/
  1245. //开始注释 xyxg
  1246. /**
  1247. $ft = array();
  1248. $ftdata = explode('|',rtrim($fpcount,'|'));
  1249. foreach ($ftdata as $va)
  1250. {
  1251. $ftitle = '';
  1252. $va = explode('-',trim($va,'-'));
  1253. foreach ($va as $v)
  1254. {
  1255. $v = $this->typeclass->read($v);
  1256. $ftitle .= $v['title'].' ';
  1257. }
  1258. $ft[] = rtrim($ftitle,' ');
  1259. }
  1260. if($data['library'] == 1)
  1261. {
  1262. $tqkcyz = $this->_kcyz($post['type'],$whlabel,$id,$data['shop'],$data['number']);
  1263. if(isset($tqkcyz[0]))
  1264. {
  1265. echo json_encode(array('t'=>2,'msg'=>"红色商品名库存匹配错误或库存不够扣减",'error'=>$tqkcyz,'success'=>false));exit;
  1266. }
  1267. if(stripos($whlabel,'z|') !== false || stripos($thisdata['whlabel'],'z|') !== false)
  1268. {
  1269. $tskcyz = $this->specialstock->get_kc($thisdata['state'],$post['state'],$whlabel,$thisdata['whlabel'],$thisdata['number']);
  1270. if($tskcyz['t'] > '0')
  1271. {
  1272. echo $tskcyz['m'];exit;
  1273. }
  1274. }
  1275. $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']);//旧状态、新状态、仓库占单设置、仓库预设设置、新仓库、新产品简化数字、旧产品数字、旧产品名称、订单号、订单店铺、旧订单仓库、旧产品简化数字
  1276. if($kcyz['t'] > '0')
  1277. {
  1278. echo $kcyz['m'];exit;
  1279. }
  1280. }
  1281. //结束注释
  1282. **/
  1283. /** 重新写产品名称
  1284. $dtctitle = array();
  1285. $dictionaries = $this->typeclass->find_all();
  1286. foreach ($dictionaries as $v)
  1287. {
  1288. $dtctitle[$v['id']] = array($v['title'],$v['bqsku']);
  1289. }
  1290. if(stripos($fpdata,'-128-') !== false || stripos($fpdata,'-127-') !== false)
  1291. {
  1292. $dfp = explode(';',trim($fpdata,';'));
  1293. $fdata = '';
  1294. foreach ($dfp as $k=>$v)
  1295. {
  1296. $ptitleb = '';
  1297. $fp = explode('|',trim($v,'|'));
  1298. $fp0 = explode(',',$fp[0]);
  1299. $fp1 = explode('-',trim($fp0[1],'-'));
  1300. foreach ($fp1 as $vv)
  1301. {
  1302. $ptitleb .= isset($dtctitle[$vv])?$dtctitle[$vv][0].' ':'';
  1303. }
  1304. $ptitleb .= $dtctitle[$fp0[0]][1].'inch ';
  1305. $fp[1] = $ptitleb;
  1306. $fdata .= implode("|",$fp).";";
  1307. }
  1308. $fpdata = $fdata;
  1309. }
  1310. **/
  1311. $warehouse = $this->warehouse->read($post['type']);
  1312. if($data['library'] == 1 || ($data['library'] != 2 && ($post['state'] != '207' || $post['state'] == '209')))
  1313. {
  1314. $kcyz = $this->ck->get_kc($post['state'],$warehouse,$thisdata['shop'],$thisdata['number'],$whlabel,$fpdata);
  1315. if($kcyz['t'] > '0')
  1316. {
  1317. echo $kcyz['m'];exit;
  1318. }
  1319. else if($kcyz['fpdata'] != '')
  1320. {
  1321. $post['whlabel'] = $kcyz['whlabel'];
  1322. $post['fpdata'] = $kcyz['fpdata'];
  1323. }
  1324. }
  1325. $fl = $this->ck->get_fl($warehouse['hz'],$whlabel,$fpdata);
  1326. $post['sfxh'] = $fl['sfxh'];
  1327. $post['ckfl'] = $fl['ckfl'];
  1328. //查询净重开始
  1329. $post['jweight'] = $this->weight->get_weightcx($post['fpdata']);
  1330. //查询净重结束
  1331. if($this->fullordertt->save($post,$id))
  1332. {
  1333. if($data['printtime'] == '0')
  1334. {
  1335. $xghz = ',将自动禁止打印';
  1336. }
  1337. else if($data['printtime'] > '0' && $data['librarytime'] == '0')
  1338. {
  1339. $q = '';
  1340. if($data['libraryconfirm'] == 1)
  1341. {
  1342. $q = ',<em style="color: #F00;">改前状态为:禁止出库</em>';
  1343. }
  1344. $xghz = ',将自动禁止发货'.$q;
  1345. }
  1346. else
  1347. {
  1348. $xghz = '';
  1349. }
  1350. echo json_encode(array('msg'=>'修改成功'.$xghz,'id'=>$id,'success'=>true));exit;
  1351. }
  1352. else
  1353. {
  1354. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  1355. }
  1356. }
  1357. $this->data['vip'] = $vip;
  1358. $arg_array = $arg_array[0];$fpdata = array();
  1359. $fullordertt = $this->fullordertt->read($arg_array);
  1360. $returngoods = $this->returngoods->get_orderinfo($fullordertt['orderinfo']);
  1361. $this->data['returngoods'] = $returngoods?1:0;
  1362. $fullordertt['parameter'] = str_replace(",","---",$fullordertt['parameter']);
  1363. $country = $this->country->find_all('1=1','id,name','name asc');//所有国家信息
  1364. $express = $this->express->find_all('1=1');//所有快递配置信息
  1365. $this->data['fullordertt'] = $fullordertt;
  1366. if($fullordertt['express'] == 2)
  1367. {
  1368. $zzhl = 'oz';
  1369. }
  1370. else
  1371. {
  1372. $zzhl = 'kg';
  1373. }
  1374. $this->data['zzhl'] = $zzhl;
  1375. $this->data['country'] = $country;
  1376. $this->data['express'] = $express;
  1377. $this->data['dtime'] = date('Y-m-d H:i:s',$fullordertt['dtime']);
  1378. $warehouse = $this->warehouse->read($fullordertt['type']);
  1379. if(stripos($fullordertt['fpdata'],';') !== false)
  1380. {
  1381. $fpdata = explode(';',rtrim($fullordertt['fpdata'],';'));
  1382. foreach ($fpdata as $k=>$v)
  1383. {
  1384. $xxv = explode('|',$v);
  1385. if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)
  1386. {
  1387. $xxv['zd'] = "<p>已占单</p>";
  1388. $bdck = $warehouse['bdck'];
  1389. if(stripos($xxv[9],'~') !== false)
  1390. {
  1391. $dxxv = explode('~',trim($xxv[9],'~'));
  1392. foreach ($dxxv as $val)
  1393. {
  1394. $wzid = $this->$bdck->read(trim($val,$warehouse['hz']));
  1395. if($wzid['details'] != '')
  1396. {
  1397. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  1398. }
  1399. }
  1400. }
  1401. else
  1402. {
  1403. $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));
  1404. if($wzid['details'] != '')
  1405. {
  1406. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  1407. }
  1408. }
  1409. }
  1410. $fpdata[$k] = $xxv;
  1411. }
  1412. }
  1413. $this->data['fpdata'] = $fpdata;
  1414. $thfpdataxs = array();
  1415. if($fullordertt['thfpdata'] != '')
  1416. {
  1417. $thfpdata = explode(';',trim($fullordertt['thfpdata'],';'));
  1418. foreach ($thfpdata as $k=>$v)
  1419. {
  1420. $thxs = explode('~',trim($v,'~'));
  1421. $thxs[0] = explode('|',trim($thxs[0],'|'));
  1422. $thxs[1] = explode('|',trim($thxs[1],'|'));
  1423. $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]);
  1424. }
  1425. }
  1426. $this->data['thfpdata'] = $thfpdataxs;
  1427. $shop = $this->shop->read($fullordertt['shop']);
  1428. $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
  1429. $is = 0;
  1430. if($shop['type'] == 269)//判断是否独立站,269是独立站
  1431. {
  1432. $is = 1;
  1433. }
  1434. $this->data['is'] = $is;
  1435. if(isset($_SESSION['api']))
  1436. {
  1437. $user = $this->user->get_api($_SESSION['api']);
  1438. if($user['vip'] == 1)
  1439. {
  1440. $vip = 1;
  1441. }
  1442. else
  1443. {
  1444. $vip = 0;
  1445. }
  1446. }
  1447. else
  1448. {
  1449. $vip = 0;
  1450. }
  1451. $this->data['power'] = $vip;
  1452. /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
  1453. $downwaybill = '';$dwls = array();
  1454. $oldwaybill = explode('-',ltrim($fullordertt['oldwaybill'],'-'));
  1455. if(isset($oldwaybill[0][1]))
  1456. {
  1457. $oldwaybill = array_reverse($oldwaybill); //调整顺序
  1458. foreach ($oldwaybill as $v)
  1459. {
  1460. $dw = explode('/',$v);
  1461. if(isset($dw[1]))
  1462. {
  1463. if(stripos($downwaybill,$dw[1]) === false)
  1464. {
  1465. $dwls[$dw[1]] = 1;
  1466. $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
  1467. }
  1468. }
  1469. }
  1470. }
  1471. if($fullordertt['printtype'] == 1)
  1472. {
  1473. if($fullordertt['waybill'] != '' && !isset($dwls[$fullordertt['waybill']]))
  1474. {
  1475. $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullordertt['printtime']).'/y-'.$fullordertt['waybill'].'.pdf" target="_blank">'.$fullordertt['waybill'].'</a>、'.$downwaybill;
  1476. }
  1477. }
  1478. $this->data['downwaybill'] = rtrim($downwaybill,'、');
  1479. /** 历史打印时间 **/
  1480. $printtime = '';
  1481. if($fullordertt['oldprinttime'])
  1482. {
  1483. $pte = explode('-',rtrim($fullordertt['oldprinttime'],'-'));
  1484. foreach ($pte as $v)
  1485. {
  1486. $printtime .= date('Y-m-d H:i:s',$v).'、';
  1487. }
  1488. }
  1489. $this->data['printtime'] = rtrim($printtime,'、');
  1490. $product = '';
  1491. $fullordertt['product'] = str_replace("'","",$fullordertt['product']);
  1492. if($fullordertt['link'] != '' && $fullordertt['source'] != '1')
  1493. {
  1494. $pt = explode(',',$fullordertt['product']);
  1495. $lk = explode(',',$fullordertt['link']);
  1496. for($i=0;$i<count($pt);$i++)
  1497. {
  1498. if(isset($lk[$i]))
  1499. {
  1500. $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);
  1501. }
  1502. else
  1503. {
  1504. $octs = '';
  1505. }
  1506. $a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];
  1507. //$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];
  1508. if(isset($lk[$i]))
  1509. {
  1510. $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';
  1511. }
  1512. else
  1513. {
  1514. $product .= ($product != '')?' , '.$a:$a;
  1515. }
  1516. }
  1517. }
  1518. else
  1519. {
  1520. $octs = $this->colourorderts->get_text($fullordertt['product']);
  1521. $a = $octs?'<font style="color:#F39">'.$fullordertt['product'].'</font>':$fullordertt['product'];
  1522. //$a = (stripos($fullordertt['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullordertt['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullordertt['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullordertt['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullordertt['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullordertt['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullordertt['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullordertt['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullordertt['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullordertt['product'].'</font>':$fullordertt['product'];
  1523. $product = $a;
  1524. }
  1525. $this->data['product'] = $product;
  1526. $out = $this->systemtransfer->find_all("number = '".$fullordertt['number']."'");
  1527. $outread = '';
  1528. if($out)
  1529. {
  1530. foreach ($out as $val)
  1531. {
  1532. $list = '';
  1533. $rk = explode('|',trim($val['rk'],'|'));
  1534. $rktime = explode('|',trim($val['rktime'],'|'));
  1535. $zw = array();
  1536. $t = $this->transfer->find_all("1=1");
  1537. foreach ($t as $v)
  1538. {
  1539. $zw[$v['id']] = $v['title'];
  1540. }
  1541. if($val['rk'] != '' && count($rk) > 0)
  1542. {
  1543. for($i=0;$i<count($rk);$i++)
  1544. {
  1545. if(!isset($rktime[$i]))
  1546. {
  1547. $list .= $zw[$cz[$i]];
  1548. }
  1549. else
  1550. {
  1551. $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';
  1552. }
  1553. }
  1554. }
  1555. //$outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';
  1556. $outread .= '<span style="color:#f00">'.$val['shipremarks'].'</span>:'.$list.'<br>';
  1557. }
  1558. }
  1559. else
  1560. {
  1561. $systemwigsout = $this->systemwigsout->find_all("number = '".$fullordertt['number']."'");
  1562. $outread = array();
  1563. if($systemwigsout)
  1564. {
  1565. foreach ($systemwigsout as $v)
  1566. {
  1567. if($v['czwarehouse'] == 37)
  1568. {
  1569. $outread[] = '华荣厂';
  1570. }
  1571. else if($v['czwarehouse'] == 0)
  1572. {
  1573. $outread[] = '龙盈厂';
  1574. }
  1575. $cz = explode('|',trim($v['cz'],'|'));
  1576. $cztime = explode('|',trim($v['cztime'],'|'));
  1577. $zw = $this->transfer->get_list();
  1578. if($v['cz'] != '' && count($cz) > 0)
  1579. {
  1580. for($i=0;$i<count($cz);$i++)
  1581. {
  1582. if(!isset($cztime[$i]))
  1583. {
  1584. $outread[] = $zw[$cz[$i]].' -&gt; ';
  1585. }
  1586. else
  1587. {
  1588. $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -&gt; ';
  1589. }
  1590. }
  1591. $outread[] = '<br>';
  1592. }
  1593. }
  1594. }
  1595. }
  1596. $klarnacolor = '';
  1597. if($fullordertt['klarnadata'] !='')
  1598. {
  1599. $klarnadata = explode('|',$fullordertt['klarnadata']);
  1600. if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')
  1601. {
  1602. $klarnadata[1] = json_decode($klarnadata[1],true);
  1603. if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullordertt['shouldmoney'] && $fullordertt['pay'] == 1211)
  1604. {
  1605. $klarnacolor = 'style="color:#F00"';
  1606. }
  1607. }
  1608. else if($klarnadata[0]!=1 && $fullordertt['pay']!=26 && $fullordertt['pay']!=27 && $fullordertt['pay']!=1211)
  1609. {
  1610. $klarnacolor = 'style="color:#F00"';
  1611. }
  1612. if($fullordertt['pay'] == 23)//klarna
  1613. {
  1614. $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');
  1615. $ToState = array_flip($ToState);
  1616. $klarnadata3 = str_replace(' ','',$klarnadata[3]);
  1617. $city = str_replace(' ','',$fullordertt['city']);
  1618. $klarnadataaddress = explode($city,$klarnadata3);
  1619. if(isset($klarnadataaddress[1]))
  1620. {
  1621. $klarnadata3 = $city.$klarnadataaddress[1];
  1622. $klarnadatacolor = explode(',',$klarnadata3);
  1623. unset($klarnadatacolor[4]);
  1624. unset($klarnadatacolor[6]);
  1625. if(isset($ToState[$klarnadatacolor[1]]))
  1626. {
  1627. $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);
  1628. }
  1629. $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);
  1630. }
  1631. else
  1632. {
  1633. $klarnadata['color'] = $klarnadata3;
  1634. }
  1635. }
  1636. }
  1637. else
  1638. {
  1639. $klarnadata = '';
  1640. }
  1641. $p = explode('-',$fullordertt['paypal']);
  1642. $this->data['klarnacolor'] = $klarnacolor;
  1643. $this->data['klarnadata'] = $klarnadata;
  1644. $this->data['systemwigsout'] = $outread;
  1645. $quantity = explode(';',trim($fullordertt['quantity'],';'));
  1646. $qc = 0;
  1647. foreach ($quantity as $v)
  1648. {
  1649. if($v > 1)
  1650. {
  1651. $qc += 1;
  1652. }
  1653. }
  1654. $this->data['qc'] = $qc;
  1655. $this->_Template('fullordertt_edit',$this->data);
  1656. }
  1657. //不可修改
  1658. public function _readonly($arg_array)
  1659. {
  1660. $post = $this->input->post(NULL, TRUE);
  1661. if(isset($post['id']))
  1662. {
  1663. $id = $this->input->post('id',true);
  1664. $ud = $this->fullordertt->read($id);
  1665. $post['type'] = $this->input->post('warehouse',true);
  1666. $post['orderremarks'] = $this->input->post('orderremarks',true);
  1667. $post['state'] = $this->input->post('state',true);
  1668. $post['msg'] = $this->input->post('msg',true);
  1669. $post['refundy'] = $this->input->post('refundy',true);
  1670. $post['refundj'] = $this->input->post('refundj',true);
  1671. $fpdata = $this->input->post('fpdata');
  1672. $fpdata = str_replace(array('%26','%2B'),array('&','+'),$fpdata);
  1673. $post['fpdata'] = $fpdata;
  1674. $rtime = $this->input->post('rtime',true);
  1675. $post['rtime'] = strtotime($rtime);
  1676. $post['rpaypal'] = $this->input->post('rpaypal',true);
  1677. $post['rtext'] = $this->input->post('rtext',true);
  1678. $post['express'] = $this->input->post('express',true);
  1679. $whlabel = $this->input->post('whlabel',true);
  1680. $post['budget'] = $this->input->post('newbudget',true);
  1681. //$post['ioss'] = $this->input->post('ioss',true);
  1682. $post['edittime'] = time();
  1683. $editstate = $post['state'];
  1684. /**
  1685. if($post['state'] == 216 && $ud['state'] != 216)
  1686. {
  1687. echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit;
  1688. }
  1689. **/
  1690. $whlabeldata = explode('|',trim($whlabel,'|'));$way = 0;
  1691. foreach ($whlabeldata as $va)
  1692. {
  1693. if(stripos($va,'z') !== false)
  1694. {
  1695. $way += 1;
  1696. }
  1697. }
  1698. if((($post['express'] == 2 || $post['express'] == 63 || $post['express'] == 64 || $post['express'] == 81) && $post['type'] != 5) || ($post['express'] != 2 && $post['express'] != 63 && $post['express'] != 64 && $post['express'] != 81 && $post['type'] == 5))
  1699. {
  1700. echo json_encode(array('msg'=>'此快递方式必须选择美国仓!','success'=>false));exit;
  1701. }
  1702. if($way == count($whlabeldata) && $post['type'] != 12)
  1703. {
  1704. echo json_encode(array('msg'=>'必须选择特殊仓!','success'=>false));exit;
  1705. }
  1706. if($way == '0' && $post['type'] == 12)
  1707. {
  1708. echo json_encode(array('msg'=>'特殊仓必须包含特殊仓货物!','success'=>false));exit;
  1709. }
  1710. $fpcount = $this->input->post('fpcount',true);
  1711. if(!$fpcount)
  1712. {
  1713. echo json_encode(array('msg'=>'需要先清理浏览器缓存,刷新当前页面后再试!','success'=>false));exit;
  1714. }
  1715. if($ud['library'] == 1)
  1716. {
  1717. if($ud['print'] != 3)
  1718. {
  1719. $post['print'] = 1;
  1720. $post['libraryconfirm'] = 1;
  1721. $post['librarynot'] = "订单未打印,未审核或未通过";
  1722. }
  1723. else
  1724. {
  1725. $post['libraryconfirm'] = 1;
  1726. $post['librarynot'] = "订单被重新提交";
  1727. }
  1728. }
  1729. if(($post['express'] == '5' || $post['express'] == '24' || $post['express'] == '42' || $post['express'] == '31') && $ud['country'] != 192)
  1730. {
  1731. echo json_encode(array('msg'=>'非美国无法选择Fedex、DHL官方-美国!','success'=>false));exit;
  1732. }
  1733. if($post['express'] == '3' && $ud['country'] != 192 && $ud['country'] != 35)
  1734. {
  1735. echo json_encode(array('msg'=>'非美国和加拿大无法选择UPS!','success'=>false));exit;
  1736. }
  1737. if(($post['express'] == '28' || $post['express'] == '7') && $ud['country'] != 191)
  1738. {
  1739. echo json_encode(array('msg'=>'非英国无法选择CNE和GES!','success'=>false));exit;
  1740. }
  1741. if($post['type'] != 5 && in_array($post['express'],[2,63,64,81,83]))
  1742. {
  1743. echo json_encode(array('msg'=>"此快递方式必须从美仓发货!",'success'=>false));exit;
  1744. }
  1745. if($post['type'] == 5 && !in_array($post['express'],[2,63,64,81,83]))
  1746. {
  1747. echo json_encode(array('msg'=>"此快递方式不能美仓发货!",'success'=>false));exit;
  1748. }
  1749. $express = $this->express->read($post['express']);
  1750. /**
  1751. if($express['ioss'] == 1 && $post['ioss'] == '')
  1752. {
  1753. echo json_encode(array('msg'=>'此快递方式必须选择IOSS!','success'=>false));exit;
  1754. }
  1755. **/
  1756. $thisdata = $this->fullordertt->read($id);
  1757. $warehouse = $this->warehouse->read($thisdata['type']);
  1758. $warehousenew = $this->warehouse->read($post['type']);
  1759. if(($warehouse['zd'] == '1' || stripos($thisdata['whlabel'],'z|') !== false) && $thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库
  1760. {
  1761. echo json_encode(array('msg'=>'此单已占用库存并出库,无法更改仓库!','success'=>false));exit;
  1762. }
  1763. if($ud['yhs'] == 1)
  1764. {
  1765. echo json_encode(array('msg'=>'仓库货物验证中,请稍后再试!','success'=>false));exit;
  1766. }
  1767. $expt = $this->express->read($post['express']);
  1768. if($expt['pt'] != '' && stripos($post['fpdata'],$expt['pt']) !== false)
  1769. {
  1770. echo json_encode(array('msg'=>$expt['ptts'],'success'=>false));exit;
  1771. }
  1772. if($expt['province'] != '' && stripos($expt['province'],$ud['province'].'、') !== false)
  1773. {
  1774. echo json_encode(array('msg'=>'此省/州不可使用 '.$expt['servicename'],'success'=>false));exit;
  1775. }
  1776. /**
  1777. if($warehouse['zd'] == '1' && $warehouse['ys'] != '1' && $thisdata['library'] == '2' && $post['fpdata'] != $thisdata['fpdata'])
  1778. {
  1779. echo json_encode(array('msg'=>'已扣减库存,无法更改产品!','success'=>false));exit;
  1780. }
  1781. **/
  1782. /**
  1783. if($warehousenew['zd'] == '1' && $editstate != $thisdata['state'] && $thisdata['library'] == '1')//如果提交的仓库开启库存模式并且更改订单状态并且未出库,那么拒绝
  1784. {
  1785. echo json_encode(array('msg'=>'如需更改订单状态,请先把仓库选择为非开启库存模式仓库或等待订单出库!','success'=>false));exit;
  1786. }
  1787. if($warehousenew['zd'] == '1' && $editstate != '207' && $thisdata['library'] == '1')//如果提交的仓库开启库存模式并且更改订单状态并且未出库,那么拒绝
  1788. {
  1789. echo json_encode(array('msg'=>'非待发货状态,不允许修改为开启库存模式仓库','success'=>false));exit;
  1790. }
  1791. **/
  1792. //开始注释 xyxg
  1793. /**
  1794. $ft = array();
  1795. $ftdata = explode('|',rtrim($fpcount,'|'));
  1796. foreach ($ftdata as $va)
  1797. {
  1798. $ftitle = '';
  1799. $va = explode('-',trim($va,'-'));
  1800. foreach ($va as $v)
  1801. {
  1802. $v = $this->typeclass->read($v);
  1803. $ftitle .= $v['title'].' ';
  1804. }
  1805. $ft[] = rtrim($ftitle,' ');
  1806. }
  1807. $user = $this->user->get_api($_SESSION['api']);
  1808. if($ud['library'] == 1)
  1809. {
  1810. $tqkcyz = $this->_kcyz($post['type'],$whlabel,$id,$ud['shop'],$ud['number']);
  1811. if(isset($tqkcyz[0]))
  1812. {
  1813. echo json_encode(array('t'=>2,'msg'=>"红色商品名库存匹配错误或库存不够扣减",'error'=>$tqkcyz,'success'=>false));exit;
  1814. }
  1815. if(stripos($whlabel,'z|') !== false || stripos($thisdata['whlabel'],'z|') !== false)
  1816. {
  1817. $tskcyz = $this->specialstock->get_kc($thisdata['state'],$post['state'],$whlabel,$thisdata['whlabel'],$thisdata['number']);
  1818. if($tskcyz['t'] > '0')
  1819. {
  1820. echo $tskcyz['m'];exit;
  1821. }
  1822. }
  1823. $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']);//旧状态、新状态、仓库占单设置、仓库预设设置、新仓库、新产品简化数字、旧产品数字、旧产品名称、订单号、订单店铺、旧订单仓库、旧产品简化数字
  1824. if($kcyz['t'] > '0')
  1825. {
  1826. echo $kcyz['m'];exit;
  1827. }
  1828. }
  1829. //结束注释
  1830. **/
  1831. $warehouse = $this->warehouse->read($post['type']);
  1832. if($ud['library'] == 1 || ($ud['library'] != 2 && ($post['state'] != '207' || $post['state'] == '209')))
  1833. {
  1834. $kcyz = $this->ck->get_kc($post['state'],$warehouse,$thisdata['shop'],$thisdata['number'],$whlabel,$fpdata);
  1835. if($kcyz['t'] > '0')
  1836. {
  1837. echo $kcyz['m'];exit;
  1838. }
  1839. else if($kcyz['fpdata'] != '')
  1840. {
  1841. $post['whlabel'] = $kcyz['whlabel'];
  1842. $post['fpdata'] = $kcyz['fpdata'];
  1843. }
  1844. }
  1845. $fl = $this->ck->get_fl($warehouse['hz'],$whlabel,$fpdata);
  1846. $post['sfxh'] = $fl['sfxh'];
  1847. $post['ckfl'] = $fl['ckfl'];
  1848. //查询净重开始
  1849. $post['jweight'] = $this->weight->get_weightcx($post['fpdata']);
  1850. //查询净重结束
  1851. if($this->fullordertt->save($post,$id))
  1852. {
  1853. if($ud['printtime'] == '0')
  1854. {
  1855. $xghz = ',将自动禁止打印';
  1856. }
  1857. else if($ud['printtime'] > '0' && $ud['librarytime'] == '0')
  1858. {
  1859. $q = '';
  1860. if($ud['libraryconfirm'] == 1)
  1861. {
  1862. $q = ',<em style="color: #F00;">改前状态为:禁止出库</em>';
  1863. }
  1864. $xghz = ',将自动禁止发货'.$q;
  1865. }
  1866. else
  1867. {
  1868. $xghz = '';
  1869. }
  1870. echo json_encode(array('msg'=>'修改成功'.$xghz,'id'=>$id,'success'=>true));exit;
  1871. }
  1872. else
  1873. {
  1874. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  1875. }
  1876. }
  1877. $arg_array = $arg_array[0];$fpdata = array();
  1878. $fullordertt = $this->fullordertt->read($arg_array);
  1879. $returngoods = $this->returngoods->get_orderinfo($fullordertt['orderinfo']);
  1880. $this->data['returngoods'] = $returngoods?1:0;
  1881. $fullordertt['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$fullordertt['shipremarks']);
  1882. $fullordertt['parameter'] = str_replace(",","---",$fullordertt['parameter']);
  1883. $this->data['fullordertt'] = $fullordertt;
  1884. if($fullordertt['express'] == 2)
  1885. {
  1886. $zzhl = 'oz';
  1887. }
  1888. else
  1889. {
  1890. $zzhl = 'kg';
  1891. }
  1892. $this->data['zzhl'] = $zzhl;
  1893. $this->data['countrys'] = $this->country->find_all();
  1894. $this->data['express'] = $this->express->find_all();
  1895. $warehouse = $this->warehouse->read($fullordertt['type']);
  1896. if(stripos($fullordertt['fpdata'],';') !== false)
  1897. {
  1898. $fpdata = explode(';',rtrim($fullordertt['fpdata'],';'));
  1899. foreach ($fpdata as $k=>$v)
  1900. {
  1901. $xxv = explode('|',$v);
  1902. if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)
  1903. {
  1904. $xxv['zd'] = "<p>已占单</p>";
  1905. $bdck = $warehouse['bdck'];
  1906. if(stripos($xxv[9],'~') !== false)
  1907. {
  1908. $dxxv = explode('~',trim($xxv[9],'~'));
  1909. foreach ($dxxv as $val)
  1910. {
  1911. $wzid = $this->$bdck->read(trim($val,$warehouse['hz']));
  1912. if($wzid['details'] != '')
  1913. {
  1914. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  1915. }
  1916. }
  1917. }
  1918. else
  1919. {
  1920. $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));
  1921. if($wzid['details'] != '')
  1922. {
  1923. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  1924. }
  1925. }
  1926. }
  1927. $fpdata[$k] = $xxv;
  1928. }
  1929. }
  1930. $this->data['fpdata'] = $fpdata;
  1931. $this->data['fpdata'] = $fpdata;
  1932. $thfpdataxs = array();
  1933. if($fullordertt['thfpdata'] != '')
  1934. {
  1935. $thfpdata = explode(';',trim($fullordertt['thfpdata'],';'));
  1936. foreach ($thfpdata as $k=>$v)
  1937. {
  1938. $thxs = explode('~',trim($v,'~'));
  1939. $thxs[0] = explode('|',trim($thxs[0],'|'));
  1940. $thxs[1] = explode('|',trim($thxs[1],'|'));
  1941. $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]);
  1942. }
  1943. }
  1944. $this->data['thfpdata'] = $thfpdataxs;
  1945. $shop = $this->shop->read($fullordertt['shop']);
  1946. $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
  1947. $is = 0;
  1948. if($shop['type'] == 269)//判断是否独立站,269是独立站
  1949. {
  1950. $is = 1;
  1951. }
  1952. $this->data['is'] = $is;
  1953. //单项开始
  1954. $warehouse = $this->warehouse->read($fullordertt['warehouse']);//发货仓库
  1955. $state = $this->typeclass->read($fullordertt['state']);//订单状态
  1956. $country = $this->country->read($fullordertt['country']);//国家
  1957. if($fullordertt['capital'] == 1)
  1958. {
  1959. $capital = '暂未支付';
  1960. }
  1961. else if($fullordertt['capital'] == 2)
  1962. {
  1963. $capital = '部分支付';
  1964. }
  1965. else if($fullordertt['capital'] == 3)
  1966. {
  1967. $capital = '全部支付';
  1968. }
  1969. if($fullordertt['printtype'] == 1)
  1970. {
  1971. $printtype = '运单';
  1972. }
  1973. else if($fullordertt['printtype'] == 2)
  1974. {
  1975. $printtype = '发货单';
  1976. }
  1977. else if($fullordertt['printtype'] == 3)
  1978. {
  1979. $printtype = '不打印单据';
  1980. }
  1981. else
  1982. {
  1983. $printtype = '未选择';
  1984. }
  1985. $this->data['warehouse'] = $warehouse['title'];
  1986. $this->data['state'] = $state['title'];
  1987. $this->data['capital'] = $capital;
  1988. $this->data['country'] = $country['name'];
  1989. $this->data['printtype'] = $printtype;
  1990. //单项结束
  1991. /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
  1992. $downwaybill = '';$dwls = array();
  1993. $oldwaybill = explode('-',ltrim($fullordertt['oldwaybill'],'-'));
  1994. if(isset($oldwaybill[0][1]))
  1995. {
  1996. $oldwaybill = array_reverse($oldwaybill); //调整顺序
  1997. foreach ($oldwaybill as $v)
  1998. {
  1999. $dw = explode('/',$v);
  2000. if(isset($dw[1]))
  2001. {
  2002. if(stripos($downwaybill,$dw[1]) === false)
  2003. {
  2004. $dwls[$dw[1]] = 1;
  2005. $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
  2006. }
  2007. }
  2008. }
  2009. }
  2010. if($fullordertt['printtype'] == 1)
  2011. {
  2012. if($fullordertt['waybill'] != '' && !isset($dwls[$fullordertt['waybill']]))
  2013. {
  2014. $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullordertt['printtime']).'/y-'.$fullordertt['waybill'].'.pdf" target="_blank">'.$fullordertt['waybill'].'</a>、'.$downwaybill;
  2015. }
  2016. }
  2017. $this->data['downwaybill'] = rtrim($downwaybill,'、');
  2018. /** 历史打印时间 **/
  2019. $printtime = '';
  2020. if($fullordertt['oldprinttime'])
  2021. {
  2022. $pte = explode('-',rtrim($fullordertt['oldprinttime'],'-'));
  2023. foreach ($pte as $v)
  2024. {
  2025. if(is_numeric($v) && $v > 0)
  2026. {
  2027. $printtime .= date('Y-m-d H:i:s',$v).'、';
  2028. }
  2029. }
  2030. }
  2031. $this->data['printtime'] = rtrim($printtime,'、');
  2032. $product = '';
  2033. $fullordertt['product'] = str_replace("'","",$fullordertt['product']);
  2034. if($fullordertt['link'] != '' && $fullordertt['source'] != '1')
  2035. {
  2036. $pt = explode(',',$fullordertt['product']);
  2037. $lk = explode(',',$fullordertt['link']);
  2038. for($i=0;$i<count($pt);$i++)
  2039. {
  2040. if(isset($lk[$i]))
  2041. {
  2042. $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);
  2043. }
  2044. else
  2045. {
  2046. $octs = '';
  2047. }
  2048. $a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];
  2049. //$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];
  2050. if(isset($lk[$i]))
  2051. {
  2052. $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';
  2053. }
  2054. else
  2055. {
  2056. $product .= ($product != '')?' , '.$a:$a;
  2057. }
  2058. }
  2059. }
  2060. else
  2061. {
  2062. $octs = $this->colourorderts->get_text($fullordertt['product']);
  2063. $a = $octs?'<font style="color:#F39">'.$fullordertt['product'].'</font>':$fullordertt['product'];
  2064. //$a = (stripos($fullordertt['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullordertt['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullordertt['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullordertt['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullordertt['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullordertt['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullordertt['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullordertt['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullordertt['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullordertt['product'].'</font>':$fullordertt['product'];
  2065. $product = $a;
  2066. }
  2067. $this->data['product'] = $product;
  2068. $out = $this->systemtransfer->find_all("number = '".$fullordertt['number']."'");
  2069. $outread = '';
  2070. if($out)
  2071. {
  2072. foreach ($out as $val)
  2073. {
  2074. $list = '';
  2075. $rk = explode('|',trim($val['rk'],'|'));
  2076. $rktime = explode('|',trim($val['rktime'],'|'));
  2077. $zw = array();
  2078. $t = $this->transfer->find_all("1=1");
  2079. foreach ($t as $v)
  2080. {
  2081. $zw[$v['id']] = $v['title'];
  2082. }
  2083. if($val['rk'] != '' && count($rk) > 0)
  2084. {
  2085. for($i=0;$i<count($rk);$i++)
  2086. {
  2087. if(!isset($rktime[$i]))
  2088. {
  2089. $list .= $zw[$cz[$i]];
  2090. }
  2091. else
  2092. {
  2093. $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';
  2094. }
  2095. }
  2096. }
  2097. $outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';
  2098. }
  2099. }
  2100. else
  2101. {
  2102. $systemwigsout = $this->systemwigsout->find_all("number = '".$fullordertt['number']."'");
  2103. $outread = array();
  2104. if($systemwigsout)
  2105. {
  2106. foreach ($systemwigsout as $v)
  2107. {
  2108. if($v['czwarehouse'] == 37)
  2109. {
  2110. $outread[] = '华荣厂';
  2111. }
  2112. else if($v['czwarehouse'] == 0)
  2113. {
  2114. $outread[] = '龙盈厂';
  2115. }
  2116. $cz = explode('|',trim($v['cz'],'|'));
  2117. $cztime = explode('|',trim($v['cztime'],'|'));
  2118. $zw = $this->transfer->get_list();
  2119. if($v['cz'] != '' && count($cz) > 0)
  2120. {
  2121. for($i=0;$i<count($cz);$i++)
  2122. {
  2123. if(!isset($cztime[$i]))
  2124. {
  2125. $outread[] = $zw[$cz[$i]].' -&gt; ';
  2126. }
  2127. else
  2128. {
  2129. $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -&gt; ';
  2130. }
  2131. }
  2132. $outread[] = '<br>';
  2133. }
  2134. }
  2135. }
  2136. }
  2137. $klarnacolor = '';
  2138. if($fullordertt['klarnadata'] !='')
  2139. {
  2140. $klarnadata = explode('|',$fullordertt['klarnadata']);
  2141. if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')
  2142. {
  2143. $klarnadata[1] = json_decode($klarnadata[1],true);
  2144. if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullordertt['shouldmoney'] && $fullordertt['pay'] == 1211)
  2145. {
  2146. $klarnacolor = 'style="color:#F00"';
  2147. }
  2148. }
  2149. else if($klarnadata[0]!=1 && $fullordertt['pay']!=26 && $fullordertt['pay']!=27 && $fullordertt['pay']!=1211)
  2150. {
  2151. $klarnacolor = 'style="color:#F00"';
  2152. }
  2153. if($fullordertt['pay'] == 23)//klarna
  2154. {
  2155. $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');
  2156. $ToState = array_flip($ToState);
  2157. $klarnadata3 = str_replace(' ','',$klarnadata[3]);
  2158. $city = str_replace(' ','',$fullordertt['city']);
  2159. $klarnadataaddress = explode($city,$klarnadata3);
  2160. if(isset($klarnadataaddress[1]))
  2161. {
  2162. $klarnadata3 = $city.$klarnadataaddress[1];
  2163. $klarnadatacolor = explode(',',$klarnadata3);
  2164. unset($klarnadatacolor[4]);
  2165. unset($klarnadatacolor[6]);
  2166. if(isset($ToState[$klarnadatacolor[1]]))
  2167. {
  2168. $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);
  2169. }
  2170. $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);
  2171. }
  2172. else
  2173. {
  2174. $klarnadata['color'] = $klarnadata3;
  2175. }
  2176. }
  2177. }
  2178. else
  2179. {
  2180. $klarnadata = '';
  2181. }
  2182. $p = explode('-',$fullordertt['paypal']);
  2183. $this->data['klarnacolor'] = $klarnacolor;
  2184. $this->data['klarnadata'] = $klarnadata;
  2185. $this->data['systemwigsout'] = $outread;
  2186. $quantity = explode(';',trim($fullordertt['quantity'],';'));
  2187. $qc = 0;
  2188. foreach ($quantity as $v)
  2189. {
  2190. if($v > 1)
  2191. {
  2192. $qc += 1;
  2193. }
  2194. }
  2195. $this->data['qc'] = $qc;
  2196. $this->_Template('fullordertt_readonly',$this->data);
  2197. }
  2198. //浏览列表
  2199. public function _readlist()
  2200. {
  2201. if(isset($_SESSION['api']))
  2202. {
  2203. $user = $this->user->get_api($_SESSION['api']);
  2204. $usp = $user;
  2205. $fgshop = "";$sid = "";
  2206. $usersp = explode('|',trim($user['shop'],'|'));
  2207. foreach ($usersp as $value)
  2208. {
  2209. $fgshop .= " shop = ".$value." or";
  2210. $sid .= " id = ".$value." or";
  2211. }
  2212. }
  2213. $post = $this->input->post(NULL, TRUE);
  2214. if(isset($post['page']))
  2215. {
  2216. $page = $this->input->post('page',true);
  2217. $perpage = $this->input->post('perpage',true);
  2218. $shop = $this->input->post('shop',true);
  2219. $warehouse = $this->input->post('warehouse',true);
  2220. $express = $this->input->post('express',true);
  2221. $state = $this->input->post('state',true);
  2222. $print = $this->input->post('print',true);
  2223. $libraryconfirm = $this->input->post('libraryconfirm',true);
  2224. $orderinfo = $this->input->post('orderinfo',true);
  2225. $client = $this->input->post('name',true);
  2226. $email = $this->input->post('email',true);
  2227. $number = $this->input->post('number',true);
  2228. $waybill = $this->input->post('waybill',true);
  2229. $authorid = $this->input->post('authorid',true);
  2230. $sourcecontentid = $this->input->post('sourcecontentid',true);
  2231. $timetk = $this->input->post('timetk',true);
  2232. $timetj = $this->input->post('timetj',true);
  2233. $timetk = strtotime($timetk);
  2234. $timetj = strtotime($timetj);
  2235. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  2236. if($shop)
  2237. {
  2238. $where .= " and shop = '$shop'";
  2239. }
  2240. if($warehouse)
  2241. {
  2242. $where .= " and type = '$warehouse'";
  2243. }
  2244. if($express)
  2245. {
  2246. $where .= " and express = '$express'";
  2247. }
  2248. if($state)
  2249. {
  2250. $where .= " and state = '$state'";
  2251. }
  2252. if($print)
  2253. {
  2254. $where .= " and print = '$print'";
  2255. }
  2256. if($libraryconfirm)
  2257. {
  2258. $where .= " and libraryconfirm = '$libraryconfirm'";
  2259. }
  2260. if($orderinfo)
  2261. {
  2262. $where .= " and orderinfo = '$orderinfo'";
  2263. }
  2264. if($client)
  2265. {
  2266. $where .= " and client like '%$client%'";
  2267. }
  2268. if($email)
  2269. {
  2270. $where .= " and email = '$email'";
  2271. }
  2272. if($number)
  2273. {
  2274. $where .= " and number = '$number'";
  2275. }
  2276. if($waybill)
  2277. {
  2278. $where .= " and waybill = '$waybill'";
  2279. }
  2280. if($authorid)
  2281. {
  2282. $where .= " and authorid = '$authorid'";
  2283. }
  2284. if($sourcecontentid)
  2285. {
  2286. $where .= " and sourcecontentid = '$sourcecontentid'";
  2287. }
  2288. if($timetk && $timetj)
  2289. {
  2290. $timetj = $timetj+24*3600;
  2291. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  2292. }
  2293. //数据排序
  2294. $order_str = "dtime desc";
  2295. if(empty($page))
  2296. {
  2297. $start = 0;
  2298. $perpage = 1;
  2299. }
  2300. else
  2301. {
  2302. $start = ($page - 1)*$perpage;
  2303. }
  2304. //取得信息列表
  2305. $info_list = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,sname,state,dtime,review,libraryconfirm,express,waybill,exstate,orderremarks,library,clientremarks,waybillid',$order_str,$start,$perpage);
  2306. //格式化数据
  2307. $dt = 0;
  2308. foreach ($info_list as $key=>$value)
  2309. {
  2310. $ud = $this->fullordertt->read($value['id']);
  2311. $ud['address'] = str_replace("'","’",$ud['address']);
  2312. $ud['name'] = str_replace("'","’",$ud['name']);
  2313. $customer = $this->customertt->get_email($ud['email'],$value['shop']);
  2314. $customernum = $this->fullordertt->find_count("email = '".$ud['email']."' and shop = '".$value['shop']."'");
  2315. preg_match_all('/[0-9]/u',$ud['phone'],$result);
  2316. $numphone = join('',$result[0]);
  2317. $customerb = $this->customertt->find_all("type = 2 and (email = '".$ud['email']."' or address = '".$ud['address']."' or numphone = '".$numphone."')",'*','id desc');
  2318. $customerc = $this->customertt->find_all("type = 1 and shop = '".$ud['shop']."' and address = '".$ud['address']."' and numphone = '".$numphone."'",'*','id desc');
  2319. //$a = array_column($customer, 'email'); //三维找其中健的数组
  2320. //$a = array_flip($a); //键和值调换
  2321. $lkh = $value['sname'];
  2322. $djlkh = 0;$djhmd = 0;
  2323. if($customer)
  2324. {
  2325. if(($customer['type'] == 1 && $customernum > 1))// || $customerc['type'] == 1 && $customerc['num'] > 1
  2326. {
  2327. $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
  2328. $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";
  2329. $djlkh = 1;
  2330. $djcount = $count;
  2331. }
  2332. else if(isset($customerc[0]['num']))
  2333. {
  2334. if($customerc[0]['num'] > 1)
  2335. {
  2336. $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
  2337. $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";
  2338. $djlkh = 1;
  2339. $djcount = $count;
  2340. }
  2341. }
  2342. }
  2343. if($customerb)
  2344. {
  2345. $hmsp = $this->shop->read($customerb[0]['shop']);
  2346. $count = $customerb[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerb[0]['count'].'"></i>':'';
  2347. $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'>".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
  2348. $djhmd = 1;
  2349. }
  2350. if($djlkh == '1' && $djhmd == '1')
  2351. {
  2352. $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'><em style='color:#FF3333'>".$djcount."老客户</em> - ".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
  2353. }
  2354. $info_list[$key]['sname'] = $lkh;
  2355. $shop = $this->shop->read($value['shop']);
  2356. $info_list[$key]['shop'] = $shop['shopname'];
  2357. //$info_list[$key]['user'] = $shop['shopuser'];
  2358. $warehouse = $this->warehouse->read($value['type']);
  2359. $warehousetitle = $warehouse['title'];
  2360. if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  2361. $info_list[$key]['type'] = $warehousetitle;
  2362. $typeclass = $this->typeclass->read($value['state']);
  2363. $info_list[$key]['state'] = $typeclass['spare'];
  2364. $wl = '';
  2365. if($value['exstate'] == '99')
  2366. {
  2367. $wl = '<font style="color:#ccc">未获取到物流信息</font>';
  2368. }
  2369. else if($value['exstate'] == '1')
  2370. {
  2371. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已揽收<font style="display: none">'.$ud['excontent'].'</font></font>';
  2372. }
  2373. else if($value['exstate'] == '2')
  2374. {
  2375. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">在途中<font style="display: none">'.$ud['excontent'].'</font></font>';
  2376. }
  2377. else if($value['exstate'] == '3')
  2378. {
  2379. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送中<font style="display: none">'.$ud['excontent'].'</font></font>';
  2380. }
  2381. else if($value['exstate'] == '4')
  2382. {
  2383. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已签收<font style="display: none">'.$ud['excontent'].'</font></font>';
  2384. }
  2385. else if($value['exstate'] == '5')
  2386. {
  2387. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送异常<font style="display: none">'.$ud['excontent'].'</font></font>';
  2388. }
  2389. $info_list[$key]['exstate'] = $wl.'<br />';
  2390. if($ud['source'] == 1) //线下单用订单时间,其他用付款时间
  2391. {
  2392. $info_list[$key]['dtime'] = '<p>'.date('Y-m-d',$ud['dtime']).'</p><p>'.date('H:i:s',$ud['dtime']).'</p>';
  2393. }
  2394. else
  2395. {
  2396. $info_list[$key]['dtime'] = '<p>'.date('Y-m-d',$value['dtime']+$dt).'</p><p>'.date('H:i:s',$value['dtime']+$dt).'</p>';
  2397. }
  2398. if($value['review'] == 1)
  2399. {
  2400. $info_list[$key]['review'] = "未送审";
  2401. }
  2402. else if($value['review'] == 2)
  2403. {
  2404. $info_list[$key]['review'] = "<font style='color:#555'>待审核</font>";
  2405. }
  2406. else if($value['review'] == 3)
  2407. {
  2408. $info_list[$key]['review'] = "<font style='color:#f90f4b'>不通过</font>";
  2409. }
  2410. else if($value['review'] == 4)
  2411. {
  2412. $info_list[$key]['review'] = "取消重审";
  2413. }
  2414. else if($value['review'] == 5)
  2415. {
  2416. $info_list[$key]['review'] = "<font style='color:#2f80f9'>审核通过</font>";
  2417. }
  2418. else if($value['review'] == 6)
  2419. {
  2420. $info_list[$key]['review'] = "<font style='color:#2f80f9'>自动通过</font>";
  2421. }
  2422. if($ud['dlz'] == 1)
  2423. {
  2424. $dlz = "<p>独立站已更新</p>";
  2425. }
  2426. else if($ud['dlz'] == 3)
  2427. {
  2428. $dlz = "<p>不需要更新</p>";
  2429. }
  2430. else if($ud['dlz'] == 2)
  2431. {
  2432. $dlz = "<p style='color:#C3C'>独立站更新失败</p>";
  2433. }
  2434. else
  2435. {
  2436. $dlz = "";
  2437. }
  2438. if($value['waybill'] != "")
  2439. {
  2440. $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz;
  2441. if( !empty($value['waybillid'])){
  2442. $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz."<p>".$value['waybillid']."</p>";
  2443. }
  2444. }
  2445. if($value['express'] != 0)
  2446. {
  2447. $express = $this->express->read($value['express']);
  2448. $expressservicename = $express['servicename'];
  2449. if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
  2450. $info_list[$key]['express'] = $expressservicename;
  2451. }
  2452. else
  2453. {
  2454. $info_list[$key]['express'] = "无";
  2455. }
  2456. $tly = "";
  2457. if($value['clientremarks'] != "")
  2458. {
  2459. $tly = "<p style='color:#FF3333'>有客户留言</p>";
  2460. }
  2461. if($value['library'] == 1 && $ud['printtype'] == 3)
  2462. {
  2463. $info_list[$key]['library'] = "不需要";
  2464. }
  2465. else if($value['library'] == 1 && $ud['printtype'] != 3)
  2466. {
  2467. $info_list[$key]['library'] = "未出库";
  2468. }
  2469. else if($value['library'] == 2)
  2470. {
  2471. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'出库</p>';
  2472. }
  2473. else if($value['library'] == 3)
  2474. {
  2475. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['retreattime']).'</p><p>'.date('H:i:s',$ud['retreattime']).'退库</p>';
  2476. }
  2477. if($ud['authorid'] != '' && $ud['authorid'] != 0)
  2478. {
  2479. $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>';
  2480. }
  2481. unset($info_list[$key]['waybillid']);
  2482. }
  2483. $total = $this->fullordertt->find_count($where);
  2484. $pagenum = ceil($total/$perpage);
  2485. $over = $total-($start+$perpage);
  2486. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  2487. echo json_encode($rows);exit;
  2488. }
  2489. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  2490. $this->data['wlshop'] = $wlshop;
  2491. $this->_Template('fullordertt_readlist',$this->data);
  2492. }
  2493. public function _readlistdown()
  2494. {
  2495. if(isset($_SESSION['api']))
  2496. {
  2497. $user = $this->user->get_api($_SESSION['api']);
  2498. $usp = $user;
  2499. $fgshop = "";$sid = "";
  2500. $usersp = explode('|',trim($user['shop'],'|'));
  2501. foreach ($usersp as $value)
  2502. {
  2503. $fgshop .= " shop = ".$value." or";
  2504. $sid .= " id = ".$value." or";
  2505. }
  2506. }
  2507. $post = $this->input->get(NULL, TRUE);
  2508. if(isset($post['excel']))
  2509. {
  2510. $shop = $this->input->get('shop',true);
  2511. $warehouse = $this->input->get('warehouse',true);
  2512. $express = $this->input->get('express',true);
  2513. $state = $this->input->get('state',true);
  2514. $print = $this->input->get('print',true);
  2515. $libraryconfirm = $this->input->get('libraryconfirm',true);
  2516. $orderinfo = $this->input->get('orderinfo',true);
  2517. $client = $this->input->get('name',true);
  2518. $email = $this->input->get('email',true);
  2519. $number = $this->input->get('number',true);
  2520. $waybill = $this->input->get('waybill',true);
  2521. $authorid = $this->input->get('authorid',true);
  2522. $sourcecontentid = $this->input->get('sourcecontentid',true);
  2523. $timetk = $this->input->get('timetk',true);
  2524. $timetj = $this->input->get('timetj',true);
  2525. $timetk = strtotime($timetk);
  2526. $timetj = strtotime($timetj);
  2527. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  2528. if($shop)
  2529. {
  2530. $where .= " and shop = '$shop'";
  2531. }
  2532. if($warehouse)
  2533. {
  2534. $where .= " and type = '$warehouse'";
  2535. }
  2536. if($express)
  2537. {
  2538. $where .= " and express = '$express'";
  2539. }
  2540. if($state)
  2541. {
  2542. $where .= " and state = '$state'";
  2543. }
  2544. if($print)
  2545. {
  2546. $where .= " and print = '$print'";
  2547. }
  2548. if($libraryconfirm)
  2549. {
  2550. $where .= " and libraryconfirm = '$libraryconfirm'";
  2551. }
  2552. if($orderinfo)
  2553. {
  2554. $where .= " and orderinfo = '$orderinfo'";
  2555. }
  2556. if($client)
  2557. {
  2558. $where .= " and client like '%$client%'";
  2559. }
  2560. if($email)
  2561. {
  2562. $where .= " and email = '$email'";
  2563. }
  2564. if($number)
  2565. {
  2566. $where .= " and number = '$number'";
  2567. }
  2568. if($waybill)
  2569. {
  2570. $where .= " and waybill = '$waybill'";
  2571. }
  2572. if($authorid)
  2573. {
  2574. $where .= " and authorid = '$authorid'";
  2575. }
  2576. if($sourcecontentid)
  2577. {
  2578. $where .= " and sourcecontentid = '$sourcecontentid'";
  2579. }
  2580. if($timetk && $timetj)
  2581. {
  2582. $timetj = $timetj+24*3600;
  2583. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  2584. }
  2585. //数据排序
  2586. $order_str = "dtime desc";
  2587. //取得信息列表
  2588. $info_list = $this->fullordertt->find_all($where,'shop,number,orderinfo,dtime,name,express,waybill,email,shipremarks,shouldmoney,orderremarks,librarytime,authorid,sourcecontentid',$order_str);
  2589. //格式化数据
  2590. $dt = 0;
  2591. foreach ($info_list as $key=>$value)
  2592. {
  2593. $shop = $this->shop->read($value['shop']);
  2594. $info_list[$key]['shop'] = $shop['shopname'];
  2595. $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);
  2596. if($value['librarytime'] > 0)
  2597. {
  2598. $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);
  2599. }
  2600. if($value['express'] != 0)
  2601. {
  2602. $express = $this->express->read($value['express']);
  2603. $info_list[$key]['express'] = $express['servicename'];
  2604. }
  2605. else
  2606. {
  2607. $info_list[$key]['express'] = "无";
  2608. }
  2609. }
  2610. $title = "订单列表 ".date("Y-m-d");
  2611. $titlename = "<table border=1>
  2612. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  2613. <tr>
  2614. <td>店铺</td>
  2615. <td>编号</td>
  2616. <td>订单号</td>
  2617. <td>订单日期</td>
  2618. <td>客户姓名</td>
  2619. <td>快递方式</td>
  2620. <td>运单号</td>
  2621. <td>邮箱</td>
  2622. <td>仓库品名</td>
  2623. <td>订单金额</td>
  2624. <td>订单备注</td>
  2625. <td>出库时间</td>
  2626. <td>author_id</td>
  2627. <td>source_content_id</td>
  2628. </tr>
  2629. </table>";
  2630. $filename = $title.".xls";
  2631. $tail = "\n";
  2632. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  2633. }
  2634. }
  2635. //删除
  2636. public function _del()
  2637. {
  2638. $post = $this->input->post(NULL, TRUE);
  2639. if(isset($post['s']))
  2640. {
  2641. $id_arr = $this->input->post('s');
  2642. $id_arr = explode(',',$id_arr);
  2643. if(!$id_arr)
  2644. {
  2645. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  2646. }
  2647. //循环删除记录
  2648. foreach ($id_arr as $v)
  2649. {
  2650. $this->fullordertt->remove($v);
  2651. }
  2652. echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
  2653. }
  2654. }
  2655. //查找商品价格
  2656. public function _price()
  2657. {
  2658. $post = $this->input->post(NULL, TRUE);
  2659. if(isset($post['data']))
  2660. {
  2661. $data = $this->input->post('data');
  2662. $data = explode('-',$data);
  2663. $number = '';$num = count($data);
  2664. //循环删除记录
  2665. for($i=0;$i<$num-1;$i++)
  2666. {
  2667. if($data[$i] != 0)
  2668. {
  2669. $number=$number.$data[$i];
  2670. if($i == 2)
  2671. {
  2672. $number=$number.$data[$num-1];
  2673. }
  2674. }
  2675. }
  2676. $list = $this->productdescribe->get_number($number);
  2677. if($list)
  2678. {
  2679. echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));
  2680. }
  2681. else
  2682. {
  2683. $list = array('purchase'=>0,'cost'=>0,'salesprice'=>0);
  2684. //echo json_encode(array('msg'=>'此信息没有配置价格!','n'=>$data[$num-1],'success'=>false));exit;
  2685. echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));exit;
  2686. }
  2687. }
  2688. }
  2689. public function _customs()
  2690. {
  2691. $post = $this->input->post(NULL, TRUE);
  2692. if(isset($post['e']))
  2693. {
  2694. $e = $this->input->post('e');//快递信息
  2695. $c = $this->input->post('c');//国家信息
  2696. $data = $this->customs->find_all('express = "'.$e.'" and country = "'.$c.'"');
  2697. $list = $this->productdescription->find_all('express = "'.$e.'" and country = "'.$c.'"');
  2698. $rows = array();
  2699. foreach ($data as $key=>$value)
  2700. {
  2701. $detailed = explode('|',trim($value['detailed'],'|'));
  2702. //此处未对比重量选择价值,暂直接选择第一条海关价值
  2703. $detailed = $this->detailed->read($detailed[0]);
  2704. $money = $detailed['customsval'];//找到海关价值
  2705. }
  2706. foreach ($list as $key=>$value)
  2707. {
  2708. $description = $this->typeclass->read($value['description']);
  2709. $list[$key]['title'] = $description['title'];//产品描述名称
  2710. }
  2711. if(!$data && !$list)
  2712. {
  2713. echo json_encode(array('msg'=>'无此快递配置信息!','success'=>false));exit;
  2714. }
  2715. else
  2716. {
  2717. //$list-title -description 取值
  2718. echo json_encode(array('money'=>sprintf("%.2f",$money),'msg'=>$list,'success'=>true));
  2719. }
  2720. }
  2721. }
  2722. public function _express()
  2723. {
  2724. $post = $this->input->post(NULL, TRUE);
  2725. if(isset($post['e']))
  2726. {
  2727. $e = $this->input->post('e');//快递信息
  2728. $c = $this->input->post('c');//国家信息
  2729. $data = $this->logistics->find_all('express = "'.$e.'" and country = "'.$c.'"');
  2730. if(!$data)
  2731. {
  2732. echo json_encode(array('success'=>false));exit;
  2733. }
  2734. else
  2735. {
  2736. echo json_encode(array('money'=>sprintf("%.2f",$data[0]['firstmoney']),'success'=>true));
  2737. }
  2738. }
  2739. }
  2740. public function _hl()
  2741. {
  2742. $post = $this->input->post(NULL, TRUE);
  2743. if(isset($post['cy']))
  2744. {
  2745. $hl = 0;
  2746. $cy = $this->input->post('cy');//币种ID
  2747. $cy = $this->typeclass->read($cy);
  2748. $gethl = $this->hl->get_hl();
  2749. foreach ($gethl as $v)
  2750. {
  2751. $code = str_replace(" ","",$v['code']);
  2752. if($code == $cy['title'])
  2753. {
  2754. $hl = $v['refePrice']/100;
  2755. }
  2756. }
  2757. echo json_encode(array('msg'=>$hl,'success'=>true));
  2758. }
  2759. }
  2760. public function _operation()
  2761. {
  2762. $post = $this->input->post(NULL, TRUE);
  2763. if(isset($post['type']))
  2764. {
  2765. $type = $this->input->post('type');
  2766. $id = $this->input->post('id');
  2767. $msg = $this->input->post('msg');
  2768. if($type == 1)//禁止发货
  2769. {
  2770. $d = $this->fullordertt->read($id);
  2771. if($d['library'] != 1)
  2772. {
  2773. echo json_encode(array('msg'=>'操作失败,订单非未出库状态!','success'=>false));exit;
  2774. }
  2775. if($msg == "")
  2776. {
  2777. echo json_encode(array('msg'=>'必须填写禁止原因!','success'=>false));exit;
  2778. }
  2779. if($d['print'] < 3)
  2780. {
  2781. $a = "订单未打印,";
  2782. }
  2783. else
  2784. {
  2785. $a = "";
  2786. }
  2787. if($this->fullordertt->save(array('libraryconfirm'=>1,'librarynot'=>$a.$msg),$id))
  2788. {
  2789. echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit;
  2790. }
  2791. else
  2792. {
  2793. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2794. }
  2795. }
  2796. if($type == 6)//允许发货
  2797. {
  2798. $d = $this->fullordertt->read($id);
  2799. if($d['library'] > 1)
  2800. {
  2801. echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;
  2802. }
  2803. if($d['print'] < 3)
  2804. {
  2805. $a = "订单未打印,";
  2806. }
  2807. else
  2808. {
  2809. $a = "";
  2810. }
  2811. if($this->fullordertt->save(array('libraryconfirm'=>2,'librarynot'=>$a.$msg),$id))
  2812. {
  2813. echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit;
  2814. }
  2815. else
  2816. {
  2817. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2818. }
  2819. }
  2820. if($type == 7)//禁止打印
  2821. {
  2822. $d = $this->fullordertt->read($id);
  2823. if($d['printtime'] != 0)
  2824. {
  2825. echo json_encode(array('msg'=>'订单已打印,操作失败','success'=>false));exit;
  2826. }
  2827. if($d['library'] > 1)
  2828. {
  2829. echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;
  2830. }
  2831. if($d['print'] < 3)
  2832. {
  2833. $a = "订单未打印,";
  2834. }
  2835. else
  2836. {
  2837. $a = "";
  2838. }
  2839. if($this->fullordertt->save(array('print'=>1),$id))
  2840. {
  2841. echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
  2842. }
  2843. else
  2844. {
  2845. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2846. }
  2847. }
  2848. if($type == 8)//允许打印
  2849. {
  2850. $d = $this->fullordertt->read($id);
  2851. /**
  2852. if($d['printtime'] != 0)
  2853. {
  2854. echo json_encode(array('msg'=>'订单已打印,操作失败','success'=>false));exit;
  2855. }
  2856. **/
  2857. if($d['library'] > 1)
  2858. {
  2859. echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;
  2860. }
  2861. if($d['print'] < 3)
  2862. {
  2863. $a = "订单未打印,";
  2864. }
  2865. else
  2866. {
  2867. $a = "";
  2868. }
  2869. if($d['printtime'] == '0')
  2870. {
  2871. $bcprint = 2;
  2872. }
  2873. else
  2874. {
  2875. $bcprint = 3;
  2876. }
  2877. if($this->fullordertt->save(array('print'=>$bcprint,'failed'=>''),$id))
  2878. {
  2879. echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
  2880. }
  2881. else
  2882. {
  2883. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2884. }
  2885. }
  2886. if($type == 9)//关闭
  2887. {
  2888. if($this->fullordertt->save(array('failed'=>''),$id))
  2889. {
  2890. echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
  2891. }
  2892. else
  2893. {
  2894. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2895. }
  2896. }
  2897. if($type == 2)//填写运单、修改运单
  2898. {
  2899. $d = $this->fullordertt->read($id);
  2900. if($d['express'] == 0)
  2901. {
  2902. echo json_encode(array('msg'=>'操作失败,未选择物流方式!','success'=>false));exit;
  2903. }
  2904. if($d['library'] == 3 || ($d['print'] == 3 && $d['libraryconfirm'] == 1))
  2905. {
  2906. echo json_encode(array('msg'=>'操作失败,不允许填写运单号!','success'=>false));exit;
  2907. }
  2908. $xg = $this->fullordertt->read($id);
  2909. $shop = $this->shop->read($xg['shop']);
  2910. $ex = $this->express->read($xg['express']);
  2911. $fs = $this->notice->get_ordertatus(216);//216成功状态
  2912. if($xg['source'] != 1)
  2913. {
  2914. //独立站地址更新订单状态、物流信息
  2915. $gx = $this->api->get_gx(substr($xg['orderinfo'],1),$msg,$xg,$shop,$ex,$xg['msg'],$xg['shopify']);
  2916. }
  2917. else if($xg['source'] == 1)
  2918. {
  2919. $gx['res'] = 3;
  2920. $gx['state'] = 216;
  2921. }
  2922. if(!isset($gx['res']))
  2923. {
  2924. $gx['res'] = 2;
  2925. $gx['state'] = $xg['state'];
  2926. }
  2927. if($gx['res'] > 0 && $fs)
  2928. {
  2929. $warehouse = $this->warehouse->read($xg['type']);
  2930. $ck = $this->_email($fs['content'],$xg,$warehouse['company']);
  2931. }
  2932. $msg = preg_replace('/( | | | |\s)/','',$msg);
  2933. if($this->fullordertt->save(array('waybill'=>$msg,'state'=>$gx['state'],'dlz'=>$gx['res']),$id))
  2934. {
  2935. echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
  2936. }
  2937. else
  2938. {
  2939. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2940. }
  2941. }
  2942. }
  2943. }
  2944. public function _merge()
  2945. {
  2946. $post = $this->input->post(NULL, TRUE);
  2947. if(isset($post['s']))
  2948. {
  2949. $id_arr = $this->input->post('s');
  2950. $id_arr = explode(',',trim( $id_arr,','));
  2951. $id_arr = array_reverse($id_arr);
  2952. if(!$id_arr)
  2953. {
  2954. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  2955. }
  2956. if(count($id_arr) < 2)
  2957. {
  2958. echo json_encode(array('msg'=>'缺少可合并单!','success'=>false));exit;
  2959. }
  2960. $tmp_list = $this->db->from('fullordertt')->where_in('id',$id_arr)->select('id,orderinfo,number,type,express')->get()->result_array();
  2961. $count_warehouse_list = [];
  2962. $count_express_list = [];
  2963. $flag = 0;
  2964. $flag_str = '';
  2965. foreach ($tmp_list as $k => $v) {
  2966. $count_warehouse_list[$v['type']] = $v['type'];
  2967. if(empty($v['express'])){
  2968. $flag = 1;
  2969. $flag_str.= $v['number'].'仓库未选,请先选快递;';
  2970. }
  2971. $count_express_list[$v['express']] = $v['express'];
  2972. }
  2973. if($flag == 1){
  2974. echo json_encode(array('msg'=>$flag_str,'success'=>false));exit;
  2975. }
  2976. if(count($count_warehouse_list) > 1){
  2977. echo json_encode(array('msg'=>'合并单的仓库不一致,无法合并!','success'=>false));exit;
  2978. }
  2979. if(count($count_express_list) > 1){
  2980. echo json_encode(array('msg'=>'合并单的快递不一致,无法合并!','success'=>false));exit;
  2981. }
  2982. $post = array();
  2983. $u = $this->fullordertt->read($id_arr[0]);
  2984. unset($id_arr[0]);
  2985. $this->db->trans_begin();
  2986. $hd = $this->fullordertthb->get_orderinfo($u['orderinfo']);
  2987. if(!$hd)
  2988. {
  2989. $this->fullordertthb->insert($u);
  2990. }
  2991. //相加
  2992. $post['shouldmoney'] = $u['shouldmoney'];//购买应收金额
  2993. $post['budget'] = $u['budget'];//预估到帐金额
  2994. $post['expressmoney']= $u['expressmoney'];//物流金额
  2995. //$post['refundy'] = $u['refundy'];//补/退原额
  2996. //$post['refundj'] = $u['refundj'];//补/退净额
  2997. $post['cost'] = $u['cost'];//成本金额
  2998. //$post['zzl'] = $u['zzl'];//总重量
  2999. //$post['zsbjz'] = $u['zsbjz'];//总申报价值
  3000. $post['ts'] = $u['ts'];//条数
  3001. $post['cost'] = $u['cost'];//成本金额
  3002. //追加
  3003. $post['rpaypal'] = $u['rpaypal'];//补/退交易号
  3004. $post['rtext'] = $u['rtext'];//补/退原因
  3005. $post['pay'] = $u['pay'];//付款方式
  3006. $post['paypal'] = $u['paypal'];//交易号
  3007. $post['clientremarks'] = $u['clientremarks'];//客户留言
  3008. $post['product'] = $u['product'];//商品名称
  3009. //$post['issku'] = $u['issku'];//sku
  3010. //$post['orderremarks'] = $u['orderremarks'];//订单备注
  3011. $post['shipremarks'] = $u['shipremarks'];//仓库品名
  3012. //产品追加
  3013. $post['fpdata'] = $u['fpdata'];//产品内容
  3014. $post['whlabel'] = $u['whlabel'];//产品对应库存码
  3015. $merge = $u['id'];
  3016. $d = array($u['id']);$order = '';
  3017. $zsl = 0;$zccsl = 0;
  3018. foreach ($id_arr as $v)
  3019. {
  3020. $v = $this->fullordertt->read($v);
  3021. if($u['type'] != $v['type'])
  3022. {
  3023. echo json_encode(array('msg'=>'仓库不一致,无法合并!','success'=>false));exit;
  3024. }
  3025. if($v['shop'] = $u['shop'])
  3026. {
  3027. $hd = $this->fullordertthb->get_orderinfo($v['orderinfo']);
  3028. if(!$hd)
  3029. {
  3030. $this->fullordertthb->insert($v);
  3031. }
  3032. // $post['shouldmoney'] += $v['shouldmoney'];//购买应收金额
  3033. // $post['budget'] += $v['budget'];//预估到帐金额
  3034. // $post['expressmoney'] += $v['expressmoney'];//物流金额
  3035. //$post['refundy'] += $v['refundy'];//补/退原额
  3036. //$post['refundj'] += $v['refundj'];//补/退净额
  3037. $post['cost'] += $v['cost'];//成本金额
  3038. //$post['zzl'] += $v['zzl'];//总重量
  3039. //$post['zsbjz'] += $v['zsbjz'];//总申报价值
  3040. $post['ts'] += $v['ts'];//条数
  3041. //$post['rpaypal'] .= $v['rpaypal'];//补/退交易号
  3042. //$post['rtext'] .= $v['rtext'];//补/退原因
  3043. //$post['pay'] .= (stripos($post['pay'],$v['pay']) !== false)?'':';'.$v['pay'];//付款方式
  3044. //$post['paypal'] .= $v['paypal'];//交易号
  3045. $post['clientremarks'] .= $v['clientremarks'];//客户留言
  3046. $post['product'] .= $v['product'];//商品名称
  3047. //$post['issku'] .= $v['issku'];//sku
  3048. //$post['orderremarks'] .= $v['orderremarks'];//订单备注
  3049. $post['shipremarks'] .= $v['shipremarks'];//仓库品名
  3050. $post['fpdata'] .= $v['fpdata'];//产品内容
  3051. $post['whlabel'] .= $v['whlabel'];//产品对应库存码
  3052. $d[] = $v['id'];
  3053. $order .= $v['orderinfo'].'('.$v['number'].')、';
  3054. $wl = $this->whlabel->find_all("zd = '".$v['number']."'");//查找是否有占用库存情况
  3055. $i = 0;
  3056. if($wl)//如果有那么清除所有占用
  3057. {
  3058. foreach ($wl as $val)
  3059. {
  3060. if($val['sku'] == 'Preset' && $val['state'] == '9')
  3061. {
  3062. $this->whlabel->remove($val['id']);//删除预设
  3063. $i++;
  3064. }
  3065. else
  3066. {
  3067. $this->whlabel->save(array('zd'=>''),$val['id']);//专属
  3068. $i++;
  3069. }
  3070. }
  3071. }
  3072. $zsl += count($wl);
  3073. $zccsl += $i;
  3074. $this->fullordertt->save(array('merge'=>$u['id'],'mergeid'=>1,'orderremarks'=>' 《合并信息》:'.'已合并到'.$u['orderinfo'].'('.$u['number'].')中; '.$v['orderremarks'],'print'=>1,'libraryconfirm'=>1,'whlabel'=>'','fpdata'=>'','shipremarks'=>''),$v['id']);
  3075. }
  3076. }
  3077. //计算出单条价值
  3078. /**
  3079. if($post['zsbjz'] < 1 || $post['ts'] < 1)
  3080. {
  3081. //$post['dtsbjz'] = 0;
  3082. }
  3083. else
  3084. {
  3085. //$post['dtsbjz'] = $post['zsbjz']/$post['ts'];//单条申报价
  3086. }
  3087. **/
  3088. $post['orderremarks'] = ' 《合并信息》:由'.rtrim($order,'、').'合并而来; '.$u['orderremarks'];
  3089. $post['merge'] = $u['id'];
  3090. //$post['mergeid'] = 1;
  3091. //合并重复项
  3092. //解决whlabel 合并在一起是 多出的那个|
  3093. $post['whlabel'] = str_replace("||","|",$post['whlabel']);
  3094. $hbcfw = explode('|',trim($post['whlabel'],'|'));
  3095. $hbcff = explode(';',trim($post['fpdata'],';'));
  3096. $c = 0;
  3097. $hbw = array();
  3098. $hbf = array();
  3099. for($i=0;$i<count($hbcfw);$i++)
  3100. {
  3101. $w = explode('-',$hbcfw[$i]);
  3102. $f = explode('|',$hbcff[$i]);
  3103. $w2 = ($w[2]==0)?0:'';
  3104. if(!isset($hbw[$w[0].$w2]))
  3105. {
  3106. $hbw[$w[0].$w2] = $hbcfw[$i];
  3107. $hbf[$w[0].$w2] = $hbcff[$i];
  3108. }
  3109. else
  3110. {
  3111. $c++;
  3112. $cw = explode('-',$hbw[$w[0].$w2]);
  3113. $cf = explode('|',$hbf[$w[0].$w2]);
  3114. if($cw[2] != 0 && $w[2] != 0)
  3115. {
  3116. $cf[2] += $f[2];
  3117. $cf[9] .= '~'.$f[9];
  3118. $hbf[$w[0].$w2] = implode("|",$cf);
  3119. $cw[1] += $f[2];
  3120. $cw[2] .= '~'.$f[9];
  3121. $hbw[$w[0].$w2] = implode("-",$cw);
  3122. }
  3123. else if($cw[2] == 0 && $w[2] == 0)
  3124. {
  3125. $cf[2] += $f[2];
  3126. $hbf[$w[0].$w2] = implode("|",$cf);
  3127. $cw[1] += $f[2];
  3128. $hbw[$w[0].$w2] = implode("-",$cw);
  3129. }
  3130. else
  3131. {
  3132. $hbw[] = $hbcfw[$i];
  3133. $hbf[] = $hbcff[$i];
  3134. }
  3135. }
  3136. }
  3137. if($c > 0)
  3138. {
  3139. $post['fpdata'] = implode(";",$hbf).';';
  3140. $post['whlabel'] = '|'.implode("|",$hbw).'|';
  3141. }
  3142. //合并重复项结束
  3143. $this->fullordertt->save($post,$u['id']);
  3144. if ($this->db->trans_status() === FALSE)
  3145. {
  3146. $this->db->trans_commit();
  3147. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  3148. }
  3149. else
  3150. {
  3151. $this->db->trans_commit();
  3152. echo json_encode(array('msg'=>'操作成功','d'=>($d),'b'=>$u['id'],'success'=>true));
  3153. }
  3154. }
  3155. }
  3156. //评价管理
  3157. public function _evaluate()
  3158. {
  3159. $user = $this->user->get_api($_SESSION['api']);
  3160. if($user)
  3161. {
  3162. $fgshop = "";$sid = "";
  3163. $user = explode('|',trim($user['shop'],'|'));
  3164. foreach ($user as $value)
  3165. {
  3166. $fgshop .= " shop = ".$value." or";
  3167. $sid .= " id = ".$value." or";
  3168. }
  3169. }
  3170. $post = $this->input->post(NULL, TRUE);
  3171. if(isset($post['page']))
  3172. {
  3173. $page = $this->input->post('page',true);
  3174. $perpage = $this->input->post('perpage',true);
  3175. $shop = $this->input->post('shop',true);
  3176. $where = "1=1 and evaluate = 0 and (".rtrim($fgshop,'or').")";
  3177. if($shop)
  3178. {
  3179. $where .= " and shop = '$shop'";
  3180. }
  3181. //数据排序
  3182. $order_str = "id desc";
  3183. if(empty($page))
  3184. {
  3185. $start = 0;
  3186. $perpage = 1;
  3187. }
  3188. else
  3189. {
  3190. $start = ($page - 1)*$perpage;
  3191. }
  3192. //取得信息列表
  3193. $info_list = $this->fullordertt->find_all($where,'id,shop,orderinfo,number,operation',$order_str,$start,$perpage);
  3194. //格式化数据
  3195. foreach ($info_list as $key=>$value)
  3196. {
  3197. $shop = $this->shop->read($value['shop']);
  3198. $info_list[$key]['shop'] = $shop['shopname'];
  3199. $info_list[$key]['operation'] = "评价";
  3200. }
  3201. $total = $this->fullordertt->find_count($where);
  3202. $pagenum = ceil($total/$perpage);
  3203. $over = $total-($start+$perpage);
  3204. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  3205. echo json_encode($rows);exit;
  3206. }
  3207. $this->_Template('fullordertt_evaluate',$this->data);
  3208. }
  3209. //订单消息
  3210. public function _state()
  3211. {
  3212. $user = $this->user->get_api($_SESSION['api']);
  3213. if($user)
  3214. {
  3215. $fgshop = "";$sid = "";
  3216. $user = explode('|',trim($user['shop'],'|'));
  3217. foreach ($user as $value)
  3218. {
  3219. $fgshop .= " shop = ".$value." or";
  3220. $sid .= " id = ".$value." or";
  3221. }
  3222. }
  3223. $post = $this->input->post(NULL, TRUE);
  3224. if(isset($post['page']))
  3225. {
  3226. $page = $this->input->post('page',true);
  3227. $perpage = $this->input->post('perpage',true);
  3228. $timetk = $this->input->post('timetk',true);
  3229. $timetj = $this->input->post('timetj',true);
  3230. $shop = $this->input->post('shop',true);
  3231. $expressstate = $this->input->post('expressstate',true);
  3232. $fs = $this->input->post('fs',true);
  3233. $state = $this->input->post('state',true);
  3234. $express = $this->input->post('express',true);
  3235. $review = $this->input->post('review',true);
  3236. $orderinfo = $this->input->post('orderinfo',true);
  3237. $number = $this->input->post('number',true);
  3238. $waybill = $this->input->post('waybill',true);
  3239. $xztime = $this->input->post('xztime',true);
  3240. $timetk = strtotime($timetk);
  3241. $timetj = strtotime($timetj);
  3242. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  3243. if($timetk && $timetj)
  3244. {
  3245. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  3246. }
  3247. if($xztime == 'librarytime')
  3248. {
  3249. $order_str = "librarytime desc";
  3250. }
  3251. else if($xztime == 'dtime')
  3252. {
  3253. $order_str = "dtime desc";
  3254. }
  3255. if($shop)
  3256. {
  3257. $where .= " and shop = '$shop'";
  3258. }
  3259. if($expressstate)
  3260. {
  3261. $where .= " and expressstate = '$expressstate'";
  3262. }
  3263. if($review)
  3264. {
  3265. $where .= " and review = '$review'";
  3266. }
  3267. if($fs)
  3268. {
  3269. if($fs == '2')
  3270. {
  3271. $where .= " and exstateerror != ''";
  3272. }
  3273. else
  3274. {
  3275. $where .= " and exstateerror = ''";
  3276. }
  3277. }
  3278. if($state)
  3279. {
  3280. $where .= " and state = '$state'";
  3281. }
  3282. if($express)
  3283. {
  3284. $where .= " and express = '$express'";
  3285. }
  3286. if($orderinfo)
  3287. {
  3288. $where .= " and orderinfo = '$orderinfo'";
  3289. }
  3290. if($number)
  3291. {
  3292. $where .= " and number = '$number'";
  3293. }
  3294. if($waybill)
  3295. {
  3296. $where .= " and waybill = '$waybill'";
  3297. }
  3298. if(empty($page))
  3299. {
  3300. $start = 0;
  3301. $perpage = 1;
  3302. }
  3303. else
  3304. {
  3305. $start = ($page - 1)*$perpage;
  3306. }
  3307. //取得信息列表
  3308. $info_list = $this->fullordertt->find_all($where,'id,shop,orderinfo,number,country,library,librarytime,express,waybill,content,orderremarks,exstateerror',$order_str,$start,$perpage);
  3309. //格式化数据
  3310. foreach ($info_list as $key=>$value)
  3311. {
  3312. $shop = $this->shop->read($value['shop']);
  3313. $info_list[$key]['shop'] = $shop['shopname'];
  3314. $country = $this->country->read($value['country']);
  3315. $info_list[$key]['country'] = $country['name'];
  3316. //$state = $this->typeclass->read($value['state']);
  3317. //$info_list[$key]['state'] = $state['title'];
  3318. if($value['library'] == 1)
  3319. {
  3320. $info_list[$key]['library'] = "未出库";
  3321. }
  3322. else if($value['library'] == 2)
  3323. {
  3324. $info_list[$key]['library'] = "已出库";
  3325. }
  3326. else if($value['library'] == 3)
  3327. {
  3328. $info_list[$key]['library'] = "已退库";
  3329. }
  3330. if($value['librarytime'] == '0')
  3331. {
  3332. $info_list[$key]['librarytime'] = '无';
  3333. }
  3334. else
  3335. {
  3336. $info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']);
  3337. }
  3338. $express = $this->express->read($value['express']);
  3339. $info_list[$key]['express'] = $express['servicename'];
  3340. }
  3341. $total = $this->fullordertt->find_count($where);
  3342. $pagenum = ceil($total/$perpage);
  3343. $over = $total-($start+$perpage);
  3344. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  3345. echo json_encode($rows);exit;
  3346. }
  3347. $notice = $this->notice->find_all("type = '1' and (".rtrim($fgshop,'or').")");
  3348. $this->data['notice'] = $notice;
  3349. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  3350. $this->data['wlshop'] = $wlshop;
  3351. $this->data['express'] = $this->express->find_all();
  3352. $this->_Template('fullordertt_state',$this->data);
  3353. }
  3354. //物流信息
  3355. public function _wl()
  3356. {
  3357. $user = $this->user->get_api($_SESSION['api']);
  3358. if($user)
  3359. {
  3360. $fgshop = "";$sid = "";
  3361. $user = explode('|',trim($user['shop'],'|'));
  3362. foreach ($user as $value)
  3363. {
  3364. $fgshop .= " shop = ".$value." or";
  3365. $sid .= " id = ".$value." or";
  3366. }
  3367. }
  3368. $post = $this->input->post(NULL, TRUE);
  3369. if(isset($post['page']))
  3370. {
  3371. $page = $this->input->post('page',true);
  3372. $perpage = $this->input->post('perpage',true);
  3373. $timetk = $this->input->post('timetk',true);
  3374. $timetj = $this->input->post('timetj',true);
  3375. $shop = $this->input->post('shop',true);
  3376. $expressstate = $this->input->post('expressstate',true);
  3377. $fs = $this->input->post('fs',true);
  3378. $state = $this->input->post('state',true);
  3379. $express = $this->input->post('express',true);
  3380. $orderinfo = $this->input->post('orderinfo',true);
  3381. $number = $this->input->post('number',true);
  3382. $waybill = $this->input->post('waybill',true);
  3383. $wlyc = $this->input->post('wlyc',true);
  3384. $wltype = $this->input->post('wltype',true);
  3385. $source = $this->input->post('source',true);
  3386. $xztime = $this->input->post('xztime',true);
  3387. $timetk = strtotime($timetk);
  3388. $timetj = strtotime($timetj);
  3389. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  3390. if($timetk && $timetj)
  3391. {
  3392. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  3393. }
  3394. if($xztime == 'librarytime')
  3395. {
  3396. $order_str = "librarytime desc";
  3397. }
  3398. else if($xztime == 'dtime')
  3399. {
  3400. $order_str = "dtime desc";
  3401. }
  3402. else if ($xztime == 'wlfstime')
  3403. {
  3404. $order_str = "wlfstime desc";
  3405. }
  3406. if($shop)
  3407. {
  3408. $where .= " and shop = '$shop'";
  3409. }
  3410. if($expressstate != '')
  3411. {
  3412. $where .= " and expressstate = '$expressstate'";
  3413. }
  3414. if($fs)
  3415. {
  3416. if($fs == '1')
  3417. {
  3418. $where .= " and wlcontent != ''";
  3419. }
  3420. if($fs == '2')
  3421. {
  3422. $where .= " and wlerror != ''";
  3423. }
  3424. if($fs == '3')
  3425. {
  3426. $where .= " and wlcontent = '' and shouldmoney > 100";
  3427. }
  3428. else if($fs == '4')
  3429. {
  3430. $where .= " and wltype = '1'";
  3431. }
  3432. }
  3433. if($state)
  3434. {
  3435. $where .= " and state = '$state'";
  3436. }
  3437. if($express)
  3438. {
  3439. $where .= " and express = '$express'";
  3440. }
  3441. if($orderinfo)
  3442. {
  3443. $where .= " and orderinfo = '$orderinfo'";
  3444. }
  3445. if($number)
  3446. {
  3447. $where .= " and number = '$number'";
  3448. }
  3449. if($waybill)
  3450. {
  3451. $where .= " and waybill = '$waybill'";
  3452. }
  3453. if($wlyc!='')
  3454. {
  3455. $where .= " and wlyc = '$wlyc'";
  3456. }
  3457. if($wltype!='')
  3458. {
  3459. $where .= " and wltype = '$wltype'";
  3460. }
  3461. if($source)
  3462. {
  3463. if($source == 1)
  3464. {
  3465. $where .= " and source = '$source'";
  3466. }
  3467. else
  3468. {
  3469. $where .= " and source != '1'";
  3470. }
  3471. }
  3472. if(empty($page))
  3473. {
  3474. $start = 0;
  3475. $perpage = 1;
  3476. }
  3477. else
  3478. {
  3479. $start = ($page - 1)*$perpage;
  3480. }
  3481. //取得信息列表
  3482. $info_list = $this->fullordertt->find_all($where,'id,orderinfo,number,country,library,librarytime,expressstate,express,waybill,wlbz,orderremarks,wlcontent,wlerror,excontent,wltype',$order_str,$start,$perpage);
  3483. //格式化数据
  3484. foreach ($info_list as $key=>$value)
  3485. {
  3486. $f = $this->fullordertt->read($value['id']);
  3487. $info_list[$key]['number'] = "<p>".$value['number']."</p>"."<p>".$f['email']."</p>";
  3488. $country = $this->country->read($value['country']);
  3489. $info_list[$key]['country'] = "<p>".$country['name']."</p><p>".$f['phone']."</p>";
  3490. //$state = $this->typeclass->read($value['state']);
  3491. //$info_list[$key]['state'] = $state['title'];
  3492. if($value['library'] == 1)
  3493. {
  3494. $info_list[$key]['library'] = "未出库";
  3495. }
  3496. else if($value['library'] == 2)
  3497. {
  3498. $info_list[$key]['library'] = "已出库";
  3499. }
  3500. else if($value['library'] == 3)
  3501. {
  3502. $info_list[$key]['library'] = "已退库";
  3503. }
  3504. if($value['librarytime'] == '0')
  3505. {
  3506. $info_list[$key]['librarytime'] = '无';
  3507. }
  3508. else
  3509. {
  3510. $info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']).'<br>'.$f['shouldmoney'];
  3511. }
  3512. if($value['expressstate'] == 0)
  3513. {
  3514. $info_list[$key]['expressstate'] = "无信息";
  3515. }
  3516. else if($value['expressstate'] == 2)
  3517. {
  3518. $info_list[$key]['expressstate'] = "已取件";
  3519. }
  3520. else if($value['expressstate'] == 3)
  3521. {
  3522. $info_list[$key]['expressstate'] = "在途中";
  3523. }
  3524. else if($value['expressstate'] == 4)
  3525. {
  3526. $info_list[$key]['expressstate'] = "到达目的地国".$value['expressstate'];
  3527. }
  3528. else if($value['expressstate'] == 5)
  3529. {
  3530. $info_list[$key]['expressstate'] = "即将派送";
  3531. }
  3532. else if($value['expressstate'] == 6)
  3533. {
  3534. $info_list[$key]['expressstate'] = "已签收";
  3535. }
  3536. else if($value['expressstate'] == 1)
  3537. {
  3538. $info_list[$key]['expressstate'] = "派送异常";
  3539. }
  3540. $express = $this->express->read($value['express']);
  3541. $info_list[$key]['express'] = $express['servicename'];
  3542. if($value['wltype'] == '0')
  3543. {
  3544. $info_list[$key]['wltype'] = "<p class='ckn'><b class='wlfsxx' data-id='".$value['id']."' data-q='1'>禁止发送</b></p>";
  3545. }
  3546. else
  3547. {
  3548. $info_list[$key]['wltype'] = "<p class='ckn'><b class='wlfsxx' data-id='".$value['id']."' data-q='1'>允许发送</b></p>";
  3549. }
  3550. if($f['wlyc'] == '0')
  3551. {
  3552. $info_list[$key]['wltype'] .= "<p class='yc'><b class='wlyc' data-id='".$value['id']."' data-t='1'>加入异常</b></p>";
  3553. }
  3554. else if($f['wlyc'] == '1')
  3555. {
  3556. $info_list[$key]['wltype'] .= "<p class='yc'><b class='wlyc' data-id='".$value['id']."' data-t='2'>物流异常</b></p>";
  3557. }
  3558. else if($f['wlyc'] == '2')
  3559. {
  3560. $info_list[$key]['wltype'] .= "<p><b>异常已处理</b></p>";
  3561. }
  3562. if(stripos($value['excontent'],'<br />') !== false)
  3563. {
  3564. $excontent = explode('<br />',$value['excontent']);
  3565. $info_list[$key]['excontent'] = '<i class="method fa fa-list-ul" data-t="'.$value['excontent'].'"></i> '.$excontent[0];
  3566. }
  3567. }
  3568. $total = $this->fullordertt->find_count($where);
  3569. $pagenum = ceil($total/$perpage);
  3570. $over = $total-($start+$perpage);
  3571. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  3572. echo json_encode($rows);exit;
  3573. }
  3574. if(isset($post['q']))
  3575. {
  3576. $id = $this->input->post('id',true);
  3577. $f = $this->fullordertt->read($id);
  3578. $wl = ($f['wltype']=='0')?1:0;
  3579. $wltitle = ($f['wltype']=='0')?'已禁发送':'已允发送';
  3580. if($this->fullordertt->save(array('wltype'=>$wl),$id))
  3581. {
  3582. echo json_encode(array('msg'=>'ckn','id'=>$id,'wltitle'=>$wltitle,'success'=>true));exit;
  3583. }
  3584. else
  3585. {
  3586. echo json_encode(array('msg'=>'失败,请重试','id'=>$id,'wltitle'=>$wltitle,'success'=>false));exit;
  3587. }
  3588. }
  3589. if(isset($post['t']))
  3590. {
  3591. $id = $this->input->post('id',true);
  3592. $f = $this->fullordertt->read($id);
  3593. $t = $this->input->post('t',true);
  3594. $yc = ($f['wlyc']=='0')?1:2;
  3595. $yctitle = ($f['wlyc']=='0')?'物流异常':'异常已处理';
  3596. if($this->fullordertt->save(array('wlyc'=>$yc),$id))
  3597. {
  3598. echo json_encode(array('msg'=>'yc','id'=>$id,'wltitle'=>$yctitle,'success'=>true));exit;
  3599. }
  3600. else
  3601. {
  3602. echo json_encode(array('msg'=>'失败,请重试','id'=>$id,'wltitle'=>$yctitle,'success'=>false));exit;
  3603. }
  3604. }
  3605. $notice = $this->notice->find_all("type = '2' and (".rtrim($fgshop,'or').")");
  3606. $this->data['notice'] = $notice;
  3607. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  3608. $this->data['wlshop'] = $wlshop;
  3609. $this->data['express'] = $this->express->find_all();
  3610. $this->_Template('fullordertt_wl',$this->data);
  3611. }
  3612. //审核订单
  3613. public function _review()
  3614. {
  3615. $user = $this->user->get_api($_SESSION['api']);
  3616. if($user)
  3617. {
  3618. $fgshop = "";$sid = "";
  3619. $user = explode('|',trim($user['shop'],'|'));
  3620. foreach ($user as $value)
  3621. {
  3622. $sid .= " id = ".$value." or";
  3623. $fgshop .= " shop = ".$value." or";
  3624. }
  3625. $fgshop = " and (".rtrim($fgshop,'or').")";
  3626. }
  3627. $post = $this->input->post(NULL, TRUE);
  3628. if(isset($post['page']))
  3629. {
  3630. $page = $this->input->post('page',true);
  3631. $perpage = $this->input->post('perpage',true);
  3632. $source = $this->input->post('source',true);
  3633. $warehouse = $this->input->post('warehouse',true);
  3634. $express = $this->input->post('express',true);
  3635. $orderremarks = $this->input->post('orderremarks',true);
  3636. $shop = $this->input->post('shop',true);
  3637. $review = $this->input->post('review',true);
  3638. $orderinfo = $this->input->post('orderinfo',true);
  3639. $shipremarks = $this->input->post('shipremarks',true);
  3640. $number = $this->input->post('number',true);
  3641. $timetk = $this->input->post('timetk',true);
  3642. $timetj = $this->input->post('timetj',true);
  3643. $timetk = strtotime($timetk);
  3644. $timetj = strtotime($timetj);
  3645. $where = "mergeid = 0 and state = '207'".$fgshop;
  3646. if($timetk && $timetj)
  3647. {
  3648. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  3649. }
  3650. if($source)
  3651. {
  3652. if($source == '2d')
  3653. {
  3654. $where .= " and source >= '2'";
  3655. }
  3656. else
  3657. {
  3658. $where .= " and source = '$source'";
  3659. }
  3660. }
  3661. if($review)
  3662. {
  3663. $where .= " and review = '$review'";
  3664. }
  3665. else
  3666. {
  3667. $where .= " and ((review = '2' and source = '1') or (review = '1' and source >= '2'))";
  3668. }
  3669. if($shop)
  3670. {
  3671. $where .= " and shop = '$shop'";
  3672. }
  3673. if($warehouse)
  3674. {
  3675. $where .= " and type = '$warehouse'";
  3676. }
  3677. if($express)
  3678. {
  3679. $where .= " and express = '$express'";
  3680. }
  3681. if($orderremarks)
  3682. {
  3683. $where .= " and orderremarks like '%$orderremarks%'";
  3684. }
  3685. if($orderinfo)
  3686. {
  3687. $where .= " and orderinfo = '$orderinfo'";
  3688. }
  3689. if($number)
  3690. {
  3691. $where .= " and number = '$number'";
  3692. }
  3693. if($shipremarks)
  3694. {
  3695. $where .= " and shipremarks like '%$shipremarks%'";
  3696. }
  3697. //数据排序
  3698. $order_str = "id desc";
  3699. if(empty($page))
  3700. {
  3701. $start = 0;
  3702. $perpage = 1;
  3703. }
  3704. else
  3705. {
  3706. $start = ($page - 1)*$perpage;
  3707. }
  3708. //取得信息列表
  3709. $info_list = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,client,express,dtime,shouldmoney,review,orderremarks');
  3710. //格式化数据
  3711. foreach ($info_list as $key=>$value)
  3712. {
  3713. $lr = $this->fullordertt->read($value['id']);
  3714. $shop = $this->shop->read($value['shop']);
  3715. $info_list[$key]['shop'] = $shop['shopname'];
  3716. $warehouse = $this->warehouse->read($value['type']);
  3717. $info_list[$key]['type'] = $warehouse['title'];
  3718. $express = $this->express->read($value['express']);
  3719. $info_list[$key]['express'] = $express['servicename'];
  3720. $info_list[$key]['dtime'] = '<p>'.date('Y-m-d',$value['dtime']).'</p><p>'.date('H:i:s',$value['dtime']).'</p>';
  3721. if($value['review'] == 1)
  3722. {
  3723. $info_list[$key]['review'] = "未送审";
  3724. }
  3725. else if($value['review'] == 2)
  3726. {
  3727. $info_list[$key]['review'] = "待审核";
  3728. }
  3729. else if($value['review'] == 3)
  3730. {
  3731. $info_list[$key]['review'] = "不通过";
  3732. }
  3733. else if($value['review'] == 4)
  3734. {
  3735. $info_list[$key]['review'] = "取消重审";
  3736. }
  3737. else if($value['review'] == 5)
  3738. {
  3739. $info_list[$key]['review'] = "审核通过";
  3740. }
  3741. else if($value['review'] == 6)
  3742. {
  3743. $info_list[$key]['review'] = "自动通过";
  3744. }
  3745. /**
  3746. $info_list[$key]['library'] = "";
  3747. if($value['review'] == 1)
  3748. {
  3749. $info_list[$key]['library'] = "<p><b class='focz' data-type='6' data-id='".$value['id']."'>审核通过</b></p>";
  3750. }
  3751. if($value['review'] == 2)
  3752. {
  3753. $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>";
  3754. }
  3755. else if($value['review'] == 3)
  3756. {
  3757. $info_list[$key]['library'] = "<p><b class='fullorderttreview' data-type='5' data-id='".$value['id']."'>审核通过</b></p>";
  3758. }
  3759. else if($value['review'] == 5)
  3760. {
  3761. $info_list[$key]['library'] = "<p><b class='fullorderttreview' data-type='3' data-id='".$value['id']."'>不通过</b></p>";
  3762. }
  3763. $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$lr['currencytitle'];
  3764. $lr['hl'] = $lr['hl']==0?6.71:$lr['hl'];
  3765. $cost = $lr['cost']/$lr['hl'];
  3766. $currencytitle = $lr['budget']-$lr['refundj']-$cost-$lr['expressmoney'];
  3767. $info_list[$key]['currencytitle'] = sprintf("%.2f",$currencytitle).' '.$lr['currencytitle'];
  3768. **/
  3769. }
  3770. $total = $this->fullordertt->find_count($where);
  3771. $pagenum = ceil($total/$perpage);
  3772. $over = $total-($start+$perpage);
  3773. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  3774. echo json_encode($rows);exit;
  3775. }
  3776. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  3777. $this->data['shop'] = $wlshop;
  3778. $this->_Template('fullordertt_review',$this->data);
  3779. }
  3780. public function _wlbz($arg_array)
  3781. {
  3782. $post = $this->input->post(NULL, TRUE);
  3783. if(isset($post['id']))
  3784. {
  3785. $id = $this->input->post('id',true);
  3786. $post['wlbz'] = $this->input->post('wlbz',true);
  3787. if($post['wlbz'] == '')
  3788. {
  3789. echo json_encode(array('msg'=>'备注不能为空','success'=>false));exit;
  3790. }
  3791. if($this->fullordertt->save($post,$id))
  3792. {
  3793. echo json_encode(array('msg'=>'修改成功','id'=>$id,'success'=>true));exit;
  3794. }
  3795. else
  3796. {
  3797. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  3798. }
  3799. }
  3800. $arg_array = $arg_array[0];
  3801. $fullordertt = $this->fullordertt->read($arg_array);
  3802. $this->data['fullordertt'] = $fullordertt;
  3803. $this->_Template('fullordertt_wlbz',$this->data);
  3804. }
  3805. //导出资金统计excel
  3806. public function _fmexcel()
  3807. {
  3808. $user = $this->user->get_api($_SESSION['api']);
  3809. if($user)
  3810. {
  3811. $fgshop = "";$sid = "";
  3812. $user = explode('|',trim($user['shop'],'|'));
  3813. foreach ($user as $value)
  3814. {
  3815. $fgshop .= " shop = ".$value." or";
  3816. $sid .= " id = ".$value." or";
  3817. }
  3818. }
  3819. if(isset($_GET['excel']))
  3820. {
  3821. $timetk = $this->input->get('timetk',true);
  3822. $timetj = $this->input->get('timetj',true);
  3823. $shop = $this->input->get('shop',true);
  3824. $source = $this->input->get('source',true);
  3825. $state = $this->input->get('state',true);
  3826. $type = $this->input->get('type',true);
  3827. $orderinfo = $this->input->get('orderinfo',true);
  3828. $user = $this->input->get('user',true);
  3829. $name = $this->input->get('name',true);
  3830. $timetk = strtotime($timetk);
  3831. $timetj = strtotime($timetj);
  3832. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  3833. if($timetk && $timetj)
  3834. {
  3835. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  3836. }
  3837. if($shop)
  3838. {
  3839. $where .= " and shop = '$shop'";
  3840. }
  3841. if($source)
  3842. {
  3843. $where .= " and source = '$source'";
  3844. }
  3845. if($state)
  3846. {
  3847. if($state == 1)
  3848. {
  3849. $where .= " and state = '$state'";
  3850. }
  3851. }
  3852. if($type)
  3853. {
  3854. $where .= " and type = '$type'";
  3855. }
  3856. if($orderinfo)
  3857. {
  3858. $where .= " and orderinfo = '$orderinfo'";
  3859. }
  3860. if($user)
  3861. {
  3862. $where .= " and user = '$user'";
  3863. }
  3864. if($name)
  3865. {
  3866. $where .= " and name = '$name'";
  3867. }
  3868. //取得信息列表
  3869. $info_list = $this->fullordertt->find_all($where,'id,shop,user,number,orderinfo,client,country,dtime,ftime,express,waybill,shouldmoney,refund,currency,budget,fpdata,hl,currencytitle');
  3870. //格式化数据
  3871. $i = 1;$shouldmoney = 0;$refund = 0;$budget = 0;$currency = 0;$hl=1;
  3872. foreach ($info_list as $key=>$value)
  3873. {
  3874. $info_list[$key]['id'] = $i;
  3875. if($value['currencytitle'] != "CNY")
  3876. {
  3877. $hl=$value['hl'];
  3878. }
  3879. $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl);
  3880. $budget=$budget+($value['budget']*$hl);
  3881. $currency=$currency+(($value['shouldmoney']-$value['budget'])*$hl);
  3882. $refund=$refund+($value['refund']*$hl);
  3883. $shop = $this->shop->read($value['shop']);
  3884. $info_list[$key]['shop'] = $shop['shopname'];
  3885. $info_list[$key]['user'] = $shop['shopuser'];
  3886. $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);
  3887. $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']);
  3888. $country = $this->country->read($value['country']);
  3889. $info_list[$key]['country'] = $country['name'];
  3890. $express = $this->express->read($value['express']);
  3891. $info_list[$key]['express'] = $express['servicename'];
  3892. $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle'];
  3893. $info_list[$key]['refund'] = $value['refund'].' '.$value['currencytitle'];
  3894. $info_list[$key]['budget'] = $value['budget'].' '.$value['currencytitle'];
  3895. $info_list[$key]['currency'] = sprintf("%.2f",$value['shouldmoney']-$value['budget']).' '.$value['currencytitle'];
  3896. $fpdata = array();
  3897. if(stripos($value['fpdata'],';') !== false)
  3898. {
  3899. $fpdata = explode(';',rtrim($value['fpdata'],';'));
  3900. foreach ($fpdata as $ke=>$va)
  3901. {
  3902. $v = explode('|',rtrim($va,'|'));
  3903. $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数
  3904. }
  3905. }
  3906. $info_list[$key]['fpdata'] = $fpdata;
  3907. $i++;
  3908. }
  3909. $data = array($shouldmoney.' CNY',$refund.' CNY',$currency.' CNY',$budget.' CNY');
  3910. $title = "订单资金信息";
  3911. $titlename = "<table border=1>
  3912. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  3913. <tr>
  3914. <td>NO.</td>
  3915. <td>店铺</td>
  3916. <td>负责人</td>
  3917. <td>编号</td>
  3918. <td>订单号</td>
  3919. <td>客户姓名</td>
  3920. <td>国家</td>
  3921. <td>订单日期</td>
  3922. <td>发货日期</td>
  3923. <td>快递公司</td>
  3924. <td>运单号</td>
  3925. <td>订单金额</td>
  3926. <td>退款金额</td>
  3927. <td>手续费</td>
  3928. <td>预估金额</td>
  3929. <td>
  3930. <table border=1>
  3931. <tr><td colspan='3' align='center'>订单产品信息</td></tr>
  3932. <tr>
  3933. <td>产品</td>
  3934. <td>条数</td>
  3935. <td>数量</td>
  3936. </tr>
  3937. </table>
  3938. </td>
  3939. <td>总条数</td>
  3940. </tr>
  3941. </table>";
  3942. $filename = $title.".xls";
  3943. $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";
  3944. $this->excel->get_fz($info_list,$titlename,$filename,$tail);
  3945. }
  3946. }
  3947. //导出订单excel
  3948. public function _fdexcel()
  3949. {
  3950. if(isset($_GET['excel']))
  3951. {
  3952. $page = $this->input->post('page',true);
  3953. $perpage = $this->input->post('perpage',true);
  3954. $timetk = $this->input->post('timetk',true);
  3955. $timetj = $this->input->post('timetj',true);
  3956. $shop = $this->input->post('shop',true);
  3957. $source = $this->input->post('source',true);
  3958. $state = $this->input->post('state',true);
  3959. $review = $this->input->post('review',true);
  3960. $express = $this->input->post('express',true);
  3961. $orderinfo = $this->input->post('orderinfo',true);
  3962. $user = $this->input->post('user',true);
  3963. $name = $this->input->post('name',true);
  3964. $waybill = $this->input->post('waybill',true);
  3965. $timetk = strtotime($timetk);
  3966. $timetj = strtotime($timetj);
  3967. $where = "1=1 and mergeid = 0";
  3968. if($timetk && $timetj)
  3969. {
  3970. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  3971. }
  3972. if($shop)
  3973. {
  3974. $where .= " and shop = '$shop'";
  3975. }
  3976. if($source)
  3977. {
  3978. $where .= " and source = '$source'";
  3979. }
  3980. if($state)
  3981. {
  3982. $where .= " and state = '$state'";
  3983. }
  3984. if($review)
  3985. {
  3986. $where .= " and review = '$review'";
  3987. }
  3988. if($express)
  3989. {
  3990. $where .= " and express = '$express'";
  3991. }
  3992. if($orderinfo)
  3993. {
  3994. $where .= " and orderinfo = '$orderinfo'";
  3995. }
  3996. if($user)
  3997. {
  3998. $where .= " and user = '$user'";
  3999. }
  4000. if($name)
  4001. {
  4002. $where .= " and name = '$name'";
  4003. }
  4004. if($waybill)
  4005. {
  4006. $where .= " and waybill = '$waybill'";
  4007. }
  4008. //取得信息列表
  4009. $info_list = $this->fullordertt->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');
  4010. //格式化数据
  4011. $i = 1;$shouldmoney = 0;$hl=1;
  4012. foreach ($info_list as $key=>$value)
  4013. {
  4014. $info_list[$key]['id'] = $i;
  4015. if($value['source'] == 1)
  4016. {
  4017. $info_list[$key]['source'] = "线下订单";
  4018. }
  4019. else if($value['source'] == 2)
  4020. {
  4021. $info_list[$key]['source'] = "PC订单";
  4022. }
  4023. else if($value['source'] == 3)
  4024. {
  4025. $info_list[$key]['source'] = "手机订单";
  4026. }
  4027. if($value['currencytitle'] != "CNY")
  4028. {
  4029. $hl=$value['hl'];
  4030. }
  4031. $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl);
  4032. $shop = $this->shop->read($value['shop']);
  4033. $info_list[$key]['shop'] = $shop['shopname'];
  4034. $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);
  4035. $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']);
  4036. $state = $this->typeclass->read($value['state']);
  4037. $info_list[$key]['state'] = $state['title'];
  4038. $country = $this->country->read($value['country']);
  4039. $info_list[$key]['country'] = $country['name'];
  4040. $express = $this->express->read($value['express']);
  4041. $info_list[$key]['express'] = $express['servicename'];
  4042. $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle'];
  4043. $fpdata = array();
  4044. if(stripos($value['fpdata'],';') !== false)
  4045. {
  4046. $fpdata = explode(';',rtrim($value['fpdata'],';'));
  4047. foreach ($fpdata as $ke=>$va)
  4048. {
  4049. $v = explode('|',rtrim($va,'|'));
  4050. $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数
  4051. }
  4052. }
  4053. $info_list[$key]['fpdata'] = $fpdata;
  4054. $i++;
  4055. }
  4056. $data = array($shouldmoney.' CNY');
  4057. $title = "订单信息表";
  4058. $titlename = "<table border=1>
  4059. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  4060. <tr>
  4061. <td>NO.</td>
  4062. <td>店铺</td>
  4063. <td>编号</td>
  4064. <td>订单号</td>
  4065. <td>订单类型</td>
  4066. <td>客户姓名</td>
  4067. <td>收件人名称</td>
  4068. <td>收货人地址</td>
  4069. <td>城市</td>
  4070. <td>邮编</td>
  4071. <td>州</td>
  4072. <td>国家</td>
  4073. <td>收件电话</td>
  4074. <td>订单日期</td>
  4075. <td>发货日期</td>
  4076. <td>订单状态</td>
  4077. <td>订单金额</td>
  4078. <td>快递公司</td>
  4079. <td>运单号</td>
  4080. <td>订单备注</td>
  4081. <td>客户备注</td>
  4082. <td>
  4083. <table border=1>
  4084. <tr><td colspan='3' align='center'>订单产品信息</td></tr>
  4085. <tr>
  4086. <td>产品</td>
  4087. <td>条数</td>
  4088. <td>数量</td>
  4089. </tr>
  4090. </table>
  4091. </td>
  4092. <td>总条数</td>
  4093. </tr>
  4094. </table>";
  4095. $filename = $title.".xls";
  4096. $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";
  4097. $this->excel->get_fz($info_list,$titlename,$filename,$tail);
  4098. }
  4099. }
  4100. public function _black()
  4101. {
  4102. $post = $this->input->post(NULL, TRUE);
  4103. if(isset($post['bd']))
  4104. {
  4105. $bd = $this->input->post('bd',true);
  4106. $rows = $this->fullordertt->read($bd);
  4107. $post['shop'] = $rows['shop'];
  4108. $post['source'] = 1;
  4109. $post['name'] = $rows['client'];
  4110. $post['email'] = $rows['email'];
  4111. $post['phone'] = $rows['phone'];
  4112. $post['country'] = $rows['country'];
  4113. $post['money'] = $rows['shouldmoney'];
  4114. $post['num'] = 1;
  4115. $post['time'] = $rows['dtime'];
  4116. $post['province'] = $rows['province'];
  4117. $post['city'] = $rows['city'];
  4118. $post['street'] = $rows['street'];
  4119. $post['address'] = $rows['address'];
  4120. $post['address2'] = $rows['address2'];
  4121. $post['zipcode'] = $rows['zipcode'];
  4122. $post['type'] = 2;
  4123. if($this->customertt->insert($post))
  4124. {
  4125. $this->fullordertt->save(array('black'=>1),$bd);
  4126. echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
  4127. }
  4128. else
  4129. {
  4130. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  4131. }
  4132. }
  4133. }
  4134. public function _ryf()
  4135. {
  4136. $post = $this->input->post(NULL, TRUE);
  4137. if(isset($post['bd']))
  4138. {
  4139. $bd = $this->input->post('bd',true);
  4140. $d = $this->fullordertt->read($bd);
  4141. if($d['state'] == 207 || $d['state'] == 207)//订单状态为等待发货或等待部分发货才可更改为允许发货
  4142. {
  4143. if($d['print'] < 3)//打印状态为未打印
  4144. {
  4145. $print = 1;//未打印
  4146. $libraryconfirm = 1;//不允许出库
  4147. $a = "订单未打印,";
  4148. }
  4149. else//已打印订单
  4150. {
  4151. $libraryconfirm = 2;//允许出库
  4152. $a = "";
  4153. }
  4154. if($this->fullordertt->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd))
  4155. {
  4156. echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
  4157. }
  4158. else
  4159. {
  4160. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  4161. }
  4162. }
  4163. if($this->fullordertt->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd))
  4164. {
  4165. echo json_encode(array('msg'=>'操作失败!订单未非发货状态','success'=>false));exit;
  4166. }
  4167. else
  4168. {
  4169. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  4170. }
  4171. }
  4172. }
  4173. public function _fsstate()
  4174. {
  4175. $post = $this->input->post(NULL, TRUE);
  4176. if(isset($post['s']))
  4177. {
  4178. $id_arr = $this->input->post('s');
  4179. $id_arr = explode(',',$id_arr);
  4180. if(!$id_arr)
  4181. {
  4182. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  4183. }
  4184. foreach ($id_arr as $v)
  4185. {
  4186. $data = $this->fullordertt->read($v);
  4187. $warehouse = $this->warehouse->read($data['type']);
  4188. $fs = $this->notice->get_ordertatus($data['state']);
  4189. if($fs)
  4190. {
  4191. $ck = $this->_email($fs['content'],$data,$warehouse['company']);
  4192. if($ck == 1)
  4193. {
  4194. $this->fullordertt->save(array('fscontent'=>date('Y-m-d H:i:s',time()).'已发送:'.$fs['title'].' - '),$v);
  4195. }
  4196. }
  4197. }
  4198. echo json_encode(array('msg'=>'发送完成!','success'=>true));exit;
  4199. }
  4200. }
  4201. public function _power()
  4202. {
  4203. $user = $this->user->get_api($_SESSION['api']);
  4204. $post = $this->input->post(NULL, TRUE);
  4205. if(isset($post['id']))
  4206. {
  4207. $id = $this->input->post('id',true);
  4208. $fullordertt = $this->fullordertt->read($id);
  4209. $express = $this->express->read($fullordertt['express']);
  4210. $warehouse = $this->warehouse->read($fullordertt['type']);
  4211. if(($warehouse['zd'] == '1' || stripos($fullordertt['whlabel'],'z|') !== false) && $fullordertt['library'] == '2')
  4212. {
  4213. echo json_encode(array('msg'=>'需要先退库释放库存后才可重置!','success'=>false));exit;
  4214. }
  4215. /**
  4216. if($fullordertt['print'] == '3' && isset($express['iscode']) && ($express['iscode'] == 'ARAMEX' || $express['iscode'] == 'TOLL' || $express['iscode'] == 'FEDEX'))
  4217. {
  4218. $lj = $this->ali->get_lj($fullordertt['number'],2,'订单修改');
  4219. if($lj != '1' && $lj != '订单不存在')
  4220. {
  4221. echo json_encode(array('msg'=>$lj,'success'=>false));exit;
  4222. }
  4223. }
  4224. **/
  4225. $warehouse = $this->warehouse->read($fullordertt['warehouse']);
  4226. $typeclass = $this->typeclass->read($fullordertt['state']);
  4227. $express = $this->express->read($fullordertt['express']);
  4228. $printtype = array(1=>'运单',2=>'发货单',3=>'不打印单据');
  4229. $teset['number']=$fullordertt['number'];
  4230. $teset['orderinfo']=$fullordertt['orderinfo'];
  4231. $teset['shop']=$fullordertt['shop'];
  4232. $teset['user']=$user['userid'];
  4233. $teset['ip']=$this->input->ip_address();
  4234. $teset['time']=time();
  4235. $teset['warehouse']=(isset($warehouse['title']))?$warehouse['title']:'未选择';
  4236. $teset['state']=(isset($typeclass['title']))?$typeclass['spare']:'未选择';
  4237. $teset['express']=(isset($express['title']))?$express['servicename']:'未选择';
  4238. $teset['printtype']=(isset($printtype[$fullordertt['printtype']]))?$printtype[$fullordertt['printtype']]:'未选择';
  4239. $teset['reviewtime']=($fullordertt['reviewtime'] > '0')?date('Y-m-d H:i:s',$fullordertt['reviewtime']):'无';
  4240. $teset['printtime']=($fullordertt['printtime'] > '0')?date('Y-m-d H:i:s',$fullordertt['printtime']):'无';
  4241. $teset['librarytime']=($fullordertt['librarytime'] > '0')?date('Y-m-d H:i:s',$fullordertt['librarytime']):'无';
  4242. $teset['shipremarks']=$fullordertt['shipremarks'];
  4243. $teset['fpdata']=$fullordertt['fpdata'];
  4244. $teset['oldwaybill']=$fullordertt['oldwaybill'];
  4245. $teset['oldprinttime']=$fullordertt['oldprinttime'];
  4246. if($fullordertt['printtype'] == 1)
  4247. {
  4248. if($fullordertt['waybill'] != '' && stripos($fullordertt['oldwaybill'],$fullordertt['waybill']) === false)
  4249. {
  4250. $teset['oldwaybill'] .= '-'.date('Ymd',$fullordertt['printtime']).'/'.$fullordertt['waybill'];
  4251. $teset['oldprinttime'] .= '-'.$fullordertt['printtime'];
  4252. }
  4253. }
  4254. $review = ($fullordertt['source']==1)?2:1;//线下单审核状态直接为待审核
  4255. if(!$this->fullreset->insert($teset))
  4256. {
  4257. echo json_encode(array('msg'=>'重置失败,请重试','success'=>true));exit;
  4258. }
  4259. if($this->fullordertt->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))
  4260. {
  4261. echo json_encode(array('msg'=>'重置成功!如需再次提交,请先保存、再提交','success'=>true));exit;
  4262. }
  4263. else
  4264. {
  4265. echo json_encode(array('msg'=>'重置失败,请重试','success'=>false));exit;
  4266. }
  4267. }
  4268. }
  4269. public function _expresstype()
  4270. {
  4271. $post = $this->input->post(NULL, TRUE);
  4272. if(isset($post['id']))
  4273. {
  4274. $id = $this->input->post('id',true);
  4275. $data = $this->express->read($id);
  4276. echo json_encode(array('msg'=>$data['type'],'success'=>true));exit;
  4277. }
  4278. }
  4279. public function _email($content,$data,$shopname)
  4280. {
  4281. $express = $this->express->read($data['express']);
  4282. $t= array('$userName','$orderid','$trackingNumber','$expressCompany','$contactPerson','$mobileNo','$zip','$recipientAddress');//需要被替换的内容
  4283. $h= array($data['client'],$data['orderinfo'],$data['waybill'],$express['servicename'],$data['name'],$data['phone'],$data['zipcode'],$data['address']);//替换的内容
  4284. $content = str_replace($t,$h,$content);
  4285. $this->load->library('email');
  4286. $config['protocol'] = 'smtp';
  4287. $config['smtp_host'] = 'smtpdm-ap-southeast-1.aliyun.com';
  4288. $config['smtp_port'] = 465;
  4289. $config['smtp_user'] = 'service@email.supernovahair.com';
  4290. $config['smtp_pass'] = 'LONGyihair374';
  4291. $config['smtp_crypto'] = 'ssl';
  4292. $config['crlf'] = "\r\n";
  4293. $config['newline'] = "\r\n";
  4294. $this->email->initialize($config);
  4295. $this->email->from('service@email.supernovahair.com',$shopname);
  4296. $this->email->to($data['email']);//收件
  4297. $this->email->subject('The product you purchased has a new progress');//标题
  4298. $this->email->message($content);//内容
  4299. if ( ! $this->email->send())
  4300. {
  4301. return 2;
  4302. }
  4303. else
  4304. {
  4305. return 1;
  4306. }
  4307. }
  4308. public function _error()
  4309. {
  4310. if(isset($_SESSION['api']))
  4311. {
  4312. $user = $this->user->get_api($_SESSION['api']);
  4313. $usp = $user;
  4314. $fgshop = "";$sid = "";
  4315. $user = explode('|',trim($user['shop'],'|'));
  4316. foreach ($user as $value)
  4317. {
  4318. $fgshop .= " shop = ".$value." or";
  4319. $sid .= " id = ".$value." or";
  4320. }
  4321. }
  4322. $post = $this->input->post(NULL, TRUE);
  4323. if(isset($post['page']))
  4324. {
  4325. $page = $this->input->post('page',true);
  4326. $perpage = $this->input->post('perpage',true);
  4327. $orderinfo = $this->input->post('orderinfo',true);
  4328. $waybill = $this->input->post('waybill',true);
  4329. $number = $this->input->post('number',true);
  4330. $timetk = $this->input->post('timetk',true);
  4331. $timetj = $this->input->post('timetj',true);
  4332. $timetk = strtotime($timetk);
  4333. $timetj = strtotime($timetj);
  4334. $where = "failed !='' and mergeid = 0 and print != 3 and (".rtrim($fgshop,'or').")";
  4335. if($orderinfo)
  4336. {
  4337. $where .= " and orderinfo = '$orderinfo'";
  4338. }
  4339. if($waybill)
  4340. {
  4341. $where .= " and waybill = '$waybill'";
  4342. }
  4343. if($number)
  4344. {
  4345. $where .= " and number = '$number'";
  4346. }
  4347. if($timetk && $timetj)
  4348. {
  4349. $timetj = $timetj+24*3600;
  4350. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  4351. }
  4352. //数据排序
  4353. $order_str = "dtime desc";
  4354. if(empty($page))
  4355. {
  4356. $start = 0;
  4357. $perpage = 1;
  4358. }
  4359. else
  4360. {
  4361. $start = ($page - 1)*$perpage;
  4362. }
  4363. $info_list = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,express,failed,operation',$order_str,$start,$perpage);
  4364. //格式化数据
  4365. foreach ($info_list as $key=>$value)
  4366. {
  4367. $ud = $this->fullordertt->read($value['id']);
  4368. $shop = $this->shop->read($value['shop']);
  4369. $info_list[$key]['shop'] = $shop['shopname'];
  4370. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullordertt/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'>".$value['orderinfo']."<p>";
  4371. $warehouse = $this->warehouse->read($value['type']);
  4372. $warehousetitle = $warehouse['title'];
  4373. if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  4374. $info_list[$key]['type'] = $warehousetitle;
  4375. if($value['express'] != 0)
  4376. {
  4377. $express = $this->express->read($value['express']);
  4378. $expressservicename = $express['servicename'];
  4379. if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
  4380. $info_list[$key]['express'] = $expressservicename;
  4381. }
  4382. else
  4383. {
  4384. $info_list[$key]['express'] = "无";
  4385. }
  4386. $x = "";
  4387. if($ud['review'] >4 && $ud['print'] == 1)
  4388. {
  4389. $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
  4390. }
  4391. else
  4392. {
  4393. $x = "<p class='ckn'><b class='fojzof' data-type='9' data-id='".$value['id']."'>关闭</b></p>";
  4394. }
  4395. $info_list[$key]['operation'] = $x;
  4396. }
  4397. $total = $this->fullordertt->find_count($where);
  4398. $pagenum = ceil($total/$perpage);
  4399. $over = $total-($start+$perpage);
  4400. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  4401. echo json_encode($rows);exit;
  4402. }
  4403. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  4404. $this->data['wlshop'] = $wlshop;
  4405. $this->data['express'] = $this->express->find_all();
  4406. $user = $this->user->get_api($_SESSION['api']);
  4407. $powerid = $this->power->read($user['power']);
  4408. $powertext = explode('|',trim($powerid['excelid'],'|'));
  4409. $pid = '';
  4410. foreach ($powertext as $v)
  4411. {
  4412. $pid .= " id = ".$v." or";
  4413. }
  4414. $fullorderexcel = $this->fullorderexcel->find_all("type = '100006' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板
  4415. $this->data['fullorderexcel'] = $fullorderexcel;
  4416. $this->_Template('fullordertt_error',$this->data);
  4417. }
  4418. public function _yc()
  4419. {
  4420. if(isset($_SESSION['api']))
  4421. {
  4422. $user = $this->user->get_api($_SESSION['api']);
  4423. $usp = $user;
  4424. $fgshop = "";$sid = "";
  4425. $user = explode('|',trim($user['shop'],'|'));
  4426. foreach ($user as $value)
  4427. {
  4428. $fgshop .= " shop = ".$value." or";
  4429. $sid .= " id = ".$value." or";
  4430. }
  4431. }
  4432. $post = $this->input->post(NULL, TRUE);
  4433. if(isset($post['page']))
  4434. {
  4435. $page = $this->input->post('page',true);
  4436. $perpage = $this->input->post('perpage',true);
  4437. $orderinfo = $this->input->post('orderinfo',true);
  4438. $waybill = $this->input->post('waybill',true);
  4439. $number = $this->input->post('number',true);
  4440. $timetk = $this->input->post('timetk',true);
  4441. $timetj = $this->input->post('timetj',true);
  4442. $timetk = strtotime($timetk);
  4443. $timetj = strtotime($timetj);
  4444. $where = "library = 2 and state = 214 and (".rtrim($fgshop,'or').")";
  4445. if($orderinfo)
  4446. {
  4447. $where .= " and orderinfo = '$orderinfo'";
  4448. }
  4449. if($waybill)
  4450. {
  4451. $where .= " and waybill = '$waybill'";
  4452. }
  4453. if($number)
  4454. {
  4455. $where .= " and number = '$number'";
  4456. }
  4457. if($timetk && $timetj)
  4458. {
  4459. $timetj = $timetj+24*3600;
  4460. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  4461. }
  4462. //数据排序
  4463. $order_str = "dtime desc";
  4464. if(empty($page))
  4465. {
  4466. $start = 0;
  4467. $perpage = 1;
  4468. }
  4469. else
  4470. {
  4471. $start = ($page - 1)*$perpage;
  4472. }
  4473. $info_list = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,state,dtime,express,waybill,library,operation',$order_str,$start,$perpage);
  4474. //格式化数据
  4475. foreach ($info_list as $key=>$value)
  4476. {
  4477. $ud = $this->fullordertt->read($value['id']);
  4478. $shop = $this->shop->read($value['shop']);
  4479. $info_list[$key]['shop'] = $shop['shopname'];
  4480. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullordertt/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'>".$value['orderinfo']."<p>";
  4481. $warehouse = $this->warehouse->read($value['type']);
  4482. $warehousetitle = $warehouse['title'];
  4483. if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  4484. $info_list[$key]['type'] = $warehousetitle;
  4485. if($value['express'] != 0)
  4486. {
  4487. $express = $this->express->read($value['express']);
  4488. $expressservicename = $express['servicename'];
  4489. if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
  4490. $info_list[$key]['express'] = $expressservicename;
  4491. }
  4492. else
  4493. {
  4494. $info_list[$key]['express'] = "无";
  4495. }
  4496. $typeclass = $this->typeclass->read($value['state']);
  4497. $info_list[$key]['state'] = "<font style='font-size: 13px;'>".$typeclass['spare']."</font>";
  4498. $info_list[$key]['dtime'] = '<p style="font-size: 13px;">'.date('Y-m-d',$ud['dtime']).'</p><p style="font-size: 13px;">'.date('H:i:s',$ud['dtime']).'</p>';
  4499. if($value['library'] == 1 && $ud['printtype'] == 3)
  4500. {
  4501. $info_list[$key]['library'] = "不需要";
  4502. }
  4503. else if($value['library'] == 1 && $ud['printtype'] != 3)
  4504. {
  4505. $info_list[$key]['library'] = "未出库";
  4506. }
  4507. else if($value['library'] == 2)
  4508. {
  4509. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'出库</p>';
  4510. }
  4511. else if($value['library'] == 3)
  4512. {
  4513. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['retreattime']).'</p><p>'.date('H:i:s',$ud['retreattime']).'退库</p>';
  4514. }
  4515. $info_list[$key]['operation'] = "<p class='ckn'><b class='ycyc' data-id='".$value['id']."'>移 出</b></p>";
  4516. }
  4517. $total = $this->fullordertt->find_count($where);
  4518. $pagenum = ceil($total/$perpage);
  4519. $over = $total-($start+$perpage);
  4520. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  4521. echo json_encode($rows);exit;
  4522. }
  4523. if(isset($post['id']))
  4524. {
  4525. $id = $this->input->post('id',true);
  4526. $data = $this->fullordertt->read($id);
  4527. if($this->fullordertt->save(array('state'=>217),$id))
  4528. {
  4529. echo json_encode(array('msg'=>'移除成功','id'=>$id,'success'=>true));exit;
  4530. }
  4531. else
  4532. {
  4533. echo json_encode(array('msg'=>"操作失败请重试",'success'=>false));exit;
  4534. }
  4535. }
  4536. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  4537. $this->data['wlshop'] = $wlshop;
  4538. $this->data['express'] = $this->express->find_all();
  4539. $user = $this->user->get_api($_SESSION['api']);
  4540. $powerid = $this->power->read($user['power']);
  4541. $powertext = explode('|',trim($powerid['excelid'],'|'));
  4542. $pid = '';
  4543. foreach ($powertext as $v)
  4544. {
  4545. $pid .= " id = ".$v." or";
  4546. }
  4547. $fullorderexcel = $this->fullorderexcel->find_all("type = '100006' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板
  4548. $this->data['fullorderexcel'] = $fullorderexcel;
  4549. $this->_Template('fullordertt_yc',$this->data);
  4550. }
  4551. //验证地址
  4552. public function _yzaddress()
  4553. {
  4554. $post = $this->input->post(NULL, TRUE);
  4555. if(isset($post['address']))
  4556. {
  4557. $address = $this->input->post('address',true);
  4558. $address2 = $this->input->post('address2',true);
  4559. $city = $this->input->post('city',true);
  4560. $province = $this->input->post('province',true);
  4561. $zipcode = $this->input->post('zipcode',true);
  4562. $barcode = $this->usps->get_address(array('address'=>$address,'address2'=>$address2,'city'=>$city,'province'=>$province,'zipcode'=>$zipcode));
  4563. echo $barcode;
  4564. }
  4565. }
  4566. //清除退货信息
  4567. public function _clearreturn()
  4568. {
  4569. $post = $this->input->post(NULL, TRUE);
  4570. if(isset($post['orderinfo']))
  4571. {
  4572. $orderinfo = $this->input->post('orderinfo',true);
  4573. $data = $this->fullordertt->get_orderinfo($orderinfo);
  4574. $fu = 'fullordertt';
  4575. if(!$data)
  4576. {
  4577. $data = $this->fullorder_smt->get_orderinfo($orderinfo);
  4578. $fu = 'fullorder_smt';
  4579. }
  4580. $this->$fu->save(array('library'=>'2','retreattime'=>'0','returndata'=>''),$data['id']);
  4581. echo json_encode(array('msg'=>'清除成功!','success'=>true));exit;
  4582. }
  4583. }
  4584. //订单退货
  4585. public function _return()
  4586. {
  4587. $post = $this->input->post(NULL, TRUE);
  4588. if(isset($post['orderinfo']))
  4589. {
  4590. $orderinfo = $this->input->post('orderinfo',true);
  4591. $data = $this->fullordertt->get_orderinfo($orderinfo);
  4592. $fu = 'fullordertt';
  4593. if(!$data)
  4594. {
  4595. $data = $this->fullorder_smt->get_orderinfo($orderinfo);
  4596. $fu = 'fullorder_smt';
  4597. }
  4598. if($data['library'] != 2){
  4599. echo json_encode(array('msg'=>'此单不是出库状态,不允许退货','success'=>false));exit;
  4600. }
  4601. $bctime = date('Ymd',time());
  4602. if($data['returndata'] != "")
  4603. {
  4604. echo json_encode(array('msg'=>'请求失败,已有Return Label信息!','success'=>false));exit;
  4605. }
  4606. $barcode = $this->usps->get_return($data);
  4607. // if(isset($barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription']))
  4608. // {
  4609. // echo json_encode(array('msg'=>$barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription'],'success'=>false));exit;
  4610. // }
  4611. // else if(isset($barcode['TrackingNumber']))
  4612. // {
  4613. // $pdf = $this->_pdf($barcode['ReturnLabel'],'t-'.$barcode['TrackingNumber'],$bctime);
  4614. // $read = 'PostalRouting:'.$barcode['PostalRouting'].' - TrackingNumber:<a href="/data/pdf/'.$bctime.'/'.'t-'.$barcode['TrackingNumber'].'.pdf" target="_blank">'.$barcode['TrackingNumber'].'</a>';
  4615. // $this->$fu->save(array('returndata'=>$read),$data['id']);
  4616. // echo json_encode(array('msg'=>'生成Return Label成功!','data'=>$read,'success'=>true));exit;
  4617. // }
  4618. // else
  4619. // {
  4620. // echo json_encode(array('msg'=>'请求失败,请稍后重试!','cs'=>$barcode,'success'=>false));exit;
  4621. // }
  4622. if(isset($barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription']))
  4623. {
  4624. echo json_encode(array('msg'=>$barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription'],'success'=>false));exit;
  4625. }
  4626. else if(isset($barcode['trackingNumber']))
  4627. {
  4628. $pdf = $this->_pdf($barcode['returnLabelImage'],'t-'.$barcode['trackingNumber'],$bctime);
  4629. $read = 'PostalRouting:'.$barcode['routingInformation'].' - TrackingNumber:<a href="/data/pdf/'.$bctime.'/'.'t-'.$barcode['trackingNumber'].'.pdf" target="_blank">'.$barcode['trackingNumber'].'</a>';
  4630. $this->$fu->save(array('returndata'=>$read),$data['id']);
  4631. echo json_encode(array('msg'=>'生成Return Label成功!','data'=>$read,'success'=>true));exit;
  4632. }
  4633. else
  4634. {
  4635. echo json_encode(array('msg'=>'请求失败,请稍后重试!'.json_encode($barcode),'cs'=>$barcode,'success'=>false));exit;
  4636. }
  4637. }
  4638. }
  4639. public function _pdf($pdf,$title,$bctime)
  4640. {
  4641. $pdf_path = './data/pdf/'.$bctime.'/';
  4642. $file_base64 = $pdf;
  4643. $file_base64 = preg_replace('/data:.*;base64,/i', '', $file_base64);
  4644. $file_base64 = base64_decode($file_base64);
  4645. if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建
  4646. file_put_contents($pdf_path.$title.'.pdf',$file_base64);
  4647. return $bctime;
  4648. }
  4649. public function _find($find)
  4650. {
  4651. preg_match_all('/\d+/',$find,$n);
  4652. $a = '';
  4653. foreach($n[0] as $v)
  4654. {
  4655. $a .= $v;
  4656. }
  4657. return $a;
  4658. }
  4659. public function _dqpm()
  4660. {
  4661. if(isset($_SESSION['api']))
  4662. {
  4663. $user = $this->user->get_api($_SESSION['api']);
  4664. $usp = $user;
  4665. $fgshop = "";$sid = "";
  4666. $usersp = explode('|',trim($user['shop'],'|'));
  4667. foreach ($usersp as $value)
  4668. {
  4669. $fgshop .= " shop = ".$value." or";
  4670. $sid .= " id = ".$value." or";
  4671. }
  4672. }
  4673. $post = $this->input->post(NULL, TRUE);
  4674. if(isset($post['page']))
  4675. {
  4676. $timetk = $this->input->post('timetk',true);
  4677. $timetj = $this->input->post('timetj',true);
  4678. $timetk = strtotime($timetk);
  4679. $timetj = strtotime($timetj);
  4680. $where = "mergeid = 0 and (".rtrim($fgshop,'or').")";
  4681. if($timetk && $timetj)
  4682. {
  4683. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  4684. }
  4685. //数据排序
  4686. $order_str = "dtime desc";
  4687. if(empty($page))
  4688. {
  4689. $start = 0;
  4690. $perpage = 1;
  4691. }
  4692. else
  4693. {
  4694. $start = ($page - 1)*$perpage;
  4695. }
  4696. $continentdata = '';
  4697. $continent = array();//陆地板块
  4698. $num = $this->fullordertt->find_count($where);//订单总数量
  4699. $country = $this->country->find_all('1=1','id,continent,ename,zname');
  4700. foreach ($country as $k=>$v)
  4701. {
  4702. $tc = $this->typeclass->read($v['continent']);
  4703. $continent[$v['continent']] = array(0=>$tc['title'],1=>0,2=>'');
  4704. }
  4705. foreach ($country as $k=>$v)
  4706. {
  4707. $n = $this->fullordertt->find_count($where.' and country = "'.$v['id'].'"');
  4708. $country[$k]['continent'] = $continent[$v['continent']][0];//此国家数量
  4709. $country[$k]['zname'] = '<a href="/fullordertt/dqpmprovince/'.$v['id'].'/'.$timetk.'/'.$timetj.'">'.$v['zname'].'</a>';//此国家数量
  4710. $country[$k]['num'] = $n;//此国家数量
  4711. $country[$k]['zb'] = (sprintf("%.4f",$n/$num)*100).'%';//此国家占比
  4712. $continent[$v['continent']]['1'] += $n;//此洲数量增加;
  4713. }
  4714. array_multisort(array_column($continent, '1'), SORT_DESC, $continent);
  4715. array_multisort(array_column($country, 'num'), SORT_DESC, $country);
  4716. foreach ($continent as $k=>$v)
  4717. {
  4718. $continentdata .= $v['0'].' 总量:'.$v['1'].' 占比:'.(sprintf("%.4f",$v['1']/$num)*100).'%&nbsp;&nbsp; - &nbsp;&nbsp;';
  4719. }
  4720. echo json_encode(array('ewnr'=>$continentdata,'rows'=>$country,'total'=>count($country),'over'=>0,'pagenum'=>1,'success'=>true));exit;
  4721. }
  4722. $this->_Template('fullordertt_dqpm',$this->data);
  4723. }
  4724. public function _dqpmprovince($arg_array)
  4725. {
  4726. if(isset($_SESSION['api']))
  4727. {
  4728. $user = $this->user->get_api($_SESSION['api']);
  4729. $usp = $user;
  4730. $fgshop = "";$sid = "";
  4731. $usersp = explode('|',trim($user['shop'],'|'));
  4732. foreach ($usersp as $value)
  4733. {
  4734. $fgshop .= " shop = ".$value." or";
  4735. $sid .= " id = ".$value." or";
  4736. }
  4737. }
  4738. $post = $this->input->post(NULL, TRUE);
  4739. if(isset($post['page']))
  4740. {
  4741. $country = $this->input->post('country',true);
  4742. $timetk = $this->input->post('timetk',true);
  4743. $timetj = $this->input->post('timetj',true);
  4744. $where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";
  4745. $province = array();
  4746. $city_list = $this->fullordertt->find_all($where,'id,province');
  4747. $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');
  4748. foreach ($city_list as $k=>$v)
  4749. {
  4750. $v['province'] = strtoupper(trim($v['province'],' '));
  4751. if(isset($ToState[$v['province']]))
  4752. {
  4753. $v['province'] = $ToState[$v['province']];
  4754. }
  4755. if(!isset($province[$v['province']]))
  4756. {
  4757. $province[$v['province']] = array('id'=>$v['id'],'province'=>'<a href="/fullordertt/ddpmdata/'.$country.'/'.$timetk.'/'.$timetj.'/'.strtoupper($v['province']).'">'.$v['province'].'</a>','num'=>0,'zb'=>'');
  4758. }
  4759. $province[$v['province']]['num'] += 1;
  4760. }
  4761. array_multisort(array_column($province, 'num'), SORT_DESC, $province);
  4762. $province = array_values($province);
  4763. foreach ($province as $k=>$v)
  4764. {
  4765. $province[$k]['zb'] = (sprintf("%.4f",$v['num']/count($city_list))*100).'%';
  4766. }
  4767. echo json_encode(array('rows'=>($province),'total'=>count($province),'over'=>0,'pagenum'=>1,'success'=>true));exit;
  4768. }
  4769. $this->data['arg_array'] = $arg_array;
  4770. $this->_Template('fullordertt_dqpmprovince',$this->data);
  4771. }
  4772. public function _ddpmdata($arg_array)
  4773. {
  4774. $arg_array[3] = str_replace('%20',' ',$arg_array[3]);
  4775. if(isset($_SESSION['api']))
  4776. {
  4777. $user = $this->user->get_api($_SESSION['api']);
  4778. $usp = $user;
  4779. $fgshop = "";$sid = "";
  4780. $usersp = explode('|',trim($user['shop'],'|'));
  4781. foreach ($usersp as $value)
  4782. {
  4783. $fgshop .= " shop = ".$value." or";
  4784. $sid .= " id = ".$value." or";
  4785. }
  4786. }
  4787. $post = $this->input->post(NULL, TRUE);
  4788. if(isset($post['page']))
  4789. {
  4790. $page = $this->input->post('page',true);
  4791. $perpage = $this->input->post('perpage',true);
  4792. $province = $this->input->post('province',true);
  4793. $timetk = $this->input->post('timetk',true);;
  4794. $timetj = $this->input->post('timetj',true);;
  4795. $country = $this->input->post('country',true);;
  4796. $where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";
  4797. if($province)
  4798. {
  4799. $where .= " and province = '$province'";
  4800. }
  4801. $order_str = "dtime desc";
  4802. if(empty($page))
  4803. {
  4804. $start = 0;
  4805. $perpage = 1;
  4806. }
  4807. else
  4808. {
  4809. $start = ($page - 1)*$perpage;
  4810. }
  4811. $info_list = $this->fullordertt->find_all($where,'id,orderinfo,number,shipremarks,shouldmoney',$order_str,$start,$perpage);
  4812. $total = $this->fullordertt->find_count($where);
  4813. $pagenum = ceil($total/$perpage);
  4814. $over = $total-($start+$perpage);
  4815. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  4816. echo json_encode($rows);exit;
  4817. }
  4818. $province = array();
  4819. $city_list = $this->fullordertt->find_all("mergeid = 0 and dtime > '$arg_array[1]' and dtime < '$arg_array[2]' and country = '$arg_array[0]' and (".rtrim($fgshop,'or').")",'province');
  4820. $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');
  4821. foreach ($city_list as $k=>$v)
  4822. {
  4823. $v['province'] = strtoupper(trim($v['province'],' '));
  4824. if(isset($ToState[$v['province']]))
  4825. {
  4826. $v['province'] = $ToState[$v['province']];
  4827. }
  4828. $province[$v['province']] = array('province'=>$v['province']);
  4829. }
  4830. $this->data['province'] = $province;
  4831. $this->data['arg_array'] = $arg_array;
  4832. $this->_Template('fullordertt_ddpmdata',$this->data);
  4833. }
  4834. public function _ddpmexcel($arg_array)
  4835. {
  4836. if(isset($_SESSION['api']))
  4837. {
  4838. $user = $this->user->get_api($_SESSION['api']);
  4839. $usp = $user;
  4840. $fgshop = "";$sid = "";
  4841. $usersp = explode('|',trim($user['shop'],'|'));
  4842. foreach ($usersp as $value)
  4843. {
  4844. $fgshop .= " shop = ".$value." or";
  4845. $sid .= " id = ".$value." or";
  4846. }
  4847. }
  4848. $province = $this->input->get('province',true);
  4849. $timetk = $arg_array[1];
  4850. $timetj = $arg_array[2];
  4851. $country = $arg_array[0];
  4852. $where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";
  4853. if($province)
  4854. {
  4855. $where .= " and province = '$province'";
  4856. }
  4857. $order_str = "dtime desc";
  4858. $info_list = $this->fullordertt->find_all($where,'orderinfo,number,shipremarks,shouldmoney',$order_str);
  4859. $country = $this->country->read($arg_array[0]);
  4860. $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  4861. $titlename = "<table border=1>
  4862. <tr><th colspan='4' align='left'><h3>".$title."<h3></th></tr>
  4863. <tr>
  4864. <td>订单号</td>
  4865. <td>订单编号</td>
  4866. <td>仓库品名</td>
  4867. <td>订单金额</td>
  4868. </tr>
  4869. </table>";
  4870. $filename = $title.".xls";
  4871. $tail = "\n";
  4872. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  4873. }
  4874. public function _statedc()
  4875. {
  4876. $user = $this->user->get_api($_SESSION['api']);
  4877. if($user)
  4878. {
  4879. $fgshop = "";$sid = "";
  4880. $user = explode('|',trim($user['shop'],'|'));
  4881. foreach ($user as $value)
  4882. {
  4883. $fgshop .= " shop = ".$value." or";
  4884. $sid .= " id = ".$value." or";
  4885. }
  4886. }
  4887. $post = $this->input->get(NULL, TRUE);
  4888. if(isset($post['timetk']))
  4889. {
  4890. $page = $this->input->get('page',true);
  4891. $perpage = $this->input->get('perpage',true);
  4892. $timetk = $this->input->get('timetk',true);
  4893. $timetj = $this->input->get('timetj',true);
  4894. $shop = $this->input->get('shop',true);
  4895. $source = $this->input->get('source',true);
  4896. $state = $this->input->get('state',true);
  4897. $review = $this->input->get('review',true);
  4898. $express = $this->input->get('express',true);
  4899. $fs = $this->input->get('fs',true);
  4900. $orderinfo = $this->input->get('orderinfo',true);
  4901. $number = $this->input->get('number',true);
  4902. $user = $this->input->get('user',true);
  4903. $name = $this->input->get('name',true);
  4904. $waybill = $this->input->get('waybill',true);
  4905. $expressstate = $this->input->get('expressstate',true);
  4906. $wltype = $this->input->get('wltype',true);
  4907. $wlyc = $this->input->get('wlyc',true);
  4908. $xztime = $this->input->get('xztime',true);
  4909. $timetk = strtotime($timetk);
  4910. $timetj = strtotime($timetj);
  4911. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  4912. if($timetk && $timetj)
  4913. {
  4914. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  4915. }
  4916. if($xztime == 'librarytime')
  4917. {
  4918. $order_str = "librarytime desc";
  4919. }
  4920. else if($xztime == 'dtime')
  4921. {
  4922. $order_str = "dtime desc";
  4923. }
  4924. if($shop)
  4925. {
  4926. $where .= " and shop = '$shop'";
  4927. }
  4928. if($source)
  4929. {
  4930. if($source == 11)
  4931. {
  4932. $where .= " and source != '1'";
  4933. }
  4934. else
  4935. {
  4936. $where .= " and source = '$source'";
  4937. }
  4938. }
  4939. if($fs)
  4940. {
  4941. if($fs == '2')
  4942. {
  4943. $where .= " and exstateerror != ''";
  4944. }
  4945. else
  4946. {
  4947. $where .= " and exstateerror = ''";
  4948. }
  4949. }
  4950. if($state)
  4951. {
  4952. $where .= " and state = '$state'";
  4953. }
  4954. if($review)
  4955. {
  4956. $where .= " and review = '$review'";
  4957. }
  4958. if($expressstate != "")
  4959. {
  4960. $where .= " and expressstate = '$expressstate'";
  4961. }
  4962. if($wltype != "")
  4963. {
  4964. $where .= " and wltype = '$wltype'";
  4965. }
  4966. if($wlyc != "")
  4967. {
  4968. $where .= " and wlyc = '$wlyc'";
  4969. }
  4970. if($express)
  4971. {
  4972. $where .= " and express = '$express'";
  4973. }
  4974. if($orderinfo)
  4975. {
  4976. $where .= " and orderinfo = '$orderinfo'";
  4977. }
  4978. if($number)
  4979. {
  4980. $where .= " and number = '$number'";
  4981. }
  4982. if($user)
  4983. {
  4984. $where .= " and user = '$user'";
  4985. }
  4986. if($name)
  4987. {
  4988. $where .= " and name = '$name'";
  4989. }
  4990. if($waybill)
  4991. {
  4992. $where .= " and waybill = '$waybill'";
  4993. }
  4994. if(empty($page))
  4995. {
  4996. $start = 0;
  4997. $perpage = 1;
  4998. }
  4999. else
  5000. {
  5001. $start = ($page - 1)*$perpage;
  5002. }
  5003. //取得信息列表
  5004. $info_list = $this->fullordertt->find_all($where,'shop,number,country,library,librarytime,expressstate,express,waybill,content,exstateerror,excontent',$order_str);
  5005. //格式化数据
  5006. foreach ($info_list as $key=>$value)
  5007. {
  5008. $shop = $this->shop->read($value['shop']);
  5009. $info_list[$key]['shop'] = $shop['shopname'];
  5010. $country = $this->country->read($value['country']);
  5011. $info_list[$key]['country'] = $country['name'];
  5012. //$state = $this->typeclass->read($value['state']);
  5013. //$info_list[$key]['state'] = $state['title'];
  5014. if($value['library'] == 1)
  5015. {
  5016. $info_list[$key]['library'] = "未出库";
  5017. }
  5018. else if($value['library'] == 2)
  5019. {
  5020. $info_list[$key]['library'] = "已出库";
  5021. }
  5022. else if($value['library'] == 3)
  5023. {
  5024. $info_list[$key]['library'] = "已退库";
  5025. }
  5026. if($value['librarytime'] == '0')
  5027. {
  5028. $info_list[$key]['librarytime'] = '无';
  5029. }
  5030. else
  5031. {
  5032. $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);
  5033. }
  5034. if($value['expressstate'] == 0)
  5035. {
  5036. $info_list[$key]['expressstate'] = "无信息";
  5037. }
  5038. else if($value['expressstate'] == 2)
  5039. {
  5040. $info_list[$key]['expressstate'] = "已取件";
  5041. }
  5042. else if($value['expressstate'] == 3)
  5043. {
  5044. $info_list[$key]['expressstate'] = "在途中";
  5045. }
  5046. else if($value['expressstate'] == 4)
  5047. {
  5048. $info_list[$key]['expressstate'] = "到达目的地国";
  5049. }
  5050. else if($value['expressstate'] == 5)
  5051. {
  5052. $info_list[$key]['expressstate'] = "即将派送";
  5053. }
  5054. else if($value['expressstate'] == 6)
  5055. {
  5056. $info_list[$key]['expressstate'] = "已签收";
  5057. }
  5058. else if($value['expressstate'] == 1)
  5059. {
  5060. $info_list[$key]['expressstate'] = "派送异常";
  5061. }
  5062. $express = $this->express->read($value['express']);
  5063. $info_list[$key]['express'] = $express['servicename'];
  5064. }
  5065. }
  5066. $title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5067. $titlename = "<table border=1>
  5068. <tr>
  5069. <td>店铺名称</td>
  5070. <td>编号</td>
  5071. <td>收件人国家</td>
  5072. <td>出库状态</td>
  5073. <td>发货时间</td>
  5074. <td>物流状态</td>
  5075. <td>快递公司</td>
  5076. <td>运单号</td>
  5077. <td>消息状态</td>
  5078. <td>错误提示</td>
  5079. <td>物流信息</td>
  5080. </tr>
  5081. </table>";
  5082. $filename = $title.".xls";
  5083. $tail = "\n";
  5084. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  5085. }
  5086. public function _statedcwl()
  5087. {
  5088. $user = $this->user->get_api($_SESSION['api']);
  5089. if($user)
  5090. {
  5091. $fgshop = "";$sid = "";
  5092. $user = explode('|',trim($user['shop'],'|'));
  5093. foreach ($user as $value)
  5094. {
  5095. $fgshop .= " shop = ".$value." or";
  5096. $sid .= " id = ".$value." or";
  5097. }
  5098. }
  5099. $post = $this->input->get(NULL, TRUE);
  5100. if(isset($post['timetk']))
  5101. {
  5102. $dowid = $this->input->get('a');
  5103. $wid = "";
  5104. if($dowid != "")
  5105. {
  5106. $id_arr = explode(',',rtrim($dowid,','));
  5107. $wid .= " id = 0 or";
  5108. foreach ($id_arr as $v)
  5109. {
  5110. $wid .= " id = '$v' or";
  5111. }
  5112. $wid = " and".rtrim($wid,'or');
  5113. }
  5114. $page = $this->input->get('page',true);
  5115. $perpage = $this->input->get('perpage',true);
  5116. $timetk = $this->input->get('timetk',true);
  5117. $timetj = $this->input->get('timetj',true);
  5118. $shop = $this->input->get('shop',true);
  5119. $expressstate = $this->input->get('expressstate',true);
  5120. $fs = $this->input->get('fs',true);
  5121. $state = $this->input->get('state',true);
  5122. $express = $this->input->get('express',true);
  5123. $orderinfo = $this->input->get('orderinfo',true);
  5124. $number = $this->input->get('number',true);
  5125. $waybill = $this->input->get('waybill',true);
  5126. $wlyc = $this->input->get('wlyc',true);
  5127. $wltype = $this->input->get('wltype',true);
  5128. $source = $this->input->get('source',true);
  5129. $xztime = $this->input->get('xztime',true);
  5130. $timetk = strtotime($timetk);
  5131. $timetj = strtotime($timetj);
  5132. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  5133. if($timetk && $timetj)
  5134. {
  5135. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  5136. }
  5137. if($xztime == 'librarytime')
  5138. {
  5139. $order_str = "librarytime desc";
  5140. }
  5141. else if($xztime == 'dtime')
  5142. {
  5143. $order_str = "dtime desc";
  5144. }
  5145. if($shop)
  5146. {
  5147. $where .= " and shop = '$shop'";
  5148. }
  5149. if($expressstate)
  5150. {
  5151. $where .= " and expressstate = '$expressstate'";
  5152. }
  5153. if($fs)
  5154. {
  5155. if($fs == '1')
  5156. {
  5157. $where .= " and wlcontent != ''";
  5158. }
  5159. if($fs == '2')
  5160. {
  5161. $where .= " and wlerror != ''";
  5162. }
  5163. if($fs == '3')
  5164. {
  5165. $where .= " and wlcontent = '' and shouldmoney > 100";
  5166. }
  5167. else if($fs == '4')
  5168. {
  5169. $where .= " and wltype = '1'";
  5170. }
  5171. }
  5172. if($state)
  5173. {
  5174. $where .= " and state = '$state'";
  5175. }
  5176. if($express)
  5177. {
  5178. $where .= " and express = '$express'";
  5179. }
  5180. if($orderinfo)
  5181. {
  5182. $where .= " and orderinfo = '$orderinfo'";
  5183. }
  5184. if($number)
  5185. {
  5186. $where .= " and number = '$number'";
  5187. }
  5188. if($waybill)
  5189. {
  5190. $where .= " and waybill = '$waybill'";
  5191. }
  5192. if($wlyc!='')
  5193. {
  5194. $where .= " and wlyc = '$wlyc'";
  5195. }
  5196. if($wltype!='')
  5197. {
  5198. $where .= " and wltype = '$wltype'";
  5199. }
  5200. if($source)
  5201. {
  5202. if($source == 1)
  5203. {
  5204. $where .= " and source = '$source'";
  5205. }
  5206. else
  5207. {
  5208. $where .= " and source != '1'";
  5209. }
  5210. }
  5211. $info_list = $this->fullordertt->find_all($where.$wid,'orderinfo,number,country,library,librarytime,expressstate,express,waybill,wlbz,orderremarks,shipremarks,wlfstime,email,phone,wlcontent,wlerror,excontent',$order_str);
  5212. //格式化数据
  5213. foreach ($info_list as $key=>$value)
  5214. {
  5215. $country = $this->country->read($value['country']);
  5216. $info_list[$key]['country'] = $country['name'];
  5217. //$state = $this->typeclass->read($value['state']);
  5218. //$info_list[$key]['state'] = $state['title'];
  5219. if($value['library'] == 1)
  5220. {
  5221. $info_list[$key]['library'] = "未出库";
  5222. }
  5223. else if($value['library'] == 2)
  5224. {
  5225. $info_list[$key]['library'] = "已出库";
  5226. }
  5227. else if($value['library'] == 3)
  5228. {
  5229. $info_list[$key]['library'] = "已退库";
  5230. }
  5231. if($value['librarytime'] == '0')
  5232. {
  5233. $info_list[$key]['librarytime'] = '无';
  5234. }
  5235. else
  5236. {
  5237. $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);
  5238. }
  5239. if($value['expressstate'] == 0)
  5240. {
  5241. $info_list[$key]['expressstate'] = "无信息";
  5242. }
  5243. else if($value['expressstate'] == 2)
  5244. {
  5245. $info_list[$key]['expressstate'] = "已取件";
  5246. }
  5247. else if($value['expressstate'] == 3)
  5248. {
  5249. $info_list[$key]['expressstate'] = "在途中";
  5250. }
  5251. else if($value['expressstate'] == 4)
  5252. {
  5253. $info_list[$key]['expressstate'] = "到达目的地国";
  5254. }
  5255. else if($value['expressstate'] == 5)
  5256. {
  5257. $info_list[$key]['expressstate'] = "即将派送";
  5258. }
  5259. else if($value['expressstate'] == 6)
  5260. {
  5261. $info_list[$key]['expressstate'] = "已签收";
  5262. }
  5263. else if($value['expressstate'] == 1)
  5264. {
  5265. $info_list[$key]['expressstate'] = "派送异常";
  5266. }
  5267. $info_list[$key]['wlfstime'] = date('Y-m-d H:i:s',$value['wlfstime']);
  5268. $express = $this->express->read($value['express']);
  5269. $info_list[$key]['express'] = $express['servicename'];
  5270. $info_list[$key]['excontent'] = str_replace('<br />','',$value['excontent']);
  5271. }
  5272. }
  5273. $title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5274. $titlename = "<table border=1>
  5275. <tr>
  5276. <td>订单号</td>
  5277. <td>编号</td>
  5278. <td>收件人国家</td>
  5279. <td>出库状态</td>
  5280. <td>出库时间</td>
  5281. <td>物流状态</td>
  5282. <td>快递公司</td>
  5283. <td>运单号</td>
  5284. <td>物流备注</td>
  5285. <td>订单备注</td>
  5286. <td>仓库品名</td>
  5287. <td>发送时间</td>
  5288. <td>邮箱</td>
  5289. <td>电话</td>
  5290. <td>邮件发送</td>
  5291. <td>错误提示</td>
  5292. <td>物流信息</td>
  5293. </tr>
  5294. </table>";
  5295. $filename = $title.".xls";
  5296. $tail = "\n";
  5297. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  5298. }
  5299. public function _waybillemail()
  5300. {
  5301. $user = $this->user->get_api($_SESSION['api']);
  5302. if($user)
  5303. {
  5304. $fgshop = "";$sid = "";
  5305. $user = explode('|',trim($user['shop'],'|'));
  5306. foreach ($user as $value)
  5307. {
  5308. $fgshop .= " shop = ".$value." or";
  5309. $sid .= " id = ".$value." or";
  5310. }
  5311. }
  5312. $post = $this->input->post(NULL, TRUE);
  5313. if(isset($post['page']))
  5314. {
  5315. $page = $this->input->post('page',true);
  5316. $perpage = $this->input->post('perpage',true);
  5317. $timetk = $this->input->post('timetk',true);
  5318. $timetj = $this->input->post('timetj',true);
  5319. $shop = $this->input->post('shop',true);
  5320. $expressstate = $this->input->post('expressstate',true);
  5321. $fs = $this->input->post('fs',true);
  5322. $state = $this->input->post('state',true);
  5323. $express = $this->input->post('express',true);
  5324. $orderinfo = $this->input->post('orderinfo',true);
  5325. $number = $this->input->post('number',true);
  5326. $waybill = $this->input->post('waybill',true);
  5327. $dlzemail = $this->input->post('dlzemail',true);
  5328. $xztime = $this->input->post('xztime',true);
  5329. $timetk = strtotime($timetk);
  5330. $timetj = strtotime($timetj);
  5331. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  5332. if($timetk && $timetj)
  5333. {
  5334. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  5335. }
  5336. $order_str = $xztime." desc";
  5337. if($shop)
  5338. {
  5339. $where .= " and shop = '$shop'";
  5340. }
  5341. if($expressstate)
  5342. {
  5343. $where .= " and expressstate = '$expressstate'";
  5344. }
  5345. if($state)
  5346. {
  5347. $where .= " and state = '$state'";
  5348. }
  5349. if($express)
  5350. {
  5351. $where .= " and express = '$express'";
  5352. }
  5353. if($orderinfo)
  5354. {
  5355. $where .= " and orderinfo = '$orderinfo'";
  5356. }
  5357. if($number)
  5358. {
  5359. $where .= " and number = '$number'";
  5360. }
  5361. if($waybill)
  5362. {
  5363. $where .= " and waybill = '$waybill'";
  5364. }
  5365. if($dlzemail != '')
  5366. {
  5367. $where .= " and dlzemail = '$dlzemail'";
  5368. }
  5369. if(empty($page))
  5370. {
  5371. $start = 0;
  5372. $perpage = 1;
  5373. }
  5374. else
  5375. {
  5376. $start = ($page - 1)*$perpage;
  5377. }
  5378. //取得信息列表
  5379. $info_list = $this->fullordertt->find_all($where,'id,shop,orderinfo,number,country,library,librarytime,express,waybill,dlzemail,dlzemailtime',$order_str,$start,$perpage);
  5380. //格式化数据
  5381. foreach ($info_list as $key=>$value)
  5382. {
  5383. $shop = $this->shop->read($value['shop']);
  5384. $info_list[$key]['shop'] = $shop['shopname'];
  5385. $country = $this->country->read($value['country']);
  5386. $info_list[$key]['country'] = $country['name'];
  5387. //$state = $this->typeclass->read($value['state']);
  5388. //$info_list[$key]['state'] = $state['title'];
  5389. if($value['library'] == 1)
  5390. {
  5391. $info_list[$key]['library'] = "未出库";
  5392. }
  5393. else if($value['library'] == 2)
  5394. {
  5395. $info_list[$key]['library'] = "已出库";
  5396. }
  5397. else if($value['library'] == 3)
  5398. {
  5399. $info_list[$key]['library'] = "已退库";
  5400. }
  5401. if($value['librarytime'] == '0')
  5402. {
  5403. $info_list[$key]['librarytime'] = '无';
  5404. }
  5405. else
  5406. {
  5407. $info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']);
  5408. }
  5409. $express = $this->express->read($value['express']);
  5410. $info_list[$key]['express'] = $express['servicename'];
  5411. if($value['dlzemail'] == '1')
  5412. {
  5413. $info_list[$key]['dlzemail'] = '发送成功';
  5414. }
  5415. else if ($value['dlzemail'] == '2')
  5416. {
  5417. $info_list[$key]['dlzemail'] = '发送失败';
  5418. }
  5419. else
  5420. {
  5421. $info_list[$key]['dlzemail'] = '';
  5422. }
  5423. $info_list[$key]['dlzemailtime'] = ($value['dlzemailtime']>0)?date('Y-m-d H:i:s',$value['dlzemailtime']):'';
  5424. }
  5425. $total = $this->fullordertt->find_count($where);
  5426. $pagenum = ceil($total/$perpage);
  5427. $over = $total-($start+$perpage);
  5428. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  5429. echo json_encode($rows);exit;
  5430. }
  5431. $notice = $this->notice->find_all("type = '2' and (".rtrim($fgshop,'or').")");
  5432. $this->data['notice'] = $notice;
  5433. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  5434. $this->data['wlshop'] = $wlshop;
  5435. $this->data['express'] = $this->express->find_all();
  5436. $this->_Template('fullordertt_waybillemail',$this->data);
  5437. }
  5438. public function _khdd()
  5439. {
  5440. $dt = 0;$fgshop = "shop = 0";$sid = 'id = 0';
  5441. if(isset($_SESSION['api']))
  5442. {
  5443. $user = $this->user->get_api($_SESSION['api']);
  5444. $usp = $user;
  5445. $fgshop = "";$sid = "";
  5446. $usersp = explode('|',trim($user['shop'],'|'));
  5447. foreach ($usersp as $value)
  5448. {
  5449. $fgshop .= " shop = ".$value." or";
  5450. $sid .= " id = ".$value." or";
  5451. }
  5452. if($user['vip'] == 1)
  5453. {
  5454. $vip = 1;
  5455. }
  5456. else
  5457. {
  5458. $vip = 0;
  5459. }
  5460. }
  5461. $post = $this->input->post(NULL, TRUE);
  5462. if(isset($_GET['excel']))
  5463. {
  5464. $page = $this->input->get('page',true);
  5465. $perpage = $this->input->get('perpage',true);
  5466. $warehouse = $this->input->get('warehouse',true);
  5467. $timetk = $this->input->get('timetk',true);
  5468. $timetj = $this->input->get('timetj',true);
  5469. $shop = $this->input->get('shop',true);
  5470. $source = $this->input->get('source',true);
  5471. $state = $this->input->get('state',true);
  5472. $review = $this->input->get('review',true);
  5473. $type = $this->input->get('type',true);
  5474. $express = $this->input->get('express',true);
  5475. $orderinfo = $this->input->get('orderinfo',true);
  5476. $user = $this->input->get('user',true);
  5477. $client = $this->input->get('name',true);
  5478. $waybill = $this->input->get('waybill',true);
  5479. $number = $this->input->get('number',true);
  5480. $email = $this->input->get('email',true);
  5481. $phone = $this->input->get('phone',true);
  5482. $dlz = $this->input->get('dlz',true);
  5483. $print = $this->input->get('print',true);
  5484. $library = $this->input->get('library',true);
  5485. $js = $this->input->get('js',true);
  5486. $exstate = $this->input->get('exstate',true);
  5487. $xztime = $this->input->get('xztime',true);
  5488. $libraryconfirm = $this->input->get('libraryconfirm',true);
  5489. $timetk = strtotime($timetk);
  5490. $timetj = strtotime($timetj);
  5491. $plorder = $this->input->get('pl',true);
  5492. $paypal = $this->input->get('paypal',true);
  5493. $zf = $this->input->get('zf',true);
  5494. $pay = $this->input->get('pay',true);
  5495. $excel = $this->input->get('excel',true);
  5496. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  5497. if($warehouse)
  5498. {
  5499. $where .= " and type = '$warehouse'";
  5500. }
  5501. if($timetk && $timetj)
  5502. {
  5503. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  5504. }
  5505. if($shop)
  5506. {
  5507. $where .= " and shop = '$shop'";
  5508. }
  5509. if($source)
  5510. {
  5511. if($source == '2d')
  5512. {
  5513. $where .= " and source >= '2'";
  5514. }
  5515. else
  5516. {
  5517. $where .= " and source = '$source'";
  5518. }
  5519. }
  5520. if($state)
  5521. {
  5522. $where .= " and state = '$state'";
  5523. }
  5524. if($review)
  5525. {
  5526. $where .= " and review = '$review'";
  5527. }
  5528. if($type)
  5529. {
  5530. $where .= " and type = '$type'";
  5531. }
  5532. if($express)
  5533. {
  5534. $where .= " and express = '$express'";
  5535. }
  5536. if($orderinfo)
  5537. {
  5538. $where .= " and orderinfo = '$orderinfo'";
  5539. }
  5540. if($user)
  5541. {
  5542. $where .= " and user = '$user'";
  5543. }
  5544. if($client)
  5545. {
  5546. $where .= " and client like '%$client%'";
  5547. }
  5548. if($waybill)
  5549. {
  5550. $where .= " and waybill = '$waybill'";
  5551. }
  5552. if($number)
  5553. {
  5554. $where .= " and number = '$number'";
  5555. }
  5556. if($email)
  5557. {
  5558. $where .= " and email = '$email'";
  5559. }
  5560. if($phone)
  5561. {
  5562. $where .= " and phone like '%$phone%'";
  5563. }
  5564. if($library)
  5565. {
  5566. $where .= " and library = '$library'";
  5567. }
  5568. if($print)
  5569. {
  5570. $where .= " and print = '$print'";
  5571. }
  5572. if($dlz != '')
  5573. {
  5574. $where .= " and dlz = '$dlz'";
  5575. }
  5576. if($js)
  5577. {
  5578. $where .= " and js = '$js'";
  5579. }
  5580. if($exstate)
  5581. {
  5582. $where .= " and exstate = '$exstate'";
  5583. }
  5584. if($libraryconfirm)
  5585. {
  5586. $where .= " and libraryconfirm = '$libraryconfirm'";
  5587. }
  5588. if($paypal)
  5589. {
  5590. $where .= " and paypal = '$paypal'";
  5591. }
  5592. if($pay)
  5593. {
  5594. $where .= " and pay = '$pay'";
  5595. }
  5596. if($zf)
  5597. {
  5598. if($zf == 1)
  5599. {
  5600. $where .= " and paypal not like '%-%-%-%'";
  5601. }
  5602. else
  5603. {
  5604. $where .= " and paypal like '%-%-%-%'";
  5605. }
  5606. }
  5607. if($plorder)
  5608. {
  5609. $plorderinfo = '';$plnumber = '';$pln = 0;
  5610. $plorder = explode(',',trim($plorder,','));
  5611. foreach ($plorder as $value)
  5612. {
  5613. if(is_numeric($value))
  5614. {
  5615. $plorderinfo .= " orderinfo = ".$value." or";
  5616. }
  5617. else if($value != '')
  5618. {
  5619. $plorderinfo .= " number = '".$value."' or";
  5620. }
  5621. }
  5622. if($pln > 0)
  5623. {
  5624. $where .= " and (".rtrim($plorderinfo,'or').") and (".rtrim($plnumber,'or').")";
  5625. }
  5626. else
  5627. {
  5628. $where .= " and (".rtrim($plorderinfo,'or').")";
  5629. }
  5630. }
  5631. //数据排序
  5632. $order_str = "dtime desc";
  5633. if(empty($page))
  5634. {
  5635. $start = 0;
  5636. $perpage = 1;
  5637. }
  5638. else
  5639. {
  5640. $start = ($page - 1)*$perpage;
  5641. }
  5642. if($excel == '1')
  5643. {
  5644. $shop = array();
  5645. $shopdata = $this->shop->find_all("type = '269'");
  5646. foreach ($shopdata as $v)
  5647. {
  5648. $shop[$v['id']] = array('t'=>$v['brandname'],'z'=>0,'l'=>0,'x'=>0);//店铺名称,总客户,老客户,新客户
  5649. }
  5650. $oldnumber = 0;$newnumber = 0;
  5651. $info_list = $this->db->query('select distinct shop,email from crowd_fullordertt where '.$where)->result_array();
  5652. foreach ($info_list as $key=>$v)
  5653. {
  5654. $shop[$v['shop']]['z'] += 1;
  5655. $num = $this->fullordertt->find_count("email = '".$v['email']."' and shop = '".$v['shop']."' and ".$xztime." < '$timetj'");
  5656. if($num > 1)
  5657. {
  5658. $shop[$v['shop']]['l'] += 1;
  5659. }
  5660. else
  5661. {
  5662. $shop[$v['shop']]['x'] += 1;
  5663. }
  5664. if(isset($v['email']) && $usp['excelpass'] == '1')
  5665. {
  5666. $emailpass = $this->setting->get_excelpass($v['email']);
  5667. $info_list[$key]['email'] = $emailpass;
  5668. }
  5669. }
  5670. $title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5671. $titlename = "<table border=1>
  5672. <tr>
  5673. <td>店铺</td>
  5674. <td>客户数</td>
  5675. <td>老客户数</td>
  5676. <td>新客户数</td>
  5677. </tr>
  5678. </table>";
  5679. $filename = $title.".xls";
  5680. $tail = "\n";
  5681. $this->excel->get_fz2($shop,$titlename,$filename,$tail);
  5682. }
  5683. else if($excel == '2' || $excel == '3')
  5684. {
  5685. $kh = array();
  5686. $info_list = $this->db->query('select distinct shop,email from crowd_fullordertt where email != "" and '.$where)->result_array();
  5687. foreach ($info_list as $key=>$v)
  5688. {
  5689. $k = $this->fullordertt->find_all("shop = '".$v['shop']."' and email = '".$v['email']."' and ".$xztime." < '$timetj'",'name,email,dtime,shouldmoney','dtime desc');
  5690. if($excel == 2 && count($k) > 1)
  5691. {
  5692. $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')));
  5693. }
  5694. if($excel == 3 && count($k) < 2)
  5695. {
  5696. $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')));
  5697. }
  5698. if(isset($v['email']) && $usp['excelpass'] == '1')
  5699. {
  5700. $emailpass = $this->setting->get_excelpass($v['email']);
  5701. $info_list[$key]['email'] = $emailpass;
  5702. }
  5703. }
  5704. $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5705. $titlename = "<table border=1>
  5706. <tr>
  5707. <td>名称</td>
  5708. <td>邮箱</td>
  5709. <td>最后购买时间</td>
  5710. <td>购买次数</td>
  5711. <td>购买总额</td>
  5712. </tr>
  5713. </table>";
  5714. $filename = $title.".xls";
  5715. $tail = "\n";
  5716. $this->excel->get_fz2($kh,$titlename,$filename,$tail);
  5717. }
  5718. else if($excel == '4' || $excel == '5')
  5719. {
  5720. $kh = array();
  5721. $info_list = $this->db->query('select distinct shop,email from crowd_fullordertt where email != "" and '.$where)->result_array();
  5722. foreach ($info_list as $key=>$value)
  5723. {
  5724. $k = $this->fullordertt->find_all("shop = '".$value['shop']."' and email = '".$value['email']."' and ".$xztime." < '$timetj'",'orderinfo,state,product,name,email,dtime,shouldmoney','dtime desc');
  5725. if($excel == 4 && count($k) > 1)
  5726. {
  5727. foreach ($k as $v)
  5728. {
  5729. $typeclass = $this->typeclass->read($v['state']);
  5730. $kh[] = array("'".$v['orderinfo'],$typeclass['spare'],$v['product'],$v['name'],$v['email'],date("Y-m-d H:i:s",$v['dtime']),$v['shouldmoney']);
  5731. }
  5732. }
  5733. if($excel == 5 && count($k) < 2)
  5734. {
  5735. if(!isset($k[0]['state']))
  5736. {
  5737. $typeclass = $k[0]['state'].'-数据字典无此信息';
  5738. }
  5739. else
  5740. {
  5741. $typeclass = $this->typeclass->read($k[0]['state']);
  5742. }
  5743. $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']);
  5744. }
  5745. if(isset($value['email']) && $usp['excelpass'] == '1')
  5746. {
  5747. $emailpass = $this->setting->get_excelpass($value['email']);
  5748. $info_list[$key]['email'] = $emailpass;
  5749. }
  5750. }
  5751. if($excel == '4'){
  5752. // $header = [
  5753. // [
  5754. // 'title'=>"订单号",
  5755. // 'width'=>0,//为0 默认为自动
  5756. // ],
  5757. // [
  5758. // 'title'=>"订单状态",
  5759. // 'width'=>0,//为0 默认为自动
  5760. // ],
  5761. // [
  5762. // 'title'=>"产品名",
  5763. // 'width'=>30,//为0 默认为自动
  5764. // ],
  5765. // [
  5766. // 'title'=>"客户名",
  5767. // 'width'=>0,//为0 默认为自动
  5768. // ],
  5769. // [
  5770. // 'title'=>"客户邮箱",
  5771. // 'width'=>0,//为0 默认为自动
  5772. // ],
  5773. // [
  5774. // 'title'=>"下单时间",
  5775. // 'width'=>0,//为0 默认为自动
  5776. // ],
  5777. // [
  5778. // 'title'=>"订单金额",
  5779. // 'width'=>0,//为0 默认为自动
  5780. // ],
  5781. // ];
  5782. // if(!empty($country['zname'])){
  5783. // $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5784. // }else{
  5785. // $title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5786. // }
  5787. // $filename = $title;
  5788. // $data = $kh;
  5789. // $this->excelnew->doHeadMerg($title,$filename,$header,$data);
  5790. $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5791. $titlename = "<table border=1>
  5792. <tr>
  5793. <td>订单号</td>
  5794. <td>订单状态</td>
  5795. <td>产品名</td>
  5796. <td>客户名</td>
  5797. <td>客户邮箱</td>
  5798. <td>下单时间</td>
  5799. <td>订单金额</td>
  5800. </tr>
  5801. </table>";
  5802. $filename = $title.".xls";
  5803. $tail = "\n";
  5804. $this->excel->get_fz2($kh,$titlename,$filename,$tail);
  5805. }else{
  5806. $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5807. $titlename = "<table border=1>
  5808. <tr>
  5809. <td>订单号</td>
  5810. <td>订单状态</td>
  5811. <td>产品名</td>
  5812. <td>客户名</td>
  5813. <td>客户邮箱</td>
  5814. <td>下单时间</td>
  5815. <td>订单金额</td>
  5816. </tr>
  5817. </table>";
  5818. $filename = $title.".xls";
  5819. $tail = "\n";
  5820. $this->excel->get_fz2($kh,$titlename,$filename,$tail);
  5821. }
  5822. }
  5823. }
  5824. }
  5825. public function _klarnadata()
  5826. {
  5827. $post = $this->input->post(NULL, TRUE);
  5828. if(isset($post['number']))
  5829. {
  5830. $number = $this->input->post('number',true);
  5831. $data = $this->fullordertt->get_number($number);
  5832. $shop = $this->shop->read($data['shop']);
  5833. $f = '';
  5834. if($data['pay'] == '23')
  5835. {
  5836. $url = 'https://api-na.klarna.com/ordermanagement/v1/orders/'.$data['paypal'];
  5837. $header[] = "Content-Type:application/json";
  5838. $header[] = "Authorization: Basic ".base64_encode($shop['klarnaname'].":".$shop['klarnapass']);
  5839. $ch = curl_init();
  5840. curl_setopt($ch, CURLOPT_URL, $url);
  5841. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5842. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  5843. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  5844. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  5845. $res = curl_exec($ch);
  5846. curl_close($ch);
  5847. $res = json_decode($res,true);
  5848. if(isset($res['fraud_status']) && $shop['klarnaname'] != '')
  5849. {
  5850. $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'];
  5851. }
  5852. }
  5853. else if($data['pay'] == '22' && $shop['paypalname'] != '')
  5854. {
  5855. $f = $this->paypal->data($data['paypal'],$shop);
  5856. }
  5857. else if(($data['pay'] == '26') && $shop['afterpayname'] != '')
  5858. {
  5859. $url = 'https://global-api.afterpay.com/v2/payments?ids='.$data['paypal'];
  5860. $header[] = "Accept:application/json";
  5861. $header[] = "User-Agent: Readme.io API Simulator'";
  5862. $header[] = "Authorization: Basic ".base64_encode($shop['afterpayname'].":".$shop['afterpaypass']);
  5863. $ch = curl_init();
  5864. curl_setopt($ch, CURLOPT_URL, $url);
  5865. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5866. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  5867. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  5868. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  5869. $res = curl_exec($ch);
  5870. curl_close($ch);
  5871. $res = json_decode($res,true);
  5872. if(isset($res['results'][0]['orderDetails']['consumer']['email']))
  5873. {
  5874. $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'];
  5875. $f = str_replace(',,',',',$f);
  5876. }
  5877. }
  5878. else if(($data['pay'] == '27') && $shop['clearpayname'] != '')
  5879. {
  5880. $url = 'https://global-api.afterpay.com/v2/payments?ids='.$data['paypal'];
  5881. $header[] = "Accept:application/json";
  5882. $header[] = "User-Agent: Readme.io API Simulator'";
  5883. $header[] = "Authorization: Basic ".base64_encode($shop['clearpayname'].":".$shop['clearpaypass']);
  5884. $ch = curl_init();
  5885. curl_setopt($ch, CURLOPT_URL, $url);
  5886. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5887. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  5888. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  5889. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  5890. $res = curl_exec($ch);
  5891. curl_close($ch);
  5892. $res = json_decode($res,true);
  5893. if(isset($res['results'][0]['orderDetails']['consumer']['email']))
  5894. {
  5895. $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'];
  5896. $f = str_replace(',,',',',$f);
  5897. }
  5898. }
  5899. else if($data['pay'] == '1211')
  5900. {
  5901. $url = 'https://api.stripe.com/v1/payment_intents/'.$data['paypal'];
  5902. $header[] = "Authorization:Bearer ".$shop['stripe'];
  5903. $ch = curl_init();
  5904. curl_setopt($ch, CURLOPT_URL, $url);
  5905. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5906. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  5907. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  5908. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  5909. $res = curl_exec($ch);
  5910. curl_close($ch);
  5911. $res = json_decode($res,true);
  5912. $f = '';
  5913. if(isset($res['shipping']['name']))
  5914. {
  5915. $line = ($res['shipping']['address']['line2'] != '')?$res['shipping']['address']['line1'].' '.$res['shipping']['address']['line2']:$res['shipping']['address']['line1'];
  5916. $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));
  5917. }
  5918. }
  5919. else
  5920. {
  5921. echo json_encode(array('msg'=>'此店铺没有对接信息','success'=>false));exit;
  5922. }
  5923. if($f != '')
  5924. {
  5925. if($this->fullordertt->save(array('klarnadata'=>$f),$data['id']))
  5926. {
  5927. echo json_encode(array('msg'=>'获取成功,请关闭此页重新打开','success'=>true));exit;
  5928. }
  5929. else
  5930. {
  5931. echo json_encode(array('msg'=>'写入失败,请重试','success'=>false));exit;
  5932. }
  5933. }
  5934. else
  5935. {
  5936. echo json_encode(array('msg'=>'获取失败,请稍后重试','cl'=>base64_encode($shop['afterpayname'].":".$shop['afterpaypass']),'a'=>$data['paypal'],'success'=>false));exit;
  5937. }
  5938. }
  5939. }
  5940. public function _kcyz($warehouse,$whlabel,$id,$shop,$number)
  5941. {
  5942. if(!$whlabel || $whlabel == '|')
  5943. {
  5944. return array('t'=>1,'m'=>json_encode(array('t'=>1,'msg'=>'请先添加产品信息!','success'=>false)));exit;
  5945. }
  5946. $w = $this->warehouse->read($warehouse);
  5947. if($w['zd'] != 1)
  5948. {
  5949. return 1;
  5950. }
  5951. $pp = explode('|',trim($whlabel,'|'));
  5952. $x = 0;$save = array();
  5953. foreach ($pp as $va)
  5954. {
  5955. $num = explode('-',$va);
  5956. if($number)
  5957. {
  5958. $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 = '')");//通用
  5959. $shopwhlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and (zd = '$number' or zd = '') and shop like '%,".$shop.",%'");//专属
  5960. }
  5961. else
  5962. {
  5963. $whlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and zd = '' and (shop IS NULL or shop = '')");//通用
  5964. $shopwhlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and zd = '' and shop like '%,".$shop.",%'");//专属
  5965. }
  5966. $x++;
  5967. if(count($whlabel)+count($shopwhlabel) < $num[1])
  5968. {
  5969. $save[] = $x-1;continue;//提前先加X不然出错,所以要减1
  5970. }
  5971. }
  5972. return $save;
  5973. }
  5974. public function _epod()
  5975. {
  5976. $post = $this->input->post(NULL, TRUE);
  5977. if(isset($post['number']))
  5978. {
  5979. $number = $this->input->post('number',true);
  5980. $data = $this->fullordertt->get_number($number);
  5981. if(is_file('./data/epod/'.date('Y',time()).'/epod-'.$data['waybill'].'.pdf'))
  5982. {
  5983. echo json_encode(array('msg'=>'http://'.$_SERVER['HTTP_HOST'].'/data/epod/'.date('Y',time()).'/epod-'.$data['waybill'].'.pdf','success'=>true));exit;
  5984. }
  5985. else
  5986. {
  5987. $epod = $this->dhl->get_epod($data);
  5988. if($epod['c'] == 1)
  5989. {
  5990. echo json_encode(array('msg'=>'http://'.$_SERVER['HTTP_HOST'].$epod['d'],'success'=>true));exit;
  5991. }
  5992. else
  5993. {
  5994. echo json_encode(array('msg'=>$epod['d'],'success'=>false));exit;
  5995. }
  5996. }
  5997. }
  5998. }
  5999. public function _zw($arg_array)
  6000. {
  6001. $arg_array = $arg_array[0];$fpdata = array();
  6002. $fullordertt = $this->fullordertt->read($arg_array);
  6003. $fullordertt['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$fullordertt['shipremarks']);
  6004. $fullordertt['parameter'] = str_replace(",","---",$fullordertt['parameter']);
  6005. $this->data['fullordertt'] = $fullordertt;
  6006. $this->data['countrys'] = $this->country->find_all();
  6007. $this->data['express'] = $this->express->find_all();
  6008. $warehouse = $this->warehouse->read($fullordertt['type']);
  6009. if(stripos($fullordertt['fpdata'],';') !== false)
  6010. {
  6011. $fpdata = explode(';',rtrim($fullordertt['fpdata'],';'));
  6012. foreach ($fpdata as $k=>$v)
  6013. {
  6014. $xxv = explode('|',$v);
  6015. if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)
  6016. {
  6017. $xxv['zd'] = "<p>已占单</p>";
  6018. $bdck = $warehouse['bdck'];
  6019. if(stripos($xxv[9],'~') !== false)
  6020. {
  6021. $dxxv = explode('~',trim($xxv[9],'~'));
  6022. foreach ($dxxv as $val)
  6023. {
  6024. $wzid = $this->$bdck->read(trim($val,$warehouse['hz']));
  6025. if($wzid['details'] != '')
  6026. {
  6027. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  6028. }
  6029. }
  6030. }
  6031. else
  6032. {
  6033. $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));
  6034. if($wzid['details'] != '')
  6035. {
  6036. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  6037. }
  6038. }
  6039. }
  6040. $fpdata[$k] = $xxv;
  6041. }
  6042. }
  6043. $this->data['fpdata'] = $fpdata;
  6044. $this->data['fpdata'] = $fpdata;
  6045. $thfpdataxs = array();
  6046. if($fullordertt['thfpdata'] != '')
  6047. {
  6048. $thfpdata = explode(';',trim($fullordertt['thfpdata'],';'));
  6049. foreach ($thfpdata as $k=>$v)
  6050. {
  6051. $thxs = explode('~',trim($v,'~'));
  6052. $thxs[0] = explode('|',trim($thxs[0],'|'));
  6053. $thxs[1] = explode('|',trim($thxs[1],'|'));
  6054. $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]);
  6055. }
  6056. }
  6057. $this->data['thfpdata'] = $thfpdataxs;
  6058. $shop = $this->shop->read($fullordertt['shop']);
  6059. $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
  6060. $is = 0;
  6061. if($shop['type'] == 269)//判断是否独立站,269是独立站
  6062. {
  6063. $is = 1;
  6064. }
  6065. $this->data['is'] = $is;
  6066. //单项开始
  6067. $warehouse = $this->warehouse->read($fullordertt['warehouse']);//发货仓库
  6068. $state = $this->typeclass->read($fullordertt['state']);//订单状态
  6069. $country = $this->country->read($fullordertt['country']);//国家
  6070. if($fullordertt['capital'] == 1)
  6071. {
  6072. $capital = '暂未支付';
  6073. }
  6074. else if($fullordertt['capital'] == 2)
  6075. {
  6076. $capital = '部分支付';
  6077. }
  6078. else if($fullordertt['capital'] == 3)
  6079. {
  6080. $capital = '全部支付';
  6081. }
  6082. if($fullordertt['printtype'] == 1)
  6083. {
  6084. $printtype = '运单';
  6085. }
  6086. else if($fullordertt['printtype'] == 2)
  6087. {
  6088. $printtype = '发货单';
  6089. }
  6090. else if($fullordertt['printtype'] == 3)
  6091. {
  6092. $printtype = '不打印单据';
  6093. }
  6094. else
  6095. {
  6096. $printtype = '未选择';
  6097. }
  6098. $this->data['warehouse'] = $warehouse['title'];
  6099. $this->data['state'] = $state['title'];
  6100. $this->data['capital'] = $capital;
  6101. $this->data['country'] = $country['name'];
  6102. $this->data['printtype'] = $printtype;
  6103. //单项结束
  6104. /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
  6105. $downwaybill = '';$dwls = array();
  6106. $oldwaybill = explode('-',ltrim($fullordertt['oldwaybill'],'-'));
  6107. if(isset($oldwaybill[0][1]))
  6108. {
  6109. $oldwaybill = array_reverse($oldwaybill); //调整顺序
  6110. foreach ($oldwaybill as $v)
  6111. {
  6112. $dw = explode('/',$v);
  6113. if(isset($dw[1]))
  6114. {
  6115. if(stripos($downwaybill,$dw[1]) === false)
  6116. {
  6117. $dwls[$dw[1]] = 1;
  6118. $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
  6119. }
  6120. }
  6121. }
  6122. }
  6123. if($fullordertt['printtype'] == 1)
  6124. {
  6125. if($fullordertt['waybill'] != '' && !isset($dwls[$fullordertt['waybill']]))
  6126. {
  6127. $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullordertt['printtime']).'/y-'.$fullordertt['waybill'].'.pdf" target="_blank">'.$fullordertt['waybill'].'</a>、'.$downwaybill;
  6128. }
  6129. }
  6130. $this->data['downwaybill'] = rtrim($downwaybill,'、');
  6131. /** 历史打印时间 **/
  6132. $printtime = '';
  6133. if($fullordertt['oldprinttime'])
  6134. {
  6135. $pte = explode('-',rtrim($fullordertt['oldprinttime'],'-'));
  6136. foreach ($pte as $v)
  6137. {
  6138. $printtime .= date('Y-m-d H:i:s',$v).'、';
  6139. }
  6140. }
  6141. $this->data['printtime'] = rtrim($printtime,'、');
  6142. $product = '';
  6143. $fullordertt['product'] = str_replace("'","",$fullordertt['product']);
  6144. if($fullordertt['link'] != '' && $fullordertt['source'] != '1')
  6145. {
  6146. $pt = explode(',',$fullordertt['product']);
  6147. $lk = explode(',',$fullordertt['link']);
  6148. for($i=0;$i<count($pt);$i++)
  6149. {
  6150. if(isset($lk[$i]))
  6151. {
  6152. $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);
  6153. }
  6154. else
  6155. {
  6156. $octs = '';
  6157. }
  6158. $a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];
  6159. //$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];
  6160. if(isset($lk[$i]))
  6161. {
  6162. $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';
  6163. }
  6164. else
  6165. {
  6166. $product .= ($product != '')?' , '.$a:$a;
  6167. }
  6168. }
  6169. }
  6170. else
  6171. {
  6172. $octs = $this->colourorderts->get_text($fullordertt['product']);
  6173. $a = $octs?'<font style="color:#F39">'.$fullordertt['product'].'</font>':$fullordertt['product'];
  6174. //$a = (stripos($fullordertt['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullordertt['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullordertt['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullordertt['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullordertt['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullordertt['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullordertt['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullordertt['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullordertt['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullordertt['product'].'</font>':$fullordertt['product'];
  6175. $product = $a;
  6176. }
  6177. $this->data['product'] = $product;
  6178. $out = $this->systemtransfer->find_all("number = '".$fullordertt['number']."'");
  6179. $outread = '';
  6180. if($out)
  6181. {
  6182. foreach ($out as $val)
  6183. {
  6184. $list = '';
  6185. $rk = explode('|',trim($val['rk'],'|'));
  6186. $rktime = explode('|',trim($val['rktime'],'|'));
  6187. $zw = array();
  6188. $t = $this->transfer->find_all("1=1");
  6189. foreach ($t as $v)
  6190. {
  6191. $zw[$v['id']] = $v['title'];
  6192. }
  6193. if($val['rk'] != '' && count($rk) > 0)
  6194. {
  6195. for($i=0;$i<count($rk);$i++)
  6196. {
  6197. if(!isset($rktime[$i]))
  6198. {
  6199. $list .= $zw[$cz[$i]];
  6200. }
  6201. else
  6202. {
  6203. $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';
  6204. }
  6205. }
  6206. }
  6207. $outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';
  6208. }
  6209. }
  6210. else
  6211. {
  6212. $systemwigsout = $this->systemwigsout->find_all("number = '".$fullordertt['number']."'");
  6213. $outread = array();
  6214. if($systemwigsout)
  6215. {
  6216. foreach ($systemwigsout as $v)
  6217. {
  6218. if($v['czwarehouse'] == 37)
  6219. {
  6220. $outread[] = '华荣厂';
  6221. }
  6222. else if($v['czwarehouse'] == 0)
  6223. {
  6224. $outread[] = '龙盈厂';
  6225. }
  6226. $cz = explode('|',trim($v['cz'],'|'));
  6227. $cztime = explode('|',trim($v['cztime'],'|'));
  6228. $zw = $this->transfer->get_list();
  6229. if($v['cz'] != '' && count($cz) > 0)
  6230. {
  6231. for($i=0;$i<count($cz);$i++)
  6232. {
  6233. if(!isset($cztime[$i]))
  6234. {
  6235. $outread[] = $zw[$cz[$i]].' -&gt; ';
  6236. }
  6237. else
  6238. {
  6239. $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -&gt; ';
  6240. }
  6241. }
  6242. $outread[] = '<br>';
  6243. }
  6244. }
  6245. }
  6246. }
  6247. $klarnacolor = '';
  6248. if($fullordertt['klarnadata'] !='')
  6249. {
  6250. $klarnadata = explode('|',$fullordertt['klarnadata']);
  6251. if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')
  6252. {
  6253. $klarnadata[1] = json_decode($klarnadata[1],true);
  6254. if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullordertt['shouldmoney'] && $fullordertt['pay'] == 1211)
  6255. {
  6256. $klarnacolor = 'style="color:#F00"';
  6257. }
  6258. }
  6259. else if($klarnadata[0]!=1 && $fullordertt['pay']!=26 && $fullordertt['pay']!=27 && $fullordertt['pay']!=1211)
  6260. {
  6261. $klarnacolor = 'style="color:#F00"';
  6262. }
  6263. if($fullordertt['pay'] == 23)//klarna
  6264. {
  6265. $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');
  6266. $ToState = array_flip($ToState);
  6267. $klarnadata3 = str_replace(' ','',$klarnadata[3]);
  6268. $city = str_replace(' ','',$fullordertt['city']);
  6269. $klarnadataaddress = explode($city,$klarnadata3);
  6270. if(isset($klarnadataaddress[1]))
  6271. {
  6272. $klarnadata3 = $city.$klarnadataaddress[1];
  6273. $klarnadatacolor = explode(',',$klarnadata3);
  6274. unset($klarnadatacolor[4]);
  6275. unset($klarnadatacolor[6]);
  6276. if(isset($ToState[$klarnadatacolor[1]]))
  6277. {
  6278. $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);
  6279. }
  6280. $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);
  6281. }
  6282. else
  6283. {
  6284. $klarnadata['color'] = $klarnadata3;
  6285. }
  6286. }
  6287. }
  6288. else
  6289. {
  6290. $klarnadata = '';
  6291. }
  6292. $p = explode('-',$fullordertt['paypal']);
  6293. $this->data['klarnacolor'] = $klarnacolor;
  6294. $this->data['klarnadata'] = $klarnadata;
  6295. $this->data['systemwigsout'] = $outread;
  6296. $this->_Template('fullordertt_zw',$this->data);
  6297. }
  6298. public function _dcdxyz()
  6299. {
  6300. $post = $this->input->get(NULL, TRUE);
  6301. if(isset($post['timetk']))
  6302. {
  6303. $timetk = $this->input->get('timetk',true);
  6304. $timetj = $this->input->get('timetj',true);
  6305. $timetk = strtotime($timetk);
  6306. $timetj = strtotime($timetj);
  6307. $where = "oldwaybill != ''";
  6308. if($timetk && $timetj)
  6309. {
  6310. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  6311. }
  6312. //数据排序
  6313. $order_str = "dtime desc";
  6314. //取得信息列表
  6315. $info_list = $this->fullordertt->find_all($where,'orderinfo,number,oldwaybill',$order_str);
  6316. $data = array();
  6317. foreach ($info_list as $key=>$value)
  6318. {
  6319. $ob = '';
  6320. $oldwaybill = explode('-',trim($value['oldwaybill'],'-'));
  6321. if(count($oldwaybill) < 2)
  6322. {
  6323. continue;
  6324. }
  6325. $oldwaybill = array_reverse($oldwaybill); //调整顺序
  6326. foreach ($oldwaybill as $v)
  6327. {
  6328. $dw = explode('/',$v);
  6329. if(isset($dw[1]))
  6330. {
  6331. $dwls[$dw[1]] = 1;
  6332. $ob .= $dw[1].'、';
  6333. }
  6334. }
  6335. $info_list[$key]['oldwaybill'] = trim($ob,'、');
  6336. $data[] = $info_list[$key];
  6337. }
  6338. $title = "多运单信息 ".date("Y-m-d");
  6339. $titlename = "<table border=1>
  6340. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  6341. <tr>
  6342. <td>订单号</td>
  6343. <td>编号</td>
  6344. <td>运单号</td>
  6345. </tr>
  6346. </table>";
  6347. $filename = $title.".xls";
  6348. $tail = "\n";
  6349. $this->excel->get_fz2($data,$titlename,$filename,$tail);
  6350. }
  6351. }
  6352. public function _thxz()
  6353. {
  6354. $post = $this->input->get(NULL, TRUE);
  6355. if(isset($post['timetk']))
  6356. {
  6357. $timetk = $this->input->get('timetk',true);
  6358. $timetj = $this->input->get('timetj',true);
  6359. $timetk = strtotime($timetk);
  6360. $timetj = strtotime($timetj);
  6361. $where = "returndata != ''";
  6362. if($timetk && $timetj)
  6363. {
  6364. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  6365. }
  6366. //数据排序
  6367. $order_str = "dtime desc";
  6368. //取得信息列表
  6369. $info_list = $this->fullordertt->find_all($where,'orderinfo,number,returndata',$order_str);
  6370. foreach ($info_list as $key=>$value)
  6371. {
  6372. $ydh = explode('">',$value['returndata']);
  6373. $ydh = explode('</a>',$ydh[1]);
  6374. $info_list[$key]['returndata'] = $ydh[0];
  6375. $time = explode('pdf/',$value['returndata']);
  6376. $time = explode('/',$time[1]);
  6377. $info_list[$key]['time'] = $time[0];
  6378. }
  6379. $title = "退货订单信息 ".date("Y-m-d");
  6380. $titlename = "<table border=1>
  6381. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  6382. <tr>
  6383. <td>订单号</td>
  6384. <td>编号</td>
  6385. <td>退货运单号</td>
  6386. <td>退货时间</td>
  6387. </tr>
  6388. </table>";
  6389. $filename = $title.".xls";
  6390. $tail = "\n";
  6391. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  6392. }
  6393. }
  6394. public function _ddcf()
  6395. {
  6396. $post = $this->input->post(NULL, TRUE);
  6397. if(isset($post['number']))
  6398. {
  6399. $number = $this->input->post('number',true);
  6400. $data = $this->fullordertt->get_number($number);
  6401. if(!$data)
  6402. {
  6403. echo json_encode(array('msg'=>'没有找到此订单','success'=>false));exit;
  6404. }
  6405. if($data['review'] != 1 && $data['review'] != 2)
  6406. {
  6407. echo json_encode(array('msg'=>'必须是 待审核 状态才能拆分','success'=>false));exit;
  6408. }
  6409. if($data['merge'] != 0)
  6410. {
  6411. echo json_encode(array('msg'=>'已合并的订单无法使用此拆分功能','success'=>false));exit;
  6412. }
  6413. $cfnum = explode('-',trim($number,'-'));
  6414. if(count($cfnum)> 4)
  6415. {
  6416. echo json_encode(array('msg'=>'只能在原单操作拆分','success'=>false));exit;
  6417. }
  6418. $num = $this->fullordertt->find_count("number like '".$number."%'");
  6419. $data['number'] = $data['number'].'-'.$num;
  6420. $data['orderinfo'] = $data['shop'].date('ymdHis',time()).rand(0,1);
  6421. $data['shouldmoney'] = 0;
  6422. $data['budget'] = 0;
  6423. $data['shipremarks'] = '';
  6424. $data['source'] = 1;
  6425. //$data['review'] = 2;
  6426. $data['extra_status'] = 1;//拆分的订单
  6427. unset($data['id']);
  6428. unset($data['jweight']);
  6429. unset($data['fpcount']);
  6430. unset($data['returndata']);
  6431. unset($data['oldwaybill']);
  6432. unset($data['waybill']);
  6433. unset($data['printtime']);
  6434. if($this->fullordertt->insert($data))
  6435. {
  6436. echo json_encode(array('msg'=>'拆分成功!新订单编号:'.$data['number'],'success'=>true));exit;
  6437. }
  6438. else
  6439. {
  6440. echo json_encode(array('msg'=>'拆分失败,请重试','success'=>false));exit;
  6441. }
  6442. }
  6443. }
  6444. public function _cf() //合并订单拆分
  6445. {
  6446. $post = $this->input->post(NULL, TRUE);
  6447. if(isset($post['id']))
  6448. {
  6449. $id = $this->input->post('id',true);
  6450. $b = $this->fullordertt->read($id);
  6451. $order = array();
  6452. if($b['merge'] == $b['id'])
  6453. {
  6454. $data = $this->fullordertt->find_all("merge = '".$b['merge']."'");
  6455. foreach ($data as $v)
  6456. {
  6457. $a = $this->fullordertthb->get_orderinfo($v['orderinfo']);
  6458. if($a)
  6459. {
  6460. $this->fullordertt->save($a,$v['id']);
  6461. }
  6462. $order[] = $v['id'];
  6463. }
  6464. echo json_encode(array('msg'=>'拆分成功!','d'=>$order,'success'=>true));exit;
  6465. }
  6466. else
  6467. {
  6468. echo json_encode(array('msg'=>'拆分条件错误!','success'=>false));exit;
  6469. }
  6470. }
  6471. }
  6472. public function _pljzzd()
  6473. {
  6474. $post = $this->input->post(NULL, TRUE);
  6475. if(isset($post['s']))
  6476. {
  6477. $id_arr = $this->input->post('s');
  6478. $id_arr = explode(',',$id_arr);
  6479. if(!$id_arr)
  6480. {
  6481. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  6482. }
  6483. //循环删除记录
  6484. $this->db->trans_begin();
  6485. foreach ($id_arr as $value)
  6486. {
  6487. $post = $this->fullordertt->read($value);
  6488. $hbw = explode('|',trim($post['whlabel'],'|'));
  6489. $hbf = explode(';',trim($post['fpdata'],';'));
  6490. foreach ($hbw as $k=>$val)
  6491. {
  6492. $w = explode('-',$val);
  6493. $f = explode('|',$hbf[$k]);
  6494. $w[2] = "DNOTO";
  6495. $f[9] = "DNOTO";
  6496. $hbf[$k] = implode("|",$f);
  6497. $hbw[$k] = implode("-",$w);
  6498. }
  6499. $w = $this->whlabel->find_all("zd = '".$post['number']."'");
  6500. foreach ($w as $k=>$val)
  6501. {
  6502. $this->whlabel->save(array('zd'=>''),$val['id']);
  6503. }
  6504. $fpdata = implode(";",$hbf).';';
  6505. $whlabel = '|'.implode("|",$hbw).'|';
  6506. $this->fullordertt->save(array('fpdata'=>$fpdata,'whlabel'=>$whlabel),$post['id']);
  6507. }
  6508. if ($this->db->trans_status() === FALSE)
  6509. {
  6510. $this->db->trans_rollback();
  6511. }
  6512. else
  6513. {
  6514. $this->db->trans_commit();
  6515. }
  6516. echo json_encode(array('del'=>$id_arr,'msg'=>'操作成功,已暂时隐藏,可继续操作其它订单,刷新即可显示!','success'=>true));
  6517. }
  6518. }
  6519. public function _cbtlabel($arg_array){
  6520. $id = $arg_array[0];
  6521. $info = $this->fullordertt->read($id);
  6522. if(empty($info)){
  6523. echo json_encode(array('msg'=>'订单不存在!','success'=>false));exit;
  6524. }
  6525. $extra_text = json_decode($info['extra_text'],true);
  6526. if(isset($extra_text['label_info'])){
  6527. echo json_encode(array('msg'=>'发货标签已执行,请勿重复操作!','success'=>false));exit;
  6528. }
  6529. $shop_info = $this->shop->read($info['shop']);
  6530. if(empty($shop_info)){
  6531. echo json_encode(array('msg'=>'店铺不存在!','success'=>false));exit;
  6532. }
  6533. $res = $this->express_tt->doCreateCBTLabel($info,$shop_info);
  6534. if($res['x'] == 0){
  6535. $msg = isset($res['Description'])?$res['Description']:$res['message'];
  6536. echo json_encode(array('msg'=>$msg,'success'=>false));exit;
  6537. }else{
  6538. echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
  6539. }
  6540. }
  6541. }