Commit 1a545d53 by 谢中龙

修改bug

parent 53686f54
......@@ -150,7 +150,94 @@ Component({
},
//预览
preview(event) {
utilLink.currentLinkRouter(event, this)
}
let ret = utilLink.currentLinkRouter(event, this);
if(ret && typeof ret === 'object'){
if(ret.type == 11){
this.hanlderOrderActivity(ret);
}
}
},
//处理活动预约
hanlderOrderActivity(info){
//判断用户是否已经预约过此活动
this.userHasOrderedActivity(info.id,info);
},
//判断活动是否已经预约过
userHasOrderedActivity(id,info){
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`/merchant/message/wxSubMsgSubscride/getByParams`,{
memberId : baseUserInfo.memberId,
businessId : id
}).then(res => {
if(res){
let data = res.data.data ? res.data.data : [];
if(data.length == 0){
//未预约
if(info.templateId){
this.getOrderActivityInfo(info.templateId,info);
}
}
else{
wx.showModal({
title : '预约成功',
showCancel: false,
confirmText : '确定',
content : '您已订阅消息通知~',
confirmColor : app.globalData.themeColor,
success(){},
})
}
}
})
},
//获取预约活动详情
getOrderActivityInfo(id,info){
wxService.get(`/merchant/message/wxTemplateMappingMiniProgram/${id}`).then(res => {
if(res){
let templateObj = res.data.data ? res.data.data : null;
if(templateObj){
let templateId = templateObj.templateId;
wx.requestSubscribeMessage({
tmplIds: [templateId],
success: (reqRes) => {
this.orderActivity(info.id,templateId,info);
},
complete: (reqComp) => {}
})
}
}
});
},
//预约活动
orderActivity(activityId,templateId,info){
let self = this;
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, {
businessId: activityId,
memberId: baseUserInfo.memberId,
templateId : templateId,
}).then(resp => {
wx.showModal({
title : '预约成功',
showCancel: false,
confirmText : '确定',
content : info.prompt,
confirmColor : app.globalData.themeColor,
success(){
self.award(activityId);
},
})
});
},
//发奖接口
award(activityId){
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`/marketing/bookingActivitySet/award`,{
activityId : activityId,
memberId: baseUserInfo.memberId,
type : 0
}).then(res => {});
},
}
})
......@@ -163,6 +163,7 @@ Component({
},
//预约活动
orderActivity(activityId,templateId,info){
let self = this;
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, {
businessId: activityId,
......@@ -175,10 +176,21 @@ Component({
confirmText : '确定',
content : info.prompt,
confirmColor : app.globalData.themeColor,
success(){},
success(){
self.award(activityId);
},
})
});
},
//发奖接口
award(activityId){
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`/marketing/bookingActivitySet/award`,{
activityId : activityId,
memberId: baseUserInfo.memberId,
type : 0
}).then(res => {});
},
//激活开卡
activeTocard(e) {
if (e.detail) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment