load->library('session'); $this->load->_model('Model_fullorder_smt','fullorder_smt'); $this->load->_model('Model_fullorder','fullorder'); $this->load->_model('Model_fullordertt','fullordertt'); $this->load->_model('Model_fullorderexcel','fullorderexcel'); $this->load->_model('Model_shop','shop'); $this->load->_model('Model_typeclass','typeclass'); $this->load->_model('Model_express','express'); $this->load->_model('Model_country','country'); $this->load->_model('Model_productdescribe','productdescribe'); $this->load->_model('Model_customs','customs'); $this->load->_model('Model_detailed','detailed'); $this->load->_model('Model_productdescription','productdescription'); $this->load->_model('Model_logistics','logistics'); $this->load->_model('Model_hl','hl'); $this->load->_model('Model_excel','excel'); $this->load->_model('Model_warehouse','warehouse'); $this->load->_model('Model_customer','customer'); $this->load->_model('Model_user','user'); $this->load->_model('Model_dhl','dhl'); $this->load->_model('Model_notice','notice'); $this->load->_model('Model_api','api'); } //定义方法的调用规则 获取URI第二段值 public function _remap($arg,$arg_array) { if($arg == 'add')//添加 { $this->_add(); } else if($arg == 'edit')//修改 { $this->_edit($arg_array); } else if($arg == 'readonly')//修改 { $this->_readonly($arg_array); } else if($arg == 'readlist') { $this->_readlist(); } else if($arg == 'del')//修改 { $this->_del(); } else if($arg == 'price')//价格明细 { $this->_price(); } else if($arg == 'customs') { $this->_customs(); } else if($arg == 'express') { $this->_express(); } else if($arg == 'hl') { $this->_hl(); } else if($arg == 'repeat') { $this->_repeat(); } else if($arg == 'operation') { $this->_operation(); } else if($arg == 'merge') { $this->_merge(); } else if($arg == 'fmexcel') { $this->_fmexcel(); } else if($arg == 'fdexcel') { $this->_fdexcel(); } else if($arg == 'fdfexcel') { $this->_fdfexcel(); } else if($arg == 'excel') { $this->_excel(); } else if($arg == 'exceldlz') { $this->_exceldlz(); } else if($arg == 'evaluate') { $this->_evaluate(); } else if($arg == 'state') { $this->_state(); } else if($arg == 'review') { $this->_review(); } else if($arg == 'black') { $this->_black(); } else if($arg == 'ryf') { $this->_ryf(); } else if($arg == 'expresstype') { $this->_expresstype(); } else if($arg == 'fsstate') { $this->_fsstate(); } else if($arg == 'power') { $this->_power(); } else if($arg == 'error') { $this->_error(); } else if($arg == 'dlzerror') { $this->_dlzerror(); } else if($arg == 'dlz') { $this->_dlz(); } else { $this->_index(); } } //管理 public function _index() { $dt = 0; if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $warehouse = $this->input->post('warehouse',true); $xztime = $this->input->post('xztime',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $shop = $this->input->post('shop',true); $source = $this->input->post('source',true); $state = $this->input->post('state',true); $review = $this->input->post('review',true); $type = $this->input->post('type',true); $express = $this->input->post('express',true); $orderinfo = $this->input->post('orderinfo',true); $user = $this->input->post('user',true); $client = $this->input->post('name',true); $waybill = $this->input->post('waybill',true); $number = $this->input->post('number',true); $email = $this->input->post('email',true); $dlz = $this->input->post('dlz',true); $print = $this->input->post('print',true); $library = $this->input->post('library',true); $timetk = strtotime($timetk)+12*3600; $timetj = strtotime($timetj)+12*3600; $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")"; if($warehouse) { $where .= " and type = '$warehouse'"; } if($timetk && $timetj) { $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { $where .= " and state = '$state'"; } if($review) { $where .= " and review = '$review'"; } if($type) { $where .= " and type = '$type'"; } if($express) { $where .= " and express = '$express'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($client) { $where .= " and client like '%$client%'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } if($number) { $where .= " and number = '$number'"; } if($email) { $where .= " and email = '$email'"; } if($library) { $where .= " and library = '$library'"; } if($print) { $where .= " and print = '$print'"; } if($dlz != '') { $where .= " and dlz = '$dlz'"; } //数据排序 $order_str = "numberpx desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表id,shop,type,source,user,orderinfo,number,name,state,buytime,clientremarks,review,print,library,libraryconfirm,express,waybill,orderremarks,black $info_list = $this->fullorder_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); //格式化数据 foreach ($info_list as $key=>$value) { $ud = $this->fullorder_smt->read($value['id']); $ud['address'] = str_replace("'","’",$ud['address']); $ud['name'] = str_replace("'","’",$ud['name']); $customer = $this->customer->get_email($ud['email'],$value['shop']); $customerb = $this->customer->get_shopdata($ud['name'],$ud['email'],$ud['address'],$value['shop']); //$a = array_column($customer, 'email'); //三维找其中健的数组 //$a = array_flip($a); //键和值调换 $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; //$info_list[$key]['user'] = $shop['shopuser']; $warehouse = $this->warehouse->read($value['type']); $warehousetitle = $warehouse['title']; if($value['type'] != 1){$warehousetitle = "".$warehouse['title']."";} $info_list[$key]['type'] = $warehousetitle; $typeclass = $this->typeclass->read($value['state']); $info_list[$key]['state'] = $typeclass['spare']; if($ud['source'] == 1) //线下单用订单时间,其他用付款时间 { $info_list[$key]['buytime'] = '

'.date('Y-m-d',$ud['dtime']).'

'.date('H:i:s',$ud['dtime']).'

'; } else { $info_list[$key]['buytime'] = '

'.date('Y-m-d',$value['buytime']+$dt).'

'.date('H:i:s',$value['buytime']+$dt).'

'; } if($ud['dlz'] == 1) { $dlz = "

独立站已更新

"; } else if($ud['dlz'] == 3) { $dlz = "

不需要更新

"; } else if($ud['dlz'] == 2) { $dlz = "

独立站更新失败

"; } else { $dlz = ""; } if($value['waybill'] != "") { $info_list[$key]['waybill'] = "

".$value['waybill']."

".$dlz; } if($value['express'] != 0) { $express = $this->express->read($value['express']); $expressservicename = $express['servicename']; if($value['express'] != 1){$expressservicename = "".$express['servicename']."";} $info_list[$key]['express'] = $expressservicename; } else { $info_list[$key]['express'] = "无"; } $x = ""; if($value['libraryconfirm'] == 2 && $ud['review'] > 4 && $ud['library'] == 1) { $x = "

禁止发货

"; } else if(($ud['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1) { $x = "

允许发货

"; } if(($ud['review'] > 4) && $ud['print'] == 2) { $x = "

禁止打印

"; } else if($ud['review'] >4 && $ud['print'] == 1) { $x = "

允许打印

"; } if($value['waybill'] == "" && $ud['review'] > 4) { $x = $x."

填写运单

"; } else if($value['waybill'] != "" && $ud['review'] > 4) { $x = $x."

修改运单

"; } 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) { $x = $x."

提交审核

"; } if($value['black'] == 0) { $x = $x."

加黑名单

"; } $info_list[$key]['black'] = $x; $tly = ""; if($value['clientremarks'] != "") { $tly = "

有客户留言

"; } if($value['state'] == 217) { $info_list[$key]['orderinfo'] = "

".$value['orderinfo']."

".$tly."
"; } else { $info_list[$key]['orderinfo'] = "

".$value['orderinfo']."

".$tly."
"; } if($value['library'] == 1) { $info_list[$key]['library'] = "未出库"; } else if($value['library'] == 2) { $info_list[$key]['library'] = "已出库"; } else if($value['library'] == 3) { $info_list[$key]['library'] = "退库"; } if($value['fpdata'] != "") { $info_list[$key]['fpdata'] = "有"; } else { $info_list[$key]['fpdata'] = "没有"; } } $total = $this->fullorder_smt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->data['express'] = $this->express->find_all(); $fullorderexcel = $this->fullorderexcel->find_all('type=1','*','idorder desc');//导出模板 $this->data['fullorderexcel'] = $fullorderexcel; $error = $this->fullorder_smt->find_count("print = 1 and failed !='' and mergeid = 0 and waybill = '' and (".rtrim($fgshop,'or').")"); $this->data['error'] = $error; $this->_Template('fullorder_smt',$this->data); } //管理 public function _dlz() { $dt = 0; if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $warehouse = $this->input->post('warehouse',true); $xztime = $this->input->post('xztime',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $shop = $this->input->post('shop',true); $source = $this->input->post('source',true); $state = $this->input->post('state',true); $review = $this->input->post('review',true); $type = $this->input->post('type',true); $express = $this->input->post('express',true); $orderinfo = $this->input->post('orderinfo',true); $user = $this->input->post('user',true); $client = $this->input->post('name',true); $waybill = $this->input->post('waybill',true); $number = $this->input->post('number',true); $email = $this->input->post('email',true); $dlz = $this->input->post('dlz',true); $print = $this->input->post('print',true); $library = $this->input->post('library',true); $timetk = strtotime($timetk)+12*3600; $timetj = strtotime($timetj)+12*3600; $where = "mergeid = 0 and type = 5 and review = 6 and state != 217 and state != 214 and (".rtrim($fgshop,'or').")"; if($warehouse) { $where .= " and type = '$warehouse'"; } if($timetk && $timetj) { $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { $where .= " and state = '$state'"; } if($review) { $where .= " and review = '$review'"; } if($type) { $where .= " and type = '$type'"; } if($express) { $where .= " and express = '$express'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($client) { $where .= " and client like '%$client%'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } if($number) { $where .= " and number = '$number'"; } if($email) { $where .= " and email = '$email'"; } if($library) { $where .= " and library = '$library'"; } if($print) { if($print = 2) { $where .= " and waybill = ''"; } $where .= " and print = '$print'"; } if($dlz != '') { $where .= " and dlz = '$dlz'"; } //数据排序 $order_str = "dtime desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表id,shop,type,source,user,orderinfo,number,name,state,buytime,clientremarks,review,print,library,libraryconfirm,express,waybill,orderremarks,black $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,client,state,buytime,libraryconfirm,express,waybill,orderremarks,reviewremarks,printnumber,library,black,clientremarks',$order_str,$start,$perpage); //格式化数据 foreach ($info_list as $key=>$value) { $ud = $this->fullorder->read($value['id']); $ud['address'] = str_replace("'","’",$ud['address']); $ud['name'] = str_replace("'","’",$ud['name']); $customer = $this->customer->get_email($ud['email'],$value['shop']); $customerb = $this->customer->get_shopdata($ud['name'],$ud['email'],$ud['address'],$value['shop']); //$a = array_column($customer, 'email'); //三维找其中健的数组 //$a = array_flip($a); //键和值调换 $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; //$info_list[$key]['user'] = $shop['shopuser']; $warehouse = $this->warehouse->read($value['type']); $warehousetitle = $warehouse['title']; if($value['type'] != 1){$warehousetitle = "".$warehouse['title']."";} $info_list[$key]['type'] = $warehousetitle; $typeclass = $this->typeclass->read($value['state']); $info_list[$key]['state'] = $typeclass['spare']; if($ud['source'] == 1) //线下单用订单时间,其他用付款时间 { $info_list[$key]['buytime'] = '

'.date('Y-m-d',$ud['dtime']).'

'.date('H:i:s',$ud['dtime']).'

'; } else { $info_list[$key]['buytime'] = '

'.date('Y-m-d',$value['buytime']+$dt).'

'.date('H:i:s',$value['buytime']+$dt).'

'; } if($value['waybill'] != "") { $info_list[$key]['waybill'] = "

".$value['waybill']."

"; } if($value['express'] != 0) { $express = $this->express->read($value['express']); $expressservicename = $express['servicename']; if($value['express'] != 1){$expressservicename = "".$express['servicename']."";} $info_list[$key]['express'] = $expressservicename; } else { $info_list[$key]['express'] = "无"; } $x = ""; if($value['libraryconfirm'] == 2 && $ud['review'] > 4 && $ud['library'] == 1) { $x = "

禁止发货

"; } else if(($ud['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1) { $x = "

允许发货

"; } if(($ud['review'] > 4) && $ud['print'] == 2) { $x = "

禁止打印

"; } else if($ud['review'] >4 && $ud['print'] == 1) { $x = "

允许打印

"; } if($value['waybill'] == "" && $ud['review'] > 4) { $x = $x."

填写运单

"; } else if($value['waybill'] != "" && $ud['review'] > 4) { $x = $x."

修改运单

"; } 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) { $x = $x."

提交审核

"; } if($value['black'] == 0) { $x = $x."

加黑名单

"; } $info_list[$key]['black'] = $x; $tly = ""; if($value['clientremarks'] != "") { $tly = "

有客户留言

"; } if($value['state'] == 217) { $info_list[$key]['orderinfo'] = "

".$value['orderinfo']."

".$tly."
"; } else { $info_list[$key]['orderinfo'] = "

".$value['orderinfo']."

".$tly."
"; } if($value['library'] == 1) { $info_list[$key]['library'] = "未出库"; } else if($value['library'] == 2) { $info_list[$key]['library'] = "已出库"; } else if($value['library'] == 3) { $info_list[$key]['library'] = "退库"; } } $total = $this->fullorder->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->data['express'] = $this->express->find_all(); $fullorderexcel = $this->fullorderexcel->find_all('type=1','*','idorder desc');//导出模板 $this->data['fullorderexcel'] = $fullorderexcel; $error = $this->fullorder->find_count("print = 1 and failed !='' and mergeid = 0 and waybill = '' and type = 5 and (".rtrim($fgshop,'or').")"); $this->data['error'] = $error; $this->_Template('fullorder_smt_dlz',$this->data); } //筛选重复订单 public function _repeat() { $user = $this->user->get_api($_SESSION['api']); if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $shop = $this->input->post('shop',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "print != 3 and (".rtrim($fgshop,'or').")"; if($shop) { $where .= " and shop = '$shop'"; } if($timetk && $timetj) { $where .= " and dtime > '$timetk' and dtime < '$timetj'"; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $info_list = $this->fullorder_smt->find_all($where,'id,shop,type,orderinfo,number,state,buytime,name,email,address'); $info = array(); $len = count($info_list); //格式化数据 foreach ($info_list as $key=>$value) { $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $warehouse = $this->warehouse->read($value['type']); $info_list[$key]['type'] = $warehouse['title']; $typeclass = $this->typeclass->read($value['state']); $info_list[$key]['state'] = $typeclass['title']; $info_list[$key]['buytime'] = '

'.date('Y-m-d',$value['buytime']).'

'.date('H:i:s',$value['buytime']).'

'; } /** 操作合并 if($value['merge'] == 0) { $info_list[$key]['merge'] = "

合并订单

"; } else { if($value['merge'] == $value['id']) { $info_list[$key]['merge'] = "已合并"; } else { $info_list[$key]['merge'] = "被合并"; } } **/ for($i=0;$i<$len;$i++) { for($j=$i+1;$j<$len;$j++) { if ($info_list[$i]['name'] == $info_list[$j]['name'] || $info_list[$i]['address'] == $info_list[$j]['address'] || $info_list[$i]['email'] == $info_list[$j]['email']) { if(!array_key_exists($j,$info)) { $info[$j] = $info_list[$j]; } if(!array_key_exists($i,$info)) { $info[$i] = $info_list[$i]; } } } } rsort($info); $total = count($info); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_slice($info,$start,$perpage))); echo json_encode($rows);exit; } $this->_Template('fullorder_smt_repeat',$this->data); } //修改 public function _edit($arg_array) { $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $id = $this->input->post('id',true); $data = $this->fullorder_smt->read($id); $post['type'] = $this->input->post('warehouse',true); $post['country'] = $this->input->post('country',true); $currency = $this->country->read($post['country']); $post['al'] = $currency['lb']; $post['freight'] = $this->input->post('freight',true); $post['expressmoney'] = $this->input->post('expressmoney',true); $post['shouldmoney'] = $this->input->post('shouldmoney',true); $post['orderremarks'] = $this->input->post('orderremarks',true); $post['shipremarks'] = $this->input->post('shipremarks'); $post['email'] = $this->input->post('email',true); $name = $this->input->post('name',true); $post['name'] = str_replace("'","’",$name); $post['phone'] = $this->input->post('phone',true); $post['country'] = $this->input->post('country',true); $post['province'] = $this->input->post('province',true); $post['city'] = $this->input->post('city',true); $post['zipcode'] = $this->input->post('zipcode',true); $post['street'] = $this->input->post('street',true); $address = $this->input->post('address',true); $post['address'] = str_replace("'","’",$address); $post['express'] = $this->input->post('express',true); $post['printtype'] = $this->input->post('printtype',true); $post['fpdata'] = $this->input->post('fpdata'); $post['waybill'] = $this->input->post('waybill',true); $post['msg'] = $this->input->post('msg',true); $post['zsbjz'] = $this->input->post('zsbjz',true); $post['refundy'] = $this->input->post('refundy',true); $post['refundj'] = $this->input->post('refundj',true); $rtime = $this->input->post('rtime',true); $post['rtime'] = strtotime($rtime); $post['rpaypal'] = $this->input->post('rpaypal',true); $post['rtext'] = $this->input->post('rtext',true); $editstate = $this->input->post('state',true); $post['review'] = 1; if($post['zsbjz'] < '0.01') { echo json_encode(array('msg'=>'总申报价错误!','success'=>false));exit; } if($data['library'] == 1) { if($data['print'] != 3) { $post['print'] = 1; $post['libraryconfirm'] = 1; $post['librarynot'] = "订单未打印,未审核或未通过"; } else { $post['libraryconfirm'] = 1; $post['librarynot'] = "未审核或未通过"; } } if($post['printtype'] == 1)//如果是运单 { $post['productdescription'] = $this->input->post('productdescription',true); $post['customs'] = $this->input->post('customs',true); } /** if($editstate == 216 && $data['state'] != 216) { echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit; } **/ if($editstate == 216 && preg_match('/\d/is',$post['waybill']) != true) { echo json_encode(array('msg'=>'当前信息不可修改订单状态','success'=>false));exit; } else { $post['review'] = $data['review']; $post['state'] = $editstate; } if($this->fullorder_smt->save($post,$id)) { echo json_encode(array('msg'=>'修改成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit; } } $arg_array = $arg_array[0];$fpdata = array(); $fullorder_smt = $this->fullorder_smt->read($arg_array); $fullorder_smt['parameter'] = str_replace(",","---",$fullorder_smt['parameter']); $country = $this->country->find_all('1=1','id,name');//所有国家信息 $express = $this->express->find_all('1=1');//所有快递配置信息 $this->data['fullorder_smt'] = $fullorder_smt; $this->data['country'] = $country; $this->data['express'] = $express; $this->data['dtime'] = date('Y-m-d H:i:s',$fullorder_smt['dtime']); if(stripos($fullorder_smt['fpdata'],';') !== false) { $fpdata = explode(';',rtrim($fullorder_smt['fpdata'],';')); foreach ($fpdata as $k=>$v) { $fpdata[$k] = explode('|',$v); } } $this->data['fpdata'] = $fpdata; $shop = $this->shop->read($fullorder_smt['shop']); $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例 $is = 0; if($shop['type'] == 269)//判断是否独立站,269是独立站 { $is = 1; } $this->data['is'] = $is; if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); if($user['power'] == 1) { $power = 1; } else { $power = 0; } } else { $power = 0; } $this->data['power'] = $power; /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/ $downwaybill = ''; if($fullorder_smt['printtype'] == 1) { if($fullorder_smt['waybill'] != '') { $downwaybill .= ''.$fullorder_smt['waybill'].'、'; } } $oldwaybill = explode('-',ltrim($fullorder_smt['oldwaybill'],'-')); if(isset($oldwaybill[0][1])) { $oldwaybill = array_reverse($oldwaybill); //调整顺序 foreach ($oldwaybill as $v) { $dw = explode('/',$v); if(isset($dw[1])) { $downwaybill .= ''.$dw[1].'、'; } } } $this->data['downwaybill'] = rtrim($downwaybill,'、'); $this->_Template('fullorder_smt_edit',$this->data); } //不可修改 public function _readonly($arg_array) { $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $id = $this->input->post('id',true); $ud = $this->fullorder_smt->read($id); $post['type'] = $this->input->post('warehouse',true); $post['orderremarks'] = $this->input->post('orderremarks',true); $post['state'] = $this->input->post('state',true); $post['msg'] = $this->input->post('msg',true); $post['refundy'] = $this->input->post('refundy',true); $post['refundj'] = $this->input->post('refundj',true); $post['fpdata'] = $this->input->post('fpdata'); $rtime = $this->input->post('rtime',true); $post['rtime'] = strtotime($rtime); $post['rpaypal'] = $this->input->post('rpaypal',true); $post['rtext'] = $this->input->post('rtext',true); /** if($post['state'] == 216 && $ud['state'] != 216) { echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit; } **/ if($this->fullorder_smt->save($post,$id)) { echo json_encode(array('msg'=>'修改成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit; } } $arg_array = $arg_array[0];$fpdata = array(); $fullorder_smt = $this->fullorder_smt->read($arg_array); $fullorder_smt['parameter'] = str_replace(",","---",$fullorder_smt['parameter']); $this->data['fullorder_smt'] = $fullorder_smt; $this->data['countrys'] = $this->country->find_all(); $this->data['express'] = $this->express->find_all(); if(stripos($fullorder_smt['fpdata'],';') !== false) { $fpdata = explode(';',rtrim($fullorder_smt['fpdata'],';')); foreach ($fpdata as $k=>$v) { $fpdata[$k] = explode('|',$v); } } $this->data['fpdata'] = $fpdata; $shop = $this->shop->read($fullorder_smt['shop']); $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例 $is = 0; if($shop['type'] == 269)//判断是否独立站,269是独立站 { $is = 1; } $this->data['is'] = $is; //单项开始 $warehouse = $this->warehouse->read($fullorder_smt['warehouse']);//发货仓库 $state = $this->typeclass->read($fullorder_smt['state']);//订单状态 $country = $this->country->read($fullorder_smt['country']);//国家 if($fullorder_smt['capital'] == 1) { $capital = '暂未支付'; } else if($fullorder_smt['capital'] == 2) { $capital = '部分支付'; } else if($fullorder_smt['capital'] == 3) { $capital = '全部支付'; } if($fullorder_smt['printtype'] == 1) { $printtype = '运单'; } else if($fullorder_smt['printtype'] == 2) { $printtype = '发货单'; } else if($fullorder_smt['printtype'] == 3) { $printtype = '不打印单据'; } else { $printtype = '未选择'; } $this->data['warehouse'] = $warehouse['title']; $this->data['state'] = $state['title']; $this->data['capital'] = $capital; $this->data['country'] = $country['ename']; $this->data['printtype'] = $printtype; //单项结束 /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/ $downwaybill = ''; if($fullorder_smt['printtype'] == 1) { if($fullorder_smt['waybill'] != '') { $downwaybill .= ''.$fullorder_smt['waybill'].'、'; } } $oldwaybill = explode('-',ltrim($fullorder_smt['oldwaybill'],'-')); if(isset($oldwaybill[0][1])) { $oldwaybill = array_reverse($oldwaybill); //调整顺序 foreach ($oldwaybill as $v) { $dw = explode('/',$v); if(isset($dw[1])) { $downwaybill .= ''.$dw[1].'、'; } } } $this->data['downwaybill'] = rtrim($downwaybill,'、'); $this->_Template('fullorder_smt_readonly',$this->data); } //浏览列表 public function _readlist() { $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $warehouse = $this->input->post('warehouse',true); $express = $this->input->post('express',true); $state = $this->input->post('state',true); $print = $this->input->post('print',true); $libraryconfirm = $this->input->post('libraryconfirm',true); $orderinfo = $this->input->post('orderinfo',true); $client = $this->input->post('name',true); $email = $this->input->post('email',true); $number = $this->input->post('number',true); $waybill = $this->input->post('waybill',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "mergeid = 0"; if($warehouse) { $where .= " and type = '$warehouse'"; } if($express) { $where .= " and express = '$express'"; } if($state) { $where .= " and state = '$state'"; } if($print) { $where .= " and print = '$print'"; } if($libraryconfirm) { $where .= " and libraryconfirm = '$libraryconfirm'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($client) { $where .= " and client like '%$client%'"; } if($email) { $where .= " and email = '$email'"; } if($number) { $where .= " and number = '$number'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } if($timetk && $timetj) { $timetj = $timetj+24*3600; $where .= " and dtime > '$timetk' and dtime < '$timetj'"; } //数据排序 $order_str = "dtime desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $info_list = $this->fullorder_smt->find_all($where,'id,type,orderinfo,number,client,state,buytime,express,waybill,print,library,orderremarks',$order_str,$start,$perpage); //格式化数据 foreach ($info_list as $key=>$value) { $ud = $this->fullorder_smt->read($value['id']); $warehouse = $this->warehouse->read($value['type']); $info_list[$key]['type'] = $warehouse['title']; $typeclass = $this->typeclass->read($value['state']); $info_list[$key]['state'] = $typeclass['spare']; if($ud['source'] == 1) //线下单用订单时间,其他用付款时间 { $info_list[$key]['buytime'] = '

'.date('Y-m-d',$ud['dtime']).'

'.date('H:i:s',$ud['dtime']).'

'; } else { $info_list[$key]['buytime'] = '

'.date('Y-m-d',$value['buytime']).'

'.date('H:i:s',$value['buytime']).'

'; } $express = $this->express->read($value['express']); $info_list[$key]['express'] = $express['servicename']; if($value['print'] == 1) { $info_list[$key]['print'] = "不可打印"; } else if($value['print'] == 2) { $info_list[$key]['print'] = "未打印"; } else if($value['print'] == 3) { $info_list[$key]['print'] = '

'.date('Y-m-d',$ud['printtime']).'

'.date('H:i:s',$ud['printtime']).'

'; } if($value['library'] == 1) { $info_list[$key]['library'] = "未出库"; } else if($value['library'] == 2) { $info_list[$key]['library'] = '

'.date('Y-m-d',$ud['librarytime']).'

'.date('H:i:s',$ud['librarytime']).'

'; } else if($value['library'] == 3) { $info_list[$key]['library'] = "已退库"; } } $total = $this->fullorder_smt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $this->_Template('fullorder_smt_readlist',$this->data); } //删除 public function _del() { $post = $this->input->post(NULL, TRUE); if(isset($post['s'])) { $id_arr = $this->input->post('s'); $id_arr = explode(',',$id_arr); if(!$id_arr) { echo json_encode(array('msg'=>'参数错误!','success'=>false));exit; } //循环删除记录 foreach ($id_arr as $v) { $this->fullorder_smt->remove($v); } echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true)); } } //查找商品价格 public function _price() { $post = $this->input->post(NULL, TRUE); if(isset($post['data'])) { $data = $this->input->post('data'); $data = explode('-',$data); $number = '';$num = count($data); //循环删除记录 for($i=0;$i<$num-1;$i++) { if($data[$i] != 0) { $number=$number.$data[$i]; if($i == 2) { $number=$number.$data[$num-1]; } } } $list = $this->productdescribe->get_number($number); if($list) { echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true)); } else { $list = array('purchase'=>0,'cost'=>0,'salesprice'=>0); //echo json_encode(array('msg'=>'此信息没有配置价格!','n'=>$data[$num-1],'success'=>false));exit; echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));exit; } } } public function _customs() { $post = $this->input->post(NULL, TRUE); if(isset($post['e'])) { $e = $this->input->post('e');//快递信息 $c = $this->input->post('c');//国家信息 $data = $this->customs->find_all('express = "'.$e.'" and country = "'.$c.'"'); $list = $this->productdescription->find_all('express = "'.$e.'" and country = "'.$c.'"'); $rows = array(); foreach ($data as $key=>$value) { $detailed = explode('|',trim($value['detailed'],'|')); //此处未对比重量选择价值,暂直接选择第一条海关价值 $detailed = $this->detailed->read($detailed[0]); $money = $detailed['customsval'];//找到海关价值 } foreach ($list as $key=>$value) { $description = $this->typeclass->read($value['description']); $list[$key]['title'] = $description['title'];//产品描述名称 } if(!$data && !$list) { echo json_encode(array('msg'=>'无此快递配置信息!','success'=>false));exit; } else { //$list-title -description 取值 echo json_encode(array('money'=>sprintf("%.2f",$money),'msg'=>$list,'success'=>true)); } } } public function _express() { $post = $this->input->post(NULL, TRUE); if(isset($post['e'])) { $e = $this->input->post('e');//快递信息 $c = $this->input->post('c');//国家信息 $data = $this->logistics->find_all('express = "'.$e.'" and country = "'.$c.'"'); if(!$data) { echo json_encode(array('success'=>false));exit; } else { echo json_encode(array('money'=>sprintf("%.2f",$data[0]['firstmoney']),'success'=>true)); } } } public function _hl() { $post = $this->input->post(NULL, TRUE); if(isset($post['cy'])) { $hl = 0; $cy = $this->input->post('cy');//币种ID $cy = $this->typeclass->read($cy); $gethl = $this->hl->get_hl(); foreach ($gethl as $v) { $code = str_replace(" ","",$v['code']); if($code == $cy['title']) { $hl = $v['refePrice']/100; } } echo json_encode(array('msg'=>$hl,'success'=>true)); } } public function _operation() { $post = $this->input->post(NULL, TRUE); if(isset($post['type'])) { $type = $this->input->post('type'); $id = $this->input->post('id'); $msg = $this->input->post('msg'); if($type == 1)//禁止发货 { $d = $this->fullorder_smt->read($id); if($d['library'] != 1) { echo json_encode(array('msg'=>'操作失败,订单非未出库状态!','success'=>false));exit; } if($d['print'] < 3) { $a = "订单未打印,"; } else { $a = ""; } if($this->fullorder_smt->save(array('libraryconfirm'=>1,'librarynot'=>$a.$msg),$id)) { echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } if($type == 6)//允许发货 { $d = $this->fullorder_smt->read($id); if($d['print'] < 3) { $a = "订单未打印,"; } else { $a = ""; } if($this->fullorder_smt->save(array('libraryconfirm'=>2,'librarynot'=>$a.$msg),$id)) { echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } if($type == 7)//禁止打印 { $d = $this->fullorder_smt->read($id); if($d['print'] == 3) { echo json_encode(array('msg'=>'操作失败,订单已打印!','success'=>false));exit; } if($d['print'] < 3) { $a = "订单未打印,"; } else { $a = ""; } if($this->fullorder_smt->save(array('print'=>1),$id)) { echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } if($type == 8)//允许打印 { $d = $this->fullorder_smt->read($id); if($d['print'] < 3) { $a = "订单未打印,"; } else { $a = ""; } if($this->fullorder_smt->save(array('print'=>2,'failed'=>''),$id)) { echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } else if($type == 2)//填写运单、修改运单 { $d = $this->fullorder_smt->read($id); if($d['express'] == 0) { echo json_encode(array('msg'=>'操作失败,未选择物流方式!','success'=>false));exit; } if($d['library'] == 3 || ($d['print'] == 3 && $d['libraryconfirm'] == 1)) { echo json_encode(array('msg'=>'操作失败,不允许填写运单号!','success'=>false));exit; } //$fs = $this->notice->get_ordertatus(216);//216成功状态 $gx['res'] = 3; $gx['state'] = 216; if($gx['res'] > 0 && isset($fs)) { $warehouse = $this->warehouse->read($xg['type']); $ck = $this->_email($fs['content'],$xg,$warehouse['company']); } if($this->fullorder_smt->save(array('waybill'=>$msg,'state'=>$gx['state']),$id)) { echo json_encode(array('msg'=>'操作成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } } } public function _merge() { $post = $this->input->post(NULL, TRUE); if(isset($post['type'])) { $type = $this->input->post('type'); $id = $this->input->post('id'); $u = $this->fullorder_smt->read($id); $rows = $this->fullorder_smt->find_all('name = "'.$u['name'].'" or email = "'.$u['email'].'" or address = "'.$u['address'].'"','*','id desc'); if(count($rows)>1) { $this->db->trans_begin(); $fpdata=$rows[0]['fpdata'];//购买产品 $shouldmoney=$rows[0]['shouldmoney'];//购买应收金额 $budget=$rows[0]['budget'];//预估到帐金额 $cost=$rows[0]['cost'];//成本金额 $merge=$rows[0]['id']; $d = array($rows[0]['id']); for($i=1;$ifullorder_smt->save(array('merge'=>$rows[0]['id'],'mergeid'=>1),$rows[$i]['id']); } $this->fullorder_smt->save(array('fpdata'=>$fpdata,'shouldmoney'=>$shouldmoney,'budget'=>$budget,'cost'=>$cost,'merge'=>$merge),$rows[0]['id']); if ($this->db->trans_status() === FALSE) { $this->db->trans_commit(); echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } else { $this->db->trans_commit(); echo json_encode(array('msg'=>'操作成功','d'=>($d),'b'=>$rows[0]['id'],'success'=>true)); } } } } //评价管理 public function _evaluate() { $user = $this->user->get_api($_SESSION['api']); if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $shop = $this->input->post('shop',true); $where = "1=1 and evaluate = 0 and (".rtrim($fgshop,'or').")"; if($shop) { $where .= " and shop = '$shop'"; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $info_list = $this->fullorder_smt->find_all($where,'id,shop,orderinfo,number,operation',$order_str,$start,$perpage); //格式化数据 foreach ($info_list as $key=>$value) { $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['operation'] = "评价"; } $total = $this->fullorder_smt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $this->_Template('fullorder_smt_evaluate',$this->data); } //订单消息 public function _state() { $user = $this->user->get_api($_SESSION['api']); if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $shop = $this->input->post('shop',true); $source = $this->input->post('source',true); $state = $this->input->post('state',true); $review = $this->input->post('review',true); $expressstate = $this->input->post('expressstate',true); $express = $this->input->post('express',true); $orderinfo = $this->input->post('orderinfo',true); $user = $this->input->post('user',true); $name = $this->input->post('name',true); $waybill = $this->input->post('waybill',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")"; if($timetk && $timetj) { $where .= " and dtime > '$timetk' and dtime < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { $where .= " and state = '$state'"; } if($review) { $where .= " and review = '$review'"; } if($expressstate != "") { $where .= " and expressstate = '$expressstate'"; } if($express) { $where .= " and express = '$express'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($name) { $where .= " and name = '$name'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $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); //格式化数据 foreach ($info_list as $key=>$value) { $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['user'] = $shop['shopuser']; $country = $this->country->read($value['country']); $info_list[$key]['country'] = $country['name']; $state = $this->typeclass->read($value['state']); $info_list[$key]['state'] = $state['title']; if($value['review'] == 1) { $info_list[$key]['review'] = "未送审"; } else if($value['review'] == 2) { $info_list[$key]['review'] = "待审核"; } else if($value['review'] == 3) { $info_list[$key]['review'] = "不通过"; } else if($value['review'] == 4) { $info_list[$key]['review'] = "取消重审"; } else if($value['review'] == 5) { $info_list[$key]['review'] = "审核通过"; } else if($value['review'] == 6) { $info_list[$key]['review'] = "自动通过"; } if($value['library'] == 1) { $info_list[$key]['library'] = "未出库"; } else if($value['library'] == 2) { $info_list[$key]['library'] = "已出库"; } else if($value['library'] == 3) { $info_list[$key]['library'] = "已退库"; } if($value['librarytime'] == '0') { $info_list[$key]['librarytime'] = '无'; } else { $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']); } if($value['expressstate'] == 0) { $info_list[$key]['expressstate'] = "未取件"; } else if($value['expressstate'] == 1) { $info_list[$key]['expressstate'] = "已取件"; } else if($value['expressstate'] == 2) { $info_list[$key]['expressstate'] = "离开中国"; } else if($value['expressstate'] == 3) { $info_list[$key]['expressstate'] = "到达目的国"; } else if($value['expressstate'] == 4) { $info_list[$key]['expressstate'] = "已派送"; } $express = $this->express->read($value['express']); $info_list[$key]['express'] = $express['servicename']; } $total = $this->fullorder_smt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $this->data['express'] = $this->express->find_all(); $this->_Template('fullorder_smt_state',$this->data); } //审核订单 public function _review() { $user = $this->user->get_api($_SESSION['api']); $fgshop = ""; if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; } $fgshop = " and (".rtrim($fgshop,'or').")"; } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $source = $this->input->post('source',true); $warehouse = $this->input->post('warehouse',true); $express = $this->input->post('express',true); $user = $this->input->post('user',true); $shop = $this->input->post('shop',true); $review = $this->input->post('review',true); $orderinfo = $this->input->post('orderinfo',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "mergeid = 0".$fgshop; if($timetk && $timetj) { $where .= " and buytime > '$timetk' and buytime < '$timetj'"; } if($source) { $where .= " and source = '$source'"; } if($shop) { $where .= " and shop = '$shop'"; } if($warehouse) { $where .= " and type = '$warehouse'"; } if($express) { $where .= " and express = '$express'"; } if($user) { $where .= " and user = '$user'"; } if($review) { $where .= " and review = '$review'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $info_list = $this->fullorder_smt->find_all($where,'id,shop,user,type,orderinfo,number,client,express,buytime,shouldmoney,review,currencytitle,library'); //格式化数据 foreach ($info_list as $key=>$value) { $lr = $this->fullorder_smt->read($value['id']); $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['user'] = $shop['shopuser']; $warehouse = $this->warehouse->read($value['type']); $info_list[$key]['type'] = $warehouse['title']; $express = $this->express->read($value['express']); $info_list[$key]['express'] = $express['servicename']; $info_list[$key]['buytime'] = '

'.date('Y-m-d',$value['buytime']).'

'.date('H:i:s',$value['buytime']).'

'; if($value['review'] == 1) { $info_list[$key]['review'] = "未送审"; } else if($value['review'] == 2) { $info_list[$key]['review'] = "待审核"; } else if($value['review'] == 3) { $info_list[$key]['review'] = "不通过"; } else if($value['review'] == 4) { $info_list[$key]['review'] = "取消重审"; } else if($value['review'] == 5) { $info_list[$key]['review'] = "审核通过"; } else if($value['review'] == 6) { $info_list[$key]['review'] = "自动通过"; } if($value['review'] == 2) { $info_list[$key]['library'] = "

审核通过

不通过

"; } else if($value['review'] == 3) { $info_list[$key]['library'] = "

审核通过

"; } else if($value['review'] == 5) { $info_list[$key]['library'] = "

不通过

"; } else { $info_list[$key]['library'] = ""; } $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$lr['currencytitle']; $lr['hl'] = $lr['hl']==0?6.71:$lr['hl']; $cost = $lr['cost']/$lr['hl']; $currencytitle = $lr['budget']-$lr['refundj']-$cost-$lr['expressmoney']; $info_list[$key]['currencytitle'] = sprintf("%.2f",$currencytitle).' '.$lr['currencytitle']; } $total = $this->fullorder_smt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $this->_Template('fullorder_smt_review',$this->data); } //导出资金统计excel public function _fmexcel() { $user = $this->user->get_api($_SESSION['api']); if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } if(isset($_GET['excel'])) { $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); $shop = $this->input->get('shop',true); $source = $this->input->get('source',true); $state = $this->input->get('state',true); $type = $this->input->get('type',true); $orderinfo = $this->input->get('orderinfo',true); $user = $this->input->get('user',true); $name = $this->input->get('name',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")"; if($timetk && $timetj) { $where .= " and buytime > '$timetk' and buytime < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { if($state == 1) { $where .= " and state = '$state'"; } } if($type) { $where .= " and type = '$type'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($name) { $where .= " and name = '$name'"; } //取得信息列表 $info_list = $this->fullorder_smt->find_all($where,'id,shop,user,number,orderinfo,client,country,dtime,ftime,express,waybill,shouldmoney,refund,currency,budget,fpdata,hl,currencytitle'); //格式化数据 $i = 1;$shouldmoney = 0;$refund = 0;$budget = 0;$currency = 0;$hl=1; foreach ($info_list as $key=>$value) { $info_list[$key]['id'] = $i; if($value['currencytitle'] != "CNY") { $hl=$value['hl']; } $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl); $budget=$budget+($value['budget']*$hl); $currency=$currency+(($value['shouldmoney']-$value['budget'])*$hl); $refund=$refund+($value['refund']*$hl); $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['user'] = $shop['shopuser']; $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']); $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']); $country = $this->country->read($value['country']); $info_list[$key]['country'] = $country['name']; $express = $this->express->read($value['express']); $info_list[$key]['express'] = $express['servicename']; $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle']; $info_list[$key]['refund'] = $value['refund'].' '.$value['currencytitle']; $info_list[$key]['budget'] = $value['budget'].' '.$value['currencytitle']; $info_list[$key]['currency'] = sprintf("%.2f",$value['shouldmoney']-$value['budget']).' '.$value['currencytitle']; $fpdata = array(); if(stripos($value['fpdata'],';') !== false) { $fpdata = explode(';',rtrim($value['fpdata'],';')); foreach ($fpdata as $ke=>$va) { $v = explode('|',rtrim($va,'|')); $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数 } } $info_list[$key]['fpdata'] = $fpdata; $i++; } $data = array($shouldmoney.' CNY',$refund.' CNY',$currency.' CNY',$budget.' CNY'); $title = "订单资金信息"; $titlename = "

".$title."

NO. 店铺 负责人 编号 订单号 客户姓名 国家 订单日期 发货日期 快递公司 运单号 订单金额 退款金额 手续费 预估金额
订单产品信息
产品 条数 数量
总条数
"; $filename = $title.".xls"; $tail = "合计:".$data[0]."".$data[1]."".$data[2]."".$data[3]."\n"; $this->excel->get_fz($info_list,$titlename,$filename,$tail); } } //导出订单excel public function _fdexcel() { if(isset($_GET['excel'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $shop = $this->input->post('shop',true); $source = $this->input->post('source',true); $state = $this->input->post('state',true); $review = $this->input->post('review',true); $express = $this->input->post('express',true); $orderinfo = $this->input->post('orderinfo',true); $user = $this->input->post('user',true); $name = $this->input->post('name',true); $waybill = $this->input->post('waybill',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "1=1 and mergeid = 0"; if($timetk && $timetj) { $where .= " and buytime > '$timetk' and buytime < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { $where .= " and state = '$state'"; } if($review) { $where .= " and review = '$review'"; } if($express) { $where .= " and express = '$express'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($name) { $where .= " and name = '$name'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } //取得信息列表 $info_list = $this->fullorder_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'); //格式化数据 $i = 1;$shouldmoney = 0;$hl=1; foreach ($info_list as $key=>$value) { $info_list[$key]['id'] = $i; if($value['source'] == 1) { $info_list[$key]['source'] = "线下订单"; } else if($value['source'] == 2) { $info_list[$key]['source'] = "PC订单"; } else if($value['source'] == 3) { $info_list[$key]['source'] = "手机订单"; } if($value['currencytitle'] != "CNY") { $hl=$value['hl']; } $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl); $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']); $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']); $state = $this->typeclass->read($value['state']); $info_list[$key]['state'] = $state['title']; $country = $this->country->read($value['country']); $info_list[$key]['country'] = $country['name']; $express = $this->express->read($value['express']); $info_list[$key]['express'] = $express['servicename']; $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle']; $fpdata = array(); if(stripos($value['fpdata'],';') !== false) { $fpdata = explode(';',rtrim($value['fpdata'],';')); foreach ($fpdata as $ke=>$va) { $v = explode('|',rtrim($va,'|')); $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数 } } $info_list[$key]['fpdata'] = $fpdata; $i++; } $data = array($shouldmoney.' CNY'); $title = "订单信息表"; $titlename = "

".$title."

NO. 店铺 编号 订单号 订单类型 客户姓名 收件人名称 收货人地址 城市 邮编 国家 收件电话 订单日期 发货日期 订单状态 订单金额 快递公司 运单号 订单备注 客户备注
订单产品信息
产品 条数 数量
总条数
"; $filename = $title.".xls"; $tail = "合计:".$data[0]."\n"; $this->excel->get_fz($info_list,$titlename,$filename,$tail); } } public function _excel() { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } if(isset($_GET['excel'])) { $dowid = $this->input->get('a'); $wid = ""; if($dowid != "") { $id_arr = explode(',',rtrim($dowid,',')); $wid .= " id = 0 or"; foreach ($id_arr as $v) { $wid .= " id = '$v' or"; } $wid = " and".rtrim($wid,'or'); } $warehouse = $this->input->get('warehouse',true); $xztime = $this->input->get('xztime',true); $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); $shop = $this->input->get('shop',true); $source = $this->input->get('source',true); $state = $this->input->get('state',true); $review = $this->input->get('review',true); $type = $this->input->get('type',true); $express = $this->input->get('express',true); $orderinfo = $this->input->get('orderinfo',true); $user = $this->input->get('user',true); $client = $this->input->get('name',true); $waybill = $this->input->get('waybill',true); $number = $this->input->get('number',true); $email = $this->input->get('email',true); $dlz = $this->input->get('dlz',true); $print = $this->input->get('print',true); $library = $this->input->get('library',true); $timetk = strtotime($timetk)+12*3600; $timetj = strtotime($timetj)+12*3600; $where = "mergeid = 0 and (".rtrim($fgshop,'or').")"; if($timetk && $timetj) { $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { $where .= " and state = '$state'"; } if($type) { $where .= " and type = '$type'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($name) { $where .= " and name = '$name'"; } if($print) { $where .= " and print = '$print'"; } if($library) { $where .= " and library = '$library'"; } //取得信息列表 $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'); //格式化数据 $i = 1; foreach ($info_list as $key=>$value) { $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['id'] = $i; $country = $this->country->read($value['country']); $info_list[$key]['country'] = $country['ename']; $info_list[$key]['qm'] = ($value['qm']==1)?'需要签名':'不签名'; $info_list[$key]['js'] = ($value['js']==1)?'优先服务':'普通'; $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']-12*3600); $info_list[$key]['printtime'] = ($value['printtime']!=0)?date('Y-m-d H:i:s',$value['printtime']-12*3600):''; $info_list[$key]['librarytime'] = ($value['librarytime']!=0)?date('Y-m-d H:i:s',$value['librarytime']-12*3600):''; $info_list[$key]['retreattime'] = ($value['retreattime']!=0)?date('Y-m-d H:i:s',$value['retreattime']-12*3600):''; $i++; } $title = "速卖通订单信息"; $titlename = "

".$title."

NO. 店铺 编码 订单号 姓名 国家 城市 邮编 地址 电话 运单号 备注 重量 保险 签名 快递服务 订单时间(美国时间) 打印时间(美国时间) 出库时间(美国时间) 退库时间(美国时间)
"; $filename = $title.".xls"; $tail = "\n"; $this->excel->get_fz2($info_list,$titlename,$filename,$tail); } } public function _exceldlz() { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } if(isset($_GET['excel'])) { $dowid = $this->input->get('a'); $wid = ""; if($dowid != "") { $id_arr = explode(',',rtrim($dowid,',')); $wid .= " id = 0 or"; foreach ($id_arr as $v) { $wid .= " id = '$v' or"; } $wid = " and".rtrim($wid,'or'); } $warehouse = $this->input->get('warehouse',true); $xztime = $this->input->get('xztime',true); $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); $shop = $this->input->get('shop',true); $source = $this->input->get('source',true); $state = $this->input->get('state',true); $review = $this->input->get('review',true); $type = $this->input->get('type',true); $express = $this->input->get('express',true); $orderinfo = $this->input->get('orderinfo',true); $user = $this->input->get('user',true); $client = $this->input->get('name',true); $waybill = $this->input->get('waybill',true); $number = $this->input->get('number',true); $email = $this->input->get('email',true); $dlz = $this->input->get('dlz',true); $print = $this->input->get('print',true); $library = $this->input->get('library',true); $timetk = strtotime($timetk)+12*3600; $timetj = strtotime($timetj)+12*3600; $where = "mergeid = 0 and type = 5 and review = 6 and (".rtrim($fgshop,'or').")"; if($timetk && $timetj) { $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { $where .= " and state = '$state'"; } if($type) { $where .= " and type = '$type'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($print) { $where .= " and print = '$print'"; } if($library) { $where .= " and library = '$library'"; } /* 匹配ID加入 */ $tc = array(); $typeclass = $this->typeclass->find_all(); foreach ($typeclass as $v) { $tc[$v['id']] = $v['title']; } //取得信息列表 $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'); //格式化数据 $i = 1; foreach ($info_list as $key=>$value) { $ud = $this->fullorder->read($value['id']); $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['id'] = $i; $country = $this->country->read($value['country']); $info_list[$key]['country'] = $country['ename']; $info_list[$key]['qm'] = ($value['qm']==1)?'需要签名':'不签名'; $info_list[$key]['js'] = ($value['js']==1)?'优先服务':'普通'; $fpdata = array(); if(stripos($ud['fpdata'],';') !== false) { $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']-12*3600); $info_list[$key]['printtime'] = ($value['printtime']!=0)?date('Y-m-d H:i:s',$value['printtime']-12*3600):''; $info_list[$key]['librarytime'] = ($value['librarytime']!=0)?date('Y-m-d H:i:s',$value['librarytime']-12*3600):''; $info_list[$key]['retreattime'] = ($value['retreattime']!=0)?date('Y-m-d H:i:s',$value['retreattime']-12*3600):''; $fpdata = explode(';',rtrim($ud['fpdata'],';')); foreach ($fpdata as $ke=>$va) { $v = explode('|',rtrim($va,'|')); $one = explode('-',rtrim($v[0],'-')); if($one['2'] == 163 || $one['2'] == 164 || $one['2'] == 165 || $one['2'] == 166) { $one['3'] = isset($tc[$one['3']])?$tc[$one['3']]:'无'; $one['4'] = isset($tc[$one['4']])?$tc[$one['4']]:'无'; $v[1] = str_replace(array('Hair Weaving','Closure','Wigs','Clip-in Full Head',$one['3'],$one['4']),array('','','','','',''),$v[1]); $v[1] = preg_replace('/(\d+)inch/','',$v[1]); $v[1] = ltrim($v[1],' '); $fpdata[$ke] = array($v[5],$one['3'],$one['4'],$v[1],$v[2]);//内容,尺寸,等级,颜色,数量 } else { $one['2'] = isset($tc[$one['2']])?$tc[$one['2']]:'无'; $one['3'] = isset($tc[$one['3']])?$tc[$one['3']]:'无'; $v[1] = str_replace(array('Hair Weaving','Closure','Wigs','Clip-in Full Head',$one['2'],$one['3']),array('','','','','',''),$v[1]); $v[1] = preg_replace('/(\d+)inch/','',$v[1]); $v[1] = ltrim($v[1],' '); $fpdata[$ke] = array($v[5],$one['2'],$one['3'],$v[1],$v[2]);//内容,尺寸,等级,颜色,数量 线下单没有真人发类型 } } } $info_list[$key]['fpdata'] = $fpdata; $i++; } $title = "独立站订单信息"; $titlename = "

".$title."

NO. 店铺 编码 订单号 姓名 国家 城市 邮编 地址 电话 运单号 备注 重量 保险 签名 快递服务 订单时间(美国时间) 打印时间(美国时间) 出库时间(美国时间) 退库时间(美国时间)
订单产品信息
尺寸 等级 颜色 花型 数量
总条数
"; $filename = $title.".xls"; $tail = "\n"; $this->excel->get_fz($info_list,$titlename,$filename,$tail); } } public function _black() { $post = $this->input->post(NULL, TRUE); if(isset($post['bd'])) { $bd = $this->input->post('bd',true); $rows = $this->fullorder_smt->read($bd); $post['shop'] = $rows['shop']; $post['source'] = 1; $post['name'] = $rows['client']; $post['email'] = $rows['email']; $post['phone'] = $rows['phone']; $post['country'] = $rows['country']; $post['money'] = $rows['shouldmoney']; $post['num'] = 1; $post['time'] = $rows['dtime']; $post['province'] = $rows['province']; $post['city'] = $rows['city']; $post['street'] = $rows['street']; $post['address'] = $rows['address']; $post['address2'] = $rows['address2']; $post['zipcode'] = $rows['zipcode']; $post['type'] = 2; if($this->customer->insert($post)) { $this->fullorder_smt->save(array('black'=>1),$bd); echo json_encode(array('msg'=>'操作成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } } public function _ryf() { $post = $this->input->post(NULL, TRUE); if(isset($post['bd'])) { $bd = $this->input->post('bd',true); $d = $this->fullorder_smt->read($bd); if($d['state'] == 207 || $d['state'] == 207)//订单状态为等待发货或等待部分发货才可更改为允许发货 { if($d['print'] < 3)//打印状态为未打印 { $print = 1;//未打印 $libraryconfirm = 1;//不允许出库 $a = "订单未打印,"; } else//已打印订单 { $libraryconfirm = 2;//允许出库 $a = ""; } if($this->fullorder_smt->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd)) { echo json_encode(array('msg'=>'操作成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } if($this->fullorder_smt->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd)) { echo json_encode(array('msg'=>'操作失败!订单未非发货状态','success'=>false));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } } public function _fsstate() { $post = $this->input->post(NULL, TRUE); if(isset($post['s'])) { $id_arr = $this->input->post('s'); $id_arr = explode(',',$id_arr); if(!$id_arr) { echo json_encode(array('msg'=>'参数错误!','success'=>false));exit; } foreach ($id_arr as $v) { $data = $this->fullorder_smt->read($v); $warehouse = $this->warehouse->read($data['type']); $fs = $this->notice->get_ordertatus($data['state']); if($fs) { $ck = $this->_email($fs['content'],$data,$warehouse['company']); if($ck == 1) { $this->fullorder_smt->save(array('fscontent'=>date('Y-m-d H:i:s',time()).'已发送:'.$fs['title'].' - '),$v); } } } echo json_encode(array('msg'=>'发送完成!','success'=>true));exit; } } public function _power() { $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $id = $this->input->post('id',true); $fullorder_smt = $this->fullorder_smt->read($id); 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)) { echo json_encode(array('msg'=>'重置成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'重置失败,请重试','success'=>false));exit; } } } public function _expresstype() { $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $id = $this->input->post('id',true); $data = $this->express->read($id); echo json_encode(array('msg'=>$data['type'],'success'=>true));exit; } } public function _email($content,$data,$shopname) { $express = $this->express->read($data['express']); $t= array('$userName','$orderid','$trackingNumber','$expressCompany','$contactPerson','$mobileNo','$zip','$recipientAddress');//需要被替换的内容 $h= array($data['client'],$data['orderinfo'],$data['waybill'],$express['servicename'],$data['name'],$data['phone'],$data['zipcode'],$data['address']);//替换的内容 $content = str_replace($t,$h,$content); $this->load->library('email'); $config['protocol'] = 'smtp'; $config['smtp_host'] = 'smtpdm-ap-southeast-1.aliyun.com'; $config['smtp_port'] = 465; $config['smtp_user'] = 'service@email.supernovahair.com'; $config['smtp_pass'] = 'LONGyihair374'; $config['smtp_crypto'] = 'ssl'; $config['crlf'] = "\r\n"; $config['newline'] = "\r\n"; $this->email->initialize($config); $this->email->from('service@email.supernovahair.com',$shopname); $this->email->to($data['email']);//收件 $this->email->subject('The product you purchased has a new progress');//标题 $this->email->message($content);//内容 if ( ! $this->email->send()) { return 2; } else { return 1; } } public function _error() { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $orderinfo = $this->input->post('orderinfo',true); $waybill = $this->input->post('waybill',true); $number = $this->input->post('number',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "print = 1 and failed !='' and mergeid = 0 and waybill = '' and (".rtrim($fgshop,'or').")"; if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } if($number) { $where .= " and number = '$number'"; } if($timetk && $timetj) { $timetj = $timetj+24*3600; $where .= " and dtime > '$timetk' and dtime < '$timetj'"; } //数据排序 $order_str = "dtime desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } $info_list_smt = $this->fullorder_smt->find_all($where,'id,shop,type,orderinfo,number,express,failed,operation',$order_str,$start,$perpage); //格式化数据 foreach ($info_list_smt as $key=>$value) { $ud = $this->fullorder_smt->read($value['id']); $shop = $this->shop->read($value['shop']); $info_list_smt[$key]['shop'] = $shop['shopname']; $info_list_smt[$key]['orderinfo'] = "".$value['orderinfo']."

"; $warehouse = $this->warehouse->read($value['type']); $warehousetitle = $warehouse['title']; if($value['type'] != 1){$warehousetitle = "".$warehouse['title']."";} $info_list_smt[$key]['type'] = $warehousetitle; if($value['express'] != 0) { $express = $this->express->read($value['express']); $expressservicename = $express['servicename']; if($value['express'] != 1){$expressservicename = "".$express['servicename']."";} $info_list_smt[$key]['express'] = $expressservicename; } else { $info_list_smt[$key]['express'] = "无"; } $x = ""; if($ud['review'] >4 && $ud['print'] == 1) { $x = "

允许打印

"; } $info_list_smt[$key]['operation'] = $x; } $total = $this->fullorder_smt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list_smt)); echo json_encode($rows);exit; } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->data['express'] = $this->express->find_all(); $fullorderexcel = $this->fullorderexcel->find_all('type=1','*','idorder desc');//导出模板 $this->data['fullorderexcel'] = $fullorderexcel; $this->_Template('fullorder_smt_error',$this->data); } public function _dlzerror() { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $orderinfo = $this->input->post('orderinfo',true); $waybill = $this->input->post('waybill',true); $number = $this->input->post('number',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "print = 1 and failed !='' and mergeid = 0 and waybill = '' and (".rtrim($fgshop,'or').")"; if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } if($number) { $where .= " and number = '$number'"; } if($timetk && $timetj) { $timetj = $timetj+24*3600; $where .= " and dtime > '$timetk' and dtime < '$timetj'"; } //数据排序 $order_str = "dtime desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } $info_list = $this->fullorder->find_all($where.' and type = 5','id,shop,type,orderinfo,number,express,failed,operation',$order_str,$start,$perpage); //格式化数据 foreach ($info_list as $key=>$value) { $ud = $this->fullorder->read($value['id']); $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['orderinfo'] = "".$value['orderinfo']."

"; $warehouse = $this->warehouse->read($value['type']); $warehousetitle = $warehouse['title']; if($value['type'] != 1){$warehousetitle = "".$warehouse['title']."";} $info_list[$key]['type'] = $warehousetitle; if($value['express'] != 0) { $express = $this->express->read($value['express']); $expressservicename = $express['servicename']; if($value['express'] != 1){$expressservicename = "".$express['servicename']."";} $info_list[$key]['express'] = $expressservicename; } else { $info_list[$key]['express'] = "无"; } $x = ""; if($ud['review'] >4 && $ud['print'] == 1) { $x = "

允许打印

"; } $info_list[$key]['operation'] = $x; } $total = $this->fullorder->find_count($where.' and type = 5'); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->data['express'] = $this->express->find_all(); $fullorderexcel = $this->fullorderexcel->find_all('type=1','*','idorder desc');//导出模板 $this->data['fullorderexcel'] = $fullorderexcel; $this->_Template('fullorder_smt_errordlz',$this->data); } }