Commit 0db3351d by 朱继来

后台下单-自营购物车检查购买数量,按倍数处理

parent 113abe40
Showing with 36 additions and 0 deletions
......@@ -762,6 +762,42 @@
var address_id = $('.address_id').val();
self.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online); // 确认订单信息
}
// 自营商品检查数量
if (goods_type == 2) {
var changeGoods = [];
var myajax;
$('.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 {
$('.shop-lists').hide();
......
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