Exemplo n.º 1
0
        echo " <option value=" . $key . ">" . $value . "</option>";
    }
}
?>
                            </select>
                            <?php 
if ($edit['PartsLevel']) {
    ?>
                                <span style="color:green">(提示:配件档次有变化)</span>
                            <?php 
}
?>
                        </p>
                        <p class="m-top"><span class="m_left36a">单位:</span>
                            <?php 
$units = GoodsUnit::model()->findAll(array('select' => '*', 'group' => 'UnitName'));
$unit = CHtml::listData($units, 'ID', 'UnitName');
$unitID = $data['spec']['Unit'];
echo CHtml::dropDownList('Unit', $unitID, $unit, array('class' => 'select select2 ', 'empty' => '选择商品单位'));
?>
	
                            <?php 
if ($edit['Unit']) {
    ?>
                                <span style="color:green">(提示:单位有变化)</span>
                            <?php 
}
?>
                        </p>
                        <p class="m-top">
Exemplo n.º 2
0
?>
</li>
                                <li>品牌:<?php 
echo $r['BrandName'];
?>
</li>
                                <li>OE号:<?php 
echo $r['OENOS']['0'];
?>
</li>
                                <li>标杆品牌:<?php 
echo $r['BganCompany'];
?>
</li>
                                <?php 
$units = GoodsUnit::model()->find("ID=:id", array(":id" => $r['UnitName']));
?>
                                <li>单位:<?php 
echo $units->UnitName;
?>
</li>
                            </ul>
                            <div style="clear:both"></div>
                        </div>

                        <div class="hide sppj">
                            <div class="column">
                                <div style="height:40px; line-height:40px;background:#FBFCFC;  border:1px solid #e2e2e2; padding:0">                
                                    <form style="margin-left:20px; float:left"> 
                                        <input name="pl" id="all" type="radio" value="all" onclick="show('all')" checked="checked" style="vertical-align:middle; margin-top:0"/><label for="all">全部</label>
                                        <input name="pl" id="good" type="radio" value="good" onclick="show('good')"/><label for="good">好评</label>
Exemplo n.º 3
0
        echo " <option value=" . $key . ">" . $value . "</option>";
    }
}
?>
                            </select>
                            <?php 
if ($edit['PartsLevel']) {
    ?>
                                <span style="color:green">(提示:配件档次有变化)</span>
                            <?php 
}
?>
                        </p>
                        <p class="m-top"><span class="m_left36a">单位:</span>
                            <?php 
$units = GoodsUnit::model()->findAll();
$unit = CHtml::listData($units, 'ID', 'UnitName');
$unitID = $data['spec']['Unit'];
echo CHtml::dropDownList('Unit', $unitID, $unit, array('class' => 'select select2 ', 'empty' => '选择商品单位'));
?>
	
                            <?php 
if ($edit['Unit']) {
    ?>
                                <span style="color:green">(提示:单位有变化)</span>
                            <?php 
}
?>
                        </p>
                        <p class="m-top">
                            <span class="m_left24a">保修期:</span>   
Exemplo n.º 4
0
 public static function addgoodslog($new)
 {
     $new['StandCode'] = self::StandCodegetcpname($new['StandCode'], 'Name');
     foreach (Yii::app()->getParams()->PartsLevel as $key => $value) {
         if ($key == $new['info']['PartsLevel']) {
             $new['PartsLevel'] = $value;
         }
     }
     $units = GoodsUnit::model()->findAll(array('select' => '*', 'group' => 'UnitName'));
     foreach ($units as $value) {
         $unit[$value->attributes['ID']] = $value->attributes['UnitName'];
     }
     if ($new['spec']['Unit']) {
         $new['spec']['Unit'] = $unit[$new['spec']['Unit']];
     }
     if ($new['spec']['ValidityType'] == 1) {
         $new['spec']['ValidityType'] = '不保修';
     }
     if ($new['spec']['ValidityType'] == 2) {
         $new['spec']['ValidityType'] = '保修车';
     }
     if ($new['spec']['ValidityType'] == 3) {
         $new['spec']['ValidityType'] = '保修时间:';
     }
     foreach ($new as $key => $value) {
         if ($key == 'spec' || $key == 'pack') {
             if ($value) {
                 foreach ($value as $k => $v) {
                     if ($v) {
                         $mongo[$k]['old'] = '';
                         $mongo[$k]['new'] = $v;
                     }
                 }
             }
         } else {
             if ($value) {
                 $mongo[$key]['old'] = '';
                 $mongo[$key]['new'] = $value;
             }
         }
     }
     if ($new['img']) {
         foreach ($new['img'] as $k => $v) {
             $mongo[img]['add'][] = $v['ImageName'];
         }
     }
     $editarr = array('GoodsID' => (int) $new['ID'], 'UpdateTime' => (int) $new['UpdateTime'], 'EditInfo' => $mongo, 'type' => 'edit');
     Yii::app()->mongodb->getDbInstance()->goods_log->insert($editarr);
 }
Exemplo n.º 5
0
 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));
 }
Exemplo n.º 6
0
 public function actionGetGoods()
 {
     if (Yii::app()->request->isAjaxRequest) {
         $goodsid = Yii::app()->request->getParam('goodsid');
         $serviceID = Yii::app()->user->getOrganID();
         $result = MallService::getredis($goodsid);
         //商品折扣价
         if ($result['IsPro'] != 1) {
             $PriceRatio = MallService::getDisprice($result['OrganID'], $serviceID);
             if ($PriceRatio > 0 && $PriceRatio < 100) {
                 $result['DisPrice'] = sprintf('%.2f', $result['Price'] * $PriceRatio / 100);
             }
         }
         $result['spec']['UnitName'] = GoodsUnit::model()->findByPk($result['spec']['Unit'])->attributes['UnitName'];
         //单位
         echo json_encode($result, true);
     } else {
         $this->redirect('index');
     }
 }
Exemplo n.º 7
0
 public static function getGoodByID($id, $payment, $m = '')
 {
     Yii::app()->cache->flush();
     $criteria = new CDbCriteria();
     $criteria->condition = "t.ISdelete = 1 and t.OrganID!=''";
     // 上架的和没有删除的商品
     $criteria->with = array("img", 'spec', 'pack');
     $model = PapGoods::model()->findByPk($id, $criteria);
     if (!$model) {
         return false;
     } else {
         if ($model->IsSale == 0) {
             if ($m == 'mall') {
                 return 'nosale';
             } else {
                 return false;
             }
         }
     }
     $data = array();
     $sellerID = $model->OrganID;
     $discount = PapOrderDiscount::model()->find(array("condition" => " OrderType = 1"));
     if ($discount) {
         if ($payment == 1) {
             $dis = $discount['OrderAlipay'];
         } else {
             if ($payment == 2) {
                 $dis = $discount['OrderLogis'];
             }
         }
         if (isset($dis) && !empty($dis)) {
             $dis = $dis;
         } else {
             $dis = 100;
         }
     } else {
         $dis = 100;
     }
     //获取该经销商最小交易额
     $turnover = PapOrderMinTurnover::model()->find("OrganID=:ID", array(":ID" => $model['OrganID']));
     if ($turnover) {
         $data["MinTurnover"] = $turnover['MinTurnover'];
     }
     $data['Version'] = $model->Version;
     $data['discount'] = $dis;
     //商品基本信息
     $data['GoodsID'] = $id;
     $data['Name'] = $model['Name'];
     $data['GoodsNO'] = $model['GoodsNO'];
     $data['CommentNo'] = $model['CommentNo'];
     $data['Info'] = $model['Info'];
     $data['Memo'] = $model['Memo'];
     $data['IsSale'] = $model['IsSale'];
     $data['PartsLevel'] = $model['PartsLevel'];
     $data['code'] = $model['StandCode'];
     if ($model['BrandID']) {
         $sql = "select BrandName from pap_brand where ID={$model['BrandID']}";
         $res = Yii::app()->papdb->createCommand($sql)->queryRow();
     }
     $data['BrandName'] = $res['BrandName'];
     $organID = Yii::app()->user->getOrganID();
     //商品价格
     $priceRatio = self::getContactprice($model['OrganID'], $organID);
     $data['Price'] = $model['Price'];
     $data['LogisticsPrice'] = 0;
     $data['PriceRatio'] = $priceRatio['PriceRatio'] > 0 && $priceRatio['PriceRatio'] <= 100 ? $priceRatio['PriceRatio'] : 100;
     $data['DisPrice'] = sprintf("%.2f", $model['Price'] * $data['PriceRatio'] / 100);
     // 折扣价,小数点后面保留两位
     if ($model['IsPro'] == 1) {
         if (!is_null($model['ProPrice']) && $model['ProPrice']) {
             $data['ProPrice'] = $model['ProPrice'];
         }
     }
     //店家信息
     $organInfo = Organ::model()->findByPk($model['OrganID'])->attributes;
     $data['OrganName'] = $organInfo['OrganName'];
     $data['SellerID'] = $model['OrganID'];
     $data['QQ'] = $organInfo['QQ'];
     $data['Phone'] = $organInfo['Phone'];
     //$address = self::getOrganAddress($organInfo['Province'], $organInfo['City'], $organInfo['Area']);
     $data['Address'] = array(Area::getCity($organInfo['Province']), Area::getCity($organInfo['City']), Area::getCity($organInfo['Area']));
     //商品OE号
     $data['OENO'] = PapGoods::model()->getOENOSByGoodsID($id);
     //$data['LogisticsPrice'] = $goods['LogisticsPrice'];
     //商品大类、子类、标准名称
     $cpArr = self::getCategory($model['StandCode']);
     $data['BigParts'] = $cpArr['BigParts'];
     $data['SubParts'] = $cpArr['SubParts'];
     $data['CpName'] = $cpArr['CpName'];
     $data['sub'] = $cpArr['sub'];
     $data['BganCompany'] = $model->spec->BganCompany ? $model->spec->BganCompany : '';
     //标品
     $data['BganGoodsNO'] = $model->spec->BganGoodsNO ? $model->spec->BganGoodsNO : '';
     //标商
     $data['Unit'] = $model->spec->Unit ? $model->spec->Unit : '';
     //单位ID
     $data['UnitName'] = GoodsUnit::model()->findByPk($data['Unit'])->attributes['UnitName'];
     //单位
     $data['MinQuantity'] = $model->pack->MinQuantity ? $model->pack->MinQuantity : '';
     //最小包装
     //        $data['pLength'] = $model->pack->Volume ? $model->pack->Volume : ''; //体积
     //        $data['Weight'] = $model->pack->Weight ? $model->pack->Weight : ''; //重量
     $data['ValidityType'] = $model->spec->ValidityType;
     $data['ValidityDate'] = $model->spec->ValidityDate;
     // 图片
     if (!$model->img) {
         $data['Images'][0]['ImageUrl'] = 'dealer/goods-img-big.jpg';
     } else {
         foreach ($model->img as $v) {
             $data['Images'][] = $v->attributes;
         }
     }
     return $data;
 }