edit-admin-up_bill_img

This commit is contained in:
lccsw
2023-02-01 14:42:21 +08:00
parent 71acb64283
commit 88d27cccf9
2 changed files with 55 additions and 21 deletions
+20 -15
View File
@@ -853,6 +853,7 @@ class Orders extends HD_Controller
{
$id = $this->input->post('id');
$file = $this->input->post('value');
$if_usedcar = $this->input->post('if_usedcar');
$row_order = $this->receiver_orders_v2_model->get(array('id' => $id));
if(!$file || !$row_order){
return $this->show_json(SYS_CODE_FAIL, '参数错误');
@@ -864,23 +865,25 @@ class Orders extends HD_Controller
}else{
$jsondata = json_decode($row['jsondata'],true);
}
//图片识别
$img_url = build_qiniu_image_url($file);
$orc_res = $this->tcorc->CarInvoiceInfos($img_url);
if (!$orc_res['code']) {
return $this->show_json(SYS_CODE_FAIL, $orc_res['msg']);
}
$bill_time = date('Y-m-d H:i:s');
$carinfo = $orc_res['data']['CarInvoiceInfos'];
if(is_array($carinfo)){
foreach($carinfo as $kye=>$val){
if($val['Name']=='开票日期'){
$bill_time = $val['Value'];
break;
if(!$if_usedcar){
//图片识别
$img_url = build_qiniu_image_url($file);
$orc_res = $this->tcorc->CarInvoiceInfos($img_url);
if (!$orc_res['code']) {
return $this->show_json(2, $orc_res['msg']);
}
$bill_time = date('Y-m-d H:i:s');
$carinfo = $orc_res['data']['CarInvoiceInfos'];
if(is_array($carinfo)){
foreach($carinfo as $kye=>$val){
if($val['Name']=='开票日期'){
$bill_time = $val['Value'];
break;
}
}
}
$jsondata['infos'] = $carinfo;
}
$jsondata['infos'] = $carinfo;
$update['file'] = $file;
$update['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
$result = $this->order_bills_model->update($update, ['o_id' => $row_order['id']]);
@@ -897,7 +900,9 @@ class Orders extends HD_Controller
, 'com_time' => $bill_time, 'biz_id' => $re_i['biz_id'], 'addr_id' => $re_i['addr_id']);
$this->items_entity->add_log($params);
}
$this->receiver_orders_v2_model->update(['bill_time' => $bill_time], ['id' => $row_order['id']]);
$update = ['bill_time'=>$bill_time];
$if_usedcar && $update['if_usedcar'] = 1;
$this->receiver_orders_v2_model->update($update, ['id' => $row_order['id']]);
$this->orders_status_entity->set_status($row_order['id'],3,1);
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
} else {
+35 -6
View File
@@ -663,17 +663,46 @@
, shade: 0.3
, time: false
});
var value = $(obj).val();
var that = this;
$.post("/receiver/orderv2/orders/edit_bill", {
'id': <?=$info['id']?>,
'value': value,
}, function (data) {
var params = {
'id':<?=$info['id']?>,
'value': $(obj).val()
}
$.post("/receiver/orderv2/orders/edit_bill", params, function (data) {
layer.closeAll()
if (data.code) {
if (data.code==1) {
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
$.form.reload();
});
} else if(data.code==2) {
layer.open({
type: 0,
// title: '标题',
content:data.msg,
btn: ['重新上传','二手车'],
btn1:function(index, layero){
// 按钮1的逻辑
layer.closeAll()
},
btn2:function(index, layero){
// 按钮2的逻辑
layer.closeAll()
params['if_usedcar'] = 1
$.post("/receiver/orderv2/orders/edit_bill", params, 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')
},
cancel: function(){
// 右上角关闭事件的逻辑
}
});
} else {
layer.msg(data.msg, {icon: 2});
}