Commit 04e126d9 by 朱继来

调整审单

parent 33e5e809
......@@ -802,9 +802,9 @@
}
}
})
}
} else {
createOrder();
}
})
function createOrder() {
......
......@@ -486,7 +486,37 @@
})
// 提交表单
$('.checkOrder').click(function(){
$('.checkOrder').click(function () {
var tax_id = $('.tax_id').val();
if (tax_id) {
$.ajax({
url: '/ajax/selectInv',
type: 'post',
data: { tax_id: tax_id },
dataType: 'json',
success: function (resp) {
if (resp.errcode == 1) {
layer.alert(resp.errmsg);
return false;
}
if (resp.errcode == 2) {
layer.confirm(resp.errmsg, function (index) {
checkOrder();
layer.close(index)
});
return false;
}
}
})
} else {
checkOrder();
}
})
function checkOrder() {
var is_newClient = $('input[name=is_newClient]:checked').val();
var client_source = $('input[name=client_source]:checked').val();
var order_status = $('input[name=order_status]:checked').val();
......@@ -534,67 +564,67 @@
// }
// }
if (isNewClient) {
if (client_source == null) {
if (isNewClient) {
if (client_source == null) {
layer.msg('请选择用户来源渠道!');
return false;
} else if (client_source == 1) {
} else if (client_source == 1) {
if ($('#input-other-source').val() == '') {
layer.msg('请填写其他来源');
return false;
}
}
}
}
}
// 审核不通过
if (order_status == -1) {
$('.input-cancel-reason').click();
return false;
}
}
var goods_amount = parseFloat($('.goods_total').text());
var msg_txt = ''; // 获取运费提示
// 正常订单校验数量、单价
if (business_type == 0) {
var change_price = false;
var change_price = false;
var change_goods_number = false;
var change_buyer_id = false;
var change_batch = false;
var change_str = '';
var is_all_self = true; // 全部为自营商品
var is_all_self_xm = true; // 全部为自营现货
$('.order-change-table').find('tbody tr').each(function(){
var goods_number = $(this).find('.change_goods_number').val();
var price = $(this).find('.price').val();
var goods_name = $(this).find('.change_goods_name').val();
var buyer_id = $(this).find('.change_buyer_id').selectpicker('val');
var batch = $(this).find('.change_batch').val();
var status = $(this).find('.change_status').val();
var supplier_id = $(this).data('sup'); // 供应商ID
var sale_type = $(this).data('sale_type'); // 1-现卖,2-预售
var change_buyer_id = false;
var change_batch = false;
var change_str = '';
var is_all_self = true; // 全部为自营商品
var is_all_self_xm = true; // 全部为自营现货
$('.order-change-table').find('tbody tr').each(function () {
var goods_number = $(this).find('.change_goods_number').val();
var price = $(this).find('.price').val();
var goods_name = $(this).find('.change_goods_name').val();
var buyer_id = $(this).find('.change_buyer_id').selectpicker('val');
var batch = $(this).find('.change_batch').val();
var status = $(this).find('.change_status').val();
var supplier_id = $(this).data('sup'); // 供应商ID
var sale_type = $(this).data('sale_type'); // 1-现卖,2-预售
if (status == -1) return true;
if (goods_number == '' || goods_number == 0) {
change_goods_number = true;
change_str += goods_name+'数量不能为0或空 ';
}
change_str += goods_name + '数量不能为0或空 ';
}
if (price == '' || price == 0) {
change_price = true;
change_str += goods_name+'单价不能为0或空 ';
change_str += goods_name + '单价不能为0或空 ';
}
if (order_goods_type == 1 && (buyer_id == null || buyer_id == '')) {
change_buyer_id = true;
change_str += goods_name+'采购员不能为空 ';
change_str += goods_name + '采购员不能为空 ';
}
if (order_goods_type == 1 && batch == '') {
change_batch = true;
change_str += goods_name+'批次不能为空 ';
change_str += goods_name + '批次不能为空 ';
}
if (supplier_id != 10000) {
......@@ -621,13 +651,13 @@
}
$.ajax({
url : '/api/getOrderFreight',
url: '/api/getOrderFreight',
type: 'post',
data: {order_id: order_id},
data: { order_id: order_id },
dataType: 'json',
async: false,
success: function (resp) {
if(resp.errcode == 0){
if (resp.errcode == 0) {
msg_txt += resp.data;
$('.freight_fee').val(resp.data).trigger('keyup');
}
......@@ -642,8 +672,8 @@
})
}
}
}
// 预付款
if (pay_type == 2) {
var deposit_amount = $('input[name=deposit_amount]').val();
......@@ -651,7 +681,7 @@
if (deposit_amount == '') {
layer.msg('请填写定金金额');
return false;
}else if (deposit_amount == 0) {
} else if (deposit_amount == 0) {
layer.msg('定金金额不能为0');
return false;
}
......@@ -681,32 +711,32 @@
return false;
}
}
}
}
// 发货方式
if (delivery_type == '') {
layer.msg('请选择发货方式');
return false;
}
}
// 非管理员或经理权限、非联营订单、非样片单 需要判断商品价格是否低于80%以下
if (!is_manager && order_goods_type != 1 && business_type != 1) {
if (!is_manager && order_goods_type != 1 && business_type != 1) {
// 设置默认值false
$('input[name=check_failed]').val(0);
$('input[name=change_pay_type]').val(0);
var check_failed_info = '';
// 检查商品单价
$('.order-change-table').find('tbody tr').each(function(){
$('.order-change-table').find('tbody tr').each(function () {
var origin_price = parseFloat($(this).find('.price').data('origin'));
var price = parseFloat($(this).find('.price').val()) || 0;
var goods_name = $(this).find('.change_goods_name').val();
limit_price = (origin_price * 0.8).toFixed(4);
// 若商品单价降价幅度小于或等于20%则赋值
if (price <= limit_price) {
check_failed_info += '型号:'+goods_name+',单价:'+origin_price+' -> '+price+' | ';
check_failed_info += '型号:' + goods_name + ',单价:' + origin_price + ' -> ' + price + ' | ';
$('input[name=check_failed]').val(1);
$('input[name=check_failed_info]').val(check_failed_info);
}
......@@ -718,30 +748,30 @@
}
}
var currencySign = currency == 1 ? '¥' : '$';
var order_amount = parseFloat($('.total').text());
var extra_fee = $('input[name=extra_fee]').val() ? $('input[name=extra_fee]').val() : 0;
var freight_fee = $('input[name=freight_fee]').val() ? $('input[name=freight_fee]').val() : 0;
var discount_amount = $('input[name="discount_amount"]').val() ? parseFloat($('input[name="discount_amount"]').val()) : 0; // 优惠券
var last_paid = parseFloat(order_amount + parseFloat(pay_preferential)).toFixed(2); // 实际支付金额
var currencySign = currency == 1 ? '¥' : '$';
var order_amount = parseFloat($('.total').text());
var extra_fee = $('input[name=extra_fee]').val() ? $('input[name=extra_fee]').val() : 0;
var freight_fee = $('input[name=freight_fee]').val() ? $('input[name=freight_fee]').val() : 0;
var discount_amount = $('input[name="discount_amount"]').val() ? parseFloat($('input[name="discount_amount"]').val()) : 0; // 优惠券
var last_paid = parseFloat(order_amount + parseFloat(pay_preferential)).toFixed(2); // 实际支付金额
var order_type_extend = $('#order_type_extend').val();
var content = '<div class="submit-check">';
content += '<p class="error">请仔细核对订单金额,谨慎操作!'+msg_txt+'</p>';
content += '<p><label>商品总金额:</label>'+currencySign + goods_amount+'</p>';
content += '<p><label>优惠金额:</label>'+discount_amount+'</p>'+
'<p><label>附加费金额:</label>'+extra_fee+'</p>'+
'<p><label>运费金额:</label>'+freight_fee+'</p>'+
'<p><label>订单总金额:</label><span class="error">'+currencySign + order_amount+'</span></p>';
if (order_goods_type == 1) {
content += '</div>';
var url = '/details/'+order_id;
content += '<p class="error">请仔细核对订单金额,谨慎操作!' + msg_txt + '</p>';
content += '<p><label>商品总金额:</label>' + currencySign + goods_amount + '</p>';
content += '<p><label>优惠金额:</label>' + discount_amount + '</p>' +
'<p><label>附加费金额:</label>' + extra_fee + '</p>' +
'<p><label>运费金额:</label>' + freight_fee + '</p>' +
'<p><label>订单总金额:</label><span class="error">' + currencySign + order_amount + '</span></p>';
if (order_goods_type == 1) {
content += '</div>';
var url = '/details/' + order_id;
} else {
content += '<p><label>支付优惠:</label>'+pay_preferential+'</p>'+
'<p><label>实际支付金额:</label><span class="error">'+currencySign + last_paid +'</span></p>'+
'</div>';
var url = '/details/'+order_id+'?tags=self';
content += '<p><label>支付优惠:</label>' + pay_preferential + '</p>' +
'<p><label>实际支付金额:</label><span class="error">' + currencySign + last_paid + '</span></p>' +
'</div>';
var url = '/details/' + order_id + '?tags=self';
}
// 弹出提示
......@@ -749,23 +779,23 @@
area: ['360px'],
title: '提示信息',
content: content,
btn:['确定', '取消'],
yes: function(index, layero){
btn: ['确定', '取消'],
yes: function (index, layero) {
$.ajax({
url : '/ajaxSaveChange',
url: '/ajaxSaveChange',
type: 'post',
data: $('#checkOrderForm').serialize(),
dataType: 'json',
success: function (resp) {
if(resp.errcode == 0){
if (resp.errcode == 0) {
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
setTimeout(function () {
// location.reload();
location.href = url;
}, 1000);
return false;
}
}
layer.alert(resp.errmsg);
return false;
......@@ -779,13 +809,13 @@
}
})
layer.msg('审核提交中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
layer.msg('审核提交中...', { icon: 16, time: 0, shade: 0.3 }); // 阻止重复提交
},
btn2: function(index, layero){
btn2: function (index, layero) {
layer.close(index);
}
});
})
}
// 临时保存
$('.tempSave').click(function() {
......
......@@ -32,6 +32,7 @@
<input type="hidden" name="check_failed_info" value="">
<input type="hidden" name="change_pay_type" value="">
<input type="hidden" name="business_type" value="{{$order_temp_info['business_type']}}">
<input type="hidden" class="tax_id" name="tax_id" value="{{ isset($order_invoice_info['tax_id']) ? $order_invoice_info['tax_id'] : '' }}">
<?php $isNewClient = App\Http\Controllers\isNewClient($order_info['order_goods_type'], $order_info['user_id'], $order_info['create_time']); ?>
@if ($isNewClient)
......
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