Commit ce24b594 by 朱继来

调整订单审核(添加自营运费)

parent 1f3f2570
......@@ -489,5 +489,25 @@ class ApiController extends Controller
$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']);
}
}
......@@ -492,6 +492,9 @@
return false;
}
var goods_amount = parseFloat($('.goods_total').text());
var msg_txt = ''; // 获取运费提示
// 正常订单校验数量、单价
if (business_type == 0) {
var change_price = false;
......@@ -499,6 +502,8 @@
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();
......@@ -507,6 +512,8 @@
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;
......@@ -529,14 +536,52 @@
change_batch = true;
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) {
layer.alert(change_str)
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);
}
})
}
}
// 预付款
if (pay_type == 2) {
var deposit_amount = $('input[name=deposit_amount]').val();
......@@ -612,7 +657,6 @@
}
var currencySign = currency == 1 ? '¥' : '$';
var goods_amount = parseFloat($('.goods_total').text());
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;
......@@ -621,7 +665,7 @@
var order_type_extend = $('#order_type_extend').val();
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>'+discount_amount+'</p>'+
'<p><label>附加费金额:</label>'+extra_fee+'</p>'+
......@@ -688,7 +732,7 @@
// 弹出提示
layer.open({
area: ['360px'],
area: ['400px'],
title: '提示信息',
content: '确定临时保存编辑的信息吗?',
btn:['确定', '取消'],
......
......@@ -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>\
<input type="hidden" name="change_info['+curr_no+'][supplier_id]" value="'+order_item.supplier_id+'">\
......@@ -119,7 +122,7 @@
<p>'+order_item.supplier_name+'</p>\
</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>\
</td>\
<td>\
......@@ -513,11 +516,17 @@
case 1: html += '<th>限时限量</th>'; break;
case 2: 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>';
}
......
......@@ -7,7 +7,7 @@
<div class="page-content order-details">
<style>
.submit-check { margin: 0 auto; width: 200px; }
.submit-check { margin: 0 auto; width: 240px; }
/* 提交审核弹框label */
.submit-check label { display: inline-block; width: 120px; text-align: right;}
......@@ -172,14 +172,20 @@
<tbody>
@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'] }}">
<td>{{ $k+1 }}</td>
<td>
<input type="hidden" name="change_info[{{$v['rec_id']}}][supplier_name]" value="{{$v['supplier_name']}}">
<p>{{$v['supplier_name']}}</p>
</td>
<td>{{ $v['sale_type'] == 1 ? '现卖' : '预售' }}</td>
<td>
<?php
if ($v['order_goods_type'] == 2) {
echo $v['sale_type'] == 1 ? '现卖' : '预售';
}
?>
</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_name" type="hidden" name="change_info[{{$v['rec_id']}}][goods_name]" value="{{$v['goods_name']}}">
......@@ -385,14 +391,12 @@
</tr>
@endif
@if (($order_info['order_goods_type'] == 1 && $order_price_info['shipping_price']) || $order_info['order_goods_type'] == 2)
<tr>
<th>运费</th>
<td>
<input class="only_number freight_fee" type="text" name="freight_fee" value="{{ $order_price_info['shipping_price'] }}">
</td>
</tr>
@endif
<tr>
<th>运费</th>
<td>
<input class="only_number freight_fee" type="text" name="freight_fee" value="{{ $order_price_info['shipping_price'] }}">
</td>
</tr>
<tr>
<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