Commit 92efc710 by 谢中龙

集点优化

parent 4f1b830f
...@@ -56,9 +56,7 @@ Component({ ...@@ -56,9 +56,7 @@ Component({
//图片的点击 //图片的点击
onTapPic(){ onTapPic(){
this.triggerEvent('dialogTap',this.data.params); this.triggerEvent('dialogTap',this.data.params);
this.setData({
showDialog :false
});
} }
} }
}) })
const PROJECT_ENV = 'test' // 生产 prod, 开发1 dev,开发2 dev2, 测试 test, 预生产 pre const PROJECT_ENV = 'prod' // 生产 prod, 开发1 dev,开发2 dev2, 测试 test, 预生产 pre
const needMock = '' // const needMock = '' //
const brandId = 1002 ; //1002 测试 2711 生产 const brandId = 2711 ; //1002 测试 2711 生产
// appid_dev_wx wxc3b64b09b1d3dfc2 // appid_dev_wx wxc3b64b09b1d3dfc2
// appid_test_wx wxac09792264c49b5c // appid_test_wx wxac09792264c49b5c
// appid_pre_711 wx358b56af62edbde1 // appid_pre_711 wx358b56af62edbde1
......
...@@ -41,13 +41,14 @@ wxService.page({ ...@@ -41,13 +41,14 @@ wxService.page({
isAuthorization: false, isAuthorization: false,
donateImgUrl : '', donateImgUrl : '',
showDonateImgUrl : false, showDonateImgUrl : false,
showTempalteModal : true, showTempalteModal : false,
userHasBaseInfo : false, userHasBaseInfo : false,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
console.log(options)
}, },
// //
watch: { watch: {
...@@ -60,8 +61,7 @@ wxService.page({ ...@@ -60,8 +61,7 @@ wxService.page({
this.setData({ this.setData({
isAuthorization: false isAuthorization: false
}, () => { }, () => {
const option = this.options || {} const option = this.options || {};
const { scene } = option const { scene } = option
if (scene) { if (scene) {
let idParam = decodeURIComponent(scene).split('&')[0] let idParam = decodeURIComponent(scene).split('&')[0]
...@@ -118,6 +118,7 @@ wxService.page({ ...@@ -118,6 +118,7 @@ wxService.page({
this.setData({ this.setData({
showTempalteModal : false showTempalteModal : false
}); });
let activityId = this.data.id;
//查询订阅模板 //查询订阅模板
let baseUserInfo = wx.getStorageSync('_baseUserInfo'); let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`${'/merchant/message/wxSubMsgMapping/getListByParams'}`, { wxService.post(`${'/merchant/message/wxSubMsgMapping/getListByParams'}`, {
...@@ -140,7 +141,7 @@ wxService.page({ ...@@ -140,7 +141,7 @@ wxService.page({
success: (res) => { success: (res) => {
for (let i = 0; i < tempArr.length; i++) { for (let i = 0; i < tempArr.length; i++) {
let tempPromise = wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, { let tempPromise = wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, {
businessId: tradeId, businessId: activityId,
memberId: baseUserInfo.memberId, memberId: baseUserInfo.memberId,
scenarioId: tempArr[i].scenarioId, scenarioId: tempArr[i].scenarioId,
templateId: tempArr[i].templateId templateId: tempArr[i].templateId
...@@ -168,8 +169,20 @@ wxService.page({ ...@@ -168,8 +169,20 @@ wxService.page({
if (res) { if (res) {
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading();
let dialog = this.data.dialog
const baseUserInfo = wx.getStorageSync('_baseUserInfo');
if(baseUserInfo){
let isUat = data.isUat;
if(isUat == 'y'){
let isTrial = baseUserInfo.member.trial ? baseUserInfo.member.trial : false;
if(!isTrial){
wxService.router(`/subPackage/page/pages/goToHome/goToHome`);
}
}
}
let dialog = data.dialog
dialog.show = false dialog.show = false
// 弹框背景 // 弹框背景
dialog.image = data.popupImage dialog.image = data.popupImage
...@@ -223,7 +236,9 @@ wxService.page({ ...@@ -223,7 +236,9 @@ wxService.page({
}) })
} }
} }
}) });
this.showOrHideTemplateModal(id);
}, },
//获取用户扫码进来是否需要弹出领取集点的 //获取用户扫码进来是否需要弹出领取集点的
getUserShowRewardCollectionPoint(id){ getUserShowRewardCollectionPoint(id){
...@@ -254,10 +269,34 @@ wxService.page({ ...@@ -254,10 +269,34 @@ wxService.page({
//图片的点击事件 //图片的点击事件
onDialogTap(e){ onDialogTap(e){
//这里先去判断用户是否开卡
const { member } = wx.getStorageSync('_baseUserInfo');
if(!member){
wx.showToast({
title: '请先去登录',
icon : 'none'
})
return ;
}
//判断是否开卡
if(!member.cardNoWeixin){
wx.showToast({
title: '请先开卡后购买',
icon : 'none'
});
wxService.openCard()
return ;
}
this.setData({
showDonateImgUrl :false
});
this.userConfirmGetCollectionPoint(this.data.id); this.userConfirmGetCollectionPoint(this.data.id);
}, },
//
//调用领取接口 //调用领取接口
userConfirmGetCollectionPoint(id){ userConfirmGetCollectionPoint(id){
wxService.post(`/sale/touchpoints/pointConsumptionActivity/award?id=${id}`).then(res => { wxService.post(`/sale/touchpoints/pointConsumptionActivity/award?id=${id}`).then(res => {
...@@ -327,6 +366,7 @@ wxService.page({ ...@@ -327,6 +366,7 @@ wxService.page({
} }
}) })
}, },
handleCheckGoods() { handleCheckGoods() {
const { activityId } = this.data const { activityId } = this.data
wxService.router(`/subPackage/page/pages/pointGoodsList/pointGoodsList`).search({ activityId }) wxService.router(`/subPackage/page/pages/pointGoodsList/pointGoodsList`).search({ activityId })
...@@ -405,10 +445,76 @@ wxService.page({ ...@@ -405,10 +445,76 @@ wxService.page({
}, },
////授权订阅消息的弹出框一天弹出一次
showOrHideTemplateModal(activityId){
if(this.todayHasGot(activityId)){
return ;
}
else{
this.setData({
showTempalteModal : true
});
this.setLocalStorageByKey(activityId);
}
},
//设置每天只能领取一次限制
setLocalStorageByKey(activityId){
let getCouponData = wx.getStorageSync('userHasSubActivity');
let key = `${activityId}_d_${this.getCurrentYearMonDay()}`;
if(!getCouponData){
getCouponData = {};
getCouponData[key] = true;
wx.setStorageSync('userHasSubActivity',getCouponData);
}
else{
//先设置进去
getCouponData[key] = true;
//获取今天的当前也的key
let expiredAllKey = [];
for(let k in getCouponData){
let expiredKey = k.split('_d_')[1];
if(parseInt(expiredKey) < parseInt(this.getCurrentYearMonDay())){
expiredAllKey.push(k);
}
}
//移除今天一起的过期key
expiredAllKey.forEach(item => {
delete getCouponData[item];
});
wx.setStorageSync('userHasSubActivity',getCouponData);
}
},
//是否已经领取了
todayHasGot(activityId){
let getCouponData = wx.getStorageSync('userHasSubActivity');
let key = `${activityId}_d_${this.getCurrentYearMonDay()}`;
if(!getCouponData){
return false;
}
if(getCouponData[key]){
return true
}
return false;
},
//获取当前年月日
getCurrentYearMonDay(){
let da = new Date();
return `${da.getFullYear()}${da.getMonth()}${da.getDate()}`;
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
}, },
/** /**
......
...@@ -156,8 +156,38 @@ wxService.page({ ...@@ -156,8 +156,38 @@ wxService.page({
}) })
}, },
handleDetail(e) { handleDetail(e) {
const { id } = e.currentTarget.dataset const { id ,item} = e.currentTarget.dataset;
wxService.router(`/pages/pointDetail/pointDetail`).search({ id }) const baseUserInfo = wx.getStorageSync('_baseUserInfo');
if(!baseUserInfo){
wx.showToast({
title: '请先登录',
icon : 'none'
});
return ;
}
let isUat = item.isUat;
if(isUat != 'y'){
wxService.router(`/pages/pointDetail/pointDetail`).search({ id })
}
else{
let isTrial = baseUserInfo.member.trial ? baseUserInfo.member.trial : false;
if(isTrial){
wxService.router(`/pages/pointDetail/pointDetail`).search({ id })
}
else{
wxService.router(`/subPackage/page/pages/goToHome/goToHome`);
}
}
},
//根据用户id获取用户信息
getUserInfo(){
const baseUserInfo = wx.getStorageSync('_baseUserInfo');
if(baseUserInfo){
let memberId = baseUserInfo.memberId;
}
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</view> </view>
<view class="point-list border_box" wx:if="{{pointList.length}}"> <view class="point-list border_box" wx:if="{{pointList.length}}">
<block wx:for="{{pointList}}" wx:key="item"> <block wx:for="{{pointList}}" wx:key="item">
<view class="point border_box" data-id="{{item.id}}" bindtap="handleDetail"> <view class="point border_box" data-id="{{item.id}}" data-item="{{item}}" bindtap="handleDetail">
<status-img img="{{item.listImage}}" currentStatus="{{currentStatus}}" currentTimeStatus="{{currentTimeStatus}}"-/> <status-img img="{{item.listImage}}" currentStatus="{{currentStatus}}" currentTimeStatus="{{currentTimeStatus}}"-/>
<view class="progress weui-flex df-j--bt"> <view class="progress weui-flex df-j--bt">
<view class="rate">进度: <view class="rate">进度:
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.8.2", "libVersion": "2.8.2",
"appid": "wxac09792264c49b5c", "appid": "wx700028bf32a3be66",
"projectname": "7-11", "projectname": "7-11",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
"id": 15, "id": 15,
"name": "集点详情", "name": "集点详情",
"pathName": "pages/pointDetail/pointDetail", "pathName": "pages/pointDetail/pointDetail",
"query": "id=711941259182346240", "query": "scene=i%3DdYP6rbn100",
"scene": null "scene": null
}, },
{ {
......
...@@ -493,6 +493,7 @@ class WXService extends Http { ...@@ -493,6 +493,7 @@ class WXService extends Http {
const page = this const page = this
_self.initAppGlobalDataSync() _self.initAppGlobalDataSync()
watch.setWatcher(page); watch.setWatcher(page);
console.log(args)
//处理触点信息数据 //处理触点信息数据
//修改参数 //修改参数
let pageIsFromShare = false, id = null; let pageIsFromShare = false, id = null;
......
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