|
@@ -13,15 +13,7 @@ var orderPage = new Vue({
|
|
|
listQuery:{
|
|
|
userId:0,
|
|
|
pageNum:1,
|
|
|
- pageSize:6,
|
|
|
- status:1
|
|
|
- },
|
|
|
- params: {
|
|
|
- size: 12,
|
|
|
- num: 1,
|
|
|
- keyword: "测试",
|
|
|
- sortField: "",
|
|
|
- sortType: 1, // 1降序,其他升序
|
|
|
+ pageSize:12,
|
|
|
},
|
|
|
listData:[],
|
|
|
checkedList:[],
|
|
@@ -57,7 +49,7 @@ var orderPage = new Vue({
|
|
|
toPagination: function (pageNum) {//点击切换分页
|
|
|
if (pageNum <= this.pageTotal) {
|
|
|
this.listQuery.pageNum = pageNum;
|
|
|
- this.QueryCouponActivityList();
|
|
|
+ this.getCollectionProductList();
|
|
|
}
|
|
|
},
|
|
|
checkNum: function () {//输入跳转分页
|
|
@@ -67,27 +59,13 @@ var orderPage = new Vue({
|
|
|
this.pageInput = 1;
|
|
|
}
|
|
|
},
|
|
|
- QueryCouponActivityList: function () {
|
|
|
+ getCollectionProductList: function () {
|
|
|
var _self = this;
|
|
|
- ProductApi.GetProductSearchList({
|
|
|
- keyword: this.params.keyword,
|
|
|
- identity: GLOBAL_USER_IDENTITY,
|
|
|
- pageSize: this.params.size,
|
|
|
- pageNum: this.params.num,
|
|
|
- sortField: this.params.sortField,
|
|
|
- sortType: this.params.sortType
|
|
|
- },function (res) {
|
|
|
- if (res.code === 0 && res.data ) {
|
|
|
- var result = JSON.parse(res.data);
|
|
|
- _self.listRecord = result.total;
|
|
|
- var resultData = setSearchProductList(result.items, _self.userId, function(){
|
|
|
- _self.$forceUpdate();
|
|
|
- setTimeout(function(){
|
|
|
- // 图片懒加载
|
|
|
- $("img[data-original]").lazyload();
|
|
|
- },500);
|
|
|
- });
|
|
|
- var list = resultData.map((el,index)=>{
|
|
|
+ ProductApi.getProductUserLikeList(_self.listQuery,function (response) {
|
|
|
+ if (response.code === 0 ) {
|
|
|
+ var data = response.data;
|
|
|
+ _self.listRecord = data.totalRecord;
|
|
|
+ var list = data.results.map((el,index)=>{
|
|
|
el.isChecked = false;
|
|
|
return el
|
|
|
});
|
|
@@ -97,6 +75,10 @@ var orderPage = new Vue({
|
|
|
_self.listData = _self.listData.concat(list);
|
|
|
}
|
|
|
console.log('listData',_self.listData)
|
|
|
+ setTimeout(function(){
|
|
|
+ // 图片懒加载
|
|
|
+ $("img[data-original]").lazyload();
|
|
|
+ },500);
|
|
|
_self.listLoading = false;
|
|
|
_self.requestFlag = true;
|
|
|
}else {
|
|
@@ -169,17 +151,15 @@ var orderPage = new Vue({
|
|
|
if(!_self.isProductChecked){
|
|
|
CAIMEI.dialog('请先选择商品',false);
|
|
|
}
|
|
|
- _self.checkedList.forEach(el =>{
|
|
|
- _self.productIds += el.productId+',';
|
|
|
- })
|
|
|
+ _self.productIds = _self.checkedList.join(",")
|
|
|
},
|
|
|
hanldCancel:function (pros) {// 取消收藏
|
|
|
var _self = this;
|
|
|
CAIMEI.Modal('确定要取消收藏吗?','取消','确定',function () {
|
|
|
- OrderApi.AffirmOrderOrder({orderID:orderId},function(response){
|
|
|
+ ProductApi.getDeleteUserLike({userId:_self.listQuery.userId,productIds:pros.productId+','},function(response){
|
|
|
if(response.code == 0){
|
|
|
- CAIMEI.dialog('确认成功',true,function () {
|
|
|
- _self.GetQueryOrderListData();
|
|
|
+ CAIMEI.dialog('取消收藏成功',true,function () {
|
|
|
+ _self.getCollectionProductList();
|
|
|
});
|
|
|
}else{
|
|
|
CAIMEI.Alert(response.msg, '确定', false);
|
|
@@ -189,22 +169,36 @@ var orderPage = new Vue({
|
|
|
},
|
|
|
hanldAllCancel:function () {// 批量取消收藏
|
|
|
var _self = this;
|
|
|
+ var checkedList =[];
|
|
|
+ _self.productIds = '';
|
|
|
if(!_self.isProductChecked){
|
|
|
CAIMEI.dialog('请先选择商品',false);
|
|
|
+ return;
|
|
|
}
|
|
|
- _self.checkedList.forEach(el =>{
|
|
|
- _self.productIds += el.productId+',';
|
|
|
+ _self.listData.forEach((el)=>{
|
|
|
+ if(el.isChecked){
|
|
|
+ checkedList.push(el.productId)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ _self.productIds = checkedList.join(",")
|
|
|
+ console.log('_self.productIds2',_self.productIds);
|
|
|
+ CAIMEI.Modal('确定要取消收藏吗?','取消','确定',function () {
|
|
|
+ ProductApi.getDeleteUserLike({userId:_self.listQuery.userId,productIds:_self.productIds},function(response){
|
|
|
+ if(response.code == 0){
|
|
|
+ CAIMEI.dialog('取消收藏成功',true,function () {
|
|
|
+ _self.getCollectionProductList();
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg, '确定', false);
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- console.log('_self.productIds',_self.productIds);
|
|
|
},
|
|
|
isCheckedAll(){//全选
|
|
|
var _self = this;
|
|
|
_self.isAllChecked = !_self.isAllChecked;
|
|
|
_self.listData.forEach((el)=>{
|
|
|
el.isChecked = _self.isAllChecked;
|
|
|
- if(el.isChecked) {
|
|
|
- _self.checkedList.push(el);
|
|
|
- }
|
|
|
})
|
|
|
if(_self.isAllChecked){
|
|
|
_self.isProductChecked = true;
|
|
@@ -222,7 +216,6 @@ var orderPage = new Vue({
|
|
|
_self.listData.forEach(el => {
|
|
|
if(el.isChecked) {
|
|
|
goodsCheckedLength++;
|
|
|
- _self.checkedList.push(el);
|
|
|
}
|
|
|
})
|
|
|
_self.checkedNum = goodsCheckedLength;
|
|
@@ -245,7 +238,7 @@ var orderPage = new Vue({
|
|
|
if(globalUserData){
|
|
|
_self.userId = globalUserData.userId;
|
|
|
_self.listQuery.userId = this.userId;
|
|
|
- _self.QueryCouponActivityList();
|
|
|
+ _self.getCollectionProductList();
|
|
|
}
|
|
|
}
|
|
|
});
|