public static function addadress($params) { $model = new PapOrderAddress(); $model->attributes = $params; return $model->save(); }
public static function checkSendID($ID) { $criteria = new CDbCriteria(); $OrganID = Yii::app()->user->getOrganID(); $criteria->addCondition("t.SellerID = {$OrganID} and t.IsDelete=0"); $criteria->addCondition("t.Status = 2"); $criteria->addInCondition("t.ID", $ID); $criteria->select = 't.ID,t.BuyerID'; $model = PapOrder::model()->findAll($criteria); if (count($model) != count($ID)) { return array('error' => 1, 'msg' => '发货失败,请选择待发货订单'); } //合并发货 if (count($ID) > 1) { $addr = array(); $name = array(); foreach ($model as $k => $v) { $name[$k] = $v['BuyerID']; if ($k >= 1 && $name[$k] != $name[0]) { return array('error' => 2, 'msg' => '发货失败,请选择同一买家'); } $addr[$k] = PapOrderAddress::model()->find(array('condition' => "OrderID={$v['ID']}", 'select' => 'ShippingName,ZipCode,Mobile,TelePhone,Province,City,Area,Address'))->attributes; if ($k >= 1 && $addr[$k] != $addr[0]) { return array('error' => 3, 'msg' => '发货失败,收货地址不相同'); } } } return array('success' => 1); }
/** * 获取订单收货地址信息 * */ public static function getship($id) { $model = PapOrderAddress::model()->find('OrderID=:orderID', array(':orderID' => $id))->attributes; return $model; }
public function actionOrderexport() { $model = PapOrder::model()->findByPk($_GET['ID']); //订单信息 $data['SellerID'] = $model->SellerID; $data['BuyerID'] = $model->BuyerID; $data['CreateTime'] = date("Y-m-d H:i:s", $model->CreateTime); $data['OrderSN'] = $model->OrderSN; $data['SellerName'] = $model->SellerName; $data['BuyerName'] = $model->BuyerName; $data['GoodsList'] = "商品清单"; $data['TotalAmount'] = "¥" . $model->TotalAmount; $data['ShipSn'] = $model->ShipSn; $data['ShipLogis'] = $model->ShipLogis; $data['ReShipSn'] = $model->ReShipSn; $data['ReShipLogis'] = $model->ReShipLogis; $data['ListShip'] = $model->ShipCost; $data['PayTime'] = $model->PayTime ? date("Y-m-d H:i:s", $model->PayTime) : ''; $data['DeliveryTime'] = $model->DeliveryTime ? date("Y-m-d H:i:s", $model->DeliveryTime) : ''; $data['ReceiptTime'] = $model->ReceiptTime ? date("Y-m-d H:i:s", $model->ReceiptTime) : ''; if ($model->Payment == '1') { $data['Payment'] = "支付宝担保交易"; } elseif ($model->Payment == '2') { $data['Payment'] = "物流代收款"; } $data['Status'] = $model->Status; $data['IsUnusual'] = $model->IsUnusual; //获取收货地址 // $ship = JporderService::getShip($model->ID); $ship = PapOrderAddress::model()->find("OrderID=:ID", array(":ID" => $model->ID))->attributes; $data['Consignee'] = $ship['ShippingName'] ? $ship['ShippingName'] : ''; $data['Mobile'] = $ship['Mobile'] ? $ship['Mobile'] : ''; $data['Phone'] = $ship['TelePhone'] ? $ship['TelePhone'] : ''; $data['Delivery'] = Area::getCity($ship['Province']) . Area::getCity($ship['City']) . Area::getCity($ship['Area']) . $ship['Address']; $data['ZipCode'] = $ship['ZipCode'] ? $ship['ZipCode'] : ''; //获取卖方基本信息 $seller = $this->getSeller($model->SellerID); $data['OrganName'] = $seller['organName']; $data['ContactPhone'] = $seller['Phone']; $data['QQ'] = $seller['QQ']; $data['Address'] = Area::getCity($seller['province']) . Area::getCity($seller['city']) . Area::getCity($seller['area']); $model1 = PapOrderGoods::model()->findAll("OrderID=:ID", array(":ID" => $model->ID)); foreach ($model1 as $key => $value) { $data['goods'][$key]['ID'] = $value['ID']; $data['goods'][$key]['CreateTime'] = F::msubstr(date("Y-m-d", $value['CreateTime'])); $data['goods'][$key]['GoodsNum'] = F::msubstr($value['GoodsNum']); $data['goods'][$key]['GoodsOE'] = F::msubstr($value['GoodsOE']); $data['goods'][$key]['GoodsName'] = F::msubstr($value['GoodsName']); $data['goods'][$key]['Brand'] = F::msubstr($value['Brand']); $data['goods'][$key]['Price'] = $value['Price']; $data['goods'][$key]['editPrice'] = $value['ProPrice'] ? $value['ProPrice'] : $value['Price']; $data['goods'][$key]['ShipCost'] = $value['ShipCost']; $data['goods'][$key]['Quantity'] = $value['Quantity']; $data['goods'][$key]['PN'] = $value['PN']; $data['goods'][$key]['ReQuantity'] = $value['ReQuantity']; $data['goods'][$key]['GoodsAmount'] = "¥" . $value['GoodsAmount']; } $this->renderPartial('orderexport', array('row' => $data)); }
public static function saveinquiryaddress($data) { $arr = new PapOrderAddress(); $arr->attributes = $data; $arr->save(); }