Browse Source

酒店预定

tanyanfei 4 years ago
parent
commit
1d503ba9b1
4 changed files with 29 additions and 7 deletions
  1. 0 1
      app.json
  2. 13 3
      pages/hotel/hotel.js
  3. 5 3
      pages/hotel/hotel.wxml
  4. 11 0
      pages/hotel/hotel.wxss

+ 0 - 1
app.json

@@ -3,7 +3,6 @@
     
     "pages/mine/mine",
     "pages/hotel/hotel",
-    "pages/verify/verify",
     "pages/index/index",
     "pages/order/order",
     "pages/eventDetail/eventDetail",

+ 13 - 3
pages/hotel/hotel.js

@@ -10,7 +10,8 @@ Page({
     info:{},
     aid:'',
     data:{},
-    date:''
+    date:'',
+    show:0
   },
 
   /**
@@ -32,8 +33,7 @@ Page({
       success: res => {
         wx.hideNavigationBarLoading();
         this.setData({
-          info: res.data.data,
-          data: res.data.data.rooms[0]
+          info: res.data.data
         })
       },
       fail: function () {
@@ -45,6 +45,13 @@ Page({
       }
     })
   },
+  show_order:function(e){
+    var i = e.target.dataset.id;
+    this.setData({
+      show:1,
+      data:this.data.info.rooms[i]
+    })
+  },
   order:function(e){
     var data={};
     data.hotel_id=this.data.info.id;
@@ -59,6 +66,9 @@ Page({
           wx.showToast({
             title: '预定成功',
           })
+          this.setData({
+            show: 0
+          })
         } else {
           wx.showToast({
             title: '提交失败',

+ 5 - 3
pages/hotel/hotel.wxml

@@ -14,12 +14,12 @@
             <text style="color:#999;">{{item.room_area}}m²   {{item.food_condition}}   {{item.floor}}层   {{item.enable_number}}人入住    </text>
             <text>{{item.unit_price}}元</text>
             <text>剩余数量:{{item.room_number}}</text>
-            <view bindtap="order" data-id='{{item.id}}' class="btn">预定</view>
+            <view bindtap="show_order" data-id='{{index}}' class="btn">预定</view>
         </view>
     </view>
 </view>
 
-<view class="bg">
+<view class="bg" wx:if='{{show}}'>
   <view class="room">  
       <text class="room_title">{{data.name}}</text>
       <image src="{{data.img}}"></image>
@@ -50,7 +50,9 @@
                {{date}}
             </view>
           </picker>
-          </view>
+        </view>
+
       </view>
+      <view bindtap="order" data-id='{{data.id}}' class="order">预定</view>
   </view>
 </view>

+ 11 - 0
pages/hotel/hotel.wxss

@@ -139,3 +139,14 @@ picker{
   position: relative;
   top: 4px;
 }
+.order{
+  display: block;
+  width: 100%;
+  height: 56rpx;
+  background: #3780CD;
+  border-radius: 6px;
+  text-align: center;
+  line-height: 60rpx;
+  color: #fff;
+  font-size: 26rpx;
+}