Commit 1635f2b4 by 谢中龙

修改字段

parent 1a545d53
......@@ -122,7 +122,8 @@
"pages/scratch/scratch",
"pages/scratchRule/scratchRule",
"pages/sign/sign",
"pages/liveSubscrib/liveSubscrib"
"pages/liveSubscrib/liveSubscrib",
"pages/activityOrder/activityOrder"
]
}
],
......
......@@ -729,6 +729,13 @@
"pathName": "subPackageMarketing/page/pages/liveSubscrib/liveSubscrib",
"query": "room_id=8",
"scene": null
},
{
"id": -1,
"name": "活动预约",
"pathName": "subPackageMarketing/page/pages/activityOrder/activityOrder",
"query": "id=717451838479273984",
"scene": null
}
]
}
......
// subPackageMarketing/page/pages/activityOrder/activityOrder.js
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
import { Integer } from '../../../../utils/integerDigitalConvertion'
let app = getApp();
wxService.page({
/**
* 页面的初始数据
*/
data: {
id : '',
activityInfo : {},
orderBtnText : '立即预约',
userOrderStatus : false,
showInvite : false,
shareObj : {
title: '',
path: '',
imageUrl: ''
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.id){
this.data.id = options.id;
wx.showLoading({
title: '数据加载中..',
});
this.getActivityInfo();
}
},
//获取活动详情
getActivityInfo(){
wxService.post(`/marketing/bookingActivitySet/findById?id=${this.data.id}`).then(res => {
console.log(res)
if(res){
let obj = res.data.data ? res.data.data : null;
if(obj){
this.data.activityInfo = obj;
this.setData({
activityInfo : this.data.activityInfo
});
this.setUserOrderStatus(this.data.id);
//生成触点
this.generatePoint();
}
}
})
},
//设置用户预约状态
setUserOrderStatus(id){
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
if(!baseUserInfo){
this.setData({
currentHasUserInfo : false,
});
return ;
}
this.setData({
currentHasUserInfo : true,
});
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){
this.setData({
orderBtnText : '立即预约',
userOrderStatus : false,
});
}
else{
this.setData({
orderBtnText : '已预约',
userOrderStatus : true,
});
}
}
});
},
// let enCodeUrl = encodeURIComponent(url);
// let sharePath = `/subPackage/page/pages/h5/h5page?url=${enCodeUrl}`
//立即预约
onTapOrderNow(){
//先判断是否已经预约过
if(this.data.userOrderStatus){
wx.showModal({
title : '预约成功',
showCancel: false,
confirmText : '确定',
content : '您已订阅消息通知~',
confirmColor : app.globalData.themeColor,
success(){},
})
}
else{
if(this.data.activityInfo.templateId){
this.getOrderActivityInfo(this.data.activityInfo,this.data.activityInfo);
}
}
},
//获取预约信息
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 => {});
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function (res) {
this.onTapCloseModal();
return this.data.shareObj;
},
//生成触点
generatePoint(){
let content = {
title: this.data.activityInfo.name,
id: this.data.activityInfo.id,
url: this.data.activityInfo.imgUrl
}
let tentacleInfo = {
content: JSON.stringify(content),
contentId: this.data.activityInfo.id,
contentType: app.globalData.contants.SHARE_TYPE.PRODUCT_DETAIL, //内容类型 STAFF_RECOMMAND
title: this.data.activityInfo.name, //标题
type: 2// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
}
wxService.getTentacleContent(tentacleInfo).then(res => {
if (res && res.id) {
let tentacleId = res.id;
let inner_id = Integer.digit(this.data.activityInfo.id, 10, 64);
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
var path = 'subPackage/page/pages/scanCoupon/scanCoupon' + '?i=' + inner_id + '&t=' + inner_tentacleId;
this.data.shareObj = {
title: this.data.activityInfo.name,
path: path,
imageUrl: this.data.activityInfo.imgUrl
}
this.setData({
shareObj : this.data.shareObj
});
}
});
},
//邀请好友
onTapInviteFriends(){
this.setData({
showInvite : true
});
},
//关闭
onTapCloseModal(){
this.setData({
showInvite : false
});
}
})
\ No newline at end of file
{
"disableScroll": true,
"navigationBarTitleText": "活动预约",
"usingComponents": {}
}
\ No newline at end of file
<!--subPackageMarketing/page/pages/activityOrder/activityOrder.wxml-->
<view class="page-container">
<image src="{{activityInfo.imgUrl}}" mode="aspectFit"></image>
</view>
<view class="bottom-order">
<view class="order-btns positionRe" >
<button wx:if="{{!currentHasUserInfo}}" class="positionAbs clear-btn" bindgetuserinfo="_getUserInfo" open-type='getUserInfo'></button>
<text bindtap="onTapOrderNow">{{orderBtnText}}</text>
</view>
<view class="order-btns positionRe">
<button wx:if="{{!currentHasUserInfo}}" class="positionAbs clear-btn" bindgetuserinfo="_getUserInfo" open-type='getUserInfo'></button>
<text bindtap="onTapInviteFriends">邀请好友</text>
</view>
</view>
<!-- 底部 -->
<view class="invite-modal" wx:if="{{showInvite}}" bindtap="onTapCloseModal"></view>
<view class="invite-body {{showInvite ? 'show' : ''}}">
<view class="items">
<button open-type="share" class="clear-btn">
<image src="/assets/imgs/7_1_0/wx-icon.png" mode="aspectFit"></image>
<text>微信好友</text>
</button>
</view>
<view class="items">
<button class="clear-btn">
<image src="/assets/imgs/7_1_0/wx-icon.png" mode="aspectFit"></image>
<text>生成海报</text>
</button>
</view>
</view>
\ No newline at end of file
/* subPackageMarketing/page/pages/activityOrder/activityOrder.wxss */
page{
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
view{
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.page-container{
width: 100vw;
height: 100vh;
}
.page-container image{
width: 100%;
height: 100%;
}
.bottom-order{
position: fixed;
bottom: 0;
z-index: 1;
left: 0;
width: 100vw;
height: 140rpx;
/* background: var(--themeColorRgba06); */
background: transparent;
padding: 0 30rpx;
display: flex;
align-items: center;
justify-content: space-around;
}
.bottom-order .order-btns{
width: 35vw;
height: 70rpx;
background: var(--themecolor);
color: #ffffff;
font-size: 28rpx;
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10rpx;
}
.bottom-order .order-btns:active{
opacity: 0.7;
}
.bottom-order .order-btns text{
flex: 1;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
/* */
.invite-modal{
position: fixed;
z-index: 2;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.5);
transition: all 0.3s;
left: 0;
top: 0;
}
.invite-body{
position: fixed;
z-index: 3;
width: 100vw;
height: 18vh;
background: #ffffff;
transition: all 0.3s;
left: 0;
bottom: 0;
padding: 30rpx;
display: flex;
align-items: center;
justify-content: space-around;
transform: translateY(100%);
}
.invite-body.show{
transform: translateY(0);
}
.invite-body .items{
width: 160rpx;
height: 180rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.invite-body .items button{
appearance: none;
background: transparent;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border: none;
padding: 0;
margin: 0;
}
.invite-body .items button::after{
border: none;
}
.invite-body .items image{
width: 80rpx;
height: 80rpx;
}
.invite-body .items:active{
opacity: 0.7;
}
\ No newline at end of file
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