|
|
|
@ -131,20 +131,6 @@ class InsurerController extends BaseController |
|
|
|
|
if($order_info->non_id){ |
|
|
|
|
$nonitems=NonAutoInsurance::findOne(['id'=>$order_info->non_id]); |
|
|
|
|
} |
|
|
|
|
// dd($order_info->non_id); |
|
|
|
|
//快递 |
|
|
|
|
// dd($car_info->id); |
|
|
|
|
// $ems_items = EmsT::find() |
|
|
|
|
// ->where(['car_id'=>$car_info->id,'order_id'=>$order_info->id]) |
|
|
|
|
// ->orderBy('id ASC') |
|
|
|
|
// ->all(); |
|
|
|
|
// $ems_items1=(object)array(); |
|
|
|
|
// if(!$ems_items){ |
|
|
|
|
// $ems_items1 = ExpressT::find() |
|
|
|
|
// ->where(['car_id'=>$car_info->id,'order_id'=>$order_info->id]) |
|
|
|
|
// ->orderBy('id ASC') |
|
|
|
|
// ->all(); |
|
|
|
|
// } |
|
|
|
|
//礼品 |
|
|
|
|
$gift_free_group_items = GiftGroupT::find() |
|
|
|
|
->where('is_free=1') |
|
|
|
@ -177,8 +163,6 @@ class InsurerController extends BaseController |
|
|
|
|
return $this->render('info',[ |
|
|
|
|
'order_info'=>$order_info, |
|
|
|
|
'car_info'=>$car_info, |
|
|
|
|
// 'ems_items' => $ems_items, |
|
|
|
|
// 'ems_items1' => $ems_items1, |
|
|
|
|
'money_man' => $money_man, |
|
|
|
|
'money_no' => $money_no, |
|
|
|
|
'money_bank' => $money_bank, |
|
|
|
@ -2381,8 +2365,10 @@ class InsurerController extends BaseController |
|
|
|
|
$limit = $request->get('limit', 10); |
|
|
|
|
|
|
|
|
|
$query = OrderT::find() |
|
|
|
|
->where('status_id>1') |
|
|
|
|
->orderBy('car_no desc,submit_date asc'); |
|
|
|
|
->orderBy('status_id desc,car_no desc,submit_date asc'); |
|
|
|
|
if($this->my->id > 2){ |
|
|
|
|
$query->andWhere('status_id>1'); |
|
|
|
|
} |
|
|
|
|
if($id_man != '') { |
|
|
|
|
$query->andWhere(['like','id_man',$id_man]); |
|
|
|
|
} |
|
|
|
@ -2413,14 +2399,12 @@ class InsurerController extends BaseController |
|
|
|
|
if($date3_end != '') { |
|
|
|
|
$query->andWhere('insurer1_begin_date<=:end_date or insurer2_begin_date<=:end_date', [':end_date'=>$date3_end]); |
|
|
|
|
} |
|
|
|
|
if($status > 0) { |
|
|
|
|
if($status == 1) { |
|
|
|
|
$query->andWhere('status_id>1 and status_id<10'); |
|
|
|
|
} |
|
|
|
|
if($status == 2) { |
|
|
|
|
$query->andWhere('status_id=10'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$total = $query->count(); |
|
|
|
|
|
|
|
|
|
$query->offset($offset)->limit($limit); |
|
|
|
@ -3503,17 +3487,33 @@ class InsurerController extends BaseController |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 礼品状态回退 |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
public function actionGiftCancel() |
|
|
|
|
{ |
|
|
|
|
Yii::$app->response->format = Response::FORMAT_JSON; |
|
|
|
|
|
|
|
|
|
$request = Yii::$app->request; |
|
|
|
|
$result = array(); |
|
|
|
|
$result['success'] = false; |
|
|
|
|
$result['msg'] = '保存失败'; |
|
|
|
|
|
|
|
|
|
if ($request->isPost && $this->my->id == 1) { |
|
|
|
|
$id = $request->post('order_id', 0); |
|
|
|
|
$id = $request->post('order_id'); |
|
|
|
|
$msg= $request->post('return_msg'); |
|
|
|
|
$result = array('success'=>false,'msg'=>'操作成功'); |
|
|
|
|
if(!$request->isPost){ |
|
|
|
|
$result['msg'] = '请求方式错误'; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
if(!$this->my->id == 1){ |
|
|
|
|
$result['msg'] = '无此操作权限'; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
if ($id < 0) { |
|
|
|
|
$result['msg'] = '订单ID无效'; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
if ($msg == '') { |
|
|
|
|
$result['msg'] = '退单理由必须'; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$order_info = OrderT::findOne($id); |
|
|
|
|
if (!$order_info) { |
|
|
|
@ -3526,20 +3526,19 @@ class InsurerController extends BaseController |
|
|
|
|
// 删除礼品/券库信息 |
|
|
|
|
GiftTicketTUse::deleteAll('order_id=' . $order_info->id); |
|
|
|
|
// 修改订单礼品/券信息 |
|
|
|
|
OrderGiftT::updateAll(['gift_src'=>''],['order_id'=>$order_info->id]); |
|
|
|
|
OrderGiftT::updateAll(['gift_src' => ''], ['order_id' => $order_info->id]); |
|
|
|
|
// 修改订单状态 |
|
|
|
|
$order_info->gift_status = 0; |
|
|
|
|
$order_info->save(); |
|
|
|
|
$result['success'] = true; |
|
|
|
|
$result['msg'] = '保存成功'; |
|
|
|
|
$this->addLog($order_info->car_id, '回退礼品状态,理由:' . $msg, 1); |
|
|
|
|
$tran->commit(); |
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
$tran->rollBack(); |
|
|
|
|
$result['msg'] = '订单不存在'; |
|
|
|
|
$result['msg'] = $e->getMessage(); |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
$result['msg'] = '当前用户无此权限'; |
|
|
|
|
} |
|
|
|
|
$result['success'] = true; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -3681,4 +3680,95 @@ class InsurerController extends BaseController |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 退单操作(超管权限任意状态退单) |
|
|
|
|
* @return array |
|
|
|
|
* @throws \Exception |
|
|
|
|
*/ |
|
|
|
|
public function actionSupperReturn() |
|
|
|
|
{ |
|
|
|
|
Yii::$app->response->format = Response::FORMAT_JSON; |
|
|
|
|
$request = Yii::$app->request; |
|
|
|
|
$result = array(); |
|
|
|
|
$result['success'] = false; |
|
|
|
|
$result['msg'] = '操作失败'; |
|
|
|
|
if($request->isPost) { |
|
|
|
|
$order_id = $request->post('order_id',0); |
|
|
|
|
$return_remark = $request->post('return_remark'); |
|
|
|
|
if ($order_id < 0) { |
|
|
|
|
$result['msg'] = '订单ID无效'; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
if($return_remark == ''){ |
|
|
|
|
$result['msg'] = '请填写退单理由!'; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$order_info = OrderT::findOne(['id'=>$order_id]); |
|
|
|
|
if(empty($order_info)) { |
|
|
|
|
$result['msg'] = '保单信息不存在!'; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 订单信息更新 |
|
|
|
|
$order_info->return_status_id = $order_info->status_id; |
|
|
|
|
$order_info->lock_id = 0; |
|
|
|
|
$order_info->status_id = 1; |
|
|
|
|
$order_info->return_remark = $return_remark; |
|
|
|
|
$order_info->return_time = time(); |
|
|
|
|
$order_info->insurer1_no = ''; |
|
|
|
|
$order_info->insurer2_no = ''; |
|
|
|
|
$order_info->shangye_src = ''; |
|
|
|
|
$order_info->jiaoqiang_src = ''; |
|
|
|
|
$order_info->fapiao_src = ''; |
|
|
|
|
$order_info->jq_fapiao_src = ''; |
|
|
|
|
$order_info->upload_status = 1; |
|
|
|
|
$order_info->payee_id = ''; |
|
|
|
|
$order_info->payment_id = ''; |
|
|
|
|
$order_info->payer = ''; |
|
|
|
|
$order_info->gift_status = 0; |
|
|
|
|
// 车辆信息处理 |
|
|
|
|
if ($order_info->car->op2_id > 0) { //续保 |
|
|
|
|
$order_info->car->location = 4; |
|
|
|
|
}else { |
|
|
|
|
$order_info->car->location = 2; |
|
|
|
|
$order_info->car->is_xubao = 0; |
|
|
|
|
} |
|
|
|
|
$order_info->car->user_id = $order_info->user_id; |
|
|
|
|
|
|
|
|
|
$tran = OrderT::getDb()->beginTransaction(); |
|
|
|
|
try { |
|
|
|
|
// 财务处理 |
|
|
|
|
CaiwuT::deleteAll(['order_id'=>$order_info->id]); |
|
|
|
|
OrderCaiwuT::deleteAll(['order_id'=>$order_info->id]); |
|
|
|
|
OrderUserT::deleteAll(['order_id'=>$order_info->id]); |
|
|
|
|
|
|
|
|
|
// 车辆信息 |
|
|
|
|
CarCT::deleteAll(['id' => $order_info->car_id]); |
|
|
|
|
if($order_info->car->op2_id > 0){ |
|
|
|
|
$car_db_info = new CarDT(false); |
|
|
|
|
}else { |
|
|
|
|
$car_db_info = new CarBT(false); |
|
|
|
|
} |
|
|
|
|
$car_db_info->id = $order_info->car_id; |
|
|
|
|
$car_db_info->user_id = $order_info->user_id; |
|
|
|
|
|
|
|
|
|
// 礼品状态回退 |
|
|
|
|
GiftTicketTUse::deleteAll('order_id=' . $order_info->id); |
|
|
|
|
OrderGiftT::updateAll(['gift_src' => ''], ['order_id' => $order_info->id]); |
|
|
|
|
|
|
|
|
|
$this->addLog($order_info->car_id,'超管退单,理由是:'.$return_remark,1); |
|
|
|
|
$car_db_info->save(); |
|
|
|
|
$order_info->car->save(); |
|
|
|
|
$order_info->save(); |
|
|
|
|
$tran->commit(); |
|
|
|
|
$result['success'] = true; |
|
|
|
|
$result['msg'] = '操作成功'; |
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
$tran->rollBack(); |
|
|
|
|
$result['msg'] = '操作失败,' . $e->getMessage(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
} |