...
|
...
|
@@ -60,34 +60,32 @@ |
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
loadMore: function() {
|
|
|
let _this = this;
|
|
|
|
|
|
loadMore() {
|
|
|
this.busy = true;
|
|
|
$.ajax({
|
|
|
url: '/me/collection/favpaging',
|
|
|
data: {
|
|
|
page: ++_this.page
|
|
|
page: ++this.page
|
|
|
}
|
|
|
}).then(data => {
|
|
|
if ($.isEmptyObject(data) || data.pageTotal === 0) {
|
|
|
_this.busy = true;
|
|
|
this.busy = true;
|
|
|
} else {
|
|
|
if (_this.page === data.pageTotal) {
|
|
|
_this.busy = true;
|
|
|
if (this.page === data.pageTotal) {
|
|
|
this.busy = true;
|
|
|
} else {
|
|
|
_this.busy = false;
|
|
|
this.busy = false;
|
|
|
}
|
|
|
|
|
|
const list = data.productList || [];
|
|
|
|
|
|
list.forEach(function(o) {
|
|
|
list.forEach(o => {
|
|
|
if (!o.productSkn) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!_this.keys[o.productId]) {
|
|
|
_this.keys[o.productId] = true;
|
|
|
if (!this.keys[o.productId]) {
|
|
|
this.keys[o.productId] = true;
|
|
|
|
|
|
let discountPrice = false;
|
|
|
|
...
|
...
|
@@ -95,7 +93,7 @@ |
|
|
discountPrice = '¥' + Number(Math.max(o.salesPrice, 0)).toFixed(2);
|
|
|
}
|
|
|
|
|
|
_this.productData.push({
|
|
|
this.productData.push({
|
|
|
fav_id: o.productId,
|
|
|
link: o.goodsId && o.cnAlphabet ? o.productId : '',
|
|
|
imgUrl: o.image,
|
...
|
...
|
@@ -109,7 +107,7 @@ |
|
|
});
|
|
|
}
|
|
|
|
|
|
_this.nullbox = _this.productData.length ? 'hide' : '';
|
|
|
this.nullbox = this.productData.length ? 'hide' : '';
|
|
|
}).fail(() => {
|
|
|
tip('网络错误');
|
|
|
});
|
...
|
...
|
@@ -125,15 +123,13 @@ |
|
|
this.pandata.objX = -width;
|
|
|
},
|
|
|
hideDelBth() {
|
|
|
this.productData.forEach(function(d) {
|
|
|
this.productData.forEach(d => {
|
|
|
$('#li-' + d.fav_id).css('transform', 'translateX(0px)');
|
|
|
$('#del-' + d.fav_id).addClass('hide');
|
|
|
});
|
|
|
this.pandata = {};
|
|
|
},
|
|
|
delItem(index, id) {
|
|
|
let _this = this;
|
|
|
|
|
|
$.ajax({
|
|
|
method: 'POST',
|
|
|
url: '/me/del-favdel',
|
...
|
...
|
@@ -141,21 +137,21 @@ |
|
|
favId: id,
|
|
|
type: 'product'
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
}).then(data => {
|
|
|
if (data.code === 200) {
|
|
|
_this.productData.splice(index, 1);
|
|
|
_this.hideDelBth();
|
|
|
delete _this.keys[id];
|
|
|
this.productData.splice(index, 1);
|
|
|
this.hideDelBth();
|
|
|
delete this.keys[id];
|
|
|
} else if (data.code === 400) {
|
|
|
tip(data.message);
|
|
|
} else {
|
|
|
tip('刪除收藏失败');
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
}).fail(() => {
|
|
|
tip('网络错误');
|
|
|
});
|
|
|
},
|
|
|
panstart: function(id) {
|
|
|
panstart(id) {
|
|
|
event.preventDefault();
|
|
|
if (this.editmodel && this.pandata.id !== id) {
|
|
|
return false;
|
...
|
...
|
@@ -173,7 +169,7 @@ |
|
|
this.pandata.id = id;
|
|
|
}
|
|
|
},
|
|
|
panmove: function(id) {
|
|
|
panmove(id) {
|
|
|
event.preventDefault();
|
|
|
if (this.editmodel && this.pandata.id !== id) {
|
|
|
return false;
|
...
|
...
|
@@ -200,7 +196,7 @@ |
|
|
li.css('transform', 'translateX(' + this.currentX + 'px)');
|
|
|
}
|
|
|
},
|
|
|
panend: function(id) {
|
|
|
panend(id) {
|
|
|
event.preventDefault();
|
|
|
if (this.editmodel && this.pandata.id !== id) {
|
|
|
return false;
|
...
|
...
|
@@ -223,17 +219,15 @@ |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
created: function() {
|
|
|
let _this = this;
|
|
|
|
|
|
yoho.addNativeMethod('editModel', function() {
|
|
|
_this.hideDelBth();
|
|
|
_this.editmodel = !_this.editmodel;
|
|
|
created() {
|
|
|
yoho.addNativeMethod('editModel', () => {
|
|
|
this.hideDelBth();
|
|
|
this.editmodel = !this.editmodel;
|
|
|
|
|
|
let header = interceptClick.titleMap[5];
|
|
|
|
|
|
header.defaultSelectedIndex = '0';
|
|
|
header.right.des = _this.editmodel ? '完成' : '编辑';
|
|
|
header.right.des = this.editmodel ? '完成' : '编辑';
|
|
|
return yoho.goPageView({
|
|
|
header: header
|
|
|
});
|
...
|
...
|
|