/** * 支付完成后返回的URL,在此只进行提示,不对订单进行任何修改操作,这里不严格验证,不改变订单状态 * * @author Garbin * @return void */ function actionIndex() { //这里是支付宝,财付通等当订单状态改变时的通知地址 $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; //哪个订单 if (!$order_id) { /* 无效的通知请求 */ $this->show_warning('forbidden'); Yii::app()->end(); } /* 获取订单信息 */ //$order_info = JpOrder::model()->findByPk($order_id); //$order_info = JporderService::getOrder($order_id); $order_info = OrderService::getOrder($order_id); if (empty($order_info)) { /* 没有该订单 */ $this->show_warning('forbidden'); Yii::app()->end(); } /* 支付方式 */ $paymentMethod = $order_info['Payment']; if ($paymentMethod != '1') { /* 支付方式方式错误 */ $this->show_warning('no_alipay_payment'); Yii::app()->end(); } $payment = Yii::app()->alipay; /* ----------通知验证开始---------- */ $notify_result = $payment->verify_notify($order_info, true); if ($notify_result === false) { /* 支付失败 */ $this->show_warning($payment->get_error()); /* 记录日志 */ //$payment->put_log(false,'return'); Yii::app()->end(); } /* ----------通知验证结束---------- */ #TODO 临时在此也改变订单状态为方便调试,实际发布时应把此段去掉,订单状态的改变以notify为准 //$this->_change_order_status($order_id, $notify_result); /* 记录日志 */ //$payment->put_log(true,'return'); /* 只有支付时会使用到return_url,所以这里显示的信息是支付成功的提示信息 */ //echo '支付成功'; $notify = $_GET; //添加交易号 $where = "ID = {$order_id}"; $data['AlipayTN'] = $notify_result['trade_no']; PapOrder::model()->updateAll($data, $where); //$redirectUrl = Yii::app()->createUrl('mall/jporder/paypal'); $redirectUrl = Yii::app()->createUrl('pap/orderreview/index'); $this->render('success', array('order_info' => $order_info, 'notify' => $notify, 'redirectUrl' => $redirectUrl)); }
public function actionGetservicer() { //订购平台 $organID = Commonmodel::getOrganID(); //待确认的报价单 $result['dquotions'] = PapQuotation::model()->count(array('condition' => "status = 1 and ServiceID = {$organID}")); //待付款的订单 $result['forder'] = PapOrder::model()->count(array('condition' => "Status = 1 and BuyerID = {$organID}")); //待收货的订单 $result['torder'] = PapOrder::model()->count(array('condition' => "Status = 3 and BuyerID = {$organID}")); //异常订单 $result['uorder'] = PapOrder::model()->count(array('condition' => "Payment=2 and Status not in (11,12,13,14) and IsUnusual!=0 and BuyerID = {$organID}")); //待买家退货的订单 $ssorder1 = PapOrder::model()->count(array('condition' => "Payment=2 and Status = 12 and BuyerID = {$organID}")); $ssorder2 = PapOrder::model()->count(array('condition' => "Payment=1 and PayStatus = 'WAIT_BUYER_RETURN_GOODS' and BuyerID = {$organID}")); $result['sorder'] = $ssorder1 + $ssorder2; echo json_encode($result); }
/** * 支付宝账号删除 */ public function actionDelpaypal() { //判断该账户是否有未完成支付宝订单 $OrganID = Yii::app()->user->getOrganID(); $order = PapOrder::model()->count(array("condition" => "SellerID = {$OrganID} AND Payment = 1 AND Status = 1 AND AlipayTN != ''")); if (empty($order)) { //删除支付宝账户 $ID = Yii::app()->request->getParam("id"); $success = FinancialPaypal::model()->deleteByPK($ID); if ($success) { $result = array('success' => 1, 'errorMsg' => '账号删除成功!'); } else { $result = array('success' => 0, 'errorMsg' => '系统异常,账号删除失败!'); } } else { $result = array('success' => 0, 'errorMsg' => '该账户还有' . $order . '条未付款的支付宝担保交易,账户删除失败!'); } echo json_encode($result); }
public static function editSendOrder($params) { $ID = $params['ID']; //订单状态更改 $criteria = new CDbCriteria(); $organID = Yii::app()->user->getOrganID(); $criteria->condition = "t.SellerID={$organID} and t.IsDelete=0 and t.Status=3 and t.ReturnStatus=0"; // and (ISNULL(t.ShipSn) or t.ShipSn='') $criteria->with = array('goodsinfo'); $model = PapOrder::model()->findByPk($ID, $criteria)->attributes; if (!$model) { return array('error' => 1, 'msg' => '发货修改失败,请稍后再试!'); } //如果是支付宝订单,则调用确认收货接口 $isAlipay = false; $alipayResult = false; $alipayError = ""; $paymentMethod = $model['Payment']; if ($paymentMethod == '1') { $isAlipay = true; // 订单交易号是否存在 if (!$model['AlipayTN']) { return array('error' => 2, 'msg' => '订单支付信息错误'); Yii::app()->end(); } $payment = Yii::app()->alipay; // 确认收货请求参数 $request = new AlipaySendConfirmRequest(); // $request->trade_no = $v['AlipayTN']; $request->invoice_no = $params['ShipSn']; $request->logistics_name = $params['ShipLogis']; $request->transport_type = "EXPRESS"; //建立请求 $html_text = $payment->buildRequestHttp($request); //var_dump($html_text); //解析XML //注意:该功能PHP5环境及以上支持,需开通curl、SSL等PHP配置环境。建议本地调试时使用PHP开发软件 $doc = new DOMDocument(); $doc->loadXML($html_text); if (!empty($doc->getElementsByTagName("alipay")->item(0)->nodeValue)) { $alipay = $doc->getElementsByTagName("alipay")->item(0); //echo $alipay->nodeValue; $is_success = $alipay->getElementsByTagName("is_success")->item(0)->nodeValue; if ($is_success == 'T') { $alipayResult = true; } else { $alipayResult = false; $alipayError = $alipay->getElementsByTagName("error")->item(0)->nodeValue; } } // 记录日志 $userId = Yii::app()->user->id; $payment->put_send_goods_log($model, $request->getParams(), $html_text, $alipayResult, $userId); } // 如果是支付宝,并且支付宝接口返回成功 或者 不是支付宝,保存物流信息 $bool = false; if (!$isAlipay || $isAlipay && $alipayResult) { $bool = PapOrder::model()->updateByPk($ID, array('UpdateTime' => time(), 'ShipSn' => $params['ShipSn'], 'ShipLogis' => $params['ShipLogis'])); } return array('success' => 1); }
</textarea> <span>(最多可输入100个字符)</span> </p> <p class='m-top20' id="NoResult"> <span class='f14' style='vertical-align: top;'>审核反馈:</span> <textarea rows='2' cols='50' id="noResultText" readonly><?php echo $data->NoResult; ?> </textarea><br/> </p> <br /> <?php $order = PapReturnGoods::model()->find('ReturnID=:returnID', array(':returnID' => $data['ID'])); $res = PapOrder::model()->findByPk($order['OrderID']); ?> <input type="hidden" id="pym" value="<?php echo $res['Payment']; ?> "> <?php if ($data->Type == 1) { ?> <span style="color: red">亲:注意哟!待收货( 物流代收 )订单,退货没有退款!</span> <?php } ?> <div style="clear:both"></div>
private static function sendDealerRemind($params, $model) { $set = array('DD' => 1, 'XJD' => 2, 'THD' => 3); $type = $set[$params['type']['name']]; $remindSetService = PapRemindSet::model()->find("OrganID={$params['OrganID']} and Type={$type}")->attributes; if ($remindSetService) { $exist1 = in_array($params['type']['key'], explode(',', $remindSetService['RemindItem'])); } switch ($type) { case 1: //$key值 1,2 if (!$remindSetService && is_array(Yii::app()->params['DealerRemind']['DD']['children'])) { $exist2 = array_key_exists($params['type']['key'], Yii::app()->params['DealerRemind']['DD']['children']); } break; case 2: //$key值 3 if (!$remindSetService && is_array(Yii::app()->params['DealerRemind']['XJD']['children'])) { $exist2 = array_key_exists($params['type']['key'], Yii::app()->params['DealerRemind']['XJD']['children']); } break; // case 'BJD': // //$params['HandleType'] = 3; // break; // case 'BJD': // //$params['HandleType'] = 3; // break; case 3: //$key值 4,5 if (!$remindSetService && is_array(Yii::app()->params['DealerRemind']['THD']['children'])) { $exist2 = array_key_exists($params['type']['key'], Yii::app()->params['DealerRemind']['THD']['children']); } break; } if ($exist1 || $exist2) { $params['HandleType'] = $params['type']['key']; switch ($params['HandleType']) { case '1': case '2': $model = $model ? $model : PapOrder::model()->findByPk($params['HandleID']); $params['No'] = $model['OrderSN']; $params['PromoterID'] = $model['BuyerID']; break; case '3': $model = $model ? $model : PapInquiry::model()->findByPk($params['HandleID']); $params['PromoterID'] = $model['OrganID']; $params['No'] = $model['InquirySn']; break; case '4': case '5': $model = $model ? $model : PapreturnOrder::model()->findByPk($params['HandleID']); $params['PromoterID'] = $model['ServiceID']; $params['No'] = $model['ReturnNO']; $params['THDStatus'] = $model['Status']; break; } $params['PromoterType'] = 3; $params['Method'] = $exist1 === true ? explode(',', $remindSetService['Method']) : array(1, 2); RemindService::saveRemind($params, 2); } }
public function run($args) { Yii::app()->getComponent('log'); Yii::log(date('Y-m-d H:i:s') . " [AutoEvaluation] start", 'info', 'command'); //所要执行的任务,如数据符合某条件更新,删除,修改 $Timeeva = time() - 24 * 60 * 60 * 10; //定义时间 收货15天后自动评价 //服务店评价 $model = PapOrder::model()->findAll("Status=9 and (EvaStatus = 0 or EvaStatus = 16)"); //查询符合要求的已收货订单 foreach ($model as $value) { if ($value['ReceiptTime'] < $Timeeva) { //已经收货订单执行下面代码 $modelg = PapOrderGoods::model()->findAll("OrderID=:ID", array(":ID" => $value['ID'])); //获得订单的商品 $gbool = 1; foreach ($modelg as $valueg) { //获得机构ID $goodsinfo = PapGoods::model()->find("ID=:ID", array(":ID" => $valueg['GoodsID'])); $gevaluation = new PapEvaluationGoods(); $gevaluation->OrganID = $goodsinfo->OrganID; $gevaluation->OrderID = $value['ID']; $gevaluation->GoodsID = $goodsinfo->ID; $gevaluation->BuyerID = $value['BuyerID']; $gevaluation->CreateTime = time(); $gevaluation->Status = 1; $model = $gevaluation->save(); //插入对单个商品的评价 if ($model) { $m = PapGoods::model()->findByPk($goodsinfo->ID); if ($m['CommentNo']) { PapGoods::model()->updateByPk($goodsinfo->ID, array('CommentNo' => $m['CommentNo'] + 1)); } else { PapGoods::model()->updateByPk($goodsinfo->ID, array('CommentNo' => 1)); } } else { $gbool = 0; } } $oevaluation = new PapEvaluationDealer(); $oevaluation->OrganID = $value['BuyerID']; $oevaluation->SellerID = $value['SellerID']; $ID = $oevaluation->OrderID = $value['ID']; $oevaluation->SellerBusiness = 5; $oevaluation->SellerService = 5; $oevaluation->SellerExact = 5; $oevaluation->SellerSpeed = 5; $oevaluation->ItemDescription = 5; $oevaluation->SellerPrice = 5; $oevaluation->SellerScore = 5; $oevaluation->CreateTime = time(); $obool = $oevaluation->save(); //插入对商家的评价 if ($obool && $gbool) { //评价插入成功后,修改订单的状态 if ($value['EvaStatus'] == 0) { $EvaStatus = 15; //如果该订单服务店先评价,把状态改为15 } elseif ($value['EvaStatus'] == 16) { $EvaStatus = 20; //如果该订单之前经销商评价过一次,则服务店此时评价状态改为20 } PapOrder::model()->updateByPK($ID, array('EvaStatus' => $EvaStatus)); } } } //经销商评价 $modeld = PapOrder::model()->findAll("Status=9 and (EvaStatus = 0 or EvaStatus = 15)"); //查询符合要求的已收货订单 foreach ($modeld as $value) { if ($value['ReceiptTime'] < $Timeeva) { $model = new PapEvaluationService(); $model->BuyerID = $value['BuyerID']; $ID = $model->OrderID = $value['ID']; $model->OrganID = $value['SellerID']; $model->BuyerFamily = 5; $model->BuyerAccept = 5; $model->BuyerBusiness = 5; $model->BuyerSpeed = 5; $model->BuyerCommunication = 5; $model->BuyerScore = 5; $model->CreateTime = time(); $bool = $model->insert(); if ($bool) { if ($value['EvaStatus'] == 0) { $EvaStatus = 16; //如果该订单经销商先评价,把状态改为16 } else { if ($value['EvaStatus'] == 15) { $EvaStatus = 20; //如果该订单之前服务店评价过一次,则经销商此时评价状态改为20 } } PapOrder::model()->updateByPK($ID, array('EvaStatus' => $EvaStatus)); } } } Yii::log(date('Y-m-d H:i:s') . " [AutoEvaluation] end \n", 'info', 'command'); echo date('Y-m-d H:i:s') . " [AutoEvaluation] end \n"; }
public function actionAddreturnorder2() { $goodsArr = explode(',', $_POST['Goods']); $sql = 'insert into `pap_return_goods` values'; $idStr = '('; foreach ($goodsArr as $v) { $g = explode('-', $v); $idStr .= $g[0] . ','; if (!$g[6]) { //如果该商品版本就空 $g[6] = 'NULL'; } $sql .= "(NULL,{$g['0']},{$g['1']},'ReturnID',{$g['2']},{$g['3']},{$g['4']},'',{$g['5']},{$g['6']}),"; } $idStr = substr($idStr, 0, -1) . ')'; $c = new CDbCriteria(); $c->addCondition("ID in {$idStr} and ReturnStatus=0", 'AND'); $m = PapOrder::model()->findAll($c); if (!$m) { echo json_encode(array('error' => '提交退款单失败,请先刷新订单列表!')); exit; } $model = new PapReturnOrder(); $model->ReturnNO = 'THD' . ReturnorderService::gen_order_sn(); $model->DealerID = $m[0]['SellerID']; $model->ServiceID = Commonmodel::getOrganID(); $model->Status = 11; //退款待审核 $model->CreateTime = time(); $model->Price = $_POST['Price']; $model->LogtigCompany = '顺丰'; $model->Result = $_POST['Reseaon']; $model->Type = $m[0]['Status'] == 9 ? 2 : 1; $model->ReturnNumber = 11; $model->save(); if (!$model->save()) { echo json_encode(array('error' => '提交退货单失败,请稍后再试!')); exit; } $id = $model->attributes['ID']; $editSql = "update `pap_order` set ReturnStatus=11 where ID in {$idStr}"; $sql = str_replace('ReturnID', $id, substr($sql, 0, -1)); $ins = Yii::app()->papdb->createCommand($sql)->execute(); $edt = Yii::app()->papdb->createCommand($editSql)->execute(); //发送待审核提醒给经销商 $params = array('OrganID' => $model['DealerID'], 'OrganType' => 2, 'HandleID' => $id); $params['type'] = array('name' => 'THD', 'key' => 4); RemindService::sendRemind($params); if ($ins && $edt) { echo json_encode(array('success' => 1)); } }
/** * 计算经销商推荐收益 * 每个月1号执行一次, 或者每隔1个月执行一次 * @param unknown $args */ public function run($args) { Yii::app()->getComponent('log'); Yii::log(date('Y-m-d H:i:s') . " [RecommendIncome] start", 'info', 'command'); echo date('Y-m-d H:i:s') . " [RecommendIncome] start \n"; $beginmoth = strtotime('-1 month'); $year = date('Y', $beginmoth); $month = date('m', $beginmoth); $beginmoth = date('Y-m', $beginmoth); $beginmoth = strtotime($beginmoth); $endmoth = date('Y-m'); $endmoth = strtotime($endmoth); $Time = date('Y-m', time()); $Time = strtotime($Time); Yii::log('beginmoth:' . $beginmoth, 'info', 'command'); Yii::log('beginyear:' . $year, 'info', 'command'); Yii::log('beginmoth:' . $beginmoth, 'info', 'command'); Yii::log('endmoth:' . $endmoth, 'info', 'command'); Yii::log('time:' . $Time, 'info', 'command'); $discountRate = Settings::getValue("discountRate"); //获取推荐收益参数 $criteria = new CDbCriteria(); $criteria->select = 'userID'; $criteria->distinct = true; $criteria->order = 'userID desc'; $sql_find = 'select ID from jpd_organ where Identity=2'; $dealers = Yii::app()->jpdb->createcommand($sql_find)->queryAll(); if (!empty($dealers)) { foreach ($dealers as $deakey => $deaval) { $IncomeID = ''; $exit = RecommendIncome::model()->find('OrganID=:OrganID and Month=:Month and Year=:Year', array(':OrganID' => $deaval['ID'], ':Month' => $month, ':Year' => $year)); if ($exit) { $IncomeID = $exit->ID; } else { $model = new RecommendIncome(); $model->EffectTime = time(); $model->OrganID = $deaval['ID']; $model->IsAccount = 0; $model->Month = $month; $model->Year = $year; $model->save(); $IncomeID = Yii::app()->jpdb->getLastInsertID(); } $serviceID = ''; $lastmonthtotal = 0; $Record_all = RecommendRecord::model()->findAll('DealerID=:OrganID ', array(':OrganID' => $deaval['ID'])); if ($Record_all) { foreach ($Record_all as $app2) { if (!empty($app2)) { if ($app2->ServiceID) { $serviceID[] = $app2->ServiceID; $app4 = PapOrder::model()->findAll('BuyerID=:BuyerID and Status=:Status and SellerID!=:SellerID and ReceiptTime<:endmoth and ReceiptTime>=:beginmoth', array(':BuyerID' => $app2->ServiceID, ':Status' => 9, ':SellerID' => $deaval['ID'], ':endmoth' => $endmoth, ':beginmoth' => $beginmoth)); if (!empty($app4)) { $month1 = 0; foreach ($app4 as $ke => $valu) { $discountAmount = $valu['RealPrice'] * $discountRate; // $payAmount = is_float($discountAmount) ? substr_replace($discountAmount, '', strpos($discountAmount, '.') + 3) : $discountAmount . '.00'; $payAmount = round($discountAmount, 2); $month1 += $payAmount; $lastmonthtotal += $payAmount; } $detail = RecommendIncomeDetail::model()->find("OrganID=:OrganID and ServiceID=:ServiceID and incomeID=:incomeID", array(':OrganID' => $deaval['ID'], ":ServiceID" => $app2->ServiceID, ':incomeID' => $IncomeID)); if (!empty($detail)) { RecommendIncomeDetail::model()->updateByPK($detail->ID, array('income' => $month1)); } else { $income = new RecommendIncomeDetail(); $income->RecomID = $app2->RecomID; $income->RecomTime = time(); // $income->IncomeAccount = 0; $income->IncomeTime = time(); $income->isAccount = 0; $income->BeFormalTime = 0; $income->income = $month1; $income->OrganID = $deaval['ID']; $income->ServiceID = $app2->ServiceID; $income->incomeID = $IncomeID; $income->save(); } } } } } } $criteria = new CDbCriteria(); $criteria->select = 'BuyerID'; $criteria->distinct = true; $criteria->addCondition('Status=9'); $criteria->addCondition("ReceiptTime<" . $endmoth); $criteria->addCondition("ReceiptTime>=" . $beginmoth); $criteria->addCondition("SellerID=" . $deaval['ID']); if (!empty($serviceID)) { $criteria->addNotInCondition('BuyerID', $serviceID); } $criteria->order = 'BuyerID desc'; $payservicers = PapOrder::model()->findAll($criteria); if (!empty($payservicers)) { foreach ($payservicers as $paykey => $payval) { $record = RecommendRecord::model()->find('ServiceID=:ServiceID', array(":ServiceID" => $payval->BuyerID)); if (!empty($record)) { $month2 = 0; $paysers = PapOrder::model()->findAll('BuyerID=:BuyerID and Status=:Status and SellerID=:SellerID and ReceiptTime<:endmoth and ReceiptTime>=:beginmonth', array(':BuyerID' => $payval->BuyerID, ':Status' => 9, ':SellerID' => $deaval['ID'], ':endmoth' => $endmoth, ':beginmonth' => $beginmoth)); foreach ($paysers as $Skey => $Sval) { $discountAmount = $Sval['RealPrice'] * $discountRate; // $payAmount = is_float($discountAmount) ? substr_replace($discountAmount, '', strpos($discountAmount, '.') + 3) : $discountAmount . '.00'; $payAmount = round($discountAmount, 2); $month2 -= $payAmount; $lastmonthtotal -= $payAmount; } $detail = RecommendIncomeDetail::model()->find("OrganID=:OrganID and ServiceID=:ServiceID and incomeID=:incomeID", array(':OrganID' => $deaval['ID'], ":ServiceID" => $payval->BuyerID, ':incomeID' => $IncomeID)); if (!empty($detail)) { RecommendIncomeDetail::model()->updateByPK($detail->ID, array('income' => $month2)); } else { $income = new RecommendIncomeDetail(); $income->RecomID = $record->RecomID; $income->RecomTime = time(); $income->IncomeTime = time(); $income->isAccount = 0; $income->BeFormalTime = 0; $income->income = $month2; $income->OrganID = $deaval['ID']; $income->ServiceID = $payval->BuyerID; $income->incomeID = $IncomeID; $income->save(); } } } } RecommendIncome::model()->updateByPK($IncomeID, array('MonthIncome' => $lastmonthtotal)); } } Yii::log(date('Y-m-d H:i:s') . " [RecommendIncome] end \n", 'info', 'command'); echo date('Y-m-d H:i:s') . " [RecommendIncome] end \n"; }
/** * 响应嘉配订单支付通知 * * @author Garbin * @param int $order_id * @param array $notify_result * @return bool */ public static function respondNotify($order_id, $notify_result) { $where = "ID = {$order_id}"; //$data = array('RefundStatus' => $notify_result['trade_status']); // $orderdata=array('ReturnStatus'=>'1','Status' => $notify_result['target']); switch ($notify_result['target']) { case RORDER_READY: $where .= ' AND Status <= ' . RORDER_PENDING; $data['AlipayTN'] = $notify_result['trade_no']; $data['Status'] = RORDER_READY; break; case RORDER_PENDING: // 付款, 待发货 $where .= ' AND Status <= ' . RORDER_PENDING; $data['AlipayTN'] = $notify_result['trade_no']; $data['Status'] = RORDER_PENDING; $data['CreateTime'] = time(); //更改提醒状态为已操作 $returninfo = PapReturnOrder::model()->findByPk($order_id); RemindService::updateRemindStatus($order_id, 4, $returninfo['DealerID']); //发送待发货提醒给修理厂 $params = array('OrganID' => $returninfo['ServiceID'], 'OrganType' => 3, 'HandleID' => $order_id); $params['type'] = array('name' => 'THD', 'key' => 5); RemindService::sendRemind($params, $returninfo); break; case RORDER_ACCEPTED: // 待收货 $where .= ' AND Status <= ' . RORDER_ACCEPTED; $where .= ' AND Status >= ' . RORDER_PENDING; $data['Status'] = RORDER_ACCEPTED; $data['DeliveryTime'] = time(); break; case RORDER_ABNORMAL: //已收货,完成 $where .= ' AND Status <= ' . RORDER_ABNORMAL; $where .= ' AND Status >= ' . RORDER_ACCEPTED; $data['Status'] = RORDER_ABNORMAL; $return = PapReturnGoods::model()->find('ReturnID=:returnID', array(':returnID' => $order_id)); if ($return) { $orderID = $return['OrderID']; if ($orderID) { $wheres = "ID = {$orderID}"; PapOrder::model()->updateAll(array('ReturnStatus' => 4), $wheres); } } break; // case RORDER_READY_PAYPAL://退款 待付款 // $where .= ' AND Status = ' . RORDER_READY_PAYPA; // $data['Status']=RORDER_READY_PAYPAL; // break; // case RORDER_PAYPAL_FINISHED://退款完成 // $where .= ' AND Status =' .RORDER_PAYPAL_FINISHED; // $data['Status']=RORDER_PAYPAL_FINISHED; // break; } //PapReturnOrder::model()->updateByPk($order_id,$data) //PapReturnOrder::model()->updateAll($data, $where) if (PapReturnOrder::model()->updateAll($data, $where)) { return true; } else { return false; } }
</ul> <?php } ?> </div> </div> <!--满意度评价--> <p class="txxx bor_back m-top10">满意度评价</p> <div class="bor_back "> <div class="satisfied "> <div class="jg-info float_l"> <div class="triangle-border2 tb-border2"></div> <div class="triangle-border2 tb-background2"></div> <div style="padding:35px 20px"> <?php $OrderInfo = PapOrder::model()->findByPK($OrderID); $OrganInfo = Organ::model()->findByPk($OrderInfo['SellerID']); $OrganPhoto = OrganPhoto::model()->find("OrganID =:organID", array(':organID' => $OrganInfo['ID'])); $xylevel = EvaluateService::getpets($OrganInfo['Grade']); if (empty($xylevel) || !$xylevel[0] || !$xylevel[1]) { $xylvstr = "<div class='xy-div' title='积分过低'><i class='seller-level0'></i></div>"; } else { $xylvstr = '<div class = "xy-div" title = "积分:' . $OrganInfo['Grade'] . '">' . str_repeat("<i class='seller-level" . $xylevel[0] . "'></i>", $xylevel[1]) . '</div>'; } ?> <div class="eav-jg-img float_l"><img src="<?php echo F::uploadUrl() . $OrganPhoto['Path']; ?> "></div> <div class="eav-jg-info float_l"> <p><b><?php
public function actionGetaccount() { $orderid = Yii::app()->request->getParam('orderid'); $order = PapOrder::model()->findByPk($orderid)->attributes; //获取卖家支付宝帐号 // $paypal = JpdFinancialPaypal::model()->find('OrganID=:ID ', array(':ID' => $order['SellerID'])); $account = JpdFinancialPaypal::model()->find('OrganID=:organID and Status=:stu', array(':organID' => $order['SellerID'], ':stu' => 0)); if (isset($account['PaypalAccount']) && !empty($account['PaypalAccount'])) { PapOrder::model()->UpdateByPk($orderid, array('AlipayTN' => 1)); echo json_encode(array('success' => 1)); } else { $message = $order['SellerName'] . ' ,还未设置收款支付宝帐号,暂时不能支付'; echo json_encode(array('failed' => $message)); } }
public static function changeOrder($params) { $ID = $params['ID']; $idArr = explode(',', $params['idArr']); $amountArr = explode(',', $params['amountArr']); $payment = $params['payment']; $ProPrice = explode(',', $params['ProPrice']); $criteria = new CDbCriteria(); $organID = Yii::app()->user->getOrganID(); $criteria->condition = "t.BuyerID={$organID} and t.IsDelete=0 and ((t.Payment=1 and t.Status=1 and ISNULL(t.AlipayTN)) or (t.Payment=2 and t.Status=2))"; $order = PapOrder::model()->findByPk($ID, $criteria); if ($payment == 1) { $status = 1; } elseif ($payment == 2) { $status = 2; } if (!$payment) { return array('error' => 1, 'msg' => '修改失败,请稍后再试!'); } //订单是否存在 if (!$order) { return array('error' => 1, 'msg' => '改价失败,请稍后再试!'); } //商品数量是否合理 foreach ($idArr as $k => $v) { if (!is_int(intval($amountArr[$k])) || $amountArr[$k] < 0) { return array('error' => 2, 'msg' => '改价失败,请稍后再试!'); } $orderGoods[$k] = PapOrderGoods::model()->findByPk($v, array('condition' => "OrderID={$ID}"))->attributes; if (!$orderGoods[$k]) { return array('error' => 3, 'msg' => '改价失败,请稍后再试!'); } } //订单商品价格修改 $sum = 0; //$discount = number_format(($order['RealPrice'] - $order['ShipCost']) / $order['GoodsAmount'], 4); // $discount = $order['Discount'] ? $order['Discount'] : "100%"; foreach ($orderGoods as $k => $v) { if ($amountArr[$k] == 0) { PapOrderGoods::model()->updateByPk($idArr[$k], array('IsDelete' => 1, 'UpdateTime' => time()), "Quantity!={$amountArr[$k]} OR ProPrice!={$ProPrice[$k]}"); } else { $goods = $ProPrice[$k] * $amountArr[$k]; PapOrderGoods::model()->updateByPk($idArr[$k], array('Quantity' => $amountArr[$k], 'ProPrice' => $ProPrice[$k], 'GoodsAmount' => $goods, 'UpdateTime' => time()), "Quantity!={$amountArr[$k]} OR ProPrice!={$ProPrice[$k]}"); $sum += $goods; } } //return $discount; // $real = sprintf("%.2f", $sum * $discount / 100) + $order['ShipCost']; $real = $sum + $order['ShipCost']; $RealPrice = $real >= 0.01 ? $real : 0.01; PapOrder::model()->updateByPk($ID, array('GoodsAmount' => $sum, 'TotalAmount' => $RealPrice, 'RealPrice' => $RealPrice, 'UpdateTime' => time(), 'Payment' => $payment, 'Status' => $status)); return array('success' => 1); }
public function actionHiderecord() { $organID = Commonmodel::getOrganID(); $sql = "select * from pap_inquiry a" . " where a.Status=0 and a.DealerID like '%,{$organID},%' "; $result = Yii::app()->papdb->createCommand($sql)->queryAll(); $quotions = count($result); //$waitpay= PapOrder::model()->count('Status=1 and SellerID ='.$organID); $Shipping = PapOrder::model()->count(array('condition' => "Status = 2 and SellerID = {$organID}")); $Abnormal = PapOrder::model()->count(array('condition' => " IsUnusual != 0 and Status =9 and SellerID = {$organID}")); //待付款的订单 //$waitpay= PapOrder::model()->count('Status=1 and SellerID ='.$organID); //待买家收货的订单 //$buyerwaitreceipt= PapOrder::model()->count('Status=3 and SellerID ='.$organID); //待同意退货的订单 $waitcheckreturn = PapOrder::model()->count('Status=11 and SellerID =' . $organID); //待买家退货的订单 //$waitreturn= PapOrder::model()->count('Status=12 and SellerID ='.$organID); //退货待收货 $sellerwaitreceipt = PapOrder::model()->count('Status=13 and SellerID =' . $organID); //待审核的退货单 $returnaudit = OrderreturnService::papreturnstatus('1'); // echo json_encode(array('quotions'=>$quotions,'shipping'=>$Shipping,'abnormal'=>$Abnormal,'waitpay'=>$waitpay, // 'buyerwaitreceipt'=>$buyerwaitreceipt,'waitcheckreturn'=>$waitcheckreturn,'waitreturn'=>$waitreturn, // 'sellerwaitreceipt'=>$sellerwaitreceipt)); echo json_encode(array('quotions' => $quotions, 'shipping' => $Shipping, 'abnormal' => $Abnormal, 'waitcheckreturn' => $waitcheckreturn, 'sellerwaitreceipt' => $sellerwaitreceipt, 'returnaudit' => $returnaudit)); }
public function actionPayConfirm() { $id = Yii::app()->request->getParam('id'); $tradeNo = PapOrder::model()->findByPK($id)->attributes['AlipayTN']; header("location:https://lab.alipay.com/consume/queryTradeDetail.htm?tradeNo={$tradeNo}"); }
text-align: left; line-height: 30px; margin-left: 20px; white-space: nowrap; } </style> <?php $this->breadcrumbs = array('销售管理' => Yii::app()->createUrl('common/saleslist'), '订单发货'); ?> <div class="bor_back m-top"> <div class="txxx txxx2"> 第一步 确认订单信息 </div> <?php $buyer = PapOrder::model()->findByPk($ID[0], array('select' => 'BuyerID,BuyerName'))->attributes; $addr = SellerorderService::getSellerOrgan($buyer['BuyerID']); ?> <ul class="mjxx m-top" style="height:40px"> <li>机构名称:<span><?php echo $addr['OrganName'] ? $addr['OrganName'] : $buyer['BuyerName']; ?> </span></li> <li>联系电话:<span><?php echo $addr['phone']; ?> </span></li> <li>城市:<span><?php echo $addr['citys']; ?> </span></li>
public static function gen_order_sn() { /* 选择一个随机的方案 */ mt_srand((double) microtime() * 1000000); $timestamp = time() - date('Z'); $y = date('y', $timestamp); $z = date('z', $timestamp); $order_sn = $y . str_pad($z, 3, '0', STR_PAD_LEFT) . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT); $orders = PapOrder::model()->find('OrderSN=' . $order_sn); if (empty($orders)) { /* 否则就使用这个订单号 */ return $order_sn; } /* 如果有重复的,则重新生成 */ return $this->gen_order_sn(); }
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 function actionReturnposts() { $this->pageTitle = Yii::app()->name . '-' . "付款"; $returnID = $_GET['returnID']; if ($returnID) { $lists[] = 1; $model = PapReturnOrder::model()->updateBypk($returnID, array('Status' => 4, 'PayMethod' => 2)); if ($model) { $list = PapReturnGoods::model()->findAll("ReturnID=:ID", array(":ID" => $returnID)); foreach ($list as $v) { if (!in_array($v['OrderID'], $lists)) { $model = PapOrder::model()->updateByPk($v['OrderID'], array("ReturnStatus" => 4)); $lists[] = $v['OrderID']; } } //更改待审核提醒为已操作 RemindService::updateRemindStatus($returnID, 4); } $this->redirect(array('Index')); } else { throw new CHttpException(404, '页面不存在'); } }
public static function getOrderSN($id, $type = '') { $ordersn = PapOrder::model()->findByPk($id, array('select' => 'OrderSN'))->attributes['OrderSN']; if ($type == 2) { return "<a href='" . Yii::app()->createUrl('pap/orderreview/detail', array('orderid' => $id)) . "' target='_blank'>{$ordersn}</a>"; } else { return "<a href='" . Yii::app()->createUrl('pap/sellerorder/detail', array('ID' => $id)) . "' target='_blank'>{$ordersn}</a>"; } }