Merge branch 'dev' into wanfang

dev
曾超新 5 years ago
commit 171e642ff9
  1. 7
      frontend/controllers/CarController.php
  2. 1
      frontend/controllers/FinanceController.php
  3. 148
      frontend/controllers/InsurerController.php
  4. 44
      frontend/views/insurer/info.php
  5. 14
      frontend/views/insurer/my-list-info.php
  6. 6
      frontend/views/insurer/office-mng-edit.php
  7. 4
      frontend/views/insurer/original-mng-edit.php

@ -1879,15 +1879,8 @@ class CarController extends BaseController
$order_info->link_man_number = $link_man_number; $order_info->link_man_number = $link_man_number;
$order_info->company_id = $company_id; $order_info->company_id = $company_id;
if($order_info->status_id != $status_id) {
if($order_info->return_status_id > 0) {
$order_info->status_id = $order_info->return_status_id;
$order_info->return_status_id = 0;
} else {
$order_info->status_id = $status_id; $order_info->status_id = $status_id;
$order_info->return_status_id = 0; $order_info->return_status_id = 0;
}
}
$order_info->submit_date = date('Y-m-d'); $order_info->submit_date = date('Y-m-d');
//商业保险日期 //商业保险日期
$order_info->insurer1_begin_date = $insurer1_begin_date; $order_info->insurer1_begin_date = $insurer1_begin_date;

@ -6725,7 +6725,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
} }
} }
$query = CaiwuT::find() $query = CaiwuT::find()
->leftJoin(OrderT::tableName(), "order_t.id=caiwu_t.order_id") ->leftJoin(OrderT::tableName(), "order_t.id=caiwu_t.order_id")
->where('order_t.status_id>1') ->where('order_t.status_id>1')

@ -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;
}
} }

@ -234,9 +234,9 @@ use common\models\PriceT;
<tr> <tr>
<th class="bg-warning">送单地址</th> <th class="bg-warning">送单地址</th>
<td colspan="5" class="form-inline"> <td colspan="5" class="form-inline">
<?=$order_info->sendCity->name?> <label><?=$order_info->sendCity?$order_info->sendCity->name:''?></label>
<?=$order_info->sendDistrict->name?> <label><?=$order_info->sendDistrict?$order_info->sendDistrict->name:''?></label>
<?=$order_info->send_address?> <label><?=$order_info->send_address?></label>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -267,7 +267,15 @@ use common\models\PriceT;
</table> </table>
</div> </div>
</div> </div>
<?php if($uid < 2 && $order_info->status_id > 1) {?>
<div class="ibox float-e-margins">
<div class="col-sm-5 col-sm-offset-4">
<button type="button" class="btn btn-primary btn-return" type="button">
<strong>退单</strong>
</button>
</div>
</div>
<?php }?>
</form> </form>
</div> </div>
@ -332,23 +340,27 @@ use common\models\PriceT;
$(function() { $(function() {
searchOps(); searchOps();
searchGifts(); searchGifts();
<?php if($uid < 2 && $order_info->status_id > 1) {?>
layer.config({extend: 'extend/layer.ext.js'});
$('.btn-return').click(function(){ $('.btn-return').click(function(){
var remark = $('#return_remark').val(); layer.prompt({
if(remark === '') { formType: 2,
parent.layer.msg('请输入退回理由'); title: '退单理由',
return; }, function(value, index){
} $.post('/insurer/supper-return',{
$.post('/insurer/return-op',{
order_id:<?=$order_info->id?>, order_id:<?=$order_info->id?>,
return_remark:remark, return_remark:value,
return_status_id:<?=$order_info->status_id?>
},function(obj){ },function(obj){
parent.layer.msg(obj.msg); layer.alert(obj.msg,function () {
if(obj.success) { window.location.reload();
$('.btn-back').click(); });
}
},'json'); },'json');
layer.close(index);
});
}); });
<?php }?>
$('.btn-cancel').click(function(){ $('.btn-cancel').click(function(){
parent.layer.confirm('是否确认放弃处理?', { parent.layer.confirm('是否确认放弃处理?', {
btn: ['确认','取消'], //按钮 btn: ['确认','取消'], //按钮

@ -351,15 +351,23 @@ use common\models\PriceT;
}); });
}); });
<?php if($order_info->gift_status == 1 && $my_id == 1) { ?> <?php if($order_info->gift_status == 1 && $my_id == 1) { ?>
layer.config({extend: 'extend/layer.ext.js'});
$('.btn-cancel').click(function () { $('.btn-cancel').click(function () {
parent.layer.confirm('此操作将回滚礼品状态,删除已生成礼物记录,确定继续?', { layer.confirm('此操作将回滚礼品状态,删除已生成礼物记录,确定继续?', {
btn: ['确认','取消'], //按钮 btn: ['确认','取消'], //按钮
shade: false //不显示遮罩 shade: false //不显示遮罩
}, function(){ }, function(){
$.post('/insurer/gift-cancel',{order_id:<?=$order_info->id?>},function(data) { layer.prompt({
parent.layer.msg(data.msg); formType: 2,
title: '礼品状态回退理由',
}, function(value, index){
$.post('/insurer/gift-cancel',{order_id:<?=$order_info->id?>,return_msg:value},function(data) {
layer.alert(data.msg,function () {
window.location.reload(); window.location.reload();
});
}, 'json'); }, 'json');
layer.close(index);
});
}, function(){ }, function(){
// //
}); });

@ -195,8 +195,8 @@ use common\models\PriceT;
<tr> <tr>
<th class="bg-warning">送单地址</th> <th class="bg-warning">送单地址</th>
<td colspan="7" class="form-inline"> <td colspan="7" class="form-inline">
<label><?=$order_info->sendCity->name?></label> <label><?=$order_info->sendCity?$order_info->sendCity->name:''?></label>
<label><?=$order_info->sendDistrict->name?></label> <label><?=$order_info->sendDistrict?$order_info->sendDistrict->name:''?></label>
<label><?=$order_info->send_address?></label> <label><?=$order_info->send_address?></label>
</td> </td>
</tr> </tr>
@ -237,7 +237,7 @@ use common\models\PriceT;
<?php <?php
foreach($insurer_company2_items as $item) { foreach($insurer_company2_items as $item) {
echo '<option value="'.$item->id.'"'; echo '<option value="'.$item->id.'"';
if($item->id == $order_info->company_id) if($item->id == $order_info->company2_id)
echo ' selected '; echo ' selected ';
echo '>'.$item->name.'</option>'; echo '>'.$item->name.'</option>';
} }

@ -195,8 +195,8 @@ use common\models\PriceT;
<tr> <tr>
<th class="bg-warning">送单地址</th> <th class="bg-warning">送单地址</th>
<td colspan="7" class="form-inline"> <td colspan="7" class="form-inline">
<label><?=$order_info->sendCity->name?></label> <label><?=$order_info->sendCity?$order_info->sendCity->name:''?></label>
<label><?=$order_info->sendDistrict->name?></label> <label><?=$order_info->sendDistrict?$order_info->sendDistrict->name:''?></label>
<label><?=$order_info->send_address?></label> <label><?=$order_info->send_address?></label>
</td> </td>
</tr> </tr>

Loading…
Cancel
Save