OrderdistributionController.class.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. *
  6. * @author fish
  7. *
  8. */
  9. namespace Seller\Controller;
  10. class OrderdistributionController extends CommonController{
  11. protected function _initialize(){
  12. parent::_initialize();
  13. }
  14. public function index()
  15. {
  16. $pindex = I('request.page', 1);
  17. $psize = 20;
  18. $keyword = I('request.keyword');
  19. $this->keyword = $keyword;
  20. $condition = "";
  21. if (!empty($keyword)) {
  22. $condition .= ' and (a.username like "%'.$keyword.'%" or a.mobile like "%'.$keyword.'%" )';
  23. }
  24. if (defined('ROLE') && ROLE == 'agenter' )
  25. {
  26. $supper_info = get_agent_logininfo();
  27. $condition .= ' and store_id='.$supper_info['id'];
  28. }
  29. $enabled = I('request.state',-1);
  30. if (isset($enabled) && $enabled >= 0) {
  31. $condition .= ' and a.state = ' . $enabled;
  32. } else {
  33. $enabled = -1;
  34. }
  35. $this->enabled = $enabled;
  36. $list = M()->query('SELECT a.*,b.storename FROM ' . C('DB_PREFIX'). "lionfish_comshop_orderdistribution a"
  37. . " left join ".C('DB_PREFIX')."lionfish_comshop_supply b on a.store_id=b.id "
  38. . " WHERE 1=1 "
  39. . $condition . ' order by a.id desc limit ' . (($pindex - 1) * $psize) . ',' . $psize);
  40. if( !empty($list) )
  41. {
  42. foreach( $list as $key => $val )
  43. {
  44. $mb_info = M('lionfish_comshop_member')->field('member_id, username as nickname,avatar')->where( array('member_id' => $val['member_id'] ) )->find();
  45. $val['mb_info'] = $mb_info;
  46. $list[$key] = $val;
  47. }
  48. }
  49. $total = M('lionfish_comshop_orderdistribution a')->where("1=1 ".$condition)->count();
  50. $pager = pagination2($total, $pindex, $psize);
  51. $this->list = $list;
  52. $this->pager = $pager;
  53. $this->display();
  54. }
  55. /**
  56. * 提现列表
  57. */
  58. public function withdrawallist()
  59. {
  60. $_GPC = I('request.');
  61. $condition = ' ';
  62. $pindex = max(1, intval($_GPC['page']));
  63. $psize = 20;
  64. if (!empty($_GPC['keyword'])) {
  65. $_GPC['keyword'] = trim($_GPC['keyword']);
  66. $condition .= ' and ( o.id = '.intval($_GPC['keyword']).') ';
  67. }
  68. $store_id = 0;
  69. $is_supply_status = 0;
  70. if (defined('ROLE') && ROLE == 'agenter' )
  71. {
  72. $supper_info = get_agent_logininfo();
  73. $store_id = $supper_info['id'];
  74. $condition .= ' and co.store_id='.$store_id;
  75. $is_supply_status = 1;
  76. }
  77. $starttime = strtotime( date('Y-m-d')." 00:00:00" );
  78. $endtime = $starttime + 86400;
  79. if (!empty($_GPC['time']['start']) && !empty($_GPC['time']['end'])) {
  80. $starttime = strtotime($_GPC['time']['start']);
  81. $endtime = strtotime($_GPC['time']['end']);
  82. $condition .= ' AND o.addtime >= '.$starttime.' AND o.addtime <= '.$endtime.' ';
  83. }
  84. $this->starttime = $starttime;
  85. $this->endtime = $endtime;
  86. if ($_GPC['comsiss_state'] != '') {
  87. $condition .= ' and o.state=' . intval($_GPC['comsiss_state']);
  88. }
  89. $sql = 'SELECT o.*,co.username FROM ' . C('DB_PREFIX') . "lionfish_comshop_orderdistribution_tixian_order o left join ".C('DB_PREFIX')."lionfish_comshop_orderdistribution co on o.member_id=co.member_id "
  90. . "WHERE 1 " . $condition . ' order by o.id desc ';
  91. if (empty($_GPC['export'])) {
  92. $sql .= ' limit ' . (($pindex - 1) * $psize) . ',' . $psize;
  93. }
  94. $community_tixian_fee = D('Home/Front')->get_config_by_name('distribution_tixian_fee');
  95. //echo $sql.'<br/>';
  96. $list = M()->query($sql);
  97. $total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX') . 'lionfish_comshop_orderdistribution_tixian_order o left join '.C("DB_PREFIX").'lionfish_comshop_orderdistribution co on o.member_id=co.member_id WHERE 1 ' . $condition );
  98. $total = $total_arr[0]['count'];
  99. foreach( $list as $key => $val )
  100. {
  101. //普通等级
  102. $member_info = M('lionfish_comshop_member')->field('username,avatar,we_openid,telephone')->where( array('member_id' => $val['member_id'] ) )->find();
  103. $val['member_info'] = $member_info;
  104. $list[$key] = $val;
  105. }
  106. if ($_GPC['export'] == '1') {
  107. foreach($list as $key =>&$row)
  108. {
  109. $row['username'] = $row['member_info']['username'];
  110. $row['telephone'] = $row['member_info']['telephone'];
  111. $row['bankname'] = $row['bankname'];
  112. if( $row['type'] == 1 )
  113. {
  114. $row['bankname'] = '余额';
  115. }elseif( $row['type'] == 2 ){
  116. $row['bankname'] = '微信零钱';
  117. }elseif($row['type'] == 3){
  118. $row['bankname'] = '支付宝';
  119. }
  120. $row['bankaccount'] = "\t".$row['bankaccount'];
  121. $row['bankusername'] = $row['bankusername'];
  122. $row['get_money'] = $row['money']-$row['service_charge_money'];
  123. $row['addtime'] = date('Y-m-d H:i:s', $row['addtime']);
  124. if(!empty($row['shentime']))
  125. {
  126. $row['shentime'] = date('Y-m-d H:i:s', $row['shentime']);
  127. }
  128. if($row['state'] ==0)
  129. {
  130. $row['state'] = '待审核';
  131. }else if($row[state] ==1)
  132. {
  133. $row['state'] = '已审核,打款';
  134. }else if($row[state] ==2){
  135. $row['state'] = '已拒绝';
  136. }
  137. }
  138. unset($row);
  139. $columns = array(
  140. array('title' => 'ID', 'field' => 'id', 'width' => 12),
  141. array('title' => '用户名', 'field' => 'username', 'width' => 12),
  142. array('title' => '联系方式', 'field' => 'telephone', 'width' => 12),
  143. array('title' => '打款银行', 'field' => 'bankname', 'width' => 24),
  144. array('title' => '打款账户', 'field' => 'bankaccount', 'width' => 24),
  145. array('title' => '真实姓名', 'field' => 'bankusername', 'width' => 24),
  146. array('title' => '申请提现金额', 'field' => 'money', 'width' => 24),
  147. array('title' => '手续费', 'field' => 'service_charge_money', 'width' => 24),
  148. array('title' => '到账金额', 'field' => 'get_money', 'width' => 24),
  149. array('title' => '申请时间', 'field' => 'addtime', 'width' => 24),
  150. array('title' => '审核时间', 'field' => 'shentime', 'width' => 24),
  151. array('title' => '状态', 'field' => 'state', 'width' => 24)
  152. );
  153. D('Seller/Excel')->export($list, array('title' => '配送员佣金提现数据-' . date('Y-m-d-H-i', time()), 'columns' => $columns));
  154. }
  155. $pager = pagination2($total, $pindex, $psize);
  156. $this->list = $list;
  157. $this->pager = $pager;
  158. $this->_GPC = $_GPC;
  159. $this->is_supply_status = $is_supply_status;
  160. $this->display();
  161. }
  162. public function agent_check_apply()
  163. {
  164. $_GPC = I('request.');
  165. $commission_model = D('Home/LocaltownDelivery');
  166. $id = intval($_GPC['id']);
  167. if (empty($id)) {
  168. $id = (is_array($_GPC['ids']) ? implode(',', $_GPC['ids']) : 0);
  169. }
  170. $comsiss_state = intval($_GPC['state']);
  171. $apply_list = M('lionfish_comshop_orderdistribution_tixian_order')->where('id in( ' . $id . ' )')->select();
  172. $time = time();
  173. //var_dump($members,$comsiss_state);die();
  174. foreach ($apply_list as $apply) {
  175. if ($apply['state'] == $comsiss_state || $apply['state'] == 1 || $apply['state'] == 2) {
  176. continue;
  177. }
  178. $money = $apply['money'];
  179. if ($comsiss_state == 1) {
  180. switch( $apply['type'] )
  181. {
  182. case 1:
  183. $result = $commission_model->send_apply_yuer( $apply['id'] );
  184. break;
  185. case 2:
  186. $result = $commission_model->send_apply_weixin_yuer( $apply['id'] );
  187. break;
  188. case 3:
  189. $result = $commission_model->send_apply_alipay_bank( $apply['id'] );
  190. break;
  191. case 4:
  192. $result = $commission_model->send_apply_alipay_bank( $apply['id'] );
  193. break;
  194. }
  195. if( $result['code'] == 1)
  196. {
  197. show_json(0, array('url' => $_SERVER['HTTP_REFERER'] ,'message'=>$result['msg'] ) );
  198. die();
  199. }
  200. //检测是否存在账户,没有就新建
  201. //TODO....检测是否微信提现到零钱,如果是,那么就准备打款吧
  202. //$commission_model->send_apply_success_msg($apply['id']);
  203. }
  204. else if ($comsiss_state == 2) {
  205. M('lionfish_comshop_orderdistribution_tixian_order')->where( array('id' => $apply['id'] ) )->save( array('state' => 2, 'shentime' => $time) );
  206. //退回冻结的货款
  207. M('lionfish_comshop_orderdistribution_commiss')->where( array('member_id' => $apply['member_id'] ) )->setInc('money',$money);
  208. M('lionfish_comshop_orderdistribution_commiss')->where( array('member_id' => $apply['member_id'] ) )->setInc('dongmoney',-$money);
  209. }
  210. else {
  211. M('lionfish_comshop_orderdistribution_tixian_order')->where( array('id' => $apply['id']) )->save( array('state' => 0, 'shentime' => 0) );
  212. }
  213. }
  214. show_json(1, array('url' => $_SERVER['HTTP_REFERER'] ));
  215. }
  216. public function withdrawalconfig()
  217. {
  218. $_GPC = I('request.');
  219. $supply_id = 0;
  220. if (defined('ROLE') && ROLE == 'agenter' )
  221. {
  222. $supper_info = get_agent_logininfo();
  223. $supply_id = $supper_info['id'];
  224. }
  225. if (IS_POST) {
  226. $data = ((is_array($_GPC['data']) ? $_GPC['data'] : array()));
  227. $data['distribution_tixianway_yuer'] = isset($data['distribution_tixianway_yuer']) ? $data['distribution_tixianway_yuer']:1;
  228. $data['distribution_tixianway_weixin'] = isset($data['distribution_tixianway_weixin']) ? $data['distribution_tixianway_weixin']:1;
  229. $data['distribution_tixianway_alipay'] = isset($data['distribution_tixianway_alipay']) ? $data['distribution_tixianway_alipay']:1;
  230. $data['distribution_tixianway_bank'] = isset($data['distribution_tixianway_bank']) ? $data['distribution_tixianway_bank']:1;
  231. $data['distribution_tixian_publish'] = isset($data['distribution_tixian_publish']) ? $data['distribution_tixian_publish']:'';
  232. if($supply_id == 0){
  233. D('Seller/Config')->update($data);
  234. }else if($supply_id > 0){
  235. D('Seller/SupplyConfig')->update($data);
  236. }
  237. show_json(1, array('url' => $_SERVER['HTTP_REFERER']) );
  238. die();
  239. }
  240. if($supply_id == 0){
  241. $data = D('Seller/Config')->get_all_config();
  242. }else if($supply_id > 0){
  243. $data = D('Seller/SupplyConfig')->get_all_config();
  244. }
  245. $this->supply_id = $supply_id;
  246. $this->data = $data;
  247. $this->display();
  248. }
  249. /**
  250. * 改变状态
  251. */
  252. public function change()
  253. {
  254. $id = I('request.id');
  255. //ids
  256. if (empty($id)) {
  257. $ids = I('request.ids');
  258. $id = ((is_array($ids) ? implode(',', $ids) : 0));
  259. }
  260. if (empty($id)) {
  261. show_json(0, array('message' => '参数错误'));
  262. }
  263. $type = I('request.type');
  264. $value = I('request.value');
  265. if (!(in_array($type, array('state')))) {
  266. show_json(0, array('message' => '参数错误'));
  267. }
  268. $items = M('lionfish_comshop_orderdistribution')->where( array('id' => array('in', $id) ) )->select();
  269. foreach ($items as $item) {
  270. M('lionfish_comshop_orderdistribution')->where( array('id' => $item['id']) )->save( array('state' => $value) );
  271. }
  272. show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
  273. }
  274. public function deletedistribution()
  275. {
  276. $id = I('request.id');
  277. if (empty($id)) {
  278. $ids = I('request.ids');
  279. $id = (is_array($ids) ? implode(',', $ids) : 0);
  280. }
  281. $items = M('lionfish_comshop_orderdistribution')->field('id')->where( array('id' => array('in', $id) ) )->select();
  282. if (empty($item)) {
  283. $item = array();
  284. }
  285. foreach ($items as $item) {
  286. if($item['has_send_count'] <= 0)
  287. M('lionfish_comshop_orderdistribution')->where( array('id' => $item['id']) )->delete();
  288. }
  289. show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
  290. }
  291. public function adddistribution()
  292. {
  293. if (IS_POST) {
  294. $id = I('post.id');
  295. if( empty($id) )
  296. {
  297. $id = 0;
  298. }
  299. $data = array();
  300. $data['username'] = I('post.username');
  301. $data['mobile'] = I('post.mobile');
  302. $data['member_id'] = I('post.member_id');
  303. $data['state'] = I('post.state');
  304. $data['always_address'] = I('post.always_address');
  305. if( empty($data['username']) )
  306. {
  307. show_json(0, array('message' => '请填写配送员姓名'));
  308. }
  309. if( empty($data['mobile']) )
  310. {
  311. show_json(0, array('message' => '请填写手机号'));
  312. }
  313. if( empty($data['member_id']) )
  314. {
  315. show_json(0, array('message' => '请选择关联会员'));
  316. }
  317. if (defined('ROLE') && ROLE == 'agenter' )
  318. {
  319. $supper_info = get_agent_logininfo();
  320. $data['store_id'] = $supper_info['id'];
  321. }
  322. //检测配送员是否关联过了
  323. $ck_pes = M('lionfish_comshop_orderdistribution')->where( "member_id=".$data['member_id']." and id != " .$id )->find();
  324. if( !empty($ck_pes) )
  325. {
  326. show_json(0, array('message' => '该会员已经关联配送员,请选择其他会员'));
  327. }
  328. if( $id > 0 )
  329. {
  330. M('lionfish_comshop_orderdistribution')->where( array('id' => $id) )->save( $data );
  331. }else{
  332. $data['has_send_count'] = 0;
  333. $data['addtime'] = time();
  334. M('lionfish_comshop_orderdistribution')->add( $data );
  335. }
  336. show_json(1, array('url' => U('Orderdistribution/index')));
  337. }
  338. $id = I('get.id', 'intval',0);
  339. if( $id > 0 )
  340. {
  341. $store_id = 0;
  342. $distribution = array();
  343. if (defined('ROLE') && ROLE == 'agenter' )
  344. {
  345. $supper_info = get_agent_logininfo();
  346. $store_id = $supper_info['id'];
  347. $distribution = M('lionfish_comshop_orderdistribution')->where( array('id' => $id,'store_id'=>$store_id) )->find();
  348. }else{
  349. $distribution = M('lionfish_comshop_orderdistribution')->where( array('id' => $id) )->find();
  350. }
  351. $this->distribution = $distribution;
  352. $saler = M('lionfish_comshop_member')->field('member_id, username as nickname,avatar')->where( array('member_id' => $distribution['member_id'] ) )->find();
  353. $saler['username'] = str_replace("'","",$saler['username']);
  354. $saler['nickname'] = str_replace("'","",$saler['nickname']);
  355. $this->saler = $saler;
  356. }
  357. $this->display();
  358. }
  359. /**
  360. * fish
  361. * 同城配送配置方法
  362. */
  363. public function distributionconfig()
  364. {
  365. $supply_id = 0;
  366. if (defined('ROLE') && ROLE == 'agenter' )
  367. {
  368. $supper_info = get_agent_logininfo();
  369. $supply_id = $supper_info['id'];
  370. }
  371. if (IS_POST) {
  372. $data = I('post.data', array());
  373. $data['goods_stock_notice'] = trim($data['goods_stock_notice']);
  374. $data['goods_details_title_bg'] = save_media($data['goods_details_title_bg']);
  375. if($supply_id > 0){
  376. D('Seller/SupplyConfig')->update($data);
  377. }else{
  378. D('Seller/Config')->update($data);
  379. }
  380. show_json(1, array('url'=> U('Orderdistribution/distributionconfig')));
  381. }
  382. if($supply_id > 0){
  383. $data = D('Seller/SupplyConfig')->get_all_config();
  384. }else{
  385. $data = D('Seller/Config')->get_all_config();
  386. }
  387. $this->data = $data;
  388. $this->display();
  389. }
  390. /**
  391. * 选择配送员
  392. */
  393. public function choosemember()
  394. {
  395. $_GPC = I('request.');
  396. $kwd = trim($_GPC['keyword']);
  397. $order_id = $_GPC['id'];
  398. $is_ajax = isset($_GPC['is_ajax']) ? intval($_GPC['is_ajax']) : 0;
  399. $order_info = M('lionfish_comshop_order')->where( array('order_id' => $order_id ) )->find();
  400. $params = array();
  401. $condition = ' 1 ';
  402. if (!empty($kwd)) {
  403. $condition .= ' and ( username LIKE "%'.$kwd .'%" or mobile like "%'.$kwd .'%" )';
  404. }
  405. if($order_info['store_id'] > 0){
  406. $condition .= ' and store_id='.$order_info['store_id'];
  407. }else{
  408. $condition .= ' and store_id=0';
  409. }
  410. /**
  411. 分页开始
  412. **/
  413. $page = isset($_GPC['page']) ? intval($_GPC['page']) : 1;
  414. $page = max(1, $page);
  415. $page_size = 10;
  416. /**
  417. 分页结束
  418. **/
  419. $ds = M()->query('SELECT * FROM ' . C('DB_PREFIX') . 'lionfish_comshop_orderdistribution where '
  420. . $condition .
  421. ' order by id asc' .' limit ' . (($page - 1) * $page_size) . ',' . $page_size );
  422. $total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX') .
  423. 'lionfish_comshop_orderdistribution WHERE ' . $condition );
  424. $total = $total_arr[0]['count'];
  425. foreach ($ds as &$value) {
  426. if($is_ajax == 1)
  427. {
  428. $ret_html .= '<tr>';
  429. $ret_html .= ' <td>'. $value['username'].'</td>';
  430. $ret_html .= ' <td>'.$value['mobile'].'</td>';
  431. $ret_html .= ' <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json=\''.json_encode($value).'\'>选择</a></td>';
  432. $ret_html .= '</tr>';
  433. }
  434. }
  435. $pager = pagination($total, $page, $page_size,'',$context = array('before' => 5, 'after' => 4, 'isajax' => 1));
  436. if( $is_ajax == 1 )
  437. {
  438. echo json_encode( array('code' => 0, 'html' => $ret_html,'pager' => $pager) );
  439. die();
  440. }
  441. $this->ds = $ds;
  442. $this->id = $order_id;
  443. $this->pager = $pager;
  444. unset($value);
  445. if ($_GPC['suggest']) {
  446. exit(json_encode(array('value' => $ds)));
  447. }
  448. $this->display();
  449. }
  450. /**
  451. * 后台配送单选择配送员
  452. */
  453. public function sub_orderchoose_distribution()
  454. {
  455. $order_id = I('post.order_id', 0);
  456. $id = I('post.id', 0);
  457. if( $order_id <=0 || $id <=0 )
  458. {
  459. show_json(0 , array('message' => '数据不合法') );
  460. }
  461. $res = D('Home/LocaltownDelivery')-> distribution_get_order( $id , $order_id);
  462. if($res)
  463. {
  464. show_json(1 , array('message' => '分配成功') );
  465. }else{
  466. show_json(0 , array('message' => '已被分配,请刷新页面') );
  467. }
  468. }
  469. public function distribution_list()
  470. {
  471. $_GPC = I('request.');
  472. $pindex = I('request.page', 1);
  473. $psize = 20;
  474. $id = I('request.id');
  475. $condition = "";
  476. //$condition .= ' and a.orderdistribution_id = '.$id." and is_statement = 1";
  477. $condition .= ' and a.orderdistribution_id = '.$id." ";
  478. $order_no = trim($_GPC['order_no']);
  479. if (!empty($order_no)) {
  480. $condition .= " and o.order_num_alias='".$order_no."'";
  481. }
  482. $list = M()->query("SELECT a.*,o.order_num_alias,o.date_added FROM " . C('DB_PREFIX'). "lionfish_comshop_orderdistribution_order a "
  483. . " left join " . C('DB_PREFIX'). "lionfish_comshop_order o on a.order_id=o.order_id "
  484. . " WHERE 1=1 " . $condition . ' order by a.id desc limit ' . (($pindex - 1) * $psize) . ',' . $psize);
  485. if( !empty($list) )
  486. {
  487. foreach( $list as $key => $val )
  488. {
  489. //配送员名称
  490. $distribution_info = M('lionfish_comshop_orderdistribution')->field('username')->where( array('id' => $val['orderdistribution_id'] ) )->find();
  491. $val['username'] = $distribution_info['username'];
  492. //下单时间
  493. $val['date_added'] = date('Y-m-d H:i:s',$val['date_added']);
  494. //抢单时间
  495. $order_log = M('lionfish_comshop_orderdistribution_log')->field('addtime')->where( array('order_id' => $val['order_id'],'state'=> 2) )->find();
  496. if(!empty($order_log['addtime'])) {
  497. $val['rob_time'] = date('Y-m-d H:i:s', $order_log['addtime']);
  498. }
  499. //取货时间
  500. $order_log = M('lionfish_comshop_orderdistribution_log')->field('addtime')->where( array('order_id' => $val['order_id'],'state'=> 3) )->find();
  501. if(!empty($order_log['addtime'])) {
  502. $val['receive_time'] = date('Y-m-d H:i:s', $order_log['addtime']);
  503. }
  504. //完成时间
  505. $order_log = M('lionfish_comshop_orderdistribution_log')->field('addtime')->where( array('order_id' => $val['order_id'],'state'=> 4) )->find();
  506. if(!empty($order_log['addtime'])){
  507. $val['finish_time'] = date('Y-m-d H:i:s',$order_log['addtime']);
  508. }
  509. $list[$key] = $val;
  510. }
  511. }
  512. $count_list = M()->query("SELECT count(1) as count FROM " . C('DB_PREFIX'). "lionfish_comshop_orderdistribution_order a "
  513. . " left join " . C('DB_PREFIX'). "lionfish_comshop_order o on a.order_id=o.order_id "
  514. . " WHERE 1=1 " . $condition);
  515. $total = $count_list[0]['count'];
  516. $pager = pagination2($total, $pindex, $psize);
  517. $this->id = $id;
  518. $this->order_no = $order_no;
  519. $this->list = $list;
  520. $this->pager = $pager;
  521. $this->display();
  522. }
  523. }
  524. ?>