Fullorder_smt.php 96 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Fullorder_smt extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_fullorder_smt','fullorder_smt');
  7. $this->load->_model('Model_fullorder','fullorder');
  8. $this->load->_model('Model_fullordertt','fullordertt');
  9. $this->load->_model('Model_fullorderexcel','fullorderexcel');
  10. $this->load->_model('Model_shop','shop');
  11. $this->load->_model('Model_typeclass','typeclass');
  12. $this->load->_model('Model_express','express');
  13. $this->load->_model('Model_country','country');
  14. $this->load->_model('Model_productdescribe','productdescribe');
  15. $this->load->_model('Model_customs','customs');
  16. $this->load->_model('Model_detailed','detailed');
  17. $this->load->_model('Model_productdescription','productdescription');
  18. $this->load->_model('Model_logistics','logistics');
  19. $this->load->_model('Model_hl','hl');
  20. $this->load->_model('Model_excel','excel');
  21. $this->load->_model('Model_warehouse','warehouse');
  22. $this->load->_model('Model_customer','customer');
  23. $this->load->_model('Model_user','user');
  24. $this->load->_model('Model_dhl','dhl');
  25. $this->load->_model('Model_notice','notice');
  26. $this->load->_model('Model_api','api');
  27. }
  28. //定义方法的调用规则 获取URI第二段值
  29. public function _remap($arg,$arg_array)
  30. {
  31. if($arg == 'add')//添加
  32. {
  33. $this->_add();
  34. }
  35. else if($arg == 'edit')//修改
  36. {
  37. $this->_edit($arg_array);
  38. }
  39. else if($arg == 'readonly')//修改
  40. {
  41. $this->_readonly($arg_array);
  42. }
  43. else if($arg == 'readlist')
  44. {
  45. $this->_readlist();
  46. }
  47. else if($arg == 'del')//修改
  48. {
  49. $this->_del();
  50. }
  51. else if($arg == 'price')//价格明细
  52. {
  53. $this->_price();
  54. }
  55. else if($arg == 'customs')
  56. {
  57. $this->_customs();
  58. }
  59. else if($arg == 'express')
  60. {
  61. $this->_express();
  62. }
  63. else if($arg == 'hl')
  64. {
  65. $this->_hl();
  66. }
  67. else if($arg == 'repeat')
  68. {
  69. $this->_repeat();
  70. }
  71. else if($arg == 'operation')
  72. {
  73. $this->_operation();
  74. }
  75. else if($arg == 'merge')
  76. {
  77. $this->_merge();
  78. }
  79. else if($arg == 'fmexcel')
  80. {
  81. $this->_fmexcel();
  82. }
  83. else if($arg == 'fdexcel')
  84. {
  85. $this->_fdexcel();
  86. }
  87. else if($arg == 'fdfexcel')
  88. {
  89. $this->_fdfexcel();
  90. }
  91. else if($arg == 'excel')
  92. {
  93. $this->_excel();
  94. }
  95. else if($arg == 'exceldlz')
  96. {
  97. $this->_exceldlz();
  98. }
  99. else if($arg == 'evaluate')
  100. {
  101. $this->_evaluate();
  102. }
  103. else if($arg == 'state')
  104. {
  105. $this->_state();
  106. }
  107. else if($arg == 'review')
  108. {
  109. $this->_review();
  110. }
  111. else if($arg == 'black')
  112. {
  113. $this->_black();
  114. }
  115. else if($arg == 'ryf')
  116. {
  117. $this->_ryf();
  118. }
  119. else if($arg == 'expresstype')
  120. {
  121. $this->_expresstype();
  122. }
  123. else if($arg == 'fsstate')
  124. {
  125. $this->_fsstate();
  126. }
  127. else if($arg == 'power')
  128. {
  129. $this->_power();
  130. }
  131. else if($arg == 'error')
  132. {
  133. $this->_error();
  134. }
  135. else if($arg == 'dlzerror')
  136. {
  137. $this->_dlzerror();
  138. }
  139. else if($arg == 'dlz')
  140. {
  141. $this->_dlz();
  142. }
  143. else
  144. {
  145. $this->_index();
  146. }
  147. }
  148. //管理
  149. public function _index()
  150. {
  151. $dt = 0;
  152. if(isset($_SESSION['api']))
  153. {
  154. $user = $this->user->get_api($_SESSION['api']);
  155. $usp = $user;
  156. $fgshop = "";$sid = "";
  157. $user = explode('|',trim($user['shop'],'|'));
  158. foreach ($user as $value)
  159. {
  160. $fgshop .= " shop = ".$value." or";
  161. $sid .= " id = ".$value." or";
  162. }
  163. }
  164. $post = $this->input->post(NULL, TRUE);
  165. if(isset($post['page']))
  166. {
  167. $page = $this->input->post('page',true);
  168. $perpage = $this->input->post('perpage',true);
  169. $warehouse = $this->input->post('warehouse',true);
  170. $xztime = $this->input->post('xztime',true);
  171. $timetk = $this->input->post('timetk',true);
  172. $timetj = $this->input->post('timetj',true);
  173. $shop = $this->input->post('shop',true);
  174. $source = $this->input->post('source',true);
  175. $state = $this->input->post('state',true);
  176. $review = $this->input->post('review',true);
  177. $type = $this->input->post('type',true);
  178. $express = $this->input->post('express',true);
  179. $orderinfo = $this->input->post('orderinfo',true);
  180. $user = $this->input->post('user',true);
  181. $client = $this->input->post('name',true);
  182. $waybill = $this->input->post('waybill',true);
  183. $number = $this->input->post('number',true);
  184. $email = $this->input->post('email',true);
  185. $dlz = $this->input->post('dlz',true);
  186. $print = $this->input->post('print',true);
  187. $library = $this->input->post('library',true);
  188. $timetk = strtotime($timetk)+12*3600;
  189. $timetj = strtotime($timetj)+12*3600;
  190. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  191. if($warehouse)
  192. {
  193. $where .= " and type = '$warehouse'";
  194. }
  195. if($timetk && $timetj)
  196. {
  197. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  198. }
  199. if($shop)
  200. {
  201. $where .= " and shop = '$shop'";
  202. }
  203. if($source)
  204. {
  205. $where .= " and source = '$source'";
  206. }
  207. if($state)
  208. {
  209. $where .= " and state = '$state'";
  210. }
  211. if($review)
  212. {
  213. $where .= " and review = '$review'";
  214. }
  215. if($type)
  216. {
  217. $where .= " and type = '$type'";
  218. }
  219. if($express)
  220. {
  221. $where .= " and express = '$express'";
  222. }
  223. if($orderinfo)
  224. {
  225. $where .= " and orderinfo = '$orderinfo'";
  226. }
  227. if($user)
  228. {
  229. $where .= " and user = '$user'";
  230. }
  231. if($client)
  232. {
  233. $where .= " and client like '%$client%'";
  234. }
  235. if($waybill)
  236. {
  237. $where .= " and waybill = '$waybill'";
  238. }
  239. if($number)
  240. {
  241. $where .= " and number = '$number'";
  242. }
  243. if($email)
  244. {
  245. $where .= " and email = '$email'";
  246. }
  247. if($library)
  248. {
  249. $where .= " and library = '$library'";
  250. }
  251. if($print)
  252. {
  253. $where .= " and print = '$print'";
  254. }
  255. if($dlz != '')
  256. {
  257. $where .= " and dlz = '$dlz'";
  258. }
  259. //数据排序
  260. $order_str = "numberpx desc";
  261. if(empty($page))
  262. {
  263. $start = 0;
  264. $perpage = 1;
  265. }
  266. else
  267. {
  268. $start = ($page - 1)*$perpage;
  269. }
  270. //取得信息列表id,shop,type,source,user,orderinfo,number,name,state,buytime,clientremarks,review,print,library,libraryconfirm,express,waybill,orderremarks,black
  271. $info_list = $this->fullorder_smt->find_all($where,'id,shop,type,orderinfo,number,client,state,buytime,libraryconfirm,express,waybill,orderremarks,reviewremarks,printnumber,library,fpdata,black,clientremarks',$order_str,$start,$perpage);
  272. //格式化数据
  273. foreach ($info_list as $key=>$value)
  274. {
  275. $ud = $this->fullorder_smt->read($value['id']);
  276. $ud['address'] = str_replace("'","’",$ud['address']);
  277. $ud['name'] = str_replace("'","’",$ud['name']);
  278. $customer = $this->customer->get_email($ud['email'],$value['shop']);
  279. $customerb = $this->customer->get_shopdata($ud['name'],$ud['email'],$ud['address'],$value['shop']);
  280. //$a = array_column($customer, 'email'); //三维找其中健的数组
  281. //$a = array_flip($a); //键和值调换
  282. $shop = $this->shop->read($value['shop']);
  283. $info_list[$key]['shop'] = $shop['shopname'];
  284. //$info_list[$key]['user'] = $shop['shopuser'];
  285. $warehouse = $this->warehouse->read($value['type']);
  286. $warehousetitle = $warehouse['title'];
  287. if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  288. $info_list[$key]['type'] = $warehousetitle;
  289. $typeclass = $this->typeclass->read($value['state']);
  290. $info_list[$key]['state'] = $typeclass['spare'];
  291. if($ud['source'] == 1) //线下单用订单时间,其他用付款时间
  292. {
  293. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$ud['dtime']).'</p><p>'.date('H:i:s',$ud['dtime']).'</p>';
  294. }
  295. else
  296. {
  297. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$value['buytime']+$dt).'</p><p>'.date('H:i:s',$value['buytime']+$dt).'</p>';
  298. }
  299. if($ud['dlz'] == 1)
  300. {
  301. $dlz = "<p>独立站已更新</p>";
  302. }
  303. else if($ud['dlz'] == 3)
  304. {
  305. $dlz = "<p>不需要更新</p>";
  306. }
  307. else if($ud['dlz'] == 2)
  308. {
  309. $dlz = "<p style='color:#C3C'>独立站更新失败</p>";
  310. }
  311. else
  312. {
  313. $dlz = "";
  314. }
  315. if($value['waybill'] != "")
  316. {
  317. $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz;
  318. }
  319. if($value['express'] != 0)
  320. {
  321. $express = $this->express->read($value['express']);
  322. $expressservicename = $express['servicename'];
  323. if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
  324. $info_list[$key]['express'] = $expressservicename;
  325. }
  326. else
  327. {
  328. $info_list[$key]['express'] = "无";
  329. }
  330. $x = "";
  331. if($value['libraryconfirm'] == 2 && $ud['review'] > 4 && $ud['library'] == 1)
  332. {
  333. $x = "<p class='ckn'><b class='fojz' data-type='1'>禁止发货</b></p>";
  334. }
  335. else if(($ud['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1)
  336. {
  337. $x = "<p class='ckn'><b class='fojzof' data-type='6' data-id='".$value['id']."'>允许发货</b></p>";
  338. }
  339. if(($ud['review'] > 4) && $ud['print'] == 2)
  340. {
  341. $x = "<p class='ckn'><b class='fojzof' data-type='7' data-id='".$value['id']."'>禁止打印</b></p>";
  342. }
  343. else if($ud['review'] >4 && $ud['print'] == 1)
  344. {
  345. $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
  346. }
  347. if($value['waybill'] == "" && $ud['review'] > 4)
  348. {
  349. $x = $x."<p><b class='kn' data-type='2'>填写运单</b></p>";
  350. }
  351. else if($value['waybill'] != "" && $ud['review'] > 4)
  352. {
  353. $x = $x."<p><b class='kn' data-type='2'>修改运单</b></p>";
  354. }
  355. if(($ud['review'] == 1 || $ud['review'] == 3) && $ud['express'] > 0 && $ud['dtsbjz'] != 0 && $ud['ts'] != 0 && $ud['zsbjz'] != 0 && $ud['zjs'] != 0 && $ud['ts'] != 0)
  356. {
  357. $x = $x."<p><b class='focz' data-type='2' data-id='".$value['id']."'>提交审核</b></p>";
  358. }
  359. if($value['black'] == 0)
  360. {
  361. $x = $x."<p><b class='black' data-type='4' data-id='".$value['id']."'>加黑名单</b></p>";
  362. }
  363. $info_list[$key]['black'] = $x;
  364. $tly = "";
  365. if($value['clientremarks'] != "")
  366. {
  367. $tly = "<p style='color:#FF3333'>有客户留言</p>";
  368. }
  369. if($value['state'] == 217)
  370. {
  371. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder_smt/readonly/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
  372. }
  373. else
  374. {
  375. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder_smt/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
  376. }
  377. if($value['library'] == 1)
  378. {
  379. $info_list[$key]['library'] = "未出库";
  380. }
  381. else if($value['library'] == 2)
  382. {
  383. $info_list[$key]['library'] = "已出库";
  384. }
  385. else if($value['library'] == 3)
  386. {
  387. $info_list[$key]['library'] = "退库";
  388. }
  389. if($value['fpdata'] != "")
  390. {
  391. $info_list[$key]['fpdata'] = "有";
  392. }
  393. else
  394. {
  395. $info_list[$key]['fpdata'] = "没有";
  396. }
  397. }
  398. $total = $this->fullorder_smt->find_count($where);
  399. $pagenum = ceil($total/$perpage);
  400. $over = $total-($start+$perpage);
  401. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  402. echo json_encode($rows);exit;
  403. }
  404. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  405. $this->data['wlshop'] = $wlshop;
  406. $this->data['express'] = $this->express->find_all();
  407. $fullorderexcel = $this->fullorderexcel->find_all('type=1','*','idorder desc');//导出模板
  408. $this->data['fullorderexcel'] = $fullorderexcel;
  409. $error = $this->fullorder_smt->find_count("print = 1 and failed !='' and mergeid = 0 and waybill = '' and (".rtrim($fgshop,'or').")");
  410. $this->data['error'] = $error;
  411. $this->_Template('fullorder_smt',$this->data);
  412. }
  413. //管理
  414. public function _dlz()
  415. {
  416. $dt = 0;
  417. if(isset($_SESSION['api']))
  418. {
  419. $user = $this->user->get_api($_SESSION['api']);
  420. $usp = $user;
  421. $fgshop = "";$sid = "";
  422. $user = explode('|',trim($user['shop'],'|'));
  423. foreach ($user as $value)
  424. {
  425. $fgshop .= " shop = ".$value." or";
  426. $sid .= " id = ".$value." or";
  427. }
  428. }
  429. $post = $this->input->post(NULL, TRUE);
  430. if(isset($post['page']))
  431. {
  432. $page = $this->input->post('page',true);
  433. $perpage = $this->input->post('perpage',true);
  434. $warehouse = $this->input->post('warehouse',true);
  435. $xztime = $this->input->post('xztime',true);
  436. $timetk = $this->input->post('timetk',true);
  437. $timetj = $this->input->post('timetj',true);
  438. $shop = $this->input->post('shop',true);
  439. $source = $this->input->post('source',true);
  440. $state = $this->input->post('state',true);
  441. $review = $this->input->post('review',true);
  442. $type = $this->input->post('type',true);
  443. $express = $this->input->post('express',true);
  444. $orderinfo = $this->input->post('orderinfo',true);
  445. $user = $this->input->post('user',true);
  446. $client = $this->input->post('name',true);
  447. $waybill = $this->input->post('waybill',true);
  448. $number = $this->input->post('number',true);
  449. $email = $this->input->post('email',true);
  450. $dlz = $this->input->post('dlz',true);
  451. $print = $this->input->post('print',true);
  452. $library = $this->input->post('library',true);
  453. $timetk = strtotime($timetk)+12*3600;
  454. $timetj = strtotime($timetj)+12*3600;
  455. $where = "mergeid = 0 and type = 5 and review = 6 and state != 217 and state != 214 and (".rtrim($fgshop,'or').")";
  456. if($warehouse)
  457. {
  458. $where .= " and type = '$warehouse'";
  459. }
  460. if($timetk && $timetj)
  461. {
  462. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  463. }
  464. if($shop)
  465. {
  466. $where .= " and shop = '$shop'";
  467. }
  468. if($source)
  469. {
  470. $where .= " and source = '$source'";
  471. }
  472. if($state)
  473. {
  474. $where .= " and state = '$state'";
  475. }
  476. if($review)
  477. {
  478. $where .= " and review = '$review'";
  479. }
  480. if($type)
  481. {
  482. $where .= " and type = '$type'";
  483. }
  484. if($express)
  485. {
  486. $where .= " and express = '$express'";
  487. }
  488. if($orderinfo)
  489. {
  490. $where .= " and orderinfo = '$orderinfo'";
  491. }
  492. if($user)
  493. {
  494. $where .= " and user = '$user'";
  495. }
  496. if($client)
  497. {
  498. $where .= " and client like '%$client%'";
  499. }
  500. if($waybill)
  501. {
  502. $where .= " and waybill = '$waybill'";
  503. }
  504. if($number)
  505. {
  506. $where .= " and number = '$number'";
  507. }
  508. if($email)
  509. {
  510. $where .= " and email = '$email'";
  511. }
  512. if($library)
  513. {
  514. $where .= " and library = '$library'";
  515. }
  516. if($print)
  517. {
  518. if($print = 2)
  519. {
  520. $where .= " and waybill = ''";
  521. }
  522. $where .= " and print = '$print'";
  523. }
  524. if($dlz != '')
  525. {
  526. $where .= " and dlz = '$dlz'";
  527. }
  528. //数据排序
  529. $order_str = "dtime desc";
  530. if(empty($page))
  531. {
  532. $start = 0;
  533. $perpage = 1;
  534. }
  535. else
  536. {
  537. $start = ($page - 1)*$perpage;
  538. }
  539. //取得信息列表id,shop,type,source,user,orderinfo,number,name,state,buytime,clientremarks,review,print,library,libraryconfirm,express,waybill,orderremarks,black
  540. $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,client,state,buytime,libraryconfirm,express,waybill,orderremarks,reviewremarks,printnumber,library,black,clientremarks',$order_str,$start,$perpage);
  541. //格式化数据
  542. foreach ($info_list as $key=>$value)
  543. {
  544. $ud = $this->fullorder->read($value['id']);
  545. $ud['address'] = str_replace("'","’",$ud['address']);
  546. $ud['name'] = str_replace("'","’",$ud['name']);
  547. $customer = $this->customer->get_email($ud['email'],$value['shop']);
  548. $customerb = $this->customer->get_shopdata($ud['name'],$ud['email'],$ud['address'],$value['shop']);
  549. //$a = array_column($customer, 'email'); //三维找其中健的数组
  550. //$a = array_flip($a); //键和值调换
  551. $shop = $this->shop->read($value['shop']);
  552. $info_list[$key]['shop'] = $shop['shopname'];
  553. //$info_list[$key]['user'] = $shop['shopuser'];
  554. $warehouse = $this->warehouse->read($value['type']);
  555. $warehousetitle = $warehouse['title'];
  556. if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  557. $info_list[$key]['type'] = $warehousetitle;
  558. $typeclass = $this->typeclass->read($value['state']);
  559. $info_list[$key]['state'] = $typeclass['spare'];
  560. if($ud['source'] == 1) //线下单用订单时间,其他用付款时间
  561. {
  562. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$ud['dtime']).'</p><p>'.date('H:i:s',$ud['dtime']).'</p>';
  563. }
  564. else
  565. {
  566. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$value['buytime']+$dt).'</p><p>'.date('H:i:s',$value['buytime']+$dt).'</p>';
  567. }
  568. if($value['waybill'] != "")
  569. {
  570. $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>";
  571. }
  572. if($value['express'] != 0)
  573. {
  574. $express = $this->express->read($value['express']);
  575. $expressservicename = $express['servicename'];
  576. if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
  577. $info_list[$key]['express'] = $expressservicename;
  578. }
  579. else
  580. {
  581. $info_list[$key]['express'] = "无";
  582. }
  583. $x = "";
  584. if($value['libraryconfirm'] == 2 && $ud['review'] > 4 && $ud['library'] == 1)
  585. {
  586. $x = "<p class='ckn'><b class='fojz' data-type='1'>禁止发货</b></p>";
  587. }
  588. else if(($ud['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1)
  589. {
  590. $x = "<p class='ckn'><b class='fojzof' data-type='6' data-id='".$value['id']."'>允许发货</b></p>";
  591. }
  592. if(($ud['review'] > 4) && $ud['print'] == 2)
  593. {
  594. $x = "<p class='ckn'><b class='fojzof' data-type='7' data-id='".$value['id']."'>禁止打印</b></p>";
  595. }
  596. else if($ud['review'] >4 && $ud['print'] == 1)
  597. {
  598. $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
  599. }
  600. if($value['waybill'] == "" && $ud['review'] > 4)
  601. {
  602. $x = $x."<p><b class='kn' data-type='2'>填写运单</b></p>";
  603. }
  604. else if($value['waybill'] != "" && $ud['review'] > 4)
  605. {
  606. $x = $x."<p><b class='kn' data-type='2'>修改运单</b></p>";
  607. }
  608. if(($ud['review'] == 1 || $ud['review'] == 3) && $ud['express'] > 0 && $ud['dtsbjz'] != 0 && $ud['ts'] != 0 && $ud['zsbjz'] != 0 && $ud['zjs'] != 0 && $ud['ts'] != 0)
  609. {
  610. $x = $x."<p><b class='focz' data-type='2' data-id='".$value['id']."'>提交审核</b></p>";
  611. }
  612. if($value['black'] == 0)
  613. {
  614. $x = $x."<p><b class='black' data-type='4' data-id='".$value['id']."'>加黑名单</b></p>";
  615. }
  616. $info_list[$key]['black'] = $x;
  617. $tly = "";
  618. if($value['clientremarks'] != "")
  619. {
  620. $tly = "<p style='color:#FF3333'>有客户留言</p>";
  621. }
  622. if($value['state'] == 217)
  623. {
  624. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/readonly/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
  625. }
  626. else
  627. {
  628. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
  629. }
  630. if($value['library'] == 1)
  631. {
  632. $info_list[$key]['library'] = "未出库";
  633. }
  634. else if($value['library'] == 2)
  635. {
  636. $info_list[$key]['library'] = "已出库";
  637. }
  638. else if($value['library'] == 3)
  639. {
  640. $info_list[$key]['library'] = "退库";
  641. }
  642. }
  643. $total = $this->fullorder->find_count($where);
  644. $pagenum = ceil($total/$perpage);
  645. $over = $total-($start+$perpage);
  646. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  647. echo json_encode($rows);exit;
  648. }
  649. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  650. $this->data['wlshop'] = $wlshop;
  651. $this->data['express'] = $this->express->find_all();
  652. $fullorderexcel = $this->fullorderexcel->find_all('type=1','*','idorder desc');//导出模板
  653. $this->data['fullorderexcel'] = $fullorderexcel;
  654. $error = $this->fullorder->find_count("print = 1 and failed !='' and mergeid = 0 and waybill = '' and type = 5 and (".rtrim($fgshop,'or').")");
  655. $this->data['error'] = $error;
  656. $this->_Template('fullorder_smt_dlz',$this->data);
  657. }
  658. //筛选重复订单
  659. public function _repeat()
  660. {
  661. $user = $this->user->get_api($_SESSION['api']);
  662. if($user)
  663. {
  664. $fgshop = "";$sid = "";
  665. $user = explode('|',trim($user['shop'],'|'));
  666. foreach ($user as $value)
  667. {
  668. $fgshop .= " shop = ".$value." or";
  669. $sid .= " id = ".$value." or";
  670. }
  671. }
  672. $post = $this->input->post(NULL, TRUE);
  673. if(isset($post['page']))
  674. {
  675. $page = $this->input->post('page',true);
  676. $perpage = $this->input->post('perpage',true);
  677. $shop = $this->input->post('shop',true);
  678. $timetk = $this->input->post('timetk',true);
  679. $timetj = $this->input->post('timetj',true);
  680. $timetk = strtotime($timetk);
  681. $timetj = strtotime($timetj);
  682. $where = "print != 3 and (".rtrim($fgshop,'or').")";
  683. if($shop)
  684. {
  685. $where .= " and shop = '$shop'";
  686. }
  687. if($timetk && $timetj)
  688. {
  689. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  690. }
  691. //数据排序
  692. $order_str = "id desc";
  693. if(empty($page))
  694. {
  695. $start = 0;
  696. $perpage = 1;
  697. }
  698. else
  699. {
  700. $start = ($page - 1)*$perpage;
  701. }
  702. //取得信息列表
  703. $info_list = $this->fullorder_smt->find_all($where,'id,shop,type,orderinfo,number,state,buytime,name,email,address');
  704. $info = array();
  705. $len = count($info_list);
  706. //格式化数据
  707. foreach ($info_list as $key=>$value)
  708. {
  709. $shop = $this->shop->read($value['shop']);
  710. $info_list[$key]['shop'] = $shop['shopname'];
  711. $warehouse = $this->warehouse->read($value['type']);
  712. $info_list[$key]['type'] = $warehouse['title'];
  713. $typeclass = $this->typeclass->read($value['state']);
  714. $info_list[$key]['state'] = $typeclass['title'];
  715. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$value['buytime']).'</p><p>'.date('H:i:s',$value['buytime']).'</p>';
  716. }
  717. /** 操作合并
  718. if($value['merge'] == 0)
  719. {
  720. $info_list[$key]['merge'] = "<p><b class='jd' data-type='5'>合并订单</b></p>";
  721. }
  722. else
  723. {
  724. if($value['merge'] == $value['id'])
  725. {
  726. $info_list[$key]['merge'] = "已合并";
  727. }
  728. else
  729. {
  730. $info_list[$key]['merge'] = "被合并";
  731. }
  732. }
  733. **/
  734. for($i=0;$i<$len;$i++)
  735. {
  736. for($j=$i+1;$j<$len;$j++)
  737. {
  738. 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'])
  739. {
  740. if(!array_key_exists($j,$info))
  741. {
  742. $info[$j] = $info_list[$j];
  743. }
  744. if(!array_key_exists($i,$info))
  745. {
  746. $info[$i] = $info_list[$i];
  747. }
  748. }
  749. }
  750. }
  751. rsort($info);
  752. $total = count($info);
  753. $pagenum = ceil($total/$perpage);
  754. $over = $total-($start+$perpage);
  755. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_slice($info,$start,$perpage)));
  756. echo json_encode($rows);exit;
  757. }
  758. $this->_Template('fullorder_smt_repeat',$this->data);
  759. }
  760. //修改
  761. public function _edit($arg_array)
  762. {
  763. $post = $this->input->post(NULL, TRUE);
  764. if(isset($post['id']))
  765. {
  766. $id = $this->input->post('id',true);
  767. $data = $this->fullorder_smt->read($id);
  768. $post['type'] = $this->input->post('warehouse',true);
  769. $post['country'] = $this->input->post('country',true);
  770. $currency = $this->country->read($post['country']);
  771. $post['al'] = $currency['lb'];
  772. $post['freight'] = $this->input->post('freight',true);
  773. $post['expressmoney'] = $this->input->post('expressmoney',true);
  774. $post['shouldmoney'] = $this->input->post('shouldmoney',true);
  775. $post['orderremarks'] = $this->input->post('orderremarks',true);
  776. $post['shipremarks'] = $this->input->post('shipremarks');
  777. $post['email'] = $this->input->post('email',true);
  778. $name = $this->input->post('name',true);
  779. $post['name'] = str_replace("'","’",$name);
  780. $post['phone'] = $this->input->post('phone',true);
  781. $post['country'] = $this->input->post('country',true);
  782. $post['province'] = $this->input->post('province',true);
  783. $post['city'] = $this->input->post('city',true);
  784. $post['zipcode'] = $this->input->post('zipcode',true);
  785. $post['street'] = $this->input->post('street',true);
  786. $address = $this->input->post('address',true);
  787. $post['address'] = str_replace("'","’",$address);
  788. $post['express'] = $this->input->post('express',true);
  789. $post['printtype'] = $this->input->post('printtype',true);
  790. $post['fpdata'] = $this->input->post('fpdata');
  791. $post['waybill'] = $this->input->post('waybill',true);
  792. $post['msg'] = $this->input->post('msg',true);
  793. $post['zsbjz'] = $this->input->post('zsbjz',true);
  794. $post['refundy'] = $this->input->post('refundy',true);
  795. $post['refundj'] = $this->input->post('refundj',true);
  796. $rtime = $this->input->post('rtime',true);
  797. $post['rtime'] = strtotime($rtime);
  798. $post['rpaypal'] = $this->input->post('rpaypal',true);
  799. $post['rtext'] = $this->input->post('rtext',true);
  800. $editstate = $this->input->post('state',true);
  801. $post['review'] = 1;
  802. if($post['zsbjz'] < '0.01')
  803. {
  804. echo json_encode(array('msg'=>'总申报价错误!','success'=>false));exit;
  805. }
  806. if($data['library'] == 1)
  807. {
  808. if($data['print'] != 3)
  809. {
  810. $post['print'] = 1;
  811. $post['libraryconfirm'] = 1;
  812. $post['librarynot'] = "订单未打印,未审核或未通过";
  813. }
  814. else
  815. {
  816. $post['libraryconfirm'] = 1;
  817. $post['librarynot'] = "未审核或未通过";
  818. }
  819. }
  820. if($post['printtype'] == 1)//如果是运单
  821. {
  822. $post['productdescription'] = $this->input->post('productdescription',true);
  823. $post['customs'] = $this->input->post('customs',true);
  824. }
  825. /**
  826. if($editstate == 216 && $data['state'] != 216)
  827. {
  828. echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit;
  829. }
  830. **/
  831. if($editstate == 216 && preg_match('/\d/is',$post['waybill']) != true)
  832. {
  833. echo json_encode(array('msg'=>'当前信息不可修改订单状态','success'=>false));exit;
  834. }
  835. else
  836. {
  837. $post['review'] = $data['review'];
  838. $post['state'] = $editstate;
  839. }
  840. if($this->fullorder_smt->save($post,$id))
  841. {
  842. echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
  843. }
  844. else
  845. {
  846. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  847. }
  848. }
  849. $arg_array = $arg_array[0];$fpdata = array();
  850. $fullorder_smt = $this->fullorder_smt->read($arg_array);
  851. $fullorder_smt['parameter'] = str_replace(",","---",$fullorder_smt['parameter']);
  852. $country = $this->country->find_all('1=1','id,name');//所有国家信息
  853. $express = $this->express->find_all('1=1');//所有快递配置信息
  854. $this->data['fullorder_smt'] = $fullorder_smt;
  855. $this->data['country'] = $country;
  856. $this->data['express'] = $express;
  857. $this->data['dtime'] = date('Y-m-d H:i:s',$fullorder_smt['dtime']);
  858. if(stripos($fullorder_smt['fpdata'],';') !== false)
  859. {
  860. $fpdata = explode(';',rtrim($fullorder_smt['fpdata'],';'));
  861. foreach ($fpdata as $k=>$v)
  862. {
  863. $fpdata[$k] = explode('|',$v);
  864. }
  865. }
  866. $this->data['fpdata'] = $fpdata;
  867. $shop = $this->shop->read($fullorder_smt['shop']);
  868. $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
  869. $is = 0;
  870. if($shop['type'] == 269)//判断是否独立站,269是独立站
  871. {
  872. $is = 1;
  873. }
  874. $this->data['is'] = $is;
  875. if(isset($_SESSION['api']))
  876. {
  877. $user = $this->user->get_api($_SESSION['api']);
  878. if($user['power'] == 1)
  879. {
  880. $power = 1;
  881. }
  882. else
  883. {
  884. $power = 0;
  885. }
  886. }
  887. else
  888. {
  889. $power = 0;
  890. }
  891. $this->data['power'] = $power;
  892. /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
  893. $downwaybill = '';
  894. if($fullorder_smt['printtype'] == 1)
  895. {
  896. if($fullorder_smt['waybill'] != '')
  897. {
  898. $downwaybill .= '<a href="/data/pdf/'.date('Ymd',$fullorder_smt['printtime']).'/y-'.$fullorder_smt['waybill'].'.pdf" target="_blank">'.$fullorder_smt['waybill'].'</a>、';
  899. }
  900. }
  901. $oldwaybill = explode('-',ltrim($fullorder_smt['oldwaybill'],'-'));
  902. if(isset($oldwaybill[0][1]))
  903. {
  904. $oldwaybill = array_reverse($oldwaybill); //调整顺序
  905. foreach ($oldwaybill as $v)
  906. {
  907. $dw = explode('/',$v);
  908. if(isset($dw[1]))
  909. {
  910. $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
  911. }
  912. }
  913. }
  914. $this->data['downwaybill'] = rtrim($downwaybill,'、');
  915. $this->_Template('fullorder_smt_edit',$this->data);
  916. }
  917. //不可修改
  918. public function _readonly($arg_array)
  919. {
  920. $post = $this->input->post(NULL, TRUE);
  921. if(isset($post['id']))
  922. {
  923. $id = $this->input->post('id',true);
  924. $ud = $this->fullorder_smt->read($id);
  925. $post['type'] = $this->input->post('warehouse',true);
  926. $post['orderremarks'] = $this->input->post('orderremarks',true);
  927. $post['state'] = $this->input->post('state',true);
  928. $post['msg'] = $this->input->post('msg',true);
  929. $post['refundy'] = $this->input->post('refundy',true);
  930. $post['refundj'] = $this->input->post('refundj',true);
  931. $post['fpdata'] = $this->input->post('fpdata');
  932. $rtime = $this->input->post('rtime',true);
  933. $post['rtime'] = strtotime($rtime);
  934. $post['rpaypal'] = $this->input->post('rpaypal',true);
  935. $post['rtext'] = $this->input->post('rtext',true);
  936. /**
  937. if($post['state'] == 216 && $ud['state'] != 216)
  938. {
  939. echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit;
  940. }
  941. **/
  942. if($this->fullorder_smt->save($post,$id))
  943. {
  944. echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
  945. }
  946. else
  947. {
  948. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  949. }
  950. }
  951. $arg_array = $arg_array[0];$fpdata = array();
  952. $fullorder_smt = $this->fullorder_smt->read($arg_array);
  953. $fullorder_smt['parameter'] = str_replace(",","---",$fullorder_smt['parameter']);
  954. $this->data['fullorder_smt'] = $fullorder_smt;
  955. $this->data['countrys'] = $this->country->find_all();
  956. $this->data['express'] = $this->express->find_all();
  957. if(stripos($fullorder_smt['fpdata'],';') !== false)
  958. {
  959. $fpdata = explode(';',rtrim($fullorder_smt['fpdata'],';'));
  960. foreach ($fpdata as $k=>$v)
  961. {
  962. $fpdata[$k] = explode('|',$v);
  963. }
  964. }
  965. $this->data['fpdata'] = $fpdata;
  966. $shop = $this->shop->read($fullorder_smt['shop']);
  967. $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
  968. $is = 0;
  969. if($shop['type'] == 269)//判断是否独立站,269是独立站
  970. {
  971. $is = 1;
  972. }
  973. $this->data['is'] = $is;
  974. //单项开始
  975. $warehouse = $this->warehouse->read($fullorder_smt['warehouse']);//发货仓库
  976. $state = $this->typeclass->read($fullorder_smt['state']);//订单状态
  977. $country = $this->country->read($fullorder_smt['country']);//国家
  978. if($fullorder_smt['capital'] == 1)
  979. {
  980. $capital = '暂未支付';
  981. }
  982. else if($fullorder_smt['capital'] == 2)
  983. {
  984. $capital = '部分支付';
  985. }
  986. else if($fullorder_smt['capital'] == 3)
  987. {
  988. $capital = '全部支付';
  989. }
  990. if($fullorder_smt['printtype'] == 1)
  991. {
  992. $printtype = '运单';
  993. }
  994. else if($fullorder_smt['printtype'] == 2)
  995. {
  996. $printtype = '发货单';
  997. }
  998. else if($fullorder_smt['printtype'] == 3)
  999. {
  1000. $printtype = '不打印单据';
  1001. }
  1002. else
  1003. {
  1004. $printtype = '未选择';
  1005. }
  1006. $this->data['warehouse'] = $warehouse['title'];
  1007. $this->data['state'] = $state['title'];
  1008. $this->data['capital'] = $capital;
  1009. $this->data['country'] = $country['ename'];
  1010. $this->data['printtype'] = $printtype;
  1011. //单项结束
  1012. /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
  1013. $downwaybill = '';
  1014. if($fullorder_smt['printtype'] == 1)
  1015. {
  1016. if($fullorder_smt['waybill'] != '')
  1017. {
  1018. $downwaybill .= '<a href="/data/pdf/'.date('Ymd',$fullorder_smt['printtime']).'/y-'.$fullorder_smt['waybill'].'.pdf" target="_blank">'.$fullorder_smt['waybill'].'</a>、';
  1019. }
  1020. }
  1021. $oldwaybill = explode('-',ltrim($fullorder_smt['oldwaybill'],'-'));
  1022. if(isset($oldwaybill[0][1]))
  1023. {
  1024. $oldwaybill = array_reverse($oldwaybill); //调整顺序
  1025. foreach ($oldwaybill as $v)
  1026. {
  1027. $dw = explode('/',$v);
  1028. if(isset($dw[1]))
  1029. {
  1030. $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
  1031. }
  1032. }
  1033. }
  1034. $this->data['downwaybill'] = rtrim($downwaybill,'、');
  1035. $this->_Template('fullorder_smt_readonly',$this->data);
  1036. }
  1037. //浏览列表
  1038. public function _readlist()
  1039. {
  1040. $post = $this->input->post(NULL, TRUE);
  1041. if(isset($post['page']))
  1042. {
  1043. $page = $this->input->post('page',true);
  1044. $perpage = $this->input->post('perpage',true);
  1045. $warehouse = $this->input->post('warehouse',true);
  1046. $express = $this->input->post('express',true);
  1047. $state = $this->input->post('state',true);
  1048. $print = $this->input->post('print',true);
  1049. $libraryconfirm = $this->input->post('libraryconfirm',true);
  1050. $orderinfo = $this->input->post('orderinfo',true);
  1051. $client = $this->input->post('name',true);
  1052. $email = $this->input->post('email',true);
  1053. $number = $this->input->post('number',true);
  1054. $waybill = $this->input->post('waybill',true);
  1055. $timetk = $this->input->post('timetk',true);
  1056. $timetj = $this->input->post('timetj',true);
  1057. $timetk = strtotime($timetk);
  1058. $timetj = strtotime($timetj);
  1059. $where = "mergeid = 0";
  1060. if($warehouse)
  1061. {
  1062. $where .= " and type = '$warehouse'";
  1063. }
  1064. if($express)
  1065. {
  1066. $where .= " and express = '$express'";
  1067. }
  1068. if($state)
  1069. {
  1070. $where .= " and state = '$state'";
  1071. }
  1072. if($print)
  1073. {
  1074. $where .= " and print = '$print'";
  1075. }
  1076. if($libraryconfirm)
  1077. {
  1078. $where .= " and libraryconfirm = '$libraryconfirm'";
  1079. }
  1080. if($orderinfo)
  1081. {
  1082. $where .= " and orderinfo = '$orderinfo'";
  1083. }
  1084. if($client)
  1085. {
  1086. $where .= " and client like '%$client%'";
  1087. }
  1088. if($email)
  1089. {
  1090. $where .= " and email = '$email'";
  1091. }
  1092. if($number)
  1093. {
  1094. $where .= " and number = '$number'";
  1095. }
  1096. if($waybill)
  1097. {
  1098. $where .= " and waybill = '$waybill'";
  1099. }
  1100. if($timetk && $timetj)
  1101. {
  1102. $timetj = $timetj+24*3600;
  1103. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  1104. }
  1105. //数据排序
  1106. $order_str = "dtime desc";
  1107. if(empty($page))
  1108. {
  1109. $start = 0;
  1110. $perpage = 1;
  1111. }
  1112. else
  1113. {
  1114. $start = ($page - 1)*$perpage;
  1115. }
  1116. //取得信息列表
  1117. $info_list = $this->fullorder_smt->find_all($where,'id,type,orderinfo,number,client,state,buytime,express,waybill,print,library,orderremarks',$order_str,$start,$perpage);
  1118. //格式化数据
  1119. foreach ($info_list as $key=>$value)
  1120. {
  1121. $ud = $this->fullorder_smt->read($value['id']);
  1122. $warehouse = $this->warehouse->read($value['type']);
  1123. $info_list[$key]['type'] = $warehouse['title'];
  1124. $typeclass = $this->typeclass->read($value['state']);
  1125. $info_list[$key]['state'] = $typeclass['spare'];
  1126. if($ud['source'] == 1) //线下单用订单时间,其他用付款时间
  1127. {
  1128. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$ud['dtime']).'</p><p>'.date('H:i:s',$ud['dtime']).'</p>';
  1129. }
  1130. else
  1131. {
  1132. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$value['buytime']).'</p><p>'.date('H:i:s',$value['buytime']).'</p>';
  1133. }
  1134. $express = $this->express->read($value['express']);
  1135. $info_list[$key]['express'] = $express['servicename'];
  1136. if($value['print'] == 1)
  1137. {
  1138. $info_list[$key]['print'] = "不可打印";
  1139. }
  1140. else if($value['print'] == 2)
  1141. {
  1142. $info_list[$key]['print'] = "未打印";
  1143. }
  1144. else if($value['print'] == 3)
  1145. {
  1146. $info_list[$key]['print'] = '<p>'.date('Y-m-d',$ud['printtime']).'</p><p>'.date('H:i:s',$ud['printtime']).'</p>';
  1147. }
  1148. if($value['library'] == 1)
  1149. {
  1150. $info_list[$key]['library'] = "未出库";
  1151. }
  1152. else if($value['library'] == 2)
  1153. {
  1154. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'</p>';
  1155. }
  1156. else if($value['library'] == 3)
  1157. {
  1158. $info_list[$key]['library'] = "已退库";
  1159. }
  1160. }
  1161. $total = $this->fullorder_smt->find_count($where);
  1162. $pagenum = ceil($total/$perpage);
  1163. $over = $total-($start+$perpage);
  1164. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  1165. echo json_encode($rows);exit;
  1166. }
  1167. $this->_Template('fullorder_smt_readlist',$this->data);
  1168. }
  1169. //删除
  1170. public function _del()
  1171. {
  1172. $post = $this->input->post(NULL, TRUE);
  1173. if(isset($post['s']))
  1174. {
  1175. $id_arr = $this->input->post('s');
  1176. $id_arr = explode(',',$id_arr);
  1177. if(!$id_arr)
  1178. {
  1179. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  1180. }
  1181. //循环删除记录
  1182. foreach ($id_arr as $v)
  1183. {
  1184. $this->fullorder_smt->remove($v);
  1185. }
  1186. echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
  1187. }
  1188. }
  1189. //查找商品价格
  1190. public function _price()
  1191. {
  1192. $post = $this->input->post(NULL, TRUE);
  1193. if(isset($post['data']))
  1194. {
  1195. $data = $this->input->post('data');
  1196. $data = explode('-',$data);
  1197. $number = '';$num = count($data);
  1198. //循环删除记录
  1199. for($i=0;$i<$num-1;$i++)
  1200. {
  1201. if($data[$i] != 0)
  1202. {
  1203. $number=$number.$data[$i];
  1204. if($i == 2)
  1205. {
  1206. $number=$number.$data[$num-1];
  1207. }
  1208. }
  1209. }
  1210. $list = $this->productdescribe->get_number($number);
  1211. if($list)
  1212. {
  1213. echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));
  1214. }
  1215. else
  1216. {
  1217. $list = array('purchase'=>0,'cost'=>0,'salesprice'=>0);
  1218. //echo json_encode(array('msg'=>'此信息没有配置价格!','n'=>$data[$num-1],'success'=>false));exit;
  1219. echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));exit;
  1220. }
  1221. }
  1222. }
  1223. public function _customs()
  1224. {
  1225. $post = $this->input->post(NULL, TRUE);
  1226. if(isset($post['e']))
  1227. {
  1228. $e = $this->input->post('e');//快递信息
  1229. $c = $this->input->post('c');//国家信息
  1230. $data = $this->customs->find_all('express = "'.$e.'" and country = "'.$c.'"');
  1231. $list = $this->productdescription->find_all('express = "'.$e.'" and country = "'.$c.'"');
  1232. $rows = array();
  1233. foreach ($data as $key=>$value)
  1234. {
  1235. $detailed = explode('|',trim($value['detailed'],'|'));
  1236. //此处未对比重量选择价值,暂直接选择第一条海关价值
  1237. $detailed = $this->detailed->read($detailed[0]);
  1238. $money = $detailed['customsval'];//找到海关价值
  1239. }
  1240. foreach ($list as $key=>$value)
  1241. {
  1242. $description = $this->typeclass->read($value['description']);
  1243. $list[$key]['title'] = $description['title'];//产品描述名称
  1244. }
  1245. if(!$data && !$list)
  1246. {
  1247. echo json_encode(array('msg'=>'无此快递配置信息!','success'=>false));exit;
  1248. }
  1249. else
  1250. {
  1251. //$list-title -description 取值
  1252. echo json_encode(array('money'=>sprintf("%.2f",$money),'msg'=>$list,'success'=>true));
  1253. }
  1254. }
  1255. }
  1256. public function _express()
  1257. {
  1258. $post = $this->input->post(NULL, TRUE);
  1259. if(isset($post['e']))
  1260. {
  1261. $e = $this->input->post('e');//快递信息
  1262. $c = $this->input->post('c');//国家信息
  1263. $data = $this->logistics->find_all('express = "'.$e.'" and country = "'.$c.'"');
  1264. if(!$data)
  1265. {
  1266. echo json_encode(array('success'=>false));exit;
  1267. }
  1268. else
  1269. {
  1270. echo json_encode(array('money'=>sprintf("%.2f",$data[0]['firstmoney']),'success'=>true));
  1271. }
  1272. }
  1273. }
  1274. public function _hl()
  1275. {
  1276. $post = $this->input->post(NULL, TRUE);
  1277. if(isset($post['cy']))
  1278. {
  1279. $hl = 0;
  1280. $cy = $this->input->post('cy');//币种ID
  1281. $cy = $this->typeclass->read($cy);
  1282. $gethl = $this->hl->get_hl();
  1283. foreach ($gethl as $v)
  1284. {
  1285. $code = str_replace(" ","",$v['code']);
  1286. if($code == $cy['title'])
  1287. {
  1288. $hl = $v['refePrice']/100;
  1289. }
  1290. }
  1291. echo json_encode(array('msg'=>$hl,'success'=>true));
  1292. }
  1293. }
  1294. public function _operation()
  1295. {
  1296. $post = $this->input->post(NULL, TRUE);
  1297. if(isset($post['type']))
  1298. {
  1299. $type = $this->input->post('type');
  1300. $id = $this->input->post('id');
  1301. $msg = $this->input->post('msg');
  1302. if($type == 1)//禁止发货
  1303. {
  1304. $d = $this->fullorder_smt->read($id);
  1305. if($d['library'] != 1)
  1306. {
  1307. echo json_encode(array('msg'=>'操作失败,订单非未出库状态!','success'=>false));exit;
  1308. }
  1309. if($d['print'] < 3)
  1310. {
  1311. $a = "订单未打印,";
  1312. }
  1313. else
  1314. {
  1315. $a = "";
  1316. }
  1317. if($this->fullorder_smt->save(array('libraryconfirm'=>1,'librarynot'=>$a.$msg),$id))
  1318. {
  1319. echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit;
  1320. }
  1321. else
  1322. {
  1323. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  1324. }
  1325. }
  1326. if($type == 6)//允许发货
  1327. {
  1328. $d = $this->fullorder_smt->read($id);
  1329. if($d['print'] < 3)
  1330. {
  1331. $a = "订单未打印,";
  1332. }
  1333. else
  1334. {
  1335. $a = "";
  1336. }
  1337. if($this->fullorder_smt->save(array('libraryconfirm'=>2,'librarynot'=>$a.$msg),$id))
  1338. {
  1339. echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit;
  1340. }
  1341. else
  1342. {
  1343. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  1344. }
  1345. }
  1346. if($type == 7)//禁止打印
  1347. {
  1348. $d = $this->fullorder_smt->read($id);
  1349. if($d['print'] == 3)
  1350. {
  1351. echo json_encode(array('msg'=>'操作失败,订单已打印!','success'=>false));exit;
  1352. }
  1353. if($d['print'] < 3)
  1354. {
  1355. $a = "订单未打印,";
  1356. }
  1357. else
  1358. {
  1359. $a = "";
  1360. }
  1361. if($this->fullorder_smt->save(array('print'=>1),$id))
  1362. {
  1363. echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
  1364. }
  1365. else
  1366. {
  1367. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  1368. }
  1369. }
  1370. if($type == 8)//允许打印
  1371. {
  1372. $d = $this->fullorder_smt->read($id);
  1373. if($d['print'] < 3)
  1374. {
  1375. $a = "订单未打印,";
  1376. }
  1377. else
  1378. {
  1379. $a = "";
  1380. }
  1381. if($this->fullorder_smt->save(array('print'=>2,'failed'=>''),$id))
  1382. {
  1383. echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
  1384. }
  1385. else
  1386. {
  1387. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  1388. }
  1389. }
  1390. else if($type == 2)//填写运单、修改运单
  1391. {
  1392. $d = $this->fullorder_smt->read($id);
  1393. if($d['express'] == 0)
  1394. {
  1395. echo json_encode(array('msg'=>'操作失败,未选择物流方式!','success'=>false));exit;
  1396. }
  1397. if($d['library'] == 3 || ($d['print'] == 3 && $d['libraryconfirm'] == 1))
  1398. {
  1399. echo json_encode(array('msg'=>'操作失败,不允许填写运单号!','success'=>false));exit;
  1400. }
  1401. //$fs = $this->notice->get_ordertatus(216);//216成功状态
  1402. $gx['res'] = 3;
  1403. $gx['state'] = 216;
  1404. if($gx['res'] > 0 && isset($fs))
  1405. {
  1406. $warehouse = $this->warehouse->read($xg['type']);
  1407. $ck = $this->_email($fs['content'],$xg,$warehouse['company']);
  1408. }
  1409. if($this->fullorder_smt->save(array('waybill'=>$msg,'state'=>$gx['state']),$id))
  1410. {
  1411. echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
  1412. }
  1413. else
  1414. {
  1415. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  1416. }
  1417. }
  1418. }
  1419. }
  1420. public function _merge()
  1421. {
  1422. $post = $this->input->post(NULL, TRUE);
  1423. if(isset($post['type']))
  1424. {
  1425. $type = $this->input->post('type');
  1426. $id = $this->input->post('id');
  1427. $u = $this->fullorder_smt->read($id);
  1428. $rows = $this->fullorder_smt->find_all('name = "'.$u['name'].'" or email = "'.$u['email'].'" or address = "'.$u['address'].'"','*','id desc');
  1429. if(count($rows)>1)
  1430. {
  1431. $this->db->trans_begin();
  1432. $fpdata=$rows[0]['fpdata'];//购买产品
  1433. $shouldmoney=$rows[0]['shouldmoney'];//购买应收金额
  1434. $budget=$rows[0]['budget'];//预估到帐金额
  1435. $cost=$rows[0]['cost'];//成本金额
  1436. $merge=$rows[0]['id'];
  1437. $d = array($rows[0]['id']);
  1438. for($i=1;$i<count($rows);$i++)
  1439. {
  1440. $fpdata=$fpdata.$rows[$i]['fpdata'];
  1441. $shouldmoney=$shouldmoney+$rows[$i]['shouldmoney'];
  1442. $budget=$budget+$rows[$i]['budget'];
  1443. $cost=$cost+$rows[$i]['cost'];
  1444. $d[] = $rows[$i]['id'];
  1445. $this->fullorder_smt->save(array('merge'=>$rows[0]['id'],'mergeid'=>1),$rows[$i]['id']);
  1446. }
  1447. $this->fullorder_smt->save(array('fpdata'=>$fpdata,'shouldmoney'=>$shouldmoney,'budget'=>$budget,'cost'=>$cost,'merge'=>$merge),$rows[0]['id']);
  1448. if ($this->db->trans_status() === FALSE)
  1449. {
  1450. $this->db->trans_commit();
  1451. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  1452. }
  1453. else
  1454. {
  1455. $this->db->trans_commit();
  1456. echo json_encode(array('msg'=>'操作成功','d'=>($d),'b'=>$rows[0]['id'],'success'=>true));
  1457. }
  1458. }
  1459. }
  1460. }
  1461. //评价管理
  1462. public function _evaluate()
  1463. {
  1464. $user = $this->user->get_api($_SESSION['api']);
  1465. if($user)
  1466. {
  1467. $fgshop = "";$sid = "";
  1468. $user = explode('|',trim($user['shop'],'|'));
  1469. foreach ($user as $value)
  1470. {
  1471. $fgshop .= " shop = ".$value." or";
  1472. $sid .= " id = ".$value." or";
  1473. }
  1474. }
  1475. $post = $this->input->post(NULL, TRUE);
  1476. if(isset($post['page']))
  1477. {
  1478. $page = $this->input->post('page',true);
  1479. $perpage = $this->input->post('perpage',true);
  1480. $shop = $this->input->post('shop',true);
  1481. $where = "1=1 and evaluate = 0 and (".rtrim($fgshop,'or').")";
  1482. if($shop)
  1483. {
  1484. $where .= " and shop = '$shop'";
  1485. }
  1486. //数据排序
  1487. $order_str = "id desc";
  1488. if(empty($page))
  1489. {
  1490. $start = 0;
  1491. $perpage = 1;
  1492. }
  1493. else
  1494. {
  1495. $start = ($page - 1)*$perpage;
  1496. }
  1497. //取得信息列表
  1498. $info_list = $this->fullorder_smt->find_all($where,'id,shop,orderinfo,number,operation',$order_str,$start,$perpage);
  1499. //格式化数据
  1500. foreach ($info_list as $key=>$value)
  1501. {
  1502. $shop = $this->shop->read($value['shop']);
  1503. $info_list[$key]['shop'] = $shop['shopname'];
  1504. $info_list[$key]['operation'] = "评价";
  1505. }
  1506. $total = $this->fullorder_smt->find_count($where);
  1507. $pagenum = ceil($total/$perpage);
  1508. $over = $total-($start+$perpage);
  1509. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  1510. echo json_encode($rows);exit;
  1511. }
  1512. $this->_Template('fullorder_smt_evaluate',$this->data);
  1513. }
  1514. //订单消息
  1515. public function _state()
  1516. {
  1517. $user = $this->user->get_api($_SESSION['api']);
  1518. if($user)
  1519. {
  1520. $fgshop = "";$sid = "";
  1521. $user = explode('|',trim($user['shop'],'|'));
  1522. foreach ($user as $value)
  1523. {
  1524. $fgshop .= " shop = ".$value." or";
  1525. $sid .= " id = ".$value." or";
  1526. }
  1527. }
  1528. $post = $this->input->post(NULL, TRUE);
  1529. if(isset($post['page']))
  1530. {
  1531. $page = $this->input->post('page',true);
  1532. $perpage = $this->input->post('perpage',true);
  1533. $timetk = $this->input->post('timetk',true);
  1534. $timetj = $this->input->post('timetj',true);
  1535. $shop = $this->input->post('shop',true);
  1536. $source = $this->input->post('source',true);
  1537. $state = $this->input->post('state',true);
  1538. $review = $this->input->post('review',true);
  1539. $expressstate = $this->input->post('expressstate',true);
  1540. $express = $this->input->post('express',true);
  1541. $orderinfo = $this->input->post('orderinfo',true);
  1542. $user = $this->input->post('user',true);
  1543. $name = $this->input->post('name',true);
  1544. $waybill = $this->input->post('waybill',true);
  1545. $timetk = strtotime($timetk);
  1546. $timetj = strtotime($timetj);
  1547. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  1548. if($timetk && $timetj)
  1549. {
  1550. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  1551. }
  1552. if($shop)
  1553. {
  1554. $where .= " and shop = '$shop'";
  1555. }
  1556. if($source)
  1557. {
  1558. $where .= " and source = '$source'";
  1559. }
  1560. if($state)
  1561. {
  1562. $where .= " and state = '$state'";
  1563. }
  1564. if($review)
  1565. {
  1566. $where .= " and review = '$review'";
  1567. }
  1568. if($expressstate != "")
  1569. {
  1570. $where .= " and expressstate = '$expressstate'";
  1571. }
  1572. if($express)
  1573. {
  1574. $where .= " and express = '$express'";
  1575. }
  1576. if($orderinfo)
  1577. {
  1578. $where .= " and orderinfo = '$orderinfo'";
  1579. }
  1580. if($user)
  1581. {
  1582. $where .= " and user = '$user'";
  1583. }
  1584. if($name)
  1585. {
  1586. $where .= " and name = '$name'";
  1587. }
  1588. if($waybill)
  1589. {
  1590. $where .= " and waybill = '$waybill'";
  1591. }
  1592. //数据排序
  1593. $order_str = "id desc";
  1594. if(empty($page))
  1595. {
  1596. $start = 0;
  1597. $perpage = 1;
  1598. }
  1599. else
  1600. {
  1601. $start = ($page - 1)*$perpage;
  1602. }
  1603. //取得信息列表
  1604. $info_list = $this->fullorder_smt->find_all($where,'id,shop,user,orderinfo,number,country,state,review,library,librarytime,expressstate,express,waybill,fscontent',$order_str,$start,$perpage);
  1605. //格式化数据
  1606. foreach ($info_list as $key=>$value)
  1607. {
  1608. $shop = $this->shop->read($value['shop']);
  1609. $info_list[$key]['shop'] = $shop['shopname'];
  1610. $info_list[$key]['user'] = $shop['shopuser'];
  1611. $country = $this->country->read($value['country']);
  1612. $info_list[$key]['country'] = $country['name'];
  1613. $state = $this->typeclass->read($value['state']);
  1614. $info_list[$key]['state'] = $state['title'];
  1615. if($value['review'] == 1)
  1616. {
  1617. $info_list[$key]['review'] = "未送审";
  1618. }
  1619. else if($value['review'] == 2)
  1620. {
  1621. $info_list[$key]['review'] = "待审核";
  1622. }
  1623. else if($value['review'] == 3)
  1624. {
  1625. $info_list[$key]['review'] = "不通过";
  1626. }
  1627. else if($value['review'] == 4)
  1628. {
  1629. $info_list[$key]['review'] = "取消重审";
  1630. }
  1631. else if($value['review'] == 5)
  1632. {
  1633. $info_list[$key]['review'] = "审核通过";
  1634. }
  1635. else if($value['review'] == 6)
  1636. {
  1637. $info_list[$key]['review'] = "自动通过";
  1638. }
  1639. if($value['library'] == 1)
  1640. {
  1641. $info_list[$key]['library'] = "未出库";
  1642. }
  1643. else if($value['library'] == 2)
  1644. {
  1645. $info_list[$key]['library'] = "已出库";
  1646. }
  1647. else if($value['library'] == 3)
  1648. {
  1649. $info_list[$key]['library'] = "已退库";
  1650. }
  1651. if($value['librarytime'] == '0')
  1652. {
  1653. $info_list[$key]['librarytime'] = '无';
  1654. }
  1655. else
  1656. {
  1657. $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);
  1658. }
  1659. if($value['expressstate'] == 0)
  1660. {
  1661. $info_list[$key]['expressstate'] = "未取件";
  1662. }
  1663. else if($value['expressstate'] == 1)
  1664. {
  1665. $info_list[$key]['expressstate'] = "已取件";
  1666. }
  1667. else if($value['expressstate'] == 2)
  1668. {
  1669. $info_list[$key]['expressstate'] = "离开中国";
  1670. }
  1671. else if($value['expressstate'] == 3)
  1672. {
  1673. $info_list[$key]['expressstate'] = "到达目的国";
  1674. }
  1675. else if($value['expressstate'] == 4)
  1676. {
  1677. $info_list[$key]['expressstate'] = "已派送";
  1678. }
  1679. $express = $this->express->read($value['express']);
  1680. $info_list[$key]['express'] = $express['servicename'];
  1681. }
  1682. $total = $this->fullorder_smt->find_count($where);
  1683. $pagenum = ceil($total/$perpage);
  1684. $over = $total-($start+$perpage);
  1685. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  1686. echo json_encode($rows);exit;
  1687. }
  1688. $this->data['express'] = $this->express->find_all();
  1689. $this->_Template('fullorder_smt_state',$this->data);
  1690. }
  1691. //审核订单
  1692. public function _review()
  1693. {
  1694. $user = $this->user->get_api($_SESSION['api']);
  1695. $fgshop = "";
  1696. if($user)
  1697. {
  1698. $fgshop = "";$sid = "";
  1699. $user = explode('|',trim($user['shop'],'|'));
  1700. foreach ($user as $value)
  1701. {
  1702. $fgshop .= " shop = ".$value." or";
  1703. }
  1704. $fgshop = " and (".rtrim($fgshop,'or').")";
  1705. }
  1706. $post = $this->input->post(NULL, TRUE);
  1707. if(isset($post['page']))
  1708. {
  1709. $page = $this->input->post('page',true);
  1710. $perpage = $this->input->post('perpage',true);
  1711. $source = $this->input->post('source',true);
  1712. $warehouse = $this->input->post('warehouse',true);
  1713. $express = $this->input->post('express',true);
  1714. $user = $this->input->post('user',true);
  1715. $shop = $this->input->post('shop',true);
  1716. $review = $this->input->post('review',true);
  1717. $orderinfo = $this->input->post('orderinfo',true);
  1718. $timetk = $this->input->post('timetk',true);
  1719. $timetj = $this->input->post('timetj',true);
  1720. $timetk = strtotime($timetk);
  1721. $timetj = strtotime($timetj);
  1722. $where = "mergeid = 0".$fgshop;
  1723. if($timetk && $timetj)
  1724. {
  1725. $where .= " and buytime > '$timetk' and buytime < '$timetj'";
  1726. }
  1727. if($source)
  1728. {
  1729. $where .= " and source = '$source'";
  1730. }
  1731. if($shop)
  1732. {
  1733. $where .= " and shop = '$shop'";
  1734. }
  1735. if($warehouse)
  1736. {
  1737. $where .= " and type = '$warehouse'";
  1738. }
  1739. if($express)
  1740. {
  1741. $where .= " and express = '$express'";
  1742. }
  1743. if($user)
  1744. {
  1745. $where .= " and user = '$user'";
  1746. }
  1747. if($review)
  1748. {
  1749. $where .= " and review = '$review'";
  1750. }
  1751. if($orderinfo)
  1752. {
  1753. $where .= " and orderinfo = '$orderinfo'";
  1754. }
  1755. //数据排序
  1756. $order_str = "id desc";
  1757. if(empty($page))
  1758. {
  1759. $start = 0;
  1760. $perpage = 1;
  1761. }
  1762. else
  1763. {
  1764. $start = ($page - 1)*$perpage;
  1765. }
  1766. //取得信息列表
  1767. $info_list = $this->fullorder_smt->find_all($where,'id,shop,user,type,orderinfo,number,client,express,buytime,shouldmoney,review,currencytitle,library');
  1768. //格式化数据
  1769. foreach ($info_list as $key=>$value)
  1770. {
  1771. $lr = $this->fullorder_smt->read($value['id']);
  1772. $shop = $this->shop->read($value['shop']);
  1773. $info_list[$key]['shop'] = $shop['shopname'];
  1774. $info_list[$key]['user'] = $shop['shopuser'];
  1775. $warehouse = $this->warehouse->read($value['type']);
  1776. $info_list[$key]['type'] = $warehouse['title'];
  1777. $express = $this->express->read($value['express']);
  1778. $info_list[$key]['express'] = $express['servicename'];
  1779. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$value['buytime']).'</p><p>'.date('H:i:s',$value['buytime']).'</p>';
  1780. if($value['review'] == 1)
  1781. {
  1782. $info_list[$key]['review'] = "未送审";
  1783. }
  1784. else if($value['review'] == 2)
  1785. {
  1786. $info_list[$key]['review'] = "待审核";
  1787. }
  1788. else if($value['review'] == 3)
  1789. {
  1790. $info_list[$key]['review'] = "不通过";
  1791. }
  1792. else if($value['review'] == 4)
  1793. {
  1794. $info_list[$key]['review'] = "取消重审";
  1795. }
  1796. else if($value['review'] == 5)
  1797. {
  1798. $info_list[$key]['review'] = "审核通过";
  1799. }
  1800. else if($value['review'] == 6)
  1801. {
  1802. $info_list[$key]['review'] = "自动通过";
  1803. }
  1804. if($value['review'] == 2)
  1805. {
  1806. $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>";
  1807. }
  1808. else if($value['review'] == 3)
  1809. {
  1810. $info_list[$key]['library'] = "<p><b class='fullorderreview' data-type='5' data-id='".$value['id']."'>审核通过</b></p>";
  1811. }
  1812. else if($value['review'] == 5)
  1813. {
  1814. $info_list[$key]['library'] = "<p><b class='fullorderreview' data-type='3' data-id='".$value['id']."'>不通过</b></p>";
  1815. }
  1816. else
  1817. {
  1818. $info_list[$key]['library'] = "";
  1819. }
  1820. $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$lr['currencytitle'];
  1821. $lr['hl'] = $lr['hl']==0?6.71:$lr['hl'];
  1822. $cost = $lr['cost']/$lr['hl'];
  1823. $currencytitle = $lr['budget']-$lr['refundj']-$cost-$lr['expressmoney'];
  1824. $info_list[$key]['currencytitle'] = sprintf("%.2f",$currencytitle).' '.$lr['currencytitle'];
  1825. }
  1826. $total = $this->fullorder_smt->find_count($where);
  1827. $pagenum = ceil($total/$perpage);
  1828. $over = $total-($start+$perpage);
  1829. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  1830. echo json_encode($rows);exit;
  1831. }
  1832. $this->_Template('fullorder_smt_review',$this->data);
  1833. }
  1834. //导出资金统计excel
  1835. public function _fmexcel()
  1836. {
  1837. $user = $this->user->get_api($_SESSION['api']);
  1838. if($user)
  1839. {
  1840. $fgshop = "";$sid = "";
  1841. $user = explode('|',trim($user['shop'],'|'));
  1842. foreach ($user as $value)
  1843. {
  1844. $fgshop .= " shop = ".$value." or";
  1845. $sid .= " id = ".$value." or";
  1846. }
  1847. }
  1848. if(isset($_GET['excel']))
  1849. {
  1850. $timetk = $this->input->get('timetk',true);
  1851. $timetj = $this->input->get('timetj',true);
  1852. $shop = $this->input->get('shop',true);
  1853. $source = $this->input->get('source',true);
  1854. $state = $this->input->get('state',true);
  1855. $type = $this->input->get('type',true);
  1856. $orderinfo = $this->input->get('orderinfo',true);
  1857. $user = $this->input->get('user',true);
  1858. $name = $this->input->get('name',true);
  1859. $timetk = strtotime($timetk);
  1860. $timetj = strtotime($timetj);
  1861. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  1862. if($timetk && $timetj)
  1863. {
  1864. $where .= " and buytime > '$timetk' and buytime < '$timetj'";
  1865. }
  1866. if($shop)
  1867. {
  1868. $where .= " and shop = '$shop'";
  1869. }
  1870. if($source)
  1871. {
  1872. $where .= " and source = '$source'";
  1873. }
  1874. if($state)
  1875. {
  1876. if($state == 1)
  1877. {
  1878. $where .= " and state = '$state'";
  1879. }
  1880. }
  1881. if($type)
  1882. {
  1883. $where .= " and type = '$type'";
  1884. }
  1885. if($orderinfo)
  1886. {
  1887. $where .= " and orderinfo = '$orderinfo'";
  1888. }
  1889. if($user)
  1890. {
  1891. $where .= " and user = '$user'";
  1892. }
  1893. if($name)
  1894. {
  1895. $where .= " and name = '$name'";
  1896. }
  1897. //取得信息列表
  1898. $info_list = $this->fullorder_smt->find_all($where,'id,shop,user,number,orderinfo,client,country,dtime,ftime,express,waybill,shouldmoney,refund,currency,budget,fpdata,hl,currencytitle');
  1899. //格式化数据
  1900. $i = 1;$shouldmoney = 0;$refund = 0;$budget = 0;$currency = 0;$hl=1;
  1901. foreach ($info_list as $key=>$value)
  1902. {
  1903. $info_list[$key]['id'] = $i;
  1904. if($value['currencytitle'] != "CNY")
  1905. {
  1906. $hl=$value['hl'];
  1907. }
  1908. $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl);
  1909. $budget=$budget+($value['budget']*$hl);
  1910. $currency=$currency+(($value['shouldmoney']-$value['budget'])*$hl);
  1911. $refund=$refund+($value['refund']*$hl);
  1912. $shop = $this->shop->read($value['shop']);
  1913. $info_list[$key]['shop'] = $shop['shopname'];
  1914. $info_list[$key]['user'] = $shop['shopuser'];
  1915. $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);
  1916. $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']);
  1917. $country = $this->country->read($value['country']);
  1918. $info_list[$key]['country'] = $country['name'];
  1919. $express = $this->express->read($value['express']);
  1920. $info_list[$key]['express'] = $express['servicename'];
  1921. $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle'];
  1922. $info_list[$key]['refund'] = $value['refund'].' '.$value['currencytitle'];
  1923. $info_list[$key]['budget'] = $value['budget'].' '.$value['currencytitle'];
  1924. $info_list[$key]['currency'] = sprintf("%.2f",$value['shouldmoney']-$value['budget']).' '.$value['currencytitle'];
  1925. $fpdata = array();
  1926. if(stripos($value['fpdata'],';') !== false)
  1927. {
  1928. $fpdata = explode(';',rtrim($value['fpdata'],';'));
  1929. foreach ($fpdata as $ke=>$va)
  1930. {
  1931. $v = explode('|',rtrim($va,'|'));
  1932. $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数
  1933. }
  1934. }
  1935. $info_list[$key]['fpdata'] = $fpdata;
  1936. $i++;
  1937. }
  1938. $data = array($shouldmoney.' CNY',$refund.' CNY',$currency.' CNY',$budget.' CNY');
  1939. $title = "订单资金信息";
  1940. $titlename = "<table border=1>
  1941. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  1942. <tr>
  1943. <td>NO.</td>
  1944. <td>店铺</td>
  1945. <td>负责人</td>
  1946. <td>编号</td>
  1947. <td>订单号</td>
  1948. <td>客户姓名</td>
  1949. <td>国家</td>
  1950. <td>订单日期</td>
  1951. <td>发货日期</td>
  1952. <td>快递公司</td>
  1953. <td>运单号</td>
  1954. <td>订单金额</td>
  1955. <td>退款金额</td>
  1956. <td>手续费</td>
  1957. <td>预估金额</td>
  1958. <td>
  1959. <table border=1>
  1960. <tr><td colspan='3' align='center'>订单产品信息</td></tr>
  1961. <tr>
  1962. <td>产品</td>
  1963. <td>条数</td>
  1964. <td>数量</td>
  1965. </tr>
  1966. </table>
  1967. </td>
  1968. <td>总条数</td>
  1969. </tr>
  1970. </table>";
  1971. $filename = $title.".xls";
  1972. $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";
  1973. $this->excel->get_fz($info_list,$titlename,$filename,$tail);
  1974. }
  1975. }
  1976. //导出订单excel
  1977. public function _fdexcel()
  1978. {
  1979. if(isset($_GET['excel']))
  1980. {
  1981. $page = $this->input->post('page',true);
  1982. $perpage = $this->input->post('perpage',true);
  1983. $timetk = $this->input->post('timetk',true);
  1984. $timetj = $this->input->post('timetj',true);
  1985. $shop = $this->input->post('shop',true);
  1986. $source = $this->input->post('source',true);
  1987. $state = $this->input->post('state',true);
  1988. $review = $this->input->post('review',true);
  1989. $express = $this->input->post('express',true);
  1990. $orderinfo = $this->input->post('orderinfo',true);
  1991. $user = $this->input->post('user',true);
  1992. $name = $this->input->post('name',true);
  1993. $waybill = $this->input->post('waybill',true);
  1994. $timetk = strtotime($timetk);
  1995. $timetj = strtotime($timetj);
  1996. $where = "1=1 and mergeid = 0";
  1997. if($timetk && $timetj)
  1998. {
  1999. $where .= " and buytime > '$timetk' and buytime < '$timetj'";
  2000. }
  2001. if($shop)
  2002. {
  2003. $where .= " and shop = '$shop'";
  2004. }
  2005. if($source)
  2006. {
  2007. $where .= " and source = '$source'";
  2008. }
  2009. if($state)
  2010. {
  2011. $where .= " and state = '$state'";
  2012. }
  2013. if($review)
  2014. {
  2015. $where .= " and review = '$review'";
  2016. }
  2017. if($express)
  2018. {
  2019. $where .= " and express = '$express'";
  2020. }
  2021. if($orderinfo)
  2022. {
  2023. $where .= " and orderinfo = '$orderinfo'";
  2024. }
  2025. if($user)
  2026. {
  2027. $where .= " and user = '$user'";
  2028. }
  2029. if($name)
  2030. {
  2031. $where .= " and name = '$name'";
  2032. }
  2033. if($waybill)
  2034. {
  2035. $where .= " and waybill = '$waybill'";
  2036. }
  2037. //取得信息列表
  2038. $info_list = $this->fullorder_smt->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');
  2039. //格式化数据
  2040. $i = 1;$shouldmoney = 0;$hl=1;
  2041. foreach ($info_list as $key=>$value)
  2042. {
  2043. $info_list[$key]['id'] = $i;
  2044. if($value['source'] == 1)
  2045. {
  2046. $info_list[$key]['source'] = "线下订单";
  2047. }
  2048. else if($value['source'] == 2)
  2049. {
  2050. $info_list[$key]['source'] = "PC订单";
  2051. }
  2052. else if($value['source'] == 3)
  2053. {
  2054. $info_list[$key]['source'] = "手机订单";
  2055. }
  2056. if($value['currencytitle'] != "CNY")
  2057. {
  2058. $hl=$value['hl'];
  2059. }
  2060. $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl);
  2061. $shop = $this->shop->read($value['shop']);
  2062. $info_list[$key]['shop'] = $shop['shopname'];
  2063. $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);
  2064. $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']);
  2065. $state = $this->typeclass->read($value['state']);
  2066. $info_list[$key]['state'] = $state['title'];
  2067. $country = $this->country->read($value['country']);
  2068. $info_list[$key]['country'] = $country['name'];
  2069. $express = $this->express->read($value['express']);
  2070. $info_list[$key]['express'] = $express['servicename'];
  2071. $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle'];
  2072. $fpdata = array();
  2073. if(stripos($value['fpdata'],';') !== false)
  2074. {
  2075. $fpdata = explode(';',rtrim($value['fpdata'],';'));
  2076. foreach ($fpdata as $ke=>$va)
  2077. {
  2078. $v = explode('|',rtrim($va,'|'));
  2079. $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数
  2080. }
  2081. }
  2082. $info_list[$key]['fpdata'] = $fpdata;
  2083. $i++;
  2084. }
  2085. $data = array($shouldmoney.' CNY');
  2086. $title = "订单信息表";
  2087. $titlename = "<table border=1>
  2088. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  2089. <tr>
  2090. <td>NO.</td>
  2091. <td>店铺</td>
  2092. <td>编号</td>
  2093. <td>订单号</td>
  2094. <td>订单类型</td>
  2095. <td>客户姓名</td>
  2096. <td>收件人名称</td>
  2097. <td>收货人地址</td>
  2098. <td>城市</td>
  2099. <td>邮编</td>
  2100. <td>州</td>
  2101. <td>国家</td>
  2102. <td>收件电话</td>
  2103. <td>订单日期</td>
  2104. <td>发货日期</td>
  2105. <td>订单状态</td>
  2106. <td>订单金额</td>
  2107. <td>快递公司</td>
  2108. <td>运单号</td>
  2109. <td>订单备注</td>
  2110. <td>客户备注</td>
  2111. <td>
  2112. <table border=1>
  2113. <tr><td colspan='3' align='center'>订单产品信息</td></tr>
  2114. <tr>
  2115. <td>产品</td>
  2116. <td>条数</td>
  2117. <td>数量</td>
  2118. </tr>
  2119. </table>
  2120. </td>
  2121. <td>总条数</td>
  2122. </tr>
  2123. </table>";
  2124. $filename = $title.".xls";
  2125. $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";
  2126. $this->excel->get_fz($info_list,$titlename,$filename,$tail);
  2127. }
  2128. }
  2129. public function _excel()
  2130. {
  2131. if(isset($_SESSION['api']))
  2132. {
  2133. $user = $this->user->get_api($_SESSION['api']);
  2134. $usp = $user;
  2135. $fgshop = "";$sid = "";
  2136. $user = explode('|',trim($user['shop'],'|'));
  2137. foreach ($user as $value)
  2138. {
  2139. $fgshop .= " shop = ".$value." or";
  2140. $sid .= " id = ".$value." or";
  2141. }
  2142. }
  2143. if(isset($_GET['excel']))
  2144. {
  2145. $dowid = $this->input->get('a');
  2146. $wid = "";
  2147. if($dowid != "")
  2148. {
  2149. $id_arr = explode(',',rtrim($dowid,','));
  2150. $wid .= " id = 0 or";
  2151. foreach ($id_arr as $v)
  2152. {
  2153. $wid .= " id = '$v' or";
  2154. }
  2155. $wid = " and".rtrim($wid,'or');
  2156. }
  2157. $warehouse = $this->input->get('warehouse',true);
  2158. $xztime = $this->input->get('xztime',true);
  2159. $timetk = $this->input->get('timetk',true);
  2160. $timetj = $this->input->get('timetj',true);
  2161. $shop = $this->input->get('shop',true);
  2162. $source = $this->input->get('source',true);
  2163. $state = $this->input->get('state',true);
  2164. $review = $this->input->get('review',true);
  2165. $type = $this->input->get('type',true);
  2166. $express = $this->input->get('express',true);
  2167. $orderinfo = $this->input->get('orderinfo',true);
  2168. $user = $this->input->get('user',true);
  2169. $client = $this->input->get('name',true);
  2170. $waybill = $this->input->get('waybill',true);
  2171. $number = $this->input->get('number',true);
  2172. $email = $this->input->get('email',true);
  2173. $dlz = $this->input->get('dlz',true);
  2174. $print = $this->input->get('print',true);
  2175. $library = $this->input->get('library',true);
  2176. $timetk = strtotime($timetk)+12*3600;
  2177. $timetj = strtotime($timetj)+12*3600;
  2178. $where = "mergeid = 0 and (".rtrim($fgshop,'or').")";
  2179. if($timetk && $timetj)
  2180. {
  2181. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  2182. }
  2183. if($shop)
  2184. {
  2185. $where .= " and shop = '$shop'";
  2186. }
  2187. if($source)
  2188. {
  2189. $where .= " and source = '$source'";
  2190. }
  2191. if($state)
  2192. {
  2193. $where .= " and state = '$state'";
  2194. }
  2195. if($type)
  2196. {
  2197. $where .= " and type = '$type'";
  2198. }
  2199. if($orderinfo)
  2200. {
  2201. $where .= " and orderinfo = '$orderinfo'";
  2202. }
  2203. if($user)
  2204. {
  2205. $where .= " and user = '$user'";
  2206. }
  2207. if($name)
  2208. {
  2209. $where .= " and name = '$name'";
  2210. }
  2211. if($print)
  2212. {
  2213. $where .= " and print = '$print'";
  2214. }
  2215. if($library)
  2216. {
  2217. $where .= " and library = '$library'";
  2218. }
  2219. //取得信息列表
  2220. $info_list = $this->fullorder_smt->find_all($where.$wid,'id,shop,number,orderinfo,client,country,province,city,zipcode,address,phone,waybill,shipremarks,zzl,bx,qm,js,dtime,printtime,librarytime,retreattime');
  2221. //格式化数据
  2222. $i = 1;
  2223. foreach ($info_list as $key=>$value)
  2224. {
  2225. $shop = $this->shop->read($value['shop']);
  2226. $info_list[$key]['shop'] = $shop['shopname'];
  2227. $info_list[$key]['id'] = $i;
  2228. $country = $this->country->read($value['country']);
  2229. $info_list[$key]['country'] = $country['ename'];
  2230. $info_list[$key]['qm'] = ($value['qm']==1)?'需要签名':'不签名';
  2231. $info_list[$key]['js'] = ($value['js']==1)?'优先服务':'普通';
  2232. $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']-12*3600);
  2233. $info_list[$key]['printtime'] = ($value['printtime']!=0)?date('Y-m-d H:i:s',$value['printtime']-12*3600):'';
  2234. $info_list[$key]['librarytime'] = ($value['librarytime']!=0)?date('Y-m-d H:i:s',$value['librarytime']-12*3600):'';
  2235. $info_list[$key]['retreattime'] = ($value['retreattime']!=0)?date('Y-m-d H:i:s',$value['retreattime']-12*3600):'';
  2236. $i++;
  2237. }
  2238. $title = "速卖通订单信息";
  2239. $titlename = "<table border=1>
  2240. <tr><th colspan='17' align='left'><h3>".$title."<h3></th></tr>
  2241. <tr>
  2242. <td>NO.</td>
  2243. <td>店铺</td>
  2244. <td>编码</td>
  2245. <td>订单号</td>
  2246. <td>姓名</td>
  2247. <td>国家</td>
  2248. <td>州</td>
  2249. <td>城市</td>
  2250. <td>邮编</td>
  2251. <td>地址</td>
  2252. <td>电话</td>
  2253. <td>运单号</td>
  2254. <td>备注</td>
  2255. <td>重量</td>
  2256. <td>保险</td>
  2257. <td>签名</td>
  2258. <td>快递服务</td>
  2259. <td>订单时间(美国时间)</td>
  2260. <td>打印时间(美国时间)</td>
  2261. <td>出库时间(美国时间)</td>
  2262. <td>退库时间(美国时间)</td>
  2263. </table>";
  2264. $filename = $title.".xls";
  2265. $tail = "<tr><td></td></tr>\n";
  2266. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  2267. }
  2268. }
  2269. public function _exceldlz()
  2270. {
  2271. if(isset($_SESSION['api']))
  2272. {
  2273. $user = $this->user->get_api($_SESSION['api']);
  2274. $usp = $user;
  2275. $fgshop = "";$sid = "";
  2276. $user = explode('|',trim($user['shop'],'|'));
  2277. foreach ($user as $value)
  2278. {
  2279. $fgshop .= " shop = ".$value." or";
  2280. $sid .= " id = ".$value." or";
  2281. }
  2282. }
  2283. if(isset($_GET['excel']))
  2284. {
  2285. $dowid = $this->input->get('a');
  2286. $wid = "";
  2287. if($dowid != "")
  2288. {
  2289. $id_arr = explode(',',rtrim($dowid,','));
  2290. $wid .= " id = 0 or";
  2291. foreach ($id_arr as $v)
  2292. {
  2293. $wid .= " id = '$v' or";
  2294. }
  2295. $wid = " and".rtrim($wid,'or');
  2296. }
  2297. $warehouse = $this->input->get('warehouse',true);
  2298. $xztime = $this->input->get('xztime',true);
  2299. $timetk = $this->input->get('timetk',true);
  2300. $timetj = $this->input->get('timetj',true);
  2301. $shop = $this->input->get('shop',true);
  2302. $source = $this->input->get('source',true);
  2303. $state = $this->input->get('state',true);
  2304. $review = $this->input->get('review',true);
  2305. $type = $this->input->get('type',true);
  2306. $express = $this->input->get('express',true);
  2307. $orderinfo = $this->input->get('orderinfo',true);
  2308. $user = $this->input->get('user',true);
  2309. $client = $this->input->get('name',true);
  2310. $waybill = $this->input->get('waybill',true);
  2311. $number = $this->input->get('number',true);
  2312. $email = $this->input->get('email',true);
  2313. $dlz = $this->input->get('dlz',true);
  2314. $print = $this->input->get('print',true);
  2315. $library = $this->input->get('library',true);
  2316. $timetk = strtotime($timetk)+12*3600;
  2317. $timetj = strtotime($timetj)+12*3600;
  2318. $where = "mergeid = 0 and type = 5 and review = 6 and (".rtrim($fgshop,'or').")";
  2319. if($timetk && $timetj)
  2320. {
  2321. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  2322. }
  2323. if($shop)
  2324. {
  2325. $where .= " and shop = '$shop'";
  2326. }
  2327. if($source)
  2328. {
  2329. $where .= " and source = '$source'";
  2330. }
  2331. if($state)
  2332. {
  2333. $where .= " and state = '$state'";
  2334. }
  2335. if($type)
  2336. {
  2337. $where .= " and type = '$type'";
  2338. }
  2339. if($orderinfo)
  2340. {
  2341. $where .= " and orderinfo = '$orderinfo'";
  2342. }
  2343. if($user)
  2344. {
  2345. $where .= " and user = '$user'";
  2346. }
  2347. if($print)
  2348. {
  2349. $where .= " and print = '$print'";
  2350. }
  2351. if($library)
  2352. {
  2353. $where .= " and library = '$library'";
  2354. }
  2355. /* 匹配ID加入 */
  2356. $tc = array();
  2357. $typeclass = $this->typeclass->find_all();
  2358. foreach ($typeclass as $v)
  2359. {
  2360. $tc[$v['id']] = $v['title'];
  2361. }
  2362. //取得信息列表
  2363. $info_list = $this->fullorder->find_all($where.$wid,'id,shop,number,orderinfo,client,country,province,city,zipcode,address,phone,waybill,shipremarks,zzl,bx,qm,js,dtime,printtime,librarytime,retreattime');
  2364. //格式化数据
  2365. $i = 1;
  2366. foreach ($info_list as $key=>$value)
  2367. {
  2368. $ud = $this->fullorder->read($value['id']);
  2369. $shop = $this->shop->read($value['shop']);
  2370. $info_list[$key]['shop'] = $shop['shopname'];
  2371. $info_list[$key]['id'] = $i;
  2372. $country = $this->country->read($value['country']);
  2373. $info_list[$key]['country'] = $country['ename'];
  2374. $info_list[$key]['qm'] = ($value['qm']==1)?'需要签名':'不签名';
  2375. $info_list[$key]['js'] = ($value['js']==1)?'优先服务':'普通';
  2376. $fpdata = array();
  2377. if(stripos($ud['fpdata'],';') !== false)
  2378. {
  2379. $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']-12*3600);
  2380. $info_list[$key]['printtime'] = ($value['printtime']!=0)?date('Y-m-d H:i:s',$value['printtime']-12*3600):'';
  2381. $info_list[$key]['librarytime'] = ($value['librarytime']!=0)?date('Y-m-d H:i:s',$value['librarytime']-12*3600):'';
  2382. $info_list[$key]['retreattime'] = ($value['retreattime']!=0)?date('Y-m-d H:i:s',$value['retreattime']-12*3600):'';
  2383. $fpdata = explode(';',rtrim($ud['fpdata'],';'));
  2384. foreach ($fpdata as $ke=>$va)
  2385. {
  2386. $v = explode('|',rtrim($va,'|'));
  2387. $one = explode('-',rtrim($v[0],'-'));
  2388. if($one['2'] == 163 || $one['2'] == 164 || $one['2'] == 165 || $one['2'] == 166)
  2389. {
  2390. $one['3'] = isset($tc[$one['3']])?$tc[$one['3']]:'无';
  2391. $one['4'] = isset($tc[$one['4']])?$tc[$one['4']]:'无';
  2392. $v[1] = str_replace(array('Hair Weaving','Closure','Wigs','Clip-in Full Head',$one['3'],$one['4']),array('','','','','',''),$v[1]);
  2393. $v[1] = preg_replace('/(\d+)inch/','',$v[1]);
  2394. $v[1] = ltrim($v[1],' ');
  2395. $fpdata[$ke] = array($v[5],$one['3'],$one['4'],$v[1],$v[2]);//内容,尺寸,等级,颜色,数量
  2396. }
  2397. else
  2398. {
  2399. $one['2'] = isset($tc[$one['2']])?$tc[$one['2']]:'无';
  2400. $one['3'] = isset($tc[$one['3']])?$tc[$one['3']]:'无';
  2401. $v[1] = str_replace(array('Hair Weaving','Closure','Wigs','Clip-in Full Head',$one['2'],$one['3']),array('','','','','',''),$v[1]);
  2402. $v[1] = preg_replace('/(\d+)inch/','',$v[1]);
  2403. $v[1] = ltrim($v[1],' ');
  2404. $fpdata[$ke] = array($v[5],$one['2'],$one['3'],$v[1],$v[2]);//内容,尺寸,等级,颜色,数量 线下单没有真人发类型
  2405. }
  2406. }
  2407. }
  2408. $info_list[$key]['fpdata'] = $fpdata;
  2409. $i++;
  2410. }
  2411. $title = "独立站订单信息";
  2412. $titlename = "<table border=1>
  2413. <tr><th colspan='19' align='left'><h3>".$title."<h3></th></tr>
  2414. <tr>
  2415. <td>NO.</td>
  2416. <td>店铺</td>
  2417. <td>编码</td>
  2418. <td>订单号</td>
  2419. <td>姓名</td>
  2420. <td>国家</td>
  2421. <td>州</td>
  2422. <td>城市</td>
  2423. <td>邮编</td>
  2424. <td>地址</td>
  2425. <td>电话</td>
  2426. <td>运单号</td>
  2427. <td>备注</td>
  2428. <td>重量</td>
  2429. <td>保险</td>
  2430. <td>签名</td>
  2431. <td>快递服务</td>
  2432. <td>订单时间(美国时间)</td>
  2433. <td>打印时间(美国时间)</td>
  2434. <td>出库时间(美国时间)</td>
  2435. <td>退库时间(美国时间)</td>
  2436. <td>
  2437. <table border=1>
  2438. <tr><td colspan='5' align='center'>订单产品信息</td></tr>
  2439. <tr>
  2440. <td>尺寸</td>
  2441. <td>等级</td>
  2442. <td>颜色</td>
  2443. <td>花型</td>
  2444. <td>数量</td>
  2445. </tr>
  2446. </table>
  2447. </td>
  2448. <td>总条数</td>
  2449. </table>";
  2450. $filename = $title.".xls";
  2451. $tail = "<tr><td></td></tr>\n";
  2452. $this->excel->get_fz($info_list,$titlename,$filename,$tail);
  2453. }
  2454. }
  2455. public function _black()
  2456. {
  2457. $post = $this->input->post(NULL, TRUE);
  2458. if(isset($post['bd']))
  2459. {
  2460. $bd = $this->input->post('bd',true);
  2461. $rows = $this->fullorder_smt->read($bd);
  2462. $post['shop'] = $rows['shop'];
  2463. $post['source'] = 1;
  2464. $post['name'] = $rows['client'];
  2465. $post['email'] = $rows['email'];
  2466. $post['phone'] = $rows['phone'];
  2467. $post['country'] = $rows['country'];
  2468. $post['money'] = $rows['shouldmoney'];
  2469. $post['num'] = 1;
  2470. $post['time'] = $rows['dtime'];
  2471. $post['province'] = $rows['province'];
  2472. $post['city'] = $rows['city'];
  2473. $post['street'] = $rows['street'];
  2474. $post['address'] = $rows['address'];
  2475. $post['address2'] = $rows['address2'];
  2476. $post['zipcode'] = $rows['zipcode'];
  2477. $post['type'] = 2;
  2478. if($this->customer->insert($post))
  2479. {
  2480. $this->fullorder_smt->save(array('black'=>1),$bd);
  2481. echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
  2482. }
  2483. else
  2484. {
  2485. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2486. }
  2487. }
  2488. }
  2489. public function _ryf()
  2490. {
  2491. $post = $this->input->post(NULL, TRUE);
  2492. if(isset($post['bd']))
  2493. {
  2494. $bd = $this->input->post('bd',true);
  2495. $d = $this->fullorder_smt->read($bd);
  2496. if($d['state'] == 207 || $d['state'] == 207)//订单状态为等待发货或等待部分发货才可更改为允许发货
  2497. {
  2498. if($d['print'] < 3)//打印状态为未打印
  2499. {
  2500. $print = 1;//未打印
  2501. $libraryconfirm = 1;//不允许出库
  2502. $a = "订单未打印,";
  2503. }
  2504. else//已打印订单
  2505. {
  2506. $libraryconfirm = 2;//允许出库
  2507. $a = "";
  2508. }
  2509. if($this->fullorder_smt->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd))
  2510. {
  2511. echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
  2512. }
  2513. else
  2514. {
  2515. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2516. }
  2517. }
  2518. if($this->fullorder_smt->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd))
  2519. {
  2520. echo json_encode(array('msg'=>'操作失败!订单未非发货状态','success'=>false));exit;
  2521. }
  2522. else
  2523. {
  2524. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2525. }
  2526. }
  2527. }
  2528. public function _fsstate()
  2529. {
  2530. $post = $this->input->post(NULL, TRUE);
  2531. if(isset($post['s']))
  2532. {
  2533. $id_arr = $this->input->post('s');
  2534. $id_arr = explode(',',$id_arr);
  2535. if(!$id_arr)
  2536. {
  2537. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  2538. }
  2539. foreach ($id_arr as $v)
  2540. {
  2541. $data = $this->fullorder_smt->read($v);
  2542. $warehouse = $this->warehouse->read($data['type']);
  2543. $fs = $this->notice->get_ordertatus($data['state']);
  2544. if($fs)
  2545. {
  2546. $ck = $this->_email($fs['content'],$data,$warehouse['company']);
  2547. if($ck == 1)
  2548. {
  2549. $this->fullorder_smt->save(array('fscontent'=>date('Y-m-d H:i:s',time()).'已发送:'.$fs['title'].' - '),$v);
  2550. }
  2551. }
  2552. }
  2553. echo json_encode(array('msg'=>'发送完成!','success'=>true));exit;
  2554. }
  2555. }
  2556. public function _power()
  2557. {
  2558. $post = $this->input->post(NULL, TRUE);
  2559. if(isset($post['id']))
  2560. {
  2561. $id = $this->input->post('id',true);
  2562. $fullorder_smt = $this->fullorder_smt->read($id);
  2563. if($this->fullorder_smt->save(array('library'=>1,'librarytime'=>0,'libraryconfirm'=>2,'print'=>1,'printtime'=>0,'printnumber'=>0,'retreattime'=>0,'librarynot'=>'订单未打印,未审核或未通过','review'=>1,'state'=>207,'waybill'=>'','oldwaybill'=>'-'.date('Ymd',$fullorder_smt['printtime']).'/'.$fullorder_smt['waybill']),$id))
  2564. {
  2565. echo json_encode(array('msg'=>'重置成功','success'=>true));exit;
  2566. }
  2567. else
  2568. {
  2569. echo json_encode(array('msg'=>'重置失败,请重试','success'=>false));exit;
  2570. }
  2571. }
  2572. }
  2573. public function _expresstype()
  2574. {
  2575. $post = $this->input->post(NULL, TRUE);
  2576. if(isset($post['id']))
  2577. {
  2578. $id = $this->input->post('id',true);
  2579. $data = $this->express->read($id);
  2580. echo json_encode(array('msg'=>$data['type'],'success'=>true));exit;
  2581. }
  2582. }
  2583. public function _email($content,$data,$shopname)
  2584. {
  2585. $express = $this->express->read($data['express']);
  2586. $t= array('$userName','$orderid','$trackingNumber','$expressCompany','$contactPerson','$mobileNo','$zip','$recipientAddress');//需要被替换的内容
  2587. $h= array($data['client'],$data['orderinfo'],$data['waybill'],$express['servicename'],$data['name'],$data['phone'],$data['zipcode'],$data['address']);//替换的内容
  2588. $content = str_replace($t,$h,$content);
  2589. $this->load->library('email');
  2590. $config['protocol'] = 'smtp';
  2591. $config['smtp_host'] = 'smtpdm-ap-southeast-1.aliyun.com';
  2592. $config['smtp_port'] = 465;
  2593. $config['smtp_user'] = 'service@email.supernovahair.com';
  2594. $config['smtp_pass'] = 'LONGyihair374';
  2595. $config['smtp_crypto'] = 'ssl';
  2596. $config['crlf'] = "\r\n";
  2597. $config['newline'] = "\r\n";
  2598. $this->email->initialize($config);
  2599. $this->email->from('service@email.supernovahair.com',$shopname);
  2600. $this->email->to($data['email']);//收件
  2601. $this->email->subject('The product you purchased has a new progress');//标题
  2602. $this->email->message($content);//内容
  2603. if ( ! $this->email->send())
  2604. {
  2605. return 2;
  2606. }
  2607. else
  2608. {
  2609. return 1;
  2610. }
  2611. }
  2612. public function _error()
  2613. {
  2614. if(isset($_SESSION['api']))
  2615. {
  2616. $user = $this->user->get_api($_SESSION['api']);
  2617. $usp = $user;
  2618. $fgshop = "";$sid = "";
  2619. $user = explode('|',trim($user['shop'],'|'));
  2620. foreach ($user as $value)
  2621. {
  2622. $fgshop .= " shop = ".$value." or";
  2623. $sid .= " id = ".$value." or";
  2624. }
  2625. }
  2626. $post = $this->input->post(NULL, TRUE);
  2627. if(isset($post['page']))
  2628. {
  2629. $page = $this->input->post('page',true);
  2630. $perpage = $this->input->post('perpage',true);
  2631. $orderinfo = $this->input->post('orderinfo',true);
  2632. $waybill = $this->input->post('waybill',true);
  2633. $number = $this->input->post('number',true);
  2634. $timetk = $this->input->post('timetk',true);
  2635. $timetj = $this->input->post('timetj',true);
  2636. $timetk = strtotime($timetk);
  2637. $timetj = strtotime($timetj);
  2638. $where = "print = 1 and failed !='' and mergeid = 0 and waybill = '' and (".rtrim($fgshop,'or').")";
  2639. if($orderinfo)
  2640. {
  2641. $where .= " and orderinfo = '$orderinfo'";
  2642. }
  2643. if($waybill)
  2644. {
  2645. $where .= " and waybill = '$waybill'";
  2646. }
  2647. if($number)
  2648. {
  2649. $where .= " and number = '$number'";
  2650. }
  2651. if($timetk && $timetj)
  2652. {
  2653. $timetj = $timetj+24*3600;
  2654. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  2655. }
  2656. //数据排序
  2657. $order_str = "dtime desc";
  2658. if(empty($page))
  2659. {
  2660. $start = 0;
  2661. $perpage = 1;
  2662. }
  2663. else
  2664. {
  2665. $start = ($page - 1)*$perpage;
  2666. }
  2667. $info_list_smt = $this->fullorder_smt->find_all($where,'id,shop,type,orderinfo,number,express,failed,operation',$order_str,$start,$perpage);
  2668. //格式化数据
  2669. foreach ($info_list_smt as $key=>$value)
  2670. {
  2671. $ud = $this->fullorder_smt->read($value['id']);
  2672. $shop = $this->shop->read($value['shop']);
  2673. $info_list_smt[$key]['shop'] = $shop['shopname'];
  2674. $info_list_smt[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder_smt/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'>".$value['orderinfo']."<p>";
  2675. $warehouse = $this->warehouse->read($value['type']);
  2676. $warehousetitle = $warehouse['title'];
  2677. if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  2678. $info_list_smt[$key]['type'] = $warehousetitle;
  2679. if($value['express'] != 0)
  2680. {
  2681. $express = $this->express->read($value['express']);
  2682. $expressservicename = $express['servicename'];
  2683. if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
  2684. $info_list_smt[$key]['express'] = $expressservicename;
  2685. }
  2686. else
  2687. {
  2688. $info_list_smt[$key]['express'] = "无";
  2689. }
  2690. $x = "";
  2691. if($ud['review'] >4 && $ud['print'] == 1)
  2692. {
  2693. $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
  2694. }
  2695. $info_list_smt[$key]['operation'] = $x;
  2696. }
  2697. $total = $this->fullorder_smt->find_count($where);
  2698. $pagenum = ceil($total/$perpage);
  2699. $over = $total-($start+$perpage);
  2700. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list_smt));
  2701. echo json_encode($rows);exit;
  2702. }
  2703. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  2704. $this->data['wlshop'] = $wlshop;
  2705. $this->data['express'] = $this->express->find_all();
  2706. $fullorderexcel = $this->fullorderexcel->find_all('type=1','*','idorder desc');//导出模板
  2707. $this->data['fullorderexcel'] = $fullorderexcel;
  2708. $this->_Template('fullorder_smt_error',$this->data);
  2709. }
  2710. public function _dlzerror()
  2711. {
  2712. if(isset($_SESSION['api']))
  2713. {
  2714. $user = $this->user->get_api($_SESSION['api']);
  2715. $usp = $user;
  2716. $fgshop = "";$sid = "";
  2717. $user = explode('|',trim($user['shop'],'|'));
  2718. foreach ($user as $value)
  2719. {
  2720. $fgshop .= " shop = ".$value." or";
  2721. $sid .= " id = ".$value." or";
  2722. }
  2723. }
  2724. $post = $this->input->post(NULL, TRUE);
  2725. if(isset($post['page']))
  2726. {
  2727. $page = $this->input->post('page',true);
  2728. $perpage = $this->input->post('perpage',true);
  2729. $orderinfo = $this->input->post('orderinfo',true);
  2730. $waybill = $this->input->post('waybill',true);
  2731. $number = $this->input->post('number',true);
  2732. $timetk = $this->input->post('timetk',true);
  2733. $timetj = $this->input->post('timetj',true);
  2734. $timetk = strtotime($timetk);
  2735. $timetj = strtotime($timetj);
  2736. $where = "print = 1 and failed !='' and mergeid = 0 and waybill = '' and (".rtrim($fgshop,'or').")";
  2737. if($orderinfo)
  2738. {
  2739. $where .= " and orderinfo = '$orderinfo'";
  2740. }
  2741. if($waybill)
  2742. {
  2743. $where .= " and waybill = '$waybill'";
  2744. }
  2745. if($number)
  2746. {
  2747. $where .= " and number = '$number'";
  2748. }
  2749. if($timetk && $timetj)
  2750. {
  2751. $timetj = $timetj+24*3600;
  2752. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  2753. }
  2754. //数据排序
  2755. $order_str = "dtime desc";
  2756. if(empty($page))
  2757. {
  2758. $start = 0;
  2759. $perpage = 1;
  2760. }
  2761. else
  2762. {
  2763. $start = ($page - 1)*$perpage;
  2764. }
  2765. $info_list = $this->fullorder->find_all($where.' and type = 5','id,shop,type,orderinfo,number,express,failed,operation',$order_str,$start,$perpage);
  2766. //格式化数据
  2767. foreach ($info_list as $key=>$value)
  2768. {
  2769. $ud = $this->fullorder->read($value['id']);
  2770. $shop = $this->shop->read($value['shop']);
  2771. $info_list[$key]['shop'] = $shop['shopname'];
  2772. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder_smt/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'>".$value['orderinfo']."<p>";
  2773. $warehouse = $this->warehouse->read($value['type']);
  2774. $warehousetitle = $warehouse['title'];
  2775. if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  2776. $info_list[$key]['type'] = $warehousetitle;
  2777. if($value['express'] != 0)
  2778. {
  2779. $express = $this->express->read($value['express']);
  2780. $expressservicename = $express['servicename'];
  2781. if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
  2782. $info_list[$key]['express'] = $expressservicename;
  2783. }
  2784. else
  2785. {
  2786. $info_list[$key]['express'] = "无";
  2787. }
  2788. $x = "";
  2789. if($ud['review'] >4 && $ud['print'] == 1)
  2790. {
  2791. $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
  2792. }
  2793. $info_list[$key]['operation'] = $x;
  2794. }
  2795. $total = $this->fullorder->find_count($where.' and type = 5');
  2796. $pagenum = ceil($total/$perpage);
  2797. $over = $total-($start+$perpage);
  2798. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  2799. echo json_encode($rows);exit;
  2800. }
  2801. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  2802. $this->data['wlshop'] = $wlshop;
  2803. $this->data['express'] = $this->express->find_all();
  2804. $fullorderexcel = $this->fullorderexcel->find_all('type=1','*','idorder desc');//导出模板
  2805. $this->data['fullorderexcel'] = $fullorderexcel;
  2806. $this->_Template('fullorder_smt_errordlz',$this->data);
  2807. }
  2808. }