orders upload bill_file, loan_file, notice_file
This commit is contained in:
@@ -698,6 +698,45 @@ class Orders extends HD_Controller
|
||||
return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
}
|
||||
|
||||
//修改分期图片
|
||||
public function edit_loanfile()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
$oid = $params['id'];
|
||||
$file = $params['value'];
|
||||
|
||||
$row_order = $this->receiver_orders_v2_model->get(array('id' => $oid));
|
||||
if(!$file || !$row_order){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
|
||||
$row = $this->order_loans_model->get(['o_id' => $oid]);
|
||||
if (!$row) {
|
||||
$this->order_loans_model->add(['o_id' => $oid, 'c_time' => time()]);
|
||||
$row = $this->order_loans_model->get(['o_id' => $oid]);
|
||||
}
|
||||
$notify_file_list = $row['notify_file'] ? explode(',',$row['notify_file']) : [];
|
||||
$update = [];
|
||||
if ($file) { //上传按揭通知函
|
||||
if ($params['type']) {
|
||||
$update['lend_file'] = $file;
|
||||
# 此处不检查load_time为空的情况,最后做“按揭完成”时也会检查
|
||||
$loan_time = $params['loan_time'];
|
||||
if ($loan_time) {
|
||||
$update['loan_time'] = date('Y-m-d H:i:s', strtotime($loan_time));
|
||||
}
|
||||
} else {
|
||||
$notify_file_list[] = $file;
|
||||
$update['notify_file'] = implode(',',$notify_file_list);
|
||||
}
|
||||
$this->data['file_url'] = build_qiniu_image_url($file);
|
||||
}
|
||||
if($update){
|
||||
$result = $this->order_loans_model->update($update, ['id' => $row['id']]);
|
||||
}
|
||||
return $result ? $this->show_json(SYS_CODE_SUCCESS, '保存成功') : $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
|
||||
//修改分期
|
||||
public function edit_loan()
|
||||
{
|
||||
|
||||
@@ -307,9 +307,10 @@
|
||||
<div class="am-form-group" v-if="info.bill && info.bill.file">
|
||||
<div v-if="info.bill.file_type=='img'" class="fl ml10">
|
||||
<img id="viewer-bill_file_img" :layer-src="info.bill.file"
|
||||
:src="info.bill.file" class="w100" alt="发票"
|
||||
:src="info.bill.file+'?imageView2/2/w/640/h/0/interlace/1'" class="w100" alt="发票"
|
||||
onclick="showViewer('viewer-bill_file_img')"
|
||||
style="height:auto;max-height:32px;max-width:50px;margin-left: 5px">
|
||||
<a :href="info.bill.file" target="_blank">查看原图</a>
|
||||
</div>
|
||||
<a v-else :href="info.bill.file" target="_blank" class="mt5"
|
||||
style="width:100px;line-height:20px;margin-left:5px;">查看发票</a>
|
||||
@@ -715,6 +716,33 @@
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
function upLoanFile(type, obj) {
|
||||
var that = this;
|
||||
var params = {
|
||||
'id':<?=$info['id']?>,
|
||||
'value': $(obj).val(),
|
||||
'type': type
|
||||
};
|
||||
if (type) {
|
||||
var loan_time = $('#loan_time').val();
|
||||
if (!loan_time) {
|
||||
layer.msg("请填写放款时间");
|
||||
return;
|
||||
}
|
||||
params['loan_time'] = loan_time;
|
||||
}
|
||||
$.post("/receiver/orderv2/orders/edit_loanfile", params, function (data) {
|
||||
layer.closeAll()
|
||||
if (data.code==1) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
function edit_bill_img(obj) {
|
||||
var loading = layer.msg('上传中', {
|
||||
icon: 16
|
||||
|
||||
@@ -76,12 +76,23 @@
|
||||
<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">
|
||||
<label class="input-group-btn" style="width: 50px;">
|
||||
<label class="input-group-btn" style="width: 50px; display: none">
|
||||
<span class="am-btn am-btn-default am-btn-sm">
|
||||
<i class="am-icon-cloud-upload"></i> 选择文件
|
||||
<input type="file" style="display: none;" accept="jpg,png,gif,png,jpeg" @change="upTz(0,$event)">
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div class="am-form-group">
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-default am-btn-sm" data-file="1"
|
||||
data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="loan_file">
|
||||
<input type="hidden" class="loan_file" name="loan_file" data-type="0" value=""
|
||||
onchange="upLoanFile(0,this)">
|
||||
<i class="am-icon-cloud-upload"></i> 选择文件
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<ul id="viewer-notify_file" class="photopic-list clearfix mt10" v-if="info.loan_info && info.loan_info.notify_file_list">
|
||||
<? foreach ($info['loan_info']['notify_file_list'] as $key=>$val) {?>
|
||||
<li style="position:relative;">
|
||||
@@ -148,13 +159,22 @@
|
||||
</ul>
|
||||
<? } else { ?>
|
||||
<div class="am-form-group">
|
||||
<label class="input-group-btn" style="width: 50px;">
|
||||
<label class="input-group-btn" style="width: 50px;; display: none">
|
||||
<span class="am-btn am-btn-default am-btn-sm">
|
||||
<i class="am-icon-cloud-upload"></i> 选择文件
|
||||
<input type="file" style="display: none;" accept="jpg,png,gif,png,jpeg"
|
||||
@change="upTz(1,$event)"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-default am-btn-sm" data-file="1"
|
||||
data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="notify_file">
|
||||
<input type="hidden" class="notify_file" id="notify_file" name="notify_file" data-type="1" value=""
|
||||
onchange="upLoanFile(1,this)">
|
||||
<i class="am-icon-cloud-upload"></i> 选择文件
|
||||
</a>
|
||||
</div>
|
||||
<div class="am-form-group ml10" v-if="info.loan_info.lend_file">
|
||||
<a :href="info.loan_info.lend_file" target="_blank" class='mt5' title="查看文件">
|
||||
{{info.loan_info.lend_file_name}}
|
||||
|
||||
@@ -396,14 +396,16 @@
|
||||
fileSizeLimit: 200 * 1024 * 1024, // 200 M
|
||||
fileSingleSizeLimit: 200 * 1024 * 1024, // 200 M
|
||||
compress: {
|
||||
width: 1600,
|
||||
width: 1600 * 2,
|
||||
height: 16000,
|
||||
crop: false, // 是否允许裁剪
|
||||
quality: 90, // 图片质量(只有type为`image/jpeg`的时候才有效)
|
||||
// quality: 90, // 图片质量(只有type为`image/jpeg`的时候才有效)
|
||||
quality: <?=$field == "bill_file" ? 100 : 90?>,
|
||||
allowMagnify: false, // 是否允许放大(如果想要生成小图的时候不失真,此选项应该设置为false).
|
||||
preserveHeaders: true, // 是否保留头部meta信息
|
||||
noCompressIfLarger: false, // 如果发现压缩后文件大小比原来还大,则使用原来图片
|
||||
compressSize: 1024 * 512, // 单位字节(如果图片大小小于此值,不会采用压缩)
|
||||
noCompressIfLarger: true, // 如果发现压缩后文件大小比原来还大,则使用原来图片
|
||||
// compressSize: 1024 * 512 * 2, // 单位字节(如果图片大小小于此值,不会采用压缩)
|
||||
compressSize: <?=$field == "bill_file" ? 1024 * 512 * 2 * 6 : 1024 * 512 * 2?>, // 单位字节(如果图片大小小于此值,不会采用压缩)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user