Commit 0ae19f61 by 谢中龙

修改超值卡

parent 14153c41
......@@ -115,6 +115,7 @@ wxService.page({
item.id = item.supValCardId;
item.startTime = item.startTime.substring(0, 10);
item.endTime = item.endTime.substring(0,10);
item.useResidueDays = item.useResidueDays ? item.useResidueDays : 0;
});
this.data.myCardsList = this.data.myCardsList.concat(data);
......
<!--subPackage/page/pages/myValueCard/myValueCard.wxml-->
<view class='my-value-card-list'>
<view class='my-value-card-list' wx:if="{{myCardsList.length > 0}}">
<view class='my-value-card-item'
wx:if="{{myCardsList.length > 0 }}"
wx:for="{{myCardsList}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="*this">
<!-- 失效的时候 -->
<view class='invalide' wx:if="{{item.useResidueDays <= 0}}">
<view class='status-bar'>
<view class='card-status'>已过期</view>
</view>
</view>
<view class='card-top-info' bindtap='onTapShowMoreInfo' data-item="{{item}}" data-index="{{idx}}">
<image class='bg-image {{item.isOpen ? "expand" : "unexpand"}}'
src='{{item.backGroundUrl}}'
mode='widthFix'></image>
mode='widthFix'></image>
<!-- 过期时间展示 -->
<!-- <view class='top-left-days'><label>剩{{item.leftTimes}}天</label></view> -->
<view class='card-top-info-desc'>
<label>剩{{item.leftTimes}}次</label>
<text wx:if="{{item.useResidueDays <= 0}}"></text>
<label wx:if="{{item.useResidueDays > 0}}">剩{{item.leftTimes}}次,{{item.useResidueDays}}天过期</label>
<image class='qrcode' src='/assets/imgs/711_11.png' mode='aspectFit'></image>
</view>
</view>
......@@ -28,7 +36,7 @@
</view>
</view>
<view class='exp-info'>
<label>使用时间:</label>
<label>有效时间:</label>
<text>{{item.startTime}} 至 {{item.endTime}}</text>
</view>
<view class='exp-info'>
......@@ -42,9 +50,9 @@
</view>
</view>
</view>
<view class='empty' wx:if="{{myCardsList.length == 0 }}">您还未购买任何超值卡~</view>
</view>
<!-- 空 -->
<empty text="您还未购买任何超值卡~" wx:if="{{myCardsList.length == 0}}"/>
<view class='no-more' wx:if="{{isNoData}}">-- 我也是有底线滴 --</view>
<!-- 底部购买记录 -->
......
......@@ -21,6 +21,39 @@ view{
width: 100%;
height: auto;
margin-bottom: 20rpx;
position: relative;
}
.my-value-card-list .my-value-card-item .invalide{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
z-index: 1;
}
.my-value-card-list .my-value-card-item .invalide .status-bar{
width: 100%;
height: 80rpx;
margin-top: 30rpx;
display: flex;
justify-content: flex-end;
align-items: center;
}
.my-value-card-list .my-value-card-item .invalide .status-bar .card-status{
width: 110rpx;
height: 50rpx;
background: #ffffff;
border-top-left-radius: 25rpx;
border-bottom-left-radius: 25rpx;
font-size: 24rpx;
color: #666666;
display: flex;
justify-content: center;
align-items: center;
}
.my-value-card-list .my-value-card-item .card-top-info{
......@@ -29,11 +62,38 @@ view{
position: relative;
}
.my-value-card-list .my-value-card-item .card-top-info .top-left-days{
position: absolute;
top: 20rpx;
width: 100%;
height: 70rpx;
padding: 0 30rpx;
display: flex;
justify-content: flex-start;
align-items: center;
}
.my-value-card-list .my-value-card-item .card-top-info .top-left-days label{
height: 50rpx;
width: auto;
padding: 0 30rpx;
border-radius: 25rpx;
background: #ffffff;
color: #333333;
font-weight: bold;
font-size: 24rpx;
display: flex;
align-items: center;
justify-content: center;
}
.my-value-card-list .my-value-card-item .card-top-info .bg-image{
width: 100%;
display: block;
}
.my-value-card-list .my-value-card-item .card-top-info .bg-image.unexpand{
border-radius: 6rpx;
}
......@@ -174,17 +234,9 @@ view{
display: flex;
justify-content: center;
align-items: center;
z-index: 9;
}
.buy-records:active{
opacity: 0.7;
}
.empty{
padding: 30rpx;
padding-top: 80rpx;
display: flex;
align-items: center;
justify-content: center;
color: #999999;
}
\ No newline at end of file
......@@ -59,7 +59,6 @@ class Http {
} else {
reject(data)
}
// complete ? complete.apply(this, arguments) : reject(data)
}
})
})
......@@ -86,7 +85,8 @@ class Http {
url,
method: 'GET',
header: {
'buyer-token': this.getToken()
'buyer-token': this.getToken(),
'tentacle-content': this.getTentacle()
},
data: parmas
})
......@@ -98,6 +98,7 @@ class Http {
// 'tunnel-token': 'aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588feD', // 测试
// 'tunnel-token' : 'd6db651f8b9c7db4176465accfc1c913843fd9ad328cd5f4fe201d918072c9e8', // 生产 3001
'tunnel-token' : '4c8d641cb2b8a576317ee5f6ead1f36474463041d61fb5d4289364565b0c6c63', // 生产 2711
'tentacle-content': this.getTentacle()
},
data: parmas
})
......@@ -113,7 +114,8 @@ class Http {
url,
method: 'POST',
header: {
'buyer-token': this.getToken()
'buyer-token': this.getToken(),
'tentacle-content': this.getTentacle()
},
data: parmas,
channel: channel
......@@ -123,7 +125,9 @@ class Http {
url,
method: 'POST',
header: {
// 'tunnel-token': 'aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588feD', // 测试
'tunnel-token': '4c8d641cb2b8a576317ee5f6ead1f36474463041d61fb5d4289364565b0c6c63', // 生产 2711
'tentacle-content': this.getTentacle()
},
data: parmas,
channel: channel
......@@ -135,7 +139,9 @@ class Http {
url,
method: 'POST',
header: {
// 'tunnel-token': 'aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588feD', // 测试
'tunnel-token': '4c8d641cb2b8a576317ee5f6ead1f36474463041d61fb5d4289364565b0c6c63', // 生产 2711
'tentacle-content': this.getTentacle()
},
data: parmas,
channel: channel
......@@ -213,6 +219,25 @@ class Http {
// }
return wx.getStorageSync('token')
}
getTentacle() {
let time = Date.parse(new Date())
let TIME_EXPIRATION = wx.getStorageSync('TIME_EXPIRATION');
let storage = wx.getStorageSync('TENTACLE_CONTENT'), tentacle = '';
if (storage) {
tentacle = storage.obj;
}
if (tentacle && TIME_EXPIRATION > time) {
wx.setStorageSync('TIME_EXPIRATION', time + 30 * 60 * 1000);
return JSON.stringify(tentacle);
} else {
// wx.removeStorageSync('TENTACLE_CONTENT')
// wx.removeStorageSync('TIME_EXPIRATION')
}
return JSON.stringify(null);
}
}
export default Http
......@@ -51,38 +51,6 @@ class WXService extends Http {
wx.hideLoading()
}).catch(res => {
// 用户未登录
// if (res.msg && res.msg.indexOf('未登录') > -1) {
// // 判断是否登陆过 登陆过 重新登陆 未登陆 跳转首页
// const baseUserInfo = this.getBaseUserInfo()
// if(!baseUserInfo) {
// wxService.router('/pages/userCenter/userCenter').replace()
// return false
// }
// // 条件限制 getUserInfoLimitCount:重试次数
// if (!this.getUserInfoLimitCount) {
// this.getUserInfoLimitCount = 1
// } else {
// this.getUserInfoLimitCount++
// }
// if (this.getUserInfoLimitCount > 3) {
// wx.showToast({
// title: '登录超出重试次数!',
// icon: 'none'
// })
// wxService.router(`/pages/userCenter/userCenter`).replace()
// return false
// } else {
// // 重新登陆 更新缓存
// this.reLogin()
// setTimeout(()=>{
// const pages = getCurrentPages()
// const perpage = pages[pages.length - 1]
// perpage.onShow()
// },2000)
// }
// }
if (res.msg && res.msg.indexOf('未登录') > -1) {
if (!this.getUserInfoLimitCount) {
this.getUserInfoLimitCount = 1
......@@ -411,6 +379,99 @@ class WXService extends Http {
}
}
//生成触点对象Id
getTentacleContent(tentacleInfo) {
return this.post('/marketing/tentacleContent/getTentacleContent', tentacleInfo).then((res) => {
let data = res.data.data
return Promise.resolve(data);
}).finally(() => { })
}
//根据触点对象id获取触点对象信息
getTentacleContentByTentacleId(id) {
this.post('/marketing/tentacleContent/queryTentacleContentById', { id: id }).then((res) => {
let data = res.data.data
if (!data) {
return;
}
let TENTACLE_CONTENT = {
id: data.id,
tentacleType: data.type,
tentacleId: data.tentacleId,
contentType: data.contentType,
contentId: data.contentId
}
let storageObj = {
memberId: '',
obj: TENTACLE_CONTENT
}
//记录触点统计
this.markerTentacleInfo(TENTACLE_CONTENT);
if (data.status == 1) {
var timestamp = Date.parse(new Date())
var expiration = timestamp + 1800000
wx.setStorageSync('TENTACLE_CONTENT', storageObj)
wx.setStorageSync('TIME_EXPIRATION', expiration)
}
else {
wx.removeStorageSync('TENTACLE_CONTENT')
wx.removeStorageSync('TIME_EXPIRATION')
}
}).finally(() => {
})
}
//记录触点信息
markerTentacleInfo(tentacleContent) {
//1 未登录时不调用改接口
//2 半个小时之内如果调用过该接口则忽略
// console.log('触点信息是---', tentacleContent)
let { memberId } = wx.getStorageSync('_baseUserInfo') ? wx.getStorageSync('_baseUserInfo') : {};
if (memberId) {
var currentTimestamp = Date.parse(new Date())
let lastRemarkTime = wx.getStorageSync('lastRemarkTime') ? wx.getStorageSync('lastRemarkTime') : 0;
//如果当前时间大于记录时间 说明半个小时已过
if (currentTimestamp > lastRemarkTime) {
//记录
this.callApiRemarkTentacle(memberId, tentacleContent);
}
else {
//小于半个小时
//看一下当前触点于之前的的是不是一个触点,如果是一个触点 则不调用接口
let lastRemarkTentacle = wx.getStorageSync('lastRemarkTentacle');
if (lastRemarkTentacle) {
// 678273783177551872
if (lastRemarkTentacle.id != tentacleContent.id) {
this.callApiRemarkTentacle(memberId, tentacleContent);
}
}
}
}
}
//调用接口记录触点信息
callApiRemarkTentacle(memberId, tentacleContent) {
wxService.post(`/member/share/inviteFriendsLoginLog/saveBatch`, {
memberId: memberId,
tentacleContent: tentacleContent,
}).then(res => {
if (res) {
if (res.data.result == 0) {
//调用接口成功 开始保存
var currentTimestamp = Date.parse(new Date())
var expiration = currentTimestamp + 1800000;
wx.setStorageSync('lastRemarkTime', expiration);
wx.setStorageSync('lastRemarkTentacle', tentacleContent);
}
}
});
}
page(config) {
const _self = this
const { sr } = this.getApp()
......@@ -430,6 +491,61 @@ class WXService extends Http {
const page = this
_self.initAppGlobalDataSync()
watch.setWatcher(page);
//处理触点信息数据
//修改参数
let pageIsFromShare = false, id = null;
args.forEach(item => {
if (item['t']) {
pageIsFromShare = true;
id = Integer.digit(item['t'], 64, 10);
if (item['i']) {
item['id'] = Integer.digit(item['i'], 64, 10);
}
}
if (item['m']) {
item['memberId'] = Integer.digit(item['m'], 64, 10);
if (item['i']) {
item['id'] = Integer.digit(item['i'], 64, 10);
}
// id = item['memberId'];
}
if (item['scene']) {
pageIsFromShare = true;
let sceneParam = decodeURIComponent(item['scene']);
let tParam = '';
//判断是不是有触点参数
if (sceneParam.indexOf('t=') > -1) {
let tArr = sceneParam.split('&');
for (let i = 0; i < tArr.length; i++) {
if (tArr[i].indexOf('t=') > -1) {
tParam = tArr[i].split('t=')[1];
break;
}
}
}
let idParam = sceneParam.split('&')[0];
let shareId = idParam && idParam.split('=')[1] || 0;
// console.log(shareId)
// console.log(idParam)
//处理pageId的
if (idParam.indexOf('pageId') > -1) {
item['pageId'] = shareId;
}
if (tParam) {
id = Integer.digit(tParam, 64, 10);
}
//
if (shareId && shareId != 0) {
item['id'] = Integer.digit(shareId, 64, 10);
}
}
});
//如果打开的是分享界面则进行触点对象信息请求并存储到本地 放到后续的header中
if (pageIsFromShare && id) {
//调用接口
_self.getTentacleContentByTentacleId(id);
}
config.onLoad && config.onLoad.apply(page, args)
},
onShow: function (...args) {
......
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