This commit is contained in:
2025-10-27 15:55:29 +08:00
commit 6632080b83
513 changed files with 117442 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
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: "删除成功"
})
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();
}
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,115 @@
export default {
methods: {
//获取邀请列表
getList() {
this.$api.sendRequest({
url: '/memberrecommend/api/memberrecommend/lists',
data: {
page: this.page,
page_size: this.page_size
},
success: res => {
this.inviteList = this.inviteList.concat(res.data.list);
this.total_num = res.data.page_count;
}
});
},
moreList() {
this.page++;
this.isClick = false;
if (this.page < this.total_num) {
this.getList();
this.isClick = true;
} else if (this.page == this.total_num) {
this.getList();
}
},
getBaseInfo() {
this.$api.sendRequest({
url: '/memberrecommend/api/memberrecommend/info',
success: res => {
if (res.code == 0) {
this.info = res.data;
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
}
});
},
openSharePopup() {
this.$refs.sharePopup.open();
},
// 关闭分享弹出层
closeSharePopup() {
this.$refs.sharePopup.close();
},
// 打开规则说明弹出层
openRulePopup() {
this.$refs.rulePopup.open();
},
// 打开规则说明弹出层
closeRulePopup() {
this.$refs.rulePopup.close();
},
copyUrl() {
let text = this.$config.h5Domain + '/pages/index/index';
if (this.memberInf && this.memberInfo.member_id) text += '?source_member=' + this.memberInfo.member_id;
this.$util.copy(text, () => {
this.closeSharePopup();
});
},
// 打开海报弹出层
openPosterPopup() {
this.getPoster();
this.$refs.sharePopup.close();
this.$refs.posterPopup.open();
},
// 关闭海报弹出层
closePosterPopup() {
this.$refs.posterPopup.close();
},
//生成海报
getPoster() {
//活动海报信息
let qrcode_param = {
source_member: this.memberInfo.member_id
};
this.$api.sendRequest({
url: "/memberrecommend/api/memberrecommend/poster",
data: {
page: '/pages/index/index',
qrcode_param: JSON.stringify(qrcode_param)
},
success: res => {
if (res.code == 0) {
this.poster = res.data.path + "?time=" + new Date().getTime();
} else {
this.posterMsg = res.message;
}
}
});
},
savePoster() {
let url = this.$util.img(this.poster);
uni.downloadFile({
url: url,
success: (res) => {
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
this.$util.showToast({
title: "保存成功"
});
},
fail: () => {
this.$util.showToast({
title: "保存失败,请稍后重试"
});
}
});
}
}
});
}
}
}

View File

@@ -0,0 +1,276 @@
export default {
data() {
return {
showSignDays: [], // 一共展示的天数
rule: [{}],
hasSign: 0, //今天是否签到
signDaysSeries: 0, //连续签到次数
MonthData: [], //本月日期信息
signList: [],
back: '', //返回页
redirect: '', //返回方式
successTip: {},
startDate: null,
endDate: null,
isActive: "", //判断点击
signState: 1,
headimg: '',
point: 0,
growth: 0,
signPoint: 0,
signGrowth: 0,
rewardRuleDay: [],
cycle: 0,
reward: {}
};
},
onLoad(option) {
setTimeout( () => {
if (!this.addonIsExist.membersignin) {
this.$util.showToast({
title: '商家未开启会员签到',
mask: true,
duration: 2000
});
setTimeout(() => {
this.$util.redirectTo('/pages/index/index');
}, 2000);
}
},1000);
if (option.back) this.back = option.back;
if (option.redirect) this.redirect = option.redirect;
this.getSignState();
},
onShow() {
if (!this.storeToken) {
this.$nextTick(() => {
this.$refs.login.open('/pages_tool/member/signin');
});
return;
}
this.headimg = this.memberInfo.headimg;
this.signDaysSeries = this.memberInfo.sign_days_series;
this.getSignPointData();
this.getSignGrowthData();
this.setPublicShare();
this.getIsSign();
},
methods: {
// 获取签到累积积分
getSignPointData() {
this.$api.sendRequest({
url: '/api/memberaccount/sum',
data: {
account_type: 'point',
from_type: 'signin'
},
success: res => {
if (res.code == 0) {
this.signPoint = res.data;
}
}
});
},
// 获取签到累积成长值
getSignGrowthData() {
this.$api.sendRequest({
url: '/api/memberaccount/sum',
data: {
account_type: 'growth',
from_type: 'signin'
},
success: res => {
if (res.code == 0) {
this.signGrowth = res.data;
}
}
});
},
// 签到是否开启
getSignState() {
this.$api.sendRequest({
url: '/api/membersignin/getSignStatus',
success: res => {
if (res.code == 0) {
this.signState = res.data.is_use;
}
}
});
},
navigateBack() {
if (this.back != '') {
this.$util.redirectTo(this.back, {}, this.redirect);
} else {
this.$util.redirectTo('/pages/member/index');
}
},
//获取rule
getRule() {
this.rewardRuleDay = [];
this.$api.sendRequest({
url: '/api/membersignin/award',
success: res => {
if (res.code == 0) {
this.cycle = res.data.cycle || 0;
this.rule = res.data.reward || [];
let default_point = 0;
if (this.rule.length > 0) {
this.rule.forEach((item, index) => {
if (item.day == 1) {
default_point = item.point;
} else {
this.rewardRuleDay.push(parseInt(item.day));
this.reward[item.day] = item.point;
}
});
}
//展示7天
var showSignDays = [];
var start_day = 1;
var end_day = 7;
var total_day = res.data.cycle;
if (this.signDaysSeries > 5) {
start_day = this.signDaysSeries - 5;
}
if (total_day >= (this.signDaysSeries + 1)) {
end_day = this.signDaysSeries + 1;
}
if (this.signDaysSeries <= 5) {
end_day = 8 - start_day;
}
if ((end_day - start_day) < 7 && total_day >= start_day + 6) {
end_day = start_day + 6;
}
if (total_day == this.signDaysSeries) {
start_day = this.signDaysSeries - 6;
end_day = this.signDaysSeries;
}
for (let i = 1; i <= res.data.cycle; i++) {
if (i >= start_day && i <= end_day) {
showSignDays.push({
day: i,
is_last: 0,
point: default_point
})
}
}
if (showSignDays && showSignDays.length) {
showSignDays[showSignDays.length - 1]['is_last'] = 1;
}
for (let i in showSignDays) {
let item = showSignDays[i];
if (this.$util.inArray(item.day, this.rewardRuleDay) != -1) {
showSignDays[i]['point'] = parseInt(this.reward[item.day]) + parseInt(default_point);
}
}
this.showSignDays = showSignDays;
this.$refs.loadingCover.hide();
}
}
});
},
//判断当前是否签到
getIsSign() {
this.$api.sendRequest({
url: '/api/membersignin/issign',
success: res => {
if (res.code == 0) {
this.hasSign = res.data;
this.getRule();
this.getSignPointData();
this.getSignGrowthData();
}
}
});
},
//签到
sign() {
if (this.signState == 0) {
this.$util.showToast({
title: '签到未开启'
})
}
if (!this.hasSign && this.signState == 1) {
this.$api.sendRequest({
url: '/api/membersignin/signin',
success: res => {
if (res.code == 0) {
this.successTip = res.data;
this.$refs.uniPopup.open()
this.getRule();
this.getSignPointData();
this.getSignGrowthData();
this.hasSign = 1;
this.signDaysSeries = this.signDaysSeries + 1;
} else {
this.$util.showToast({
title: res.message
})
}
}
});
}
},
close() {
this.$refs.uniPopup.close()
},
/**
* 设置公众号分享
*/
setPublicShare() {
let shareUrl = this.$config.h5Domain + '/pages_tool/member/signin';
this.$util.setPublicShare({
title: '签到有礼',
desc: '天天签到,积分好礼送不停',
link: shareUrl,
imgUrl: ''
},
res => {
// console.log('公众号分享成功');
// this.share();
}
);
},
},
computed: {
pointTomorrow: function() {
var signDaysSeries = this.signDaysSeries + 1;
var point = this.rule[0].point ? parseInt(this.rule[0].point) : 0;
for (let i = 1; i < this.rule.length; i++) {
let reward = this.rule[i];
if (reward.day == signDaysSeries && reward.point) point += parseInt(reward.point);
}
return point;
},
showDay: function() {
return parseInt(this.signDaysSeries / 7) * 7 + 1;
}
},
/**
* 自定义分享内容
*/
onShareAppMessage() {
var path = '/pages_tool/member/signin';
return {
title: '签到有礼,天天签到,积分好礼送不停',
imageUrl: '',
path: path,
success: res => {},
fail: res => {},
complete: res => {}
};
}
};