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