Commit 52ae82c6 by 朱继来

Merge branch 'zjl_change_num_20190108'

parents 8fc775de 460d0773
...@@ -358,8 +358,8 @@ Class OrderController extends Controller ...@@ -358,8 +358,8 @@ Class OrderController extends Controller
$info = $this->getOrderInfo($request, 1); $info = $this->getOrderInfo($request, 1);
$info['title'] = '平台订单'; $info['title'] = '平台订单';
// 若为京东自营、自营客服、财务角色,则跳转到自营列表 // 若为京东自营、自营客服角色,则跳转到自营列表
if (in_array($info['role'], [6, 7, 9])) { if (in_array($info['role'], [6, 7])) {
return redirect('self_order'); return redirect('self_order');
} }
......
...@@ -237,7 +237,7 @@ class OrderModel extends Model ...@@ -237,7 +237,7 @@ class OrderModel extends Model
}) })
->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.single_pre_price', 'it.brand_name', 'it.supplier_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', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'a.consignee', 'a.address', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'c.com_name', 'oe.send_remark', 'oe.is_new as is_new_order') ->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', 'it.supplier_name', 'it.order_source as items_source', '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', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'a.consignee', 'a.address', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'c.com_name', 'oe.send_remark', 'oe.is_new as is_new_order')
->groupBy('it.rec_id') ->groupBy('it.rec_id')
->orderBy('o.create_time', 'DESC') ->orderBy('o.create_time', 'DESC')
->get() ->get()
...@@ -249,9 +249,9 @@ class OrderModel extends Model ...@@ -249,9 +249,9 @@ class OrderModel extends Model
// 标题 // 标题
if ($map['order_goods_type'] == 1) { if ($map['order_goods_type'] == 1) {
$headerCell = ['订单ID', '订单编号', '会员账号', '是否为新订单', '收货人', '下单日期', '下单时间', '客户名称', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', $sale_name, '商品总额', '运费', '附加费', '优惠券', '订单总额', '订单类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注']; $headerCell = ['订单ID', '订单编号', '会员账号', '是否为新订单', '收货人', '下单日期', '下单时间', '客户名称', '明细来源', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', $sale_name, '商品总额', '运费', '附加费', '优惠券', '订单总额', '订单类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注'];
} else { } else {
$headerCell = ['订单ID', '订单编号', '会员账号', '收货人', '下单日期', '下单时间', '客户名称', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', $sale_name, '商品总额', '运费', '附加费', '优惠券', '订单总额', '订单类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注']; $headerCell = ['订单ID', '订单编号', '会员账号', '收货人', '下单日期', '下单时间', '客户名称', '明细来源', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', $sale_name, '商品总额', '运费', '附加费', '优惠券', '订单总额', '订单类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注'];
} }
array_unshift($cellData, $headerCell); array_unshift($cellData, $headerCell);
...@@ -345,6 +345,8 @@ class OrderModel extends Model ...@@ -345,6 +345,8 @@ class OrderModel extends Model
$tmp[$i]['create_time_date'] = date('Y-m-d', $order[$i]['create_time']); $tmp[$i]['create_time_date'] = date('Y-m-d', $order[$i]['create_time']);
$tmp[$i]['create_time_sec'] = date('H:i:s', $order[$i]['create_time']); $tmp[$i]['create_time_sec'] = date('H:i:s', $order[$i]['create_time']);
$tmp[$i]['com_name'] = !empty($order[$i]['tax_title']) ? $order[$i]['tax_title'] : $order[$i]['com_name']; $tmp[$i]['com_name'] = !empty($order[$i]['tax_title']) ? $order[$i]['tax_title'] : $order[$i]['com_name'];
$tmp[$i]['items_source'] = $order[$i]['items_source'];
// 自营商品名称换成商品型号 // 自营商品名称换成商品型号
$tmp[$i]['goods_name'] = $order[$i]['order_goods_type'] == 1 ? $order[$i]['goods_name'] : $this->getGoodsName($order[$i]['goods_id']); $tmp[$i]['goods_name'] = $order[$i]['order_goods_type'] == 1 ? $order[$i]['goods_name'] : $this->getGoodsName($order[$i]['goods_id']);
$tmp[$i]['brand_name'] = $order[$i]['brand_name']; $tmp[$i]['brand_name'] = $order[$i]['brand_name'];
......
...@@ -10,7 +10,7 @@ return [ ...@@ -10,7 +10,7 @@ return [
'search'=> 'http://' . env('LOGIN_DOMAIN', '') . '/api/search', 'search'=> 'http://' . env('LOGIN_DOMAIN', '') . '/api/search',
], ],
'domain' => 'liexin.com', 'domain' => 'liexin.net',
// 订单系统 // 订单系统
'order_url' => 'http://order.liexin.net', 'order_url' => 'http://order.liexin.net',
......
...@@ -404,6 +404,7 @@ ...@@ -404,6 +404,7 @@
$('.shop-table').delegate('.goods_num', 'blur', function() { $('.shop-table').delegate('.goods_num', 'blur', function() {
var self = $(this); var self = $(this);
var num = self.val(); var num = self.val();
var min_buy = Number(self.parents('tr').attr('min_buy'));
var cart_id = self.parents('tr').data('cid'); var cart_id = self.parents('tr').data('cid');
var type = self.parents('tr').data('type'); var type = self.parents('tr').data('type');
var user_id = 0; var user_id = 0;
...@@ -415,8 +416,16 @@ ...@@ -415,8 +416,16 @@
user_id = internal_uid ? internal_uid : user_id; user_id = internal_uid ? internal_uid : user_id;
if (num < min_buy) {
num = min_buy;
layer.msg('购买数量低于最小起订量,默认调整为最小起订量');
}
if (goods_type == 1) { // 联营需要选择交货地 if (goods_type == 1) { // 联营需要选择交货地
delivery_place = $('input[name=delivery_place]:checked').val(); delivery_place = $('input[name=delivery_place]:checked').val();
} else { // 自营数量需要结合倍数
var mpl = Number(self.parents('tr').find('.goods_mpl').text()); // 倍数
num = Math.ceil(num / mpl) * mpl;
} }
$.ajax({ $.ajax({
...@@ -724,18 +733,23 @@ ...@@ -724,18 +733,23 @@
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+'" data-type="'+list[i].type+'">'+ html += '<tr data-cid="'+list[i].cart_id+'" data-type="'+list[i].type+'" min_buy="'+list[i].min_buy+'">'+
'<td>'+(i+1)+'</td>'+ '<td>'+(i+1)+'</td>'+
'<td class="goods_id">'+list[i].goods_id+'</td>'+ '<td class="goods_id">'+list[i].goods_id+'</td>'+
'<td>'+list[i].goods_name+'</td>'+ '<td>'+list[i].goods_name+'</td>'+
'<td>'+list[i].brand_name+'</td>'+ '<td>'+list[i].brand_name+'</td>';
'<td><input type="text" class="goods_num" name="goods_num" value="'+list[i].goods_number+'"></td>'+
'<td class="goods_price">'+list[i].goods_price+'</td>'+ if (goods_type == 2) {
'<td class="goods_amount">'+list[i].goods_amount_format+'</td>'+ html += '<td><span class="goods_mpl">'+list[i].mpl+'</span></td>';
'<td>'+list[i].delivery_time+'</td>'+ }
'<td>'+list[i].supplier_name+'</td>'+
'<td><a class="btn btn-danger btn-xs remove-goods">删除</a></td>'+ html += '<td><input type="text" class="goods_num" name="goods_num" value="'+list[i].goods_number+'"></td>'+
'</tr>'; '<td class="goods_price">'+list[i].goods_price+'</td>'+
'<td class="goods_amount">'+list[i].goods_amount_format+'</td>'+
'<td>'+list[i].delivery_time+'</td>'+
'<td>'+list[i].supplier_name+'</td>'+
'<td><a class="btn btn-danger btn-xs remove-goods">删除</a></td>'+
'</tr>';
cart_ids.push(list[i].cart_id); // 购物车ID集合 cart_ids.push(list[i].cart_id); // 购物车ID集合
} }
...@@ -748,6 +762,41 @@ ...@@ -748,6 +762,41 @@
var address_id = $('.address_id').val(); var address_id = $('.address_id').val();
self.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online); // 确认订单信息 self.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online); // 确认订单信息
} }
// 自营商品检查数量
if (goods_type == 2) {
var changeGoods = [];
$('.shop-table tbody tr').each(function() {
var goods_id = $(this).find('.goods_id').text();
var num = Number($(this).find('.goods_num').val());
var mpl = Number($(this).find('.goods_mpl').text());
var cart_id = $(this).data('cid');
var type = $(this).data('type');
if (num % mpl != 0) {
num = Math.ceil(num / mpl) * mpl;
$.ajax({
type: "POST",
url: '/ajax/changeNum',
data: {uid: user_id, num: num, cart_id: cart_id, type: type, goods_type: goods_type},
dataType: "json",
async: false,
success: function(resp){
if (resp.errcode == 0) {
changeGoods.push(goods_id);
}
},
})
}
})
if (changeGoods.length > 0) {
layer.alert('已按倍数调整购买数量,商品ID:'+changeGoods.join(', '));
self.lists(user_id, goods_type, is_online, delivery_place); // 加载购物车列表
}
}
} else { } else {
$('.shop-lists').hide(); $('.shop-lists').hide();
......
...@@ -186,10 +186,11 @@ ...@@ -186,10 +186,11 @@
<th width="15%">SKUID</th> <th width="15%">SKUID</th>
<th width="20%">商品名称</th> <th width="20%">商品名称</th>
<th width="10%">制造商</th> <th width="10%">制造商</th>
<th width="5%">倍数</th>
<th width="10%">采购数量</th> <th width="10%">采购数量</th>
<th width="10%">采购单价</th> <th width="10%">采购单价</th>
<th width="10%">小计</th> <th width="10%">小计</th>
<th width="10%">货期</th> <th width="6%">货期</th>
<th width="10%">供应商</th> <th width="10%">供应商</th>
<th width="5%">操作</th> <th width="5%">操作</th>
</tr> </tr>
...@@ -202,7 +203,7 @@ ...@@ -202,7 +203,7 @@
<!-- 订单金额 --> <!-- 订单金额 -->
<div class="amount-section"> <div class="amount-section">
<p>应付金额:<span class="text-danger order_amount"></span></p> <p>(95折后)应付金额:<span class="text-danger order_amount"></span></p>
</div> </div>
</div> </div>
......
...@@ -322,10 +322,11 @@ ...@@ -322,10 +322,11 @@
<th width="15%">SKUID</th> <th width="15%">SKUID</th>
<th width="20%">商品名称</th> <th width="20%">商品名称</th>
<th width="10%">制造商</th> <th width="10%">制造商</th>
<th width="5%">倍数</th>
<th width="10%">采购数量</th> <th width="10%">采购数量</th>
<th width="10%">采购单价</th> <th width="10%">采购单价</th>
<th width="10%">小计</th> <th width="10%">小计</th>
<th width="10%">货期</th> <th width="6%">货期</th>
<th width="10%">供应商</th> <th width="10%">供应商</th>
<th width="5%">操作</th> <th width="5%">操作</th>
</tr> </tr>
......
...@@ -467,7 +467,7 @@ ...@@ -467,7 +467,7 @@
@if ($order_info['order_remark']) @if ($order_info['order_remark'])
<tr> <tr>
<td>订单备注信息:</td> <td>订单备注信息:</td>
<td colspan="8">{{$order_info['order_remark']}}</td> <td colspan="10">{{$order_info['order_remark']}}</td>
</tr> </tr>
@endif @endif
</tfoot> </tfoot>
...@@ -502,7 +502,7 @@ ...@@ -502,7 +502,7 @@
@if ($order_price_info['discount_amount'] != 0) @if ($order_price_info['discount_amount'] != 0)
<tr> <tr>
<td>优惠</td> <td>优惠金额</td>
<td class="edit-parent-td"> <td class="edit-parent-td">
{{$currency}}<span id="other_money">{{$order_price_info['discount_amount']}}</span> {{$currency}}<span id="other_money">{{$order_price_info['discount_amount']}}</span>
</td> </td>
......
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