sjgrouporder.inc.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. global $_GPC, $_W;
  3. $storeid=$_COOKIE["storeid"];
  4. $cur_store = $this->getStoreById($storeid);
  5. $GLOBALS['frames'] = $this->getNaveMenu2($storeid);
  6. $pageindex = max(1, intval($_GPC['page']));
  7. $pagesize=8;
  8. $type=isset($_GPC['type'])?$_GPC['type']:'all';
  9. $type2=isset($_GPC['type2'])?$_GPC['type2']:'today';
  10. $where=" where a.uniacid=:uniacid and a.store_id=:store_id ";
  11. $data[':uniacid']=$_W['uniacid'];
  12. $data[':store_id']=$storeid;
  13. if(isset($_GPC['keywords'])){
  14. $where.=" and (a.goods_name LIKE concat('%', :name,'%') || a.order_num LIKE concat('%', :name,'%') || b.name LIKE concat('%', :name,'%') || c.store_name LIKE concat('%', :name,'%'))";
  15. $data[':name']=$_GPC['keywords'];
  16. $type='all';
  17. }
  18. if($_GPC['time']){
  19. $start=strtotime($_GPC['time']['start']);
  20. $end=strtotime($_GPC['time']['end']);
  21. $where.=" and a.time >='{$start}' and a.time<='{$end}'";
  22. $type='all';
  23. }else{
  24. if($type=='wait'){
  25. $where.=" and a.state=1";
  26. }
  27. if($type=='pay'){
  28. $where.=" and a.state=2";
  29. }
  30. if($type=='complete'){
  31. $where.=" and a.state=3";
  32. }
  33. if($type=='close'){
  34. $where.=" and a.state=4";
  35. }
  36. if($type=='invalid'){
  37. $where.=" and a.state=5";
  38. }
  39. }
  40. $sql="SELECT a.*,b.name as nick_name,c.store_name FROM ".tablename('zhtc_grouporder'). " a" . " left join " . tablename("zhtc_user") . " b on a.user_id=b.id left join " . tablename("zhtc_store") . " c on a.store_id=c.id " .$where." ORDER BY a.id DESC";
  41. $total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zhtc_grouporder'). " a" . " left join " . tablename("zhtc_user") . " b on a.user_id=b.id left join " . tablename("zhtc_store") . " c on a.store_id=c.id " .$where,$data);
  42. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  43. $list=pdo_fetchall($select_sql,$data);
  44. if($_GPC['op']=='delete'){
  45. $res=pdo_delete('zhtc_grouporder',array('id'=>$_GPC['id']));
  46. if($res){
  47. message('删除成功!', $this->createWebUrl2('sjgrouporder'), 'success');
  48. }else{
  49. message('删除失败!','','error');
  50. }
  51. }
  52. include $this->template('web/sjgrouporder');