Commit 5b5d8567 by 朱继来

Merge branch 'zjl_freight_20210129'

parents f94825ee 02d928ff
...@@ -489,5 +489,25 @@ class ApiController extends Controller ...@@ -489,5 +489,25 @@ class ApiController extends Controller
$this->Export($temp['err_code'], $temp['err_msg']); $this->Export($temp['err_code'], $temp['err_msg']);
} }
// 获取运费
public function getOrderFreight($request)
{
$order_id = $request->input('order_id', 0);
if (!$order_id) $this->Export(-1, '参数缺失');
$data['order_id'] = $order_id;
$url = Config('website.api_domain').'order/getfreight';
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$temp = json_decode(curlApi($url, $data, "POST"), true); // 连接API
$this->Export($temp['err_code'], $temp['err_msg'], $temp['data']);
}
} }
...@@ -183,7 +183,34 @@ ...@@ -183,7 +183,34 @@
} }
}) })
// 输入数量、单价校验 // 输入数量校验
$(document).off().delegate('.change_number', 'keyup', function(){
var val = $(this).val();
var reg = /^\d{0,8}$/g;
if(!val) return false;
if (!(reg.test(val))) {
if(isNaN(parseInt(val))){
layer.msg('只能是数字组成');
$(this).val('');
}else{
$(this).val(parseInt(val));
}
}
if (val < 0) {
layer.msg('只能是正整数');
$(this).val('');
return false;
}
if(val.length > 8){
$(this).val(val.slice(0, 8));
}
});
// 输入单价校验
$('#checkOrderForm').off().delegate('.only_number', 'keyup', function(){ $('#checkOrderForm').off().delegate('.only_number', 'keyup', function(){
if($(this).val() == '') return false; if($(this).val() == '') return false;
...@@ -492,6 +519,9 @@ ...@@ -492,6 +519,9 @@
return false; return false;
} }
var goods_amount = parseFloat($('.goods_total').text());
var msg_txt = ''; // 获取运费提示
// 正常订单校验数量、单价 // 正常订单校验数量、单价
if (business_type == 0) { if (business_type == 0) {
var change_price = false; var change_price = false;
...@@ -499,6 +529,8 @@ ...@@ -499,6 +529,8 @@
var change_buyer_id = false; var change_buyer_id = false;
var change_batch = false; var change_batch = false;
var change_str = ''; var change_str = '';
var is_all_self = true; // 全部为自营商品
var is_all_self_xm = true; // 全部为自营现货
$('.order-change-table').find('tbody tr').each(function(){ $('.order-change-table').find('tbody tr').each(function(){
var goods_number = $(this).find('.change_goods_number').val(); var goods_number = $(this).find('.change_goods_number').val();
...@@ -507,6 +539,8 @@ ...@@ -507,6 +539,8 @@
var buyer_id = $(this).find('.change_buyer_id').selectpicker('val'); var buyer_id = $(this).find('.change_buyer_id').selectpicker('val');
var batch = $(this).find('.change_batch').val(); var batch = $(this).find('.change_batch').val();
var status = $(this).find('.change_status').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 (status == -1) return true;
...@@ -529,12 +563,50 @@ ...@@ -529,12 +563,50 @@
change_batch = true; change_batch = true;
change_str += goods_name+'批次不能为空 '; change_str += goods_name+'批次不能为空 ';
} }
if (supplier_id != 10000) {
is_all_self = false;
} else {
if (sale_type != 1) is_all_self_xm = false;
}
}) })
if (change_price || change_goods_number || change_buyer_id || change_batch) { if (change_price || change_goods_number || change_buyer_id || change_batch) {
layer.alert(change_str) layer.alert(change_str)
return false; return false;
} }
// 若都为自营且商品总额小于1000,则重新计算运费规则
if (is_all_self && goods_amount < 1000) {
if (is_all_self_xm) { // 若全为自营现货,则更新发货方式为现货优先发货
$('.zy_delivery_type').val(1);
msg_txt = '全为自营现货,已更新发货方式为现货优先发货,并重新获取运费金额:';
} else {
msg_txt = '全为自营商品,已重新获取运费金额:';
}
$.ajax({
url : '/api/getOrderFreight',
type: 'post',
data: {order_id: order_id},
dataType: 'json',
async: false,
success: function (resp) {
if(resp.errcode == 0){
msg_txt += resp.data;
$('.freight_fee').val(resp.data).trigger('keyup');
}
layer.alert(resp.errmsg);
return false;
},
error: function (res) {
console.log(res);
}
})
}
} }
// 预付款 // 预付款
...@@ -612,7 +684,6 @@ ...@@ -612,7 +684,6 @@
} }
var currencySign = currency == 1 ? '¥' : '$'; var currencySign = currency == 1 ? '¥' : '$';
var goods_amount = parseFloat($('.goods_total').text());
var order_amount = parseFloat($('.total').text()); var order_amount = parseFloat($('.total').text());
var extra_fee = $('input[name=extra_fee]').val() ? $('input[name=extra_fee]').val() : 0; 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 freight_fee = $('input[name=freight_fee]').val() ? $('input[name=freight_fee]').val() : 0;
...@@ -621,7 +692,7 @@ ...@@ -621,7 +692,7 @@
var order_type_extend = $('#order_type_extend').val(); var order_type_extend = $('#order_type_extend').val();
var content = '<div class="submit-check">'; var content = '<div class="submit-check">';
content += '<p class="error">请核对订单金额,谨慎操作!</p>'; content += '<p class="error">请仔细核对订单金额,谨慎操作!'+msg_txt+'</p>';
content += '<p><label>商品总金额:</label>'+currencySign + goods_amount+'</p>'; content += '<p><label>商品总金额:</label>'+currencySign + goods_amount+'</p>';
content += '<p><label>优惠金额:</label>'+discount_amount+'</p>'+ content += '<p><label>优惠金额:</label>'+discount_amount+'</p>'+
'<p><label>附加费金额:</label>'+extra_fee+'</p>'+ '<p><label>附加费金额:</label>'+extra_fee+'</p>'+
...@@ -688,7 +759,7 @@ ...@@ -688,7 +759,7 @@
// 弹出提示 // 弹出提示
layer.open({ layer.open({
area: ['360px'], area: ['400px'],
title: '提示信息', title: '提示信息',
content: '确定临时保存编辑的信息吗?', content: '确定临时保存编辑的信息吗?',
btn:['确定', '取消'], btn:['确定', '取消'],
......
...@@ -109,9 +109,12 @@ ...@@ -109,9 +109,12 @@
} }
} }
var sale_type = '现卖'; var sale_type = '';
if (order_item.order_goods_type == 2) {
sale_type = order_item.sale_type == 1 ? '现卖' : '预售';
}
html += '<tr data-sup="'+sup+'" data-brand_name="'+order_item.brand_name+'">\ html += '<tr data-sup="'+sup+'" data-brand_name="'+order_item.brand_name+'" data-sale_type="'+order_item.sale_type+'">\
<td>'+curr_no+'</td>\ <td>'+curr_no+'</td>\
<td>\ <td>\
<input type="hidden" name="change_info['+curr_no+'][supplier_id]" value="'+order_item.supplier_id+'">\ <input type="hidden" name="change_info['+curr_no+'][supplier_id]" value="'+order_item.supplier_id+'">\
...@@ -119,7 +122,7 @@ ...@@ -119,7 +122,7 @@
<p>'+order_item.supplier_name+'</p>\ <p>'+order_item.supplier_name+'</p>\
</td>\ </td>\
<td>\ <td>\
<input type="hidden" name="change_info['+curr_no+'][sale_type]" value="1">\ <input type="hidden" name="change_info['+curr_no+'][sale_type]" value="1'+order_item.sale_type+'">\
<p>'+sale_type+'</p>\ <p>'+sale_type+'</p>\
</td>\ </td>\
<td>\ <td>\
...@@ -148,7 +151,7 @@ ...@@ -148,7 +151,7 @@
html += '<td>\ html += '<td>\
<input class="only_number num change_goods_number" name="change_info['+curr_no+'][goods_number]" value="'+order_item.goods_number+'">\ <input class="num change_number" name="change_info['+curr_no+'][goods_number]" value="'+order_item.goods_number+'">\
</td>\ </td>\
<td>\ <td>\
<input class="price only_number" name="change_info['+curr_no+'][goods_price]" data-price="'+order_item.goods_price+'" value="'+order_item.goods_price+'">\ <input class="price only_number" name="change_info['+curr_no+'][goods_price]" data-price="'+order_item.goods_price+'" value="'+order_item.goods_price+'">\
...@@ -354,7 +357,7 @@ ...@@ -354,7 +357,7 @@
<i class="fa fa-exclamation-triangle fa-2x select-standard-brand" aria-hidden="true" data-type=2></i>\ <i class="fa fa-exclamation-triangle fa-2x select-standard-brand" aria-hidden="true" data-type=2></i>\
</td>\ </td>\
<td>\ <td>\
<input class="only_number num change_goods_number" name="change_info['+curr_no+'][goods_number]" value="'+add_goods_number+'">\ <input class="num change_number" name="change_info['+curr_no+'][goods_number]" value="'+add_goods_number+'">\
</td>\ </td>\
<td>\ <td>\
<input class="price only_number" name="change_info['+curr_no+'][goods_price]" data-price="'+add_goods_price+'" value="'+add_goods_price+'">\ <input class="price only_number" name="change_info['+curr_no+'][goods_price]" data-price="'+add_goods_price+'" value="'+add_goods_price+'">\
...@@ -513,11 +516,17 @@ ...@@ -513,11 +516,17 @@
case 1: html += '<th>限时限量</th>'; break; case 1: html += '<th>限时限量</th>'; break;
case 2: html += '<th>活动价</th>'; break; case 2: html += '<th>活动价</th>'; break;
case 3: html += '<th>会员价</th>'; break; case 3: html += '<th>会员价</th>'; break;
default: html += ''; break; case 6: html += '<th>自营清库存</th>'; break;
case 7: html += '<th>团购价</th>'; break;
case 8: html += '<th>折扣价</th>'; break;
case 10: html += '<th>活动打折</th>'; break;
default: html += '<th></th>'; break;
} }
} }
if (goods_type == 1 && data.tiered[0]['price_us']) { var joint_goods_type = ['1', '2']; // 商品联营类型
if (joint_goods_type.indexOf(data.goods_type) != -1) {
html += '<th>USD价格</th>'; html += '<th>USD价格</th>';
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<div class="page-content order-details"> <div class="page-content order-details">
<style> <style>
.submit-check { margin: 0 auto; width: 200px; } .submit-check { margin: 0 auto; width: 240px; }
/* 提交审核弹框label */ /* 提交审核弹框label */
.submit-check label { display: inline-block; width: 120px; text-align: right;} .submit-check label { display: inline-block; width: 120px; text-align: right;}
...@@ -172,14 +172,20 @@ ...@@ -172,14 +172,20 @@
<tbody> <tbody>
@foreach ($order_items_info as $k=>$v) @foreach ($order_items_info as $k=>$v)
<tr class="change_item_{{$v['rec_id']}}" data-sup="{{$v['canal'] ? $v['supplier_id'].'.'.$v['canal'] : $v['supplier_id']}}" data-brand_id="{{ $v['brand_id'] }}" data-brand_name="{{ $v['brand_name'] }}"> <tr class="change_item_{{$v['rec_id']}}" data-sup="{{$v['canal'] ? $v['supplier_id'].'.'.$v['canal'] : $v['supplier_id']}}" data-brand_id="{{ $v['brand_id'] }}" data-brand_name="{{ $v['brand_name'] }}" data-sale_type="{{ $v['sale_type'] }}">
<input class="change_rec_id" type="hidden" name="change_rec_id" value="{{ $v['rec_id'] }}"> <input class="change_rec_id" type="hidden" name="change_rec_id" value="{{ $v['rec_id'] }}">
<td>{{ $k+1 }}</td> <td>{{ $k+1 }}</td>
<td> <td>
<input type="hidden" name="change_info[{{$v['rec_id']}}][supplier_name]" value="{{$v['supplier_name']}}"> <input type="hidden" name="change_info[{{$v['rec_id']}}][supplier_name]" value="{{$v['supplier_name']}}">
<p>{{$v['supplier_name']}}</p> <p>{{$v['supplier_name']}}</p>
</td> </td>
<td>{{ $v['sale_type'] == 1 ? '现卖' : '预售' }}</td> <td>
<?php
if ($v['order_goods_type'] == 2) {
echo $v['sale_type'] == 1 ? '现卖' : '预售';
}
?>
</td>
<td> <td>
<input class="change_goods_id" type="hidden" name="change_info[{{$v['rec_id']}}][goods_id]" value="{{$v['goods_id']}}"> <input class="change_goods_id" type="hidden" name="change_info[{{$v['rec_id']}}][goods_id]" value="{{$v['goods_id']}}">
<input class="change_goods_name" type="hidden" name="change_info[{{$v['rec_id']}}][goods_name]" value="{{$v['goods_name']}}"> <input class="change_goods_name" type="hidden" name="change_info[{{$v['rec_id']}}][goods_name]" value="{{$v['goods_name']}}">
...@@ -203,7 +209,7 @@ ...@@ -203,7 +209,7 @@
</td> </td>
@endif @endif
<td> <td>
<input type="text" class="only_number num change_goods_number" name="change_info[{{$v['rec_id']}}][goods_number]" value="{{$v['goods_number']}}" <?= $v['status'] == -1 ? 'readonly' : '' ?>> <input type="text" class="num change_number" name="change_info[{{$v['rec_id']}}][goods_number]" value="{{$v['goods_number']}}" <?= $v['status'] == -1 ? 'readonly' : '' ?>>
</td> </td>
<td> <td>
<input type="text" class="price only_number change_goods_price" name="change_info[{{$v['rec_id']}}][goods_price]" data-origin="{{$v['original_price']}}" data-price="{{$v['goods_price']}}" value="{{$v['goods_price']}}" <?= $v['status'] == -1 ? 'readonly' : '' ?>> <input type="text" class="price only_number change_goods_price" name="change_info[{{$v['rec_id']}}][goods_price]" data-origin="{{$v['original_price']}}" data-price="{{$v['goods_price']}}" value="{{$v['goods_price']}}" <?= $v['status'] == -1 ? 'readonly' : '' ?>>
...@@ -211,7 +217,7 @@ ...@@ -211,7 +217,7 @@
<!-- 销售类型为预售时展示 --> <!-- 销售类型为预售时展示 -->
@if ($order_info['sale_type'] == 2) @if ($order_info['sale_type'] == 2)
<td> <td>
<input type="text" class="only_number" name="change_info[{{$v['rec_id']}}][delivery_time]" value="{{$v['delivery_time']}}" placeholder="请填写天数"> <input type="text" class="change_number" name="change_info[{{$v['rec_id']}}][delivery_time]" value="{{$v['delivery_time']}}" placeholder="请填写天数">
</td> </td>
<td> <td>
<!-- 未锁库存 --> <!-- 未锁库存 -->
...@@ -385,14 +391,12 @@ ...@@ -385,14 +391,12 @@
</tr> </tr>
@endif @endif
@if (($order_info['order_goods_type'] == 1 && $order_price_info['shipping_price']) || $order_info['order_goods_type'] == 2)
<tr> <tr>
<th>运费</th> <th>运费</th>
<td> <td>
<input class="only_number freight_fee" type="text" name="freight_fee" value="{{ $order_price_info['shipping_price'] }}"> <input class="only_number freight_fee" type="text" name="freight_fee" value="{{ $order_price_info['shipping_price'] }}">
</td> </td>
</tr> </tr>
@endif
<tr> <tr>
<th width="20%">订单总额</th> <th width="20%">订单总额</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