public function actionDetail() { $serviceID = Yii::app()->user->getOrganID(); $goodsid = Yii::app()->request->getParam('goods'); $result = MallService::getredis($goodsid); //$payment = 1; //$result = MallService::getGoodByID($goodsid, $payment, 'mall'); if ($result == 'null') { echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; echo "<script>alert('该商品不存在!');window.location.href='" . Yii::app()->createUrl('pap/mall/index') . "'</script>"; exit; } else { if ($result == 'nosale') { echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; echo "<script>alert('该商品已下架!');window.location.href='" . Yii::app()->createUrl('pap/mall/index') . "'</script>"; exit; } } $result['GoodsID'] = $result['ID']; $result['CommentNo'] = PapGoods::model()->findByPk($result['ID'])->attributes['CommentNo']; //商品折扣价 if ($result['IsPro'] != 1) { $PriceRatio = MallService::getDisprice($result['OrganID'], $serviceID); if ($PriceRatio > 0 && $PriceRatio < 100) { $result['DisPrice'] = sprintf('%.2f', $result['Price'] * $PriceRatio / 100); } } $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); } //店内分类 $rows = $this->Getmaincate($result['OrganID']); $cate = $this->findsub($rows); //获取经销商客服列表 $csparams['organID'] = $result['OrganID']; $csparams['type'] = 1; $csinfo = CsService::getcslists($csparams); //大类、子类、标准名称 if (is_array($result['gcategory']) && !$result['gcategory']['BigName']) { $result['BigName'] = $result['gcategory']['BigName']; $result['SubName'] = $result['gcategory']['SubName']; $result['sub'] = $result['gcategory']['SubParts']; } else { $cpArr = MallService::getCategory($result['StandCode']); $result['BigName'] = $cpArr['BigParts']; $result['SubName'] = $cpArr['SubParts']; $result['sub'] = $cpArr['sub']; } //公告信息 $model = new PapGoodsSendnotice(); $sellerID = $result['OrganID']; $notice = $model->find("OrganID = {$sellerID}"); //var_dump($data);die; //店家积分 $result['TotalScore'] = DefaultService::getrecord($result['OrganID']); //店家信息 $organInfo = Organ::model()->findByPk($result['OrganID'])->attributes; $result['Address'] = array(Area::getCity($organInfo['Province']), Area::getCity($organInfo['City']), Area::getCity($organInfo['Area'])); $result['spec']['UnitName'] = GoodsUnit::model()->findByPk($result['spec']['Unit'])->attributes['UnitName']; //单位 //最小交易金额 $result['MinTurnover'] = PapOrderMinTurnover::model()->find("OrganID=:ID", array(":ID" => $result['OrganID']))->attributes['MinTurnover']; $this->pageTitle = Yii::app()->name . '-' . "商品详情"; $this->render('detail', array('r' => $result, 'cate' => $cate, 'carmodeltext' => $carmodeltext, 'res' => $res, 'csinfo' => $csinfo, 'car' => $car, 'data' => $notice)); }
public function actionIndex() { $this->pageTitle = Yii::app()->name . '-经销商店铺'; $dealerid = Yii::app()->request->getParam('dealerid'); $model = Organ::model()->findByPk($dealerid, "Identity=2"); if (!$model) { $this->redirect(array('/pap/home/index')); } if (!isset($dealerid) || empty($dealerid)) { throw new CHttpException(404, 'Invalid request. Please do not repeat this request again.'); } $orderGet = Yii::app()->request->getParam('order'); $brandGet = Yii::app()->request->getParam('brand'); $priceGet = Yii::app()->request->getParam('price'); $skwd1 = urldecode(Yii::app()->request->getParam('skwd')); $skwd = MallService::checkKey($skwd1); $sub = Yii::app()->request->getParam('sub'); $ispro = Yii::app()->request->getParam('ispro'); $partslevel = Yii::app()->request->getParam('partslevel'); //车型车系 $cookie = Yii::app()->request->getCookies(); //var_dump($cookie); $car['make'] = $cookie['mallmake']->value; $car['series'] = $cookie['mallseries']->value; $car['year'] = $cookie['mallyear']->value; $car['model'] = $cookie['mallmodel']->value; //获取商品品牌 $brandparams['dealerid'] = $dealerid; $brandparams['type'] = 2; $brandparams['brand'] = $brandGet; $brandparams['sub'] = $sub; $brandparams['skwd'] = $skwd; $brandparams['car'] = $car; $brandModel = MallService::getDealerbrand($brandparams); //$brandModel = MallService::getBrand($brandparams); $brandData = $brandModel['data']; $brand = $brandModel['brand']; //价格区间 $priceModel = MallService::getPrice(array('price' => $priceGet)); $priceData = $priceModel['data']; $price = $priceModel['price']; //获得排序 $orderData = $this->getOrder($orderGet); //获取url $get = $this->getSearchParams($_GET); $params = array('order' => $orderData[0], 'dealerid' => $dealerid, 'skwd' => $skwd, 'brand' => $brandGet, 'price' => $price['cond'], 'car' => $car, 'sub' => $sub, 'ispro' => $ispro, 'rows' => 12, 'resource' => "mall", 'partslevel' => $partslevel, 'type' => 3, 'organID' => Yii::app()->user->getOrganID()); //获取适用车型text //$carmodeltxt = MallService::getCarmodeltxt($car); //经销商店铺信息 $seller = DefaultService::sellerstore($dealerid); //店铺积分 $TotalScore = DefaultService::getrecord($dealerid); //获取大类名称 if ($sub) { $big = Gcategory::model()->findByPk($sub); } //获取商品 $goods = MallService::getGoodsData($params); $rows = $this->Getmaincate($dealerid); $cate = $this->findsub($rows); // var_dump($cate);exit; //底部分页 //推荐商品 //获取经销商客服列表 $csparams['organID'] = $dealerid; $csparams['type'] = 1; $csinfo = CsService::getcslists($csparams); $data = array('seller' => $seller, 'csinfo' => $csinfo, 'TotalScore' => $TotalScore, 'dataProvider' => $goods['dataProvider'], 'pages' => $this->getShortPage($goods["count"], $params['rows']), 'dealerID' => $dealerid, 'order' => $orderData, 'get' => $get, 'cate' => $cate, 'displayType' => MallService::getDisplayType("seller_displayType"), 'params' => array('brand' => $brand, 'price' => $price, 'ispro' => $ispro, 'partslevel' => $partslevel), 'brand' => $brandData, 'price' => $priceData, 'order' => $orderData, 'bigid' => $big['ParentID']); $this->render('index', $data); }
public function actionOrderGoods() { $this->layout = '//layouts/base'; $goodsid = Yii::app()->request->getParam('goods'); $version = Yii::app()->request->getParam('Version'); $order = Yii::app()->request->getParam('Order'); $return = Yii::app()->request->getParam('return'); $quo = Yii::app()->request->getParam('quo'); //版本信息 $good = DealergoodsService::getmongoversion($goodsid, $version); $result = $good['GoodsInfo']; $result['SellerID'] = $result['OrganID']; if ($order) { $model = PapOrderGoods::model()->find(array('select' => 'ProPrice as Price,Quantity,MakeID,CarID,Year,ModelID', 'condition' => "OrderID={$order} and GoodsID={$goodsid}"))->attributes; $result['Quantity'] = $model['Quantity']; $result['Price'] = $model['Price']; $car = array('make' => $model['MakeID'], 'series' => $model['CarID'], 'year' => $model['Year'], 'model' => $model['ModelID']); } else { if ($return) { $model = PapReturnGoods::model()->find(array('select' => 'Price,OrderID', 'condition' => "ReturnID='{$return}' and GoodsID='{$goodsid}'"))->attributes; $result['Quantity'] = $model['Quantity']; $result['Price'] = $model['Price']; $ordermodel = PapOrderGoods::model()->find(array('select' => 'MakeID,CarID,Year,ModelID', 'condition' => "OrderID={$model['OrderID']} and GoodsID={$goodsid}"))->attributes; $car = array('make' => $ordermodel['MakeID'], 'series' => $ordermodel['CarID'], 'year' => $ordermodel['Year'], 'model' => $ordermodel['ModelID']); } else { if ($quo) { $model = PapQuotationGoods::model()->findByPk($quo, array('select' => 'Price,Num', 'condition' => "GoodsID='{$goodsid}'"))->attributes; $result['Quantity'] = $model['Num']; $result['Price'] = $model['Price']; } else { $this->redirect(array('index')); } } } //发货公告 $model = new PapGoodsSendnotice(); $notice = $model->find("OrganID = {$result['SellerID']}"); //商品基本信息 $result['GoodsID'] = $goodsid; $result['BrandName'] = $result['Brand']; $goods = PapGoods::model()->findByPk($goodsid, array('select' => 'IsSale,CommentNo')); $result['IsSale'] = $goods->attributes['IsSale']; $result['CommentNo'] = $goods->attributes['CommentNo']; if ($result['oeno']) { $oe = ''; foreach ($result['oeno'] as $v) { $oe .= $v . ','; } $result['OENO'] = substr($oe, 0, -1); } else { $result['OENO'] = ''; } //最小交易金额 $result['MinTurnover'] = PapOrderMinTurnover::model()->find("OrganID=:ID", array(":ID" => $result['SellerID']))->attributes['MinTurnover']; //店家积分 $result['TotalScore'] = DefaultService::getrecord($result['SellerID']); //店家信息 $organInfo = Organ::model()->findByPk($result['SellerID'])->attributes; $result['OrganName'] = $organInfo['OrganName']; $result['QQ'] = $organInfo['QQ']; $result['Phone'] = $organInfo['Phone']; $result['Address'] = array(Area::getCity($organInfo['Province']), Area::getCity($organInfo['City']), Area::getCity($organInfo['Area'])); //大类子类标准名称 $result['StandCodeName'] = Gcategory::model()->find(array('select' => 'Name', 'condition' => "Code='{$result['StandCode']}'"))->attributes['Name']; $cpArr = MallService::getCategory($result['StandCode']); $result['BigName'] = $cpArr['BigParts']; $result['SubName'] = $cpArr['SubParts']; $result['sub'] = $cpArr['sub']; $result['ValidityType'] = $result['spec']['ValidityType']; $result['ValidityDate'] = $result['spec']['ValidityDate']; $result['BganCompany'] = $result['spec']['BganCompany'] ? $result['spec']['BganCompany'] : ''; //标品 $result['BganGoodsNO'] = $result['spec']['BganGoodsNO'] ? $result['spec']['BganGoodsNO'] : ''; //标商 $result['Unit'] = $result['spec']['Unit'] ? $result['spec']['Unit'] : ''; //单位ID $result['UnitName'] = GoodsUnit::model()->findByPk($result['Unit'])->attributes['UnitName']; //单位 $result['MinQuantity'] = $result['pack']['MinQuantity'] ? $result['pack']['MinQuantity'] : ''; //最小包装 // 图片 if (!$result['img']) { $result['Images'][0]['ImageUrl'] = 'dealer/goods-img-big.jpg'; $result['Images'][0]['BigImage'] = 'dealer/goods-img-big.jpg'; } else { foreach ($result['img'] as $k => $v) { $result['Images'][$k]['MallImage'] = $v['MallImage']; $result['Images'][$k]['ImageUrl'] = $v['ImageUrl']; if (!$v['BigImage']) { $result['Images'][$k]['BigImage'] = $v['ImageUrl']; } else { $result['Images'][$k]['BigImage'] = $v['BigImage']; } } } if (!$result) { $this->redirect(array('index')); } $carmodeltext = MallService::getCarmodeltxt($car); $carfit = $car; $carfit['goodsid'] = $goodsid; $fitres = MallService::checkCarfit($carfit); $rows = $this->Getmaincate($result['SellerID']); $cate = $this->findsub($rows); $this->pageTitle = Yii::app()->name . '-' . "订单商品详情"; //获取经销商客服列表 $csparams['organID'] = $result['SellerID']; $csparams['type'] = 1; $csinfo = CsService::getcslists($csparams); $this->render('ordergoods', array('r' => $result, 'cate' => $cate, 'carmodeltext' => $carmodeltext, 'fitres' => $fitres['success'] == 1 ? 1 : 0, 'csinfo' => $csinfo, 'car' => $car, 'data' => $notice, 'goodsid' => $goodsid)); }