Commit c3e5b51b by 朱继来

fix

parents aa97b375 777fac3c
......@@ -275,6 +275,15 @@ function getOrderAddress($order_id)
return $order->consignee;
}
// 获取渠道名称
function getSupplierName($key)
{
$redis = Redis::connection('read');
$supp_info = $redis->hget('supp_info_', $key);
return $supp_info;
}
Class OrderController extends Controller
{
// 首页
......@@ -1098,6 +1107,7 @@ Class OrderController extends Controller
"k1" => $check['k1'],
"k2" => $check['k2'],
"client_source" => $client_source,
"change_extend_fee" => $request->input('change_extend_fee', ''),
];
$temp = json_decode(curlApi($url, $resData, "POST"), true);
......
......@@ -34,10 +34,10 @@
width: 100%;
}
.order-details .change-table th {
width: 30%;
/*width: 30%;*/
}
.order-details .change-table td {
width: 70%;
/*width: 70%;*/
}
/* 审核 */
......
......@@ -1057,15 +1057,35 @@
$('.order-change-table input').on('blur', function(){
var table = $('.order-change-table');
var goods_total = 0;
var supplier = [];
$(table).find('tbody 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 sup = $(this).data('sup');
if (supplier.hasOwnProperty(sup)) { // 判断当前key是否存在于数组中
supplier[sup] += parseFloat(num * price);
} else {
supplier[sup] = parseFloat(num * price);
}
});
// 附加费商品金额设置
$('.extend-fee-table').find('tbody tr').each(function(){
var sup = $(this).data('sup');
$(this).find('.sup_amount').val(supplier[sup]);
$(this).find('.sup_amount_val').text(supplier[sup]);
})
var fee = parseFloat($('input[name="extra_fee"]').val());
goods_total = goods_total.toFixed(2);
var total = parseFloat(goods_total + fee).toFixed(2);
goods_total = goods_total.toFixed(2);
$('.goods_total').html(goods_total);
$('input[name="goods_amount"]').val(goods_total);
$('input[name="order_amount"]').val(total);
......@@ -1082,6 +1102,26 @@
// }
})
// 根据供应商调整附加费
$('.extend-fee-table input').on('blur', function(){
var table = $('.extend-fee-table');
var goods_total = parseFloat($('.goods_total').text());
var extend_fee_total = 0;
$(table).find('tbody tr').each(function(){
var extend_fee = parseInt($(this).find('.adjust_extend_fee').val()) || 0;
extend_fee_total += extend_fee;
});
var total = parseFloat(goods_total + extend_fee_total).toFixed(2);
$('.extra_fee').html(extend_fee_total);
$('input[name="extra_fee"]').val(extend_fee_total);
$('input[name="order_amount"]').val(total);
$('.total').html(total);
})
// 定金调整
// $('.advance').on('blur',function(){
// if($(this).val()<($('.total').html()*0.2)){
......@@ -1147,27 +1187,27 @@
});
// 附加费
$('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));
// $('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();
// // 价格调整后,付款类型显示或隐藏
// // var orderPayType = $('input[name=order_pay_type]').val();
// if (currency == 1) { // 人民币
// checkPayType(total, orderPayType, 10000, 49999);
// } else {
// checkPayType(total, orderPayType, 1500, 7800);
// }
})
// // if (currency == 1) { // 人民币
// // checkPayType(total, orderPayType, 10000, 49999);
// // } else {
// // checkPayType(total, orderPayType, 1500, 7800);
// // }
// })
// 选择付款时间
$('.payTime').change(function(){
......
......@@ -80,8 +80,9 @@
<hr/>
<!-- 调价 -->
<p>调价</p>
<table class="table table-bordered table-hover order-change-table change-table">
<table class="table table-bordered table-hover order-change-table">
<thead>
<th width="20%">供应商</th>
<th>型号</th>
<th>调整数量</th>
<th>调整单价</th>
......@@ -89,7 +90,10 @@
<tbody>
@foreach ($order_items_info as $v)
<tr>
<tr data-sup="{{$v['canal'] ? $v['supplier_id'].'.'.$v['canal'] : $v['supplier_id']}}">
<td>
<p>{{$v['supplier_name']}}</p>
</td>
<td>
<input type="hidden" name="change_info[{{$v['rec_id']}}][goods_name]" value="{{$v['goods_name']}}">
<p>{{$v['goods_name']}}</p>
......@@ -105,17 +109,67 @@
</tbody>
</table>
<?php $extend_fee_items = json_decode($order_temp_info['extend_fee_items'], true); ?>
@if ($extend_fee_items)
<hr/>
<p>附加费设置</p>
<table class="table table-bordered table-hover change-table">
<table class="table table-bordered table-hover extend-fee-table">
<thead>
<th width="20%">供应商/渠道</th>
<th>商品金额</th>
<th>调整附加费</th>
</thead>
<tbody>
@foreach ($extend_fee_items as $k => $v)
<tr data-sup="{{$k}}">
<td>
@if (strpos($k, '.') !== false)
<p>
<?php
$sid = explode('.', $k)[1];
echo App\Http\Controllers\getSupplierName($sid);
?>
</p>
@else
<p>{{$v['supplier_name']}}</p>
@endif
<input type="hidden" name="change_extend_fee[{{$k}}][supplier_name]" value="{{$v['supplier_name']}}">
</td>
<td>
<input type="hidden" name="change_extend_fee[{{$k}}][amount]" class="sup_amount" value="{{$v['amount']}}">
<p class="sup_amount_val">{{$v['amount']}}</p>
</td>
<td>
<input class="adjust_extend_fee only_number" name="change_extend_fee[{{$k}}][extend_fee]" value="{{$v['extend_fee']}}">
</td>
<input type="hidden" name="change_extend_fee[{{$k}}][count]" value="{{$v['count']}}">
@if (isset($v['ladder_max']))
<input type="hidden" name="change_extend_fee[{{$k}}][ladder_max]" value="{{$v['ladder_max']}}">
@endif
</tr>
@endforeach
</tbody>
</table>
@endif
<hr/>
<table class="table table-bordered table-hover">
<tr>
<th>商品总金额</th>
<th width="20%">商品总金额</th>
<td><p class="text-danger">{{$currency}}<span class="goods_total">{{$order_price_info['goods_price']}}</span></p></td>
</tr>
<tr>
<th>附加费金额</th>
<td><input type="text" name="extra_fee" autocomplete="off" value="{{$order_price_info['ext_price']}}" class="only_number"></td>
<th width="20%">附加费金额</th>
<td>
<p class="text-danger">{{$currency}}<span class="extra_fee">{{$order_price_info['ext_price'] ? $order_price_info['ext_price'] : 0}}</span></p>
<input type="hidden" name="extra_fee" autocomplete="off" value="{{$order_price_info['ext_price'] ? $order_price_info['ext_price'] : 0}}">
</td>
<!-- <td><input type="text" name="extra_fee" autocomplete="off" value="{{$order_price_info['ext_price']}}" class="only_number"></td> -->
</tr>
<!-- <tr>
......@@ -126,7 +180,7 @@
</tr> -->
<tr>
<th>订单总额</th>
<th width="20%">订单总额</th>
<td>
<p class="text-danger">{{$currency}}<span class="total">{{$order_info['order_amount']}}</span></p>
</td>
......@@ -136,9 +190,9 @@
<div class="show-advance-pay">
<hr/>
<p>定金调整</p>
<table class="table table-bordered table-hover change-table">
<table class="table table-bordered table-hover">
<tr>
<th>定金金额</th>
<th width="20%">定金金额</th>
<td>
<p class="text-danger">{{$currency}}
<?php
......
......@@ -412,7 +412,7 @@
<th>采购数量</th>
<th>采购单价</th>
<!-- <th>采购小计</th> -->
<th>优惠单价</th>
<th>均摊后单价</th>
<th>小计</th>
<th>货期</th>
<th>供应商</th>
......
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