Commit d0dc3d31 by 朱继来

合并审单和调价功能

parent da6afce7
......@@ -344,9 +344,20 @@ Class OrderController extends Controller
$info = $this->orderDetail($request, $id);
//待审核才可以
if($info['order_info']['status'] != 1){
return redirect('/prompt')->with(['message'=>"该订单不符合调价条件~【status:{$info['order_info']['status']}】",'url' =>$_SERVER['HTTP_REFERER'], 'jumpTime'=>3,'status'=>false]);
}
// if($info['order_info']['status'] != 1){
// return redirect('/prompt')->with(['message'=>"该订单不符合人工审单条件~【status:{$info['order_info']['status']}】",'url' =>$_SERVER['HTTP_REFERER'], 'jumpTime'=>3,'status'=>false]);
// }
// 获取所有的业务员
$sale_list = $this->getSales('销售');
$perm = new PermController;
$manager = $perm->getRoleUsers($request, '经理');
$sale_list = $perm->getRoleUsers($request, '交易员');
$info['sale_list'] = $sale_list;
$info['manager'] = $manager;
return view('detail', $info);
}
......@@ -406,6 +417,9 @@ Class OrderController extends Controller
$check['k2'] = md5(md5($check['k1']).'fh6y5t4rr351d2c3bryi');
$resData = [
"cancel_reason" => $request->input('cancel_reason', ''),
"sale_id" => $request->input('sale_id', ''),
"status" => $request->input('order_status', ''),
"deposit_amount" => $request->input('deposit_amount', ''),
"goods_amount" => $request->input('goods_amount', ''),
"order_amount" => $request->input('order_amount', ''),
......
......@@ -7,6 +7,10 @@
padding: 2px;
}
.btn-group-xs a{
margin-right: 5px;
}
/* 文本颜色 */
.list-text-no-check{color: #FFB5B5;}
.list-text-cancel{color: #999;}
......@@ -247,4 +251,11 @@ input[type="color"],
border-bottom-right-radius: 5px;
padding: 10px;
text-align: center;
}
.show-advance-pay{
display: none;
}
.error{
color: red;
}
\ No newline at end of file
......@@ -220,8 +220,8 @@
if(action_type=='account'){
self.account();
}
if(action_type=='check'){
self.check();
if(action_type=='changeOrder'){
self.changeOrder();
}
$.lie.droplist($('.droplist'));
......@@ -293,100 +293,7 @@
}
})
});
//文本框输入事件,任何非正整数的输入都重置为1
$('.only_positive_nubme').off().on('keyup', function(){
if(!$(this).val()){
return false;
}
if(!(/^\d{0,7}(\.\d{0,4})?$/g.test( $(this).val()))){//判断输入是否合法,不合法强制转换
if(isNaN(parseFloat($(this).val()))){
layer.msg('只能是正整数');
$(this).val('');
}else{
$(this).val(parseFloat($(this).val()).toFixed(0));
}
}
if($(this).val()>999999999){
$(this).val(999999999);
}
if($(this).val().length>11){
$(this).val($(this).val().slice(0,11));
}
});
$('.only_number').off().on('keyup', function(){
if(!$(this).val()){
return false;
}
if(!(/^\d{0,7}(\.\d{0,4})?$/g.test( $(this).val()))){//判断输入是否合法,不合法强制转换
if(isNaN(parseFloat($(this).val()))){
layer.msg('只能是数字和小数组成');
$(this).val('');
}else{
$(this).val(parseFloat($(this).val()).toFixed(4));
}
}
if($(this).val()>999999.9999){
$(this).val(999999.9999);
}
if($(this).val().length>11){
$(this).val($(this).val().slice(0,11));
}
///$('.total').html('¥'+($(this).val()*$('.num').html()).toFixed(4));
});
$('.deletegoods').click(function(){
var thisobj=$(this);
layer.open({
title: '删除商品'
,content: '<div><textarea type="text" class="reason" style="width:300px;height: 100px"></textarea></div><span class="error">请填写删除商品原因,100字以内</span>'
,btn:['取消','确定']
,yes: function(index, layero){
layer.close(index);
}
,btn2: function(index, layero){
if(!$('.reason').val()){
layer.tips('请填写删除商品原因',$('.reason'));
return false;
}
deletegoods(thisobj);
}
});
})
function deletegoods(thisobj){
$.ajax({
type: 'post',
url:'/ajaxdeletegoods',
data:{ rec_id:thisobj.attr('data-id'),
reason:$('.reason').val()
},
dataType: 'json',
success: function(resp) {
if(!resp){
layer.msg('网络错误');
return false;
}
if(resp.errcode>100 && resp.errcode<200){
layer.tips(resp.errmsg,$('.'+resp.obj));
return false;
}
if(resp.errcode>0 && resp.errcode<99){
layer.msg(resp.errmsg);
return false;
}
if(resp.errcode==0){
location.reload();//刷新本页
return false;
}
return false;
}
});
}
//保存订单状态
$('select[name="order_status"]').on('change', function() {
var param = {};
......@@ -658,71 +565,8 @@
});
});
$('.order-change-table input').on('blur', function(){
var table = $('.order-change-table');
var goods_total = 0;
$(table).find('tr').each(function(){
var num = parseInt($(this).find('.num').val()) || 0;
var price = parseFloat($(this).find('.price').val()) || 0;
goods_total += parseFloat(num * price);
});
var fee = parseFloat($('input[name="extra_fee"]').val());
goods_total = goods_total.toFixed(2);
var total = parseFloat(goods_total + fee).toFixed(2);
$('.goods_total').html(goods_total);
$('input[name="goods_amount"]').val(goods_total);
$('input[name="order_amount"]').val(total);
$('.total').html(total);
$('.advance').val((total*0.3).toFixed(2));
})
$('.advance').on('blur',function(){
if($(this).val()<($('.total').html()*0.2)){
$(this).val(parseFloat($('.total').html()*0.2).toFixed(2));
layer.tips('预付款金额不能小于'+$('.total').html()*0.2,$(this));
}
if($(this).val()>($('.total').html()*0.5)){
$(this).val(parseFloat($('.total').html()*0.5).toFixed(2));
layer.tips('预付款金额不能大于'+$('.total').html()*0.5,$(this));
}
})
// 订单审核---通过or不通过
$('input[name="order_status"]').parent().on('click', function(){
if($(this).find('input').val() == 2){
$('.cancle_reason').hide();
} else {
$('.cancle_reason').show();
}
});
$('.cancle_reason label').click(function(){
if($(this).find('input').val() == 1){
var reason = $('textarea[name="reason"]').val();
} else {
var reason = $(this).text();
}
$('input[name="cancel_reason"]').val(reason);
});
$('textarea[name="reason"]').on('blur', function(){
if($('.cancle_reason input[name="reason"]:checked').val() == 1){
$('input[name="cancel_reason"]').val($(this).val());
}
});
$('input[name="extra_fee"]').on('blur', function(){
var fee = parseFloat($(this).val());
var goods_total = parseFloat($('.goods_total').html());
if (isNaN(fee)) {
fee = 0.0000;
}
var total = parseFloat(goods_total + fee).toFixed(2);
$('input[name="goods_amount"]').val(goods_total);
$('input[name="order_amount"]').val(total);
$('.total').html(total);
$('.advance').val((total*0.3).toFixed(2));
})
},
//物流信息
......@@ -998,44 +842,332 @@
});
})
},
//审核
check: function(){
var dialog;
$('.adjust').on('click', function(){
var url = $(this).data('url');
dialog = $.lie.dialog({
css: {width:600, height: 400},
title: '再次调价备注',
url: url,
isloading: true,
button: []
//人工审单
changeOrder: function(){
$('.deletegoods').click(function(){
var thisobj=$(this);
layer.open({
title: '删除商品'
,content: '<div><textarea type="text" class="reason" style="width:300px;height: 100px"></textarea></div><span class="error">请填写删除商品原因,100字以内</span>'
,btn:['取消','确定']
,yes: function(index, layero){
layer.close(index);
}
,btn2: function(index, layero){
if(!$('.reason').val()){
layer.tips('请填写删除商品原因',$('.reason'));
return false;
}
deletegoods(thisobj);
}
});
})
function deletegoods(thisobj){
$.ajax({
type: 'post',
url:'/ajaxdeletegoods',
data:{ rec_id:thisobj.attr('data-id'),
reason:$('.reason').val()
},
dataType: 'json',
success: function(resp) {
if(!resp){
layer.msg('网络错误');
return false;
}
if(resp.errcode>100 && resp.errcode<200){
layer.tips(resp.errmsg,$('.'+resp.obj));
return false;
}
if(resp.errcode>0 && resp.errcode<99){
layer.msg(resp.errmsg);
return false;
}
if(resp.errcode==0){
location.reload();//刷新本页
return false;
}
return false;
}
});
}
// 根据币种和订单金额判断付款类型
function checkPayType(orderAmount, orderPayType, min_price, max_price)
{
if (orderAmount < min_price) {
$('.order_all_pay').attr('checked', true);
$('.order_advance_pay').parent('label').hide();
} else if (orderAmount >= min_price && orderAmount <= max_price) {
// 判断付款类型
if (orderPayType == 1) {
$('.order_all_pay').attr('checked', true);
$('.order_advance_pay').parent('label').show();
} else if (orderPayType == 2) {
$('.order_advance_pay').attr('checked', true);
$('.order_advance_pay').parent('label').show();
}
} else {
$('.order_all_pay').attr('checked', true);
$('.order_advance_pay').parent('label').show();
}
}
if (currency == 1) { // 人民币
checkPayType(order_amount, order_pay_type, 10000, 49999);
} else {
checkPayType(order_amount, order_pay_type, 1500, 7800);
}
// 选择付款类型
$('input[name=order_pay_type]').click(function(){
var val = $(this).val();
if (val == 1) {
$('.show-advance-pay').hide();
} else {
$('.show-advance-pay').show();
}
})
//文本框输入事件,任何非正整数的输入都重置为1
$('.only_positive_nubme').off().on('keyup', function(){
if(!$(this).val()){
return false;
}
if(!(/^\d{0,7}(\.\d{0,4})?$/g.test( $(this).val()))){//判断输入是否合法,不合法强制转换
if(isNaN(parseFloat($(this).val()))){
layer.msg('只能是正整数');
$(this).val('');
}else{
$(this).val(parseFloat($(this).val()).toFixed(0));
}
}
if($(this).val()>999999999){
$(this).val(999999999);
}
if($(this).val().length>11){
$(this).val($(this).val().slice(0,11));
}
});
$('body').on('click', '.adjust-close', function(){
if (typeof(dialog) != 'undefined') {
dialog.close();
$('.only_number').off().on('keyup', function(){
if(!$(this).val()){
return false;
}
}).on('click', '.form-submit', function(){
var $obj = $('.form-ajax:visible');
if ($obj.length) {
$obj.ajaxSubmit({
url : $(this).attr('action'),
type : 'post',
data : $(this).serialize(),
dataType : 'json',
success : function(resp){
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
if(!(/^\d{0,7}(\.\d{0,4})?$/g.test( $(this).val()))){//判断输入是否合法,不合法强制转换
if(isNaN(parseFloat($(this).val()))){
layer.msg('只能是数字和小数组成');
$(this).val('');
}else{
$(this).val(parseFloat($(this).val()).toFixed(4));
}
}
if($(this).val()>999999.9999){
$(this).val(999999.9999);
}
if($(this).val().length>11){
$(this).val($(this).val().slice(0,11));
}
///$('.total').html('¥'+($(this).val()*$('.num').html()).toFixed(4));
});
// 调整价格
$('.order-change-table input').on('blur', function(){
var table = $('.order-change-table');
var goods_total = 0;
$(table).find('tr').each(function(){
var num = parseInt($(this).find('.num').val()) || 0;
var price = parseFloat($(this).find('.price').val()) || 0;
goods_total += parseFloat(num * price);
});
var fee = parseFloat($('input[name="extra_fee"]').val());
goods_total = goods_total.toFixed(2);
var total = parseFloat(goods_total + fee).toFixed(2);
$('.goods_total').html(goods_total);
$('input[name="goods_amount"]').val(goods_total);
$('input[name="order_amount"]').val(total);
$('.total').html(total);
$('.advance').val((total*0.3).toFixed(2));
// 价格调整后,付款类型显示或隐藏
var orderPayType = $('input[name=order_pay_type]').val();
if (currency == 1) { // 人民币
checkPayType(total, orderPayType, 10000, 49999);
} else {
checkPayType(total, orderPayType, 1500, 7800);
}
})
// 定金调整
$('.advance').on('blur',function(){
if($(this).val()<($('.total').html()*0.2)){
$(this).val(parseFloat($('.total').html()*0.2).toFixed(2));
layer.tips('预付款金额不能小于'+$('.total').html()*0.2,$(this));
}
if($(this).val()>($('.total').html()*0.5)){
$(this).val(parseFloat($('.total').html()*0.5).toFixed(2));
layer.tips('预付款金额不能大于'+$('.total').html()*0.5,$(this));
}
// 价格调整后,付款类型显示或隐藏
var orderPayType = $('input[name=order_pay_type]').val();
var total = $('input[name=order_amount]').val();
if (currency == 1) { // 人民币
checkPayType(total, orderPayType, 10000, 49999);
} else {
checkPayType(total, orderPayType, 1500, 7800);
}
})
// 订单审核---通过or不通过
$('input[name="order_status"]').parent().on('click', function(){
if($(this).find('input').val() == 2){
$('.cancle_reason').hide();
} else {
$('.cancle_reason').show();
}
});
$('.cancle_reason label').click(function(){
if($(this).find('input').val() == 1){
var reason = $('textarea[name="reason"]').val();
} else {
var reason = $(this).text();
}
$('input[name="cancel_reason"]').val(reason);
});
$('textarea[name="reason"]').on('blur', function(){
if($('.cancle_reason input[name="reason"]:checked').val() == 1){
$('input[name="cancel_reason"]').val($(this).val());
}
});
// 附加费
$('input[name="extra_fee"]').on('blur', function(){
var fee = parseFloat($(this).val());
var goods_total = parseFloat($('.goods_total').html());
if (isNaN(fee)) {
fee = 0.0000;
}
var total = parseFloat(goods_total + fee).toFixed(2);
$('input[name="goods_amount"]').val(goods_total);
$('input[name="order_amount"]').val(total);
$('.total').html(total);
$('.advance').val((total*0.3).toFixed(2));
// 价格调整后,付款类型显示或隐藏
var orderPayType = $('input[name=order_pay_type]').val();
if (currency == 1) { // 人民币
checkPayType(total, orderPayType, 10000, 49999);
} else {
checkPayType(total, orderPayType, 1500, 7800);
}
})
// 提交表单
$('.checkOrder').click(function(){
var sale_id = $('input[name=sale_id]:checked').val();
var order_status = $('input[name=order_status]:checked').val();
var reason = $('input[name=reason]:checked').val();
if (sale_id == null) {
layer.msg('请选择业务员!');
return false;
}
if (order_status == -1) {console.log(reason)
if (reason == null) {
layer.msg('请选择不通过原因!');
return false;
} else if (reason == 1) {
if ($('#input-reason').val() == '') {
layer.msg('请填写其他原因!');
return false;
}
})
}
// 弹出提示
layer.open({
title: '提醒',
content: '<div>确定审核不通过吗?</div>',
btn:['取消','确定'],
yes: function(index, layero){
layer.close(index);
},
btn2: function(index, layero){
$.ajax({
url : '/ajaxCheck',
type: 'post',
data: $('#checkOrderForm').serialize(),
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function (res) {
console.log(res);
}
})
}
});
return false;
}
var currencySign = currency == 1 ? '¥' : '$';
var goods_amount = currencySign+$('input[name=goods_amount]').val();
var order_amount = currencySign+$('input[name=order_amount]').val();
var extra_fee = $('input[name=extra_fee]').val() == '' ? '' : currencySign+$('input[name=extra_fee]').val();
// 弹出提示
layer.open({
title: '提醒',
content: '<div><p class="error">请核对订单金额,谨慎操作!</p><div><p>商品总金额:'+goods_amount+'</p><p>附加费金额:'+extra_fee+'</p><p>订单总金额:<span class="error">'+order_amount+'</span></p></div></div>',
btn:['取消','确定'],
yes: function(index, layero){
layer.close(index);
},
btn2: function(index, layero){
$.ajax({
url : '/ajaxSaveChange',
type: 'post',
data: $('#checkOrderForm').serialize(),
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function (res) {
console.log(res);
}
})
}
});
})
},
}
......
<p style="padding-left: 5px;">人工调价、审核</p>
<p style="padding-left: 5px;">人工审单</p>
<div class="tabs-box">
<div class="order-change-main">
<form action="{{URL('ajaxSaveChange')}}" method="post" class="form-horizontal ajaxSubmit">
@if ($order_info['status'] == 1)
<form id="checkOrderForm" class="form-horizontal">
<input type="hidden" name="order_sn" value="{{$order_info['order_sn']}}">
<input type="hidden" name="order_id" value="{{$order_info['order_id']}}">
<input type="hidden" name="goods_amount" value="{{$order_price_info['goods_price']}}">
<input type="hidden" name="order_amount" value="{{$order_info['order_amount']}}">
<input type="hidden" name="cancel_reason" value="{{isset($order_info['cancle_reason']) ? $order_info['cancle_reason'] : ''}}">
<input type="hidden" name="user_mobile" value="{{$user_mobile}}">
<!-- 审核 -->
<p>审核</p>
<table class="table table-bordered table-hover check-table" style="min-height:150px;">
<tr>
<td class="check-table-title" width="20%">付款类型:</td>
<td class="check-select">
<label><input class="order_all_pay" type="radio" name="order_pay_type" value="1">全额付款</label>
<label><input class="order_advance_pay" type="radio" name="order_pay_type" value="2">预付首款</label>
</td>
</tr>
<tr>
<td class="check-table-title" width="20%">业务员:</td>
<td>
@if (!empty($manager))
@foreach ($manager as $k => $v)
@if(($k + 1) % 8 == 1)
<ul>
@endif
<li><label><input type="radio" name="sale_id" value="{{$v->userId}}"/>{{$v->name}}</label></li>
@if(($k + 1) % 8 == 0 || $k + 1 == count($manager))
</ul>
@endif
@endforeach
<hr/>
@endif
@foreach ($sale_list as $key => $vo)
@if(($key + 1) % 8 == 1)
<ul>
@endif
<li><label><input type="radio" name="sale_id" value="{{$vo->userId}}"/>{{$vo->name}}</label></li>
@if(($key + 1) % 8 == 0 || $key + 1 == count($sale_list))
</ul>
@endif
@endforeach
</td>
</tr>
<tr>
<td class="check-table-title" width="20%">调价审核:</td>
<td class="check-select">
<label><input type="radio" name="order_status" value="2" checked>审核通过</label>
<label><input type="radio" name="order_status" value="-1" id="faild">审核不通过</label>
</td>
</tr>
<tr class="cancle_reason" style="display: none;">
<td class="check-table-title">审核不通过原因:</td>
<td>
<div class="multi-reason">
<label><input type="radio" name="reason" value="客户不接受调价">客户不接受调价</label>
<label><input type="radio" name="reason" value="无现货">无现货</label>
<label><input type="radio" name="reason" value="客户不接受附加费">客户不接受附加费</label>
<label><input type="radio" name="reason" value="客户下错单">客户下错单</label>
</div>
<div class="other-reason">
<label><input type="radio" name="reason" value="1">其他</label>
<textarea name="reason" id="input-reason" placeholder="请填写其他原因"></textarea>
</div>
</td>
</tr>
</table>
<!-- 调价 -->
<p>调价</p>
<table class="table table-bordered table-hover order-change-table change-table">
<thead>
......@@ -57,7 +125,7 @@
</tr>
</table>
@if ($order_info['order_pay_type'] == 2)
<div class="show-advance-pay">
<p>定金调整</p>
<table class="table table-bordered table-hover change-table">
<tr>
......@@ -77,9 +145,29 @@
</td>
</tr>
</table>
@endif
</div>
<button class="btn btn-primary">提交</button>
<a class="btn btn-primary checkOrder">提交</a>
</form>
@endif
@if ($order_info['status'] == 2)
<p>交易状态:&nbsp;审核通过,请联系客户及时付款!</p>
@endif
@if ($order_info['status'] == -1)
@if ($order_info['cancel_reason'] != '')
<p>交易状态:&nbsp;审核不通过</p>
<p>审核不通过原因:&nbsp;{{$order_info['cancel_reason']}}</p>
@else
<p>交易状态:&nbsp;用戶取消</p>
@endif
@endif
</div>
</div>
\ No newline at end of file
</div>
<script>
var order_amount = "{{$order_info['order_amount']}}";
var currency = "{{$order_info['currency']}}";
var order_pay_type = "{{$order_info['order_pay_type']}}";
</script>
\ No newline at end of file
......@@ -414,11 +414,11 @@
<div class="tabs-box">
<!-- 判断操作权限 -->
@if (($role == 1 || $role ==2) && $order_info['status'] == 1 && in_array('adjust_price', $userPerms))
<a href="{{URL('change', ['order_id'=>$order_info['order_id']])}}" class="btn btn-default">调价</a>
<a class="btn btn-success" href="{{URL('change', ['order_id'=>$order_info['order_id']])}}" class="btn btn-default">人工审单</a>
@endif
<!-- <a href="{:U('account', 'order_id='.$order_info['order_id'])}" class="btn btn-default">账期设置</a> -->
@if (($role == 1 || $role ==2) && in_array($order_info['status'], array(1, 2)) && in_array('check_order', $userPerms))
<a href="{{URL('check', ['order_id'=>$order_info['order_id']])}}" class="btn btn-default">审单</a>
<!-- <a href="{{URL('check', ['order_id'=>$order_info['order_id']])}}" class="btn btn-default">审单</a> -->
@endif
@if ($order_info['status'] == 2 && in_array('cancel_order', $userPerms))
......
......@@ -260,8 +260,8 @@
<a class="btn btn-primary" href="{{URL('details', ['order_id'=>$v['order_id']])}}">详情</a>
<!-- 管理员和经理显示 -->
@if ($role == 1 || $role == 2)
<a class="btn btn-default" href="{{URL('change', ['order_id'=>$v['order_id']])}}">调价</a>
<a class="btn btn-success" href="{{URL('check', ['order_id'=>$v['order_id']])}}">审核</a>
<a class="btn btn-success" href="{{URL('change', ['order_id'=>$v['order_id']])}}">人工审单</a>
<!-- <a class="btn btn-success" href="{{URL('check', ['order_id'=>$v['order_id']])}}">审单</a> -->
@endif
</div>
</td>
......
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