Commit 42704382 by 朱继来

Merge branch 'zjl_order_invoice_20181123'

parents 58884bd1 48887e9e
......@@ -245,6 +245,21 @@ function getSelfStock($goods_id)
}
}
// 调用财务系统接口判断是否能修改发票
function isChangeInvoice($order_sn)
{
$url = Config('website.finance-self-invoice-url');
$data['order_sn'] = $order_sn;
$res = json_decode(curlApi($url, $data, 'POST'), true);
if ($res['err_code'] == 0) {
return true;
} else {
return false;
}
}
Class OrderController extends Controller
{
// 首页
......@@ -1145,7 +1160,6 @@ Class OrderController extends Controller
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$data['id'] = $request->input('order_id','');
$data['operator_id'] = $request->user->userId;
$update_url = Config('website.api_domain').'order/updateOrderInvoice';
......
......@@ -68,4 +68,7 @@ return [
// 获取自营商品库存
'self-stock-url' => 'http://footstone.liexin.net/webapi/goods_details?sku_id=',
// 财务系统接口地址 (自营发票)
'finance-self-invoice-url' => 'http://192.168.1.97/webapi/checkOrderBillStatus',
];
......@@ -686,10 +686,28 @@
$('#inv_type').click(function(){
var val = $(this).val();
if (val == 2) {
if (val == 1) { // 不开票
$('.tax_title_section').hide();
$('.add_tax').hide();
$('input[name=tax_title]').val('');
$('input[name=tax_no]').val('');
$('input[name=bank_name]').val('');
$('input[name=bank_account]').val('');
$('input[name=company_phone]').val('');
$('textarea[name=company_address]').val('');
} else if (val == 2) { // 普票
$('.tax_title_section').show();
$('.add_tax').hide();
$('.invoice_title').attr('colspan', 3);
} else{
$('input[name=tax_no]').val('');
$('input[name=bank_name]').val('');
$('input[name=bank_account]').val('');
$('input[name=company_phone]').val('');
$('textarea[name=company_address]').val('');
} else { // 增票
$('.tax_title_section').show();
$('.add_tax').show();
$('.invoice_title').attr('colspan', 0);
}
......
......@@ -48,7 +48,7 @@
</td>
</tr>
<tr>
<tr class="tax_title_section">
<td>发票抬头</td>
<td class="invoice_title">
<input type="text" name="tax_title" value="{{$detail['tax_title']}}">
......@@ -77,7 +77,7 @@
</td>
<td>公司注册地址</td>
<td>
<textarea name="company_address" id="company_address" cols="50" rows="2" placeholder="请填写详细地址">{{$detail['company_address']}}</textarea>
<textarea name="company_address" id="company_address" class="form-control" placeholder="请填写详细地址">{{$detail['company_address']}}</textarea>
</td>
</tr>
......@@ -97,5 +97,19 @@
$.lie.order.details();
var inv_type = '{{$detail['inv_type']}}';
if (inv_type == 1) {
$('.tax_title_section').hide();
$('.add_tax').hide();
} else if (inv_type == 2) {
$('.tax_title_section').show();
$('.add_tax').hide();
$('.invoice_title').attr('colspan', 3);
} else{
$('.tax_title_section').show();
$('.add_tax').show();
$('.invoice_title').attr('colspan', 0);
}
$('#inv_type').val(inv_type);
</script>
\ No newline at end of file
......@@ -221,9 +221,21 @@
<a href="/changeInvoice/{{$order_info['order_id']}}" class="btn btn-success btn-sm changeBtn">更改发票</a>
@endif
@elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'self' && !$extend)
@if(in_array($order_info['status'], [1, 2, 3, 4]) && $order_invoice_info['invoice_status'] < 2 && in_array('self_order_update_invoice', $userPerms))
<a href="/changeInvoice/{{$order_info['order_id']}}?tags={{$_REQUEST['tags']}}" class="btn btn-success btn-sm changeBtn">更改发票</a>
@endif
<?php
if ($order_info['status'] > 3) { // 已付款请求财务接口判断是否能修改发票
$isChangeInvoice = App\Http\Controllers\isChangeInvoice($order_info['order_sn']);
if ($isChangeInvoice) {
echo '<a href="/changeInvoice/'.$order_info['order_id'].'?tags='.$_REQUEST['tags'].'" class="btn btn-success btn-sm changeBtn">更改发票</a>';
}
} else {
if ($order_invoice_info['invoice_status'] < 2 && in_array('self_order_update_invoice', $userPerms)) {
echo '<a href="/changeInvoice/'.$order_info['order_id'].'?tags='.$_REQUEST['tags'].'" class="btn btn-success btn-sm changeBtn">更改发票</a>';
}
}
?>
<!-- in_array($order_info['status'], [1, 2, 3, 4]) && $order_invoice_info['invoice_status'] < 2 && in_array('self_order_update_invoice', $userPerms) -->
}
@elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'erp')
<a href="/changeInvoice/{{$order_info['order_id']}}?tags={{$_REQUEST['tags']}}" class="btn btn-success btn-sm changeBtn">更改发票</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