add-licheb-orc_car_img
This commit is contained in:
@@ -253,7 +253,22 @@ class Orders extends HD_Controller
|
||||
}
|
||||
}
|
||||
$row['contract_data'] = $contract_data;
|
||||
|
||||
//获取图片识别信息
|
||||
$agent = $this->order_agents_model->get(['o_id' => $row['id']]);
|
||||
$company = $ins_risk = $business_risk = '';
|
||||
if ($agent) {
|
||||
$agent['ins_time'] = $agent['ins_time'] != '0000-00-00 00:00:00' ? date('Y-m-d', strtotime($agent['ins_time'])) : '';
|
||||
$agent_jsondata = $agent['jsondata'] ? json_decode($agent['jsondata'], true) : '';
|
||||
if ($agent_jsondata) {
|
||||
$company = $agent_jsondata['company'];
|
||||
$ins_risk = $agent_jsondata['ins_risk'];
|
||||
$business_risk = $agent_jsondata['business_risk'];
|
||||
}
|
||||
}
|
||||
$agent['company'] = $company;
|
||||
$agent['ins_risk'] = $ins_risk;
|
||||
$agent['business_risk'] = $business_risk;
|
||||
$row['agent'] = $agent;
|
||||
//获取销售员
|
||||
if ($row['sale_id']) {
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'licheb_users_model');
|
||||
@@ -839,6 +854,12 @@ class Orders extends HD_Controller
|
||||
$res = $this->receiver_order_datas_model->update($update,['id'=>$re_data_id]);
|
||||
if($res){
|
||||
$this->orders_status_entity->set_status($id,6,1);
|
||||
if($field=='ins_img'){//保单识别图片保存数据
|
||||
$this->order_datas_entity->orc_ins_img($id);
|
||||
}
|
||||
if($field=='car_img'){//更新车牌号
|
||||
$this->order_datas_entity->up_car_num($id);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
@@ -881,4 +902,35 @@ class Orders extends HD_Controller
|
||||
}
|
||||
}
|
||||
|
||||
//修改资料信息
|
||||
public function edit_agent(){
|
||||
$params = $this->input->post();
|
||||
$row = $this->receiver_orders_v2_model->get(['id' => $params['oid']]);
|
||||
if (!$row) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$agent = $this->order_agents_model->get(['o_id' => $row['id']]);
|
||||
$jsondata = json_decode($agent['jsondata'],true);
|
||||
$update = [];
|
||||
$update['car_num'] = $params['car_num'];
|
||||
$update['ins_time'] = $params['ins_time'] ? date('Y-m-d H:i:s', strtotime($params['ins_time'])) : '0000-00-00 00:00:00';
|
||||
|
||||
$jsondata['company'] = $params['company'];
|
||||
$jsondata['ins_risk'] = $params['ins_risk'];
|
||||
$jsondata['business_risk'] = $params['business_risk'];
|
||||
|
||||
$update['jsondata'] = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
|
||||
if ($agent) {
|
||||
$result = $this->order_agents_model->update($update, ['id' => $agent['id']]);
|
||||
} else {
|
||||
$update['o_id'] = $row['id'];
|
||||
$update['c_time'] = time();
|
||||
$result = $this->order_agents_model->add($update);
|
||||
}
|
||||
if ($result) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,69 @@
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g">
|
||||
<form id="agent_form">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">车牌号:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 50%">
|
||||
<input type="text" name="car_num" v-model="info.agent.car_num">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">保险公司:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 50%">
|
||||
<input type="text" name="company" v-model="info.agent.company">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12"></div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">保险到期时间:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 50%">
|
||||
<input type="text" name="ins_time" id="ins_time" value="<?= $info['agent']['ins_time'] ?>">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">交强险费用:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 50%">
|
||||
<input type="text" name="ins_risk" v-model="info.agent.ins_risk"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12"></div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">商业险费用:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label" style="width: 50%">
|
||||
<input type="text" name="business_risk" v-model="info.agent.business_risk"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline am-u-lg-6">
|
||||
<div class="am-form-group am-u-lg-6" style="margin-top: 15px;">
|
||||
<input type="hidden" name="oid" v-model="info.id">
|
||||
<a href='javascript:;' class='am-btn am-btn-primary am-btn-xs' @click="save_agent">
|
||||
保存
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="am-form-group clearfix" >
|
||||
<div class="" v-if="info.main_type==1">
|
||||
<p class="am-text-default mb10 ml30 pt15 pb10">
|
||||
@@ -166,8 +229,8 @@
|
||||
<a href="<?=$val?>" target="_blank" class="pic">
|
||||
</a>
|
||||
<?}else{?>
|
||||
<a target="_blank" class="pic" id="layer-photos-demo-41">
|
||||
<img src="<?=$val?>" @click="show_carimg(41)"/>
|
||||
<a target="_blank" class="pic" id="layer-photos-demo-4<?=$key?>">
|
||||
<img src="<?=$val?>" @click="show_carimg(4<?=$key?>)"/>
|
||||
</a>
|
||||
<?}?>
|
||||
<!--
|
||||
|
||||
@@ -588,7 +588,19 @@
|
||||
}
|
||||
}, 'json');
|
||||
});
|
||||
}
|
||||
},
|
||||
save_agent: function () { //保存代办信息
|
||||
var post_data = $('#agent_form').serialize();
|
||||
$.post("/receiver/orderv2/orders/edit_agent", post_data, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -453,32 +453,31 @@ class CusorderV2 extends Wxapp{
|
||||
|
||||
$car_data = [];
|
||||
if($row['brand_id'] && $row['s_id'] && $row['v_id']){
|
||||
$car_data['车辆名称'] = $brand['name'].$series['name'];
|
||||
$car_data['车辆名称'] = $brand['name'].$series['name'];
|
||||
$car_data['车辆级别'] = $version;
|
||||
$car_data['车身颜色'] = $color;
|
||||
$car_data['平台售价'] = $money_json['price_car'];
|
||||
$money_json['price_coplus'] && $car_data['公司加价'] = $money_json['price_coplus'];
|
||||
$money_json['price_color'] && $car_data['颜色加价'] = $money_json['price_color'];
|
||||
$car_data['定金'] = $money_json['price_book'];
|
||||
$money_json['price_coplus'] && $car_data['公司加价'] = number_format($money_json['price_coplus'],2);
|
||||
$money_json['price_color'] && $car_data['颜色加价'] = number_format($money_json['price_color'],2);
|
||||
$car_data['定金'] = number_format($money_json['price_book'],2);
|
||||
$car_price_list = [];
|
||||
$money_json['price_discount'] && $car_price_list['优惠'] = $money_json['price_discount'];
|
||||
$money_json['price_discount'] && $car_price_list['优惠'] = number_format($money_json['price_discount'],2);
|
||||
$car_data['最终售价'] =[
|
||||
'list' => $car_price_list,
|
||||
'value' => $orders_entity->total_price($row['id'])
|
||||
'value' => number_format($orders_entity->total_price($row['id']),2)
|
||||
];
|
||||
//服务费
|
||||
$srv_data = $orders_entity->order_srv_money($row['id'],1);
|
||||
if($srv_data['total']>0){
|
||||
$car_data['委托代办']['value'] = $srv_data['total'];
|
||||
$car_data['委托代办']['value'] = number_format($srv_data['total'],2);
|
||||
foreach($srv_data['list'] as $val){
|
||||
$car_data['委托代办']['list'][$val['title']] = $val['money'];
|
||||
$car_data['委托代办']['list'][$val['title']] = is_numeric($val['money']) ? number_format($val['money'],2):'';
|
||||
}
|
||||
if($row['fines']){
|
||||
$fines = json_decode($row['fines'],true);
|
||||
$fines_list = [];
|
||||
foreach ($fines as $item) {
|
||||
$fines_list['list'][$item['txt']] = $item['price'];
|
||||
$fines_list['list'][$item['txt']] = $item['price'] ? number_format($item['price'],2) : '';
|
||||
}
|
||||
$fines_list['value'] = $money_json['price_fine_select'] ? $money_json['price_fine_select'] : 0.00;
|
||||
$car_data['委托代办']['list']['精品选装'] = $fines_list;
|
||||
@@ -519,9 +518,9 @@ class CusorderV2 extends Wxapp{
|
||||
'incolor_id' => $row['incor_id'],
|
||||
'delry_time' => $row['delry_time']!='0000-00-00 00:00:00' ? date('Y-m-d',strtotime($row['delry_time'])):'',
|
||||
'finance_id' => !$row['payway'] ? $row['finance_id'] : '',
|
||||
'deposit' => $money_json['price_book'] ? $money_json['price_book'] : 0,
|
||||
'disc_money' => $money_json['price_discount'] ? $money_json['price_discount'] : '',
|
||||
'disc_fine_money' => $money_json['price_fine_discount'] ? $money_json['price_fine_discount'] : 0,
|
||||
'deposit' => $money_json['price_book'] ? number_format($money_json['price_book'] ,2): 0,
|
||||
'disc_money' => $money_json['price_discount'] ? number_format($money_json['price_discount'],2) : '',
|
||||
'disc_fine_money' => $money_json['price_fine_discount'] ? number_format($money_json['price_fine_discount'],2) : 0,
|
||||
'srv_arr' => $row['srv_ids'] ? json_decode($row['srv_ids'],true) : [],
|
||||
'cus_id' => $row['customer_id'],
|
||||
'status' => $row['status'],
|
||||
|
||||
@@ -21,7 +21,7 @@ class Cusorderdata extends Wxapp{
|
||||
$this->load->model('receiver/order/receiver_order_datas_model');
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
|
||||
$this->load->library('receiver/orders_status_entity');
|
||||
$this->load->library('receiver/order_datas_entity');
|
||||
$this->load->library('TcOrc');
|
||||
}
|
||||
|
||||
@@ -166,10 +166,11 @@ class Cusorderdata extends Wxapp{
|
||||
return $res_data;
|
||||
}
|
||||
$update['business_licence'] = $business_licence;
|
||||
}elseif($ins_imgs || $other_imgs){
|
||||
$file_name = $ins_imgs ? 'ins_img' : 'other_img';
|
||||
$imgs = $ins_imgs ? $ins_imgs : $other_imgs;
|
||||
$update[$file_name] = json_encode($imgs,JSON_UNESCAPED_UNICODE);
|
||||
}elseif($ins_imgs){
|
||||
//图片识别
|
||||
$update['ins_img'] = json_encode($ins_imgs,JSON_UNESCAPED_UNICODE);
|
||||
}elseif($other_imgs){
|
||||
$update['other_img'] = json_encode($other_imgs,JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
if($cardidb){
|
||||
$key = 'cardidb';
|
||||
@@ -193,6 +194,12 @@ class Cusorderdata extends Wxapp{
|
||||
}
|
||||
$res = $this->receiver_order_datas_model->update($update,['o_id'=>$id]);
|
||||
if($res){
|
||||
if($update['ins_img']){ //保单识别图片保存数据
|
||||
$this->order_datas_entity->orc_ins_img($id);
|
||||
}
|
||||
if($update['car_img']){ //更新车牌号
|
||||
$this->order_datas_entity->up_car_num($id);
|
||||
}
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
|
||||
@@ -17,7 +17,10 @@ class Order_datas_entity{
|
||||
public function __construct(){
|
||||
$this->ci = & get_instance();
|
||||
$this->ci->load->model('receiver/order/receiver_order_datas_model');
|
||||
$this->ci->load->model('receiver/order/receiver_order_agents_model');
|
||||
$this->ci->load->model('app/app_checkdata_model');
|
||||
$this->ci->load->library('TcOrc');
|
||||
$this->ci->load->library('qiniuorc');
|
||||
}
|
||||
|
||||
public function data_status($o_data){
|
||||
@@ -135,7 +138,6 @@ class Order_datas_entity{
|
||||
return false;
|
||||
}
|
||||
$img_url = build_qiniu_image_url($row['car_img']);
|
||||
$this->ci->load->library('TcOrc');
|
||||
$result = $this->ci->tcorc->VehicleLicense($img_url);
|
||||
if (!$result['code']) {
|
||||
return false;
|
||||
@@ -148,4 +150,101 @@ class Order_datas_entity{
|
||||
$res = $this->ci->receiver_order_datas_model->update($update,['id'=>$row['id']]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 识别保单图片
|
||||
* @param $oid
|
||||
* @return false
|
||||
*/
|
||||
public function orc_ins_img($oid){
|
||||
$row = $this->ci->receiver_order_datas_model->get(['o_id'=>$oid]);
|
||||
$ins_img = json_decode($row['ins_img'],true);
|
||||
$jsondata = json_decode($row['jsondata'],true);
|
||||
$ins_info = $jsondata['ins_info'] ? $jsondata['ins_info'] : [];
|
||||
if($ins_img){
|
||||
$img_keys = [];
|
||||
foreach ($ins_img as $key=>$value) {
|
||||
$value && $url = build_qiniu_image_url($value);
|
||||
$url && $img_keys[] = md5($url);
|
||||
$ins_key = md5($url);
|
||||
if($url && !$ins_info[$ins_key]){
|
||||
$result = $this->ci->qiniuorc->car_insure($url);
|
||||
if ($result['code']) {
|
||||
$ins_info[$ins_key]['msg'] = $result['msg'];
|
||||
$ins_info[$ins_key]['data'] = $result['data'];
|
||||
$ins_info[$ins_key]['img_url'] = $url;
|
||||
}else{
|
||||
$ins_info[$ins_key]['msg'] = $result['msg'];
|
||||
$ins_info[$ins_key]['img_url'] = $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
$ins_time = $company = '';
|
||||
$ins_risk = $business_risk = 0;
|
||||
foreach ($ins_info as $key=>$value) {
|
||||
if(!in_array($key,$img_keys)){
|
||||
unset($ins_info[$key]);
|
||||
}else{
|
||||
$money = floatval($value['data']['合计保费']);
|
||||
if($money==950){
|
||||
$ins_risk = $money;
|
||||
}else{
|
||||
$company = $value['data']['保险公司'];
|
||||
$ins_time = date('Y-m-d',strtotime($value['data']['投保确认时间'])+365*12*24*60*60);
|
||||
$business_risk += $money;
|
||||
}
|
||||
}
|
||||
}
|
||||
$agent = $this->ci->receiver_order_agents_model->get(['o_id'=>$oid]);
|
||||
$agent_jsondata = $agent ? json_decode($agent['jsondata'],true) : [];
|
||||
$company && $agent_jsondata['company'] = $company;
|
||||
$ins_risk && $agent_jsondata['ins_risk'] = $ins_risk;
|
||||
$business_risk && $agent_jsondata['business_risk'] = $business_risk;
|
||||
if(!$agent){
|
||||
$add = [
|
||||
'o_id' => $oid,
|
||||
'jsondata' => json_encode($agent_jsondata,JSON_UNESCAPED_UNICODE),
|
||||
'c_time' => time(),
|
||||
];
|
||||
$ins_time && $add['ins_time'] = $ins_time;
|
||||
$this->ci->receiver_order_agents_model->add($add);
|
||||
}else{
|
||||
$update['jsondata'] = json_encode($agent_jsondata,JSON_UNESCAPED_UNICODE);
|
||||
$ins_time && $update['ins_time'] = $ins_time;
|
||||
$this->ci->receiver_order_agents_model->update($update,['id'=>$agent['id']]);
|
||||
}
|
||||
}
|
||||
$jsondata['ins_info'] = $ins_info;
|
||||
$update = [
|
||||
'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE)
|
||||
];
|
||||
$res = $this->ci->receiver_order_datas_model->update($update,['id'=>$row['id']]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车牌号
|
||||
* @return void
|
||||
*/
|
||||
public function up_car_num($oid){
|
||||
$row = $this->ci->receiver_order_datas_model->get(['o_id'=>$oid]);
|
||||
$jsondata = json_decode($row['jsondata'],true);
|
||||
$car_num = $jsondata['car_info']['PlateNo'];
|
||||
$res = false;
|
||||
if($car_num){
|
||||
$agent = $this->ci->receiver_order_agents_model->get(['o_id'=>$oid]);
|
||||
if(!$agent){
|
||||
$add = [
|
||||
'o_id' => $oid,
|
||||
'car_num' => $car_num,
|
||||
'c_time' => time(),
|
||||
];
|
||||
$res = $this->ci->receiver_order_agents_model->add($add);
|
||||
}else{
|
||||
$update['car_num'] = $car_num;
|
||||
$res = $this->ci->receiver_order_agents_model->update($update,['id'=>$agent['id']]);
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user