|
@@ -74,7 +74,6 @@ var orderPage = new Vue({
|
|
|
}else{
|
|
|
_self.listData = _self.listData.concat(list);
|
|
|
}
|
|
|
- console.log('listData',_self.listData)
|
|
|
setTimeout(function(){
|
|
|
// 图片懒加载
|
|
|
$("img[data-original]").lazyload();
|
|
@@ -96,13 +95,13 @@ var orderPage = new Vue({
|
|
|
}
|
|
|
return false
|
|
|
},
|
|
|
- shoppingCart:function (pros) {
|
|
|
+ shoppingCart:function (pros) {// 加入购物车
|
|
|
var _self = this;
|
|
|
ShoppingApi.ShoppingAddCart(
|
|
|
{
|
|
|
userID:_self.listQuery.userId,
|
|
|
productID:pros.productId,
|
|
|
- productCount:1
|
|
|
+ productCount:pros.minBuyNumber
|
|
|
},
|
|
|
function (response) {
|
|
|
if(response.code === 0){
|
|
@@ -148,10 +147,46 @@ var orderPage = new Vue({
|
|
|
},
|
|
|
hanldAllAddCart:function () {// 批量加入购物车
|
|
|
var _self = this;
|
|
|
+ var checkedList = [];
|
|
|
if(!_self.isProductChecked){
|
|
|
CAIMEI.dialog('请先选择商品',false);
|
|
|
}
|
|
|
- _self.productIds = _self.checkedList.join(",")
|
|
|
+ _self.listData.forEach((el)=>{
|
|
|
+ if(el.isChecked){
|
|
|
+ checkedList.push(el.productId);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ShoppingApi.ShoppingAddCarts({userId:_self.listQuery.userId,productIds:checkedList.join(",")},function(response){
|
|
|
+ if(response.code === 0){
|
|
|
+ globalHead.getHeadCart(_self.listQuery.userId);
|
|
|
+ $.confirm({
|
|
|
+ useBootstrap: false,
|
|
|
+ boxWidth: (isPC?'338px':'74.6vw'),
|
|
|
+ title: false,
|
|
|
+ content:'<div class="cartAlert"><h6>商品已成功加入购物车!</h6><p>当前购物车共<em>'+response.data+'</em>种商品</p></div>',
|
|
|
+ closeIcon: true,
|
|
|
+ animation: 'opacity',
|
|
|
+ closeAnimation: 'opacity',
|
|
|
+ animateFromElement: false,
|
|
|
+ scrollToPreviousElement: false,
|
|
|
+ buttons: {
|
|
|
+ login: {
|
|
|
+ text: '去结算',
|
|
|
+ btnClass: 'btn-to-cart',
|
|
|
+ action: function(){
|
|
|
+ window.location.href = '/shopping/cart.html';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ close: {
|
|
|
+ text: '继续购物',
|
|
|
+ btnClass: 'btn-to-goon'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ dialog("加入购物车失败!");
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
hanldCancel:function (pros) {// 取消收藏
|
|
|
var _self = this;
|