Commit 2dcfe552 by 前端

Merge branch 'v3.24.0' into 'master'

上线合并

See merge request !14
2 parents 9002e75b b4afa671
Showing 49 changed files with 1997 additions and 141 deletions
import { preReleaseAppId } from '~/config' import { preReleaseAppId } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease'] const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 2 let index = 4
/** /**
* *
......
...@@ -13,6 +13,7 @@ import strategyApi from './strategy' ...@@ -13,6 +13,7 @@ import strategyApi from './strategy'
import questionnaireApi from './questionnaire' import questionnaireApi from './questionnaire'
import rescueApi from './rescueApi' import rescueApi from './rescueApi'
import sopApi from './sopApi' import sopApi from './sopApi'
import solitaireApi from './solitaire'
module.exports = { module.exports = {
wechatApi, wechatApi,
...@@ -29,5 +30,6 @@ module.exports = { ...@@ -29,5 +30,6 @@ module.exports = {
strategyApi, strategyApi,
questionnaireApi, questionnaireApi,
rescueApi, rescueApi,
solitaireApi,
sopApi sopApi
} }
\ No newline at end of file \ No newline at end of file
...@@ -29,4 +29,13 @@ module.exports = { ...@@ -29,4 +29,13 @@ module.exports = {
...data ...data
}) })
}, },
/**绑定红包 */
bindRedEnvelopeLink(data = {}) {
return api.post({
method: 'marketing.api.self.red.envelope.banding.link',
projectName,
...data
},true)
},
} }
\ No newline at end of file \ No newline at end of file
import api from '../request/http'
const projectName = 'material'
module.exports = {
/**获取接龙抽奖详情 */
getSolitaireDetail(data) {
return api.post({
method: 'marketing.api.activityRedEnvelope.relay.lottery.detail',
projectName,
...data
})
},
/**
* 获取用户接龙信息
*/
getSolitaireUserInfo(data) {
return api.post({
method: 'marketing.api.activityRedEnvelope.relay.lottery.user.info',
projectName,
...data,
}, true)
},
/**
* 分页查询群接龙中奖明细列表
*/
getSolitaireAewardList(data) {
data.pageSize = 99999
data.pageNum = 1
return api.post({
method: 'marketing.api.activityRedEnvelope.relay.lottery.record.page',
projectName,
...data
})
},
/** 提交接龙 */
commitSolitaire(data) {
return api.post({
method: 'marketing.api.activityRedEnvelope.relay.lottery.user.commit',
projectName,
...data
}, true)
},
/**分页获取用户红包中奖记录 */
getRedEnvelopeRecordList(data = {}) {
return api.post({
method: 'marketing.api.activityRedEnvelope.user.winning.goods.record.page',
projectName,
pageSize: 10,
...data
})
},
/**
* 快递到家地址信息配置列表
*/
getDeliveryConfig(data = {}) {
return api.post({
method: 'marketing.api.self.red.envelope.customer.write.config.list',
projectName,
...data
})
},
/**提交地址信息 */
submitDelivery(data) {
return api.post({
method: 'marketing.api.self.red.envelope.customer.write.detail.save',
projectName,
...data
}, true)
},
/**查询红包详情 */
getActivityRedEnvelopeDetail(data = {}) {
return api.post({
method: 'marketing.api.activityRedEnvelope.findOne',
projectName,
...data
})
},
/** 自研红包抽奖记录保存(即抽奖本身) */
saveRedEnvelopeShowRecord(data = {}) {
return api.post({
method: 'marketing.api.self.red.envelope.lottery.draw.record.save',
projectName,
...data
})
},
/** 开奖成功后记录信息 */
recordedPrizeInfo(data = {}) {
return api.post({
method: 'marketing.api.activityRedEnvelope.relay.user.claim',
projectName,
...data
})
},
/**
* 发放关联活动优惠券
*/
getCoupon(data = {}) {
return api.post({
method: 'scrm.api.coupon.activity.user.get',
...data,
receiveWay: 17
})
},
}
\ No newline at end of file \ No newline at end of file
import http from '../request/http' import http from '../request/http'
const { appId } = wx.getAccountInfoSync().miniProgram const {
appId
} = wx.getAccountInfoSync().miniProgram
let loginCount = null, let loginCount = null,
loginCache = null, loginCache = null,
loginTimer = null loginTimer = null
...@@ -93,5 +95,20 @@ class UsersApi { ...@@ -93,5 +95,20 @@ class UsersApi {
...data ...data
}) })
} }
// 解析微信群的opengid
async getOpengid(data) {
const {
code
} = await this.getWxCode()
data.code = code
data.appId = appId
return http.fetch('scrm.api.sso.wechat.convert.analysis.opengid', data)
}
/**opengid转chatId */
async openGIdtoChatId(data) {
data.projectName = 'entmicro'
return http.fetch('entmicro.api.customer.base.chat.opengid.to.chantid', data)
}
} }
export default new UsersApi() export default new UsersApi()
\ No newline at end of file \ No newline at end of file
...@@ -7,7 +7,7 @@ page { ...@@ -7,7 +7,7 @@ page {
color: #282829; color: #282829;
font-size: 28rpx; font-size: 28rpx;
--themeColor: #3772EC; --themeColor: #3772EC;
--btnColor: #EC3C1F; --btnColor: #3772EC;
--borderRadius: 8rpx; --borderRadius: 8rpx;
--margin: 32rpx; --margin: 32rpx;
/* 兼容 IOS<11.2 先constant再env */ /* 兼容 IOS<11.2 先constant再env */
......
...@@ -3,11 +3,13 @@ import orderMixin from './orderMixin' ...@@ -3,11 +3,13 @@ import orderMixin from './orderMixin'
import afterSaleMixin from './afterSaleMixin' import afterSaleMixin from './afterSaleMixin'
import countdownMixin from './countdownMixin' import countdownMixin from './countdownMixin'
import devMixin from './devMixin' import devMixin from './devMixin'
import jumpAuthMixin from './jumpAuthMixin'
module.exports = { module.exports = {
kfMixin, kfMixin,
orderMixin, orderMixin,
afterSaleMixin, afterSaleMixin,
countdownMixin, countdownMixin,
devMixin devMixin,
jumpAuthMixin
} }
module.exports = Behavior({
methods: {
getNickNameAndHeadUrl() {
const redirectUrl = `https://scrm.glsx.com.cn/wy-wx-oauth`,
appid = 'wx1cf40dc91c28a7fd',
wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
wx.p.router.jumpH5(wxUrl)
},
jumpLoading() {
const {
options
} = this
let query = ['isLogin=1'],
params = {
merchantId: options.merchantId || ''
}
Object.keys(options).map(key => {
if (key != 'scene') query.push(`${key}=${options[key]}`)
})
let url = encodeURIComponent(`/${this.route}?${query.join('&')}`)
params.url = url
if (options.scene) params.scene = options.scene
wx.p.router.redirectTo('/pages/loading/loading', params)
},
}
})
\ No newline at end of file \ No newline at end of file
// packageActivity/pages/redEnvelope/index/index.js // packageActivity/pages/redEnvelope/index/index.js
import {
jumpAuthMixin
} from '~/mixins/index'
import {
domain
} from '~/api/env/index'
Page({ Page({
behaviors: [jumpAuthMixin],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
count: 3
}, },
/** /**
...@@ -26,9 +32,176 @@ Page({ ...@@ -26,9 +32,176 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
const {
options
} = this
console.log(options)
if (options.isLogin) this.getRedEnvelopeH5()
else this.jumpLoading() //直接打开时跳转、防止sessionId失效
},
async getRedEnvelopeH5() {
const res = await wx.p.router.intercept()
if (!res) {
const {
userInfo
} = this.data
let {
id,
awardInfoId,
activityId,
businessId,
source,
linkId
} = this.options
if (!activityId) {
activityId = id
this.options.activityId = id
}
if (!userInfo.nickName) return this.getNickNameAndHeadUrl()
try {
const {
sourceType
} = await wx.p.api.solitaireApi.getActivityRedEnvelopeDetail({
id: activityId
})
/**接龙奖品回显 */
if (awardInfoId) this.jumpRedEnvelopeH5({
activityId
}, () => {
this.jump()
})
else {
if (linkId) this.jumpRedEnvelopeH5({
activityId,
linkId,
source
})
else {
const {
code,
data,
errId,
message
} = await wx.p.api.questionnaireApi.bindRedEnvelopeLink({
activityId,
bindingSource: source,
wechatName: userInfo.nickName,
businessId
})
if (code == 0) {
if (data.id && data.link) {
// /**sourceType 0-自研,1-外采 */
if (sourceType == 1) {
this.showRedModel()
this.jumpUrl = data.link
} else this.jumpRedEnvelopeH5({
activityId,
linkId: data.id,
source
})
} else throw {
message,
errId
}
} else throw {
message,
errId
}
}
}
} catch ({
message,
errId
}) {
if (message) wx.showModal({
title: '温馨提示',
content: message,
confirmText: '知道了',
showCancel: false,
confirmColor: '#F13C3D',
success: function (res) {
if (res.confirm) {
if (errId == '202207218' || errId == '202207224') wx.p.router.redirectTo('/packageActivity/pages/redEnvelope/record/record')
else wx.p.router.switchTab('/pages/tab/mine/index') //错误统一跳转至我的
}
}
})
}
}
},
jumpRedEnvelopeH5({
activityId,
linkId,
source
}, callBack) {
const {
awardInfoId,
merchantId,
recordId
} = this.options, {
userInfo: {
accountId,
nickName,
unionId,
openid,
phone
},
userInfo
} = this.data, {
sessionId
} = wx.p.storage.get()
let user = encodeURIComponent(JSON.stringify({
accountId,
nickName,
unionId,
openid,
phone
})),
query = `activityId=${activityId}&merchantId=${merchantId || userInfo.merchantId}&sessionId=${sessionId}&userInfo=${user}`
if (linkId) query += `&linkId=${linkId}`
// 绑定来源 0:权益会员卡;1:调查问卷;2:群接龙
if (source > -1) query += `&source=${source}`
if (recordId) query += `&recordId=${recordId}`
if (awardInfoId) query += `&awardInfoId=${awardInfoId}`
this.linkQuery = query
if (callBack) callBack()
else this.showRedModel()
},
showRedModel() {
this.setData({
show: true
})
this.countDown()
},
countDown() {
let {
count,
isJump
} = this.data
let _this = this
if (count == 0) {
!isJump && this.jump()
if (this.timer) clearTimeout(this.timer)
return
}
this.timer = setTimeout(() => {
_this.setData({
count: count - 1
})
this.countDown()
}, 1e3)
},
jump() {
this.setData({
isJump: true,
show: false,
})
if (this.timer) clearTimeout(this.timer)
/**jumpUrl 外采链接 */
let url = this.jumpUrl ? this.jumpUrl : `${domain}/scrm-wx-red-packet/#/redEnvelope?${this.linkQuery}` //测试、预发布、生产
// url: `${domain}/dj-scrm-wx-work-main-lwk/#/?${this.linkQuery}` //开发环境
wx.p.router.redirectToH5(url)
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
...@@ -55,12 +228,5 @@ Page({ ...@@ -55,12 +228,5 @@ Page({
*/ */
onReachBottom() { onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
} }
}) })
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageActivity/pages/redEnvelope/index/index.wxss */
// 提示
.member-dialog {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 998;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.bg {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
background: rgba(0, 0, 0, .5);
}
.content {
position: relative;
text-align: center;
box-sizing: border-box;
.member-bg {
width: 550rpx;
height: 910rpx;
}
.count-down {
position: absolute;
top: 26rpx;
right: 26rpx;
width: 72rpx;
height: 72rpx;
line-height: 72rpx;
background: #EA4D3A;
border-radius: 36rpx;
font-weight: 600;
font-size: 42rpx;
color: #FFFFFF;
}
.open-btn {
position: absolute;
bottom: 50rpx;
left: 28%;
width: 158rpx;
height: 158rpx;
}
}
}
\ No newline at end of file \ No newline at end of file
<!--packageActivity/pages/redEnvelope/index/index.wxml-->
<text>packageActivity/pages/redEnvelope/index/index.wxml</text>
\ No newline at end of file \ No newline at end of file
<!-- 红包会员弹窗 -->
<block wx:if="{{show}}">
<view class="member-dialog">
<view class="bg" />
<view class="content">
<view class="count-down">{{count}}</view>
<glsx-image class="member-bg" src="equity/bg-red.png"></glsx-image>
<glsx-image bindtap="jump" class="open-btn" src="equity/icon-open.png"></glsx-image>
</view>
</view>
</block>
\ No newline at end of file \ No newline at end of file
// packageActivity/pages/redEnvelope/record/components/DeliveryBox/DeliveryBox.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
deliveryConfig: {
type: Object,
observer: function (n) {
if (!n.awardInfoId) return
const {
awardInfoId,
writeInfoList
} = n,
writeDetailList = [],
list = []
writeInfoList.map(({
describeId,
describeMsg
}) => {
writeDetailList.push({
describeId,
describeMsg,
detail: ''
})
let maxlength = 50,
type = 'text'
if (describeId == 2) {
maxlength = 11
type = 'tel'
}
if (describeId == 3) {
maxlength = 18
type = 'digit'
}
list.push({
describeId,
maxlength,
type,
detail: '',
placeholder: `请输入${describeMsg}`
})
})
this.setData({
list,
params: {
awardInfoId,
writeDetailList
}
})
}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
onChange(e) {
// e.detail 为当前输入的值
const {
index
} = e.currentTarget.dataset
this.setData({
[`list[${index}].detail`]: e.detail
})
},
close() {
this.setData({
show: false
})
this.triggerEvent('close')
},
submit() {
try {
const {
params,
list
} = this.data
list.map(({
detail,
placeholder
}, index) => {
if (detail) params.writeDetailList[index].detail = detail
else throw placeholder
})
this.close()
this.triggerEvent('submit', params)
} catch (error) {
if (error) wx.p.wxApi.showToast(error)
}
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"van-overlay": "@vant/weapp/overlay/index",
"van-field": "@vant/weapp/field/index"
}
}
\ No newline at end of file \ No newline at end of file
/* packageActivity/pages/redEnvelope/record/components/DeliveryBox/DeliveryBox.wxss */
.delivery-box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
display: flex;
align-items: center;
width: 590rpx;
max-height: 800rpx;
background-image: linear-gradient(160deg, #ffc59c 12%, #fff0e6 100%);
box-shadow: 0 0 28rpx 4rpx #fff08ab3;
border-radius: 44rpx;
flex-direction: column;
padding: 64rpx 0 88rpx;
box-sizing: border-box;
.title {
font-weight: 600;
font-size: 40rpx;
color: #863e00;
padding-bottom: 32rpx;
}
.delivery-content {
width: 100%;
box-sizing: border-box;
padding: 0 48rpx;
max-height: 428rpx;
overflow-y: scroll;
.delivery-item {
height: 92rpx;
background: #ffffff;
border-radius: 16rpx;
margin-bottom: 20rpx;
overflow: hidden;
display: flex;
align-items: center;
padding-left: 40rpx;
.icon{
width: 52rpx;
height: 52rpx;
}
}
}
.btn {
margin-top: 52rpx;
width: 312rpx;
height: 80rpx;
background-image: linear-gradient(88deg, #ff444d 16%, #ff5ba8 90%);
border: 2rpx solid #ff7887;
box-shadow: inset 0 4rpx 24rpx 0 #ffffff80;
border-radius: 50rpx;
font-weight: 600;
font-size: 40rpx;
color: #ffffff;
text-align: center;
line-height: 80rpx;
}
.close{
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: -114rpx;
width: 72rpx;
height: 72rpx;
}
}
<van-overlay show="{{ show }}" lock-scroll="{{false}}">
<view class="delivery-box show-view">
<view class="title">填写信息</view>
<view class="delivery-content">
<block wx:for="{{list}}" wx:key="index">
<view class="delivery-item">
<view class="icon">
<glsx-image src="activity/icon-{{item.describeId}}.png"></glsx-image>
</view>
<van-field value="{{item.detail}}" type="{{item.type}}" maxlength="{{item.maxlength}}" placeholder="{{item.placeholder}}" bindchange="onChange" data-index="{{index}}" />
</view>
</block>
</view>
<view class="btn" bindtap="submit">确认提交</view>
<view class="close" bindtap="close">
<glsx-image src="activity/close.png"></glsx-image>
</view>
</view>
</van-overlay>
\ No newline at end of file \ No newline at end of file
...@@ -5,16 +5,109 @@ Page({ ...@@ -5,16 +5,109 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
list: [],
pageNum: 1,
}, },
open(e) {
const {
code
} = e.currentTarget.dataset
this.setData({
showCodeBox: true,
codeNumber: code
})
},
close() {
this.setData({
showCodeBox: false
})
},
/**
* 状态
* 0-待提现;1-提现中;2-提现成功;3-提现失败;(红包状态)
* 4-已到账;5-未到账;(劵状态)
* 6-待核销;7-已核销;8-待发货;9-已发货;(实物)
*
* isAddressFlag 奖品是否已填写收货地址 true:是; false:否;
*/
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.getList()
},
async getList() {
try {
wx.p.wxApi.showLoading()
const {
list,
pageNum
} = this.data, {
list: data,
total
} = await wx.p.api.solitaireApi.getRedEnvelopeRecordList({
pageNum
})
this.setData({
list: [...list, ...data],
flag: true,
total
})
wx.hideLoading()
} catch (error) {
wx.hideLoading()
if (error) wx.p.wxApi.showToast(String(error))
}
},
writeDelivery(e) {
const {
awardInfoId
} = e.currentTarget.dataset
wx.p.api.solitaireApi.getDeliveryConfig({
awardInfoId
}).then(async writeInfoList => {
this.setData({
deliveryConfig: {
writeInfoList,
awardInfoId,
},
showDeliveryBox: true
})
})
},
async submitDelivery({
detail
}) {
try {
wx.p.wxApi.showLoading('提交中...')
const {
code,
message
} = await wx.p.api.solitaireApi.submitDelivery(detail)
wx.hideLoading()
if (code == 0) {
this.setData({
pageNum: 1,
list: [],
deliveryConfig: {},
})
wx.p.wxApi.showToast('提交成功!')
setTimeout(() => {
this.getList()
}, 1.5e3)
} else throw message
} catch (error) {
console.log(error)
wx.hideLoading()
if (error) wx.p.wxApi.showToast(error)
}
},
closeDelivery() {
this.setData({
deliveryConfig: {},
})
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
...@@ -54,7 +147,18 @@ Page({ ...@@ -54,7 +147,18 @@ Page({
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() { onReachBottom() {
let {
pageNum,
total
} = this.data
wx.p.util.onReachBottom({
pageNum,
total
},
() => {
this.getList()
}
)
}, },
/** /**
......
{
"usingComponents": {
"van-overlay": "@vant/weapp/overlay/index",
"delivery-box":"./components/DeliveryBox/DeliveryBox"
},
"navigationBarTitleText": "中奖记录"
}
\ No newline at end of file \ No newline at end of file
/* packageActivity/pages/redEnvelope/record/record.wxss */
page {
background-color: #F6F6F7;
}
.layout {
padding: 20rpx 30rpx;
.item {
height: 190rpx;
background: #FFFFFF;
border-radius: 8rpx;
margin-bottom: 20rpx;
box-sizing: border-box;
position: relative;
font-size: 28rpx;
.status {
position: absolute;
right: 20rpx;
top: 20rpx;
font-weight: 500;
color: #52C41A;
&-0,
&-1,
&-6,
&-8 {
color: #ff9909;
}
&-3,
&-5,
&-7 {
color: #999999;
}
}
.info{
max-width: 380rpx;
}
.icon {
width: 128rpx;
height: 128rpx;
margin: 0 16rpx 0 24rpx;
}
.name {
font-weight: 500;
color: #333333;
line-height: 28rpx;
}
.price {
color: #ec3c1f;
font-size: 34rpx;
font-weight: 500;
display: flex;
align-items: baseline;
line-height: 44rpx;
.unit {
font-size: 24rpx;
}
}
.time {
font-size: 24rpx;
color: #999999;
line-height: 34rpx;
margin-top: 12rpx;
}
.btn {
min-width: 96rpx;
height: 52rpx;
padding: 0 20rpx;
background: #3772EC;
border-radius: 26rpx;
position: absolute;
right: 20rpx;
bottom: 32rpx;
color: #fff;
}
}
}
.code-box {
justify-content: center;
height: 100%;
flex-direction: column;
.content {
width: 590rpx;
height: 482rpx;
background: #FFFFFF;
border-radius: 44rpx;
flex-direction: column;
.title {
font-weight: 600;
font-size: 40rpx;
color: #666666;
padding: 74rpx 0 54rpx;
}
.code {
font-weight: 700;
font-size: 96rpx;
color: #3772EC;
letter-spacing: 20rpx;
}
.tips {
width: 428rpx;
height: 52rpx;
background: #EEEEEE;
border-radius: 26rpx;
font-size: 28rpx;
color: #666666;
margin-top: 12rpx;
}
}
.close {
width: 72rpx;
height: 72rpx;
margin-top: 42rpx;
}
}
.nothing {
font-weight: 500;
font-size: 13px;
color: #999999;
flex-direction: column;
.icon {
width: 422rpx;
height: 380rpx;
margin: 208rpx 0 32rpx;
}
}
\ No newline at end of file \ No newline at end of file
<!--packageActivity/pages/redEnvelope/record/record.wxml-->
<text>packageActivity/pages/redEnvelope/record/record.wxml</text>
\ No newline at end of file \ No newline at end of file
<view class="layout isFullSucreen">
<block wx:if="{{flag}}">
<block wx:if="{{list.length}}">
<block wx:for="{{list}}" wx:key="index">
<view class="item flex">
<view class="status status-{{item.status}}">{{item.statusStr}}</view>
<view class="icon">
<image src="{{item.prizeLogo}}" />
</view>
<view class="info">
<view class="name">{{item.prizeName}}</view>
<block wx:if="{{item.prizeType == 0}}">
<view class="price">
<view class="unit">¥</view>
{{item.amount}}
</view>
</block>
<view class="time">{{item.winTime}}</view>
</view>
<block wx:if="{{item.prizeType == 1 && item.status == 6}}">
<view class="btn text-center" data-code="{{item.code}}" bindtap="open">查看</view>
</block>
<block wx:if="{{item.exchangeType == 0 && item.status == 8 && !item.isAddressFlag}}">
<view class="btn text-center" data-award-info-id="{{item.awardInfoId}}" bindtap="writeDelivery">去填写</view>
</block>
</view>
</block>
<block wx:if="{{nothing}}">
<view class="list-nothing ">到底啦!!</view>
</block>
</block>
<block wx:else>
<view class="nothing flex">
<view class="icon">
<glsx-image src="activity/nothing.png"></glsx-image>
</view>
暂无中奖记录
</view>
</block>
</block>
</view>
<van-overlay show="{{ showCodeBox }}">
<view class="code-box flex">
<view class="content flex">
<view class="title">核销码</view>
<view class="code">{{codeNumber}}</view>
<view class="tips text-center">核销码用于到店核销领取奖品</view>
</view>
<view class="close" bindtap="close">
<glsx-image src="activity/close.png"></glsx-image>
</view>
</view>
</van-overlay>
<delivery-box deliveryConfig="{{deliveryConfig}}" model:show="{{showDeliveryBox}}" bindsubmit="submitDelivery" bindclose="closeDelivery"></delivery-box>
\ No newline at end of file \ No newline at end of file
// packageActivity/pages/solitaire/components/Coupon/Coupon.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
item: Object
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
close() {
this.setData({
show: false
})
},
jump() {
const {item } = this.data,
{discountType} = item
if (discountType == 2 || discountType == 4) {
wx.p.router.redirectTo('/packageMall/pages/coupon/coupon', {
userCouponId: id,
useMemberType: 0
})
return
}
// /**线上商品代金券 */
if (discountType == 3) {
wx.p.router.redirectTo('/packageMine/pages/coupon/recommend/recommend', {
couponInfo: item
})
return
}
if (discountType == 8) {
wx.p.router.redirectTo('/packageSaveMoney/pages/detail/detail', {
param:{
brandName:item.brandName,
supplier:'HW'
}
})
return
}
wx.p.router.redirectTo('/packageMine/pages/coupon/detail/detail', {
item
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
}
}
\ No newline at end of file \ No newline at end of file
.box {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 102;
background-color: rgba($color: #000000, $alpha: .5);
.flex {
display: flex;
align-items: center;
}
.content {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 590rpx;
height: 628rpx;
background-image: linear-gradient(149deg, #FFC296 4%, #FFEED0 47%, #FFF0E6 100%);
box-shadow: 0 0 48rpx 4rpx #fff08ab3;
border-radius: 44rpx;
display: flex;
flex-direction: column;
align-items: center;
.icon-title {
position: absolute;
left: 50%;
transform: translateX(-50%);
top: -230rpx;
width: 438rpx;
height: 76rpx;
}
.card {
flex-direction: column;
width: 100%;
.content-icon {
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 228rpx;
height: 228rpx;
top: -120rpx;
}
.name {
font-weight: 600;
font-size: 40rpx;
color: #863e00;
letter-spacing: 0;
width: 95%;
padding: 114rpx 40rpx 8rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.describe {
height: 52rpx;
background: #f6dcaa;
border-radius: 26rpx;
padding: 0 32rpx;
font-size: 28rpx;
color: #985e23;
text-align: center;
}
.price {
font-weight: 700;
font-size: 116rpx;
color: #f32226;
display: flex;
align-items: baseline;
line-height: 134rpx;
.unit {
font-weight: 600;
font-size: 68rpx;
color: #f32226;
}
}
.tips {
font-weight: 600;
font-size: 40rpx;
color: #F32226;
}
.btn {
width: 312rpx;
height: 80rpx;
background-image: linear-gradient(88deg, #FF444D 16%, #FF5BA8 90%);
border: 2rpx solid #FF7887;
box-shadow: inset 0 4rpx 24rpx 0 #ffffff80;
border-radius: 50rpx;
font-weight: 600;
font-size: 40rpx;
color: #FFFFFF;
justify-content: center;
margin: 22rpx 0;
}
.time {
font-size: 28rpx;
color: #8B7E7C;
}
}
}
.close {
width: 72rpx;
height: 72rpx;
position: absolute;
left: 50%;
bottom: -132rpx;
transform: translateX(-50%);
}
}
\ No newline at end of file \ No newline at end of file
<block wx:if="{{show}}">
<view class="box">
<view class="content">
<view class="icon-title">
<glsx-image src="activity/success.png"></glsx-image>
></view>
<view class="card flex">
<view class="content-icon">
<glsx-image src="activity/coupon.png"></glsx-image>
</view>
<view class="name">
恭喜你获得{{item.couponName}}一张
</view>
<view class="describe flex">优惠券已存入您的卡包里</view>
<block wx:if="{{item.discountType == 2}}">
<view class="price">
{{ item.discountIntensity}}
<view class="unit">折</view>
</view>
</block>
<block wx:else>
<view class="price">
<view class="unit">¥</view>
{{item.denomination}}
</view>
</block>
<view class="tips">全场通用</view>
<view class="btn flex" bindtap="jump">去使用</view>
<view class="time">使用期限:{{item.receiveStartTime}}-{{item.receiveEndTime}}</view>
</view>
<view class="close">
<glsx-image src="activity/close.png" bindtap="close"></glsx-image>
</view>
</view>
</view>
</block>
\ No newline at end of file \ No newline at end of file
// packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
popupConfig: {
type: Object
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
close() {
this.setData({
show: false
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.wxss */
.box {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 101;
background-color: rgba($color: #000000, $alpha: .5);
.content {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 516rpx;
height: 641rpx;
display: flex;
flex-direction: column;
align-items: center;
// background-color: #096;
.bg {
position: absolute;
width: 682rpx;
height: 724rpx;
z-index: -1;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.title {
font-weight: 600;
font-size: 40rpx;
color: #333333;
padding: 200rpx 0 18rpx;
max-width: 360rpx;
text-align: center;
line-height: 56rpx;
}
.text {
font-weight: 400;
font-size: 28rpx;
color: #333333;
line-height: 44rpx;
max-width: 352rpx;
text-align: center;
}
.btn {
position: absolute;
bottom: 114rpx;
left: 50%;
transform: translateX(-50%);
width: 272rpx;
height: 68rpx;
background-image: linear-gradient(90deg, #FE9461 15%, #FC5B32 90%);
border-radius: 34rpx;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
line-height: 68rpx;
}
}
.expire {}
}
\ No newline at end of file \ No newline at end of file
<block wx:if="{{show}}">
<view class="box">
<view class="content">
<view class="bg">
<glsx-image src="activity/{{popupConfig.type == 1?'default-bg':'expire-bg'}}.png"></glsx-image>
</view>
<block wx:if="{{popupConfig.title}}">
<view class="title">{{popupConfig.title}}</view>
</block>
<block wx:else>
<view class="title"> 很遗憾您未中奖!敬请期待下次活动!</view>
</block>
<block wx:if="{{popupConfig.showDefault}}">
<view class="text">很遗憾您未参加此次接龙!敬请期待下次活动!</view>
</block>
<block wx:else>
<block wx:if="{{popupConfig.numWin}}">
<view class="text">本次开奖数字为:{{popupConfig.numWin}}</view>
</block>
<block wx:if="{{popupConfig.relayContent}}">
<view class="text">您选择的数字为:{{popupConfig.relayContent}}</view>
</block>
</block>
<view class="btn" bindtap="close">好的</view>
</view>
</view>
</block>
\ No newline at end of file \ No newline at end of file
// packageActivity/pages/solitaire/index/index.js // packageActivity/pages/solitaire/index/index.js
import {
jumpAuthMixin
} from "~/mixins/index";
const generateOptionsArray = function (count = 9) {
return Array.from({
length: count
}, (_, index) => Number(index + 1))
}
Page({ Page({
behaviors: [jumpAuthMixin],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
list: []
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {},
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
...@@ -26,9 +32,320 @@ Page({ ...@@ -26,9 +32,320 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
const {
options
} = this
console.log(options,'--------')
if (options.id) this.options.relayLotteryId = options.id
if (options.isLogin) this.getGroupEnterInfo(options)
else this.jumpLoading() //直接打开时跳转、防止sessionId失效
}, },
async getGroupEnterInfo(options) {
//测试时需要分享测试
// let query = []
// Object.keys(options).map(key => {
// if (key != 'isLogin') query.push(`${key}=${options[key]}`)
// })
// this.shareQuery = query.join('&')
// this.noPageAuth = true
const res = await wx.p.router.intercept()
if (!res) {
const {
userInfo
} = this.data
if (!userInfo.nickName) return this.getNickNameAndHeadUrl()
try {
const _this = this
wx.getGroupEnterInfo({
async success({
iv,
encryptedData
}) {
const {
data,
code,
message
} = await wx.p.api.userApi.getOpengid({
iv,
encryptedData
})
if (code == 0 && data) {
console.log('openGid:', data)
const res = await wx.p.api.userApi.openGIdtoChatId({
merchantId: options.merchantId,
openGid: data
})
console.log('chatId:', res.data)
options.chatId = res.data || ''
this.options = options
_this.getSolitaireDetail(options)
} else throw message
},
fail(err) {
_this.getSolitaireDetail(options)
}
})
} catch (error) {
if (error) wx.p.wxApi.showToast(error)
}
}
},
/**获取用户接龙信息 */
async getSolitaireUserInfo(params) {
delete params.isLogin
try {
const {
userInfo: {
nickName: name,
phone,
openId,
unionId
}
} = this.data, {
code,
data,
message
} = await wx.p.api.solitaireApi.getSolitaireUserInfo({
...params,
name,
phone,
openId,
unionId
})
if (code == 0) {
if (data) {
/**
* recordId 记录id
* stateCode 状态码 -1.未参与 0.已参加 1.未中奖 2.已中奖
* relayContent 接龙内容
* prizeType 奖品类型 1.红包 2.优惠券 3.权益
* prizeId 奖品id (已领取时返回)
* claimState 领取状态 0.未领取 1.已领取
*/
const {
stateCode,
stateName,
relayContent,
claimState,
prizeType,
recordId,
prizeId
} = data
if (stateCode == 2) {
this.setData({
disabled: true
})
if (claimState == 0) {
if (prizeType == 1) this.bindActivityRedEnvelope(recordId)
else this.getCoupon(recordId)
} else {
if (prizeType == 1) this.getRedEnvelopeAwardInfo({
awardInfoId: prizeId,
params
})
else this.getCouponInfo(prizeId)
}
} else {
if (stateCode == 0 || stateCode == 1) this.setData({
['popupConfig.type']: stateCode == 0 ? 1 : 2,
['popupConfig.title']: stateName || '',
})
this.setData({
show: stateCode == 0 || stateCode == 1,
disabled: stateCode == 1,
['popupConfig.relayContent']: relayContent
})
}
}
} else throw message
} catch (error) {
console.log(error)
this.showGroupNoAccess(error)
}
},
async getCoupon(recordId) {
const {
activityObject: {
rewardId,
merchantId,
merchantName
}
} = this.data,
data = await wx.p.api.solitaireApi.getCoupon({
couponId: rewardId,
merchantId,
merchantName
})
if (data && data.length) {
let [info] = data
this.setCouponInfo(info)
wx.p.api.solitaireApi.recordedPrizeInfo({
prizeId: info.userCouponId,
recordId
})
} else wx.p.wxApi.showToas('奖品已发完')
},
async getCouponInfo(userCouponId) {
const info = await wx.p.api.couponsApi.couponsDetail({
userCouponId
})
info.userCouponId = userCouponId
this.setCouponInfo(info)
},
setCouponInfo(info) {
info.receiveStartTime = new Date(info.receiveStartTime).format('yyyy/MM/dd')
info.receiveEndTime = new Date(info.receiveStartTime).format('yyyy/MM/dd')
if (info.discountIntensity) info.discountIntensity = Number(info.discountIntensity / 100)
if (info.denomination) info.denomination = Number(info.denomination / 100)
info.id = info.userCouponId
this.setData({
couponInfo: info,
showCoupon: true
})
},
/**获取接龙活动详情 */
async getSolitaireDetail(params) {
try {
wx.p.wxApi.showLoading()
const res = await wx.p.api.solitaireApi.getSolitaireDetail(params)
this.getSolitaireUserInfo(params)
this.getSolitaireAewardList(params)
this.setData({
activityDetail: decodeURIComponent(wx.p.format.encodeSearchKey(res.description)),
title: res.title,
array: generateOptionsArray(res.numLimit),
loading: true,
activityObject: res
})
if (new Date(wx.p.format.iosTimeFormat(res.lotteryTime)).getTime() <= Date.now()) this.setData({
['popupConfig.numWin']: res.numWin
})
wx.p.wxApi.hideLoading()
} catch (error) {
console.log(error)
if (error) wx.p.wxApi.showToast(error)
}
},
/**获取接龙明细 */
async getSolitaireAewardList(params) {
const {
list
} = await wx.p.api.solitaireApi.getSolitaireAewardList(params)
this.setData({
list: list.reverse()
})
},
/**领取红包 */
async bindActivityRedEnvelope(recordId) {
const {
activityObject: {
rewardId,
id
},
userInfo
} = this.data
wx.p.router.redirectTo('/packageActivity/pages/redEnvelope/index/index', {
activityId: rewardId,
merchantId: userInfo.merchantId,
source: 2,
recordId,
isLogin: 1,
businessId: id
})
},
/**红包活动回显 */
async getRedEnvelopeAwardInfo({
awardInfoId,
params
}) {
const {
activityObject: {
rewardId
}
} = this.data
wx.p.router.redirectTo('/packageActivity/pages/redEnvelope/index/index', {
activityId: rewardId,
merchantId: params.merchantId,
awardInfoId,
isLogin: 1
})
},
showGroupNoAccess(title) {
this.setData({
['popupConfig.type']: 1,
['popupConfig.title']: title,
['popupConfig.showDefault']: true,
show: true,
disabled: true
})
},
bindPickerChange(e) {
this.setData({
'params.num': this.data.array[e.detail.value]
})
},
inSolitaire() {
const {
userInfo
} = this.data
this.setData({
flag: true
})
this.setData({
'params.name': userInfo.nickName
})
},
/**提交 */
async submit() {
try {
const {
params,
} = this.data, {
id: relayLotteryId,
} = this.options
console.log(params)
if (!params.name) throw '请输入名称!'
if (!params.num) throw '请选择数字!'
wx.p.wxApi.showLoading()
const {
code,
data,
message
} = await wx.p.api.solitaireApi.commitSolitaire({
relayLotteryId,
name: params.name,
relayContent: params.num,
})
wx.hideLoading()
if (code == 0) {
if (data) {
wx.p.wxApi.showToast('提交成功!')
this.setData({
disabled: true
})
this.getSolitaireAewardList({
relayLotteryId
})
} else throw message
} else this.setData({
show: true
})
} catch (error) {
wx.hideLoading()
if (error) wx.p.wxApi.showToast(error)
}
},
input(e) {
const {
value
} = e.detail, {
name
} = e.target.dataset
this.setData({
[name]: value
})
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
...@@ -55,12 +372,5 @@ Page({ ...@@ -55,12 +372,5 @@ Page({
*/ */
onReachBottom() { onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
} }
}) })
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
"mp-html": "/components/mp-html/index",
"solitaire-popup":"../components/solitairePopup/solitairePopup",
"coupon":"../components/Coupon/Coupon"
},
"navigationBarTitleText": "群接龙抽奖"
}
\ No newline at end of file \ No newline at end of file
/* packageActivity/pages/solitaire/index/index.wxss */
page {
background-color: #f7f7f7;
}
.layout {
padding: 24rpx 32rpx 160rpx;
.box {
background: #FFFFFF;
border-radius: 16rpx;
}
.title {
height: 100rpx;
font-weight: 600;
font-size: 32rpx;
color: #2D2D2E;
justify-content: center;
}
.mp-html {
padding: 32rpx;
font-size: 28rpx;
color: #2D2D2E;
line-height: 46rpx;
margin: 24rpx 0;
max-height: 50vh;
box-sizing: border-box;
overflow-y: scroll;
}
.detail-box {
font-size: 28rpx;
color: #2D2D2E;
line-height: 50rpx;
padding: 32rpx;
.subtitle {
font-size: 28rpx;
font-weight: 600;
line-height: 46rpx;
margin-bottom: 20rpx;
text {
color: #FC5B32;
}
}
.item {
.label {
max-width: 420rpx;
}
.value {
margin-left: auto;
flex-shrink: 0;
}
}
.input-box {
margin-top: 24px;
.button {
.icon {
width: 40rpx;
height: 40rpx;
box-sizing: border-box;
border: 2rpx solid #fc5b3233;
border-radius: 100%;
position: relative;
margin-right: 8rpx;
&::before,
&::after {
content: '';
position: absolute;
background: #FC5B32;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
&::before {
width: 20.84rpx;
height: 3.82rpx;
}
&::after {
width: 3.82rpx;
height: 20.86rpx;
}
}
font-size: 28rpx;
color: #FC5B32;
}
.input {
height: 68rpx;
background: #F5F5F5;
border-radius: 8rpx;
margin-bottom: 24rpx;
padding: 14rpx 20rpx;
box-sizing: border-box;
font-size: 28rpx;
position: relative;
.arrow {
position: absolute;
right: 24rpx;
width: 17rpx;
height: 17rpx;
transform: rotate(-45deg);
transform-origin: left;
border-left: 4rpx solid #BDBDBD;
border-bottom: 4rpx solid #BDBDBD;
}
}
.placeholder {
color: #BDBDBD;
}
.default-btn {
width: 564rpx;
height: 68rpx;
background-image: linear-gradient(90deg, #FE9461 15%, #FC5B32 90%);
border-radius: 34rpx;
font-size: 32rpx;
margin-top: 32rpx;
}
}
}
}
\ No newline at end of file \ No newline at end of file
<!--packageActivity/pages/solitaire/index/index.wxml-->
<text>packageActivity/pages/solitaire/index/index.wxml</text>
\ No newline at end of file \ No newline at end of file
<block wx:if="{{loading}}">
<view class="layout">
<view class="title flex box">{{title}}</view>
<view class="mp-html box">
<mp-html content="{{activityDetail}}"></mp-html>
</view>
<view class="detail-box box">
<view class="subtitle">参与接龙目前共<text>{{list.length}}</text>人</view>
<view class="list">
接龙明细
<block wx:for="{{list}}" wx:key="index">
<block wx:if="{{index < 5}}">
<view class="item flex">
<view class="label text-hide">{{index + 1}}.名称:{{item.name}}
</view>
<view class="value">选择数字:{{item.relayContent}}</view>
</view>
</block>
</block>
<block wx:if="{{list.length >= 6}}">
<block wx:if="{{list.length > 6}}">
<view class="item">…</view>
</block>
<view class="item flex">
<view class="label text-hide">{{list.length}}.名称:{{list[list.length - 1].name}}</view>
<view class="value">选择数字:{{list[list.length - 1].relayContent}}</view>
</view>
</block>
<block wx:if="{{!disabled}}">
<view class="input-box">
<block wx:if="{{!flag}}">
<view class="button flex" bindtap="inSolitaire">
<view class="icon"></view>参与接龙
</view>
</block>
<block wx:else>
<view class="input">
<input type="text" placeholder="请输入名称" maxlength="32" placeholder-class="placeholder" value="{{params.name}}" bindinput="input" data-name="params.name" />
</view>
<view class="input {{params.num ?'':'placeholder'}}">
<picker bindchange="bindPickerChange" range="{{array}}">
{{params.num || '请选择数字'}}
</picker>
<view class="arrow y-center"></view>
</view>
<button class="default-btn" bindtap="submit">确定</button>
</block>
</view>
</block>
</view>
</view>
</view>
</block>
<solitaire-popup popupConfig="{{popupConfig}}" model:show="{{show}}"></solitaire-popup>
<coupon item="{{couponInfo}}" model:show="{{showCoupon}}"></coupon>
\ No newline at end of file \ No newline at end of file
...@@ -13,7 +13,11 @@ Page({ ...@@ -13,7 +13,11 @@ Page({
imgList: new Array(3), imgList: new Array(3),
authStatus: true, authStatus: true,
hasUserInfo: false, hasUserInfo: false,
isOpenMember: false isOpenMember: false,
txtObj: {
noMember: '恭喜领取成功',
member: '恭喜您已成为会员用户'
},
}, },
navbarReady(e) { navbarReady(e) {
let { let {
...@@ -129,6 +133,7 @@ Page({ ...@@ -129,6 +133,7 @@ Page({
}, },
// 领取会员卡 // 领取会员卡
toPostFreeCard(merchantId, phone, userInfo) { toPostFreeCard(merchantId, phone, userInfo) {
wx.p.wxApi.showLoading()
let para = { let para = {
merchantId, merchantId,
phone phone
...@@ -177,6 +182,7 @@ Page({ ...@@ -177,6 +182,7 @@ Page({
}) })
}, },
receiveRed(equityFreeCardId) { receiveRed(equityFreeCardId) {
wx.p.wxApi.showLoading()
let { let {
isOpenMember, isOpenMember,
nickName, nickName,
...@@ -187,20 +193,19 @@ Page({ ...@@ -187,20 +193,19 @@ Page({
nickName: nickName nickName: nickName
} }
if (bindingSource) params.bindingSource = bindingSource if (bindingSource) params.bindingSource = bindingSource
wx.p.api.equityApi.checkReceiveRed(params).then(res => { wx.p.api.equityApi.checkReceiveRed(params).then(async res => {
wx.hideLoading()
console.log(res, 'checkReceiveRed---') console.log(res, 'checkReceiveRed---')
let { let {
code, code,
message, message,
data data
} = res } = res
if (code != 0) { if (code != 0) return this.showTips(message || '服务不可用')
this.showTips(message || '服务不可用') /**isActivityRedEnvelopeFlag 是否关联红包活动 */
return if (!data.isActivityRedEnvelopeFlag) this.jumpMine()
} else {
if (!data.isActivityRedEnvelopeFlag) { /**是否领取过红包 */
this.jumpMine()
} else {
if (!data.isReceiveFlag) { if (!data.isReceiveFlag) {
/**用户是否已添加福利官 true:是;false:否; */ /**用户是否已添加福利官 true:是;false:否; */
if (!data.isAddWelfareOfficerFlag) { if (!data.isAddWelfareOfficerFlag) {
...@@ -210,14 +215,19 @@ Page({ ...@@ -210,14 +215,19 @@ Page({
addWelfareOfficer: 'bg-member-welfare' addWelfareOfficer: 'bg-member-welfare'
}) })
} else { } else {
wx.p.router.go('/packageEquity/pages/receiveRed/receiveRed', { this.setData({
isOpenMember: isOpenMember, receiveSuccess: true
activityRedEnvelopeLink: data.activityRedEnvelopeLink
}) })
setTimeout(() => {
wx.p.router.redirectTo('/packageActivity/pages/redEnvelope/index/index', {
activityId: data.activityRedEnvelopeId,
businessId: equityFreeCardId,
source: 0,
isLogin: 1
})
}, 1.5e3)
} }
} else { } else this.jumpMine()
this.jumpMine()
}
} }
}) })
}, },
...@@ -226,9 +236,11 @@ Page({ ...@@ -226,9 +236,11 @@ Page({
// 先判断登录 // 先判断登录
const authStatus = await wx.p.router.intercept(false) const authStatus = await wx.p.router.intercept(false)
if (authStatus) return if (authStatus) return
wx.p.wxApi.showLoading()
wx.p.api.equityApi.checkOpenMember({ wx.p.api.equityApi.checkOpenMember({
isTrialCardFlag: 1 isTrialCardFlag: 1
}).then(res => { }).then(res => {
wx.hideLoading()
if (res.code == -1 && res.errId == 2008) { if (res.code == -1 && res.errId == 2008) {
this.showTips(res.message || '服务不可用') this.showTips(res.message || '服务不可用')
return return
......
...@@ -83,3 +83,36 @@ ...@@ -83,3 +83,36 @@
height: 20rpx; height: 20rpx;
} }
} }
.red-bg-iamge {
width: 100%;
position: absolute;
left: 0;
top: 0;
.image-class {
background-color: #fff;
width: 100%;
height: 320rpx;
}
.img-card {
position: absolute;
bottom: -42rpx;
left: 35%;
width: 136rpx;
height: 136rpx;
}
}
.receive-red {
text-align: center;
.title {
font-weight: 600;
font-size: 48rpx;
color: #3871E1;
text-align: center;
line-height: 48rpx;
}
}
\ No newline at end of file \ No newline at end of file
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" showBack="{{true}}" navTitleStyle="{{navTitleStyle}}" page-title="领取会员卡">领取会员卡</navigation-bar> <navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" showBack="{{true}}" navTitleStyle="{{navTitleStyle}}" page-title="领取会员卡">领取会员卡</navigation-bar>
<view class="bg-iamge" style="height: calc({{statusBarHeight + navigationBarHeight - 30}}px);">
<block wx:if="{{receiveSuccess}}">
<view class="red-bg-iamge" style="height: calc({{statusBarHeight + navigationBarHeight + 26}}px);">
<glsx-image src="equity/bg-receive.png" class="image-class" />
<glsx-image src="equity/icon-receive.png" class="img-card" />
</view>
<view class="receive-red" style="margin-top:calc({{statusBarHeight + navigationBarHeight + 100}}px);">
<view class="title">{{txtObj[isOpenMember ? 'member' : 'noMember']}}</view>
</view>
</block>
<block wx:else>
<view class="bg-iamge" style="height: calc({{statusBarHeight + navigationBarHeight - 30}}px);">
<glsx-image src="equity/bg-card.png" class="image-class" /> <glsx-image src="equity/bg-card.png" class="image-class" />
</view> </view>
<scroll-view class="box" scroll-y style="margin-top:calc({{statusBarHeight + navigationBarHeight - 30}}px);" refresher-enabled="{{false}}"> <scroll-view class="box" scroll-y style="margin-top:calc({{statusBarHeight + navigationBarHeight - 30}}px);" refresher-enabled="{{false}}">
<view style="height: calc(100vh - {{statusBarHeight + navigationBarHeight - 30}}px);"> <view style="height: calc(100vh - {{statusBarHeight + navigationBarHeight - 30}}px);">
<view class="img-box"> <view class="img-box">
<glsx-image src="equity/card.png" class="img-card" /> <glsx-image src="equity/card.png" class="img-card" />
...@@ -12,8 +23,8 @@ ...@@ -12,8 +23,8 @@
<glsx-image class="img-equity" src="equity/card-{{index}}.png" /> <glsx-image class="img-equity" src="equity/card-{{index}}.png" />
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view class="card-btn isFullSucreen"> <view class="card-btn isFullSucreen">
<view class="tips">限时领红包</view> <view class="tips">限时领红包</view>
<button wx:if="{{authStatus}}" open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="text-center btn-defalut">免费领取</button> <button wx:if="{{authStatus}}" open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="text-center btn-defalut">免费领取</button>
<button wx:elif="{{!hasUserInfo}}" catchtap="jumpAuthUserInfo" class="text-center btn-defalut">免费领取</button> <button wx:elif="{{!hasUserInfo}}" catchtap="jumpAuthUserInfo" class="text-center btn-defalut">免费领取</button>
...@@ -21,5 +32,6 @@ ...@@ -21,5 +32,6 @@
<view class="btn-defalut" bindtap="toCheckMember">免费领取</view> <view class="btn-defalut" bindtap="toCheckMember">免费领取</view>
</view> </view>
<view class="h-20"></view> <view class="h-20"></view>
</view>
<glsx-privacy appletName="业主甄选"></glsx-privacy>
\ No newline at end of file \ No newline at end of file
</view>
<glsx-privacy appletName="业主甄选"></glsx-privacy>
</block>
\ No newline at end of file \ No newline at end of file
...@@ -58,11 +58,9 @@ Page({ ...@@ -58,11 +58,9 @@ Page({
*/ */
onLoad(options) { onLoad(options) {
wx.hideShareMenu() wx.hideShareMenu()
wx.p.router.getData(obj => {
this.setData({ this.setData({
isMember: obj.isOpenMember ? 'member' : 'noMember', isMember: options.isOpenMember ? 'member' : 'noMember',
activityRedEnvelopeLink: obj.activityRedEnvelopeLink activityRedEnvelopeLink: options.activityRedEnvelopeLink
})
}) })
this.countDown() this.countDown()
}, },
......
...@@ -39,7 +39,7 @@ Page({ ...@@ -39,7 +39,7 @@ Page({
let { let {
showLogin showLogin
} = this.data } = this.data
if(showLogin) return if (showLogin) return
this.data.haveCouponsList = [] this.data.haveCouponsList = []
this.setData({ this.setData({
curTabIndex: e.detail, curTabIndex: e.detail,
...@@ -60,12 +60,17 @@ Page({ ...@@ -60,12 +60,17 @@ Page({
curTabIndex, curTabIndex,
isMerchant isMerchant
} = this.data } = this.data
let {merchantId} = wx.p.storage.get('merchant_info') let {
merchantId
} = wx.p.storage.get('merchant_info')
let para = { let para = {
useMemberType: 0 useMemberType: 0
} }
if (curTabIndex == 1) para.discountType = 8 //线上优惠券加上这个参数
if (!isMerchant) para.merchantId = merchantId if (!isMerchant) para.merchantId = merchantId
if (curTabIndex == 1) {
para.discountType = 8 //线上优惠券加上这个参数
delete para.merchantId //权益优惠券不传merchantId
}
wx.p.api.couponsApi.getCardData(para).then(res => { wx.p.api.couponsApi.getCardData(para).then(res => {
wx.hideLoading() wx.hideLoading()
let list = res.map(item => { let list = res.map(item => {
......
...@@ -9,7 +9,7 @@ Page({ ...@@ -9,7 +9,7 @@ Page({
}, },
setCopyData(e) { setCopyData(e) {
const text = e.currentTarget.dataset.title; const text = e.currentTarget.dataset.title;
wx.$api.setCopyData(text, () => { wx.p.wxApi.setCopyData(text, () => {
wx.p.wxApi.showToast('复制成功') wx.p.wxApi.showToast('复制成功')
}) })
}, },
......
...@@ -12,12 +12,16 @@ Component({ ...@@ -12,12 +12,16 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
count: 5 count: 3
}, },
lifetimes: { lifetimes: {
async attached() { async attached() {
const { const {
data data,
data: {
activityId,
merchantId
}
} = this.data } = this.data
if (data.activityType) { if (data.activityType) {
let url = '/packageEquity/pages/freecard/freecard', let url = '/packageEquity/pages/freecard/freecard',
...@@ -26,24 +30,17 @@ Component({ ...@@ -26,24 +30,17 @@ Component({
notIntercept: true notIntercept: true
} }
if (data.activityType == 3) { if (data.activityType == 3) {
const { options = {
userInfo activityId,
} = wx.p.router.getPageInstance().data businessId: data.id,
const res = await wx.p.api.questionnaireApi.receiveQuestionnaireRedEnvelope({ merchantId,
questionnaireId: data.id, source: 1,
activityRedEnvelopeId: data.activityId, isLogin: 1
nickName: userInfo.nickName }
}) url = '/packageActivity/pages/redEnvelope/index/index'
if (res.isActivityRedEnvelopeFlag && !res.isReceiveFlag) this.setData({
jumpOption: {
url: res.activityRedEnvelopeLink,
type: data.activityType
} }
})
this.countDown()
} else {
if (data.activityType == 2) { if (data.activityType == 2) {
options.couponId = data.activityId options.couponId = activityId
url = '/packageMall/pages/coupon/coupon' url = '/packageMall/pages/coupon/coupon'
} }
this.setData({ this.setData({
...@@ -53,9 +50,8 @@ Component({ ...@@ -53,9 +50,8 @@ Component({
options options
} }
}) })
this.countDown()
} }
} else this.countDown() this.countDown()
} }
}, },
timer: null, timer: null,
...@@ -69,19 +65,15 @@ Component({ ...@@ -69,19 +65,15 @@ Component({
const { const {
jumpOption jumpOption
} = this.data } = this.data
if (jumpOption) { if (jumpOption) wx.p.router.redirectTo(jumpOption.url, jumpOption.options)
if (jumpOption.type == 3) wx.p.router.switchTab('/pages/tab/index/index', { else wx.p.router.goHome()
jumpH5Url: jumpOption.url
})
else wx.p.router.redirectTo(jumpOption.url, jumpOption.options)
} else wx.p.router.goHome()
}, },
countDown() { countDown() {
this.timer = setTimeout(() => { this.timer = setTimeout(() => {
let { let {
count count
} = this.data } = this.data
if (this.timer && count == 0) { if (this.timer && count == 1) {
clearTimeout(this.timer) clearTimeout(this.timer)
this.back() this.back()
return return
......
...@@ -6,14 +6,3 @@ ...@@ -6,14 +6,3 @@
<view class="btn" bindtap="back">返回</view> <view class="btn" bindtap="back">返回</view>
<view class="tips">{{count}}S后自动跳转</view> <view class="tips">{{count}}S后自动跳转</view>
</view> </view>
\ No newline at end of file \ No newline at end of file
<!-- 红包会员弹窗 -->
<block wx:if="{{data.activityType == 3 && jumpOption}}">
<view class="member-dialog">
<view class="bg" />
<view class="content">
<view class="count-down">{{count}}</view>
<glsx-image class="member-bg" src="equity/bg-red.png"></glsx-image>
<glsx-image bindtap="back" class="open-btn" src="equity/icon-open.png"></glsx-image>
</view>
</view>
</block>
\ No newline at end of file \ No newline at end of file
...@@ -23,6 +23,7 @@ Page({ ...@@ -23,6 +23,7 @@ Page({
this.toCheckMember() this.toCheckMember()
}, },
onLoad: function (options) { onLoad: function (options) {
console.log(options)
// options = JSON.stringify(options)==='{}'?this.options:options // options = JSON.stringify(options)==='{}'?this.options:options
this.data.isGameUse = options.inType == 'game' this.data.isGameUse = options.inType == 'game'
const query = options ? options.param : this.data.query const query = options ? options.param : this.data.query
...@@ -132,6 +133,7 @@ Page({ ...@@ -132,6 +133,7 @@ Page({
delete tem.id delete tem.id
} }
wx.p.api.equityApi.commodityMsg(tem).then(res => { wx.p.api.equityApi.commodityMsg(tem).then(res => {
wx.hideLoading()
res.goodsDetailList = res.goodsDetailList || [] res.goodsDetailList = res.goodsDetailList || []
let tempList = res.goodsDetailList.map((item, index) => { let tempList = res.goodsDetailList.map((item, index) => {
item.warrantyDate = new Date(item.warrantyDate).format('yyyy-MM-dd hh:mm:ss') item.warrantyDate = new Date(item.warrantyDate).format('yyyy-MM-dd hh:mm:ss')
...@@ -186,7 +188,7 @@ Page({ ...@@ -186,7 +188,7 @@ Page({
// }) // })
setTimeout(() => { setTimeout(() => {
wx.p.router.back(e => { wx.p.router.back(e => {
e.onLoad({ showToast: 1 }) if(e && e.onLoad ) e.onLoad({ showToast: 1 })
}) })
}, 500) }, 500)
return return
......
...@@ -167,6 +167,7 @@ Page({ ...@@ -167,6 +167,7 @@ Page({
wx.p.storage.set('sessionId', data.sessionId) wx.p.storage.set('sessionId', data.sessionId)
// 返回上一页 // 返回上一页
wx.p.router.back(thisPage => { wx.p.router.back(thisPage => {
thisPage.options.isLogin = 1 //登陆标识
thisPage && thisPage.setData({ thisPage && thisPage.setData({
userInfo: data userInfo: data
}) })
......
// pages/loading/loading.js // pages/loading/loading.js
import { systemApi } from '~/api/index' import {
systemApi
} from '~/api/index'
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -26,7 +28,7 @@ Page({ ...@@ -26,7 +28,7 @@ Page({
async login(options = {}) { async login(options = {}) {
console.log(options, 'options.merchantId') console.log(options, 'options.merchantId')
// wx.p.router.goHome() // wx.p.router.goHome()
if (options.merchantId){ if (options.merchantId) {
wx.$merchant_id = options.merchantId wx.$merchant_id = options.merchantId
wx.p.storage.set('merchant_info', { wx.p.storage.set('merchant_info', {
merchantId: options.merchantId, merchantId: options.merchantId,
...@@ -35,7 +37,11 @@ Page({ ...@@ -35,7 +37,11 @@ Page({
wx.p.storage.set('first_enter_miniprograme', true) wx.p.storage.set('first_enter_miniprograme', true)
} }
try { try {
const { code, data, message } = await wx.p.api.userApi.login() const {
code,
data,
message
} = await wx.p.api.userApi.login()
wx.$LoginStatus = code != 0 wx.$LoginStatus = code != 0
if (data) if (data)
wx.p.storage.set('merchant_info', { wx.p.storage.set('merchant_info', {
...@@ -65,17 +71,25 @@ Page({ ...@@ -65,17 +71,25 @@ Page({
}, },
async getSceneById(scene) { async getSceneById(scene) {
const id = decodeURIComponent(scene).split('=').at(-1) const id = decodeURIComponent(scene).split('=').at(-1)
console.log(decodeURIComponent(scene),'decodeURIComponent(scene)'); console.log(decodeURIComponent(scene), 'decodeURIComponent(scene)');
try { try {
const { code, data } = await wx.p.api.wechatApi.getSceneById({ const {
code,
data
} = await wx.p.api.wechatApi.getSceneById({
id id
}) })
const params = data.scene.split('url='),options = {} const params = data.scene.split('url='),
options = {},
{
options: _options
} = this
data.scene.split('&').map(item => { data.scene.split('&').map(item => {
const [key, val] = item.split('=') const [key, val] = item.split('=')
options[key] = val options[key] = val
}) })
if (params.length > 1) options.url = params.at(-1) if (params.length > 1) options.url = params.at(-1)
if (!options.url && _options.url) options.url = _options.url
if (code == 0) this.login(options) if (code == 0) this.login(options)
else throw {} else throw {}
} catch (error) { } catch (error) {
...@@ -86,15 +100,23 @@ Page({ ...@@ -86,15 +100,23 @@ Page({
jumpPage(options) { jumpPage(options) {
console.log(options); console.log(options);
const targetPath = decodeURIComponent(options.url), const targetPath = decodeURIComponent(options.url),
{ url, events } = this.setRouteData(targetPath), {
url,
events
} = this.setRouteData(targetPath),
routeName = this.tabList.findIndex(e => `/${e.pagePath}` == `${url}.html`) > -1 ? 'switchTab' : 'redirectTo' routeName = this.tabList.findIndex(e => `/${e.pagePath}` == `${url}.html`) > -1 ? 'switchTab' : 'redirectTo'
events.notIntercept = true events.notIntercept = true
events.merchantId = options.merchantId || '' events.merchantId = options.merchantId || ''
Object.keys(options).map(key => {
if (key != 'url' && options[key]) events[key] = options[key]
})
wx.p.router[routeName](url, events) wx.p.router[routeName](url, events)
}, },
setRouteData(targetPath) { setRouteData(targetPath) {
let [url, query] = targetPath.split('?'), let [url, query] = targetPath.split('?'),
events = {} events = {
isLogin: 1
}
if (query) { if (query) {
let arr = query.split('&') let arr = query.split('&')
arr.map(e => { arr.map(e => {
......
...@@ -8,7 +8,6 @@ Page({ ...@@ -8,7 +8,6 @@ Page({
navStyle, navStyle,
noticeContent: '', noticeContent: '',
bannerList: [], bannerList: [],
isEmpty: false,
codeList: [{ codeList: [{
title: '官方', title: '官方',
desc: '福利群', desc: '福利群',
...@@ -53,17 +52,6 @@ Page({ ...@@ -53,17 +52,6 @@ Page({
}) })
} }
this.getStrategyList(); this.getStrategyList();
if (options?.jumpH5Url) {
this.setData({
isEmpty: true
})
wx.p.router.jumpH5(options.jumpH5Url)
setTimeout(() => {
this.setData({
isEmpty: false
})
}, 1600)
}
this.shareTitle = "甄选福利" this.shareTitle = "甄选福利"
}, },
......
<view wx:if="{{isEmpty}}"></view> <view class="container">
<view wx:else>
<view class="container">
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="甄选福利"> <navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="甄选福利">
<view class="bar-text">甄选福利</view> <view class="bar-text">甄选福利</view>
</navigation-bar> </navigation-bar>
...@@ -51,7 +49,6 @@ ...@@ -51,7 +49,6 @@
<block wx:if="{{strategyList.length}}"> <block wx:if="{{strategyList.length}}">
<MoneySavingTips list="{{strategyList}}" bind:selectStrategy="selectStrategy"></MoneySavingTips> <MoneySavingTips list="{{strategyList}}" bind:selectStrategy="selectStrategy"></MoneySavingTips>
</block> </block>
</view>
</view> </view>
<!-- 弹框 --> <!-- 弹框 -->
<view wx:if="{{showModal}}" class="modal_widget"> <view wx:if="{{showModal}}" class="modal_widget">
......
...@@ -19,6 +19,11 @@ Page({ ...@@ -19,6 +19,11 @@ Page({
icon: 'myAddress', icon: 'myAddress',
url: '/packageMine/pages/address/index/index' url: '/packageMine/pages/address/index/index'
}, },
{
text: '中奖记录',
icon: 'redEnvelope',
url: '/packageActivity/pages/redEnvelope/record/record'
}
], ],
vipType: { vipType: {
1: 'gold_vip_bg', 1: 'gold_vip_bg',
......
{ {
"appid": "wxb818f6bc908c52fc",
"compileType": "miniprogram", "compileType": "miniprogram",
"packOptions": {
"ignore": [],
"include": []
},
"setting": { "setting": {
"coverView": true, "coverView": true,
"es6": true, "es6": true,
...@@ -20,10 +15,17 @@ ...@@ -20,10 +15,17 @@
}, },
"useCompilerPlugins": [ "useCompilerPlugins": [
"sass" "sass"
] ],
"ignoreUploadUnusedFiles": true
}, },
"condition": {},
"editorSetting": { "editorSetting": {
"tabIndent": "insertSpaces", "tabIndent": "insertSpaces",
"tabSize": 2 "tabSize": 2
} },
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wx39a574d259fe58a0"
} }
\ No newline at end of file \ No newline at end of file
...@@ -17,6 +17,18 @@ class Router { ...@@ -17,6 +17,18 @@ class Router {
}); });
}); });
} }
/**关闭当前页面跳转H5 */
redirectToH5(url, notIntercept) {
if (notIntercept) wx.redirectTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`,
})
else this.intercept(url).then((response) => {
if (response) return;
wx.redirectTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`,
});
});
}
/** /**
* 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 || * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 ||
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层 * 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
......
...@@ -143,13 +143,39 @@ export function setPrice(price) { ...@@ -143,13 +143,39 @@ export function setPrice(price) {
if (!decimal) decimal = '00' if (!decimal) decimal = '00'
return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + `.${decimal}` return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + `.${decimal}`
} }
/**decodeURIComponent 编码转换 */
export default{ export function encodeSearchKey(key) {
const encodeArr = [{
code: '%',
encode: '%25'
}, {
code: '?',
encode: '%3F'
}, {
code: '#',
encode: '%23'
}, {
code: '&',
encode: '%26'
}, {
code: '=',
encode: '%3D'
}];
return key.replace(/[%?#&=]/g, ($, index, str) => {
for (const k of encodeArr) {
if (k.code === $) {
return k.encode;
}
}
});
}
export default {
timeAgo, timeAgo,
commentTime, commentTime,
iosTimeFormat, iosTimeFormat,
getScopeTime, getScopeTime,
decimal, decimal,
centsToyuan, centsToyuan,
setPrice setPrice,
encodeSearchKey
} }
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!