Exemplo n.º 1
0
 public function indexAction()
 {
     $queryAdd = I('get.condition');
     $data = array();
     if (is_numeric($queryAdd)) {
         $openId = get_openid();
         $orderFormModel = new OrderFormModel();
         $orderFormModel->setQueryAdd($queryAdd);
         $orderFormModel->setOpenId($openId);
         $orderForm = $orderFormModel->getOrderFormInfo();
         $num = count($orderForm);
         if ($num < 1) {
             $data['content'] = $this->fetch('noForm');
         } else {
             $orderGoods = new OrderGoodsModel();
             $orderGoods->setOrderForm($orderForm);
             $res = $orderGoods->getOrderGoods();
             $this->assign('res', $res);
             $data['content'] = $this->fetch('list');
         }
         $data['state'] = 0;
         //表示返回的订单信息
     } else {
         $goodsDetailUrl = U('Goods/GoodsDetail/index');
         $this->assign('goodsDetailUrl', $goodsDetailUrl);
         $goodsModel = new GoodsModel();
         $goodsModel->setPageSize($this->pageSize);
         $goodsModel->setName($queryAdd);
         $num = $goodsModel->likeNameCount();
         if ($num == 0) {
             $data['content'] = 'soory';
         } else {
             if ($num > $this->pageSize) {
                 $this->assign('nextPageNum', 2);
                 $data['page'] = $this->fetch('page');
             }
             $res = $goodsModel->goodsList();
             //添加物流方式
             $logistic = new LogisticsModel();
             $key = 'logistics_mode';
             $res = $logistic->getLogisticInfo($res, $key);
             //添加来源
             $source = new SourceModel();
             $key = 'source';
             $keyRes = 'source';
             $res = $source->getInfoById($res, $key, $keyRes);
             $this->assign('list', $res);
             $data['content'] = $this->fetch($this->goodsList);
         }
         $data['state'] = 1;
         //表示返回的商品信息
     }
     $jsonData = json_encode($data);
     echo $jsonData;
 }
 public function chooseAllAction()
 {
     $orderForm = new OrderFormModel();
     $orderForm->setCustomerId($this->customerId);
     $resOrderForm = $orderForm->getOrderFormInfo();
     $num = count($resOrderForm);
     if ($num < 1) {
         $HomeUrl = U('Home/Index/index');
         $this->assign('HomeUrl', $HomeUrl);
         $data = $this->fetch('noForm');
     } else {
         $orderGoods = new OrderGoodsModel();
         $orderGoods->setOrderForm($resOrderForm);
         $res = $orderGoods->getOrderGoods();
         $this->assign('res', $res);
         $data = $this->fetch('list');
     }
     echo $data;
 }
 public function unPayManageAction()
 {
     $orderGoods = new OrderGoodsModel();
     $orderForm = new OrderFormModel();
     $orderForm->setOpenid($this->open_id);
     $resOrderForm = $orderForm->getOrderFormInfo();
     $orderGoods->setOrderForm($resOrderForm);
     $res = $orderGoods->getOrderGoods();
     $relation = M('order_relation');
     $map[buy_openid] = $this->open_id;
     $map[is_payed] = 0;
     $map[is_cancel] = 0;
     $unpayOrder = array();
     $unpayOrder = $relation->where($map)->select();
     //为payOrder拼接所含订单数据
     foreach ($unpayOrder as $key => $value) {
         $map1[payid] = $value[id];
         $form = M('order_form');
         $unpayOrder[$key][order_form] = $form->where($map1)->select();
         foreach ($unpayOrder[$key][order_form] as $value) {
             $unpayOrder[$key][count] = $value[total_prices];
         }
     }
     $this->assign('topay', U('Pay/Index/index') . '?payid=');
     $this->assign('tocancel', U('noPaytoCancel') . '?id=');
     $this->assign('list', $unpayOrder);
     $url = U('orderManageDetails') . '?id=';
     $this->assign('key', $key);
     $this->assign('url', $url);
     $this->assign("YZBody", $this->fetch());
     $this->display(YZ_TEMPLATE);
 }