Commit edf36381 by 朱继来

Merge branch 'zjl_order_source_20180904' into development

parents fbac8ceb 659b3eab
...@@ -275,6 +275,15 @@ function getOrderAddress($order_id) ...@@ -275,6 +275,15 @@ function getOrderAddress($order_id)
return $order->consignee; return $order->consignee;
} }
// 获取渠道名称
function getSupplierName($key)
{
$redis = Redis::connection('read');
$supp_info = $redis->hget('supp_info_', $key);
return $supp_info;
}
Class OrderController extends Controller Class OrderController extends Controller
{ {
// 首页 // 首页
...@@ -1098,6 +1107,7 @@ Class OrderController extends Controller ...@@ -1098,6 +1107,7 @@ Class OrderController extends Controller
"k1" => $check['k1'], "k1" => $check['k1'],
"k2" => $check['k2'], "k2" => $check['k2'],
"client_source" => $client_source, "client_source" => $client_source,
"change_extend_fee" => $request->input('change_extend_fee', ''),
]; ];
$temp = json_decode(curlApi($url, $resData, "POST"), true); $temp = json_decode(curlApi($url, $resData, "POST"), true);
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
width: 100%; width: 100%;
} }
.order-details .change-table th { .order-details .change-table th {
width: 30%; /*width: 30%;*/
} }
.order-details .change-table td { .order-details .change-table td {
width: 70%; /*width: 70%;*/
} }
/* 审核 */ /* 审核 */
......
...@@ -1054,15 +1054,35 @@ ...@@ -1054,15 +1054,35 @@
$('.order-change-table input').on('blur', function(){ $('.order-change-table input').on('blur', function(){
var table = $('.order-change-table'); var table = $('.order-change-table');
var goods_total = 0; var goods_total = 0;
var supplier = [];
$(table).find('tbody tr').each(function(){ $(table).find('tbody tr').each(function(){
var num = parseInt($(this).find('.num').val()) || 0; var num = parseInt($(this).find('.num').val()) || 0;
var price = parseFloat($(this).find('.price').val()) || 0; var price = parseFloat($(this).find('.price').val()) || 0;
goods_total += parseFloat(num * price); 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()); var fee = parseFloat($('input[name="extra_fee"]').val());
goods_total = goods_total.toFixed(2);
var total = parseFloat(goods_total + fee).toFixed(2); var total = parseFloat(goods_total + fee).toFixed(2);
goods_total = goods_total.toFixed(2);
$('.goods_total').html(goods_total); $('.goods_total').html(goods_total);
$('input[name="goods_amount"]').val(goods_total); $('input[name="goods_amount"]').val(goods_total);
$('input[name="order_amount"]').val(total); $('input[name="order_amount"]').val(total);
...@@ -1079,6 +1099,26 @@ ...@@ -1079,6 +1099,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(){ // $('.advance').on('blur',function(){
// if($(this).val()<($('.total').html()*0.2)){ // if($(this).val()<($('.total').html()*0.2)){
...@@ -1144,27 +1184,27 @@ ...@@ -1144,27 +1184,27 @@
}); });
// 附加费 // 附加费
$('input[name="extra_fee"]').on('blur', function(){ // $('input[name="extra_fee"]').on('blur', function(){
var fee = parseFloat($(this).val()); // var fee = parseFloat($(this).val());
var goods_total = parseFloat($('.goods_total').html()); // var goods_total = parseFloat($('.goods_total').html());
if (isNaN(fee)) { // if (isNaN(fee)) {
fee = 0.0000; // fee = 0.0000;
} // }
var total = parseFloat(goods_total + fee).toFixed(2); // var total = parseFloat(goods_total + fee).toFixed(2);
$('input[name="goods_amount"]').val(goods_total); // $('input[name="goods_amount"]').val(goods_total);
$('input[name="order_amount"]').val(total); // $('input[name="order_amount"]').val(total);
$('.total').html(total); // $('.total').html(total);
$('.advance').val((total*0.3).toFixed(2)); // $('.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) { // 人民币 // // if (currency == 1) { // 人民币
// checkPayType(total, orderPayType, 10000, 49999); // // checkPayType(total, orderPayType, 10000, 49999);
// } else { // // } else {
// checkPayType(total, orderPayType, 1500, 7800); // // checkPayType(total, orderPayType, 1500, 7800);
// } // // }
}) // })
// 选择付款时间 // 选择付款时间
$('.payTime').change(function(){ $('.payTime').change(function(){
......
...@@ -80,8 +80,9 @@ ...@@ -80,8 +80,9 @@
<hr/> <hr/>
<!-- 调价 --> <!-- 调价 -->
<p>调价</p> <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> <thead>
<th width="20%">供应商</th>
<th>型号</th> <th>型号</th>
<th>调整数量</th> <th>调整数量</th>
<th>调整单价</th> <th>调整单价</th>
...@@ -89,7 +90,10 @@ ...@@ -89,7 +90,10 @@
<tbody> <tbody>
@foreach ($order_items_info as $v) @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> <td>
<input type="hidden" name="change_info[{{$v['rec_id']}}][goods_name]" value="{{$v['goods_name']}}"> <input type="hidden" name="change_info[{{$v['rec_id']}}][goods_name]" value="{{$v['goods_name']}}">
<p>{{$v['goods_name']}}</p> <p>{{$v['goods_name']}}</p>
...@@ -105,17 +109,67 @@ ...@@ -105,17 +109,67 @@
</tbody> </tbody>
</table> </table>
@if ($order_temp_info['extend_fee_items'])
<hr/> <hr/>
<p>附加费设置</p> <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>
<?php $extend_fee_items = json_decode($order_temp_info['extend_fee_items'], true); ?>
@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> <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> <td><p class="text-danger">{{$currency}}<span class="goods_total">{{$order_price_info['goods_price']}}</span></p></td>
</tr> </tr>
<tr> <tr>
<th>附加费金额</th> <th width="20%">附加费金额</th>
<td><input type="text" name="extra_fee" autocomplete="off" value="{{$order_price_info['ext_price']}}" class="only_number"></td> <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']}}">
</td>
<!-- <td><input type="text" name="extra_fee" autocomplete="off" value="{{$order_price_info['ext_price']}}" class="only_number"></td> -->
</tr> </tr>
<!-- <tr> <!-- <tr>
...@@ -126,7 +180,7 @@ ...@@ -126,7 +180,7 @@
</tr> --> </tr> -->
<tr> <tr>
<th>订单总额</th> <th width="20%">订单总额</th>
<td> <td>
<p class="text-danger">{{$currency}}<span class="total">{{$order_info['order_amount']}}</span></p> <p class="text-danger">{{$currency}}<span class="total">{{$order_info['order_amount']}}</span></p>
</td> </td>
...@@ -136,9 +190,9 @@ ...@@ -136,9 +190,9 @@
<div class="show-advance-pay"> <div class="show-advance-pay">
<hr/> <hr/>
<p>定金调整</p> <p>定金调整</p>
<table class="table table-bordered table-hover change-table"> <table class="table table-bordered table-hover">
<tr> <tr>
<th>定金金额</th> <th width="20%">定金金额</th>
<td> <td>
<p class="text-danger">{{$currency}} <p class="text-danger">{{$currency}}
<?php <?php
...@@ -157,9 +211,9 @@ ...@@ -157,9 +211,9 @@
</div> </div>
<p>付款时间</p> <p>付款时间</p>
<table class="table table-bordered table-hover change-table"> <table class="table table-bordered table-hover">
<tr> <tr>
<th>选择付款时间</th> <th width="20%">选择付款时间</th>
<td> <td>
<select name="payTime" class="payTime"> <select name="payTime" class="payTime">
<option value="">请选择</option> <option value="">请选择</option>
......
...@@ -412,7 +412,7 @@ ...@@ -412,7 +412,7 @@
<th>采购数量</th> <th>采购数量</th>
<th>采购单价</th> <th>采购单价</th>
<!-- <th>采购小计</th> --> <!-- <th>采购小计</th> -->
<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