sjqggoodall.inc.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. global $_GPC, $_W;
  3. $storeid=$_COOKIE["storeid"];
  4. $cur_store = $this->getStoreById($storeid);
  5. $GLOBALS['frames'] = $this->getNaveMenu2($storeid);
  6. $type2=isset($_GPC['type'])?$_GPC['type']:'all';
  7. $where=" WHERE a.uniacid=:uniacid and a.store_id=:store_id";
  8. $data[':uniacid']=$_W['uniacid'];
  9. $data[':store_id']=$storeid;
  10. if($_GPC['keywords']){
  11. $where .=" and (a.name LIKE :name || c.store_name LIKE :name)";
  12. $op=$_GPC['keywords'];
  13. $data[':name']="%$op%";
  14. }
  15. if($_GPC['type_id']){
  16. $where .=" and a.type_id=:type_id";
  17. $data[':type_id']=$_GPC['type_id'];
  18. }
  19. if($_GPC['is_shelves2']){
  20. $where .=" and a.state=:cid";
  21. $data[':cid']=$_GPC['is_shelves2'];
  22. }
  23. if($_GPC['is_tg']){
  24. $where.=" and a.is_tg={$_GPC['is_tg']} ";
  25. }
  26. $pageindex = max(1, intval($_GPC['page']));
  27. $pagesize=10;
  28. $sql="select a.* ,b.name as type_name,c.store_name from " . tablename("zhtc_qggoods") . " a" . " left join " . tablename("zhtc_qgtype") . " b on b.id=a.type_id left join " . tablename("zhtc_store") . " c on c.id=a.store_id ".$where." order by num asc";
  29. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  30. $list = pdo_fetchall($select_sql,$data);
  31. $total=pdo_fetchcolumn("select count(*) from " . tablename("zhtc_qggoods") . " a" . " left join " . tablename("zhtc_qgtype") . " b on b.id=a.type_id left join " . tablename("zhtc_store") . " c on c.id=a.store_id ".$where,$data);
  32. $pager = pagination($total, $pageindex, $pagesize);
  33. $type=pdo_getall('zhtc_qgtype',array('uniacid'=>$_W['uniacid']));
  34. if($_GPC['op']=='del'){
  35. $res=pdo_delete('zhtc_qggoods',array('id'=>$_GPC['id']));
  36. if($res){
  37. message('删除成功',$this->createWebUrl2('sjqggoodall',array()),'success');
  38. }else{
  39. message('删除失败','','error');
  40. }
  41. }
  42. if($_GPC['state']){
  43. $res=pdo_update('zhtc_qggoods',array('state'=>$_GPC['state']),array('id'=>$_GPC['id']));
  44. if($res){
  45. message('编辑成功',$this->createWebUrl2('sjqggoodall',array()),'success');
  46. }else{
  47. message('编辑失败','','error');
  48. }
  49. }
  50. if($_GPC['state2']){
  51. $res=pdo_update('zhtc_qggoods',array('state2'=>$_GPC['state2']),array('id'=>$_GPC['id']));
  52. if($res){
  53. message('编辑成功',$this->createWebUrl2('sjqggoodall',array()),'success');
  54. }else{
  55. message('编辑失败','','error');
  56. }
  57. }
  58. if($_GPC['sh']){
  59. $res=pdo_update('zhtc_qggoods',array('is_tg'=>$_GPC['sh']),array('id'=>$_GPC['id']));
  60. if($res){
  61. message('编辑成功',$this->createWebUrl2('sjqggoodall',array()),'success');
  62. }else{
  63. message('编辑失败','','error');
  64. }
  65. }
  66. include $this->template('web/sjqggoodall');