Commit f6a05cc3 by 高淑倩

add:集点详情_授权

parent bac1b1b1
const app = getApp()
const wxService = require('../../utils/wxService')
const utils = require('../../utils/util')
const envInfo = require('../../config/index').envInfo
Component({
/**
* 组件的属性列表
*/
properties: {
isAuthorization: Boolean,
isAuthorizationActiveText: {
type: String,
value: ''
},
isAuthorizationType: {
type: Number,
value: 2
}
},
observers: {
},
/**
* 组件的初始数据
*/
data: {
couponNum: '2',
userInfo: {},
hasUserInfo: false,
env: envInfo.env,
checkAll: true
},
/**
* 组件的方法列表
*/
methods: {
checkAll() {
this.setData({
checkAll: !this.data.checkAll
})
},
handelToMemberRules() {
wxService.router(`/pages/memberRules/memberRules?type=${this.data.isAuthorizationType}`)
},
//再想想
close() {
this.setData({
isAuthorization: false
})
},
//立即兑换
query() {},
_getUserInfo(res = {}) {
this.setData({
isAuthorization: false
})
const userInfo = res.detail || {}
if (res.detail.userInfo) {
utils.getUserInfoByBtn(userInfo).then( (data = {} ) => {
const {token} = data
wx.setStorageSync('_accreditUserInfo', userInfo)
wx.hideNavigationBarLoading()
if (token) {
wx.setStorageSync('token', token)
} else {
wx.setStorageSync('token', '')
}
wx.setStorageSync('_baseUserInfo', data)
// 存储用户开卡状态
// wx.setStorageSync('memberActivateStatus', data.memberActivateStatus)
this.setUserInfo()
}).catch(err=> {
if (err) {
wx.showToast({
title: `会员系统异常请稍后重试!`,
icon: 'none'
})
}
})
} else {
this.setData({
isAuthorization: false
})
}
},
handleActiveAgree() {
// 子组件触发父组件 去开卡
wxService.nextTick(() => {
this.triggerEvent('activeTocard', true)
})
this.setData({
isAuthorization: false
})
},
setUserInfo () {
// 判断有无开卡
// const {memberActivateStatus} = wx.getStorageSync('_baseUserInfo')
const userInfo = wx.getStorageSync('_baseUserInfo')
// 新用户去激活领卡
if (userInfo && userInfo.member && !userInfo.member.mobile) {
wxService.openCard()
return false
}
// 没有开卡并且需要开卡
// if(!memberActivateStatus) {
// wxService.openCard()
// return false
// }
// 跳转
const urls = getCurrentPages()
setTimeout(() => {
const item = urls[0]
if (item.route) {
try {
const options = item.options
wxService.router(`/${item.route}`).search(options).replace()
} catch (e) {
wx.showToast({
title: `会员系统异常请稍后重试!`,
icon: 'none'
})
}
} else {
wx.showToast({
title: `会员系统异常请稍后重试!`,
icon: 'none'
})
}
}, 200)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="modal" wx:if='{{isAuthorization}}'>
<view class="modal-mask"></view>
<view class="modal-container" style="top:{{isAuthorizationActiveText ? '12%' : '26%' }};">
<view class='auth-avatar'>
<image class='auth-avatar-img' src='/assets/imgs/auth-avatar.png'></image>
</view>
<view class='auth-shop' wx:if="{{isAuthorizationActiveText}}">
<view class="auto-old"><span class="auto-old-num">1. </span>老会员无需领取新会员卡,即可在会员小程序享受全部会员权益。</view>
<view class="auto-old"><span class="auto-old-num">2. </span>若在领取新会员卡过程中输入新手机号,会造成原会员及积分信息的更替。</view>
<view class="auto-old"><span class="auto-old-num">3. </span>领取后的新会员卡,将存放在"微信-卡包"。</view>
</view>
<view class='auth-shop' wx:else>广东7-Eleven申请获取授权,用于会员服务</view>
<button type='primary' wx:if="{{!isAuthorizationActiveText}}" bindgetuserinfo="_getUserInfo" open-type='getUserInfo' class='agree' disabled='{{!checkAll}}'>同意</button>
<button type='primary' wx:else class='agree' disabled='{{!checkAll}}' bindtap="handleActiveAgree">同意并领取新会员卡</button>
<view class='rule-wrap'>
<view class='agree-rule'>
<view wx:if="{{!isAuthorizationActiveText}}" class="agree-icon"><icon size="18" type="{{checkAll ? 'success' : 'circle'}}" bindtap="checkAll"></icon></view>
<view wx:if="{{!isAuthorizationActiveText}}"><text>我已阅读并同意</text><text class='rule-text' bindtap="handelToMemberRules">《会员规则》</text></view>
<!-- <view wx:else><text>我已阅读并同意</text><text class='rule-text' bindtap="handelToMemberRules">《激活领卡规则》</text></view>-->
</view>
</view>
<view class='close' bindtap='close'>
<image class='close-img' src='/assets/imgs/close.png'></image>
</view>
</view>
</view>
\ No newline at end of file
/* component/authorization-modal/authorization-modal.wxss */
.modal {
position: absolute;
right: 0;
left: 0;
bottom: 0;
top: 0;
background-color: transparent;
}
.auto-old {
display: flex;
padding-bottom: 10rpx;
}
.auto-old-num {
display: inline-block;
width: 60rpx;
}
.modal-mask {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.6);
opacity: 1;
z-index: 3;
}
.modal-container {
position: fixed;
left: 96rpx;
/* top: 262rpx; */
/* top: 18%; */
background-color: #fff;
width: 570rpx;
min-height: 450rpx;
z-index: 4;
border-radius: 20rpx;
}
.auth-avatar{
width: 126rpx;
height: 126rpx;
/* margin: 120rpx auto 92rpx; */
margin: 60rpx auto 60rpx;
}
.auth-avatar-img{
width: 126rpx;
height: 126rpx;
}
.auth-shop{
width: 400rpx;
margin: 0 auto;
font-size: 30rpx;
color: #333333;
}
.agree{
width: 416rpx;
height: 88rpx;
line-height: 88rpx;
font-size: 30rpx;
background-color: #05c35b !important;
margin: 50rpx auto 32rpx;
}
.agree-rule{
font-size: 22rpx;
color: #666666;
display: flex;
padding-bottom: 50rpx;
}
.agree-icon{
margin-right: 10rpx;
}
.rule-text{
color: #05c35b;
}
.rule-wrap{
margin-left: 76rpx;
}
.close-img{
width: 58rpx;
height: 58rpx;
position: absolute;
bottom: -120rpx;
left: 265rpx;
}
......@@ -36,6 +36,7 @@ wxService.page({
showGetBtn: true, // 默认展示 未达成按钮
currentStatus: 2, // 活动状态 1 未生效 2 生效中 3 已失效 0 已删除
currentTimeStatus: 1, // 1 进行中 2 已结束 3 未开始
isAuthorization: false,
},
/**
* 生命周期函数--监听页面加载
......@@ -235,16 +236,46 @@ wxService.page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
// 登录接口返回err
const reLoginErrFlag = wx.getStorageSync('reLoginErr')
const baseUserInfo = wx.getStorageSync('_baseUserInfo')
const { id } = this.options
if (id) {
if (baseUserInfo && !reLoginErrFlag){
this.setData({
id
}, () => {
this.getPointDetail(id)
isAuthorization: false
},()=>{
if (id) {
this.setData({
id
}, () => {
this.getPointDetail(id)
})
}
// 隐藏 dialog
this.isShowDialog(false)
})
}
else if(!baseUserInfo && reLoginErrFlag){
this.setData({
isAuthorization: true
})
}
else {
this.setData({
isAuthorization: true
})
}
// 隐藏 dialog
this.isShowDialog(false)
// if (id) {
// this.setData({
// id
// }, () => {
// this.getPointDetail(id)
// })
// }
// // 隐藏 dialog
// this.isShowDialog(false)
},
/**
......
......@@ -4,6 +4,7 @@
"status-img": "/component/statusPoint/statusPoint",
"x-dialog":"/component/dialog/dialog",
"x-progress-point":"/component/progressPoint/progressPoint",
"x-progress-image":"/component/progressImage/progressImage"
"x-progress-image":"/component/progressImage/progressImage",
"authorization-modal-point": "/component/authorization-modal-point/authorization-modal-point"
}
}
\ No newline at end of file
......@@ -59,3 +59,4 @@
show="{{dialog.show}}"
/>
<authorization-modal-point isAuthorization='{{isAuthorization}}'/>
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