liche update for admin order upload idcard

This commit is contained in:
xxb
2021-09-22 19:48:05 +08:00
committed by xiaoyu
parent 4a84d6e2e2
commit 9b90f868d4
4 changed files with 115 additions and 26 deletions
+43 -6
View File
@@ -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');
+45 -17
View File
@@ -68,20 +68,30 @@
</div>
</div>
<div class="am-form-inline am-u-lg-12">
<div class="am-form-group am-u-lg-6">
<template v-if="info.bill && (info.bill.cardidA || info.bill.cardidB)">
<label class="am-para-label label-width"><span class="span-bold">身份证图片:</span></label>
<div class="am-para-input">
<div id="layer-photos-demo" class="layer-photos-demo">
<img v-if="info.bill && info.bill.cardidA" :layer-src="info.bill.cardidA"
:src="info.bill.cardidA" class="w100" alt="身份证正面" @click="show_carimg"
style="height:50px;">
<img v-if="info.bill && info.bill.cardidB" :layer-src="info.bill.cardidB"
:src="info.bill.cardidB" class="w100" alt="身份证反面" @click="show_carimg"
style="height:50px">
</div>
<div class="am-form-group am-u-lg-12">
<label class="am-para-label label-width"><span class="span-bold">身份证图片:</span></label>
<div class="am-para-input">
<div id="layer-photos-demo" class="layer-photos-demo fl">
<img v-if="info.bill && info.bill.cardidA && info.bill.cardidA.src" :layer-src="info.bill.cardidA.src"
:src="info.bill.cardidA.src" class="w100" alt="身份证正面" @click="show_carimg"
style="height:50px;">
<img v-if="info.bill && info.bill.cardidB && info.bill.cardidB.src" :layer-src="info.bill.cardidB.src"
:src="info.bill.cardidB.src" class="w100" alt="身份证反面" @click="show_carimg"
style="height:50px">
</div>
</template>
<button type="button" class="am-btn am-btn-default am-btn-sm fl ml10"
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-params-source="vue_obj.info.bill.cardidA">
<i class="am-icon-cloud-upload"></i> 上传身份证正面
</button>
<button type="button" class="am-btn am-btn-default am-btn-sm fl ml10"
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-params-source="vue_obj.info.bill.cardidB">
<i class="am-icon-cloud-upload"></i> 上传身份证反面
</button>
<button type="button" class ="am-btn am-btn-primary am-btn-sm fl ml10"
v-if="info.bill && (info.bill.cardidA || info.bill.cardidB)" @click="save_cardID">保存身份证</button>
</div>
</div>
</div>
</div>
@@ -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');
}
}
});
+21 -2
View File
@@ -57,6 +57,7 @@
img_value = file_url;
}
<?if($source){?>
var source = window.parent.<?=$source?>;
var img = {
src: url,
value: img_value,
@@ -64,7 +65,16 @@
height: file._info.height,
rheight:file.picHeight//相对高度
};
window.parent.<?=$source?>.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="<?=$field?>"]').map(function () {
if (field == 'icon') {
@@ -174,7 +184,16 @@
var source = window.parent.<?=$source?>;
var mode = <?=$mode ? $mode : 0?>;
imgs.map(function(v,i){
if(0==mode || source.length<mode){
if(1 == mode){
//单张图替换对象
if(source instanceof Array){//源数据为数组
console.log(source);
source.splice(0, 1, v);
} else {//源数据为对象
source = v;
}
} else if(0==mode || source.length<mode){
//多张图限制上传
source.push(v);
}
});
+6 -1
View File
@@ -71,7 +71,12 @@
var mode = <?=$mode ? $mode : 0?>;
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<mode){
source.push(v);
}