Files
lucky_shop/pages_tool/member/public/js/collection.js
ZF sun 4ae21c5d7a refactor: 完成多语言国际化全量替换与补充
1. 新增大量中英文语言包文件,覆盖自定义组件、页面、工具类的文案
2. 替换硬编码文本为多语言调用,统一全局文案管理
3. 优化语言包结构,拆分公共模块与业务模块
4. 修复部分语言加载与国际化适配问题
2026-06-26 17:32:35 +08:00

81 lines
2.0 KiB
JavaScript

export default {
data() {
return {
collectionList: [],
isShowEmpty: false
};
},
methods: {
//跳转至详情页
toDetail(e) {
this.$util.redirectTo("/pages_goods/detail", {
goods_id: e.goods_id
});
},
//请求数据
getData(mescroll) {
this.isShowEmpty = false;
let url = "/api/goodscollect/page"
let array = []
this.$api.sendRequest({
url: url,
data: {
page_size: mescroll.size,
page: mescroll.num,
},
async: false,
}).then((res) => {
let newArr = res.data?.list || [];
for (var i = 0; i < newArr.length; i++) {
newArr[i].composite_score = Math.floor((parseFloat(newArr[i].shop_desccredit) + parseFloat(newArr[i].shop_servicecredit) + parseFloat(newArr[i].shop_deliverycredit)) / 3).toFixed(1);
}
array = array.concat(newArr);
//设置列表数据
if (mescroll.num == 1) this.collectionList = []; //如果是第一页需手动制空列表
this.collectionList = this.collectionList.concat(newArr); //追加新数据
mescroll.endSuccess(array.length);
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
this.isShowEmpty = true;
})
},
//监听下拉刷新,初始化页面数据
listenRefresh(e) {
this.$refs.goodsRecommend.init();
},
//删除某一项
deleteItem(e) {
this.$api.sendRequest({
url: "/api/goodscollect/delete",
data: {
goods_id: e
},
success: res => {
if (res.code == 0) {
this.$util.showToast({
title: this.$lang('member.collection.deleteSuccess')
})
let array = this.collectionList;
let newArray = array.filter((v) => {
return v.goods_id != e;
})
this.collectionList = newArray;
} else {
this.$util.showToast({
title: res.message
})
}
}
})
},
imageError(index) {
this.collectionList[index].logo = this.$util.getDefaultImage().goods;
this.$forceUpdate();
},
goodsImageError(index) {
this.collectionList[index].sku_image = this.$util.getDefaultImage().goods;
this.$forceUpdate();
}
}
};