Example #1
0
 /**
  * 经销商物流退款-未收货
  */
 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, '页面不存在');
     }
 }
Example #2
0
    echo $count > 1 ? $count * 135 + 1 : $count * 135;
    ?>
px;min-height:135px">
                <div class="goods_show1 float_l">
                    <div class="zwq_color m_top20">¥<?php 
    echo $data->RealPrice;
    ?>
</div>
                </div>
                 <?php 
    $return = PapReturnGoods::model()->findAll('OrderID=:orderid', array(':orderid' => $data['ID']));
    foreach ($return as $key => $value) {
        $return['ReturnID'] = $value['ReturnID'];
    }
    if ($return) {
        $returnorder = PapReturnOrder::model()->findByPk($return['ReturnID']);
    }
    ?>
                <div class="goods_show2 float_l">
                    <div class="m-top5">
                        <div>
                            <?php 
    if ($data->Payment == 1) {
        ?>
                                支付宝担保
                            <?php 
    } elseif ($data->Payment == 2) {
        ?>
                                物流代收款
                            <?php 
    }
Example #3
0
 /**
  *    响应嘉配订单支付通知
  *
  *    @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;
     }
 }
Example #4
0
 public function actionPayConfirmreturn()
 {
     $id = Yii::app()->request->getParam('id');
     $tradeNo = PapReturnOrder::model()->findByPK($id)->attributes['AlipayTN'];
     header("location:https://lab.alipay.com/consume/queryTradeDetail.htm?tradeNo={$tradeNo}");
 }
Example #5
0
 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));
     }
 }
Example #6
0
 public static function papgetComplainStatus($ComplainStatus)
 {
     $organID = Yii::app()->user->getOrganID();
     $criteria = new CDbCriteria();
     $criteria->addCondition(" t.ServiceID = " . $organID, "AND");
     $criteria->addCondition(" t.ComplainStatus = " . $ComplainStatus, "AND");
     $count = PapReturnOrder::model()->count($criteria);
     return $count;
 }