diff --git a/common/models/OrderT.php b/common/models/OrderT.php
index 652e68b..57a2554 100644
--- a/common/models/OrderT.php
+++ b/common/models/OrderT.php
@@ -14,21 +14,28 @@ use Yii;
* @property string $engine_no
* @property string $car_frame_no
* @property string $car_man
+ * @property string $car_man_type
+ * @property string $car_man_phone
+ * @property string $car_man_number
* @property string $gift_other
* @property integer $company_id
* @property integer $company2_id
* @property integer $status_id
* @property string $submit_date
* @property string $id_man
- * @property string $id_number
+ * @property string $id_man_number
+ * @property string $id_man_phone
+ * @property string $id_man_type
* @property string $link_man
- * @property string $link_phone
+ * @property string $link_man_phone
+ * @property string $link_man_type
+ * @property string $link_man_number
* @property string $insurer1_begin_date
* @property string $insurer1_end_date
* @property string $insurer2_begin_date
* @property string $insurer2_end_date
* @property string $send_date
- * @property string $direction1_id
+ * @property string $direction_id
* @property string $range1_id
* @property string $city1_id
* @property string $district1_id
@@ -103,10 +110,10 @@ class OrderT extends \common\models\Base
public function rules()
{
return [
- [['car_id', 'user_id', 'company_id', 'company2_id', 'status_id', 'pay_type_id','lock_id','direction1_id','range1_id','city1_id','district1_id','direction2_id','range2_id','city2_id','district2_id','success_id','return_status_id','return_time','first_send','send_times','check_gift','gift_type1_id','gift_type8_id','gift_type2_id','gift_type3_id','gift_type4_id','gift_type5_id','gift_type6_id','gift_type7_id','business_group_id','op1_id','op2_id','shoufei_id','payer','payee_id','hk_status','payment_id','account_status','insurance_status','el_insurance','ord_scheme_id','non_num','addr_id'], 'integer'],
+ [['car_id', 'user_id', 'company_id', 'company2_id', 'status_id', 'pay_type_id','lock_id','range1_id','send_city_id','send_district_id','direction2_id','range2_id','city2_id','district2_id','success_id','return_status_id','return_time','first_send','send_times','check_gift','gift_type1_id','gift_type8_id','gift_type2_id','gift_type3_id','gift_type4_id','gift_type5_id','gift_type6_id','gift_type7_id','business_group_id','op1_id','op2_id','shoufei_id','payer','payee_id','hk_status','payment_id','account_status','insurance_status','el_insurance','ord_scheme_id','non_num','addr_id'], 'integer'],
[['submit_date', 'insurer1_begin_date', 'insurer1_end_date', 'insurer2_begin_date', 'insurer2_end_date', 'send_date','print_date','zhifu_date', 'created_at', 'updated_at','insurer_date_start','insurer_date_end'], 'safe'],
- [['gift_other', 'id_man', 'id_number', 'link_man', 'send_address1','send_address2','car_frame_no','car_man','total1','total1_clear','total1_real','total1_dis','total1_percent','total1_rate','total2','total2_clear','total2_rate','total3','total_all','total_real','price_remark','money_no','money_bank','email','return_remark','piao_header','photo_back','photo_face','tijiang'], 'string', 'max' => 100],
- [['link_phone','car_no','engine_no','pay_no','insurer1_no','insurer2_no','identifying_code','money_man','insurer_non_no'], 'string', 'max' => 50],
+ [['gift_other', 'id_man', 'id_man_number', 'id_man_type', 'id_man_phone', 'link_man', 'link_man_phone', 'link_man_type', 'link_man_number', 'send_address','send_address2','car_frame_no','car_man','total1','total1_clear','total1_real','total1_dis','total1_percent','total1_rate','total2','total2_clear','total2_rate','total3','total_all','total_real','price_remark','money_no','money_bank','email','return_remark','piao_header','photo_back','photo_face','tijiang'], 'string', 'max' => 100],
+ [['car_no','engine_no','pay_no','insurer1_no','insurer2_no','identifying_code','money_man','insurer_non_no'], 'string', 'max' => 50],
[['remark'], 'string', 'max' => 200],
];
}
@@ -138,7 +145,7 @@ class OrderT extends \common\models\Base
'insurer2_begin_date' => 'Insurer2 Begin Date',
'insurer2_end_date' => 'Insurer2 End Date',
'send_date' => 'Send Date',
- 'direction1_id' => 'Direction 1 ID',
+ 'direction_id' => 'Direction 1 ID',
'range1_id' => 'Range 1 ID',
'city1_id' => 'City 1 ID',
'district1_id' => 'District 1 ID',
@@ -221,6 +228,10 @@ class OrderT extends \common\models\Base
return $this->hasOne(UserT::className(),['id'=>'lock_id']);
}
+ public function getSuccess()
+ {
+ return $this->hasOne(InvalidT::className(),['id'=>'success_id']);
+ }
public function getPayType()
{
return $this->hasOne(PayTypeT::className(),['id'=>'pay_type_id']);
@@ -256,19 +267,14 @@ class OrderT extends \common\models\Base
return $this->hasOne(RangeT::className(),['id'=>'range1_id']);
}
- public function getDirection1()
- {
- return $this->hasOne(DirectionT::className(),['id'=>'direction1_id']);
- }
-
- public function getCity1()
+ public function getSendCity()
{
- return $this->hasOne(CityT::className(),['id'=>'city1_id']);
+ return $this->hasOne(CityT::className(),['id'=>'send_city_id']);
}
- public function getDistrict1()
+ public function getSendDistrict()
{
- return $this->hasOne(DistrictT::className(),['id'=>'district1_id']);
+ return $this->hasOne(DistrictT::className(),['id'=>'send_district_id']);
}
public function getRange2()
diff --git a/frontend/controllers/AppointmentController.php b/frontend/controllers/AppointmentController.php
index 08660a8..fced2ae 100644
--- a/frontend/controllers/AppointmentController.php
+++ b/frontend/controllers/AppointmentController.php
@@ -108,7 +108,7 @@ class AppointmentController extends BaseController
$items = $query->all();
$data = [];
- $data['total'] = count($items);
+ $data['total'] = $total;
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
@@ -358,17 +358,28 @@ class AppointmentController extends BaseController
}
//今日预约
- public function actionToday()
+ public function actionToday() {
+ $invalid_items = InvalidT::getTree();
+ $user_items = $this->my->getChildren();
+
+ return $this->render('today',[
+ 'invalid_items' => $invalid_items,
+ 'user_items' => $user_items
+ ]);
+ }
+ public function actionTodayJson()
{
+ Yii::$app->response->format = Response::FORMAT_JSON;
$session = Yii::$app->session;
$request = Yii::$app->request;
$car_man = $request->get('car_man');
$phone = $request->get('phone');
$car_no = $request->get('car_no');
- $page = $request->get('page',1);
$sort_key = $request->get('sort_key','appointment_t.pdate');
$sort_value = $request->get('sort_value','ASC');
$ptype = $request->get('ptype');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
@@ -399,46 +410,52 @@ class AppointmentController extends BaseController
$session->remove('appointment_today');
$session->set('appointment_today',$sql);
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
+ $query = $query->offset($offset)->limit($limit);
$items = $query->all();
- $page_info = MyLib::getPageInfo($pagination);
+ $data = [];
+ $data['total'] = $total;
+ $data['rows'] = [];
+ foreach($items as $item) {
+ $car_info = $item->car;
+ $row = $item->toArray();
+ $row['car_id'] = $car_info->id;
+ $row['car_no'] = $car_info->car_no;
+ $row['car_man'] = $car_info->car_man;
+ $row['register_date'] = $car_info->register_date;
+ $row['insurer1_date'] = $car_info->insurer1_date;
+ $row['insurer2_date'] = $car_info->insurer2_date;
+ $row['user_name'] = $item->user ? $item->user->getShowName():'';
+ $data['rows'][] = $row;
+ }
+ return $data;
+ }
- $list = MeetT::getAllData(1);
+ //全部预约
+ public function actionAll() {
+ $invalid_items = InvalidT::getTree();
+ $user_items = $this->my->getChildren();
- return $this->render('today',[
- 'items' => $items,
- 'page_info' => $page_info,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'ptype' => $ptype,
- 'list' => $list,
- 'page' => $page,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'type' => 2
+ return $this->render('all',[
+ 'invalid_items' => $invalid_items,
+ 'user_items' => $user_items
]);
}
-
- //全部预约
- public function actionAll()
+ public function actionAllJson()
{
+ Yii::$app->response->format = Response::FORMAT_JSON;
$session = Yii::$app->session;
$request = Yii::$app->request;
$car_man = $request->get('car_man');
$phone = $request->get('phone');
$car_no = $request->get('car_no');
- $page = $request->get('page',1);
$username = $request->get('username');
$sort_key = $request->get('sort_key','appointment_t.pdate');
$sort_value = $request->get('sort_value','ASC');
$user_id = $request->get('user_id');
-
$ptype = $request->get('ptype');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
@@ -483,36 +500,25 @@ class AppointmentController extends BaseController
$session->remove('appointment_all');
$session->set('appointment_all',$sql);
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
+ $query = $query->offset($offset)->limit($limit);
$items = $query->all();
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
-
- $list = MeetT::getAllData(1);
-
- return $this->render('all',[
- 'items' => $items,
- 'page_info' => $page_info,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'ptype' => $ptype,
- 'list' => $list,
- 'car_no' => $car_no,
- 'page' => $page,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'type' => 3,
- 'invalid_items' => $invalid_items,
- 'username' => $username,
- 'user_items' => $user_items,
- 'user_id' => $user_id
- ]);
+ $data = [];
+ $data['total'] = $total;
+ $data['rows'] = [];
+ foreach($items as $item) {
+ $car_info = $item->car;
+ $row = $item->toArray();
+ $row['car_id'] = $car_info->id;
+ $row['car_no'] = $car_info->car_no;
+ $row['car_man'] = $car_info->car_man;
+ $row['register_date'] = $car_info->register_date;
+ $row['insurer1_date'] = $car_info->insurer1_date;
+ $row['insurer2_date'] = $car_info->insurer2_date;
+ $row['user_name'] = $item->user ? $item->user->getShowName():'';
+ $data['rows'][] = $row;
+ }
+ return $data;
}
public function actionCount()
diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php
index a38e449..2551a9e 100644
--- a/frontend/controllers/CarController.php
+++ b/frontend/controllers/CarController.php
@@ -2263,718 +2263,6 @@ class CarController extends BaseController
}
//保单信息保存
-
-// public function actionOrderSave()
-// {
-// Yii::$app->response->format = Response::FORMAT_JSON;
-// $request = Yii::$app->request;
-// $result = array();
-// $result['success'] = false;
-// $result['msg'] = '保存失败';
-// if ($request->isPost) {
-// //状态
-// $status_id = $request->post('status_id', 1);
-// //车辆信息
-// $car_id = $request->post('car_id', 0);
-// $car_no = $request->post('car_no');
-// $seats = (int)$request->post('seats');
-// $register_date = $request->post('register_date');
-// $car_man = $request->post('car_man');
-// $car_man_number = $request->post('car_man_number');
-//
-// //保单信息
-// $order_id = $request->post('order_id', 0);
-// $id_man = $request->post('id_man');
-// $id_number = $request->post('id_number');
-// $link_man = $request->post('link_man');
-// $link_phone = $request->post('link_phone');
-// $send_date = $request->post('send_date');
-// $company2_id = $request->post('company2_id');
-// $pay_type_id = $request->post('pay_type_id');
-// $shoufei_id = $request->post('shoufei_id');
-// $email = $request->post('email');
-// $insurer1_begin_date = $request->post('insurer1_begin_date');
-// $insurer2_begin_date = $request->post('insurer2_begin_date');
-// $order_remark = $request->post('order_remark');
-// $direction1_id = $request->post('direction1_id');
-// $range1_id = $request->post('range1_id');
-// $city1_id = $request->post('city1_id');
-// $district1_id = $request->post('district1_id');
-// $send_address1 = $request->post('send_address1');
-// $send_address2 = $request->post('send_address2');
-// $success_id = $request->post('success_id');
-// $gifts = $request->post('gifts');
-// $car_man_weixin = $request->post('car_man_weixin');
-// $business_group_id = $request->post('business_group_id', 0);
-//
-// //报价信息
-// $total1_clear = $request->post('total1_clear');
-// $total1 = $request->post('total1');
-// $total1_real = $request->post('total1_real');
-// $total1_dis = $request->post('total1_dis');
-// $total1_percent = $request->post('total1_percent');
-// $total2_clear = $request->post('total2_clear');
-// $total2 = $request->post('total2');
-// $total3 = $request->post('total3');
-// $total_all = $request->post('total_all');
-// $total_real = $request->post('total_real');
-// $price_remark = $request->post('price_remark');
-//
-// //报价明细
-// $types = $request->post('types', array());
-// $nopays = $request->post('nopays', array());
-//
-// //礼品
-// $gifts = $request->post('gifts', array());
-//
-// if ($car_no == '') {
-// $result['msg'] = '请输入车牌号码!';
-// return $result;
-// }
-// //财务信息条件
-// $money_man = $request->post('money_man');
-// $money_no = $request->post('money_no');
-// $money_bank = $request->post('money_bank');
-// $paydate= date('Y-m',time());
-//// echo '
';
-//// print_r($money_man);
-//// var_dump($paydate);
-//// die;
-//
-//
-//
-// //判断起保日期是否正确
-// $begin_date = date('Y-m-d', strtotime('+90 day'));
-//// var_dump($begin_date);
-//// die;
-// if ($insurer1_begin_date != '' && $insurer1_begin_date > $begin_date) {
-// $result['msg'] = '商业起保日期不正确!';
-// return $result;
-// }
-// if ($insurer2_begin_date != '' && $insurer2_begin_date > $begin_date) {
-// $result['msg'] = '交强起保日期不正确!';
-// return $result;
-// }
-// //提交才判断的条件
-// if ($status_id > 1) {
-// if ($success_id == 0) {
-// $result['msg'] = '请选择成功理由';
-// return $result;
-// }
-// if ($seats == 0) {
-// $result['msg'] = '请输入座位数';
-// return $result;
-// }
-// }
-// //三者不能超过
-// if($this->web->max_other_money > 0 && floatval($types[2]) > $this->web->max_other_money) {
-// if($this->web->max_out_rate > 0 && (1 - $total1_percent)*100 > $this->web->max_out_rate) {
-// $result['msg'] = '三者超过' . $this->web->max_other_money . '万,商业折扣率不能超过' . $this->web->max_out_rate.'%';
-// return $result;
-// }
-// }
-// //非京牌车优惠率不能超过
-// if(substr($car_no,0,strlen('京')) != '京' && $this->web->max_other_area_rate > 0 && (1 - $total1_percent)*100 > $this->web->max_other_area_rate) {
-// $result['msg'] = '非京牌车辆商业折扣率不能低于'.round((100 - $this->web->max_other_area_rate)/100,2);
-// return $result;
-// }
-// //所有车辆优惠金额不能超过
-// if($this->web->max_dis_money > 0 && $total1_dis > $this->web->max_dis_money) {
-// $result['msg'] = '所有车辆减免金额不能超过'.$this->web->max_dis_money.'元';
-// return $result;
-// }
-//
-// $tran = CarT::getDb()->beginTransaction();
-// try {
-// $order_info = OrderT::findOne(['id' => $order_id]);
-// $car_info = $order_info->car;
-// //车辆信息
-// $car_info->car_no = $car_no;
-// $car_info->seats = $seats;
-// $car_info->register_date = $register_date;
-// $car_info->car_man = $car_man;
-// $car_info->car_man_number = $car_man_number;
-// $car_info->weixin = $car_man_weixin;
-// $car_info->save();
-//
-// //保单信息
-// $order_info->car_no = $car_no;
-// $order_info->engine_no = $car_info->engine_no;
-// $order_info->car_frame_no = $car_info->car_frame_no;
-// $order_info->car_man = $car_man;
-// $order_info->company2_id = $company2_id;
-// $order_info->success_id = $success_id;
-// $order_info->status_id = $status_id;
-// if ($status_id > 1) {
-// $order_info->return_status_id = 0;
-// $order_info->return_remark = '';
-// $order_info->return_time = 0;
-// }
-// $order_info->submit_date = date('Y-m-d');
-// $order_info->id_man = $id_man;
-// $order_info->id_number = $id_number;
-// $order_info->link_man = $link_man;
-// $order_info->link_phone = $link_phone;
-// $order_info->insurer1_begin_date = $insurer1_begin_date;
-// $insurer1_end_date = '';
-// if ($insurer1_begin_date != '') {
-// $insurer1_end_date = date('Y-m-d', strtotime(date('Y-m-d', strtotime($insurer1_begin_date . "+1 year")) . '-1 day'));
-// }
-// $order_info->insurer1_end_date = $insurer1_end_date;
-// $order_info->insurer2_begin_date = $insurer2_begin_date;
-// $insurer2_end_date = '';
-// if ($insurer2_end_date != '')
-// $insurer2_end_date = date('Y-m-d', strtotime(date('Y-m-d', strtotime($insurer2_begin_date . "+1 year")) . '-1 day'));
-// $order_info->insurer2_end_date = $insurer2_end_date;
-// $order_info->send_date = $send_date;
-// $order_info->direction1_id = $direction1_id;
-// $order_info->range1_id = $range1_id;
-// $order_info->city1_id = $city1_id;
-// $order_info->district1_id = $district1_id;
-// $order_info->send_address1 = $send_address1;
-// $order_info->send_address2 = $send_address2;
-// $order_info->pay_type_id = $pay_type_id;
-// $order_info->shoufei_id = $shoufei_id;
-// $order_info->email = $email;
-// $order_info->remark = $order_remark;
-//
-// $order_info->total1_clear = $total1_clear;
-// $order_info->total1 = $total1;
-// $order_info->total1_real = $total1_real;
-// $order_info->total1_dis = $total1_dis;
-// $order_info->total1_percent = $total1_percent;
-// $order_info->total2_clear = $total2_clear;
-// $order_info->total2 = $total2;
-// $order_info->total3 = $total3;
-// $order_info->total_all = $total_all;
-// $order_info->total_real = $total_real;
-// $order_info->price_remark = $price_remark;
-// $order_info->business_group_id = $business_group_id;
-//
-// $order_info->save();
-//
-// //处理操作人员状态 0:正在操作中,1:操作结束,2:退回操作,3:无效操作,4:放弃操作
-// if ($status_id > 1) {
-// $order_user_info = OrderUserT::findOne(['user_id' => $this->my->id, 'order_id' => $order_info->id, 'status' => 0]);
-// if ($order_user_info) {
-// $order_user_info->status = 1;
-// $order_user_info->save();
-// }
-// }
-// //礼品
-// OrderGiftT::deleteAll('order_id=' . $order_info->id . ' and status=0');
-// if (is_array($gifts)) {
-// foreach ($gifts as $tmp_str) {
-// $tmp = explode('_', $tmp_str);
-// $group_id = isset($tmp[0]) ? $tmp[0] : 0;
-// $gift_id = isset($tmp[1]) ? $tmp[1] : 0;
-// if ($group_id == 0 && $gift_id == 0) continue;
-// $group_info = GiftGroupT::findOne(['id' => $group_id]);
-// if (!isset($group_info)) {
-// continue;
-//// $result['msg'] = '礼品分组有错误,请与主管联系';
-//// return $result;
-// }
-// $gift_info = GiftType3T::findOne(['id' => $gift_id]);
-// if (!isset($gift_info)) {
-// continue;
-//// $result['msg'] = $group_info->name.' 礼品不存在,重新选择';
-//// return $result;
-// }
-// $tmp_count = OrderGiftT::find()->where('order_id=' . $order_info->id . ' and group_id=' . $group_id . ' and status=1')->count();
-// if ($tmp_count > 0) {
-// continue;
-// }
-// //处理礼品数量
-// if ($status_id > 1) {
-// if ($gift_info->total > -1) {
-// $gift_info->total = $gift_info->total - 1;
-// $gift_info->save();
-// }
-// }
-// $row = new OrderGiftT();
-// $row->order_id = $order_info->id;
-// $row->group_id = $group_id;
-// $row->gift_id = $gift_id;
-// $row->is_free = $group_info->is_free;
-// $row->gift_type = $gift_info->type;
-// $row->send_id = 0;
-// $row->send_time = 0;
-// $row->price = 0;
-// $row->status = 0;
-// if (!$row->save()) {
-// var_dump($row->errors);
-// }
-// }
-// }
-//
-// //险种明细
-// foreach ($types as $id => $val) {
-// $price_row = PriceT::find()
-// ->where('order_id=' . $order_info->id . ' and type_id=' . $id)
-// ->one();
-// if (empty($price_row)) {
-// $price_row = new PriceT();
-// $price_row->order_id = $order_info->id;
-// $price_row->type_id = $id;
-// }
-// $price_row->val = $val;
-// if (!empty($nopays[$id]))
-// $price_row->is_nopay = 1;
-// else
-// $price_row->is_nopay = 0;
-// $price_row->save();
-// }
-//
-// //处理预约
-// if ($status_id > 1) {
-// $tmp_row = AppointmentT::findOne(['car_id' => $car_info->id]);
-// if (!empty($tmp_row)) {
-// $tmp_row->delete();
-// }
-// $tmp_status_info = StatusT::findOne(['id' => $status_id]);
-// $log_msg = '';
-// if ($tmp_status_info) {
-// $log_msg = '进入' . $tmp_status_info->name;
-// }
-// $this->addLog($car_info->id, $log_msg, 1);
-// }
-//
-// //处理公司礼品
-// //清除原公司礼品
-// CarGiftT::deleteAll('user_id=' . $this->my->id . ' and car_id=' . $car_info->id . ' and order_id=' . $order_info->id . ' and type=1 and status=0');
-// foreach ($gifts as $id_str) {
-// $gift_ids = explode('-', $id_str);
-// if (count($gift_ids) != 2) continue;
-// $strategy_id = $gift_ids[0];
-// $gift_id = $gift_ids[1];
-// $car_gift_info = CarGiftT::find()
-// ->where('strategy_id=' . $strategy_id . ' and order_id=' . $order_info->id . ' and gift_id=' . $gift_id)
-// ->one();
-// if (!$car_gift_info && $gift_id > 0) {
-// $car_gift_info = new CarGiftT();
-// $car_gift_info->user_id = $this->my->id;
-// $car_gift_info->car_id = $car_info->id;
-// $car_gift_info->order_id = $order_info->id;
-// $car_gift_info->strategy_id = $strategy_id;
-// $car_gift_info->gift_id = $gift_id;
-// $car_gift_info->submit_time = time();
-// $car_gift_info->status = 0;
-// $car_gift_info->type = 1;
-// $car_gift_info->save();
-// }
-// }
-// //处理自费礼品
-// $gift_items = CarGiftT::find()
-// ->where('car_id=' . $car_info->id . ' and order_id=0')
-// ->all();
-// foreach ($gift_items as $item) {
-// $item->order_id = $order_info->id;
-// $item->save();
-// }
-// // 处理财务-如果是在线支付-生成财务分支
-//
-// if ($status_id > 1) {
-// if ($shoufei_id == 2) {
-// $order_caiwu = OrderCaiwuT::findOne(['order_id'=>$order_info->id]);
-//
-// if(!$order_caiwu){
-// $order_caiwu = new OrderCaiwuT();
-// $order_caiwu->status_id = 2;
-// }
-//
-// $order_caiwu->order_id = $order_info->id;
-// $order_caiwu->money_man = $money_man;
-// $order_caiwu->money_no = $money_no;
-// $order_caiwu->pay_date = $paydate;
-// $order_caiwu->money_bank = $money_bank;
-// $order_caiwu->save();
-// }
-//
-// }
-// $result['success'] = true;
-// $result['msg'] = '保存成功';
-//
-// $tran->commit();
-// } catch (\Exception $e) {
-// $tran->rollBack();
-// throw $e;
-// }
-//
-// }
-// return $result;
-// }
-
-// public function actionOrderSave()
-// {
-// Yii::$app->response->format = Response::FORMAT_JSON;
-// $request = Yii::$app->request;
-// $result = array();
-// $result['success'] = false;
-// $result['msg'] = '保存失败';
-// if ($request->isPost) {
-// //状态
-// $status_id = $request->post('status_id', 1);
-// //车辆信息
-// $car_id = $request->post('car_id', 0);
-// $car_no = $request->post('car_no');
-// $seats = (int)$request->post('seats');
-// $register_date = $request->post('register_date');
-// $car_man = $request->post('car_man');
-// $car_man_number = $request->post('car_man_number');
-// //地址信息
-// $province = $request->post('province');
-// $city = $request->post('city');
-// $district = $request->post('district');
-// $town = $request->post('twon');
-// $address = $request->post('address');
-//
-// //保单信息
-// $order_id = $request->post('order_id', 0);
-// $id_man = $request->post('id_man');
-// $id_number = $request->post('id_number');
-// $link_man = $request->post('link_man');
-// $link_phone = $request->post('link_phone');
-// $send_date = $request->post('send_date');
-// $company2_id = $request->post('company2_id');
-// $pay_type_id = $request->post('pay_type_id');
-// $shoufei_id = $request->post('shoufei_id');
-// $email = $request->post('email');
-// $insurer1_begin_date = $request->post('insurer1_begin_date');
-// $insurer2_begin_date = $request->post('insurer2_begin_date');
-// $order_remark = $request->post('order_remark');
-// $direction1_id = $request->post('direction1_id');
-// $range1_id = $request->post('range1_id');
-// $city1_id = $request->post('city1_id');
-// $district1_id = $request->post('district1_id');
-// $send_address1 = $request->post('send_address1');
-//// $send_address2 = $request->post('send_address2');
-// $success_id = $request->post('success_id');
-// $gifts = $request->post('gifts');
-// $car_man_weixin = $request->post('car_man_weixin');
-// $business_group_id = $request->post('business_group_id', 0);
-//
-// //非车险信息
-//// $is_insurance = $request->post('is_insurance');
-//// $ord_scheme_id = $request->post('scheme_id');
-//// $non_num = $request->post('non_num');
-//
-//
-// //报价信息
-// $total1_clear = $request->post('total1_clear');
-// $total1 = $request->post('total1');
-// $total1_real = $request->post('total1_real');
-// $total1_dis = $request->post('total1_dis');
-// $total1_percent = $request->post('total1_percent');
-// $total2_clear = $request->post('total2_clear');
-// $total2 = $request->post('total2');
-// $total3 = $request->post('total3');
-// $total_all = $request->post('total_all');
-// $total_real = $request->post('total_real');
-// $price_remark = $request->post('price_remark');
-//
-// //报价明细
-// $types = $request->post('types', array());
-// $nopays = $request->post('nopays', array());
-//
-// //礼品
-// $gifts = $request->post('gifts', array());
-//
-// if ($car_no == '') {
-// $result['msg'] = '请输入车牌号码!';
-// return $result;
-// }
-// //财务信息条件
-// $money_man = $request->post('money_man');
-// $money_no = $request->post('money_no');
-// $money_bank = $request->post('money_bank');
-// $paydate= date('Y-m',time());
-//// echo '';
-//// print_r($money_man);
-//// var_dump($paydate);
-//// die;
-//
-//
-//
-// //判断起保日期是否正确
-// $begin_date = date('Y-m-d', strtotime('+90 day'));
-//// var_dump($begin_date);
-//// die;
-// if ($insurer1_begin_date != '' && $insurer1_begin_date > $begin_date) {
-// $result['msg'] = '商业起保日期不正确!';
-// return $result;
-// }
-// if ($insurer2_begin_date != '' && $insurer2_begin_date > $begin_date) {
-// $result['msg'] = '交强起保日期不正确!';
-// return $result;
-// }
-// //提交才判断的条件
-// if ($status_id > 1) {
-// if ($success_id == 0) {
-// $result['msg'] = '请选择成功理由';
-// return $result;
-// }
-// if ($seats == 0) {
-// $result['msg'] = '请输入座位数';
-// return $result;
-// }
-// }
-// //三者不能超过
-// if($this->web->max_other_money > 0 && floatval($types[2]) > $this->web->max_other_money) {
-// if($this->web->max_out_rate > 0 && (1 - $total1_percent)*100 > $this->web->max_out_rate) {
-// $result['msg'] = '三者超过' . $this->web->max_other_money . '万,商业折扣率不能超过' . $this->web->max_out_rate.'%';
-// return $result;
-// }
-// }
-// //非京牌车优惠率不能超过
-// if(substr($car_no,0,strlen('京')) != '京' && $this->web->max_other_area_rate > 0 && (1 - $total1_percent)*100 > $this->web->max_other_area_rate) {
-// $result['msg'] = '非京牌车辆商业折扣率不能低于'.round((100 - $this->web->max_other_area_rate)/100,2);
-// return $result;
-// }
-// //所有车辆优惠金额不能超过
-// if($this->web->max_dis_money > 0 && $total1_dis > $this->web->max_dis_money) {
-// $result['msg'] = '所有车辆减免金额不能超过'.$this->web->max_dis_money.'元';
-// return $result;
-// }
-//
-// $tran = CarT::getDb()->beginTransaction();
-// try {
-// $order_info = OrderT::findOne(['id' => $order_id]);
-// $car_info = $order_info->car;
-// //车辆信息
-// $car_info->car_no = $car_no;
-// $car_info->seats = $seats;
-// $car_info->register_date = $register_date;
-// $car_info->car_man = $car_man;
-// $car_info->car_man_number = $car_man_number;
-// $car_info->weixin = $car_man_weixin;
-// $car_info->save();
-//
-// //保单信息
-// $order_info->car_no = $car_no;
-// $order_info->engine_no = $car_info->engine_no;
-// $order_info->car_frame_no = $car_info->car_frame_no;
-// $order_info->car_man = $car_man;
-// $order_info->company2_id = $company2_id;
-// $order_info->success_id = $success_id;
-// $order_info->status_id = $status_id;
-// if ($status_id > 1) {
-// $order_info->return_status_id = 0;
-// $order_info->return_remark = '';
-// $order_info->return_time = 0;
-// }
-// $order_info->submit_date = date('Y-m-d');
-// $order_info->id_man = $id_man;
-// $order_info->id_number = $id_number;
-// $order_info->link_man = $link_man;
-// $order_info->link_phone = $link_phone;
-// $order_info->insurer1_begin_date = $insurer1_begin_date;
-// $insurer1_end_date = '';
-// if ($insurer1_begin_date != '') {
-// $insurer1_end_date = date('Y-m-d', strtotime(date('Y-m-d', strtotime($insurer1_begin_date . "+1 year")) . '-1 day'));
-// }
-// $order_info->insurer1_end_date = $insurer1_end_date;
-// $order_info->insurer2_begin_date = $insurer2_begin_date;
-// $insurer2_end_date = '';
-// if ($insurer2_end_date != '')
-// $insurer2_end_date = date('Y-m-d', strtotime(date('Y-m-d', strtotime($insurer2_begin_date . "+1 year")) . '-1 day'));
-// $order_info->insurer2_end_date = $insurer2_end_date;
-// $order_info->send_date = $send_date;
-// $order_info->direction1_id = $direction1_id;
-// $order_info->range1_id = $range1_id;
-// $order_info->city1_id = $city1_id;
-// $order_info->district1_id = $district1_id;
-// $order_info->send_address1 = $send_address1;
-//// $order_info->send_address2 = $send_address2;
-// $order_info->pay_type_id = $pay_type_id;
-// $order_info->shoufei_id = $shoufei_id;
-// $order_info->email = $email;
-// $order_info->remark = $order_remark;
-//
-// //正本地址存储
-//
-// if ($status_id > 1) {
-// $order_ad= OrderAddress::findOne(['order_id'=>$order_id]);
-// if(!$order_ad){
-// $order_ad=new OrderAddress();
-// $order_ad->order_id=$order_id;
-// }
-// $order_ad->province=$province;
-// $order_ad->city=$city;
-// $order_ad->district=$district;
-// $order_ad->town=$town;
-// $order_ad->address=$address;
-// $order_ad->save();
-// $order_info->addr_id=$order_ad->id;
-// }
-//
-//
-// $order_info->total1_clear = $total1_clear;
-// $order_info->total1 = $total1;
-// $order_info->total1_real = $total1_real;
-// $order_info->total1_dis = $total1_dis;
-// $order_info->total1_percent = $total1_percent;
-// $order_info->total2_clear = $total2_clear;
-// $order_info->total2 = $total2;
-// $order_info->total3 = $total3;
-// $order_info->total_all = $total_all;
-// $order_info->total_real = $total_real;
-// $order_info->price_remark = $price_remark;
-// $order_info->business_group_id = $business_group_id;
-//
-// $order_info->save();
-//
-// //处理操作人员状态 0:正在操作中,1:操作结束,2:退回操作,3:无效操作,4:放弃操作
-// if ($status_id > 1) {
-// $order_user_info = OrderUserT::findOne(['user_id' => $this->my->id, 'order_id' => $order_info->id, 'status' => 0]);
-// if ($order_user_info) {
-// $order_user_info->status = 1;
-// $order_user_info->save();
-// }
-// }
-// //礼品
-// OrderGiftT::deleteAll('order_id=' . $order_info->id . ' and status=0');
-// if (is_array($gifts)) {
-// foreach ($gifts as $tmp_str) {
-// $tmp = explode('_', $tmp_str);
-// $group_id = isset($tmp[0]) ? $tmp[0] : 0;
-// $gift_id = isset($tmp[1]) ? $tmp[1] : 0;
-// if ($group_id == 0 && $gift_id == 0) continue;
-// $group_info = GiftGroupT::findOne(['id' => $group_id]);
-// if (!isset($group_info)) {
-// continue;
-//// $result['msg'] = '礼品分组有错误,请与主管联系';
-//// return $result;
-// }
-// $gift_info = GiftType3T::findOne(['id' => $gift_id]);
-// if (!isset($gift_info)) {
-// continue;
-//// $result['msg'] = $group_info->name.' 礼品不存在,重新选择';
-//// return $result;
-// }
-// $tmp_count = OrderGiftT::find()->where('order_id=' . $order_info->id . ' and group_id=' . $group_id . ' and status=1')->count();
-// if ($tmp_count > 0) {
-// continue;
-// }
-// //处理礼品数量
-// if ($status_id > 1) {
-// if ($gift_info->total > -1) {
-// $gift_info->total = $gift_info->total - 1;
-// $gift_info->save();
-// }
-// }
-// $row = new OrderGiftT();
-// $row->order_id = $order_info->id;
-// $row->group_id = $group_id;
-// $row->gift_id = $gift_id;
-// $row->is_free = $group_info->is_free;
-// $row->gift_type = $gift_info->type;
-// $row->send_id = 0;
-// $row->send_time = 0;
-// $row->price = 0;
-// $row->status = 0;
-// if (!$row->save()) {
-// var_dump($row->errors);
-// }
-// }
-// }
-//
-// //险种明细
-// foreach ($types as $id => $val) {
-// $price_row = PriceT::find()
-// ->where('order_id=' . $order_info->id . ' and type_id=' . $id)
-// ->one();
-// if (empty($price_row)) {
-// $price_row = new PriceT();
-// $price_row->order_id = $order_info->id;
-// $price_row->type_id = $id;
-// }
-// $price_row->val = $val;
-// if (!empty($nopays[$id]))
-// $price_row->is_nopay = 1;
-// else
-// $price_row->is_nopay = 0;
-// $price_row->save();
-// }
-//
-// //处理预约
-// if ($status_id > 1) {
-// $tmp_row = AppointmentT::findOne(['car_id' => $car_info->id]);
-// if (!empty($tmp_row)) {
-// $tmp_row->delete();
-// }
-// $tmp_status_info = StatusT::findOne(['id' => $status_id]);
-// $log_msg = '';
-// if ($tmp_status_info) {
-// $log_msg = '进入' . $tmp_status_info->name;
-// }
-// $this->addLog($car_info->id, $log_msg, 1);
-// }
-//
-// //处理公司礼品
-// //清除原公司礼品
-// CarGiftT::deleteAll('user_id=' . $this->my->id . ' and car_id=' . $car_info->id . ' and order_id=' . $order_info->id . ' and type=1 and status=0');
-// foreach ($gifts as $id_str) {
-// $gift_ids = explode('-', $id_str);
-// if (count($gift_ids) != 2) continue;
-// $strategy_id = $gift_ids[0];
-// $gift_id = $gift_ids[1];
-// $car_gift_info = CarGiftT::find()
-// ->where('strategy_id=' . $strategy_id . ' and order_id=' . $order_info->id . ' and gift_id=' . $gift_id)
-// ->one();
-// if (!$car_gift_info && $gift_id > 0) {
-// $car_gift_info = new CarGiftT();
-// $car_gift_info->user_id = $this->my->id;
-// $car_gift_info->car_id = $car_info->id;
-// $car_gift_info->order_id = $order_info->id;
-// $car_gift_info->strategy_id = $strategy_id;
-// $car_gift_info->gift_id = $gift_id;
-// $car_gift_info->submit_time = time();
-// $car_gift_info->status = 0;
-// $car_gift_info->type = 1;
-// $car_gift_info->save();
-// }
-// }
-// //处理自费礼品
-// $gift_items = CarGiftT::find()
-// ->where('car_id=' . $car_info->id . ' and order_id=0')
-// ->all();
-// foreach ($gift_items as $item) {
-// $item->order_id = $order_info->id;
-// $item->save();
-// }
-// // 处理财务-如果是在线支付-生成财务分支
-//
-// if ($status_id > 1) {
-// if ($shoufei_id == 2) {
-// $order_caiwu = OrderCaiwuT::findOne(['order_id'=>$order_info->id]);
-//
-// if(!$order_caiwu){
-// $order_caiwu = new OrderCaiwuT();
-// $order_caiwu->status_id = 2;
-// }
-//
-// $order_caiwu->order_id = $order_info->id;
-// $order_caiwu->money_man = $money_man;
-// $order_caiwu->money_no = $money_no;
-// $order_caiwu->pay_date = $paydate;
-// $order_caiwu->money_bank = $money_bank;
-// $order_caiwu->save();
-// }
-//
-// }
-// $result['success'] = true;
-// $result['msg'] = '保存成功';
-//
-// $tran->commit();
-// } catch (\Exception $e) {
-// $tran->rollBack();
-// throw $e;
-// }
-//
-// }
-// return $result;
-// }
public function actionOrderSave()
{
Yii::$app->response->format = Response::FORMAT_JSON;
@@ -2990,52 +2278,36 @@ class CarController extends BaseController
$car_no = $request->post('car_no');
$seats = (int)$request->post('seats');
$register_date = $request->post('register_date');
+
$car_man = $request->post('car_man');
$car_man_number = $request->post('car_man_number');
- //地址信息
-// $province = $request->post('province');
-//
-// $district = $request->post('district');
-// $town = $request->post('twon');
-// $address = $request->post('address');
-
- $city = $request->post('city');
- $pcity = $request->post('pcity');
- $pproper = $request->post('pproper');
- $receiver_address = $request->post('receiver_address');
-
+ $car_man_type = $request->post('car_man_type');
+ $car_man_phone = $request->post('car_man_phone');
+ $id_man = $request->post('id_man');
+ $id_man_number = $request->post('id_man_number');
+ $id_man_type = $request->post('id_man_type');
+ $id_man_phone = $request->post('id_man_phone');
+ $link_man = $request->post('link_man');
+ $link_man_number = $request->post('link_man_number');
+ $link_man_type = $request->post('link_man_type');
+ $link_man_phone = $request->post('link_man_phone');
+ //送单地址信息
+ $send_district_id = $request->post('send_district_id');
+ $send_city_id = $request->post('send_city_id');
+ $send_address = $request->post('send_address');
//保单信息
- $order_id = $request->post('order_id', 0);
- $id_man = $request->post('id_man');
- $id_number = $request->post('id_number');
- $link_man = $request->post('link_man');
- $link_phone = $request->post('link_phone');
+ $order_id = $request->post('id', 0);
+ $email = $request->post('email');
$send_date = $request->post('send_date');
$company2_id = $request->post('company2_id');
$pay_type_id = $request->post('pay_type_id');
$shoufei_id = $request->post('shoufei_id');
- $email = $request->post('email');
$insurer1_begin_date = $request->post('insurer1_begin_date');
$insurer2_begin_date = $request->post('insurer2_begin_date');
$order_remark = $request->post('order_remark');
- $direction1_id = $request->post('direction1_id');
- $range1_id = $request->post('range1_id');
- $city1_id = $request->post('city1_id');
- $district1_id = $request->post('district1_id');
- $send_address1 = $request->post('send_address1');
-// $send_address2 = $request->post('send_address2');
$success_id = $request->post('success_id');
- $gifts = $request->post('gifts');
- $car_man_weixin = $request->post('car_man_weixin');
- $business_group_id = $request->post('business_group_id', 0);
-
- //非车险信息
-// $is_insurance = $request->post('is_insurance');
-// $ord_scheme_id = $request->post('scheme_id');
-// $non_num = $request->post('non_num');
-
//报价信息
$total1_clear = $request->post('total1_clear');
@@ -3054,29 +2326,13 @@ class CarController extends BaseController
$types = $request->post('types', array());
$nopays = $request->post('nopays', array());
- //礼品
- $gifts = $request->post('gifts', array());
-
- if ($car_no == '') {
- $result['msg'] = '请输入车牌号码!';
- return $result;
- }
//财务信息条件
$money_man = $request->post('money_man');
$money_no = $request->post('money_no');
$money_bank = $request->post('money_bank');
- $paydate= date('Y-m',time());
-// echo '';
-// print_r($money_man);
-// var_dump($paydate);
-// die;
-
-
//判断起保日期是否正确
$begin_date = date('Y-m-d', strtotime('+90 day'));
-// var_dump($begin_date);
-// die;
if ($insurer1_begin_date != '' && $insurer1_begin_date > $begin_date) {
$result['msg'] = '商业起保日期不正确!';
return $result;
@@ -3096,23 +2352,6 @@ class CarController extends BaseController
return $result;
}
}
- //三者不能超过
- if($this->web->max_other_money > 0 && floatval($types[2]) > $this->web->max_other_money) {
- if($this->web->max_out_rate > 0 && (1 - $total1_percent)*100 > $this->web->max_out_rate) {
- $result['msg'] = '三者超过' . $this->web->max_other_money . '万,商业折扣率不能超过' . $this->web->max_out_rate.'%';
- return $result;
- }
- }
- //非京牌车优惠率不能超过
- if(substr($car_no,0,strlen('京')) != '京' && $this->web->max_other_area_rate > 0 && (1 - $total1_percent)*100 > $this->web->max_other_area_rate) {
- $result['msg'] = '非京牌车辆商业折扣率不能低于'.round((100 - $this->web->max_other_area_rate)/100,2);
- return $result;
- }
- //所有车辆优惠金额不能超过
- if($this->web->max_dis_money > 0 && $total1_dis > $this->web->max_dis_money) {
- $result['msg'] = '所有车辆减免金额不能超过'.$this->web->max_dis_money.'元';
- return $result;
- }
$tran = CarT::getDb()->beginTransaction();
try {
@@ -3124,27 +2363,32 @@ class CarController extends BaseController
$car_info->register_date = $register_date;
$car_info->car_man = $car_man;
$car_info->car_man_number = $car_man_number;
- $car_info->weixin = $car_man_weixin;
- $car_info->save();
+ if(!$car_info->save()) {
+ throw new \Exception(print_r($car_info->getErrors(), true));
+ }
//保单信息
$order_info->car_no = $car_no;
+ $order_info->seats = $seats;
$order_info->engine_no = $car_info->engine_no;
$order_info->car_frame_no = $car_info->car_frame_no;
$order_info->car_man = $car_man;
+ $order_info->car_man_phone = $car_man_phone;
+ $order_info->car_man_type = $car_man_type;
+ $order_info->car_man_number = $car_man_number;
+ $order_info->id_man = $id_man;
+ $order_info->id_man_phone = $id_man_phone;
+ $order_info->id_man_type = $id_man_type;
+ $order_info->id_man_number = $id_man_number;
+ $order_info->link_man = $link_man;
+ $order_info->link_man_phone = $link_man_phone;
+ $order_info->link_man_type = $link_man_type;
+ $order_info->link_man_number = $link_man_number;
+
$order_info->company2_id = $company2_id;
$order_info->success_id = $success_id;
$order_info->status_id = $status_id;
- if ($status_id > 1) {
- $order_info->return_status_id = 0;
- $order_info->return_remark = '';
- $order_info->return_time = 0;
- }
$order_info->submit_date = date('Y-m-d');
- $order_info->id_man = $id_man;
- $order_info->id_number = $id_number;
- $order_info->link_man = $link_man;
- $order_info->link_phone = $link_phone;
$order_info->insurer1_begin_date = $insurer1_begin_date;
$insurer1_end_date = '';
if ($insurer1_begin_date != '') {
@@ -3157,50 +2401,14 @@ class CarController extends BaseController
$insurer2_end_date = date('Y-m-d', strtotime(date('Y-m-d', strtotime($insurer2_begin_date . "+1 year")) . '-1 day'));
$order_info->insurer2_end_date = $insurer2_end_date;
$order_info->send_date = $send_date;
- $order_info->direction1_id = $direction1_id;
- $order_info->range1_id = $range1_id;
- $order_info->city1_id = $city1_id;
- $order_info->district1_id = $district1_id;
- $order_info->send_address1 = $send_address1;
-// $order_info->send_address2 = $send_address2;
+ $order_info->send_district_id = $send_district_id;
+ $order_info->send_city_id = $send_city_id;
+ $order_info->send_address = $send_address;
$order_info->pay_type_id = $pay_type_id;
$order_info->shoufei_id = $shoufei_id;
$order_info->email = $email;
$order_info->remark = $order_remark;
- //正本地址存储
- if ($status_id > 1) {
-// $order_ad= OrderAddress::findOne(['order_id'=>$order_id]);
-// if(!$order_ad){
-// $order_ad=new OrderAddress();
-// $order_ad->order_id=$order_id;
-// }
-// $order_ad->province=$province;
-// $order_ad->city=$city;
-// $order_ad->district=$district;
-// $order_ad->town=$town;
-// $order_ad->address=$address;
-// $order_ad->save();
-// $order_info->addr_id=$order_ad->id;
-
- }
- //非车险存储
-// $order_info->is_insurance = $is_insurance;
-// if($is_insurance==2 && $ord_scheme_id && $non_num){
-// $order_info->ord_scheme_id=$ord_scheme_id;
-// $scheme_items=Scheme::findOne(['id'=>$order_info->ord_scheme_id]);
-// if($scheme_items){
-// $order_info->non_baofei=$scheme_items->baofei;
-//
-// }
-// $order_info->non_num=$non_num;
-// }
-
- $order_info->receiver_province = $city;
- $order_info->receiver_city = $pcity;
- $order_info->receiver_county = $pproper;
- $order_info->receiver_address = $receiver_address;
-
$order_info->total1_clear = $total1_clear;
$order_info->total1 = $total1;
$order_info->total1_real = $total1_real;
@@ -3212,65 +2420,25 @@ class CarController extends BaseController
$order_info->total_all = $total_all;
$order_info->total_real = $total_real;
$order_info->price_remark = $price_remark;
- $order_info->business_group_id = $business_group_id;
- $order_info->save();
+ $order_info->money_man = $money_man;
+ $order_info->money_bank = $money_bank;
+ $order_info->money_no = $money_no;
+
+ if(!$order_info->save()) {
+ throw new \Exception(print_r($order_info->getErrors(), true));
+ }
//处理操作人员状态 0:正在操作中,1:操作结束,2:退回操作,3:无效操作,4:放弃操作
if ($status_id > 1) {
$order_user_info = OrderUserT::findOne(['user_id' => $this->my->id, 'order_id' => $order_info->id, 'status' => 0]);
if ($order_user_info) {
$order_user_info->status = 1;
- $order_user_info->save();
- }
- }
- //礼品
- OrderGiftT::deleteAll('order_id=' . $order_info->id . ' and status=0');
- if (is_array($gifts)) {
- foreach ($gifts as $tmp_str) {
- $tmp = explode('_', $tmp_str);
- $group_id = isset($tmp[0]) ? $tmp[0] : 0;
- $gift_id = isset($tmp[1]) ? $tmp[1] : 0;
- if ($group_id == 0 && $gift_id == 0) continue;
- $group_info = GiftGroupT::findOne(['id' => $group_id]);
- if (!isset($group_info)) {
- continue;
-// $result['msg'] = '礼品分组有错误,请与主管联系';
-// return $result;
- }
- $gift_info = GiftType3T::findOne(['id' => $gift_id]);
- if (!isset($gift_info)) {
- continue;
-// $result['msg'] = $group_info->name.' 礼品不存在,重新选择';
-// return $result;
- }
- $tmp_count = OrderGiftT::find()->where('order_id=' . $order_info->id . ' and group_id=' . $group_id . ' and status=1')->count();
- if ($tmp_count > 0) {
- continue;
- }
- //处理礼品数量
- if ($status_id > 1) {
- if ($gift_info->total > -1) {
- $gift_info->total = $gift_info->total - 1;
- $gift_info->save();
- }
- }
- $row = new OrderGiftT();
- $row->order_id = $order_info->id;
- $row->group_id = $group_id;
- $row->gift_id = $gift_id;
- $row->is_free = $group_info->is_free;
- $row->gift_type = $gift_info->type;
- $row->send_id = 0;
- $row->send_time = 0;
- $row->price = 0;
- $row->status = 0;
- if (!$row->save()) {
- var_dump($row->errors);
+ if(!$order_user_info->save()) {
+ throw new \Exception(print_r($order_user_info->getErrors(), true));
}
}
}
-
//险种明细
foreach ($types as $id => $val) {
$price_row = PriceT::find()
@@ -3286,7 +2454,9 @@ class CarController extends BaseController
$price_row->is_nopay = 1;
else
$price_row->is_nopay = 0;
- $price_row->save();
+ if(!$price_row->save()) {
+ throw new \Exception(print_r($price_row->getErrors(), true));
+ }
}
//处理预约
@@ -3302,39 +2472,6 @@ class CarController extends BaseController
}
$this->addLog($car_info->id, $log_msg, 1);
}
-
- //处理公司礼品
- //清除原公司礼品
- CarGiftT::deleteAll('user_id=' . $this->my->id . ' and car_id=' . $car_info->id . ' and order_id=' . $order_info->id . ' and type=1 and status=0');
- foreach ($gifts as $id_str) {
- $gift_ids = explode('-', $id_str);
- if (count($gift_ids) != 2) continue;
- $strategy_id = $gift_ids[0];
- $gift_id = $gift_ids[1];
- $car_gift_info = CarGiftT::find()
- ->where('strategy_id=' . $strategy_id . ' and order_id=' . $order_info->id . ' and gift_id=' . $gift_id)
- ->one();
- if (!$car_gift_info && $gift_id > 0) {
- $car_gift_info = new CarGiftT();
- $car_gift_info->user_id = $this->my->id;
- $car_gift_info->car_id = $car_info->id;
- $car_gift_info->order_id = $order_info->id;
- $car_gift_info->strategy_id = $strategy_id;
- $car_gift_info->gift_id = $gift_id;
- $car_gift_info->submit_time = time();
- $car_gift_info->status = 0;
- $car_gift_info->type = 1;
- $car_gift_info->save();
- }
- }
- //处理自费礼品
- $gift_items = CarGiftT::find()
- ->where('car_id=' . $car_info->id . ' and order_id=0')
- ->all();
- foreach ($gift_items as $item) {
- $item->order_id = $order_info->id;
- $item->save();
- }
// 处理财务-如果是在线支付-生成财务分支
if ($status_id > 1) {
@@ -3349,21 +2486,22 @@ class CarController extends BaseController
$order_caiwu->order_id = $order_info->id;
$order_caiwu->money_man = $money_man;
$order_caiwu->money_no = $money_no;
- $order_caiwu->pay_date = $paydate;
$order_caiwu->money_bank = $money_bank;
- $order_caiwu->save();
+ if(!$order_caiwu->save()) {
+ throw new \Exception(print_r($order_caiwu->getErrors(), true));
+ }
}
}
+
$result['success'] = true;
$result['msg'] = '保存成功';
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
- throw $e;
+ $result['msg'] = $e->getMessage();
}
-
}
return $result;
}
@@ -5722,18 +4860,7 @@ class CarController extends BaseController
$msg .= $msg1;
// $msg .= '总计'.($total_all).'元;';
$msg .= '保费实收'.($total_real).'元;';
-
- $msg_1 = '升级礼品三选一(喷漆,镀晶,保养);';
- $msg_2 = '赠送VIP服务卡(车辆美容、人伤极速赔、客户经理一对一、全程代办等);';
- $msg_3 = '尊享一案多修服务;';
- if($has_chesun == 0){
- $msg .= '1.'.$msg_2;
- }elseif($total1_clear < 1500){
- $msg .= '1.'.$msg_2.'2.'.$msg_3;
- }else{
- $msg .= '1.'.$msg_1.'2.'.$msg_2.'3.'.$msg_3;
- }
- $msg .= '详询51669518或'.$this->my->phone.'微信同号,祝您生活愉快。';
+ $msg .= '祝您生活愉快。';
// }
@@ -5853,4 +4980,59 @@ class CarController extends BaseController
return $data;
}
+
+ public function actionOrderAdd() {
+ $request = Yii::$app->request;
+ $car_id = $request->get('car_id');
+
+ $car_info = CarT::findOne(['id'=>$car_id]);
+ $order_info = $car_info->getOrders()->orderBy('id DESC')->one();
+ if(!$order_info) {
+ $user_id = 0;
+ if($car_info->location == 2) {
+ $b_info = CarBT::findOne(['id'=>$car_info->id]);
+ $user_id = $b_info->user_id;
+ }
+ if($car_info->location == 3) {
+ $c_info = CarCT::findOne(['id'=>$car_info->id]);
+ $user_id = $c_info->user_id;
+ }
+ if($car_info->location == 4) {
+ $d_info = CarDT::findOne(['id'=>$car_info->id]);
+ $user_id = $d_info->user_id;
+ }
+ $order_info = new OrderT();
+ $order_info->car_id = $car_info->id;
+ $order_info->car_no = $car_info->car_no;
+ $order_info->engine_no = $car_info->engine_no;
+ $order_info->car_frame_no = $car_info->car_frame_no;
+ $order_info->car_man = $car_info->car_man;
+ $order_info->user_id = $user_id;
+ $order_info->status_id = 1;
+ $order_info->id_man = $car_info->car_man;
+ $order_info->link_man = $car_info->car_man;
+ $order_info->link_phone = $car_info->phone;
+ $order_info->save();
+ }
+ $insurer_type_items = InsurerTypeT::find()->all();
+ $insurer_company_items = InsurerCompanyT::find()->all();
+ $insurer_company2_items = InsurerCompany2T::find()->all();
+ $pay_type_items = PayTypeT::find()->all();
+ $success_items = InvalidT::getTree(1);
+ $city_items = CityT::find()->all();
+ $district_items = DistrictT::find()->all();
+
+ return $this->render('order-add',[
+ 'car_id' => $car_id,
+ 'car_info' => $car_info,
+ 'order_info' => $order_info,
+ 'insurer_type_items' => $insurer_type_items,
+ 'insurer_company_items' => $insurer_company_items,
+ 'insurer_company2_items' => $insurer_company2_items,
+ 'pay_type_items' => $pay_type_items,
+ 'success_items' => $success_items,
+ 'city_items' => $city_items,
+ 'district_items' => $district_items
+ ]);
+ }
}
diff --git a/frontend/controllers/InsurerController.php b/frontend/controllers/InsurerController.php
index fde57f7..d037f45 100644
--- a/frontend/controllers/InsurerController.php
+++ b/frontend/controllers/InsurerController.php
@@ -459,6 +459,10 @@ class InsurerController extends BaseController
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
+ $row['factory_model'] = $item->car->factory_model;
+ $row['user_name'] = $item->user?$item->user->getShowName():'';
+ $row['status_name'] = $item->status->name;
+ $row['lock_name'] = $item->lock?$item->lock->getShowName():'';
$data['rows'][] = $row;
}
return $data;
@@ -663,14 +667,18 @@ class InsurerController extends BaseController
* 核保管理-列表
* @return string
*/
- public function actionOfficeMng()
+ public function actionOfficeMng() {
+ return $this->render('office-mng');
+ }
+ public function actionOfficeMngJson()
{
+ Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_man = $request->get('car_man');
$phone = $request->get('phone');
$car_no = $request->get('car_no');
- $page = $request->get('page',1);
- if($page < 1) $page = 1;
+ $offset = $request->get('offset', 0);
+ $limit = $request->get('limit', 10);
$query = OrderT::find()
->where('status_id=2')
@@ -687,105 +695,30 @@ class InsurerController extends BaseController
$query = $query->orderBy('updated_at asc');
$total = $query->count();
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
+ $query = $query->offset($offset)->limit($limit);
$items = $query->all();
- $page_info = MyLib::getPageInfo($pagination);
+ $data = [];
+ $data['total'] = $total;
+ $data['rows'] = [];
+ foreach($items as $item) {
+ $row = $item->toArray();
+ $row['company_name'] = $item->company2?$item->company2->name:'';
+ $row['factory_model'] = $item->car?$item->car->factory_model:'';
+ $row['user_name'] = $item->user?$item->user->getShowName():'';
+ $row['status_name'] = $item->status->name;
+ $row['pay_type'] = ($item->shoufei_id?MyLib::zhifufs($item->shoufei_id).'-':'').' '.($item->payType?$item->payType->name:'');
+ $row['lock_name'] = $item->lock?$item->lock->getShowName():'';
+ $data['rows'][] = $row;
+ }
- return $this->render('office-mng',[
- 'items' => $items,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'page' => $page,
- 'page_info' => $page_info
- ]);
+ return $data;
}
- /**
- * 核保管理-详情
- * @return string
- */
-// public function actionOfficeMngEdit()
-// {
-// $request = Yii::$app->request;
-// $id = $request->get('id',0);
-// $back_params = $request->get('back_params');
-// $order_info = OrderT::findOne(['id'=>$id]);
-// $car_info = $order_info->car;
-//
-// if($order_info->lock_id == 0) {
-// $tran = OrderT::getDb()->beginTransaction();
-// try {
-// $order_info->lock_id = $this->my->id;
-// $order_info->save();
-//
-// $order_user_info = new OrderUserT();
-// $order_user_info->user_id = $this->my->id;
-// $order_user_info->order_id = $order_info->id;
-// $order_user_info->type_id = $order_info->status_id;
-// $order_user_info->status = 0;
-// $order_user_info->save();
-// $tran->commit();
-//
-// } catch (\Exception $e) {
-// $tran->rollBack();
-// throw $e;
-// }
-// } else {
-// if($order_info->lock_id != $this->my->id) {
-// echo '该记录已经被别人锁定,【返回】';
-// exit;
-// }
-// }
-// //礼品
-// $gift_group_items = array();
-// $gift_free_group_items = array();
-// $sel_gifts = array();
-// $tmp_items = OrderGiftT::find()
-// ->where('order_id='.$order_info->id)
-// ->all();
-// foreach($tmp_items as $item) {
-// $gift = $item->gift;
-// if($gift->type == 0)
-// $gift_group_items[] = $gift;
-// else
-// $gift_free_group_items[] = $gift;
-// }
-//
-// $gift_items = CarGiftT::find()
-// ->where('order_id='.$order_info->id)
-// ->orderBy('strategy_id DESC')
-// ->all();
-////echo count($gift_items);
-//
-// $insurer_type_items = InsurerTypeT::find()
-// ->all();
-// $insurer_company_items = InsurerCompanyT::find()
-// ->all();
-// $type_items = GiftType2T::find()->all();
-//
-// return $this->render('office-mng-edit',[
-// 'car_info' => $car_info,
-// 'insurer_type_items' => $insurer_type_items,
-// 'order_info' => $order_info,
-// 'insurer_company_items' => $insurer_company_items,
-// 'gift_items' => $gift_items,
-// 'back_params' => $back_params,
-// 'gift_group_items' => $gift_group_items,
-// 'gift_free_group_items' => $gift_free_group_items,
-// 'sel_gifts' => $sel_gifts,
-// 'type_items' => $type_items
-// ]);
-// }
public function actionOfficeMngEdit()
{
$request = Yii::$app->request;
$id = $request->get('id',0);
- $back_params = $request->get('back_params');
$order_info = OrderT::findOne(['id'=>$id]);
$car_info = $order_info->car;
@@ -800,39 +733,22 @@ class InsurerController extends BaseController
$order_user_info->order_id = $order_info->id;
$order_user_info->type_id = $order_info->status_id;
$order_user_info->status = 0;
- $order_user_info->save();
+ if(!$order_user_info->save()) {
+ throw new \Exception(print_r($order_user_info->getErrors(), true));
+ }
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
- throw $e;
+ echo $e->getMessage();
+ exit;
}
} else {
if($order_info->lock_id != $this->my->id) {
- echo '该记录已经被别人锁定,【返回】';
+ echo '该记录已经被别人锁定,【返回】';
exit;
}
}
- //礼品
- $gift_group_items = array();
- $gift_free_group_items = array();
- $sel_gifts = array();
- $tmp_items = OrderGiftT::find()
- ->where('order_id='.$order_info->id)
- ->all();
- foreach($tmp_items as $item) {
- $gift = $item->gift;
- if($gift->type == 0)
- $gift_group_items[] = $gift;
- else
- $gift_free_group_items[] = $gift;
- }
-
- $gift_items = CarGiftT::find()
- ->where('order_id='.$order_info->id)
- ->orderBy('strategy_id DESC')
- ->all();
-//echo count($gift_items);
$insurer_type_items = InsurerTypeT::find()
->all();
@@ -840,7 +756,6 @@ class InsurerController extends BaseController
->all();
$payee_items=PayeeT::find()->all();
$payment_items=Payment::find()->all();
- $type_items = GiftType2T::find()->all();
return $this->render('office-mng-edit',[
'car_info' => $car_info,
@@ -849,11 +764,6 @@ class InsurerController extends BaseController
'insurer_company_items' => $insurer_company_items,
'payee_items' => $payee_items,
'payment_items' => $payment_items,
- 'gift_items' => $gift_items,
- 'back_params' => $back_params,
- 'gift_group_items' => $gift_group_items,
- 'gift_free_group_items' => $gift_free_group_items,
- 'sel_gifts' => $sel_gifts,
'type_items' => $type_items
]);
}
@@ -875,19 +785,24 @@ class InsurerController extends BaseController
$tran = OrderT::getDb()->beginTransaction();
try {
$order_info->lock_id = 0;
- $order_info->save();
- $result['success'] = true;
+ if(!$order_info->save()) {
+ throw new \Exception(print_r($order_info->getErrors(), true));
+ }
$order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'status'=>0]);
if($order_user_info) {
$order_user_info->status = 4; //放弃操作
- $order_user_info->save();
+ if(!$order_user_info->save()) {
+ throw new \Exception(print_r($order_user_info->getErrors(), true));
+ }
}
+ $result['success'] = true;
+ $result['msg'] = '操作成功';
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
- throw $e;
+ $result['msg'] = $e->getMessage();
}
}
return $result;
@@ -898,117 +813,6 @@ class InsurerController extends BaseController
* @return array
* @throws \Exception
*/
-// public function actionOfficeMngSave()
-// {
-// Yii::$app->response->format = Response::FORMAT_JSON;
-// $request = Yii::$app->request;
-// $result = array();
-// $result['success'] = false;
-// $result['msg'] = '保存失败';
-//
-// if($request->isPost) {
-// $car_id = $request->post('car_id',0);
-// $order_id = $request->post('order_id',0);
-// $status_id = $request->post('status_id',2);
-// $total1_rate = $request->post('total1_rate','0.00');
-// $total2_rate = $request->post('total2_rate','0.00');
-// $pay_no = $request->post('pay_no',0);
-// $company_id = $request->post('company_id',0);
-//
-// if($total1_rate == '') {
-// $result['msg'] = '请输入商业跟单手续费!';
-// return $result;
-// }
-// if($total2_rate == '') {
-// $result['msg'] = '请输入交强跟单手续费!';
-// return $result;
-// }
-// if($company_id == '') {
-// $result['msg'] = '请选择保险公司!';
-// return $result;
-// }
-// if($pay_no == '') {
-// $result['msg'] = '请输入缴费单号';
-// return $result;
-// }
-//
-// $tran = OrderT::getDb()->beginTransaction();
-// try {
-// $order_info = OrderT::findOne(['id'=>$order_id]);
-// if(empty($order_info)) {
-// $result['msg'] = '保单错误!';
-// return $result;
-// }
-// //更新车辆车牌号
-// $car_info = $order_info->car;
-// $car_info->car_no = $order_info->car_no;
-// $car_info->save();
-//
-// $old_status_id = $order_info->status_id;
-// $order_info->total1_rate = $total1_rate;
-// $order_info->total2_rate = $total2_rate;
-// $order_info->company_id = $company_id;
-// $order_info->pay_no = $pay_no;
-//
-// $order_info->status_id = $status_id;
-//
-// //如果是在线支付和自上门,更改订单状态
-//
-//
-//// echo '';
-//// print_r($old_status_id);
-//// echo '
';
-//// print_r($status_id);
-//// die;
-//
-//
-//
-// if($status_id > $old_status_id) {
-// if($order_info->shoufei_id ==2 || $order_info->shoufei_id ==3){
-//
-// $order_info->status_id = 5;
-// }
-// $order_info->op1_id = $this->my->id;
-//
-//// echo '
';
-// $order_info->lock_id = 0;
-// if($order_info->shoufei_id ==2){
-// $this->addLog($car_id,'核保结束,在线支付,直接进入正本生成',1);
-//// echo 1;
-// }elseif( $order_info->shoufei_id ==3){
-// $this->addLog($car_id,'核保结束,客户自上门,直接进入正本生成',1);
-//// echo 2;
-// } else{
-// $this->addLog($car_id,'核保结束,进入配送调度',1);
-//// echo 3;
-// }
-//// echo '
';
-//// print_r($order_info->status_id);
-//// print_r($status_id);
-//// print_r($old_status_id);
-//// die;
-//
-// //处理操作人员状态
-// $order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]);
-// if($order_user_info) {
-// $order_user_info->status = 1; //操作结束
-// $order_user_info->save();
-// }
-// }
-// $order_info->save();
-//
-// $tran->commit();
-//
-// } catch(\Exception $e) {
-// $tran->rollBack();
-// throw $e;
-// }
-//
-// $result['success'] = true;
-// $result['msg'] = '保存成功';
-// }
-// return $result;
-// }
public function actionOfficeMngSave()
{
Yii::$app->response->format = Response::FORMAT_JSON;
@@ -1025,8 +829,6 @@ class InsurerController extends BaseController
$total2_rate = $request->post('total2_rate','0.00');
$pay_no = $request->post('pay_no',0);
$company_id = $request->post('company_id',0);
- $payee_id = $request->post('payee_id');
- $payment_id = $request->post('payment_id');
if($total1_rate == '') {
$result['msg'] = '请输入商业跟单手续费!';
@@ -1377,64 +1179,21 @@ class InsurerController extends BaseController
* 正本管理-列表
* @return string
*/
-// public function actionOriginalMng()
-// {
-// $request = Yii::$app->request;
-// $id_man = $request->get('id_man');
-// $phone = $request->get('phone');
-// $car_no = $request->get('car_no');
-// $send_date = $request->get('send_date');
-// $page = $request->get('page',1);
-// if($page < 1) $page = 1;
-//
-// $query = OrderT::find()
-// ->where('status_id=5 or status_id=6 or status_id=7 or status_id=8')
-// ->orderBy('submit_date DESC, id DESC');
-// if($id_man != '') {
-// $query = $query->andWhere('id_man="'.$id_man.'"');
-// }
-// if($phone != '') {
-// $query = $query->andWhere('link_phone="'.$phone.'"');
-// }
-// if($car_no != '') {
-// $query = $query->andWhere('car_no="'.$car_no.'"');
-// }
-// if($send_date != '') {
-// $query = $query->andWhere('send_date="'.$send_date.'"');
-// }
-// $query = $query->orderBy('updated_at ASC');
-// $total = $query->count();
-//
-// $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
-// $pagination->setPage($page-1);
-//
-// $query = $query->offset($pagination->offset)->limit($pagination->limit);
-// $items = $query->all();
-//
-// $page_info = MyLib::getPageInfo($pagination);
-//
-//
-// return $this->render('original-mng',[
-// 'items' => $items,
-// 'id_man' => $id_man,
-// 'phone' => $phone,
-// 'car_no' => $car_no,
-// 'send_date' => $send_date,
-// 'page' => $page,
-// 'page_info' => $page_info
-// ]);
-// }
- public function actionOriginalMng()
+ public function actionOriginalMng() {
+ return $this->render('original-mng');
+ }
+ public function actionOriginalMngJson()
{
+ Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$id_man = $request->get('id_man');
$phone = $request->get('phone');
$car_no = $request->get('car_no');
$send_date = $request->get('send_date');
- $page = $request->get('page',1);
$payee_id = $request->get('payee_id');
$payment_id = $request->get('payment_id');
- if($page < 1) $page = 1;
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit',10);
$query = OrderT::find()
->where('status_id=5')
@@ -1460,140 +1219,58 @@ class InsurerController extends BaseController
$query = $query->orderBy('updated_at ASC');
$total = $query->count();
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
+ $query = $query->offset($offset)->limit($limit);
$items = $query->all();
- $page_info = MyLib::getPageInfo($pagination);
- $payee_items=PayeeT::find()->all();
- $payment_items=Payment::find()->all();
- return $this->render('original-mng',[
- 'items' => $items,
- 'payee_items' => $payee_items,
- 'payment_items' => $payment_items,
- 'payee_id' => $payee_id,
- 'payment_id' => $payment_id,
- 'id_man' => $id_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'send_date' => $send_date,
- 'page' => $page,
- 'page_info' => $page_info
- ]);
+ $data = [];
+ $data['total'] = $total;
+ $data['rows'] = [];
+ foreach($items as $item) {
+ $row = $item->toArray();
+ $row['company_name'] = $item->company->name;
+ $row['user_name'] = $item->user?$item->user->getShowName():'';
+ $row['status_name'] = $item->status->name;
+ $row['pay_type'] = ($item->shoufei_id?MyLib::zhifufs($item->shoufei_id).'-':'').' '.($item->payType?$item->payType->name:'');
+ $row['lock_name'] = $item->lock?$item->lock->getShowName():'';
+ $data['rows'][] = $row;
+ }
+
+ return $data;
+
}
/**
* 正本管理-详情
* @return string
*/
+ public function actionOriginalMngEdit()
+ {
+ $request = Yii::$app->request;
+ $id = $request->get('id',0);
+ $back_params = $request->get('back_params');
+ $order_info = OrderT::findOne(['id'=>$id]);
+ $car_info = $order_info->car;
-
-// public function actionOriginalMngEdit()
-// {
-// $request = Yii::$app->request;
-// $id = $request->get('id',0);
-// $back_params = $request->get('back_params');
-// $order_info = OrderT::findOne(['id'=>$id]);
-// $car_info = $order_info->car;
-//
-// if($order_info->lock_id == 0) {
-// $tran = OrderT::getDb()->beginTransaction();
-// try {
-// $order_info->lock_id = $this->my->id;
-// $order_info->save();
-//
-// $order_user_info = new OrderUserT();
-// $order_user_info->user_id = $this->my->id;
-// $order_user_info->order_id = $order_info->id;
-// $order_user_info->type_id = $order_info->status_id;
-// $order_user_info->status = 0;
-// $order_user_info->save();
-//
-// $tran->commit();
-// } catch (\Exception $e) {
-// $tran->rollBack();
-// throw $e;
-// }
-// } else {
-// if($order_info->lock_id != $this->my->id) {
-// echo '该记录已经被别人锁定,【返回】';
-// exit;
-// }
-// }
-//
-// //礼品
-// $gift_group_items = array();
-// $gift_free_group_items = array();
-// //获取礼品数据
-// $sel_gifts = array();
-// $tmp_items = OrderGiftT::find()
-// ->where('order_id='.$order_info->id)
-// ->all();
-// foreach($tmp_items as $item) {
-// $gift_info = $item->gift;
-// if($gift_info->type == 1) {
-// $gift_free_group_items[] = $gift_info;
-// } else {
-// $gift_group_items[] = $gift_info;
-// }
-// $sel_gifts[$item->group_id] = $item;
-// }
-//
-// $gift_items = CarGiftT::find()
-// ->where('order_id='.$order_info->id)
-// ->orderBy('strategy_id DESC')
-// ->all();
-//
-// $insurer_type_items = InsurerTypeT::find()
-// ->all();
-// $insurer_company_items = InsurerCompanyT::find()
-// ->all();
-//
-// $type_items = GiftType2T::find()->all();
-// $payee_items=PayeeT::find()->all();
-// $payment_items=Payment::find()->all();
-// return $this->render('original-mng-edit',[
-// 'car_info' => $car_info,
-// 'insurer_type_items' => $insurer_type_items,
-// 'order_info' => $order_info,
-// 'insurer_company_items' => $insurer_company_items,
-// 'payee_items' => $payee_items,
-// 'payment_items' => $payment_items,
-// 'gift_items' => $gift_items,
-// 'back_params' => $back_params,
-// 'gift_group_items' => $gift_group_items,
-// 'gift_free_group_items' => $gift_free_group_items,
-// 'sel_gifts' => $sel_gifts,
-// 'type_items' => $type_items
-// ]);
-// }
- public function actionOriginalMngEdit()
- {
- $request = Yii::$app->request;
- $id = $request->get('id',0);
- $back_params = $request->get('back_params');
- $order_info = OrderT::findOne(['id'=>$id]);
- $car_info = $order_info->car;
-
- if($order_info->lock_id == 0) {
- $tran = OrderT::getDb()->beginTransaction();
- try {
- $order_info->lock_id = $this->my->id;
- $order_info->save();
+ if($order_info->lock_id == 0) {
+ $tran = OrderT::getDb()->beginTransaction();
+ try {
+ $order_info->lock_id = $this->my->id;
+ $order_info->save();
$order_user_info = new OrderUserT();
$order_user_info->user_id = $this->my->id;
$order_user_info->order_id = $order_info->id;
$order_user_info->type_id = $order_info->status_id;
$order_user_info->status = 0;
- $order_user_info->save();
+ if(!$order_user_info->save()) {
+ throw new \Exception(print_r($order_user_info->getErrors(), true));
+ }
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
- throw $e;
+ echo $e->getMessage();
+ exit;
}
} else {
if($order_info->lock_id != $this->my->id) {
@@ -1602,29 +1279,6 @@ class InsurerController extends BaseController
}
}
- //礼品
- $gift_group_items = array();
- $gift_free_group_items = array();
- //获取礼品数据
- $sel_gifts = array();
- $tmp_items = OrderGiftT::find()
- ->where('order_id='.$order_info->id)
- ->all();
- foreach($tmp_items as $item) {
- $gift_info = $item->gift;
- if($gift_info->type == 1) {
- $gift_free_group_items[] = $gift_info;
- } else {
- $gift_group_items[] = $gift_info;
- }
- $sel_gifts[$item->group_id] = $item;
- }
-
- $gift_items = CarGiftT::find()
- ->where('order_id='.$order_info->id)
- ->orderBy('strategy_id DESC')
- ->all();
-
$insurer_type_items = InsurerTypeT::find()
->all();
$insurer_company_items = InsurerCompanyT::find()
@@ -1640,11 +1294,6 @@ class InsurerController extends BaseController
'insurer_company_items' => $insurer_company_items,
'payee_items' => $payee_items,
'payment_items' => $payment_items,
- 'gift_items' => $gift_items,
- 'back_params' => $back_params,
- 'gift_group_items' => $gift_group_items,
- 'gift_free_group_items' => $gift_free_group_items,
- 'sel_gifts' => $sel_gifts,
'type_items' => $type_items
]);
}
@@ -1653,583 +1302,6 @@ class InsurerController extends BaseController
* @return array
* @throws \Exception
*/
-
-
-// public function actionOriginalMngSave()
-// {
-// 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);
-// $status_id = $request->post('status_id',0);
-// $insurer1_no = $request->post('insurer1_no');
-// $insurer2_no = $request->post('insurer2_no');
-// $payer = $request->post('payer');
-// $gifts = $request->post('gifts',array());
-// $gift_types = $request->post('gift_types',array());
-// $payee_id = $request->post('payee_id');
-// $payment_id = $request->post('payment_id');
-//
-// if($insurer1_no == '' && $insurer2_no == '') {
-// $result['msg'] = '请输入商业或交强保单号!';
-// return $result;
-// }
-// //去除首位空格和字符串中间的空格
-// $insurer1_no= trim($insurer1_no);
-// $insurer1_no=str_replace(" ","",$insurer1_no);
-// $insurer2_no= trim($insurer2_no);
-// $insurer2_no=str_replace(" ","",$insurer2_no);
-//
-// $tran = OrderT::getDb()->beginTransaction();
-// try {
-// $order_info = OrderT::findOne(['id'=>$order_id]);
-// if(empty($order_info)) {
-// $result['msg'] = '保单错误!';
-// return $result;
-// }
-//
-// $old_status_id = $order_info->status_id;
-// $order_info->insurer1_no = $insurer1_no;
-// $order_info->insurer2_no = $insurer2_no;
-// $order_info->payee_id = $payee_id;
-// $order_info->payment_id = $payment_id;
-// $order_info->status_id = $status_id;
-// $order_info->payer = $payer;
-// if($status_id == 10) {
-// $order_info->op2_id = $this->my->id;
-// $order_info->lock_id = 0;
-// $order_info->print_date = date('Y-m-d');
-// }
-// $order_info->save();
-//
-// if($status_id == 10) {
-// //礼品处理
-// $car_no = $order_info->car_no;
-//// var_dump($gifts);
-//// die;
-// foreach ($gifts as $gift_id => $code) {
-// $gift_info = GiftType3T::findOne(['id'=>$gift_id]);
-//
-// $type_id = $gift_types[$gift_id];
-// $type_info = GiftType2T::findOne(['id'=>$type_id]);
-// if(!$type_info) continue;
-// if($code == '') continue;
-//// echo $gift_id;
-//// var_dump($type_id);
-//
-// if(is_array($code)){
-//
-//// var_dump($code);
-// foreach ($code as $vs) {
-//
-// $ticket_info = GiftTicketT::findOne(['code'=>$vs,'type_id'=>$type_id]);
-// if(!$ticket_info) {
-// $result['msg'] = $type_info->name.' 礼品编号不存在!';
-// return $result;
-// }
-// if($ticket_info->status != 0) {
-// $result['msg'] = $type_info->name.' 礼品编号已经出库!';
-// return $result;
-// }
-// $ticket_info->group_id = $gift_id;
-// $ticket_info->car_no = $car_no;
-// $ticket_info->status = 1;
-// $ticket_info->use_date = date('Y-m-d H:i:s');
-// $ticket_info->op_id = $this->my->id;
-// if(!$ticket_info->save()) {
-// var_dump($ticket_info->errors);
-// }
-//
-// }
-//
-// }
-//
-// }
-//// die;
-//// var_dump($gifts);
-//// die;
-//// foreach($gifts as $gift_id => $code) {
-//// if($code == '') continue;
-//// $gift_info = GiftType3T::findOne(['id'=>$gift_id]);
-//// $type_id = $gift_types[$gift_id];
-//// $type_info = GiftType2T::findOne(['id'=>$type_id]);
-//// $ticket_info = GiftTicketT::findOne(['code'=>$code,'type_id'=>$type_id]);
-//// if(!$ticket_info) {
-//// $result['msg'] = $type_info->name.' 礼品编号不存在!';
-//// return $result;
-//// }
-//// if($ticket_info->status != 0) {
-//// $result['msg'] = $type_info->name.' 礼品编号已经出库!';
-//// return $result;
-//// }
-//// $ticket_info->group_id = $gift_id;
-//// $ticket_info->car_no = $car_no;
-//// $ticket_info->status = 1;
-//// $ticket_info->use_date = date('Y-m-d H:i:s');
-//// $ticket_info->op_id = $this->my->id;
-//// if(!$ticket_info->save()) {
-//// var_dump($ticket_info->errors);
-//// }
-//// }
-//// dd($order_info->company->name);
-//// if($order_info->company_id && ($order_info->company_id !='10'|| $order_info->company_id !='11')){
-// if($order_info->company_id && $order_info->company->difc !='2'){
-//
-//
-// //财务处理
-// CaiwuT::deleteAll(['order_id'=>$order_info->id]);
-// //商业
-// if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
-// $row = null;
-// CaiwuT::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
-// $row = new CaiwuT();
-// $row->insurer_no = $order_info->insurer1_no;
-// $row->car_no = $order_info->car_no;
-// $row->factory_model = $order_info->car->factory_model;
-// $row->id_man = $order_info->id_man;
-// $row->total = sprintf("%.2f",$order_info->total1);
-// $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
-// $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
-// $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
-// $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
-// $row->total_rate = $order_info->total1_rate;
-// $row->total_dis = $row->total_clear_real;
-// $row->user_id = $order_info->user_id;
-// $row->status = 0;
-// $row->insurer_type = 1;
-// $row->order_id = $order_info->id;
-// if(!$row->save()) {
-// var_dump($row->errors);
-// exit;
-// }
-// }
-//
-// //交强
-// if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
-// $row = null;
-// CaiwuT::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
-// $row = new CaiwuT();
-// $row->insurer_no = $order_info->insurer2_no;
-// $row->car_no = $order_info->car_no;
-// $row->factory_model = $order_info->car->factory_model;
-// $row->id_man = $order_info->id_man;
-// $row->total = sprintf("%.2f",$order_info->total2);
-// $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
-// $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
-// $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
-// $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
-// $row->total_rate = $order_info->total2_rate;
-// $row->total_dis = $row->total_clear_real;
-// $row->user_id = $order_info->user_id;
-// $row->status = 0;
-// $row->insurer_type = 2;
-// $row->order_id = $order_info->id;
-// $row->save();
-// }
-// }else{
-// //财务处理
-// CaiwuT1::deleteAll(['order_id'=>$order_info->id]);
-//
-// //商业
-// if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
-// $row = null;
-// CaiwuT1::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
-// $row = new CaiwuT1();
-// $row->insurer_no = $order_info->insurer1_no;
-// $row->car_no = $order_info->car_no;
-// $row->factory_model = $order_info->car->factory_model;
-// $row->id_man = $order_info->id_man;
-// $row->total = sprintf("%.2f",$order_info->total1);
-// $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
-// $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
-// $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
-// $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
-// $row->total_rate = $order_info->total1_rate;
-// $row->total_dis = sprintf("%.2f",($order_info->total1 * $order_info->total1_rate/100));
-// $row->user_id = $order_info->user_id;
-// $row->status = 0;
-// $row->insurer_type = 1;
-// $row->order_id = $order_info->id;
-// $row->save();
-// $this->addLog($order_info->car_id,'特殊保险公司-商业险提交到回单匹配1',1);
-// }
-//
-// //交强
-// if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
-// $row = null;
-// CaiwuT1::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
-// $row = new CaiwuT1();
-// $row->insurer_no = $order_info->insurer2_no;
-// $row->car_no = $order_info->car_no;
-// $row->factory_model = $order_info->car->factory_model;
-// $row->id_man = $order_info->id_man;
-// $row->total = sprintf("%.2f",$order_info->total2);
-// $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
-// $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
-// $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
-// $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
-// $row->total_rate = $order_info->total2_rate;
-// $row->total_dis = sprintf("%.2f",($order_info->total2 * $order_info->total2_rate/100));
-// $row->user_id = $order_info->user_id;
-// $row->status = 0;
-// $row->insurer_type = 2;
-// $row->order_id = $order_info->id;
-// $row->save();
-// $this->addLog($order_info->car_id,'特殊保险公司-交强险提交到回单匹配1',1);
-// }
-//// $this->addLog($order_info->car_id,'特殊保险公司提交到回单匹配1',1);
-// }
-//
-// //生成财务分支 修改日期2018/5/18
-// $order_caiwu = OrderCaiwuT::findOne(['order_id'=>$order_info->id]);
-// if(!$order_caiwu) {
-// $order_caiwu = new OrderCaiwuT();
-// $order_caiwu->order_id = $order_info->id;
-// $order_caiwu->status_id = 12;
-// $order_caiwu->pay_date = substr($order_info->print_date,0,7);
-// $order_caiwu->save();
-// }else{
-// $order_caiwu->status_id = 12;
-// $order_caiwu->pay_date = substr($order_info->print_date,0,7);
-// $order_caiwu->save();
-// }
-// //B->C 或 D->C
-// $car_info = CarT::findOne(['id'=>$order_info->car_id]);
-// //如果是续保
-// if($car_info->location==4){
-// //查找上一年的保单
-// $near_info= OrderT::find()->where(['car_no'=>$order_info->car_no])
-// ->andWhere(['status_id'=>10])
-// ->andWhere(['<', 'submit_date', $order_info->submit_date])
-// ->orderBy('created_at desc')->one();
-// if($near_info){
-// $car_info->op_user1 = $near_info->user->getShowName();
-// $this->addLog($order_info->car_id,'续保数据更新新保操作员',1);
-// }
-// }
-// $car_info->location = 3;
-// $car_info->print_date = date('Y-m-d');
-// $car_info->user_id = 0;
-// //更新保险日期
-// $car_info->insurer1_date = $order_info->insurer1_end_date;
-// $car_info->insurer2_date = $order_info->insurer2_end_date;
-// //续保次数
-// $car_info->xubao_num=$car_info->xubao_num+1;
-// $car_info->save();
-//
-// CarBT::deleteAll(['id'=>$car_info->id]);
-// CarDT::deleteAll(['id'=>$car_info->id]);
-//
-// $c_info = CarCT::findOne(['id'=>$car_info->id]);
-// if(!$c_info) {
-// $c_info = new CarCT();
-// $c_info->id = $car_info->id;
-// $c_info->user_id = 0;
-// $c_info->save();
-// }
-// $this->addLog($order_info->car_id,'正本生成,流程结束',1);
-//
-// //处理操作人员状态
-// $order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]);
-// if($order_user_info) {
-// $order_user_info->status = 1; //操作结束
-// $order_user_info->save();
-// }
-// }
-// $result['success'] = true;
-// $result['msg'] = '保存成功';
-// $tran->commit();
-//
-// } catch(\Exception $e) {
-// $tran->rollBack();
-// throw $e;
-// }
-// }
-// return $result;
-// }
-
-
-
-// public function actionOriginalMngSave()
-// {
-// 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);
-// $status_id = $request->post('status_id',0);
-// $insurer1_no = $request->post('insurer1_no');
-// $insurer2_no = $request->post('insurer2_no');
-// $payer = $request->post('payer');
-// $gifts = $request->post('gifts',array());
-// $gift_types = $request->post('gift_types',array());
-// $payee_id = $request->post('payee_id');
-// $payment_id = $request->post('payment_id');
-// //上传商业和交强文件
-//// $urlfile= $request->post('urlfile');
-//// $urlfile1= $request->post('urlfile1');
-////
-//// if(substr($urlfile,-3)!='pdf' && substr($urlfile1,-3)!='pdf'){
-//// $result['msg'] = '请上传正确的商业或交强pdf文件';
-//// return $result;
-//// }
-//// $urlfile= trim($urlfile);
-//// $urlfile1= trim($urlfile1);
-//
-// if($insurer1_no == '' && $insurer2_no == '') {
-// $result['msg'] = '请输入商业或交强保单号!';
-// return $result;
-// }
-// //去除首位空格和字符串中间的空格
-// $insurer1_no= trim($insurer1_no);
-// $insurer1_no=str_replace(" ","",$insurer1_no);
-// $insurer2_no= trim($insurer2_no);
-// $insurer2_no=str_replace(" ","",$insurer2_no);
-//
-//
-// $tran = OrderT::getDb()->beginTransaction();
-// try {
-// $order_info = OrderT::findOne(['id'=>$order_id]);
-// if(empty($order_info)) {
-// $result['msg'] = '保单错误!';
-// return $result;
-// }
-//
-// $old_status_id = $order_info->status_id;
-// $order_info->insurer1_no = $insurer1_no;
-// $order_info->insurer2_no = $insurer2_no;
-// //上传文件
-//// $order_info->shangye_src = $urlfile;
-//// $order_info->jiaoqiang_src = $urlfile1;
-//// $order_info->upload_status = 2;
-//
-//
-// $order_info->payee_id = $payee_id;
-// $order_info->payment_id = $payment_id;
-// $order_info->status_id = $status_id;
-// $order_info->payer = $payer;
-// if($status_id == 8) {
-// $order_info->op2_id = $this->my->id;
-// $order_info->lock_id = 0;
-// $order_info->print_date = date('Y-m-d');
-// }
-// $order_info->save();
-//
-// if($status_id == 8) {
-// //礼品处理
-// $car_no = $order_info->car_no;
-//
-//// die;
-//// var_dump($gifts);
-//// die;
-//// foreach($gifts as $gift_id => $code) {
-//// if($code == '') continue;
-//// $gift_info = GiftType3T::findOne(['id'=>$gift_id]);
-//// $type_id = $gift_types[$gift_id];
-//// $type_info = GiftType2T::findOne(['id'=>$type_id]);
-//// $ticket_info = GiftTicketT::findOne(['code'=>$code,'type_id'=>$type_id]);
-//// if(!$ticket_info) {
-//// $result['msg'] = $type_info->name.' 礼品编号不存在!';
-//// return $result;
-//// }
-//// if($ticket_info->status != 0) {
-//// $result['msg'] = $type_info->name.' 礼品编号已经出库!';
-//// return $result;
-//// }
-//// $ticket_info->group_id = $gift_id;
-//// $ticket_info->car_no = $car_no;
-//// $ticket_info->status = 1;
-//// $ticket_info->use_date = date('Y-m-d H:i:s');
-//// $ticket_info->op_id = $this->my->id;
-//// if(!$ticket_info->save()) {
-//// var_dump($ticket_info->errors);
-//// }
-//// }
-//// dd($order_info->company->name);
-//// if($order_info->company_id && ($order_info->company_id !='10'|| $order_info->company_id !='11')){
-// if($order_info->company_id && $order_info->company->difc !='2'){
-//
-// //财务处理
-// CaiwuT::deleteAll(['order_id'=>$order_info->id]);
-// //商业
-// if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
-// $row = null;
-// CaiwuT::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
-// $row = new CaiwuT();
-// $row->insurer_no = $order_info->insurer1_no;
-// $row->car_no = $order_info->car_no;
-// $row->factory_model = $order_info->car->factory_model;
-// $row->id_man = $order_info->id_man;
-// $row->total = sprintf("%.2f",$order_info->total1);
-// $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
-// $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
-// $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
-// $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
-// $row->total_rate = $order_info->total1_rate;
-// $row->total_dis = $row->total_clear_real;
-// $row->user_id = $order_info->user_id;
-// $row->status = 0;
-// $row->insurer_type = 1;
-// $row->order_id = $order_info->id;
-// if(!$row->save()) {
-// var_dump($row->errors);
-// exit;
-// }
-// }
-//
-// //交强
-// if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
-// $row = null;
-// CaiwuT::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
-// $row = new CaiwuT();
-// $row->insurer_no = $order_info->insurer2_no;
-// $row->car_no = $order_info->car_no;
-// $row->factory_model = $order_info->car->factory_model;
-// $row->id_man = $order_info->id_man;
-// $row->total = sprintf("%.2f",$order_info->total2);
-// $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
-// $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
-// $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
-// $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
-// $row->total_rate = $order_info->total2_rate;
-// $row->total_dis = $row->total_clear_real;
-// $row->user_id = $order_info->user_id;
-// $row->status = 0;
-// $row->insurer_type = 2;
-// $row->order_id = $order_info->id;
-// $row->save();
-// }
-// }else{
-// //财务处理
-// CaiwuT1::deleteAll(['order_id'=>$order_info->id]);
-//
-// //商业
-// if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
-// $row = null;
-// CaiwuT1::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
-// $row = new CaiwuT1();
-// $row->insurer_no = $order_info->insurer1_no;
-// $row->car_no = $order_info->car_no;
-// $row->factory_model = $order_info->car->factory_model;
-// $row->id_man = $order_info->id_man;
-// $row->total = sprintf("%.2f",$order_info->total1);
-// $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
-// $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
-// $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
-// $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
-// $row->total_rate = $order_info->total1_rate;
-// $row->total_dis = sprintf("%.2f",($order_info->total1 * $order_info->total1_rate/100));
-// $row->user_id = $order_info->user_id;
-// $row->status = 0;
-// $row->insurer_type = 1;
-// $row->order_id = $order_info->id;
-// $row->save();
-// $this->addLog($order_info->car_id,'特殊保险公司-商业险提交到回单匹配1',1);
-// }
-//
-// //交强
-// if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
-// $row = null;
-// CaiwuT1::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
-// $row = new CaiwuT1();
-// $row->insurer_no = $order_info->insurer2_no;
-// $row->car_no = $order_info->car_no;
-// $row->factory_model = $order_info->car->factory_model;
-// $row->id_man = $order_info->id_man;
-// $row->total = sprintf("%.2f",$order_info->total2);
-// $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
-// $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
-// $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
-// $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
-// $row->total_rate = $order_info->total2_rate;
-// $row->total_dis = sprintf("%.2f",($order_info->total2 * $order_info->total2_rate/100));
-// $row->user_id = $order_info->user_id;
-// $row->status = 0;
-// $row->insurer_type = 2;
-// $row->order_id = $order_info->id;
-// $row->save();
-// $this->addLog($order_info->car_id,'特殊保险公司-交强险提交到回单匹配1',1);
-// }
-//
-// }
-//
-// //生成财务分支 修改日期2018/5/18
-// $order_caiwu = OrderCaiwuT::findOne(['order_id'=>$order_info->id]);
-// if(!$order_caiwu) {
-// $order_caiwu = new OrderCaiwuT();
-// $order_caiwu->order_id = $order_info->id;
-// $order_caiwu->status_id = 12;
-// $order_caiwu->pay_date = substr($order_info->print_date,0,7);
-// $order_caiwu->save();
-// }else{
-// $order_caiwu->status_id = 12;
-// $order_caiwu->pay_date = substr($order_info->print_date,0,7);
-// $order_caiwu->save();
-// }
-// //B->C 或 D->C
-// $car_info = CarT::findOne(['id'=>$order_info->car_id]);
-// //如果是续保
-// if($car_info->location==4){
-// //查找上一年的保单
-// $near_info= OrderT::find()->where(['car_no'=>$order_info->car_no])
-// ->andWhere(['status_id'=>10])
-// ->andWhere(['<', 'submit_date', $order_info->submit_date])
-// ->orderBy('created_at desc')->one();
-// if($near_info){
-// $car_info->op_user1 = $near_info->user->getShowName();
-// $this->addLog($order_info->car_id,'续保数据更新新保操作员',1);
-// }
-// }
-//
-// $car_info->location = 3;
-// $car_info->print_date = date('Y-m-d');
-//
-//
-// $car_info->user_id = 0;
-// //更新保险日期
-// $car_info->insurer1_date = $order_info->insurer1_end_date;
-// $car_info->insurer2_date = $order_info->insurer2_end_date;
-// //续保次数
-// $car_info->xubao_num=$car_info->xubao_num+1;
-// $car_info->save();
-//
-// CarBT::deleteAll(['id'=>$car_info->id]);
-// CarDT::deleteAll(['id'=>$car_info->id]);
-//
-// $c_info = CarCT::findOne(['id'=>$car_info->id]);
-// if(!$c_info) {
-// $c_info = new CarCT();
-// $c_info->id = $car_info->id;
-// $c_info->user_id = 0;
-// $c_info->save();
-// }
-// $this->addLog($order_info->car_id,'正本生成结束,下一步操作正本配送',1);
-//
-// //处理操作人员状态
-// $order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]);
-// if($order_user_info) {
-// $order_user_info->status = 1; //操作结束
-// $order_user_info->save();
-// }
-// }
-// $result['success'] = true;
-// $result['msg'] = '保存成功';
-// $tran->commit();
-//
-// } catch(\Exception $e) {
-// $tran->rollBack();
-// throw $e;
-// }
-// }
-// return $result;
-// }
public function actionOriginalMngSave()
{
Yii::$app->response->format = Response::FORMAT_JSON;
@@ -2252,10 +1324,10 @@ class InsurerController extends BaseController
$urlfile= $request->post('urlfile');
$urlfile1= $request->post('urlfile1');
- if(substr($urlfile,-3)!='pdf' && substr($urlfile1,-3)!='pdf'){
- $result['msg'] = '请上传正确的商业或交强pdf文件';
- return $result;
- }
+// if(substr($urlfile,-3)!='pdf' && substr($urlfile1,-3)!='pdf'){
+// $result['msg'] = '请上传正确的商业或交强pdf文件';
+// return $result;
+// }
$urlfile= trim($urlfile);
$urlfile1= trim($urlfile1);
@@ -2296,144 +1368,61 @@ class InsurerController extends BaseController
$order_info->lock_id = 0;
$order_info->print_date = date('Y-m-d');
}
- $order_info->save();
+ if(!$order_info->save()) {
+ throw new \Exception(print_r($order_info->getErrors(), true));
+ }
if($status_id == 10) {
- //礼品处理
- $car_no = $order_info->car_no;
-
-// die;
-// var_dump($gifts);
-// die;
-// foreach($gifts as $gift_id => $code) {
-// if($code == '') continue;
-// $gift_info = GiftType3T::findOne(['id'=>$gift_id]);
-// $type_id = $gift_types[$gift_id];
-// $type_info = GiftType2T::findOne(['id'=>$type_id]);
-// $ticket_info = GiftTicketT::findOne(['code'=>$code,'type_id'=>$type_id]);
-// if(!$ticket_info) {
-// $result['msg'] = $type_info->name.' 礼品编号不存在!';
-// return $result;
-// }
-// if($ticket_info->status != 0) {
-// $result['msg'] = $type_info->name.' 礼品编号已经出库!';
-// return $result;
-// }
-// $ticket_info->group_id = $gift_id;
-// $ticket_info->car_no = $car_no;
-// $ticket_info->status = 1;
-// $ticket_info->use_date = date('Y-m-d H:i:s');
-// $ticket_info->op_id = $this->my->id;
-// if(!$ticket_info->save()) {
-// var_dump($ticket_info->errors);
-// }
-// }
-// dd($order_info->company->name);
-// if($order_info->company_id && ($order_info->company_id !='10'|| $order_info->company_id !='11')){
- if($order_info->company_id && $order_info->company->difc !='2'){
-
- //财务处理
- CaiwuT::deleteAll(['order_id'=>$order_info->id]);
- //商业
- if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
- $row = null;
- CaiwuT::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
- $row = new CaiwuT();
- $row->insurer_no = $order_info->insurer1_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total1);
- $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
- $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
- $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
- $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
- $row->total_rate = $order_info->total1_rate;
- $row->total_dis = $row->total_clear_real;
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 1;
- $row->order_id = $order_info->id;
- if(!$row->save()) {
- var_dump($row->errors);
- exit;
- }
- }
-
- //交强
- if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
- $row = null;
- CaiwuT::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
- $row = new CaiwuT();
- $row->insurer_no = $order_info->insurer2_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total2);
- $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
- $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
- $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
- $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
- $row->total_rate = $order_info->total2_rate;
- $row->total_dis = $row->total_clear_real;
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 2;
- $row->order_id = $order_info->id;
- $row->save();
- }
- }else{
- //财务处理
- CaiwuT1::deleteAll(['order_id'=>$order_info->id]);
-
- //商业
- if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
- $row = null;
- CaiwuT1::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
- $row = new CaiwuT1();
- $row->insurer_no = $order_info->insurer1_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total1);
- $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
- $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
- $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
- $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
- $row->total_rate = $order_info->total1_rate;
- $row->total_dis = sprintf("%.2f",($order_info->total1 * $order_info->total1_rate/100));
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 1;
- $row->order_id = $order_info->id;
- $row->save();
- $this->addLog($order_info->car_id,'特殊保险公司-商业险提交到回单匹配1',1);
+ //财务处理
+ CaiwuT::deleteAll(['order_id'=>$order_info->id]);
+ //商业
+ if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
+ $row = null;
+ CaiwuT::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
+ $row = new CaiwuT();
+ $row->insurer_no = $order_info->insurer1_no;
+ $row->car_no = $order_info->car_no;
+ $row->factory_model = $order_info->car->factory_model;
+ $row->id_man = $order_info->id_man;
+ $row->total = sprintf("%.2f",$order_info->total1);
+ $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
+ $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
+ $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
+ $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
+ $row->total_rate = $order_info->total1_rate;
+ $row->total_dis = $row->total_clear_real;
+ $row->user_id = $order_info->user_id;
+ $row->status = 0;
+ $row->insurer_type = 1;
+ $row->order_id = $order_info->id;
+ if(!$row->save()) {
+ throw new \Exception(print_r($row->getErrors(), true));
}
+ }
- //交强
- if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
- $row = null;
- CaiwuT1::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
- $row = new CaiwuT1();
- $row->insurer_no = $order_info->insurer2_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total2);
- $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
- $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
- $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
- $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
- $row->total_rate = $order_info->total2_rate;
- $row->total_dis = sprintf("%.2f",($order_info->total2 * $order_info->total2_rate/100));
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 2;
- $row->order_id = $order_info->id;
- $row->save();
- $this->addLog($order_info->car_id,'特殊保险公司-交强险提交到回单匹配1',1);
+ //交强
+ if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
+ $row = null;
+ CaiwuT::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
+ $row = new CaiwuT();
+ $row->insurer_no = $order_info->insurer2_no;
+ $row->car_no = $order_info->car_no;
+ $row->factory_model = $order_info->car->factory_model;
+ $row->id_man = $order_info->id_man;
+ $row->total = sprintf("%.2f",$order_info->total2);
+ $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
+ $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
+ $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
+ $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
+ $row->total_rate = $order_info->total2_rate;
+ $row->total_dis = $row->total_clear_real;
+ $row->user_id = $order_info->user_id;
+ $row->status = 0;
+ $row->insurer_type = 2;
+ $row->order_id = $order_info->id;
+ if(!$row->save()) {
+ throw new \Exception(print_r($row->getErrors(), true));
}
-
}
//生成财务分支 修改日期2018/5/18
@@ -2443,11 +1432,15 @@ class InsurerController extends BaseController
$order_caiwu->order_id = $order_info->id;
$order_caiwu->status_id = 12;
$order_caiwu->pay_date = substr($order_info->print_date,0,7);
- $order_caiwu->save();
+ if(!$order_caiwu->save()) {
+ throw new \Exception(print_r($order_caiwu->getErrors(), true));
+ }
}else{
$order_caiwu->status_id = 12;
$order_caiwu->pay_date = substr($order_info->print_date,0,7);
- $order_caiwu->save();
+ if(!$order_caiwu->save()) {
+ throw new \Exception(print_r($order_caiwu->getErrors(), true));
+ }
}
//B->C 或 D->C
$car_info = CarT::findOne(['id'=>$order_info->car_id]);
@@ -2480,7 +1473,9 @@ class InsurerController extends BaseController
$car_info->insurer2_date = $order_info->insurer2_end_date;
//续保次数
$car_info->xubao_num=$car_info->xubao_num+1;
- $car_info->save();
+ if(!$car_info->save()) {
+ throw new \Exception(print_r($car_info->getErrors(), true));
+ }
CarBT::deleteAll(['id'=>$car_info->id]);
CarDT::deleteAll(['id'=>$car_info->id]);
@@ -2490,7 +1485,9 @@ class InsurerController extends BaseController
$c_info = new CarCT();
$c_info->id = $car_info->id;
$c_info->user_id = 0;
- $c_info->save();
+ if(!$c_info->save()) {
+ throw new \Exception(print_r($c_info->getErrors(), true));
+ }
}
$this->addLog($order_info->car_id,'正本生成结束',1);
@@ -2498,7 +1495,9 @@ class InsurerController extends BaseController
$order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]);
if($order_user_info) {
$order_user_info->status = 1; //操作结束
- $order_user_info->save();
+ if(!$order_user_info->save()) {
+ throw new \Exception(print_r($order_user_info->getErrors(), true));
+ }
}
}
$result['success'] = true;
@@ -2507,7 +1506,7 @@ class InsurerController extends BaseController
} catch(\Exception $e) {
$tran->rollBack();
- throw $e;
+ $result['msg'] = $e->getMessage();
}
}
return $result;
diff --git a/frontend/controllers/RenewalController.php b/frontend/controllers/RenewalController.php
index f5b0008..909585a 100644
--- a/frontend/controllers/RenewalController.php
+++ b/frontend/controllers/RenewalController.php
@@ -80,8 +80,18 @@ class RenewalController extends BaseController
}
//首拨
- public function actionFirst()
+ public function actionFirst() {
+ $invalid_items = InvalidT::getTree();
+ $user_items = $this->my->getChildren();
+
+ return $this->render('first',[
+ 'invalid_items' => $invalid_items,
+ 'user_items' => $user_items
+ ]);
+ }
+ public function actionFirstJson()
{
+ Yii::$app->response->format = Response::FORMAT_JSON;
$session = Yii::$app->session;
$request = Yii::$app->request;
$car_man = $request->get('car_man');
@@ -92,25 +102,26 @@ class RenewalController extends BaseController
$sort_key = $request->get('sort_key','appointment_t.pdate');
$sort_value = $request->get('sort_value','ASC');
$user_id = $request->get('user_id');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
- ->where('appointment_t.is_first=1 and car_t.location=4');
+ ->where('appointment_t.is_first=1 and car_t.location=2');
- $user_ids = array();
if($username == '') {
$user_ids = $this->getChildrenUserIDs();
- $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
+ $query->andWhere(['in','appointment_t.user_id',$user_ids]);
}
if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
+ $query->andWhere('car_t.car_man like "'.$car_man.'"');
}
if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
+ $query->andWhere('car_t.phone like "'.$phone.'"');
}
if($car_no != '') {
- $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
+ $query->andWhere('car_t.car_no like "'.$car_no.'"');
}
if($username != '') {
$user_query = UserT::find()
@@ -120,10 +131,10 @@ class RenewalController extends BaseController
$user_ids[] = $user_info->id;
}
if(count($user_ids) > 0)
- $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
+ $query->andWhere(['in','appointment_t.user_id',$user_ids]);
}
if($sort_key != '') {
- $query = $query->orderBy($sort_key.' '.$sort_value.',appointment_t.id '.$sort_value);
+ $query->orderBy($sort_key.' '.$sort_value.',appointment_t.id '.$sort_value);
}
$sql = $query->createCommand()->rawSql;
// echo $query->createCommand()->rawSql;
@@ -131,52 +142,54 @@ class RenewalController extends BaseController
$session->remove('appointment_first');
$session->set('appointment_first',$sql);
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $current_index = $pagination->offset;
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
+ $query = $query->offset($offset)->limit($limit);
$items = $query->all();
- $page_info = MyLib::getPageInfo($pagination);
+ $data = [];
+ $data['total'] = $total;
+ $data['rows'] = [];
+ foreach($items as $item) {
+ $car_info = $item->car;
+ $row = $item->toArray();
+ $row['car_id'] = $car_info->id;
+ $row['car_no'] = $car_info->car_no;
+ $row['car_man'] = $car_info->car_man;
+ $row['register_date'] = $car_info->register_date;
+ $row['insurer1_date'] = $car_info->insurer1_date;
+ $row['insurer2_date'] = $car_info->insurer2_date;
+ $row['user_name'] = $item->user ? $item->user->getShowName():'';
+ $data['rows'][] = $row;
+ }
+ return $data;
+ }
+ //今日预约
+ public function actionToday() {
$invalid_items = InvalidT::getTree();
$user_items = $this->my->getChildren();
- return $this->render('first',[
- 'items' => $items,
- 'page_info' => $page_info,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'page' => $page,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'type' => 1,
+ return $this->render('today',[
'invalid_items' => $invalid_items,
- 'username' => $username,
- 'user_items' => $user_items,
- 'user_id' => $user_id
+ 'user_items' => $user_items
]);
}
-
- //今日预约
- public function actionToday()
+ public function actionTodayJson()
{
+ Yii::$app->response->format = Response::FORMAT_JSON;
$session = Yii::$app->session;
$request = Yii::$app->request;
$car_man = $request->get('car_man');
$phone = $request->get('phone');
$car_no = $request->get('car_no');
- $page = $request->get('page',1);
$sort_key = $request->get('sort_key','appointment_t.pdate');
$sort_value = $request->get('sort_value','ASC');
-
$ptype = $request->get('ptype');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
- ->where('appointment_t.is_first=0 and car_t.location=4')
+ ->where('appointment_t.is_first=0 and car_t.location=2')
->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"');
$user_ids = $this->getChildrenUserIDs();
@@ -189,7 +202,7 @@ class RenewalController extends BaseController
$query = $query->andWhere('car_t.phone="'.$phone.'"');
}
if($ptype > 0) {
- $query = $query->andWhere('appointment_t.ptype="'.$ptype.'"');
+ $query = $query->andWhere('appointment_t.ptype='.$ptype);
}
if($car_no != '') {
$query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
@@ -203,50 +216,56 @@ class RenewalController extends BaseController
$session->remove('appointment_today');
$session->set('appointment_today',$sql);
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
+ $query = $query->offset($offset)->limit($limit);
$items = $query->all();
- $page_info = MyLib::getPageInfo($pagination);
+ $data = [];
+ $data['total'] = $total;
+ $data['rows'] = [];
+ foreach($items as $item) {
+ $car_info = $item->car;
+ $row = $item->toArray();
+ $row['car_id'] = $car_info->id;
+ $row['car_no'] = $car_info->car_no;
+ $row['car_man'] = $car_info->car_man;
+ $row['register_date'] = $car_info->register_date;
+ $row['insurer1_date'] = $car_info->insurer1_date;
+ $row['insurer2_date'] = $car_info->insurer2_date;
+ $row['user_name'] = $item->user ? $item->user->getShowName():'';
+ $data['rows'][] = $row;
+ }
+ return $data;
+ }
- $list = MeetT::getAllData(1);
+ //全部预约
+ public function actionAll() {
+ $invalid_items = InvalidT::getTree();
+ $user_items = $this->my->getChildren();
- return $this->render('today',[
- 'items' => $items,
- 'list' => $list,
- 'page_info' => $page_info,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'ptype' => $ptype,
- 'car_no' => $car_no,
- 'page' => $page,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'type' => 2
+ return $this->render('all',[
+ 'invalid_items' => $invalid_items,
+ 'user_items' => $user_items
]);
}
-
- //全部预约
- public function actionAll()
+ public function actionAllJson()
{
+ Yii::$app->response->format = Response::FORMAT_JSON;
$session = Yii::$app->session;
$request = Yii::$app->request;
$car_man = $request->get('car_man');
$phone = $request->get('phone');
$car_no = $request->get('car_no');
- $page = $request->get('page',1);
$username = $request->get('username');
$sort_key = $request->get('sort_key','appointment_t.pdate');
$sort_value = $request->get('sort_value','ASC');
$user_id = $request->get('user_id');
-
$ptype = $request->get('ptype');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
- ->where('appointment_t.is_first=0 and car_t.location=4');
+ ->where('appointment_t.is_first=0 and car_t.location=2');
if($username == '') {
$user_ids = $this->getChildrenUserIDs();
@@ -259,11 +278,9 @@ class RenewalController extends BaseController
if($phone != '') {
$query = $query->andWhere('car_t.phone="'.$phone.'"');
}
-
if($ptype > 0) {
- $query = $query->andWhere('appointment_t.ptype="'.$ptype.'"');
+ $query = $query->andWhere('appointment_t.ptype='.$ptype);
}
-
if($car_no != '') {
$query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
}
@@ -289,36 +306,25 @@ class RenewalController extends BaseController
$session->remove('appointment_all');
$session->set('appointment_all',$sql);
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
+ $query = $query->offset($offset)->limit($limit);
$items = $query->all();
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
-
- $list = MeetT::getAllData(1);
-
- return $this->render('all',[
- 'items' => $items,
- 'page_info' => $page_info,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'list' => $list,
- 'ptype' => $ptype,
- 'car_no' => $car_no,
- 'page' => $page,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'type' => 3,
- 'invalid_items' => $invalid_items,
- 'username' => $username,
- 'user_items' => $user_items,
- 'user_id' => $user_id
- ]);
+ $data = [];
+ $data['total'] = $total;
+ $data['rows'] = [];
+ foreach($items as $item) {
+ $car_info = $item->car;
+ $row = $item->toArray();
+ $row['car_id'] = $car_info->id;
+ $row['car_no'] = $car_info->car_no;
+ $row['car_man'] = $car_info->car_man;
+ $row['register_date'] = $car_info->register_date;
+ $row['insurer1_date'] = $car_info->insurer1_date;
+ $row['insurer2_date'] = $car_info->insurer2_date;
+ $row['user_name'] = $item->user ? $item->user->getShowName():'';
+ $data['rows'][] = $row;
+ }
+ return $data;
}
public function actionMyList()
diff --git a/frontend/views/appointment/all.php b/frontend/views/appointment/all.php
index 188498b..d9d6680 100644
--- a/frontend/views/appointment/all.php
+++ b/frontend/views/appointment/all.php
@@ -1,161 +1,107 @@
-
-
-
-
+
+
+
-
-
+endBlock(); ?>
diff --git a/frontend/views/appointment/today.php b/frontend/views/appointment/today.php
index f864e09..3010691 100644
--- a/frontend/views/appointment/today.php
+++ b/frontend/views/appointment/today.php
@@ -1,94 +1,107 @@
-
-
-
-
+
+
+
-
-
-
- 序号 |
- 预约日期 |
- 预约时间 |
- 车牌号 |
- 车主 |
- 初登日期 |
- 商业起保日期 |
- 交强起保日期 |
- 预约备注 |
- 业务员 |
- 操作 |
-
- $item) {
- $start_index = ($page-1) * 20 + $index;
- $car_info = $item->car;
- ?>
-
- =$start_index+1?> |
- =$item->pdate?> |
- =$item->ptime?> |
- =$car_info->car_no?> |
- =$car_info->car_man?> |
- =$car_info->register_date?> |
- =$car_info->insurer1_date?> |
- =$car_info->insurer2_date?> |
- =MyLib::substr_cut($item->remark,40)?> |
- =$item->user?$item->user->getShowName():''?> |
-
- [详情]
- |
-
-
-
- =$page_info?> |
-
-
+endBlock(); ?>
diff --git a/frontend/views/car/info.php b/frontend/views/car/info.php
index 1618217..76ad43e 100644
--- a/frontend/views/car/info.php
+++ b/frontend/views/car/info.php
@@ -187,7 +187,7 @@ use \common\libs\MyLib;
var o = {};
function insurerDlg() {
title = '投保';
- layer_show(title, '/car/order-add?car_id==$car_info->id?>');
+ layer_show_full(title, '/car/order-add?car_id==$car_info->id?>');
}
function appointmentDlg() {
title = '添加预约';
diff --git a/frontend/views/car/order-add.php b/frontend/views/car/order-add.php
new file mode 100644
index 0000000..150a132
--- /dev/null
+++ b/frontend/views/car/order-add.php
@@ -0,0 +1,457 @@
+
+beginBlock('header_css'); ?>
+
+endBlock(); ?>
+
+
+
+
+beginBlock('footer_js'); ?>
+
+endBlock(); ?>
\ No newline at end of file
diff --git a/frontend/views/insurer/finance-mng.php b/frontend/views/insurer/finance-mng.php
index db2909e..12a9247 100644
--- a/frontend/views/insurer/finance-mng.php
+++ b/frontend/views/insurer/finance-mng.php
@@ -1,136 +1,104 @@
-
-
-
-
-
+
+
+
-
-
-
- 序号 |
- 被保险人 |
- 联系电话 |
- 保险公司 |
- 车牌号 |
- 正本日期 |
- 商业保单号 |
- 交强保单号 |
- 共计签单 |
- 级别 |
- 销售座席 |
- 状态 |
- 转账状态 |
- 支付方式 |
- 当前操作 |
- 操作 |
-
- $item) {
- $start_index = ($page - 1) * 20 + $index;
- $caiwu = $item->caiwu;
- $users=$item->user->group;
- $username=$item->user;
- $nams=$users['name'];
- ?>
-
- =$start_index+1?> |
- =MyLib::substr_cut($item->id_man,20)?> |
- =$item->link_phone?> |
- =$item->company?$item->company->name:''?> |
- =$item->car_no?> |
- =$item->print_date?> |
- =$item->insurer1_no?> |
- =$item->insurer2_no?> |
- =$item->total_all?> |
- =$nams?> |
- =$item->user?$item->user->getShowName():''?> |
- =$caiwu->status->name?> |
- =$caiwu->caiwuStatus ? $caiwu->caiwuStatus->name : ''?> |
- =$item->shoufei_id?MyLib::zhifufs($item->shoufei_id).'-':''?>=$item->payType?$item->payType->name:''?> |
- =$caiwu->lock?$caiwu->lock->getShowName():''?> |
-
- status_id == 12){ ?>
- [解锁]
- [详情]
-
- |
-
-
-
- =$page_info?> |
-
-
+endBlock(); ?>
diff --git a/frontend/views/insurer/my-list-info.php b/frontend/views/insurer/my-list-info.php
index 6a5c423..ee0b200 100644
--- a/frontend/views/insurer/my-list-info.php
+++ b/frontend/views/insurer/my-list-info.php
@@ -1,481 +1,237 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
- |
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+endBlock(); ?>
diff --git a/frontend/views/insurer/my-list.php b/frontend/views/insurer/my-list.php
index ea715d2..5ec1afd 100644
--- a/frontend/views/insurer/my-list.php
+++ b/frontend/views/insurer/my-list.php
@@ -44,8 +44,8 @@ use \common\libs\MyLib;
应收 |
状态 |
礼品状态 |
- 业务员 |
- 当前操作 |
+ 业务员 |
+ 当前操作 |
操作 |
diff --git a/frontend/views/insurer/office-mng-edit.php b/frontend/views/insurer/office-mng-edit.php
index fc16c2f..a66a4f4 100644
--- a/frontend/views/insurer/office-mng-edit.php
+++ b/frontend/views/insurer/office-mng-edit.php
@@ -1,378 +1,268 @@
-
-
+
+
+
-
-
-
-
-
-
\ No newline at end of file
+
+endBlock(); ?>
diff --git a/frontend/views/insurer/office-mng.php b/frontend/views/insurer/office-mng.php
index 01f3441..e946785 100644
--- a/frontend/views/insurer/office-mng.php
+++ b/frontend/views/insurer/office-mng.php
@@ -1,79 +1,102 @@
-
-
-
-
+
+
+
-
-
-
- 序号 |
- 被保险人 |
- 联系电话 |
- 保险公司 |
- 车牌号 |
- 车型 |
- 提单日期 |
- 送单日期 |
- 共计签单 |
- 销售座席 |
- 状态 |
- 支付方式 |
- 当前操作 |
- 操作 |
-
- $item) {
- $start_index = ($page-1) * 20 + $index;
- ?>
-
- =$start_index+1?> |
- =MyLib::substr_cut($item->id_man,30)?> |
- =$item->link_phone?> |
- =$item->company2?$item->company2->name:''?> |
- =$item->car_no?> |
- =$item->car?$item->car->factory_model:''?> |
- =$item->submit_date?> |
- =$item->send_date?> |
- =$item->total_all?> |
- =$item->user?$item->user->getShowName():''?> |
- =$item->status->name?> |
- =$item->shoufei_id?MyLib::zhifufs($item->shoufei_id).'-':''?>=$item->payType?$item->payType->name:''?> |
- =$item->lock?$item->lock->getShowName():''?> |
-
- [详情]
- |
-
-
-
- =$page_info?> |
-
-
+endBlock(); ?>
diff --git a/frontend/views/insurer/original-mng-edit.php b/frontend/views/insurer/original-mng-edit.php
index 2325c40..0ec89d7 100644
--- a/frontend/views/insurer/original-mng-edit.php
+++ b/frontend/views/insurer/original-mng-edit.php
@@ -1,416 +1,284 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+endBlock(); ?>
diff --git a/frontend/views/insurer/original-mng.php b/frontend/views/insurer/original-mng.php
index 254656a..aded5ab 100644
--- a/frontend/views/insurer/original-mng.php
+++ b/frontend/views/insurer/original-mng.php
@@ -1,105 +1,101 @@
-
-
-
-
+
+
+
-
-
-
- 序号 |
- 被保险人 |
- 联系电话 |
- 车牌号 |
- 商业保单号 |
- 交强保单号 |
- 保险公司 |
- 验证码 |
- 销售座席 |
- 状态 |
- 支付方式 |
- 收款人 |
- 收款方式 |
- 当前操作 |
- 操作 |
-
- $item) {
- $start_index = ($page - 1) * 20 + $index;
- ?>
-
- =$start_index+1?> |
- =MyLib::substr_cut($item->id_man,30)?> |
- =$item->link_phone?> |
- =$item->car_no?> |
- =$item->insurer1_no?> |
- =$item->insurer2_no?> |
- =MyLib::substr_cut($item->company?$item->company->name:'',30)?> |
- =$item->sms_code?> |
- =$item->user?$item->user->getShowName():''?> |
- =$item->status->name?> |
- =$item->shoufei_id?MyLib::zhifufs($item->shoufei_id).'-':''?>=$item->payType?$item->payType->name:''?> |
- =$item->payee_id?$item->payee->name:''?> |
- =$item->payment_id?$item->payment->name:''?> |
-
- =$item->lock?$item->lock->getShowName():''?> |
-
- [详情]
- |
-
-
-
- =$page_info?> |
-
-
+endBlock(); ?>
diff --git a/frontend/views/renewal/all.php b/frontend/views/renewal/all.php
index 228029f..1b30af0 100644
--- a/frontend/views/renewal/all.php
+++ b/frontend/views/renewal/all.php
@@ -1,161 +1,107 @@
-
-
-
-
+
+
+
-
-
+endBlock(); ?>
diff --git a/frontend/views/renewal/first.php b/frontend/views/renewal/first.php
index 2054bbb..f0953a5 100644
--- a/frontend/views/renewal/first.php
+++ b/frontend/views/renewal/first.php
@@ -1,161 +1,107 @@
-
-
-
-
+
+
+
-
-
+endBlock(); ?>
diff --git a/frontend/views/renewal/today.php b/frontend/views/renewal/today.php
index cb4be43..a8f4e2f 100644
--- a/frontend/views/renewal/today.php
+++ b/frontend/views/renewal/today.php
@@ -1,94 +1,107 @@
-
-
-
-
+
+
+
-
-
-
- 序号 |
- 预约日期 |
- 预约时间 |
- 车牌号 |
- 车主 |
- 初登日期 |
- 商业起保日期 |
- 交强起保日期 |
- 预约备注 |
- 业务员 |
- 操作 |
-
- $item) {
- $start_index = ($page-1) * 20 + $index;
- $car_info = $item->car;
- ?>
-
- =$start_index+1?> |
- =$item->pdate?> |
- =$item->ptime?> |
- =$car_info->car_no?> |
- =$car_info->car_man?> |
- =$car_info->register_date?> |
- =$car_info->insurer1_date?> |
- =$car_info->insurer2_date?> |
- =MyLib::substr_cut($item->remark,40)?> |
- =$item->user?$item->user->getShowName():''?> |
-
- [详情]
- |
-
-
-
- =$page_info?> |
-
-
+endBlock(); ?>