tanyanfei 3 years ago
parent
commit
937f1615b8
5 changed files with 58 additions and 10 deletions
  1. 29 2
      pages/hotel/hotel.js
  2. 12 4
      pages/hotel/hotel.wxml
  3. 13 2
      pages/hotel/hotel.wxss
  4. 3 1
      pages/order/hotel.js
  5. 1 1
      pages/order/hotel.wxml

+ 29 - 2
pages/hotel/hotel.js

@@ -15,7 +15,9 @@ Page({
     s_time:'',
     e_time:'',
     room_nums:'',
-    success:false
+    success:false,
+    start:'',
+    end:''
   },
 
   /**
@@ -29,6 +31,20 @@ Page({
       aid: Number(options.aid)
     })
     wx.request({
+      url: host + '/api/detail',
+      method: 'GET',
+      data: {
+        type: 'conference',
+        id: options.huiyi_id,
+      },
+      success:res=>{
+        this.setData({
+          start: res.data.data.begin_time.split(' ')[0],
+          end: res.data.data.end_time.split(' ')[0]
+        })
+      }
+    })
+    wx.request({
       url: host + '/api/signup/hotel',
       method: 'GET',
       data: {
@@ -49,11 +65,22 @@ Page({
       }
     })
   },
+  close(){
+    this.setData({
+      show: 0
+    })
+  },
   show_order:function(e){
     var i = e.target.dataset.id;
+    var data = this.data.info.rooms[i]
+    var num = data.enable_number,nums=[];
+    for(let i=1;i<=num;i++){
+      nums.push(i)
+    }
+    data.nums = nums
     this.setData({
       show:1,
-      data:this.data.info.rooms[i]
+      data: data
     })
   },
   bindDateChange:function(e){

+ 12 - 4
pages/hotel/hotel.wxml

@@ -23,6 +23,7 @@
 
 <view class="bg" wx:if='{{show}}'>
   <view class="room">  
+      <icon bindtap="close" class="icon-small" type="cancel" size="23"></icon>
       <text class="room_title">{{data.name}}</text>
       <image src="{{data.img}}"></image>
       <view class="room_item">
@@ -32,12 +33,18 @@
           <view><text>床型:{{data.name}}</text><text>窗户:{{data.window_condition}}</text></view>
           <view><text>餐食:{{data.food_condition}}</text><text>房价:{{data.unit_price}}元</text></view>
       </view>
-      <view class="room_item" style="padding-bottom:0;">
-        <label>入住人数: </label><input bindinput="bindinputChange"></input>
+      <view class="room_item" style="padding:20rpx 10rpx;">
+        <label>入住人数: </label>
+        <radio-group class='rs' bindchange="bindinputChange">
+          <label class="radio" wx:for='{{data.nums}}'>
+            <radio value="{{item}}" />{{item}}人
+          </label>
+        </radio-group>
+        <!-- <input type="number" bindinput="bindinputChange"></input> -->
       </view>
       <view class="room_item">
         <view><label>入住时间: </label>
-          <picker mode="date" value="{{s_time}}" start="2021-01-01" bindchange="bindDateChange">
+          <picker mode="date" value="{{s_time}}" start="{{start}}"  end='{{end}}'  bindchange="bindDateChange">
             <view class="picker">
               <text wx:if='{{!s_time}}'>请选择</text>
                {{s_time}}
@@ -46,7 +53,8 @@
         </view>
         <view>
           <label>离开时间: </label>
-          <picker mode="date" value="{{e_time}}" start="2021-01-01" bindchange="bindDateChange1">
+          <picker mode="date" value="{{e_time}}" start="{{start}}" 
+          end='{{end}}' bindchange="bindDateChange1">
             <view class="picker">
               <text wx:if='{{!e_time}}'>请选择</text>
                {{e_time}}

+ 13 - 2
pages/hotel/hotel.wxss

@@ -98,6 +98,7 @@ page{
 .room_title{
   display: block;
   text-align: center;
+  margin-bottom: 10px;
 }
 .room image{
   width: 100%;
@@ -118,7 +119,7 @@ page{
 }
 .room_item text{
   width: 50%;
-  font-size: 22rpx;
+  font-size: 24rpx;
   color: #666;
 }
 .room_item input{
@@ -138,8 +139,10 @@ picker{
   font-size: 24rpx;
   width: 50%;
   position: relative;
-  top: 4px;
+  top: 1px;
 }
+
+
 .order{
   display: block;
   width: 100%;
@@ -175,4 +178,12 @@ picker{
   line-height: 90rpx;
   padding: 0;
   border-radius: 18rpx;
+}
+.icon-small{
+  float: right;
+}
+.rs{
+  display: inline-block;
+  width: 80%;
+
 }

+ 3 - 1
pages/order/hotel.js

@@ -8,6 +8,7 @@ Page({
    */
   data: {
     act: 0,
+    huiyi_id:'',
     aid:'',   //报名id
   },
 
@@ -16,7 +17,8 @@ Page({
    */
   onLoad: function (options) {
     this.setData({
-      aid: options.aid
+      aid: options.aid,
+      huiyi_id: options.id
     })
     wx.showNavigationBarLoading()
     wx.request({

+ 1 - 1
pages/order/hotel.wxml

@@ -1,5 +1,5 @@
 <view class="content">
-    <navigator class="list" wx:for='{{list}}' url="../hotel/hotel?aid={{aid}}&id={{item.id}}">
+    <navigator class="list" wx:for='{{list}}' url="../hotel/hotel?aid={{aid}}&id={{item.id}}&huiyi_id={{huiyi_id}}">
         <image src="{{item.imgs}}"></image>
         <view>
             <view class="title">{{item.name}}</view>