</p> <?php } ?> <div style="border-bottom:1px solid #ebebeb"> <?php if ($data->returngoods) { $count = count($data->returngoods); ?> <ul class="splb_order float_l tb_head m_left"> <?php foreach ($data->returngoods as $v) { ?> <?php $goods = DealergoodsService::getmongoversion($v['GoodsID'], $v['Version']); ?> <li> <div class="div_img float_l m-top"> <a class="order_goods" title="" href="<?php echo Yii::app()->CreateUrl('pap/dealergoods/goodsinfo', array('goods' => $v['GoodsID'])); ?> " version="<?php echo $v['Version']; ?> " target="_blank" goodsid="<?php echo $v['GoodsID']; ?> "> <img src="
private static function getVersionGoods($v) { $res = DealergoodsService::getmongoversion($v['GoodsID'], $v['Version']); $goods = $res['GoodsInfo']; // if (is_array($goods) && !empty($goods)) { //商品图片 if (is_array($goods['img']) && !empty($goods['img'])) { if (!$goods['img'][0]['ImageUrl']) { $v['ImageUrl'] = $goods['img'][0]['MallImage']; } else { $v['ImageUrl'] = $goods['img'][0]['ImageUrl']; } } else { $v['ImageUrl'] = ''; } //商品oe号 if (is_array($goods['oeno']) && !empty($goods['oeno'])) { $oe = ''; foreach ($goods['oeno'] as $ov) { if ($ov) { $oe .= $ov . ','; } } $v['GoodsOE'] = substr($oe, 0, -1); } else { $v['GoodsOE'] = ''; } $v['GoodsName'] = $goods['Name']; $v['GoodsNum'] = $goods['GoodsNO']; $v['Brand'] = $goods['Brand']; $v['PartsLevelName'] = $goods['PartsLevelName']; $v['CpName'] = Gcategory::model()->find(array('select' => 'Name', 'condition' => "Code='{$goods['StandCode']}'"))->attributes['Name']; $v['Carmodeltxt'] = MallService::getCarmodeltxt(array('make' => $v['MakeID'], 'series' => $v['CarID'], 'year' => $v['Year'], 'model' => $v['ModelID'])); return $v; }
public static function createorder($quoID, $schID, $payment, $address, $ordertype, $goodsids, $nums, $CouponSn) { $opration = array(); //错误时执行操作 $sql_findQuo = 'select * from pap_quotation where QuoID=' . $quoID; $Quoinfo = Yii::app()->papdb->createCommand($sql_findQuo)->queryRow(); //获取方案对应的商品 $sql_goods = 'select * from pap_quotation_goods where SchID=' . $schID . ' and GoodsID in(' . $goodsids . ') '; $goodsinfo = self::excutesql(array('sql' => $sql_goods, 'db' => 'pap')); //获取经销商最小价格 $min_price = PapOrderMinTurnover::model()->find('OrganID=:OrganID', array(':OrganID' => $Quoinfo['DealerID'])); $min_price = $min_price['MinTurnover']; //获取经销商信息 $sql_dealer = 'select ID,OrganName from jpd_organ where ID=' . $Quoinfo['DealerID']; $dealerinfo = Yii::app()->jpdb->createCommand($sql_dealer)->queryRow(); //获取修理厂信息 $find_lsm_orgname = 'select OrganName from jpd_organ where ID=' . $Quoinfo['ServiceID']; $serviceinfo = Yii::app()->jpdb->createCommand($find_lsm_orgname)->queryRow(); //调用商城生成订单方法 $carts = array(); $carts['SellerID'] = $Quoinfo['DealerID']; $carts['BuyerID'] = $Quoinfo['ServiceID']; $carts['SellerName'] = $dealerinfo['OrganName']; $carts['BuyerName'] = $serviceinfo['OrganName']; $carts['MinTurnover'] = $min_price ? $min_price : '0'; //获取经销商订单折扣率--询报价订单 $dis = 100; $discount = PapOrderDiscount::model()->find(array("condition" => " OrderType = 2")); if ($discount) { if ($payment == 1 && $discount['OrderAlipay']) { $dis = $discount['OrderAlipay']; } else { if ($payment == 2 && $discount['OrderLogis']) { $dis = $discount['OrderLogis']; } else { $dis = 100; } } } else { $dis = 100; } $carts['discount'] = $dis; $totalgoods; $nums = explode(',', $nums); foreach ($goodsinfo as $kk => $value) { $goodsbyid = DealergoodsService::getmongoversion($value['GoodsID'], $value['Version']); if ($goodsbyid) { $totalgoods[$kk] = array('BuyerID' => $Quoinfo['ServiceID'], 'BuyerName' => $serviceinfo['OrganName'], 'SellerID' => $dealerinfo['ID'], 'SellerName' => $dealerinfo['OrganName'], "GoodsID" => $value['GoodsID'], "GoodsNum" => $goodsbyid['GoodsInfo']['GoodsNO'], "GoodsOE" => is_array($goodsbyid['GoodsInfo']['oeno']) ? implode(',', $goodsbyid['GoodsInfo']['oeno']) : (is_string($goodsbyid['GoodsInfo']['oeno']) ? ['GoodsInfo']['oeno'] : ''), "GoodsName" => $goodsbyid['GoodsInfo']['Name'], "CpName" => $goodsbyid['GoodsInfo']['StandCode'] ? self::getCpName($goodsbyid['GoodsInfo']['StandCode']) : '', "Brand" => $goodsbyid['GoodsInfo']['Brand'], "Price" => $goodsbyid['GoodsInfo']['Price'], "ProPrice" => $value['Price'], "Quantity" => $nums[$kk], "ShipCost" => null, "CreateTime" => time(), "UpdateTime" => time(), "Version" => $goodsbyid['Version']); } } $carts['GoodsList'] = $totalgoods; if ($ordertype == 2) { //如果是由询价单生成的订单 //获取询价单信息 $sql = 'select * from pap_inquiry where InquiryID=' . $Quoinfo['InquiryID']; $Inquiryinfo = Yii::app()->papdb->createCommand($sql)->queryRow(); if (!$Inquiryinfo) { return json_encode(array('success' => false, 'message' => '确认失败,该询价单不存在')); } if ($Inquiryinfo['Status'] == 2) { return json_encode(array('success' => false, 'message' => '确认失败,该询价单已确认')); } if ($Inquiryinfo['Status'] == 3) { return json_encode(array('success' => false, 'message' => '确认失败,该询价单已撤销')); } // 修改询价单状态 $updateinquiry = PapInquiry::model()->updateByPK($Quoinfo['InquiryID'], array('Status' => 2)); if ($updateinquiry != 1) { return json_encode(array('success' => false, 'message' => '确认询价单失败', 'msg' => 'check inquiry fail', 'QuoID' => $quoID, 'data' => '确认询价单失败')); } else { //成功时插入return的SQL $opration[1] = 'update pap_inquiry set Status=1 where InquiryID=' . $Quoinfo['InquiryID']; } } //修改方案状态 $updateschem = InquiryorderService::changeschstatus(array('status' => 2, 'SchID' => $schID)); if ($updateschem != 1) { self::returnint($opration); return json_encode(array('success' => false, 'message' => '确认方案失败', 'msg' => 'check scheme fail', 'QuoID' => $quoID, 'data' => '确认方案失败')); } else { $opration[2] = 'update pap_quotation_scheme set Status="1" where SchID=' . $schID; } // 修改报价单状态 $discountdesc = QuotationService::getpriceratio($Quoinfo['DealerID'], $Quoinfo['ServiceID']); $updateQuo = PapQuotation::model()->updateByPK($quoID, array('Status' => '2', 'Discount' => $discountdesc['type'] . ',' . $discountdesc['discount'])); if ($updateQuo != 1) { self::returnint($opration); return json_encode(array('success' => false, 'message' => '确认报价单失败', 'msg' => 'check quo scheme fail', 'QuoID' => $quoID, 'data' => '确认报价单方案失败')); } else { $opration[3] = 'update pap_quotation set Status=1 where QuoID=' . $quoID; } $adressinfo = self::getaddressbypk($address); $params = array('payment' => $payment, 'ship' => $adressinfo, 'ordertype' => $ordertype, 'cartsGoods' => array($carts)); //根据优惠券编号查询优惠券金额 if ($CouponSn) { $copinfo = BuyGoodsService::couponbysn(array('couponsn' => $CouponSn)); if ($copinfo) { $params['coupon'] = $copinfo['Amount']; $params['couponsn'] = $copinfo['CouponSn']; $params['usecouponID'] = $copinfo['CouponID']; } } //self::returnint($opration); $orderID = BuyGoodsService::createorder($params); // exit; $orderID = intval($orderID); //获取订单编号 $sql_order = 'select OrderSN from pap_order where ID=' . $orderID; $res = Yii::app()->papdb->createCommand($sql_order)->queryRow(); $order_sn = $res['OrderSN']; if (!$orderID) { self::returnint($opration); return json_encode(array('success' => false, 'message' => '生成订单失败', 'msg' => 'create order fail', 'QuoID' => $quoID, 'data' => '创建订单失败')); } //保存订单编号到询价单表 if ($ordertype == 2) { PapInquiry::model()->updateByPK($Quoinfo['InquiryID'], array('OrderSn' => $order_sn)); } //保存订单ID到报价单表 PapQuotation::model()->updateByPK($quoID, array('OrderID' => $orderID)); //更改报价单待确认状态为已处理 $sql = 'update pap_remind_business set HandleStatus=2 where HandleID=' . $quoID . ' and OrganID=' . $Quoinfo['ServiceID']; Yii::app()->papdb->createCommand($sql)->execute(); return json_encode(array('success' => true, 'message' => '生成订单成功,点击跳转', 'msg' => 'carate order success', 'QuoID' => $quoID, 'data' => '创建订单成功', 'orderID' => $orderID, 'ordersn' => $order_sn)); }
public static function getgoodsinfobyid($goodsid, $Version, $QuogoodsID = '') { $info = DealergoodsService::getmongoversion($goodsid, $Version); $goodsinfo = $info['GoodsInfo']; $goodsinfo['PL'] = $goodsinfo['PartsLevelName']; $goodsinfo['BrandName'] = $goodsinfo['Brand']; $oes = self::getgoodsoes($goodsinfo['oeno']); if (Yii::app()->user->isDealer() == 1) { $nameurl = Yii::app()->createUrl('/pap/dealergoods/goodsinfo/', array('goods' => $goodsid)); $goodsinfo['Name'] = '<a version="' . $Version . '" goodsid="' . $goodsid . '" class="order_goods" href="' . $nameurl . '">' . $goodsinfo['Name'] . '</a>'; $goodsinfo['GoodsNO'] = '<a target="_blank" href="' . $nameurl . '">' . $goodsinfo['GoodsNO'] . '</a>'; } elseif (Yii::app()->user->isServicer() == 1) { $nameurl = Yii::app()->createUrl('/pap/mall/detail/', array('goods' => $goodsid)); $goodsinfo['Name'] = '<a version="' . $Version . '" quogoodsid=' . $QuogoodsID . ' goodsid="' . $goodsid . '" class="quottion_goods_href" href="javascript:void(0);">' . $goodsinfo['Name'] . '</a>'; $goodsinfo['GoodsNO'] = '<a version="' . $Version . '" quogoodsid=' . $QuogoodsID . ' goodsid="' . $goodsid . '" class="quottion_goods_href" href="javascript:void(0);">' . $goodsinfo['GoodsNO'] . '</a>'; } $goodsinfo['Name'] = '<a version="' . $Version . '" goodsid="' . $goodsid . '" class="order_goods" href="' . $nameurl . '">' . $goodsinfo['Name'] . '</a>'; $goodsinfo['GoodsNO'] = '<a target="_blank" href="' . $nameurl . '">' . $goodsinfo['GoodsNO'] . '</a>'; $goodsinfo['OENO'] = $oes; $goodsinfo['StandCodeName'] = '<a title="' . $goodsinfo['StandCodeName'] . '">' . $goodsinfo['StandCodeName'] . '</a>'; unset($goodsinfo['Price']); return $goodsinfo; }
public function actionGoodsinfo() { $this->pageTitle = Yii::app()->name . '-' . "商品详情"; $ID = Yii::app()->request->getParam('goods'); if (Yii::app()->request->getParam('Version')) { $Version = Yii::app()->request->getParam('Version'); $GoodsID = Yii::app()->request->getParam('GoodsID'); // $Goodsinfo = PapGoods::model()->findBypk($GoodsID); $data = DealergoodsService::getmongoversion($GoodsID, $Version, 'haveveh'); $this->render('versioninfo', array('data' => $data['GoodsInfo'])); } else { $this->render('edit', array('data' => DealergoodsService::editgetgoods($ID), 'status' => 'info')); } }
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)); }