├── .idea ├── hotel自己.iml ├── modules.xml └── vcs.xml ├── README.md ├── app.js ├── app.json ├── app.wxss ├── images ├── book.png ├── book1.png ├── home.png ├── home1.png ├── map.png ├── mine.png └── mine1.png ├── pages ├── hotel │ ├── book │ │ ├── book.js │ │ ├── book.json │ │ ├── book.wxml │ │ ├── book.wxss │ │ └── detail │ │ │ └── roomdetail │ │ │ ├── roomdetail.js │ │ │ ├── roomdetail.json │ │ │ ├── roomdetail.wxml │ │ │ └── roomdetail.wxss │ ├── home │ │ ├── detail │ │ │ └── roomdetail │ │ │ │ ├── roomdetail.js │ │ │ │ ├── roomdetail.json │ │ │ │ ├── roomdetail.wxml │ │ │ │ └── roomdetail.wxss │ │ ├── home.js │ │ ├── home.json │ │ ├── home.wxml │ │ └── home.wxss │ └── mine │ │ ├── mine.js │ │ ├── mine.json │ │ ├── mine.wxml │ │ ├── mine.wxss │ │ └── orderdetail │ │ ├── orderdetail.js │ │ ├── orderdetail.json │ │ ├── orderdetail.wxml │ │ └── orderdetail.wxss └── logs │ ├── logs.js │ ├── logs.json │ ├── logs.wxml │ └── logs.wxss ├── utils ├── data.js ├── qqmap-wx-jssdk.min.js └── util.js ├── wxParse ├── emojis │ ├── 00.gif │ ├── 01.gif │ ├── 02.gif │ ├── 03.gif │ ├── 04.gif │ ├── 05.gif │ ├── 06.gif │ ├── 07.gif │ ├── 08.gif │ ├── 09.gif │ ├── 10.gif │ ├── 100.gif │ ├── 101.gif │ ├── 102.gif │ ├── 103.gif │ ├── 104.gif │ ├── 105.gif │ ├── 106.gif │ ├── 107.gif │ ├── 108.gif │ ├── 109.gif │ ├── 11.gif │ ├── 110.gif │ ├── 111.gif │ ├── 112.gif │ ├── 113.gif │ ├── 114.gif │ ├── 115.gif │ ├── 116.gif │ ├── 117.gif │ ├── 118.gif │ ├── 119.gif │ ├── 12.gif │ ├── 120.gif │ ├── 121.gif │ ├── 122.gif │ ├── 123.gif │ ├── 124.gif │ ├── 125.gif │ ├── 126.gif │ ├── 127.gif │ ├── 128.gif │ ├── 129.gif │ ├── 13.gif │ ├── 130.gif │ ├── 131.gif │ ├── 132.gif │ ├── 133.gif │ ├── 134.gif │ ├── 14.gif │ ├── 15.gif │ ├── 16.gif │ ├── 17.gif │ ├── 18.gif │ ├── 19.gif │ ├── 20.gif │ ├── 21.gif │ ├── 22.gif │ ├── 23.gif │ ├── 24.gif │ ├── 25.gif │ ├── 26.gif │ ├── 27.gif │ ├── 28.gif │ ├── 29.gif │ ├── 30.gif │ ├── 31.gif │ ├── 32.gif │ ├── 33.gif │ ├── 34.gif │ ├── 35.gif │ ├── 36.gif │ ├── 37.gif │ ├── 38.gif │ ├── 39.gif │ ├── 40.gif │ ├── 41.gif │ ├── 42.gif │ ├── 43.gif │ ├── 44.gif │ ├── 45.gif │ ├── 46.gif │ ├── 47.gif │ ├── 48.gif │ ├── 49.gif │ ├── 50.gif │ ├── 51.gif │ ├── 52.gif │ ├── 53.gif │ ├── 54.gif │ ├── 55.gif │ ├── 56.gif │ ├── 57.gif │ ├── 58.gif │ ├── 59.gif │ ├── 60.gif │ ├── 61.gif │ ├── 62.gif │ ├── 63.gif │ ├── 64.gif │ ├── 65.gif │ ├── 66.gif │ ├── 67.gif │ ├── 68.gif │ ├── 69.gif │ ├── 70.gif │ ├── 71.gif │ ├── 72.gif │ ├── 73.gif │ ├── 74.gif │ ├── 75.gif │ ├── 76.gif │ ├── 77.gif │ ├── 78.gif │ ├── 79.gif │ ├── 80.gif │ ├── 81.gif │ ├── 82.gif │ ├── 83.gif │ ├── 84.gif │ ├── 85.gif │ ├── 86.gif │ ├── 87.gif │ ├── 88.gif │ ├── 89.gif │ ├── 90.gif │ ├── 91.gif │ ├── 92.gif │ ├── 93.gif │ ├── 94.gif │ ├── 95.gif │ ├── 96.gif │ ├── 97.gif │ ├── 98.gif │ └── 99.gif ├── html2json.js ├── htmlparser.js ├── showdown.js ├── wxDiscode.js ├── wxParse.js ├── wxParse.wxml └── wxParse.wxss └── 效果图预览 ├── 微信截图_20171011164947.png ├── 微信截图_20171011165019.png ├── 微信截图_20171011165033.png ├── 微信截图_20171011165053.png ├── 微信截图_20171011165124.png └── 微信截图_20171011175601.png /.idea/hotel自己.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hellohotel 2 | 这是一个酒店预订的小程序,支持在线下订单,在线支付,订单查看
3 | ![](https://raw.githubusercontent.com/zhoujiae/hellohotel/master/%E6%95%88%E6%9E%9C%E5%9B%BE%E9%A2%84%E8%A7%88/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20171011164947.png "效果图") 4 | ![](https://github.com/zhoujiae/hellohotel/blob/master/%E6%95%88%E6%9E%9C%E5%9B%BE%E9%A2%84%E8%A7%88/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20171011165019.png "效果图") 5 | ![](https://github.com/zhoujiae/hellohotel/blob/master/%E6%95%88%E6%9E%9C%E5%9B%BE%E9%A2%84%E8%A7%88/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20171011165033.png "效果图") 6 | ![](https://github.com/zhoujiae/hellohotel/blob/master/%E6%95%88%E6%9E%9C%E5%9B%BE%E9%A2%84%E8%A7%88/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20171011165053.png "效果图") 7 | ![](https://github.com/zhoujiae/hellohotel/blob/master/%E6%95%88%E6%9E%9C%E5%9B%BE%E9%A2%84%E8%A7%88/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20171011175601.png "效果图") 8 | ![](https://github.com/zhoujiae/hellohotel/blob/master/%E6%95%88%E6%9E%9C%E5%9B%BE%E9%A2%84%E8%A7%88/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20171011165124.png "效果图") 9 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var con = require("utils/data.js"); 2 | App({ 3 | onLaunch: function () { 4 | //调用API从本地缓存中获取数据 5 | var logs = wx.getStorageSync('logs') || [] 6 | logs.unshift(Date.now()) 7 | wx.setStorageSync('logs', logs) 8 | }, 9 | getUserInfo: function (cb) { 10 | var that = this 11 | if (this.globalData.userInfo) { 12 | typeof cb == "function" && cb(this.globalData.userInfo) 13 | } else { 14 | //调用登录接口 15 | wx.login({ 16 | success: function (o) { 17 | // console.log(o); 18 | wx.getUserInfo({ 19 | success: function (res) { 20 | wx.request({ 21 | url: con.index_slogin, 22 | method: "POST", 23 | header: { 24 | 'content-type': 'application/x-www-form-urlencoded' 25 | }, 26 | data: { 27 | code: o.code, 28 | wxappid: con.wyy_user_wxappid, 29 | nickname: res.userInfo.nickName, 30 | pic: res.userInfo.avatarUrl 31 | }, 32 | success: function (res) { 33 | console.log(res.data) 34 | console.log(res.data.openid); 35 | wx.setStorage({ 36 | key: 'openid', 37 | data: res.data.openid, 38 | }) 39 | that.globalData.openid = res.data.openid 40 | } 41 | }) 42 | 43 | that.globalData.userInfo = res.userInfo 44 | 45 | } 46 | }) 47 | } 48 | }) 49 | } 50 | }, 51 | globalData: { 52 | userInfo: null 53 | } 54 | }) -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/hotel/home/home", 4 | "pages/hotel/book/book", 5 | "pages/hotel/mine/mine", 6 | "pages/hotel/home/detail/roomdetail/roomdetail", 7 | "pages/hotel/book/detail/roomdetail/roomdetail", 8 | "pages/hotel/mine/orderdetail/orderdetail", 9 | "pages/logs/logs" 10 | ], 11 | "window": { 12 | "backgroundTextStyle": "light", 13 | "navigationBarBackgroundColor": "#fe3131", 14 | "navigationBarTitleText": "酒店", 15 | "navigationBarTextStyle": "white" 16 | }, 17 | "tabBar": { 18 | "list": [ 19 | { 20 | "pagePath": "pages/hotel/home/home", 21 | "text": "首页", 22 | "iconPath": "images/home.png", 23 | "selectedIconPath": "images/home1.png" 24 | }, 25 | { 26 | "pagePath": "pages/hotel/book/book", 27 | "text": "预订", 28 | "iconPath": "images/book.png", 29 | "selectedIconPath": "images/book1.png" 30 | }, 31 | { 32 | "pagePath": "pages/hotel/mine/mine", 33 | "text": "我的", 34 | "iconPath": "images/mine.png", 35 | "selectedIconPath": "images/mine1.png" 36 | } 37 | ], 38 | "color": "#bfbfbf", 39 | "selectedColor": "#fe3131", 40 | "backgroundColor": "white" 41 | }, 42 | "networkTimeout": { 43 | "request": 10000, 44 | "downloadFile": 10000 45 | }, 46 | "debug": true 47 | } -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | width: 100%; 3 | } -------------------------------------------------------------------------------- /images/book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhoujiae/hellohotel/58d5107f59b513139dc2150afd46d9f50ada7be8/images/book.png -------------------------------------------------------------------------------- /images/book1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhoujiae/hellohotel/58d5107f59b513139dc2150afd46d9f50ada7be8/images/book1.png -------------------------------------------------------------------------------- /images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhoujiae/hellohotel/58d5107f59b513139dc2150afd46d9f50ada7be8/images/home.png -------------------------------------------------------------------------------- /images/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhoujiae/hellohotel/58d5107f59b513139dc2150afd46d9f50ada7be8/images/home1.png -------------------------------------------------------------------------------- /images/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhoujiae/hellohotel/58d5107f59b513139dc2150afd46d9f50ada7be8/images/map.png -------------------------------------------------------------------------------- /images/mine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhoujiae/hellohotel/58d5107f59b513139dc2150afd46d9f50ada7be8/images/mine.png -------------------------------------------------------------------------------- /images/mine1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhoujiae/hellohotel/58d5107f59b513139dc2150afd46d9f50ada7be8/images/mine1.png -------------------------------------------------------------------------------- /pages/hotel/book/book.js: -------------------------------------------------------------------------------- 1 | // book.js 2 | var app = getApp(); 3 | var con = require("../../../utils/data.js"); 4 | Page({ 5 | 6 | /** 7 | * 页面的初始数据 8 | */ 9 | data: { 10 | housefenlei: [] 11 | }, 12 | 13 | /** 14 | * 生命周期函数--监听页面加载 15 | */ 16 | onLoad: function (options) { 17 | var that = this; 18 | app.getUserInfo(); 19 | wx.request({ 20 | url: con.index, 21 | data: { wxappid: con.wyy_user_wxappid}, 22 | method: 'GET', 23 | header: { 24 | "Content-Type": 'application/json' 25 | }, 26 | success: function (res) { 27 | that.setData({ 28 | // 房间信息 29 | housefenlei: res.data.house, 30 | }) 31 | console.log(res.data.house); 32 | } 33 | }); 34 | }, 35 | // 跳转订房详情 36 | go_roomdetail: function (e) { 37 | var id = e.currentTarget.dataset.id 38 | wx.navigateTo({ 39 | url: 'detail/roomdetail/roomdetail?id=' + id, 40 | }) 41 | }, 42 | /** 43 | * 用户点击右上角分享 44 | */ 45 | onShareAppMessage: function () { 46 | 47 | } 48 | }) -------------------------------------------------------------------------------- /pages/hotel/book/book.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "房间预订" 3 | } -------------------------------------------------------------------------------- /pages/hotel/book/book.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{item.guest_id}} 9 | 10 | {{item.is_tj == 1 ? "推荐" : ""}} 11 | {{item.is_state == 1 ? "正常营业" : ""}} 12 | {{item.is_wifi == 1 ? "无线" : ""}} 13 | {{item.is_window == 1 ? "有窗" : ""}} 14 | 15 | 16 | 17 | {{item.price}}元 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /pages/hotel/book/book.wxss: -------------------------------------------------------------------------------- 1 | .room { 2 | width: 96%; 3 | margin: 0 auto; 4 | display: flex; 5 | justify-content: space-around; 6 | height: 200rpx; 7 | margin-top: 30rpx; 8 | border-bottom: 5rpx solid gainsboro; 9 | } 10 | .room_img { 11 | width: 24%; 12 | vertical-align: middle; 13 | } 14 | image { 15 | width: 100%; 16 | height: 80%; 17 | } 18 | .room_info { 19 | width: 31%; 20 | vertical-align: middle; 21 | text-align: center; 22 | } 23 | .room_info1 { 24 | width: 45%; 25 | vertical-align: middle; 26 | text-align: center; 27 | } 28 | button { 29 | background: #fe3131; 30 | width: 150rpx; 31 | height: 50rpx; 32 | line-height: 50rpx; 33 | font-size: 30rpx; 34 | color: white; 35 | margin-top: 30rpx; 36 | } 37 | .room_infoname { 38 | font-weight: bold; 39 | margin-top: 20rpx; 40 | } 41 | .room_infolabel { 42 | color: gray; 43 | font-size: 25rpx; 44 | margin: 40rpx 8rpx 0; 45 | display: inline-block; 46 | } 47 | .price { 48 | color: #fe3131; 49 | margin-top: 20rpx; 50 | } 51 | -------------------------------------------------------------------------------- /pages/hotel/book/detail/roomdetail/roomdetail.js: -------------------------------------------------------------------------------- 1 | // roomdetail.js 2 | var app = getApp(); 3 | var con = require("../../../../../utils/data.js"); 4 | var openid, stat, b, c, d, stime, etime, snum, msg; 5 | Page({ 6 | 7 | /** 8 | * 页面的初始数据 9 | */ 10 | data: { 11 | housefenlei: [], 12 | date: '2017-06-10', 13 | date1: '2017-06-11', 14 | array: [1, 2, 3, 4, 5, 6, 7, 8], 15 | index: 0, 16 | openid: "", 17 | showView: true, 18 | showMine: false 19 | }, 20 | /** 21 | * 生命周期函数--监听页面加载 22 | */ 23 | onLoad: function (options) { 24 | var that = this; 25 | app.getUserInfo(); 26 | // 房间详情 27 | wx.request({ 28 | url: con.gethousebyid, 29 | data: { wxappid: con.wyy_user_wxappid, id: options.id }, 30 | method: 'GET', 31 | header: { 32 | "Content-Type": 'application/json' 33 | }, 34 | success: function (res) { 35 | b = res.data.info.guest_id, 36 | c = res.data.info.price, 37 | d = res.data.info.id, 38 | snum = res.data.info.else_num, 39 | console.log(res.data.info.guest_id) 40 | wx.getStorage({ 41 | key: 'openid', 42 | success: function (res) { 43 | 44 | // console.log(res.data); 45 | openid = res.data; 46 | that.setData({ 47 | openid: res.data 48 | }) 49 | }, 50 | }) 51 | that.setData({ 52 | // 房间信息 53 | housefenlei: res.data.info, 54 | }) 55 | console.log(res.data.info); 56 | } 57 | }); 58 | // 显示隐藏 59 | showView: (options.showView == "true" ? true : false) 60 | showMine: (options.showMine == "false" ? false : true) 61 | }, 62 | // 改变表单状态 63 | onChangeShowState: function () { 64 | var that = this; 65 | that.setData({ 66 | showView: (!that.data.showView) 67 | }) 68 | }, 69 | // 改变按钮状态 70 | changeMine: function () { 71 | var that = this; 72 | that.setData({ 73 | showMine: (!that.data.showMine) 74 | }) 75 | that.onChangeShowState() 76 | }, 77 | // 改变日期 78 | bindDateChange: function (e) { 79 | console.log('picker发送选择改变,携带值为', e.detail.value) 80 | this.setData({ 81 | date: e.detail.value 82 | }) 83 | }, 84 | bindDateChange1: function (e) { 85 | console.log('picker发送选择改变,携带值为', e.detail.value) 86 | this.setData({ 87 | date1: e.detail.value 88 | }) 89 | }, 90 | // 改变数量 91 | bindPickerChange: function (e) { 92 | console.log('picker发送选择改变,携带值为', e.detail.value) 93 | this.setData({ 94 | index: e.detail.value 95 | }) 96 | }, 97 | // 底部弹窗 98 | showModal: function () { 99 | // 显示遮罩层 100 | var animation = wx.createAnimation({ 101 | duration: 200, 102 | timingFunction: "linear", 103 | delay: 0 104 | }) 105 | this.animation = animation 106 | animation.translateY(300).step() 107 | this.setData({ 108 | animationData: animation.export(), 109 | showModalStatus: true 110 | }) 111 | setTimeout(function () { 112 | animation.translateY(0).step() 113 | this.setData({ 114 | animationData: animation.export() 115 | }) 116 | }.bind(this), 200) 117 | }, 118 | hideModal: function () { 119 | // 隐藏遮罩层 120 | var animation = wx.createAnimation({ 121 | duration: 200, 122 | timingFunction: "linear", 123 | delay: 0 124 | }) 125 | this.animation = animation 126 | animation.translateY(300).step() 127 | this.setData({ 128 | animationData: animation.export(), 129 | }) 130 | setTimeout(function () { 131 | animation.translateY(0).step() 132 | this.setData({ 133 | animationData: animation.export(), 134 | showModalStatus: false 135 | }) 136 | }.bind(this), 200) 137 | }, 138 | // 提交预订信息 139 | formSubmit: function (e) { 140 | var that = this; 141 | app.getUserInfo(); 142 | console.log(b) 143 | var a = e.detail.value; 144 | // 判断输入项是否为空 145 | console.log(a.num); 146 | console.log(snum); 147 | // var nima = parseInt(a.num); 148 | if (a.name != "" && a.phone != "" && a.num <= snum) { 149 | wx.request({ 150 | url: con.set_order, 151 | data: { 152 | wxappid: con.wyy_user_wxappid, 153 | // preid: id, 154 | name: a.name, 155 | openid: app.globalData.openid, 156 | phone: a.phone, 157 | startdate: a.kdate, 158 | enddate: a.jdate, 159 | roomnum: a.num, 160 | roomname: b, 161 | price: c, 162 | id: d 163 | }, 164 | method: 'POST', 165 | header: { 166 | "Content-Type": "application/x-www-form-urlencoded" 167 | }, 168 | success(res) { 169 | var zhifu = res.data; 170 | console.log(res.data); 171 | stat = res.data.status; 172 | msg = res.data.errMsg; 173 | console.log(msg) 174 | // 计算天数差 175 | var date1 = a.kdate; 176 | var date2 = a.jdate; 177 | var Num = a.num; 178 | var aDate, oDate1, oDate2, iDays 179 | aDate = date1.split("-") 180 | oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) //转换为12-18-2002格式 181 | aDate = date2.split("-") 182 | oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) 183 | iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) //把相差的毫秒数转换为天数 184 | // return iDays 185 | console.log(iDays); 186 | var totalNum = iDays * Num; 187 | console.log(totalNum) 188 | // 总价钱 189 | var totalPrice = totalNum * c; 190 | console.log(totalPrice) 191 | that.setData({ 192 | totalPrice: totalPrice 193 | }) 194 | if (stat == 1) { 195 | // 调用支付 196 | wx.requestPayment({ 197 | 'timeStamp': zhifu.timeStamp, 198 | 'nonceStr': zhifu.nonceStr, 199 | 'package': zhifu.package, 200 | 'signType': zhifu.signType, 201 | 'paySign': zhifu.paySign, 202 | 'success': function (res1) { 203 | console.log(zhifu.out_trade_no) 204 | console.log(res1) 205 | if (res1.errMsg == "requestPayment:ok") { 206 | console.log(con.wyy_user_wxappid) 207 | wx.request({ 208 | url: con.order_success, 209 | data: { 210 | wxappid: con.wyy_user_wxappid, 211 | out_trade_no: zhifu.out_trade_no, 212 | id: d, 213 | orderNum: a.num 214 | }, 215 | method: 'GET', 216 | header: { 217 | "Content-Type": 'application/json' 218 | }, 219 | success: function (res1) { 220 | console.log(zhifu.out_trade_no) 221 | console.log(res1) 222 | that.setData({ 223 | 224 | }) 225 | console.log(res1.data); 226 | if (res1.data.status == 1) { 227 | wx.showToast({ 228 | title: res1.data.errMsg, 229 | icon: 'success', 230 | duration: 1000, 231 | mask: true 232 | }) 233 | setTimeout(function () { 234 | wx.switchTab({ 235 | url: '../../../mine/mine' 236 | }) 237 | }, 2000) 238 | } else { 239 | wx.showToast({ 240 | title: res1.data.errMsg, 241 | icon: 'loading', 242 | duration: 2000, 243 | mask: true 244 | }) 245 | } 246 | } 247 | }); 248 | } else { 249 | wx.showToast({ 250 | title: '支付失败', 251 | icon: 'loading', 252 | duration: 2000, 253 | mask: true 254 | }) 255 | } 256 | 257 | }, 258 | 'fail': function (res) { 259 | console.log(res) 260 | wx.showToast({ 261 | title: '支付失败', 262 | icon: 'loading', 263 | duration: 1000, 264 | mask: true 265 | }) 266 | }, 267 | 'complete': function (res) { 268 | 269 | } 270 | }) 271 | } 272 | 273 | else { 274 | wx.showToast({ 275 | title: msg, 276 | icon: 'loading', 277 | duration: 2000, 278 | mask: true 279 | }) 280 | } 281 | } 282 | }) 283 | that.showModal(); 284 | } else { 285 | wx.showToast({ 286 | title: '提交失败,您的信息不全或房间数超出!', 287 | icon: 'loading', 288 | duration: 2000, 289 | mask: true 290 | }) 291 | } 292 | 293 | console.log(a.kdate); 294 | console.log(a.jdate); 295 | 296 | 297 | }, 298 | /** 299 | * 用户点击右上角分享 300 | */ 301 | onShareAppMessage: function () { 302 | 303 | } 304 | }) -------------------------------------------------------------------------------- /pages/hotel/book/detail/roomdetail/roomdetail.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/hotel/book/detail/roomdetail/roomdetail.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {{housefenlei.guest_id}} 14 | 15 | 16 | ¥{{housefenlei.price}} 17 | 18 | 19 | 20 | 21 | 推荐{{housefenlei.is_tj == 1 ? "是" : "否"}} 22 | 营业{{housefenlei.is_state == 1 ? "是" : "否"}} 23 | 24 | 25 | wifi{{housefenlei.is_wifi == 1 ? "有" : "否"}} 26 | 窗户{{housefenlei.is_window == 1 ? "有" : "否"}} 27 | 28 | 29 | 面积{{housefenlei.area}}㎡ 30 | 楼层{{housefenlei.floor}} 31 | 32 | 33 | 剩余数量{{housefenlei.else_num}} 34 | 可住人数{{housefenlei.live}} 35 | 36 | 37 | 房间总数{{housefenlei.number}} 38 | 39 | 40 | 41 | {{showView?'立即预定':'立即预定'}} 42 | 43 | 44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 入住时间:{{date}} 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 退房时间:{{date1}} 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 房间数:{{array[index]}} 79 | 80 | 81 | 82 | 83 | 84 | 温馨提醒:订单一经预订,不可取消或变更,如未能按约入住,您的预约房费将不予退还 85 | 86 | 87 |
88 |
89 | 90 | 91 | 92 | 93 | 总价钱:¥{{totalPrice}} 94 | 95 | 96 | 97 |
98 | -------------------------------------------------------------------------------- /pages/hotel/book/detail/roomdetail/roomdetail.wxss: -------------------------------------------------------------------------------- 1 | /* roomdetail.wxss */ 2 | .swiper { 3 | height: 400rpx; 4 | } 5 | .container1 { 6 | width: 96%; 7 | margin: 0 auto; 8 | } 9 | image { 10 | width: 100%; 11 | } 12 | .info { 13 | width: 100%; 14 | overflow: hidden; 15 | } 16 | .left { 17 | float: left; 18 | } 19 | .right { 20 | float: right; 21 | } 22 | .left_name { 23 | font-size: 35rpx; 24 | font-weight: bolder; 25 | padding: 10rpx 0; 26 | } 27 | .left_label { 28 | font-size: 30rpx; 29 | color: #fe3131; 30 | padding: 8rpx 0; 31 | } 32 | .right_price { 33 | color: #fe3131; 34 | font-weight: bolder; 35 | } 36 | button { 37 | background: #fe3131; 38 | color: white; 39 | } 40 | /*-----*/ 41 | .commodity_screen { 42 | width: 100%; 43 | height: 100%; 44 | position: fixed; 45 | top: 0; 46 | left: 0; 47 | background: #000; 48 | opacity: 0.4; 49 | overflow: hidden; 50 | z-index: 1000; 51 | color: #fff; 52 | } 53 | 54 | .commodity_attr_box { 55 | width: 100%; 56 | overflow: hidden; 57 | position: fixed; 58 | bottom: 0; 59 | left: 0; 60 | z-index: 2000; 61 | padding-top: 20rpx; 62 | background: #fff; 63 | } 64 | .predetail { 65 | margin: 30rpx auto; 66 | border:1rpx solid lightgray; 67 | color:gray; 68 | border-radius:10rpx; 69 | } 70 | .pre_input { 71 | width: 100%; 72 | color:gray; 73 | } 74 | .name { 75 | width: 96%; 76 | margin: 0 auto; 77 | font-weight: bolder; 78 | } 79 | .bottom { 80 | width: 96%; 81 | margin: 0 auto; 82 | overflow: hidden; 83 | } 84 | .bottom_price { 85 | float: left; 86 | color: #fe3131; 87 | font-size: 60rpx; 88 | margin-top:10rpx; 89 | 90 | } 91 | .button_bottom { 92 | float: right; 93 | margin-bottom: 10rpx; 94 | } 95 | .font_style { 96 | font-size: 35rpx; 97 | font-weight: bolder; 98 | } 99 | .xueyuan_top_left { 100 | float: left; 101 | } 102 | .xueyuan_top_right { 103 | float: right; 104 | } 105 | .title { 106 | overflow: hidden; 107 | width: 96%; 108 | margin: 0 auto; 109 | } 110 | .tx { 111 | padding: 20rpx 0; 112 | margin: 0 auto; 113 | color: #fe3131; 114 | font-size: 30rpx; 115 | font-weight: bolder; 116 | } 117 | input { 118 | font-size:30rpx; 119 | margin-left:10rpx; 120 | } 121 | /*弹窗*/ 122 | .total_price { 123 | color: #fe3131; 124 | font-size: 40rpx; 125 | text-align: center; 126 | padding: 20rpx 0; 127 | font-weight:bolder; 128 | } 129 | .button_pay { 130 | background: #fe3131; 131 | color: white; 132 | } 133 | .hotel_bq { 134 | margin: 20rpx auto; 135 | font-size: 30rpx; 136 | } 137 | .spaninfo { 138 | color: #fe3131; 139 | margin-left: 10rpx; 140 | font-weight: bolder; 141 | } 142 | .clean { 143 | overflow: hidden; 144 | } 145 | .inlineblock { 146 | display: inline-block; 147 | width: 48%; 148 | padding: 10rpx 0; 149 | } 150 | picker { 151 | margin:10rpx; 152 | font-size:30rpx; 153 | } 154 | /*显示隐藏*/ 155 | .bright789_view_hide{ 156 | display: none; 157 | } 158 | .bright789_view_show{ 159 | display: block; 160 | } 161 | .enblock { 162 | font-size:30rpx; 163 | color:white; 164 | background:#fe3131; 165 | text-align:center; 166 | padding:20rpx 0; 167 | border-radius:10rpx; 168 | } 169 | .Mine_hide { 170 | display: none; 171 | } 172 | .Mine_block { 173 | display: block; 174 | } -------------------------------------------------------------------------------- /pages/hotel/home/detail/roomdetail/roomdetail.js: -------------------------------------------------------------------------------- 1 | // roomdetail.js 2 | var app = getApp(); 3 | var con = require("../../../../../utils/data.js"); 4 | var openid, stat, b, c, d, stime, etime, snum, msg; 5 | Page({ 6 | 7 | /** 8 | * 页面的初始数据 9 | */ 10 | data: { 11 | housefenlei: [], 12 | date: '2017-06-10', 13 | date1: '2017-06-11', 14 | array: [1, 2, 3, 4, 5, 6, 7, 8], 15 | index: 0, 16 | openid: "", 17 | showView: true, 18 | showMine: false 19 | }, 20 | /** 21 | * 生命周期函数--监听页面加载 22 | */ 23 | onLoad: function (options) { 24 | var that = this; 25 | app.getUserInfo(); 26 | // 房间详情 27 | wx.request({ 28 | url: con.gethousebyid, 29 | data: { wxappid: con.wyy_user_wxappid, id: options.id }, 30 | method: 'GET', 31 | header: { 32 | "Content-Type": 'application/json' 33 | }, 34 | success: function (res) { 35 | b = res.data.info.guest_id, 36 | c = res.data.info.price, 37 | d = res.data.info.id, 38 | snum = res.data.info.else_num, 39 | console.log(res.data.info.guest_id) 40 | wx.getStorage({ 41 | key: 'openid', 42 | success: function (res) { 43 | 44 | // console.log(res.data); 45 | openid = res.data; 46 | that.setData({ 47 | openid: res.data 48 | }) 49 | }, 50 | }) 51 | that.setData({ 52 | // 房间信息 53 | housefenlei: res.data.info, 54 | }) 55 | console.log(res.data.info); 56 | } 57 | }); 58 | // 显示隐藏 59 | showView: (options.showView == "true" ? true : false) 60 | showMine: (options.showMine == "false" ? false : true) 61 | }, 62 | // 改变表单状态 63 | onChangeShowState: function () { 64 | var that = this; 65 | that.setData({ 66 | showView: (!that.data.showView) 67 | }) 68 | }, 69 | // 改变按钮状态 70 | changeMine: function () { 71 | var that = this; 72 | that.setData({ 73 | showMine: (!that.data.showMine) 74 | }) 75 | that.onChangeShowState() 76 | }, 77 | // 改变日期 78 | bindDateChange: function (e) { 79 | console.log('picker发送选择改变,携带值为', e.detail.value) 80 | this.setData({ 81 | date: e.detail.value 82 | }) 83 | }, 84 | bindDateChange1: function (e) { 85 | console.log('picker发送选择改变,携带值为', e.detail.value) 86 | this.setData({ 87 | date1: e.detail.value 88 | }) 89 | }, 90 | // 改变数量 91 | bindPickerChange: function (e) { 92 | console.log('picker发送选择改变,携带值为', e.detail.value) 93 | this.setData({ 94 | index: e.detail.value 95 | }) 96 | }, 97 | // 底部弹窗 98 | showModal: function () { 99 | // 显示遮罩层 100 | var animation = wx.createAnimation({ 101 | duration: 200, 102 | timingFunction: "linear", 103 | delay: 0 104 | }) 105 | this.animation = animation 106 | animation.translateY(300).step() 107 | this.setData({ 108 | animationData: animation.export(), 109 | showModalStatus: true 110 | }) 111 | setTimeout(function () { 112 | animation.translateY(0).step() 113 | this.setData({ 114 | animationData: animation.export() 115 | }) 116 | }.bind(this), 200) 117 | }, 118 | hideModal: function () { 119 | // 隐藏遮罩层 120 | var animation = wx.createAnimation({ 121 | duration: 200, 122 | timingFunction: "linear", 123 | delay: 0 124 | }) 125 | this.animation = animation 126 | animation.translateY(300).step() 127 | this.setData({ 128 | animationData: animation.export(), 129 | }) 130 | setTimeout(function () { 131 | animation.translateY(0).step() 132 | this.setData({ 133 | animationData: animation.export(), 134 | showModalStatus: false 135 | }) 136 | }.bind(this), 200) 137 | }, 138 | // 提交预订信息 139 | formSubmit: function(e) { 140 | var that = this; 141 | app.getUserInfo(); 142 | console.log(b) 143 | var a = e.detail.value; 144 | // 判断输入项是否为空 145 | console.log(a.num); 146 | console.log(snum); 147 | // var nima = parseInt(a.num); 148 | if (a.name != "" && a.phone != "" && a.num<=snum) { 149 | wx.request({ 150 | url: con.set_order, 151 | data: { 152 | wxappid: con.wyy_user_wxappid, 153 | // preid: id, 154 | name: a.name, 155 | openid: app.globalData.openid, 156 | phone: a.phone, 157 | startdate: a.kdate, 158 | enddate: a.jdate, 159 | roomnum: a.num, 160 | roomname: b, 161 | price: c, 162 | id: d 163 | }, 164 | method: 'POST', 165 | header: { 166 | "Content-Type": "application/x-www-form-urlencoded" 167 | }, 168 | success(res) { 169 | var zhifu = res.data; 170 | console.log(res.data); 171 | stat = res.data.status; 172 | msg = res.data.errMsg; 173 | console.log(msg) 174 | // 计算天数差 175 | var date1 = a.kdate; 176 | var date2 = a.jdate; 177 | var Num = a.num; 178 | var aDate, oDate1, oDate2, iDays 179 | aDate = date1.split("-") 180 | oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) //转换为12-18-2002格式 181 | aDate = date2.split("-") 182 | oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) 183 | iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) //把相差的毫秒数转换为天数 184 | // return iDays 185 | console.log(iDays); 186 | var totalNum = iDays * Num; 187 | console.log(totalNum) 188 | // 总价钱 189 | var totalPrice = totalNum * c; 190 | console.log(totalPrice) 191 | that.setData({ 192 | totalPrice: totalPrice 193 | }) 194 | if (stat == 1) { 195 | // 调用支付 196 | wx.requestPayment({ 197 | 'timeStamp': zhifu.timeStamp, 198 | 'nonceStr': zhifu.nonceStr, 199 | 'package': zhifu.package, 200 | 'signType': zhifu.signType, 201 | 'paySign': zhifu.paySign, 202 | 'success': function (res1) { 203 | console.log(zhifu.out_trade_no) 204 | console.log(res1) 205 | if (res1.errMsg == "requestPayment:ok") { 206 | console.log(con.wyy_user_wxappid) 207 | wx.request({ 208 | url: con.order_success, 209 | data: { 210 | wxappid: con.wyy_user_wxappid, 211 | out_trade_no: zhifu.out_trade_no, 212 | id: d, 213 | orderNum: a.num 214 | }, 215 | method: 'GET', 216 | header: { 217 | "Content-Type": 'application/json' 218 | }, 219 | success: function (res1) { 220 | console.log(zhifu.out_trade_no) 221 | console.log(res1) 222 | that.setData({ 223 | 224 | }) 225 | console.log(res1.data); 226 | if (res1.data.status == 1) { 227 | wx.showToast({ 228 | title: res1.data.errMsg, 229 | icon: 'success', 230 | duration: 1000, 231 | mask: true 232 | }) 233 | setTimeout(function () { 234 | wx.switchTab({ 235 | url: '../../../mine/mine' 236 | }) 237 | }, 2000) 238 | } else { 239 | wx.showToast({ 240 | title: '支付失败', 241 | icon: 'loading', 242 | duration: 2000, 243 | mask: true 244 | }) 245 | } 246 | } 247 | }); 248 | } else { 249 | wx.showToast({ 250 | title: '支付失败', 251 | icon: 'loading', 252 | duration: 2000, 253 | mask: true 254 | }) 255 | } 256 | 257 | }, 258 | 'fail': function (res) { 259 | console.log(res) 260 | wx.showToast({ 261 | title: '支付失败', 262 | icon: 'loading', 263 | duration: 1000, 264 | mask: true 265 | }) 266 | }, 267 | 'complete': function (res) { 268 | 269 | } 270 | }) 271 | } 272 | 273 | else { 274 | wx.showToast({ 275 | title: msg, 276 | icon: 'loading', 277 | duration: 2000, 278 | mask: true 279 | }) 280 | } 281 | } 282 | }) 283 | that.showModal(); 284 | } else { 285 | wx.showToast({ 286 | title: '提交失败,您的信息不全或房间数超出!', 287 | icon: 'loading', 288 | duration: 2000, 289 | mask: true 290 | }) 291 | } 292 | 293 | console.log(a.kdate); 294 | console.log(a.jdate); 295 | 296 | 297 | }, 298 | /** 299 | * 用户点击右上角分享 300 | */ 301 | onShareAppMessage: function () { 302 | 303 | } 304 | }) -------------------------------------------------------------------------------- /pages/hotel/home/detail/roomdetail/roomdetail.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/hotel/home/detail/roomdetail/roomdetail.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {{housefenlei.guest_id}} 14 | 15 | 16 | ¥{{housefenlei.price}} 17 | 18 | 19 | 20 | 21 | 推荐{{housefenlei.is_tj == 1 ? "是" : "否"}} 22 | 营业{{housefenlei.is_state == 1 ? "是" : "否"}} 23 | 24 | 25 | wifi{{housefenlei.is_wifi == 1 ? "有" : "否"}} 26 | 窗户{{housefenlei.is_window == 1 ? "有" : "否"}} 27 | 28 | 29 | 面积{{housefenlei.area}}㎡ 30 | 楼层{{housefenlei.floor}} 31 | 32 | 33 | 剩余数量{{housefenlei.else_num}} 34 | 可住人数{{housefenlei.live}} 35 | 36 | 37 | 房间总数{{housefenlei.number}} 38 | 39 | 40 | 41 | {{showView?'立即预定':'立即预定'}} 42 | 43 | 44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 入住时间:{{date}} 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 退房时间:{{date1}} 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 房间数:{{array[index]}} 79 | 80 | 81 | 82 | 83 | 84 | 温馨提醒:订单一经预订,不可取消或变更,如未能按约入住,您的预约房费将不予退还 85 | 86 | 87 |
88 |
89 | 90 | 91 | 92 | 93 | 总价钱:¥{{totalPrice}} 94 | 95 | 96 | 97 |
98 | -------------------------------------------------------------------------------- /pages/hotel/home/detail/roomdetail/roomdetail.wxss: -------------------------------------------------------------------------------- 1 | /* roomdetail.wxss */ 2 | .swiper { 3 | height: 400rpx; 4 | } 5 | .container1 { 6 | width: 96%; 7 | margin: 0 auto; 8 | } 9 | image { 10 | width: 100%; 11 | } 12 | .info { 13 | width: 100%; 14 | overflow: hidden; 15 | } 16 | .left { 17 | float: left; 18 | } 19 | .right { 20 | float: right; 21 | } 22 | .left_name { 23 | font-size: 35rpx; 24 | font-weight: bolder; 25 | padding: 10rpx 0; 26 | } 27 | .left_label { 28 | font-size: 30rpx; 29 | color: #fe3131; 30 | padding: 8rpx 0; 31 | } 32 | .right_price { 33 | color: #fe3131; 34 | font-weight: bolder; 35 | } 36 | button { 37 | background: #fe3131; 38 | color: white; 39 | } 40 | /*-----*/ 41 | .commodity_screen { 42 | width: 100%; 43 | height: 100%; 44 | position: fixed; 45 | top: 0; 46 | left: 0; 47 | background: #000; 48 | opacity: 0.4; 49 | overflow: hidden; 50 | z-index: 1000; 51 | color: #fff; 52 | } 53 | 54 | .commodity_attr_box { 55 | width: 100%; 56 | overflow: hidden; 57 | position: fixed; 58 | bottom: 0; 59 | left: 0; 60 | z-index: 2000; 61 | padding-top: 20rpx; 62 | background: #fff; 63 | } 64 | .predetail { 65 | margin: 30rpx auto; 66 | border:1rpx solid lightgray; 67 | color:gray; 68 | border-radius:10rpx; 69 | } 70 | .pre_input { 71 | width: 100%; 72 | color:gray; 73 | } 74 | .name { 75 | width: 96%; 76 | margin: 0 auto; 77 | font-weight: bolder; 78 | } 79 | .bottom { 80 | width: 96%; 81 | margin: 0 auto; 82 | overflow: hidden; 83 | } 84 | .bottom_price { 85 | float: left; 86 | color: #fe3131; 87 | font-size: 60rpx; 88 | margin-top:10rpx; 89 | 90 | } 91 | .button_bottom { 92 | float: right; 93 | margin-bottom: 10rpx; 94 | } 95 | .font_style { 96 | font-size: 35rpx; 97 | font-weight: bolder; 98 | } 99 | .xueyuan_top_left { 100 | float: left; 101 | } 102 | .xueyuan_top_right { 103 | float: right; 104 | } 105 | .title { 106 | overflow: hidden; 107 | width: 96%; 108 | margin: 0 auto; 109 | } 110 | .tx { 111 | padding: 20rpx 0; 112 | margin: 0 auto; 113 | color: #fe3131; 114 | font-size: 30rpx; 115 | font-weight: bolder; 116 | } 117 | input { 118 | font-size:30rpx; 119 | margin-left:10rpx; 120 | } 121 | /*弹窗*/ 122 | .total_price { 123 | color: #fe3131; 124 | font-size: 40rpx; 125 | text-align: center; 126 | padding: 20rpx 0; 127 | font-weight:bolder; 128 | } 129 | .button_pay { 130 | background: #fe3131; 131 | color: white; 132 | } 133 | .hotel_bq { 134 | margin: 20rpx auto; 135 | font-size: 30rpx; 136 | } 137 | .spaninfo { 138 | color: #fe3131; 139 | margin-left: 10rpx; 140 | font-weight: bolder; 141 | } 142 | .clean { 143 | overflow: hidden; 144 | } 145 | .inlineblock { 146 | display: inline-block; 147 | width: 48%; 148 | padding: 10rpx 0; 149 | } 150 | picker { 151 | margin:10rpx; 152 | font-size:30rpx; 153 | } 154 | /*显示隐藏*/ 155 | .bright789_view_hide{ 156 | display: none; 157 | } 158 | .bright789_view_show{ 159 | display: block; 160 | } 161 | .enblock { 162 | font-size:30rpx; 163 | color:white; 164 | background:#fe3131; 165 | text-align:center; 166 | padding:20rpx 0; 167 | border-radius:10rpx; 168 | } 169 | .Mine_hide { 170 | display: none; 171 | } 172 | .Mine_block { 173 | display: block; 174 | } -------------------------------------------------------------------------------- /pages/hotel/home/home.js: -------------------------------------------------------------------------------- 1 | // home.js 2 | var WxParse = require("../../../wxParse/wxParse.js"); 3 | var QQMapWX = require('../../../utils/qqmap-wx-jssdk.min.js'); 4 | var app = getApp(); 5 | var con = require("../../../utils/data.js"); 6 | var lng, lat, name, address, showModalStatus; 7 | Page({ 8 | 9 | /** 10 | * 页面的初始数据 11 | */ 12 | data: { 13 | navbar: ['酒店简介', '评价'], 14 | currentTab: 0, 15 | // 轮播图数据 16 | lunbolist: [], 17 | // 精彩推荐客房 18 | housefenlei: [], 19 | hotelinfo: [], 20 | evalue: [], 21 | manyi: [ 22 | { value: '一般' ,num: 1 }, 23 | { value: '满意', num: 2, checked: "true" }, 24 | { value: '非常满意', num: 3 } 25 | ], 26 | // 评价列表 27 | evalue_list: [], 28 | // 评价满意状态 29 | pj: "", 30 | opentime: "", 31 | detime: "" 32 | }, 33 | // 菜单切换 34 | navbarTap: function (e) { 35 | this.setData({ 36 | currentTab: e.currentTarget.dataset.idx 37 | }) 38 | }, 39 | /** 40 | * 生命周期函数--监听页面加载 41 | */ 42 | onLoad: function (options) { 43 | this.requestjiekou(); 44 | }, 45 | requestjiekou: function () { 46 | var demo = new QQMapWX({ 47 | key: 'QCDBZ-GZ3WI-BQDG7-5H24V-Y2HSO-I7BSG' 48 | }); 49 | var that = this; 50 | app.getUserInfo(); 51 | // 首页接口 52 | wx.request({ 53 | url: con.index, 54 | data: { wxappid: con.wyy_user_wxappid, count: 4 }, 55 | method: 'GET', 56 | header: { 57 | "Content-Type": 'application/json' 58 | }, 59 | success: function (res) { 60 | lat = res.data.hotel.latitude; 61 | lng = res.data.hotel.longitude; 62 | name = res.data.hotel.name; 63 | address = res.data.hotel.province + res.data.hotel.city + res.data.hotel.district + res.data.hotel.address; 64 | WxParse.wxParse('arta', 'html', res.data.hotel.intro, that, 0); 65 | // 时间戳转化 66 | var opentime = new Date(parseInt(res.data.hotel.opening) * 1000).toJSON().slice(0, 10); 67 | var detime = new Date(parseInt(res.data.hotel.decorate) * 1000).toJSON().slice(0, 10); 68 | that.setData({ 69 | // 轮播图数据 70 | lunbolist: res.data.photo, 71 | // 酒店信息 72 | hotelinfo: res.data.hotel, 73 | // 房间信息; 74 | housefenlei: res.data.house, 75 | // 评价信息 76 | evalue: res.data.evalue, 77 | lat: res.data.hotel.latitude, 78 | lng: res.data.hotel.longitude, 79 | // 开业时间 80 | opentime: opentime, 81 | detime: detime, 82 | markers: [{ 83 | iconPath: "../../../images/map.png", 84 | id: 0, 85 | latitude: res.data.hotel.latitude, 86 | longitude: res.data.hotel.longitude, 87 | title: res.data.hotel.name, 88 | width: 30, 89 | height: 30 90 | }] 91 | }) 92 | console.log(res.data); 93 | } 94 | }); 95 | // 评价列表接口 96 | wx.request({ 97 | url: con.evalue_list, 98 | data: { wxappid: con.wyy_user_wxappid }, 99 | method: 'GET', 100 | header: { 101 | "Content-Type": 'application/json' 102 | }, 103 | success: function (res) { 104 | // WxParse.wxParse('arta', 'html', res.data.hotel.intro, that, 0); 105 | that.setData({ 106 | evalue_list: res.data.msg 107 | }) 108 | var a = res.data.msg; 109 | console.log(res.data.msg); 110 | } 111 | }); 112 | }, 113 | // 地图导航 114 | bindgothere: function (e) { 115 | console.log(lat); 116 | console.log(lng); 117 | wx.openLocation({ 118 | latitude: parseFloat(lat), 119 | longitude: parseFloat(lng), 120 | name: name, 121 | address: address 122 | }) 123 | }, 124 | // 跳转预订页面 125 | go_book: function (e) { 126 | wx.switchTab({ 127 | url: '../book/book' 128 | }) 129 | }, 130 | // 跳转订房详情 131 | go_roomdetail: function (e) { 132 | var id = e.currentTarget.dataset.id 133 | wx.navigateTo({ 134 | url: 'detail/roomdetail/roomdetail?id=' + id, 135 | }) 136 | }, 137 | formSubmit: function (e) { 138 | var that = this; 139 | app.getUserInfo(); 140 | var a = e.detail.value; 141 | console.log(a); 142 | console.log(a.satisfied) 143 | // 如果评论信息不为空就提交到评论接口 144 | if (a.comment != "") { 145 | // 提交评价信息到接口 146 | wx.request({ 147 | url: con.evalue_add, 148 | data: { 149 | wxappid: con.wyy_user_wxappid, 150 | openid: app.globalData.openid, 151 | info: a.comment, 152 | satisfaction: a.satisfied 153 | }, 154 | method: 'GET', 155 | header: { 156 | "Content-Type": 'application/json' 157 | }, 158 | success: function (res) { 159 | that.requestjiekou(); 160 | that.setData({ 161 | 162 | }) 163 | console.log(res.data); 164 | if (res.data.status == 1) { 165 | wx.showToast({ 166 | title: '发表成功', 167 | icon: 'success', 168 | duration: 2000 169 | }) 170 | 171 | } 172 | if (res.data.status == 0) { 173 | wx.showToast({ 174 | title: '对不起,尚未查询到您在本酒店的订单,无法评价!', 175 | icon: 'fail', 176 | duration: 2000 177 | }) 178 | } 179 | // else { 180 | // wx.showToast({ 181 | // title: '发表失败1', 182 | // icon: 'fail', 183 | // duration: 2000 184 | // }) 185 | // } 186 | } 187 | }); 188 | } else { 189 | wx.showToast({ 190 | title: '发表失败', 191 | icon: 'fail', 192 | duration: 2000 193 | }) 194 | } 195 | }, 196 | /** 197 | * 用户点击右上角分享 198 | */ 199 | onShareAppMessage: function () { 200 | 201 | } 202 | }) -------------------------------------------------------------------------------- /pages/hotel/home/home.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/hotel/home/home.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | {{hotelinfo.name}} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 精选推荐 17 | 更多 > 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | {{item.guest_id}} 26 | 27 | 28 | 29 | 30 | 31 | 32 | {{item}} 33 | 34 | 35 |