Commit ddf48d6b by TengFengLian

预约看房/入园接口

parent e44907b9
...@@ -47,20 +47,6 @@ ...@@ -47,20 +47,6 @@
</view> </view>
<view class="row align-c"> <view class="row align-c">
<view class="input-label row align-c"> <view class="input-label row align-c">
<text space="ensp">报名人数</text>
</view>
<view class="input-wrap row con-b align-c">
<l-button special="{{true}}" bind:lintap="onQuantityCut">
<image class="input-icon" src="../../image/cut.png"></image>
</l-button>
<text>{{formInto.quantity}}</text>
<l-button special="{{true}}" bind:lintap="onQuantityAdd">
<image class="input-icon" src="../../image/add.png"></image>
</l-button>
</view>
</view>
<view class="row align-c">
<view class="input-label row align-c">
<text space="ensp">报名时间</text> <text space="ensp">报名时间</text>
</view> </view>
<view class="input-wrap row con-b align-c"> <view class="input-wrap row con-b align-c">
...@@ -74,6 +60,20 @@ ...@@ -74,6 +60,20 @@
<image class="input-icon" src="../../image/more.png"></image> <image class="input-icon" src="../../image/more.png"></image>
</view> </view>
</view> </view>
<view class="row align-c">
<view class="input-label row align-c">
<text space="ensp">报名人数</text>
</view>
<view class="input-wrap row con-b align-c">
<l-button special="{{true}}" bind:lintap="onQuantityCut">
<image class="input-icon" src="../../image/cut.png"></image>
</l-button>
<text>{{formInto.quantity}}</text>
<l-button special="{{true}}" bind:lintap="onQuantityAdd">
<image class="input-icon" src="../../image/add.png"></image>
</l-button>
</view>
</view>
</view> </view>
<view class="entry-operation"> <view class="entry-operation">
......
import iMiment from '../../npm/miment.js' import iMiment from '../../npm/miment.js'
const app = getApp()
Page({ Page({
data: { data: {
...@@ -17,6 +18,9 @@ Page({ ...@@ -17,6 +18,9 @@ Page({
isSubmit: false, isSubmit: false,
winQuota: false, winQuota: false,
// 预约入园剩余名额
total: 0,
}, },
onLoad: function (options) { onLoad: function (options) {
...@@ -35,6 +39,9 @@ Page({ ...@@ -35,6 +39,9 @@ Page({
formDate: funcDate, formDate: funcDate,
appointmentDate: funcDate, appointmentDate: funcDate,
}) })
if (this.data.formType === 1) { // 入园预约
this.getResidue()
}
}, },
onServic: function () { onServic: function () {
...@@ -71,26 +78,38 @@ Page({ ...@@ -71,26 +78,38 @@ Page({
errorQuantity: '', errorQuantity: '',
}) })
} }
this.inspectForm()
}, },
onQuantityAdd: function () { onQuantityAdd: function () {
if (this.data.formQuantity < 5) { if (this.data.total*1 == 0) {
this.setData({ this.setData({
formQuantity: this.data.formQuantity + 1, errorQuantity: '所选日期预约名额已满'
errorQuantity: '',
}) })
} else { } else if (this.data.formQuantity >= this.data.total*1) {
this.setData({
errorQuantity: '所选日期预约的名额仅剩' + activityTime.residue + '人'
})
} else if (this.data.formQuantity >= 5) {
this.setData({ this.setData({
errorQuantity: '每个账号最多预约5人' errorQuantity: '每个账号最多预约5人'
}) })
} else {
this.setData({
formQuantity: this.data.formQuantity + 1,
errorQuantity: '',
})
this.inspectForm()
} }
}, },
onSelectionDate: function (event) { onSelectionDate: function (event) {
this.setData({ this.setData({
formDate: event.detail.value, formDate: event.detail.value,
winQuota: true
}) })
if (this.data.formType === 1) { // 入园预约
this.getResidue()
}
}, },
inspectForm: function () { inspectForm: function () {
...@@ -112,6 +131,12 @@ Page({ ...@@ -112,6 +131,12 @@ Page({
errorPhone: '请输入手机号码' errorPhone: '请输入手机号码'
}) })
return return
} else if (this.data.formPhone.length != 11) {
this.setData({
isSubmit: false,
errorPhone: '请输入11位手机号码'
})
return
} else { } else {
this.setData({ this.setData({
errorPhone: '' errorPhone: ''
...@@ -133,6 +158,7 @@ Page({ ...@@ -133,6 +158,7 @@ Page({
this.setData({ this.setData({
isSubmit: true isSubmit: true
}) })
}, },
onSubmit: function () { onSubmit: function () {
...@@ -140,10 +166,37 @@ Page({ ...@@ -140,10 +166,37 @@ Page({
this.inspectForm() this.inspectForm()
return return
} }
this.setData({ wx.lin.showToast({
appointmentComplete: true icon: 'loading',
title: '提交中',
show: true,
})
let that = this
app.wxRequest({
url: '/api/v1/subscribe/doSubscribe',
data: {
mobile: that.data.formPhone,
subscribeNum: that.data.formQuantity,
subscribeDate: that.data.formDate + ' 00:00:00',
name: that.data.formName,
type: this.data.formType === 1 ? 0 : 1,
},
success: function(res) {
that.setData({
appointmentComplete: true
})
wx.lin.hideToast()
},
fail: function(err) {
wx.lin.hideToast()
wx.lin.showToast({
icon: 'error',
title: err.msg,
})
}
}) })
}, },
onAppointmentComplete: function () { onAppointmentComplete: function () {
...@@ -154,4 +207,25 @@ Page({ ...@@ -154,4 +207,25 @@ Page({
delta: 1 delta: 1
}) })
}, },
// 预约入园查询返回剩余名额
getResidue() {
var that = this
app.wxRequest({
url: '/api/v1/subscribe/getResidue',
data: {
subscribeDate: that.data.formDate + ' 00:00:00',
type: 0,
},
success: function(res) {
that.setData({
total: res.data.total,
winQuota: true,
})
}
})
},
}) })
\ No newline at end of file
<l-toast></l-toast>
<!-- 首页 - 入园预约 / 房屋预约 --> <!-- 首页 - 入园预约 / 房屋预约 -->
<navigation class="navigation" backIcon="/image/back-w.png"></navigation> <navigation class="navigation" backIcon="/image/back-w.png"></navigation>
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
<text>名</text> <text>名</text>
</view> </view>
<view class="input-wrap row align-c"> <view class="input-wrap row align-c">
<input class="text" placeholder-class="input-tip" placeholder="请输入名字" data-type="name" bindblur="onInputBlur"></input> <input maxlength="16" class="text" placeholder-class="input-tip" placeholder="请输入名字" data-type="name" bindblur="onInputBlur"></input>
</view> </view>
</view> </view>
<view class="form-error row align-c"> <view class="form-error row align-c">
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
<text>号</text> <text>号</text>
</view> </view>
<view class="input-wrap row align-c"> <view class="input-wrap row align-c">
<input class="text" placeholder-class="input-tip" placeholder="请输入手机号" data-type="phone" bindblur="onInputBlur"></input> <input maxlength="11" type="number" class="text" placeholder-class="input-tip" placeholder="请输入手机号" data-type="phone" bindblur="onInputBlur"></input>
</view> </view>
</view> </view>
<view class="form-error row align-c"> <view class="form-error row align-c">
...@@ -89,7 +90,7 @@ ...@@ -89,7 +90,7 @@
</view> </view>
<view class="quota row con-e align-c" hidden="{{!winQuota}}"> <view class="quota row con-e align-c" hidden="{{!winQuota}}">
<text>剩余名额:</text> <text>剩余名额:</text>
<text>100</text> <text>{{total}}人</text>
</view> </view>
</view> </view>
...@@ -122,7 +123,7 @@ ...@@ -122,7 +123,7 @@
</view> </view>
</view> </view>
<view class="form-error row align-c"> <view class="form-error row align-c">
<text hidden="{{errorName ? false : true}}">{{errorName}}</text> <text maxlength="16" hidden="{{errorName ? false : true}}">{{errorName}}</text>
</view> </view>
<!-- 手机输入 --> <!-- 手机输入 -->
...@@ -133,7 +134,7 @@ ...@@ -133,7 +134,7 @@
<text>号</text> <text>号</text>
</view> </view>
<view class="input-wrap row align-c"> <view class="input-wrap row align-c">
<input class="text" placeholder-class="input-tip" placeholder="请输入手机号" data-type="phone" bindblur="onInputBlur"></input> <input maxlength="11" type="number" class="text" placeholder-class="input-tip" placeholder="请输入手机号" data-type="phone" bindblur="onInputBlur"></input>
</view> </view>
</view> </view>
<view class="form-error row align-c"> <view class="form-error row align-c">
......
...@@ -241,16 +241,19 @@ Page({ ...@@ -241,16 +241,19 @@ Page({
}) })
if (res.data.list.length > 0) { if (res.data.list.length > 0) {
let count = that.data.strategyList.length
let tempArray = [] let tempArray = []
res.data.list.forEach(item => { for(let i = 0; i < res.data.list.length; i++) {
let item = res.data.list[i]
let strategy = { let strategy = {
id: item.id, id: item.id,
image: item.cover, image: item.cover,
title: item.title, title: item.title,
date: item.updateDate, date: item.updateDate,
index: count + i - 1,
} }
tempArray.push(strategy) tempArray.push(strategy)
}) }
console.log('tempArray', tempArray) console.log('tempArray', tempArray)
...@@ -271,7 +274,6 @@ Page({ ...@@ -271,7 +274,6 @@ Page({
strategyList: tempArray strategyList: tempArray
}) })
} }
// 游客攻略瀑布列表 // 游客攻略瀑布列表
wx.lin.renderWaterFlow(that.data.strategyList, false, () => {}) wx.lin.renderWaterFlow(that.data.strategyList, false, () => {})
...@@ -288,7 +290,7 @@ Page({ ...@@ -288,7 +290,7 @@ Page({
}, },
onReachBottom: function() { onReachBottom: function() {
console.log('触底啦') // console.log('触底啦')
if (this.data.loading || !this.data.moreData) { if (this.data.loading || !this.data.moreData) {
return return
} }
......
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