Exemplo n.º 1
0
 /**
  * 立即购买一件商品生成订单
  */
 public function actionBuynoworder()
 {
     $goodsId = Yii::app()->request->getParam("goodsid");
     if (!$goodsId) {
         $this->redirect(array('/pap/home/index'));
     }
     $payment = Yii::app()->request->getParam("payment");
     if ($payment) {
         $payment = Yii::app()->request->getParam("payment");
     } else {
         $payment = 1;
     }
     if (!$payment) {
         $this->redirect(array('/pap/home/index'));
     }
     //获取物流  前台页面input name属性
     $ShipLogis = Yii::app()->request->getParam("logistics");
     $quantity = Yii::app()->request->getParam("quantity");
     if (!$quantity) {
         $this->redirect(array('/pap/home/index'));
     }
     $addressId = Yii::app()->request->getParam("addr");
     if (!$addressId) {
         $this->redirect(array('/pap/home/index'));
     }
     $ship = $this->getShip($addressId);
     if (!$ship) {
         $this->redirect(array('/pap/home/index'));
     }
     $goods = MallService::getGoodByID($goodsId, $payment);
     $locate = Yii::app()->request->getParam('locate');
     //优惠券减免金额
     $lottid = Yii::app()->request->getParam("lott");
     $PromoID = Yii::app()->request->getParam('PromoID');
     $usecouponID = Yii::app()->request->getParam('usecouponID');
     /*
      * 方法参数:$goods:商品信息 $payment:支付方式 $ShipLogis:物流公司 $ship:收货地址
      */
     $params = array('goods' => $goods, 'payment' => $payment, 'shiplogis' => $ShipLogis, 'ship' => $ship, 'quantity' => $quantity, 'locate' => $locate, 'usecouponID' => $usecouponID);
     $orderId = BuyGoodsService::createbuynoworder($params);
     if ($orderId && $lottid && $PromoID) {
         $this->redirect(array("payment", "id" => $orderId, 'lottid' => $lottid, 'promoid' => $PromoID));
     }
     $this->redirect(array("payment", "id" => $orderId));
 }
Exemplo n.º 2
0
 public function actionOrderGoods()
 {
     $this->layout = '//layouts/papmall';
     $goodsid = $subParts = Yii::app()->request->getParam('goods');
     $payment = 1;
     $result = MallService::getGoodByID($goodsid, $payment);
     if (!$result) {
         $this->redirect(array('index'));
     }
     $cookie = Yii::app()->request->getCookies();
     $car = array('make' => $cookie['mallmake']->value, 'series' => $cookie['mallseries']->value, 'year' => $cookie['mallyear']->value, 'model' => $cookie['mallmodel']->value);
     $carmodeltext = MallService::getCarmodeltxt($car);
     $res = array();
     if ($car['make'] && $car['series'] && $car['year'] && $car['model']) {
         $params = $car;
         $params['goodsid'] = $goodsid;
         $res = MallService::checkCarfit($params);
     }
     $this->pageTitle = Yii::app()->name . '-' . "商品详情";
     //获取经销商客服列表
     $csparams['organID'] = $result['SellerID'];
     $csparams['type'] = 1;
     $csinfo = CsService::getcslists($csparams);
     $this->render('ordergoods', array('r' => $result, 'carmodeltext' => $carmodeltext, 'res' => $res, 'csinfo' => $csinfo));
 }
Exemplo n.º 3
0
 public function actionAddgoodstocar()
 {
     $goodsId = Yii::app()->request->getParam("goodsid");
     $quant = Yii::app()->request->getParam("quant");
     //商品数量
     $locate = Yii::app()->request->getParam("locate");
     //定位车型
     if ($quant) {
         $goodscount = $quant;
     } else {
         $goodscount = 1;
     }
     if (!$goodsId) {
         echo false;
     }
     $payment = 1;
     //通过商品ID获取商品信息
     $goods = MallService::getGoodByID($goodsId, $payment);
     if (!$goods) {
         echo false;
     }
     if ($goods["ProPrice"]) {
         //促销价大于折扣价,则折扣价作为销售价存入购物车表
         $SellPrice = $goods["ProPrice"];
     } else {
         if ($goods['DisPrice']) {
             $SellPrice = $goods["DisPrice"];
         } else {
             $SellPrice = $goods['Price'];
         }
     }
     //定位车系
     $cookie = Yii::app()->request->getCookies();
     if ($locate) {
         $locate = explode('_', $locate);
         $make = $locate[0];
         $series = $locate[1];
         $year = $locate[2];
         $model = $locate[3];
     } else {
         $make = $cookie['mallmake']->value;
         $series = $cookie['mallseries']->value;
         $year = $cookie['mallyear']->value;
         $model = $cookie['mallmodel']->value;
     }
     //提出商品信息中需要加入购物车中的字段
     $params = array("GoodsID" => $goodsId, "GoodsName" => $goods["Name"], "CpName" => $goods["CpName"], "GoodsNum" => $goods["GoodsNO"], "Brand" => $goods["BrandName"], "ImageUrl" => $goods['Images'][0]["ImageUrl"], "Price" => $goods["Price"], "ProPrice" => $SellPrice ? $SellPrice : $goods["Price"], "BuyerID" => Yii::app()->user->getOrganID(), "BuyerName" => Yii::app()->user->getOrganName(), "SellerID" => $goods["SellerID"], "SellerName" => $goods["OrganName"], "CreateTime" => time(), "UpdateTime" => time(), "Quantity" => $goodscount, "MakeID" => $make, "CarID" => $series, "Year" => $year, "ModelID" => $model);
     //var_dump($params);exit;
     echo MallService::addtocart($params);
 }