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 static function newgoodsxinfo($GoodsID) { $PartsLevel = array('A' => '原厂', 'B' => '高端品牌', 'C' => '经济实用', 'D' => '下线', 'E' => '拆车'); $Goods = PapGoods::model()->findBypk($GoodsID); if ($Goods) { $arr = $Goods->attributes; $arr['Brand'] = self::idgetjpbrand($Goods->attributes['BrandID'], 'BrandName'); //机构名称 $arr['OrganName'] = self::getnamebyorganid($Goods->attributes['OrganID']); //获得配件档次名称 $arr['PartsLevelName'] = $PartsLevel[$Goods->attributes['PartsLevel']]; //获得标准名称 $arr['StandCodeName'] = DealergoodsService::StandCodegetcpname($Goods->attributes['StandCode'], 'Name'); //商品-OE号 $oeno = PapGoodsOeRelation::model()->findAll('GoodsID=:GoodsID', array(':GoodsID' => $GoodsID)); foreach ($oeno as $value) { $arr['oeno'][] = $value->attributes['OENO']; } $gcategory = MallService::getCategory($Goods->attributes['StandCode']); // $version['gcategory'] = $gcategory->attributes; $redis['gcategory']['BigParts'] = $gcategory['BigPartsID']; $redis['gcategory']['SubParts'] = $gcategory['SubPartsID']; $redis['gcategory']['BigName'] = $gcategory['BigParts']; $redis['gcategory']['SubName'] = $gcategory['SubParts']; //商品-图片 $img = PapGoodsImageRelation::model()->findAll('GoodsID=:GoodsID', array(':GoodsID' => $GoodsID)); foreach ($img as $key => $value) { $arr['img'][$key]['ImageUrl'] = $value->attributes['ImageUrl']; $arr['img'][$key]['ImageName'] = $value->attributes['ImageName']; $arr['img'][$key]['BigImage'] = $value->attributes['BigImage']; $arr['img'][$key]['MallImage'] = $value->attributes['MallImage']; } //商品-属性 $spec = PapGoodsSpec::model()->find('GoodsID=:GoodsID', array(':GoodsID' => $GoodsID)); $arr['spec']['ValidityType'] = $spec->attributes['ValidityType']; $arr['spec']['ValidityDate'] = $spec->attributes['ValidityDate']; $arr['spec']['Unit'] = $spec->attributes['Unit']; $arr['spec']['BganCompany'] = $spec->attributes['BganCompany']; $arr['spec']['BganGoodsNO'] = $spec->attributes['BganGoodsNO']; //商品-包装 $pack = PapGoodsPack::model()->find('GoodsID=:GoodsID', array(':GoodsID' => $GoodsID)); $arr['pack']['MinQuantity'] = $pack->attributes['MinQuantity']; } return $arr; }
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)); }