Commit b4b506a5 by 朱继来

回传合同

parent 0d9ade8b
......@@ -1705,6 +1705,25 @@ Class OrderController extends Controller
}
}
// 回传合同
public function uploadContract(Request $request)
{
if ($request->isMethod('post')) {
$order_id = $request->input('order_id');
$data['upload_contract_url'] = $request->input('url');
DB::connection('order')->transaction(function() use ($request, $order_id, $data) {
DB::connection('order')->table('lie_order')->where('order_id', $order_id)->update(['erp_syn'=>1]); // 标记ERP同步
DB::connection('order')->table('lie_order_extend')->where('order_id', $order_id)->update($data);
$OrderActionLogModel = new OrderActionLogModel();
$OrderActionLogModel->addLog($order_id, $request->user->userId, 2, '回传合同'); // 操作记录
});
return ['errcode'=>0, 'errmsg'=>'回传合同成功'];
}
}
public function tempCount(Request $request)
{
$current = strtotime(date('Y-m-d', time())); // 当天0点
......
......@@ -394,4 +394,16 @@ function utf8_strlen($string = null) {
preg_match_all("/./us", $string, $match);
// 返回单元个数
return count($match[0]);
}
//上传文件接口签名
function Autograph(){
$url=Config('website.api_domain');
$data['k1']=time();
$data['k2']=MD5(MD5($data['k1']).Config('website.upload_key'));
echo '<script>
k1="'.$data['k1'].'";
k2="'.$data['k2'].'";
UploadImgUrl="'.$url.'"
</script>';
}
\ No newline at end of file
......@@ -134,6 +134,7 @@ Route::group(['middleware' => 'web'], function () {
Route::match(['get', 'post'], '/return_edit/{id}', 'OrderController@orderReturnEdit');
Route::post('/ajax/addGoods', 'AddOrderController@addGoods');
Route::post('/ajax/uploadContract', 'OrderController@uploadContract');
});
// 不需要登陆态
......
......@@ -16,6 +16,7 @@ return [
'order_url' => 'http://order.liexin.net',
// API项目
'api_domain' => 'http://api.liexin.com/',
'upload_key' => 'fh6y5t4rr351d2c3bryi', // 上传文件key
// 权限系统
'perm_url' => 'http://perm.liexin.net',
// 获取用户权限接口
......
......@@ -880,6 +880,70 @@
})
})
//上传图片按扭事件
$(document).on('click', '#upload-contract', function(){
var order_id = $(this).data('id');
var form = $('<form id="formUpload" enctype="multipart/form-data">\
<input type="file" name="upload" accept="application/pdf">\
</form>');
form.appendTo('body');
form.find('input').change(function(){
// 预览图片
var file = this;
var formData = new FormData();
formData.append('upload', this.files[0]);
formData.append('source', 1);
formData.append('k1', k1);
formData.append('k2', k2);
$.ajax({
url : UploadImgUrl+'oss/upload',
type : 'post',
data : formData,
dataType : 'json',
cache : false,
processData: false,
contentType: false,
xhrFields: {withCredentials: true},
success : function(res){
if(res.code == 200){
layer.msg(res.message);
var data = res.data;
$.ajax({
url: '/ajax/uploadContract',
type: 'post',
data: {order_id: order_id, url: data[0]},
dataType: 'json',
success: function(res) {
if (res.errcode == 0) {
location.reload();
return false;
}
layer.msg(res.errmsg);
},
error : function(err){
console.log(err);
}
})
return false;
}
layer.msg(res.message);
},
error : function(err){
console.log(err);
}
})
});
form.find('input[type="file"]').trigger('click');
})
},
//物流信息
......
......@@ -5,7 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单管理后台 | 订单详情</title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
{{ Autograph() }}
@include('orderlist.css')
@include('orderlist.js')
</head>
......
......@@ -749,6 +749,11 @@
<a href="javascript:;" data-id="{{$order_info['order_id']}}" data-sn="{{$order_info['order_sn']}}" class="btn btn-success offline-paid">线下转账</a>
@endif
<!-- 回传合同 -->
@if ($order_info['status'] == 2)
<a class="btn btn-warning" id="upload-contract" data-id="{{$order_info['order_id']}}">回传合同</a>
@endif
@if (in_array($order_info['status'], array(4, 7, 8, 10)) && in_array('order_send', $userPerms))
<!-- <a href="{{URL('send', ['order_id'=>$order_info['order_id']])}}" class="btn btn-default">订单发货</a> -->
@endif
......
......@@ -309,14 +309,18 @@
<a class="btn btn-info" href="{{URL('sendSales', ['order_id'=>$v['order_id']])}}" target="_blank">推送</a>
@endif
<?php
?>
@if ($v['status'] > 1 && in_array('download_contract', $userPerms))
<a class="btn btn-default download-contract" data-id="{{$v['order_id']}}" href="javascript:;">下载合同</a>
@endif
<?php
$extend = App\Http\Controllers\getOrderExtend($v['order_id'], 'upload_contract_url');
if (!empty($extend->upload_contract_url)) {
echo '<a class="btn btn-warning" href="'.$extend->upload_contract_url.'" target="_blank">客户合同下载</a>';
}
?>
@if ($v['status'] == -1 && !$v['cancel_reason'])
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$v['order_id']}}" data-type="4">填写取消原因</a>
@endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment