Commit ddf48d6b by TengFengLian

预约看房/入园接口

parent e44907b9
......@@ -47,20 +47,6 @@
</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 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">
......@@ -74,6 +60,20 @@
<image class="input-icon" src="../../image/more.png"></image>
</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 class="entry-operation">
......
import iMiment from '../../npm/miment.js'
const app = getApp()
Page({
data: {
......@@ -17,6 +18,9 @@ Page({
isSubmit: false,
winQuota: false,
// 预约入园剩余名额
total: 0,
},
onLoad: function (options) {
......@@ -35,6 +39,9 @@ Page({
formDate: funcDate,
appointmentDate: funcDate,
})
if (this.data.formType === 1) { // 入园预约
this.getResidue()
}
},
onServic: function () {
......@@ -71,26 +78,38 @@ Page({
errorQuantity: '',
})
}
this.inspectForm()
},
onQuantityAdd: function () {
if (this.data.formQuantity < 5) {
if (this.data.total*1 == 0) {
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({
errorQuantity: '每个账号最多预约5人'
})
} else {
this.setData({
formQuantity: this.data.formQuantity + 1,
errorQuantity: '',
})
this.inspectForm()
}
},
onSelectionDate: function (event) {
this.setData({
formDate: event.detail.value,
winQuota: true
})
if (this.data.formType === 1) { // 入园预约
this.getResidue()
}
},
inspectForm: function () {
......@@ -112,6 +131,12 @@ Page({
errorPhone: '请输入手机号码'
})
return
} else if (this.data.formPhone.length != 11) {
this.setData({
isSubmit: false,
errorPhone: '请输入11位手机号码'
})
return
} else {
this.setData({
errorPhone: ''
......@@ -133,6 +158,7 @@ Page({
this.setData({
isSubmit: true
})
},
onSubmit: function () {
......@@ -140,10 +166,37 @@ Page({
this.inspectForm()
return
}
this.setData({
appointmentComplete: true
wx.lin.showToast({
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 () {
......@@ -154,4 +207,25 @@ Page({
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>
......@@ -28,7 +29,7 @@
<text>名</text>
</view>
<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 class="form-error row align-c">
......@@ -43,7 +44,7 @@
<text>号</text>
</view>
<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 class="form-error row align-c">
......@@ -89,7 +90,7 @@
</view>
<view class="quota row con-e align-c" hidden="{{!winQuota}}">
<text>剩余名额:</text>
<text>100</text>
<text>{{total}}人</text>
</view>
</view>
......@@ -122,7 +123,7 @@
</view>
</view>
<view class="form-error row align-c">
<text hidden="{{errorName ? false : true}}">{{errorName}}</text>
<text maxlength="16" hidden="{{errorName ? false : true}}">{{errorName}}</text>
</view>
<!-- 手机输入 -->
......@@ -133,7 +134,7 @@
<text>号</text>
</view>
<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 class="form-error row align-c">
......
......@@ -241,16 +241,19 @@ Page({
})
if (res.data.list.length > 0) {
let count = that.data.strategyList.length
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 = {
id: item.id,
image: item.cover,
title: item.title,
date: item.updateDate,
index: count + i - 1,
}
tempArray.push(strategy)
})
}
console.log('tempArray', tempArray)
......@@ -271,7 +274,6 @@ Page({
strategyList: tempArray
})
}
// 游客攻略瀑布列表
wx.lin.renderWaterFlow(that.data.strategyList, false, () => {})
......@@ -288,7 +290,7 @@ Page({
},
onReachBottom: function() {
console.log('触底啦')
// console.log('触底啦')
if (this.data.loading || !this.data.moreData) {
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