Fullordertt.php 234 KB

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