Exemple #1
0
 function pageindex($inPath)
 {
     $url = $this->getUrlParams($inPath);
     $page = $url['page'] ? (int) $url['page'] : 1;
     $categoryObj = new m_category();
     $purchaseObj = new m_purchase();
     $condition = "isdel = 0";
     if ($_POST) {
         $key = base_Utils::getStr($_POST['key']);
         $cat_id = (int) $_POST['cat_id'];
         $condition .= " and goods_name like '%{$key}%' or goods_sn like '%{$key}%'";
         if ($cat_id) {
             $condition .= " and cat_id = {$cat_id}";
         }
         $this->params['key'] = $key;
     }
     $purchaseObj->setCount(true);
     $purchaseObj->setPage($page);
     $purchaseObj->setLimit(base_Constant::PAGE_SIZE);
     $purchase = $purchaseObj->select($condition, "", "", "order by id desc");
     $this->params['purchase'] = $purchase->items;
     $this->params['pagebar'] = $this->PageBar($purchase->totalSize, base_Constant::PAGE_SIZE, $page, $inPath);
     $this->params['catelist'] = $categoryObj->getOrderCate('    ');
     return $this->render('purchase/index.html', $this->params);
 }