|
|
@ -131,20 +131,6 @@ class InsurerController extends BaseController |
|
|
|
if($order_info->non_id){ |
|
|
|
if($order_info->non_id){ |
|
|
|
$nonitems=NonAutoInsurance::findOne(['id'=>$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() |
|
|
|
$gift_free_group_items = GiftGroupT::find() |
|
|
|
->where('is_free=1') |
|
|
|
->where('is_free=1') |
|
|
@ -177,8 +163,6 @@ class InsurerController extends BaseController |
|
|
|
return $this->render('info',[ |
|
|
|
return $this->render('info',[ |
|
|
|
'order_info'=>$order_info, |
|
|
|
'order_info'=>$order_info, |
|
|
|
'car_info'=>$car_info, |
|
|
|
'car_info'=>$car_info, |
|
|
|
// 'ems_items' => $ems_items, |
|
|
|
|
|
|
|
// 'ems_items1' => $ems_items1, |
|
|
|
|
|
|
|
'money_man' => $money_man, |
|
|
|
'money_man' => $money_man, |
|
|
|
'money_no' => $money_no, |
|
|
|
'money_no' => $money_no, |
|
|
|
'money_bank' => $money_bank, |
|
|
|
'money_bank' => $money_bank, |
|
|
@ -2381,8 +2365,8 @@ class InsurerController extends BaseController |
|
|
|
$limit = $request->get('limit', 10); |
|
|
|
$limit = $request->get('limit', 10); |
|
|
|
|
|
|
|
|
|
|
|
$query = OrderT::find() |
|
|
|
$query = OrderT::find() |
|
|
|
->where('status_id>1') |
|
|
|
->andWhere('status_id>1') |
|
|
|
->orderBy('car_no desc,submit_date asc'); |
|
|
|
->orderBy('status_id desc,car_no desc,submit_date asc'); |
|
|
|
if($id_man != '') { |
|
|
|
if($id_man != '') { |
|
|
|
$query->andWhere(['like','id_man',$id_man]); |
|
|
|
$query->andWhere(['like','id_man',$id_man]); |
|
|
|
} |
|
|
|
} |
|
|
@ -2413,14 +2397,12 @@ class InsurerController extends BaseController |
|
|
|
if($date3_end != '') { |
|
|
|
if($date3_end != '') { |
|
|
|
$query->andWhere('insurer1_begin_date<=:end_date or insurer2_begin_date<=:end_date', [':end_date'=>$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) { |
|
|
|
if($status == 1) { |
|
|
|
$query->andWhere('status_id>1 and status_id<10'); |
|
|
|
$query->andWhere('status_id>1 and status_id<10'); |
|
|
|
} |
|
|
|
} |
|
|
|
if($status == 2) { |
|
|
|
if($status == 2) { |
|
|
|
$query->andWhere('status_id=10'); |
|
|
|
$query->andWhere('status_id=10'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$total = $query->count(); |
|
|
|
$total = $query->count(); |
|
|
|
|
|
|
|
|
|
|
|
$query->offset($offset)->limit($limit); |
|
|
|
$query->offset($offset)->limit($limit); |
|
|
@ -3503,17 +3485,33 @@ class InsurerController extends BaseController |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 礼品状态回退 |
|
|
|
|
|
|
|
* @return array |
|
|
|
|
|
|
|
*/ |
|
|
|
public function actionGiftCancel() |
|
|
|
public function actionGiftCancel() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Yii::$app->response->format = Response::FORMAT_JSON; |
|
|
|
Yii::$app->response->format = Response::FORMAT_JSON; |
|
|
|
|
|
|
|
|
|
|
|
$request = Yii::$app->request; |
|
|
|
$request = Yii::$app->request; |
|
|
|
$result = array(); |
|
|
|
$id = $request->post('order_id'); |
|
|
|
$result['success'] = false; |
|
|
|
$msg= $request->post('return_msg'); |
|
|
|
$result['msg'] = '保存失败'; |
|
|
|
$result = array('success'=>false,'msg'=>'操作成功'); |
|
|
|
|
|
|
|
if(!$request->isPost){ |
|
|
|
if ($request->isPost && $this->my->id == 1) { |
|
|
|
$result['msg'] = '请求方式错误'; |
|
|
|
$id = $request->post('order_id', 0); |
|
|
|
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); |
|
|
|
$order_info = OrderT::findOne($id); |
|
|
|
if (!$order_info) { |
|
|
|
if (!$order_info) { |
|
|
@ -3526,20 +3524,19 @@ class InsurerController extends BaseController |
|
|
|
// 删除礼品/券库信息 |
|
|
|
// 删除礼品/券库信息 |
|
|
|
GiftTicketTUse::deleteAll('order_id=' . $order_info->id); |
|
|
|
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->gift_status = 0; |
|
|
|
$order_info->save(); |
|
|
|
$order_info->save(); |
|
|
|
$result['success'] = true; |
|
|
|
$this->addLog($order_info->car_id, '回退礼品状态,理由:' . $msg, 1); |
|
|
|
$result['msg'] = '保存成功'; |
|
|
|
|
|
|
|
$tran->commit(); |
|
|
|
$tran->commit(); |
|
|
|
} catch (\Exception $e) { |
|
|
|
} catch (\Exception $e) { |
|
|
|
$tran->rollBack(); |
|
|
|
$tran->rollBack(); |
|
|
|
|
|
|
|
$result['msg'] = '订单不存在'; |
|
|
|
$result['msg'] = $e->getMessage(); |
|
|
|
$result['msg'] = $e->getMessage(); |
|
|
|
|
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
$result['success'] = true; |
|
|
|
$result['msg'] = '当前用户无此权限'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -3681,4 +3678,89 @@ 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->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 && $order_info->car->location != 4){ |
|
|
|
|
|
|
|
$car_db_info = new CarDT(false); |
|
|
|
|
|
|
|
$car_db_info->id = $order_info->car_id; |
|
|
|
|
|
|
|
$car_db_info->user_id = $order_info->user_id; |
|
|
|
|
|
|
|
$order_info->car->save(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(!$order_info->car->op2_id && $order_info->car->location != 2){ |
|
|
|
|
|
|
|
$car_db_info = new CarBT(false); |
|
|
|
|
|
|
|
$car_db_info->id = $order_info->car_id; |
|
|
|
|
|
|
|
$car_db_info->user_id = $order_info->user_id; |
|
|
|
|
|
|
|
$order_info->car->save(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 礼品状态回退 |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
$order_info->save(); |
|
|
|
|
|
|
|
$tran->commit(); |
|
|
|
|
|
|
|
$result['success'] = true; |
|
|
|
|
|
|
|
$result['msg'] = '操作成功'; |
|
|
|
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
|
|
|
$tran->rollBack(); |
|
|
|
|
|
|
|
$result['msg'] = '操作失败,' . $e->getMessage(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |