Commit c56dd8ca by 朱继来

Merge branch 'zjl_adjust_20181008' into development

parents 76fc29a2 54bf524d
...@@ -394,17 +394,20 @@ Class AddOrderController extends Controller ...@@ -394,17 +394,20 @@ Class AddOrderController extends Controller
} }
} }
// 获取自营运费 // 确认订单信息
public function getExpressFee(Request $request) public function confirm(Request $request)
{ {
if ($request->isMethod('post')) { if ($request->isMethod('post')) {
$data['uid'] = $request->input('uid'); $data['uid'] = $request->input('uid', 0);
$data['address_id'] = $request->input('address_id'); $data['address_id'] = $request->input('address_id', 0);
$data['cart_id'] = $request->input('cart_ids', '');
$data['user_coupon_id'] = $request->input('user_coupon_id', 0);
$data['type'] = $request->input('goods_type');
$data['k1'] = time(); $data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi'); $data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'cart/getExpressFeeByOrder'; $url = Config('website.api_domain').'cart/confirm';
$response = json_decode(curlApi($url, $data), true); $response = json_decode(curlApi($url, $data), true);
...@@ -425,6 +428,7 @@ Class AddOrderController extends Controller ...@@ -425,6 +428,7 @@ Class AddOrderController extends Controller
$data['address_id'] = $request->input('address_id'); $data['address_id'] = $request->input('address_id');
$data['cart_id'] = implode(',', $request->input('cart_ids')); $data['cart_id'] = implode(',', $request->input('cart_ids'));
$data['type'] = $request->input('type'); $data['type'] = $request->input('type');
$data['remark'] = $request->input('remark');
if ($data['type'] == 3) { // 自营线下订单 if ($data['type'] == 3) { // 自营线下订单
$data['address_name'] = $request->input('address_name'); $data['address_name'] = $request->input('address_name');
...@@ -437,7 +441,8 @@ Class AddOrderController extends Controller ...@@ -437,7 +441,8 @@ Class AddOrderController extends Controller
$data['k1'] = time(); $data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi'); $data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'order/createByOrderSystem'; // $url = Config('website.api_domain').'order/createByOrderSystem';
$url = Config('website.api_domain').'order/create';
$response = json_decode(curlApi($url, $data), true); $response = json_decode(curlApi($url, $data), true);
......
...@@ -361,8 +361,8 @@ Class OrderController extends Controller ...@@ -361,8 +361,8 @@ Class OrderController extends Controller
{ {
$info = $this->getOrderInfo($request, 1); $info = $this->getOrderInfo($request, 1);
// 若为京东自营角色,则跳转到自营列表 // 若为京东自营、自营客服角色,则跳转到自营列表
if ($info['role'] == 6) { if (in_array($info['role'], [6, 7])) {
return redirect('self_order'); return redirect('self_order');
} }
...@@ -611,6 +611,7 @@ Class OrderController extends Controller ...@@ -611,6 +611,7 @@ Class OrderController extends Controller
array('brand_name', '制造商'), array('brand_name', '制造商'),
array('goods_number', '数量'), array('goods_number', '数量'),
array('goods_price', '单价'), array('goods_price', '单价'),
array('single_pre_price', '均摊后单价'),
array('goods_amount', '商品小计'), array('goods_amount', '商品小计'),
array('goods_sum', '商品总额'), array('goods_sum', '商品总额'),
array('shipping_fee', '运费'), array('shipping_fee', '运费'),
...@@ -771,7 +772,7 @@ Class OrderController extends Controller ...@@ -771,7 +772,7 @@ Class OrderController extends Controller
}) })
->where('it.status', '<>', -1) ->where('it.status', '<>', -1)
->where('o.order_goods_type', '=', $map['order_goods_type']) ->where('o.order_goods_type', '=', $map['order_goods_type'])
->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.brand_name', 'o.order_id', 'o.order_sn', 'o.order_pay_type', 'o.order_goods_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'i.tax_title', 'i.inv_type', 'i.invoice_status', 'a.consignee', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'c.com_name', 'oe.send_remark') ->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', 'o.order_id', 'o.order_sn', 'o.order_pay_type', 'o.order_goods_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'i.tax_title', 'i.inv_type', 'i.invoice_status', 'a.consignee', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'c.com_name', 'oe.send_remark')
->groupBy('it.rec_id') ->groupBy('it.rec_id')
->orderBy('o.create_time', 'DESC') ->orderBy('o.create_time', 'DESC')
->get(); ->get();
...@@ -865,6 +866,7 @@ Class OrderController extends Controller ...@@ -865,6 +866,7 @@ Class OrderController extends Controller
$tmp[$i]['goods_name'] = $order[$i]->order_goods_type == 1 ? $order[$i]->goods_name : getGoodsName($order[$i]->goods_id); $tmp[$i]['goods_name'] = $order[$i]->order_goods_type == 1 ? $order[$i]->goods_name : getGoodsName($order[$i]->goods_id);
$tmp[$i]['goods_number'] = $order[$i]->goods_number; $tmp[$i]['goods_number'] = $order[$i]->goods_number;
$tmp[$i]['goods_price'] = $order[$i]->goods_price; $tmp[$i]['goods_price'] = $order[$i]->goods_price;
$tmp[$i]['single_pre_price'] = $order[$i]->single_pre_price;
$tmp[$i]['goods_amount'] = $order[$i]->goods_number*$order[$i]->goods_price; $tmp[$i]['goods_amount'] = $order[$i]->goods_number*$order[$i]->goods_price;
$tmp[$i]['brand_name'] = $order[$i]->brand_name; $tmp[$i]['brand_name'] = $order[$i]->brand_name;
......
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
return 5; return 5;
} else if ($department->name == '京东自营') { } else if ($department->name == '京东自营') {
return 6; return 6;
} else if ($department->name == '自营客服') {
return 7;
} else { } else {
return 0; return 0;
} }
......
...@@ -87,7 +87,7 @@ Route::group(['middleware' => 'web'], function () { ...@@ -87,7 +87,7 @@ Route::group(['middleware' => 'web'], function () {
Route::post('/ajax/getCoupon', 'AddOrderController@getCoupon'); Route::post('/ajax/getCoupon', 'AddOrderController@getCoupon');
Route::get('/add_online', 'AddOrderController@addOnline'); Route::get('/add_online', 'AddOrderController@addOnline');
Route::post('/ajax/getExpressFee', 'AddOrderController@getExpressFee'); Route::post('/ajax/confirm', 'AddOrderController@confirm');
Route::get('/add_offline', 'AddOrderController@addOffline'); Route::get('/add_offline', 'AddOrderController@addOffline');
Route::post('/ajax/getSku', 'AddOrderController@getSku'); Route::post('/ajax/getSku', 'AddOrderController@getSku');
......
...@@ -147,6 +147,15 @@ li { ...@@ -147,6 +147,15 @@ li {
text-align: right; text-align: right;
display: none; display: none;
} }
#remark {
border-radius: 4px;
padding: 5px;
resize: none;
margin-bottom: 10px;
}
.preferential_price{ /* 优惠金额 */
display: none;
}
/*提交订单成功页面*/ /*提交订单成功页面*/
.section-1, .section-3{ .section-1, .section-3{
......
...@@ -87,10 +87,13 @@ ...@@ -87,10 +87,13 @@
$('.user-info').delegate('#address', 'change', function() { $('.user-info').delegate('#address', 'change', function() {
var user_id = $('.user_id').val(); var user_id = $('.user_id').val();
var address_id = $(this).val(); var address_id = $(this).val();
var user_coupon_id = $('.user_coupon_id').val();
var cart_ids = [];
var goods_amount = parseFloat($('.goods_amount').val()); $('.shop-table tbody').find('tr').each(function() {
var currency = $('.currency').val(); var cid = $(this).data('cid');
var coupon_amount = $('.user_coupon_id').val() != '' ? parseFloat($('#user_coupon').data('amount')) : 0; cart_ids.push(cid);
})
if (address_id) { if (address_id) {
$.ajax({ $.ajax({
...@@ -109,8 +112,8 @@ ...@@ -109,8 +112,8 @@
$('.address-mobile').text(data.mobile); $('.address-mobile').text(data.mobile);
$('.address-detail').text(data.province_val + data.city_val + data.district_val + data.detail_address); $('.address-detail').text(data.province_val + data.city_val + data.district_val + data.detail_address);
if (goods_type == 2 && address_id) { if (cart_ids.length > 0) {
loading.getExpressFee(user_id, address_id); // 获取自营运费 loading.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type); // 确认订单信息
} }
} }
} }
...@@ -119,15 +122,9 @@ ...@@ -119,15 +122,9 @@
$('.address-content').hide(); $('.address-content').hide();
$('.address_id').val(''); $('.address_id').val('');
if (goods_type == 2) { if (cart_ids.length > 0) {
$('.express_fee').val(0); loading.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type); // 确认订单信息
$('.express_fee_val').text('¥0.00');
} }
var express_fee = parseFloat($('.express_fee').val());
var order_amount = parseFloat(goods_amount-coupon_amount+express_fee).toFixed(4);
$('.order_amount').text(currency+order_amount);
} }
}) })
...@@ -359,7 +356,7 @@ ...@@ -359,7 +356,7 @@
dataType: "json", dataType: "json",
success: function(resp){ success: function(resp){
layer.msg(resp.errmsg); layer.msg(resp.errmsg);
loading.lists(user_id, goods_type, is_online); // 加载购物车列表 loading.lists(user_id, goods_type, is_online, delivery_place); // 加载购物车列表
return false; return false;
}, },
}) })
...@@ -394,10 +391,6 @@ ...@@ -394,10 +391,6 @@
success: function(resp){ success: function(resp){
if (resp.errcode == 0) { if (resp.errcode == 0) {
loading.lists(user_id, goods_type, is_online); // 加载购物车列表 loading.lists(user_id, goods_type, is_online); // 加载购物车列表
// var data = resp.data;
// self.parents('tr').find('.goods_price').text(data.goods_price);
// self.parents('tr').find('.goods_amount').text(data.goods_amount_format);
} }
layer.msg(resp.errmsg); layer.msg(resp.errmsg);
...@@ -444,26 +437,22 @@ ...@@ -444,26 +437,22 @@
// 选择优惠券 // 选择优惠券
$('#user_coupon').change(function(){ $('#user_coupon').change(function(){
var coupon_id = $(this).val(); var coupon_id = $(this).val();
var goods_amount = parseFloat($('.goods_amount').val()); var address_id = $('.address_id').val();
var currency = $('.currency').val(); var user_id = $('.user_id').val();
var coupon_amount = parseFloat($(this).data('amount')); var cart_ids = [];
var express_fee = 0;
if (goods_type == 2) { $('.shop-table tbody').find('tr').each(function() {
express_fee = parseFloat($('.express_fee').val()); var cid = $(this).data('cid');
} cart_ids.push(cid);
})
if (coupon_id) { if (coupon_id) {
var order_amount = parseFloat(goods_amount-coupon_amount+express_fee).toFixed(4);
$('.user_coupon_id').val(coupon_id); $('.user_coupon_id').val(coupon_id);
$('.order_amount').text(currency+order_amount);
} else { } else {
$('.user_coupon_id').val(''); $('.user_coupon_id').val('');
var order_amount = parseFloat(goods_amount+express_fee).toFixed(4);
$('.order_amount').text(currency+order_amount);
} }
loading.confirm(user_id, address_id, cart_ids, coupon_id, goods_type); // 确认订单信息
}) })
// 提交订单 // 提交订单
...@@ -472,6 +461,7 @@ ...@@ -472,6 +461,7 @@
var type = $(this).data('type'); var type = $(this).data('type');
var cart_ids = []; var cart_ids = [];
var user_id = 0; var user_id = 0;
var remark = $('#remark').val();
if (is_online) { if (is_online) {
user_id = $('.user_id').val(); user_id = $('.user_id').val();
...@@ -491,6 +481,7 @@ ...@@ -491,6 +481,7 @@
address_id: address_id, address_id: address_id,
type: type, type: type,
cart_ids: cart_ids, cart_ids: cart_ids,
remark: remark,
} }
if (type == 3) { // 自营线下订单 if (type == 3) { // 自营线下订单
...@@ -540,6 +531,7 @@ ...@@ -540,6 +531,7 @@
// 购物车商品列表 // 购物车商品列表
lists: function(user_id, goods_type, is_online, delivery_place="1") { // type:1-联营,2-自营 lists: function(user_id, goods_type, is_online, delivery_place="1") { // type:1-联营,2-自营
var self = this; var self = this;
var user_coupon_id = $('.user_coupon_id').val() ? $('.user_coupon_id').val() : 0;
$.ajax({ $.ajax({
type: 'post', type: 'post',
...@@ -556,6 +548,7 @@ ...@@ -556,6 +548,7 @@
var cart_ids = []; var cart_ids = [];
if (len > 0) { if (len > 0) {
// 购物车列表
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
html += '<tr data-cid="'+list[i].cart_id+'">'+ html += '<tr data-cid="'+list[i].cart_id+'">'+
'<td>'+list[i].goods_id+'</td>'+ '<td>'+list[i].goods_id+'</td>'+
...@@ -570,47 +563,18 @@ ...@@ -570,47 +563,18 @@
'</tr>'; '</tr>';
cart_ids.push(list[i].cart_id); // 购物车ID集合 cart_ids.push(list[i].cart_id); // 购物车ID集合
order_amount += list[i].goods_number * list[i].goods_price;
}
order_amount = parseFloat(order_amount).toFixed(4);
if (list[0].currency == 1) {
currency = '¥';
} else {
currency = '$';
} }
$('.shop-lists').show(); $('.shop-lists').show();
$('.shop-table tbody').empty().append(html); $('.shop-table tbody').empty().append(html);
if (is_online) {
$('.order-info').show();
$('.goods_amount').val(order_amount);
$('.currency').val(currency);
$('.goods_amount_val').empty().text(currency+order_amount);
$('.order_amount').empty().text(currency+order_amount);
self.getCoupon(user_id, goods_type, cart_ids); // 获取最优的优惠券
var address_id = $('.address_id').val(); var address_id = $('.address_id').val();
if (goods_type == 2 && address_id) { self.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online); // 确认订单信息
self.getExpressFee(user_id, address_id); // 获取自营运费
var express_fee = $('.express_fee').val();
$('.order_amount').empty().text(currency+order_amount+express_fee);
}
} else {
$('.amount-section').show();
$('.order_amount').empty().text(currency+order_amount);
}
} }
} else { } else {
$('.shop-lists').hide(); $('.shop-lists').hide();
if (is_online) { if (is_online) {
// $('.goods_amount').val(''); // 清空值
$('.order-info').hide(); $('.order-info').hide();
} else { } else {
$('.amount-section').hide(); $('.amount-section').hide();
...@@ -653,26 +617,43 @@ ...@@ -653,26 +617,43 @@
}) })
}, },
// 获取自营运费 // 确认订单信息
getExpressFee: function(user_id, address_id) { confirm: function(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online=1) {
var self = this;
$.ajax({ $.ajax({
type: 'post', type: 'post',
url: '/ajax/getExpressFee', url: '/ajax/confirm',
data: {uid: user_id, address_id: address_id}, data: {uid: user_id, address_id: address_id, cart_ids: cart_ids, user_coupon_id: user_coupon_id, goods_type: goods_type},
dataType: "json", dataType: "json",
success: function(resp){ success: function(resp){console.log(resp);
if (resp.errcode == 0) { if (resp.errcode == 0) {
var data = parseFloat(resp.data); var data = resp.data;
if (is_online) {
$('.order-info').show();
$('.express_fee').val(data); $('.goods_amount_val').empty().text(data.goods_total_format); // 商品总额
$('.express_fee_val').empty().text('¥' + data); $('.order_amount').empty().text(data.order_amount_format); // 订单总额
var goods_amount = parseFloat($('.goods_amount').val()); // 若优惠券ID存在,则不用再推荐
var currency = $('.currency').val(); if (!user_coupon_id) {
var coupon_amount = $('.user_coupon_id').val() != '' ? parseFloat($('#user_coupon').data('amount')) : 0; $('.preferential_price').hide();
var order_amount = parseFloat(goods_amount-coupon_amount+data).toFixed(4); $('.preferential_price_val').empty();
$('.order_amount').empty().text(currency+order_amount); self.getCoupon(user_id, goods_type, cart_ids); // 获取最优的优惠券
} else {
$('.preferential_price').show();
$('.preferential_price_val').empty().text(data.preferential_price_format);
}
if (goods_type == 2 && address_id) {
$('.express_fee').val(data.finally_shipping_price_format); // 运费
}
} else {
$('.amount-section').show();
$('.order_amount').empty().text(data.order_amount_format);
}
} }
return false; return false;
......
...@@ -201,6 +201,7 @@ ...@@ -201,6 +201,7 @@
<!-- 订单金额 --> <!-- 订单金额 -->
<div class="amount-section"> <div class="amount-section">
<textarea name="remark" id="remark" cols="30" rows="3" placeholder="填写订单备注信息"></textarea>
<p>应付金额:<span class="text-danger order_amount"></span></p> <p>应付金额:<span class="text-danger order_amount"></span></p>
</div> </div>
</div> </div>
......
...@@ -352,10 +352,6 @@ ...@@ -352,10 +352,6 @@
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<input type="hidden" class="currency" name="currency" value="¥">
<input type="hidden" class="goods_amount" name="goods_amount" value="0">
<input type="hidden" class="express_fee" name="express_fee" value="0">
<div class="row"> <div class="row">
<p class="con-title"><span>商品总额:</span></p> <p class="con-title"><span>商品总额:</span></p>
<p class="con-val goods_amount_val"></p> <p class="con-val goods_amount_val"></p>
...@@ -371,15 +367,25 @@ ...@@ -371,15 +367,25 @@
</p> </p>
</div> </div>
<div class="row preferential_price">
<p class="con-title"><span>优惠金额:</span></p>
<p class="con-val preferential_price_val">0.00</p>
</div>
<div class="row"> <div class="row">
<p class="con-title"><span>运费:</span></p> <p class="con-title"><span>运费:</span></p>
<p class="con-val express_fee_val">0.00</p> <p class="con-val express_fee_val">0.00</p>
</div> </div>
<div class="row"> <div class="row">
<p class="con-title"><span>应付金额:</span></p> <p class="con-title"><span>应付金额:</span></p>
<p class="con-val text-danger order_amount"></p> <p class="con-val text-danger order_amount"></p>
</div> </div>
<div class="row">
<p class="con-title"><span>备注信息:</span></p>
<textarea name="remark" id="remark" cols="50" rows="3" placeholder="填写订单备注信息"></textarea>
</div>
</div> </div>
</div> </div>
......
...@@ -372,9 +372,6 @@ ...@@ -372,9 +372,6 @@
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<input type="hidden" class="currency" name="currency" value="">
<input type="hidden" class="goods_amount" name="goods_amount" value="">
<div class="row"> <div class="row">
<p class="con-title"><span>商品总额:</span></p> <p class="con-title"><span>商品总额:</span></p>
<p class="con-val goods_amount_val"></p> <p class="con-val goods_amount_val"></p>
...@@ -390,10 +387,20 @@ ...@@ -390,10 +387,20 @@
</p> </p>
</div> </div>
<div class="row preferential_price">
<p class="con-title"><span>优惠金额:</span></p>
<p class="con-val preferential_price_val">0.00</p>
</div>
<div class="row"> <div class="row">
<p class="con-title"><span>应付金额:</span></p> <p class="con-title"><span>应付金额:</span></p>
<p class="con-val text-danger order_amount"></p> <p class="con-val text-danger order_amount"></p>
</div> </div>
<div class="row">
<p class="con-title"><span>备注信息:</span></p>
<textarea name="remark" id="remark" cols="50" rows="3" placeholder="填写订单备注信息"></textarea>
</div>
</div> </div>
</div> </div>
......
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
<input class="only_positive_nubme only_number num" name="change_info[{{$v['rec_id']}}][goods_number]" value="{{$v['goods_number']}}"> <input class="only_positive_nubme only_number num" name="change_info[{{$v['rec_id']}}][goods_number]" value="{{$v['goods_number']}}">
</td> </td>
<td> <td>
<span>{{$currency}}</span>
<input class="price only_number" name="change_info[{{$v['rec_id']}}][goods_price]" data-origin="{{$v['original_price']}}" value="{{$v['goods_price']}}"> <input class="price only_number" name="change_info[{{$v['rec_id']}}][goods_price]" data-origin="{{$v['original_price']}}" value="{{$v['goods_price']}}">
</td> </td>
</tr> </tr>
...@@ -142,6 +143,7 @@ ...@@ -142,6 +143,7 @@
<p class="sup_amount_val">{{$v['amount']}}</p> <p class="sup_amount_val">{{$v['amount']}}</p>
</td> </td>
<td> <td>
<span>{{$currency}}</span>
<input class="adjust_extend_fee only_number" name="change_extend_fee[{{$k}}][extend_fee]" value="{{$v['extend_fee']}}"> <input class="adjust_extend_fee only_number" name="change_extend_fee[{{$k}}][extend_fee]" value="{{$v['extend_fee']}}">
</td> </td>
......
...@@ -457,11 +457,19 @@ ...@@ -457,11 +457,19 @@
@endforeach @endforeach
@endif @endif
</tbody> </tbody>
<tfoot> </table>
</div>
</tfoot> @if ($order_info['order_remark'])
<div class="tabs-box">
<table class="table table-bordered table-hover"">
<tr>
<td width="10%">订单备注信息:</td>
<td>{{$order_info['order_remark']}}</td>
</tr>
</table> </table>
</div> </div>
@endif
<div class="tabs-box order-total"> <div class="tabs-box order-total">
<div> <div>
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
<div class="btn-group btn-group-xs"> <div class="btn-group btn-group-xs">
<a class="btn btn-primary" href="/details/{{$v['order_id']}}?tags=self" target="_blank">详情</a> <a class="btn btn-primary" href="/details/{{$v['order_id']}}?tags=self" target="_blank">详情</a>
@if (in_array('download_contract', $userPerms)) @if (in_array('self_order_download_contract', $userPerms))
<a class="btn btn-default download-contract" data-id="{{$v['order_id']}}" href="javascript:;">下载合同</a> <a class="btn btn-default download-contract" data-id="{{$v['order_id']}}" href="javascript:;">下载合同</a>
@endif @endif
</div> </div>
......
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