Commit f2a01694 by 严立

LL - 活动预约

parent f1d53533
// pages/hotelAccommodation/hotelAccommodation.js
Page({ Page({
/**
* 页面的初始数据
*/
data: { data: {
phone: '13856782234',
hotline: false, //客服热线
type: 0, //夜间入园
name: '',
mobile: '',
num: '',
time: '',
}, },
onLoad: function (options) { showHotline() {
this.setData({
hotline: true
})
},
//客服热线拨打
call() {
wx.makePhoneCall({
phoneNumber: this.data.phone,
})
},
//取消拨打
cancel() {
this.setData({
hotline: false,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log('.............', options.detail)
let detail = JSON.parse(options.detail);
console.log(detail);
this.setData({
type: detail.type,
name: detail.name,
mobile: detail.mobile,
num: detail.num,
time: detail.time,
})
}, },
}) })
\ No newline at end of file
<!--pages/home/home/home.wxml--> <navigation class="navigation" titleText="预约凭证" color="#FFFFFF" backIcon="/image/back-w.png">
<text>pages/home/home/home.wxml</text> </navigation>
<view>
<image class="Img" wx:if="{{type == 0}}" src="http://upload.miaomiao-bao.com/f6dfe202008192103225871.jpg"></image>
<image class="Img" wx:if="{{type == 1}}" src="http://upload.miaomiao-bao.com/8883f202008192105356616.jpg"></image>
<view class="appiont-container">
<image wx:if="{{type == 0}}" class="bgcImg" src="http://upload.miaomiao-bao.com/f8e92202008192102227949.jpg"></image>
<image wx:if="{{type == 1}}" class="bgcImg" src="http://upload.miaomiao-bao.com/11174202008192100431340.jpg"></image>
<view class="form">
<image class="card" src="http://upload.miaomiao-bao.com/b6d15202008192102456807.png"></image>
<image wx:if="{{type == 0}}" src="http://sm-web.meiqicloud.com/userfiles/appResources/appointment/night/title-1.png" class="title" style="width:400rpx;margin-left:112rpx;"></image>
<image wx:if="{{type == 1}}" src="http://sm-web.meiqicloud.com/userfiles/appResources/appointment/night/title-2.png" class="title" style="width:300rpx;margin-left:160rpx;"></image>
<view class="form-content">
<view class="form-item">
<view class="form-item-nav">姓名</view>
<view class="form-item-content">{{name}}</view>
</view>
<view class="form-item">
<view class="form-item-nav">手机号</view>
<view class="form-item-content">{{mobile}}</view>
</view>
<view class="form-item" wx:if="{{type == 0}}">
<view class="form-item-nav">入园人数</view>
<view class="form-item-content">{{num}}人</view>
</view>
<view class="form-item" wx:if="{{type == 0}}">
<view class="form-item-nav">入园时间</view>
<view class="form-item-content">{{time}}</view>
</view>
<view class="form-item" wx:if="{{type == 1}}">
<view class="form-item-nav">看房日期</view>
<view class="form-item-content">{{time}}</view>
</view>
</view>
<image src="http://sm-web.meiqicloud.com/userfiles/appResources/appointment/night/ornament-1.png" class="thanks"></image>
</view>
<view class="custom" bindtap="showHotline">客服咨询</view>
</view>
</view>
<!-- 客服热线 -->
<l-arc-popup show="{{hotline}}" arc-radius="30">
<view class="phone">{{phone}}</view>
<view class="call" bindtap="call">呼叫</view>
<view style="height:10rpx;background-color:rgb(246,247,249);"></view>
<view class="call" bindtap="cancel">取消</view>
</l-arc-popup>
\ No newline at end of file
/* pages/home/home/home.wxss */ /* pages/hotelAccommodation/hotelAccommodation.wxss */
\ No newline at end of file
.Img {
position: absolute;
z-index: -2;
width: 100%;
height: 1624rpx;
}
.bgcImg {
width: 100%;
height: 316rpx;
}
.appiont-container {
width: 622rpx;
padding-top: 224rpx;
margin: auto;
position: relative;
z-index: 0;
}
.form {
width: 100%;
height: auto;
position: relative;
height: 780rpx;
margin-top: -5rpx;
overflow: hidden;
}
.card {
width: 100%;
height: 1096rpx;
position: absolute;
z-index: -1;
top: -316rpx;
}
.title {
height: 50rpx;
margin-top: 50rpx;
margin-bottom: 94rpx;
}
.form-content {
width: 494rpx;
margin: auto;
}
.form-item {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 48rpx;
}
.form-item-nav {
width: 120rpx;
height: 40rpx;
line-height: 40rpx;
text-align: justify;
text-align-last: justify;
font-size: 30rpx;
color: rgba(149, 157, 169, 1);
}
.form-item-nav::after {
content: "";
display: inline-block;
width: 100%;
height: 0;
}
.form-item-content {
width: 310rpx;
font-size: 30rpx;
font-weight: 400;
color: rgba(21, 25, 31, 1);
}
.thanks {
width: 462rpx;
height: 22rpx;
position: absolute;
bottom: 56rpx;
left: 76rpx;
}
.icon {
width: 170rpx;
height: 52rpx;
position: absolute;
top: 210rpx;
right: 46rpx;
z-index: 10;
}
.custom {
width: 622rpx;
height: 96rpx;
background: rgba(134, 197, 225, 1);
border-radius: 4px;
margin-top: 72rpx;
line-height: 96rpx;
text-align: center;
color: rgba(255, 255, 255, 1);
margin-bottom: 68rpx;
}
.phone {
height: 85rpx;
text-align: center;
color: rgb(160, 157, 160);
line-height: 85rpx;
}
.call {
height: 125rpx;
text-align: center;
line-height: 125rpx;
font: 30rpx;
}
...@@ -85,6 +85,7 @@ Page({ ...@@ -85,6 +85,7 @@ Page({
winButtonPay: false, // 立即支付 winButtonPay: false, // 立即支付
winButtonAppointment: false, // 确认预约 winButtonAppointment: false, // 确认预约
winNoticeDetail: false, // 购买须知详情 winNoticeDetail: false, // 购买须知详情
winActivityResult: false, // 活动报名结果
stockList: [], stockList: [],
winStockTip: false, winStockTip: false,
...@@ -268,7 +269,7 @@ Page({ ...@@ -268,7 +269,7 @@ Page({
winButtonPay: false, // 立即支付 winButtonPay: false, // 立即支付
winButtonAppointment: true, // 确认预约 winButtonAppointment: true, // 确认预约
}) })
this.setStock() this.setEntryTime()
break break
} }
...@@ -383,7 +384,7 @@ Page({ ...@@ -383,7 +384,7 @@ Page({
}, },
/** /**
* 设置活动场次时间 * 活动 - 设置活动场次时间
* @function * @function
* @param * @param
* @returns * @returns
...@@ -428,33 +429,44 @@ Page({ ...@@ -428,33 +429,44 @@ Page({
} }
this.setData({ this.setData({
entryId: funcDate[0][0].id,
entryDate: funcDate, entryDate: funcDate,
entrySelection: funcDateList[0] + ' ' + funcTimeList[0][0], entrySelection: funcDateList[0] + ' ' + funcTimeList[0][0],
entryDateList: [funcDateList, funcTimeList[0]], entryDateList: [funcDateList, funcTimeList[0]],
entryTimeList: funcTimeList, entryTimeList: funcTimeList,
quantityTipNumber: funcDate[0][0].residue
quantityTipNumber: funcDate[0][0].residue,
quantityMax: funcDate[0][0].residue < 3 ? funcDate[0][0].residue : 3,
quantityMin: 1,
}) })
console.log(this.dat.entryDate)
} }
}) })
}, },
/** /**
* 选择数值事件 * 活动 - 选择数值事件
* @function * @function
* @param * @param
* @returns * @returns
*/ */
onEntryTime: function (event) { onEntryTime: function (event) {
let funcIndex = event.detail.value let funcIndex = event.detail.value
let funcStock = this.data.entryDate[funcIndex[0]][funcIndex[1]].residue
this.setData({ this.setData({
entrySelection: this.data.entryDateList[0][funcIndex[0]] + ' ' + this.data.entryTimeList[this.data.entryDateIndex][funcIndex[1]], entrySelection: this.data.entryDateList[0][funcIndex[0]] + ' ' + this.data.entryTimeList[this.data.entryDateIndex][funcIndex[1]],
entryId: this.data.entryDate[funcIndex[0]][funcIndex[1]].id, entryId: this.data.entryDate[funcIndex[0]][funcIndex[1]].id,
quantityTipNumber: this.data.entryDate[funcIndex[0]][funcIndex[1]].residue
quantityTipNumber: funcStock,
quantityMax: funcStock < 3 ? funcStock : 3,
quantityMin: 1,
quantity: 1,
}) })
}, },
/** /**
* 选择滚动事件 * 活动 - 选择滚动事件
* @function * @function
* @param * @param
* @returns * @returns
...@@ -476,6 +488,18 @@ Page({ ...@@ -476,6 +488,18 @@ Page({
}, },
/** /**
* 活动 - 报名完成
* @function
* @param
* @returns
*/
onEntryComplete: function () {
wx.reLaunch({
url: '/pages/mine/appointment/appointment?fromPage=pay'
})
},
/**
* 同步库存信息 * 同步库存信息
* @function * @function
* @param * @param
...@@ -659,10 +683,24 @@ Page({ ...@@ -659,10 +683,24 @@ Page({
* @returns * @returns
*/ */
onQuantityAdd: function () { onQuantityAdd: function () {
console.log('onQuantityAdd', this.data.quantityMax)
// 购买数量最大为 20 // 购买数量最大为 20
if (this.data.quantity >= this.data.quantityMax) { if (this.data.quantity >= this.data.quantityMax) {
// 针对不同商品类型订制提示语
let funcErrorMessage = ''
switch (logicData.option.type) {
case 6:
case 7:
if (this.data.quantity > 3) funcErrorMessage = '每个账号最多报名3人'
if (this.data.quantity < 3) funcErrorMessage = '没有更多报名名额了'
break
default:
funcErrorMessage = '已达数量购买上限'
}
this.setData({ this.setData({
quantityError: '已达数量购买上限', quantityError: funcErrorMessage,
}) })
return return
} }
...@@ -755,6 +793,19 @@ Page({ ...@@ -755,6 +793,19 @@ Page({
isPaySubmit: true, isPaySubmit: true,
}) })
switch (logicData.option.type) {
case 6:
case 7:
this.paySubmitActivity()
break
default:
this.paySubmitCommodity()
break
}
},
paySubmitCommodity: function () {
// 整合商品数据 // 整合商品数据
let funcCommodity = [] let funcCommodity = []
let funcShoppingCartList = this.data.shoppingCartList let funcShoppingCartList = this.data.shoppingCartList
...@@ -803,9 +854,18 @@ Page({ ...@@ -803,9 +854,18 @@ Page({
'goodType': this.data.shopInfo.shopType, 'goodType': this.data.shopInfo.shopType,
}, },
success: (response) => { success: (response) => {
console.log('------------------') if (/ 商品不存在/.test(response.data.msg)) {
console.log(response) wx.lin.showToast({
title: '商品已下架,请重新下单。',
icon: 'error',
success: () => {
wx.navigateBack({
delta: 2
})
}
})
return
}
if (/价格不一致/.test(response.data.msg)) { if (/价格不一致/.test(response.data.msg)) {
wx.lin.showToast({ wx.lin.showToast({
...@@ -895,7 +955,84 @@ Page({ ...@@ -895,7 +955,84 @@ Page({
}) })
}, },
paySubmitActivity: function () {
App.wxRequest({
url: '/api/v1/activity/doActivityEnroll',
data: {
'activityId': this.data.shoppingCartList[0].id,
'activityTimesId': this.data.entryId,
'enrollNum': this.data.quantity,
'name': this.data.registerInfo[0].name,
'mobile': this.data.registerInfo[0].phone,
},
success: (response) => {
console.log('/api/v1/activity/doActivityEnroll')
console.log(response)
if (/请勿重复报名/.test(response.data.msg)) {
wx.lin.showToast({
title: response.data.msg,
icon: 'error',
})
this.setData({
isPaySubmit: false,
})
return
}
// 库存充足正常下单支付
let funcResponse = response.data
pagePayId = funcResponse.orderId
console.log(pagePayId)
this.setData({
orderId: pagePayId
})
// 支付金额为零,默认支付成功
if (Number(this.data.payAmount) === 0) {
this.payStatus(true)
return
}
wx.requestPayment({
'timeStamp': funcResponse.timeStamp,
'nonceStr': funcResponse.nonceStr,
'package': funcResponse.package,
'signType': funcResponse.signType,
'paySign': funcResponse.paySign,
success: (response) => {
console.log('active requestPayment')
if (response.errMsg === 'requestPayment:ok') {
// 用户点击支付完成按钮回调
// this.payStatus(true)
}
if (response.errMsg === 'requestPayment:fail cancel') {
clearInterval(App.globalData.payStateTimer)
this.payStatus(false)
}
},
fail: (response) => {
clearInterval(App.globalData.payStateTimer)
this.payStatus(false)
}
})
// 开启支付状态轮询
// wx.showLoading({ title: '正在获取数据', mask: true })
this.queryPayStatus(pagePayId)
},
fail: (error) => {
this.setData({
isPaySubmit: true,
})
}
})
},
queryPayStatus: function () { queryPayStatus: function () {
console.log('queryPayStatus')
let funcIndex = 0 let funcIndex = 0
App.globalData.payStateTimer = setInterval(() => { App.globalData.payStateTimer = setInterval(() => {
...@@ -928,15 +1065,29 @@ Page({ ...@@ -928,15 +1065,29 @@ Page({
* @returns * @returns
*/ */
payStatus: function (funcPayResult) { payStatus: function (funcPayResult) {
console.log('payStatus', funcPayResult)
console.log('payStatus', logicData.option.type)
clearInterval(App.globalData.payStateTimer) clearInterval(App.globalData.payStateTimer)
this.setData({ this.setData({
isPaySubmit: false, isPaySubmit: false,
}) })
if (funcPayResult) { if (funcPayResult) {
// 支付成功进入成功页面 switch (logicData.option.type) {
wx.reLaunch({ case 6:
url: '/pages/pay/order-state/order-state?state=' + funcPayResult + '&amount=' + this.data.buyContentAmount + '&orderId=' + this.data.orderId case 7:
}) this.setData({
winActivityResult: true
})
break
default:
// 支付成功进入成功页面
wx.reLaunch({
url: '/pages/pay/order-state/order-state?state=' + funcPayResult + '&amount=' + this.data.buyContentAmount + '&orderId=' + this.data.orderId
})
break
}
} else { } else {
// 取消支付直接进入订单 // 取消支付直接进入订单
wx.reLaunch({ wx.reLaunch({
......
...@@ -110,10 +110,10 @@ ...@@ -110,10 +110,10 @@
<!-- 电影 --> <!-- 电影 -->
<view class="buy-content-activity row align-c" wx:if="{{orderType === 7}}"> <view class="buy-content-activity row align-c" wx:if="{{orderType === 7}}">
<image src="{{resourcesBase + shopInfo.cover}}"></image> <image src="{{shoppingCartList[0].cover}}"></image>
<view class="buy-content-activity-info col con-b"> <view class="buy-content-activity-info col con-b">
<view class="title"> <view class="title">
<text>{{buyContentTitle}}</text> <text>{{shoppingCartList[0].name}}</text>
</view> </view>
<view class="time"> <view class="time">
<text>{{buyContentTime}}</text> <text>{{buyContentTime}}</text>
...@@ -274,6 +274,14 @@ ...@@ -274,6 +274,14 @@
</view> </view>
</view> </view>
<!-- winActivityResult -->
<view class="entry-complete row con-c align-c" wx:if="{{winActivityResult}}">
<view class="entry-complete-tip">
<image src="./image/tip.png"></image>
<l-button l-class="button" plain="{{true}}" bind:lintap="onEntryComplete">我知道了</l-button>
</view>
</view>
<!-- winButtonPay --> <!-- winButtonPay -->
<cover-view class="pay" wx:if="{{winButtonPay && !winNoticeDetail && !winStockTip}}"> <cover-view class="pay" wx:if="{{winButtonPay && !winNoticeDetail && !winStockTip}}">
<cover-view class="pay-tip row align-c"> <cover-view class="pay-tip row align-c">
...@@ -288,7 +296,7 @@ ...@@ -288,7 +296,7 @@
<!-- winButtonAppointment --> <!-- winButtonAppointment -->
<cover-view class="appointment row con-c align-c" wx:if="{{winButtonAppointment && !winNoticeDetail}}"> <cover-view class="appointment row con-c align-c" wx:if="{{winButtonAppointment && !winNoticeDetail}}">
<cover-view class="appointment-confirm row con-c align-c">确认预约</cover-view> <cover-view class="appointment-confirm row con-c align-c" bindtap="paySubmitActivity">确认预约</cover-view>
</cover-view> </cover-view>
<!-- 购买须知详情 --> <!-- 购买须知详情 -->
......
...@@ -989,4 +989,38 @@ ...@@ -989,4 +989,38 @@
font-weight: 400; font-weight: 400;
line-height: 42rpx; line-height: 42rpx;
color: #15191F; color: #15191F;
}
/* 预约完成 */
.entry-complete {
z-index: 1900;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.65);
}
.entry-complete-tip {
position: relative;
width: 606rpx;
height: 840rpx;
}
.entry-complete-tip image {
width: 606rpx;
height: 840rpx;
}
.entry-complete .button {
position: absolute;
bottom: 64rpx;
left: 88rpx;
width: 432rpx;
height: 80rpx;
border: 1px #15191f solid;
border-radius: 2px;
color: #15191f;
background: #fefcf9;
} }
\ No newline at end of file
...@@ -183,6 +183,8 @@ Page({ ...@@ -183,6 +183,8 @@ Page({
}, },
// 跳转到报名页面 // 跳转到报名页面
onReportMovie: function (event) { onReportMovie: function (event) {
console.log(event)
let id = event.currentTarget.dataset.movieid let id = event.currentTarget.dataset.movieid
wx.navigateTo({ wx.navigateTo({
url: '/pages/pay/order-input/order-input?type=' + '7' + '&id=' + id, url: '/pages/pay/order-input/order-input?type=' + '7' + '&id=' + id,
......
...@@ -471,33 +471,56 @@ Page({ ...@@ -471,33 +471,56 @@ Page({
}, },
success: (response) => { success: (response) => {
let funcResponse = response.data.list let funcResponse = response.data.list
let funcList = [] let funcCommodityList = []
for (let i = 0, l = funcResponse.length; i < l; i++) { for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = { let funcItem = {
'name': funcResponse[i].activityId, 'id': funcResponse[i].activityId, // 商品标识
'typeId': 7, // 商品类别标识
'sidebarId': '',
'name': funcResponse[i].filmName,
'cover': funcResponse[i].cover, // 商品封面
'price': funcResponse[i].visitorPrice, // 普通价
'priceText': App.modular.utils.formatAmount(funcResponse[i].visitorPrice), // 普通价文本格式
'priceSpecial': funcResponse[i].ownerPrice, // 业主价
'priceSpecialText': App.modular.utils.formatAmount(funcResponse[i].ownerPrice), // 业主价文本格式
'priceDiscount': funcResponse[i].price, // 活动价
'priceDiscountText': App.modular.utils.formatAmount(funcResponse[i].price), // 活动价文本格式
'priceType': 1,
'describe': funcResponse[i].synopsis,
'describeDetail': '', // 商品描述详情,在点击详情时获得数据
'dateBegin': funcResponse[i].beginDate, 'dateBegin': funcResponse[i].beginDate,
'dateEnd': funcResponse[i].endDate, 'dateEnd': funcResponse[i].endDate,
'cover': funcResponse[i].cover,
'movieDirector': funcResponse[i].filmDirector, 'movieDirector': funcResponse[i].filmDirector,
'movieLeader': funcResponse[i].filmLead, 'movieLeader': funcResponse[i].filmLead,
'movieName': funcResponse[i].filmName, 'movieName': funcResponse[i].filmName,
'movieType': funcResponse[i].filmType, 'movieType': funcResponse[i].filmType,
'movieKeyWord': funcResponse[i].keyword, 'movieKeyWord': funcResponse[i].keyword,
'movieLeader': funcResponse[i].filmLead,
'price': funcResponse[i].visitorPrice, // 普通价
'priceText': App.modular.utils.formatAmount(funcResponse[i].visitorPrice), // 普通价文本格式
'priceSpecial': funcResponse[i].ownerPrice, // 业主价
'priceSpecialText': App.modular.utils.formatAmount(funcResponse[i].ownerPrice), // 业主价文本格式
'priceType': 1,
'tagsId': funcResponse[i].tagIds, 'tagsId': funcResponse[i].tagIds,
'tags': funcResponse[i].tags.split(' '), 'tags': funcResponse[i].tags.split(' '),
} }
let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
if (funcItem.priceDiscount) {
funcItem.priceType = 1
} else {
// 活动价不存在,进一步判断普通价与业主价是否一致,如果不一致,则显示两者
if (funcItem.price !== funcItem.priceSpecial && funcUserType) {
funcItem.priceType = 2
} else {
funcItem.priceType = 3
}
}
if (funcItem.tagsId.includes('102')) { if (funcItem.tagsId.includes('102')) {
funcList.push(funcItem) funcCommodityList.push(funcItem)
} }
funcCommodityList.push(funcItem)
} }
this.setData({ this.setData({
detailCommodity: funcList detailCommodity: funcCommodityList
}) })
} }
}) })
......
...@@ -323,7 +323,7 @@ ...@@ -323,7 +323,7 @@
<text>免费</text> <text>免费</text>
</view> </view>
<view> <view>
<button class="row con-c align-c">报名观影</button> <button class="row con-c align-c" data-item="{{item}}" bindtap="onBuy">报名观影</button>
</view> </view>
</view> </view>
</view> </view>
......
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 sign in to comment