edit-api-licheb_imgs
This commit is contained in:
@@ -239,6 +239,12 @@ class Orders extends HD_Controller
|
||||
$row['imgs_status'] = $this->order_datas_entity->data_ckinfo($img_data,$row['main_type']);
|
||||
|
||||
//获取开票
|
||||
$bill_ck_img = json_decode($img_data['bill_ck_img'],true);
|
||||
if($bill_ck_img){
|
||||
foreach ($bill_ck_img as $key => $value) {
|
||||
$bill_ck_img[$key] = build_qiniu_image_url($value);
|
||||
}
|
||||
}
|
||||
$bill = $this->order_bills_model->get(['o_id' => $row['id']], 'status,file');
|
||||
$bill_status = $this->receiver_order_status_model->get(['o_id'=>$row['id'],'pid_status'=>3,'status'=>1]); //是否已开票
|
||||
$bill['file'] = $bill['file'] ? build_qiniu_image_url($bill['file']) : '';
|
||||
@@ -246,6 +252,8 @@ class Orders extends HD_Controller
|
||||
$bill['cardidA'] = $img_data['cardida'];
|
||||
$bill['cardidB'] = $img_data['cardidb'];
|
||||
$bill['business_licence'] = $img_data['business_licence'];
|
||||
$bill['bill_ck_img'] = $bill_ck_img;
|
||||
|
||||
$bill['status'] = $bill_status ? 1 : 0;
|
||||
$companys = $this->sys_company_model->select(['status' => 1, 'wx_mchid!=' => ''], 'id desc', '', '', 'id,short');
|
||||
$row['companys'] = $companys;
|
||||
@@ -1237,4 +1245,56 @@ class Orders extends HD_Controller
|
||||
$this->data['id'] = $id;
|
||||
return $this->show_view('receiver/orderv2/edit_srv');
|
||||
}
|
||||
|
||||
public function edit_bill_img(){
|
||||
$id = $this->input->post('id');
|
||||
$file = $this->input->post('value');
|
||||
if(!$file || !$id){
|
||||
$this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$re_data = $this->receiver_order_datas_model->get(['o_id'=>$id]);
|
||||
$bill_ck_img = [];
|
||||
if(!$re_data){
|
||||
$re_data_id = $this->receiver_order_datas_model->add(['c_time'=>time(),'o_id'=>$id]);
|
||||
}else{
|
||||
$re_data_id = $re_data['id'];
|
||||
$bill_ck_img = json_decode($re_data['bill_ck_img'],true);
|
||||
}
|
||||
|
||||
if(strpos($file,'.pdf') !== false){
|
||||
$this->load->library('pdf');
|
||||
$pdf_url = build_qiniu_image_url($file);
|
||||
$pdf_imgs = $this->pdf->pdf2img($pdf_url);
|
||||
if($pdf_imgs){
|
||||
$bill_ck_img = $this->up_qiniu($pdf_imgs);
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, 'pdf识别失败');
|
||||
}
|
||||
}else{
|
||||
$bill_ck_img[] = $file;
|
||||
}
|
||||
$update = [
|
||||
'bill_ck_img' => json_encode($bill_ck_img,JSON_UNESCAPED_UNICODE)
|
||||
];
|
||||
$res = $this->receiver_order_datas_model->update($update,['id'=>$re_data_id]);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
//图片上传七牛
|
||||
private function up_qiniu($imgs){
|
||||
$this->load->library('qiniu');
|
||||
//上传七牛并保存
|
||||
foreach($imgs as $key=>$val){
|
||||
$file_name = date('Ym')."/".md5($val).'.jpg';
|
||||
$result = $this->qiniu->fetch($val,$file_name);
|
||||
if($result){
|
||||
$imgs[$key] = $result['file'];
|
||||
}
|
||||
}
|
||||
return $imgs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,6 +312,29 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
<label class="am-para-label label-width">合格证:</label>
|
||||
<div class="am-para-input">
|
||||
<a href="javascript:void(0);" data-file="1" data-type="jpg,png,gif,png,jpeg" data-uptype="qiniu" data-field="bill_img_file" class="am-btn am-btn-default am-btn-sm">
|
||||
<input type="hidden" name="bill_img_file" data-type="1" value="" onchange="edit_bill_img(this)">
|
||||
<i class="am-icon-cloud-upload"></i>上传图片
|
||||
</a>
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-mark="file" data-type="pdf"
|
||||
data-uptype="qiniu" data-field="bill_pdf_file" >
|
||||
<input type="hidden" name="bill_pdf_file" data-type="1" value="" onchange="edit_bill_img(this)">
|
||||
<i class="am-icon-cloud-upload"></i>上传pdf
|
||||
</a>
|
||||
<ul class="photopic-list clearfix mt10" v-if="info.bill && info.bill.bill_ck_img">
|
||||
<li v-for="(item,key) in info.bill.bill_ck_img">
|
||||
<a target="_blank" class="pic" :id="'layer-photos-demo-111'+key">
|
||||
<img :src="item" @click="show_carimg('111'+key)"/>
|
||||
</a>
|
||||
<div class="f12 tc"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -706,4 +729,25 @@
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
function edit_bill_img(obj) {
|
||||
var loading = layer.msg('上传中', {
|
||||
icon: 16
|
||||
,shade: 0.3
|
||||
,time: false
|
||||
});
|
||||
var value = $(obj).val();
|
||||
$.post("/receiver/orderv2/orders/edit_bill_img", {
|
||||
'id': <?=$info['id']?>,
|
||||
'value': value,
|
||||
}, function (data) {
|
||||
layer.closeAll()
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -940,9 +940,19 @@ class CusorderV2 extends Wxapp
|
||||
//订单列表头部
|
||||
protected function get_tabs()
|
||||
{
|
||||
$where = [
|
||||
'status' => 0,
|
||||
'biz_id' => $this->biz_id,
|
||||
];
|
||||
$d_count = $this->orders_model->count($where);
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'biz_id' => $this->biz_id,
|
||||
];
|
||||
$f_count = $this->orders_model->count($where);
|
||||
$lists = [
|
||||
['key' => 11, 'name' => '进行中'],
|
||||
['key' => 12, 'name' => '已完成'],
|
||||
['key' => 11, 'name' => "进行中({$d_count})"],
|
||||
['key' => 12, 'name' => "已完成({$f_count})"],
|
||||
];
|
||||
$data['filters'] = [
|
||||
'type' => [
|
||||
|
||||
@@ -28,6 +28,7 @@ class Cusorderdata extends Wxapp{
|
||||
protected function get(){
|
||||
$id = $this->input_param('id');
|
||||
//$row = $this->receiver_order_status_model->get(['o_id'=>$id,'status'=>1,'pid_status'=>0]);
|
||||
$row = $this->orders_model->get(['id'=>$id]);
|
||||
$is_pay = $this->app_liche_orders_model->count(['o_id'=>$id,'status'=>1]);
|
||||
$data = [];
|
||||
if($is_pay){
|
||||
@@ -46,6 +47,33 @@ class Cusorderdata extends Wxapp{
|
||||
'img' => build_qiniu_image_url($row_data['register_img'])
|
||||
];
|
||||
}
|
||||
$bill_ck_img = $business_img = $insurance_img = [];
|
||||
$d_ins_info = json_decode($row_data['insurance_img'],true);
|
||||
if($d_ins_info){
|
||||
$insurance_img = [
|
||||
'value' => $d_ins_info['img'],
|
||||
'img' => build_qiniu_image_url($d_ins_info['img']),
|
||||
'product' => $d_ins_info['product'] ? $d_ins_info['product'] : '',
|
||||
'price' => $d_ins_info['price'] ? $d_ins_info['price'] : 0,
|
||||
'date' => $d_ins_info['date'] ? $d_ins_info['date'] : '',
|
||||
];
|
||||
}
|
||||
$d_ins_img = json_decode($row_data['business_img'],true);
|
||||
if($d_ins_img){
|
||||
$business_img = [
|
||||
'value' => $d_ins_img['img'],
|
||||
'img' => build_qiniu_image_url($d_ins_img['img']),
|
||||
'product' => $d_ins_img['product'] ? $d_ins_img['product'] : '',
|
||||
'price' => $d_ins_img['price'] ? $d_ins_img['price'] : 0,
|
||||
'date' => $d_ins_img['date'] ? $d_ins_img['date'] : '',
|
||||
];
|
||||
}
|
||||
$bill_img_json = json_decode($row_data['bill_ck_img'],true);
|
||||
if($bill_img_json){
|
||||
foreach ($bill_img_json as $item) {
|
||||
$bill_ck_img[] = build_qiniu_image_url($item);
|
||||
}
|
||||
}
|
||||
$data['imgs'] = [
|
||||
'cardida' => [],
|
||||
'cardidb' => [],
|
||||
@@ -53,7 +81,10 @@ class Cusorderdata extends Wxapp{
|
||||
'car_img' => $car_img,
|
||||
'register_img' => $register_img,
|
||||
'ins_img' => [],
|
||||
'other_img' => []
|
||||
'other_img' => [],
|
||||
'insurance_img' => $insurance_img,
|
||||
'business_img' => $business_img,
|
||||
'bill_ck_img' => $bill_ck_img
|
||||
];
|
||||
|
||||
if($row['main_type']){
|
||||
@@ -132,6 +163,8 @@ class Cusorderdata extends Wxapp{
|
||||
$business_licence = $this->input_param('business_licence');
|
||||
$ins_imgs = $this->input_param('ins_imgs');
|
||||
$other_imgs = $this->input_param('other_imgs');
|
||||
$insurance_img = $this->input_param('insurance_img');
|
||||
$business_img = $this->input_param('business_img');
|
||||
$update = [];
|
||||
if($cardida){
|
||||
$full_cardida = build_qiniu_image_url($cardida);
|
||||
@@ -176,10 +209,13 @@ class Cusorderdata extends Wxapp{
|
||||
return $res_data;
|
||||
}
|
||||
$update['business_licence'] = $business_licence;
|
||||
}elseif($ins_imgs){
|
||||
//图片识别
|
||||
}elseif(is_array($ins_imgs)){
|
||||
$update['ins_img'] = json_encode($ins_imgs,JSON_UNESCAPED_UNICODE);
|
||||
}elseif($other_imgs){
|
||||
} elseif($insurance_img){
|
||||
$update['insurance_img'] = json_encode(['img'=>$insurance_img],JSON_UNESCAPED_UNICODE);
|
||||
} elseif($business_img){
|
||||
$update['business_img'] = json_encode(['img'=>$business_img],JSON_UNESCAPED_UNICODE);
|
||||
}elseif(is_array($other_imgs)){
|
||||
$update['other_img'] = json_encode($other_imgs,JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
if($cardidb){
|
||||
@@ -204,8 +240,11 @@ 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($insurance_img || $business_img){ //保单识别图片保存数据
|
||||
$res = $this->order_datas_entity->orc_ins_img_2($id);
|
||||
if(!$res){
|
||||
throw new Exception('图片识别失败,请重新上传', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
if($update['car_img']){ //更新车牌号
|
||||
$this->order_datas_entity->up_car_num($id);
|
||||
@@ -215,4 +254,34 @@ class Cusorderdata extends Wxapp{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public function put_info(){
|
||||
$id = $this->input_param('id');
|
||||
$type = $this->input_param('type');
|
||||
$product = $this->input_param('product');
|
||||
$price = $this->input_param('price');
|
||||
$date = $this->input_param('date');
|
||||
$data_row = $this->receiver_order_datas_model->get(['o_id'=>$id]);
|
||||
if(!$data_row){
|
||||
throw new Exception('数据不存在', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if($type){ //交强险图片
|
||||
$jsondata = json_decode($data_row['insurance_img'],true);
|
||||
$jsondata['product'] = $product;
|
||||
$jsondata['price'] = $price;
|
||||
$jsondata['date'] = $date;
|
||||
$update['insurance_img'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
}else{ //商业险图片
|
||||
if($price<1000){
|
||||
throw new Exception('金额有误,请重新填写', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$jsondata = json_decode($data_row['business_img'],true);
|
||||
$jsondata['product'] = $product;
|
||||
$jsondata['price'] = $price;
|
||||
$jsondata['date'] = $date;
|
||||
$update['business_img'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
$res = $this->receiver_order_datas_model->update($update,['id'=>$data_row['id']]);
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,21 +32,19 @@ class Order_datas_entity{
|
||||
'ins_img' => ['text'=>'未传','type'=>4,'color'=>self::COLOR_UN_UPLOAD], //保单证
|
||||
'other_img' => ['text'=>'未传','type'=>5,'color'=>self::COLOR_UN_UPLOAD], //交车合照
|
||||
];
|
||||
// $where = ['cf_id'=>$o_data['id'],'app_id'=>2,'type in (1,2,3,4,5)'=>null,'datatype'=>'img'];
|
||||
// $check_data = $this->ci->app_checkdata_model->map('type','',$where,'','','','id,cf_id,type,ifcheck');
|
||||
foreach ($result as $key=>$item) {
|
||||
if($o_data[$key]){
|
||||
$result[$key]['text'] = '已传';
|
||||
$result[$key]['color'] = self::COLOR_IS_UPLOAD;
|
||||
// if($check_data[$item['type']][0]['ifcheck']==1){
|
||||
// $result[$key]['text'] = '已通过';
|
||||
// $result[$key]['color'] = self::COLOR_CHECK;
|
||||
// }
|
||||
// if($check_data[$item['type']][0]['ifcheck']==-1){
|
||||
// $result[$key]['text'] = '未通过';
|
||||
// $result[$key]['color'] = self::COLOR_UN_CHECK;
|
||||
// }
|
||||
if($key=='ins_img'){
|
||||
if($o_data['ins_img'] || $o_data['insurance_img'] || $o_data['business_img']){
|
||||
$result[$key]['text'] = '已传';
|
||||
$result[$key]['color'] = self::COLOR_IS_UPLOAD;
|
||||
}
|
||||
}else{
|
||||
if($o_data[$key]){
|
||||
$result[$key]['text'] = '已传';
|
||||
$result[$key]['color'] = self::COLOR_IS_UPLOAD;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -222,6 +220,67 @@ class Order_datas_entity{
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 识别保单图片
|
||||
* @param $oid
|
||||
* @return false
|
||||
*/
|
||||
public function orc_ins_img_2($oid){
|
||||
$row = $this->ci->receiver_order_datas_model->get(['o_id'=>$oid]);
|
||||
$insurance_img = json_decode($row['insurance_img'],true);
|
||||
$business_img = json_decode($row['business_img'],true);
|
||||
$jsondata = json_decode($row['jsondata'],true);
|
||||
$ins_info = $jsondata['ins_info'] ? $jsondata['ins_info'] : [];
|
||||
if($insurance_img['img']){
|
||||
$url = build_qiniu_image_url($insurance_img['img']);
|
||||
$ins_key = md5($url);
|
||||
if(!$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;
|
||||
$jsondata['ins_info'] = $ins_info;
|
||||
$insurance_img['price'] = floatval($result['data']['合计保费']);
|
||||
$insurance_img['date'] = $result['data']['投保确认时间'];
|
||||
$insurance_img['product'] = $result['data']['保险公司'];
|
||||
}else{
|
||||
$ins_info[$ins_key]['msg'] = $result['msg'];
|
||||
$ins_info[$ins_key]['img_url'] = $url;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($business_img['img']){
|
||||
$url = build_qiniu_image_url($business_img['img']);
|
||||
$ins_key = md5($url);
|
||||
if(!$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;
|
||||
$jsondata['ins_info'] = $ins_info;
|
||||
$business_img['price'] = floatval($result['data']['合计保费']);
|
||||
$business_img['date'] = $result['data']['投保确认时间'];
|
||||
$business_img['product'] = $result['data']['保险公司'];
|
||||
}else{
|
||||
$ins_info[$ins_key]['msg'] = $result['msg'];
|
||||
$ins_info[$ins_key]['img_url'] = $url;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$update = [
|
||||
'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE),
|
||||
'insurance_img' => json_encode($insurance_img,JSON_UNESCAPED_UNICODE),
|
||||
'business_img' => json_encode($business_img,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
$res = $this->ci->receiver_order_datas_model->update($update,['id'=>$row['id']]);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车牌号
|
||||
* @return void
|
||||
|
||||
Reference in New Issue
Block a user