...
|
...
|
@@ -34,8 +34,6 @@ |
|
|
<script>
|
|
|
const $ = require('yoho-jquery');
|
|
|
const tip = require('common/tip');
|
|
|
const modal = require('common/modal');
|
|
|
const loading = require('common/loading');
|
|
|
|
|
|
module.exports = {
|
|
|
props: ['productUrl'],
|
...
|
...
|
@@ -81,26 +79,23 @@ |
|
|
},
|
|
|
delItem(index, id) {
|
|
|
let _this = this;
|
|
|
$.modal.confirm('', '确定刪除该收藏吗?', function() {
|
|
|
this.hide();
|
|
|
$.ajax({
|
|
|
method: 'post',
|
|
|
url: '/home/favorite/favdel',
|
|
|
data: {
|
|
|
favId: id,
|
|
|
type: 'product'
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
_this.productData.splice(index, 1);
|
|
|
} else if (data.code === 400) {
|
|
|
$.modal.alert(data.message, '出错了!');
|
|
|
} else {
|
|
|
$.modal.alert('', '刪除收藏失败');
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
$.modal.alert('', '网络错误');
|
|
|
});
|
|
|
$.ajax({
|
|
|
method: 'post',
|
|
|
url: '/home/favorite/favdel',
|
|
|
data: {
|
|
|
favId: id,
|
|
|
type: 'product'
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
_this.productData.splice(index, 1);
|
|
|
} else if (data.code === 400) {
|
|
|
tip(data.message);
|
|
|
} else {
|
|
|
tip('刪除收藏失败');
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
tip('网络错误');
|
|
|
});
|
|
|
}
|
|
|
}
|
...
|
...
|
|