商品足迹,增加收藏

master
gongfuxiang 2024-10-12 08:46:50 +08:00
parent 64f5ad5a36
commit d3bfa59699
4 changed files with 81 additions and 52 deletions

View File

@ -1579,6 +1579,7 @@
"3v6ulk": "After choosing for so long, do you really want to delete it?",
"8q2yej": "Please slide the data you want to operate on first",
"9g81jk": "Data does not exist",
"8tt78i": "Add to Favorites",
"87rfg3": "Cancel collection",
"346c25": "Collection successful",
"21051p": "Collection failed",

View File

@ -1571,6 +1571,7 @@
"3v6ulk": "挑了这么久,真的要删除吗?",
"8q2yej": "请先滑动要操作的数据",
"9g81jk": "数据不存在",
"8tt78i": "加入收藏",
"87rfg3": "取消收藏",
"346c25": "收藏成功",
"21051p": "收藏失败",

View File

@ -267,11 +267,7 @@
}
app.globalData.showToast(res.data.msg, 'success');
} else {
if (app.globalData.is_login_check(res.data)) {
app.globalData.showToast(res.data.msg);
} else {
app.globalData.showToast(self.$t('common.sub_error_retry_tips'));
}
app.globalData.showToast(res.data.msg);
}
},
fail: () => {

View File

@ -16,7 +16,7 @@
</view>
</view>
</view>
<view class="dis-inline-block pa top-xxxxl right-xxxxl" @tap="delete_event" :data-value="item.id" :data-index="index">
<view class="dis-inline-block pa top-xxxxl right-xxxxl" @tap="item_event" :data-value="item.id" :data-index="index">
<iconfont name="icon-ellipsis" size="40rpx" color="#999"></iconfont>
</view>
<view v-if="(item.is_error || 0) == 0" class="dis-inline-block pa right-xxxxl bottom-xxxxl" :data-index="index" @tap.stop="goods_cart_event">
@ -231,57 +231,88 @@
this.get_data_list();
},
//
delete_event(e) {
//
item_event(e) {
var self = this;
wx.showActionSheet({
itemList: [self.$t('common.del_record')],
success (res) {
//
var id = e.currentTarget.dataset.value;
var index = e.currentTarget.dataset.index;
// loding
uni.showLoading({
title: self.$t('common.processing_in_text')
});
uni.request({
url: app.globalData.get_request_url("delete", "usergoodsbrowse"),
method: 'POST',
data: {
ids: id
},
dataType: 'json',
success: res => {
uni.hideLoading();
if (res.data.code == 0) {
var temp_data_list = self.data_list;
temp_data_list.splice(index, 1);
self.setData({
data_list: temp_data_list
});
if (temp_data_list.length == 0) {
self.setData({
data_list_loding_status: 0,
data_bottom_line_status: false
});
}
app.globalData.showToast(res.data.msg, 'success');
} else {
if (app.globalData.is_login_check(res.data)) {
app.globalData.showToast(res.data.msg);
} else {
app.globalData.showToast(self.$t('common.sub_error_retry_tips'));
}
}
},
fail: () => {
uni.hideLoading();
app.globalData.showToast(self.$t('common.internet_error_tips'));
}
});
itemList: [self.$t('cart.cart.8tt78i'), self.$t('common.del_record')],
success (res) {
var id = e.currentTarget.dataset.value;
var index = e.currentTarget.dataset.index;
if(res.tapIndex == 0) {
self.goods_favor_handle(self, id, index);
} else {
self.goods_delete_handle(self, id, index);
}
}
});
},
//
goods_delete_handle(self, id, index, success_msg = null) {
uni.showLoading({
title: self.$t('common.processing_in_text')
});
uni.request({
url: app.globalData.get_request_url("delete", "usergoodsbrowse"),
method: 'POST',
data: {
ids: id
},
dataType: 'json',
success: res => {
uni.hideLoading();
if (res.data.code == 0) {
var temp_data_list = self.data_list;
temp_data_list.splice(index, 1);
self.setData({
data_list: temp_data_list
});
if (temp_data_list.length == 0) {
self.setData({
data_list_loding_status: 0,
data_bottom_line_status: false
});
}
app.globalData.showToast(success_msg || res.data.msg, 'success');
} else {
app.globalData.showToast(res.data.msg);
}
},
fail: () => {
uni.hideLoading();
app.globalData.showToast(self.$t('common.internet_error_tips'));
}
});
},
//
goods_favor_handle(self, id, index) {
uni.showLoading({
title: self.$t('common.processing_in_text'),
});
uni.request({
url: app.globalData.get_request_url('favor', 'goods'),
method: 'POST',
data: {
id: self.data_list[index]['goods_id'],
is_mandatory_favor: 1
},
dataType: 'json',
success: (res) => {
uni.hideLoading();
if (res.data.code == 0) {
self.goods_delete_handle(self, id, index, res.data.msg);
} else {
app.globalData.showToast(res.data.msg);
}
},
fail: () => {
uni.hideLoading();
app.globalData.showToast(self.$t('common.internet_error_tips'));
},
});
},
//
goods_cart_event(e) {