From 9b90f868d4fbb9d39a06d9b6899f32c99806603f Mon Sep 17 00:00:00 2001 From: xxb Date: Wed, 22 Sep 2021 19:48:05 +0800 Subject: [PATCH] liche update for admin order upload idcard --- admin/controllers/receiver/Orders.php | 49 ++++++++++++++++++--- admin/views/receiver/orders/get.php | 62 +++++++++++++++++++-------- admin/views/upload.php | 23 +++++++++- admin/views/uploadpdf.php | 7 ++- 4 files changed, 115 insertions(+), 26 deletions(-) diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php index 6d0237ae..75cb8aa6 100644 --- a/admin/controllers/receiver/Orders.php +++ b/admin/controllers/receiver/Orders.php @@ -143,8 +143,8 @@ class Orders extends HD_Controller //获取开票 $bill = $this->order_bills_model->get(['o_id' => $row['id']], 'status,file,cardidA,cardidB'); $bill['file'] = $bill['file'] ? build_qiniu_image_url($bill['file']) : ''; - $bill['cardidA'] = $bill['cardidA'] ? build_qiniu_image_url($bill['cardidA']) : ''; - $bill['cardidB'] = $bill['cardidB'] ? build_qiniu_image_url($bill['cardidB']) : ''; + $bill['cardidA'] = $bill['cardidA'] ? array('value' => $bill['cardidA'], 'src' => build_qiniu_image_url($bill['cardidA'])) : array('value' => '', 'src' =>''); + $bill['cardidB'] = $bill['cardidB'] ? array('value' => $bill['cardidB'], 'src' => build_qiniu_image_url($bill['cardidB']) ) : array('value' => '', 'src' => ''); $bill['status'] = intval($bill['status']); $row['bill'] = $bill; //获取合同文件 @@ -210,6 +210,7 @@ class Orders extends HD_Controller $row['car_imgs'] = $car_imgs; $info = $row; $this->data['info'] = $info; + $this->data['_title'] = '订单详情'; return $this->show_view('receiver/orders/get', true); } @@ -224,6 +225,44 @@ class Orders extends HD_Controller { } + /** + * 更新身份证信息 + * @return bool + */ + function edit_cardID(){ + $o_id = $this->input->post('o_id'); + $cardidA = $this->input->post('cardidA'); + $cardidB = $this->input->post('cardidB'); + if(!$cardidA || !$cardidB){ + return $this->show_json(SYS_CODE_FAIL,'请上传身份证照片'); + } + + $this->load->library('TcOrc'); + $cardidA_src = build_qiniu_image_url($cardidA); + $result = $this->tcorc->IdentityCard($cardidA_src); + if(!$result['code']){ + return $this->show_json(SYS_CODE_FAIL,'身份证校验不通过'); + } else { + //校验姓名 + $uname = $result['data']['Name']; + $row_order = $this->orders_model->get(['id'=>$o_id]); + if($uname != $row_order['name']){ + return $this->show_json(SYS_CODE_FAIL,'身份证姓名与客户不一致'); + } + } + + $upd = array( + 'cardidA' => $cardidA, + 'cardidB' => $cardidB + ); + $result = $this->order_bills_model->update($upd,['o_id'=>$o_id]); + if($result){ + return $this->show_json(SYS_CODE_SUCCESS,'保存成功'); + }else{ + return $this->show_json(SYS_CODE_FAIL,'保存失败'); + } + } + //删除单条数据 public function del() { @@ -384,10 +423,8 @@ class Orders extends HD_Controller $this->data['bill'] = $bill; return $this->show_view('receiver/orders/get_bill'); } - - //编辑发表信息 - public function edit_bill() - { + //编辑发票信息 + public function edit_bill(){ $id = $this->input->post('id'); $money = $this->input->post('money'); $file = $this->input->post('file'); diff --git a/admin/views/receiver/orders/get.php b/admin/views/receiver/orders/get.php index f34f5425..d4beb85c 100644 --- a/admin/views/receiver/orders/get.php +++ b/admin/views/receiver/orders/get.php @@ -68,20 +68,30 @@
-
- + + + +
@@ -213,12 +223,12 @@ }, methods: { setauto: function (type) { - var that = this - var p_data = {'tp': 1, 'type': type} + var that = this; + var p_data = {'tp': 1, 'type': type}; if (type == 2) { - p_data['pid'] = that.brand_id + p_data['pid'] = that.brand_id; } else if (type == 3) { - p_data['pid'] = that.s_id + p_data['pid'] = that.s_id; } $.get("/common/auto", p_data, function (result) { if (type == 1) { @@ -416,6 +426,24 @@ photos: '#layer-photos-demo' , anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) }); + }, + //保存 + save_cardID:function(){ + var that = this; + var data_post = { + o_id:that.info.id, + cardidA:that.info.bill.cardidA.value, + cardidB:that.info.bill.cardidB.value + }; + $.post("/receiver/orders/edit_cardID", data_post, function (data) { + if (data.code) { + layer.msg(data.msg, {time: 2000, icon: 1}, function () { + $.form.reload(); + }); + } else { + layer.msg(data.msg, {icon: 2}); + } + }, 'json'); } } }); diff --git a/admin/views/upload.php b/admin/views/upload.php index 9caf948a..42b2f0d9 100755 --- a/admin/views/upload.php +++ b/admin/views/upload.php @@ -57,6 +57,7 @@ img_value = file_url; } + var source = window.parent.; var img = { src: url, value: img_value, @@ -64,7 +65,16 @@ height: file._info.height, rheight:file.picHeight//相对高度 }; - window.parent..splice(0, 1, img); + //单张图替换对象 + if(source instanceof Array){//源数据为数组 + source.splice(0, 1, img); + } else {//源数据为对象,编辑属性才能触发渲染 + source.src = img.src; + source.value = img.value; + source.width = img.width; + source.height = img.height; + source.rheight = img.rheight; + } top.$('[name=""]').map(function () { if (field == 'icon') { @@ -174,7 +184,16 @@ var source = window.parent.; var mode = ; imgs.map(function(v,i){ - if(0==mode || source.length; files.map(function(v,i){ if(1 == mode){//只有一个替换 - source.splice(0, 1, v); + //单个替换对象 + if(source instanceof Array){//源数据为数组 + source.splice(0, 1, v); + } else {//源数据为对象 + source = v; + } } else if(0==mode || source.length