index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="content">
  3. <!-- 背景图 -->
  4. <view class="index_bg">
  5. <view class="welcome"><image class="welcome_img" src="../../static/index/welcome.png"></image></view>
  6. </view>
  7. <!-- 第一层公寓名称卡片 -->
  8. <view class="uni-ka" style="margin-top: -40px;margin-bottom:0px;">
  9. <text class="uni-title">墨轩湖姬子公寓(南昌交通学院)</text>
  10. <text class="uni-sub-title">2021年装修 | 智能门锁 | 房间wifi | 免费停车</text>
  11. <text class="uni-extra" @click="navigateToXiangqing">设施/详情></text>
  12. <text class="uni-body">宜春市靖安县北高速路口什么路899号</text>
  13. <image class="uni-phone" @click="telphone(phone)" src="../../static/index/index_phone.svg"></image>
  14. <image class="uni-map" @click="mapDaohang" src="../../static/index/index_map.svg"></image>
  15. <br><text class="uni-body2">距离我520km</text>
  16. </view>
  17. <!-- 第二层工具 -->
  18. <view class="item-list">
  19. <view class="item-list-one" @click="navigateToXuzhi">
  20. <image src="../../static/index/index_xuzhi.svg" class="img-btn"></image>
  21. <text class="list-txt">入住须知</text>
  22. </view>
  23. <view class="item-list-one" @click="navigateToDairuzhu">
  24. <image src="../../static/index/index_ruzhu.svg" class="img-btn"></image>
  25. <text class="list-txt">办理入住</text>
  26. </view>
  27. <view class="item-list-one" @click="navigateToXuzhu">
  28. <image src="../../static/index/index_xuzhu.svg" class="img-btn"></image>
  29. <text class="list-txt">办理续住</text>
  30. </view>
  31. <view class="item-list-one" @click="navigateToTuifang">
  32. <image src="../../static/index/index_tuifang.svg" class="img-btn"></image>
  33. <text class="list-txt">办理退房</text>
  34. </view>
  35. </view>
  36. <!-- 第三层订房 -->
  37. <view class="room-list">
  38. <!-- 选择住房日期 -->
  39. <view class="select-time" @click="openCalendar">
  40. <view class="select-time-one">
  41. <text class="select-list">周四入住</text>
  42. <text class="select-list-time">07月21日</text>
  43. </view>
  44. <view class="select-center">
  45. <view class="select-line1"></view>
  46. <view class="select-circle">1晚</view>
  47. <view class="select-line2"></view>
  48. </view>
  49. <view class="select-time-one">
  50. <text class="select-list">周五离店</text>
  51. <text class="select-list-time">07月22日</text>
  52. </view>
  53. <uni-calendar ref="calendar" :selected="info.selected" class="uni-calendar--hook" :clear-date="true" :date="info.date" :insert="info.insert" :lunar="info.lunar" :startDate="info.startDate"
  54. :endDate="info.endDate" :range="info.range" @change="change" @confirm="confirm" @close="close"/>
  55. </view>
  56. <!-- 房型列表 -->
  57. <view class="room-kuang">
  58. <view class="room-xinxi" v-for="(item,index) in room" :key="index">
  59. <image class="room-image" src="../../static/index/room_image.svg" @click="inputDialogToggle"></image>
  60. <view class="room-name">{{item.name}}</view>
  61. <view class="room-mark">{{item.mark1}} {{item.mark2}} {{item.mark3}}</view>
  62. <view class="room-icon">
  63. <image src="../../static/index/index_wifi.svg" style="width: 30rpx;height: 30rpx;"></image>
  64. <image src="../../static/index/index_kongtiao.svg" style="width: 26rpx;height: 26rpx;margin-left: 10rpx;"></image>
  65. <image src="../../static/index/index_nosmoking.svg" style="width: 30rpx;height: 30rpx;margin-left: 10rpx;"></image>
  66. <image src="../../static/index/index_lock.svg" style="width: 30rpx;height: 30rpx;margin-left: 10rpx;"></image>
  67. </view>
  68. <view class="before-price"><strike>{{item.before_price}}</strike></view>
  69. <view class="room-price">{{item.price}}</view>
  70. <view class="room-button" @click="navigateToOrderRoom"><text>订</text></view>
  71. <view class="room-line" v-if="index<(room.length-1)"></view>
  72. </view>
  73. </view>
  74. </view>
  75. <!-- 房间样式弹窗页面 -->
  76. <uni-popup ref="popup" type="dialog" :mask-click="false">
  77. <view class="popup_bg">
  78. <text class="popup_title">户型详情</text>
  79. <text class="popup_error" @click="popupClose"></text>
  80. <!-- 轮播图 -->
  81. <swiper class="swiper" circular :indicator-dots="indicatorDots">
  82. <swiper-item v-for="(item, index) in img" :key="index">
  83. <view class="swiper-item">
  84. <image :src="item.srcUrl" class="swiper-img"></image>
  85. </view>
  86. </swiper-item>
  87. </swiper>
  88. <text class="popup_title2">便利设施</text>
  89. <view class="popup_txt">尤其是刚上线的产品,很难通过产品的内部体系来实现快速的用户增长,所以会更加依赖于分享来达到广泛的传播,获取目标用户。
  90. 所以监听用户的截图操作,提示用户进行分享,既缩短了以前分享截...</view>
  91. </view>
  92. </uni-popup>
  93. <!-- 办理续住弹窗页面 -->
  94. <uni-popup ref="popup_xuzhu" type="dialog" :mask-click="false">
  95. <view class="popup_bg_xu">
  96. <text class="popup_title">办理续住</text>
  97. <text class="popup_error" @click="popupXuzhuClose"></text>
  98. <text class="popup_xu_line"></text>
  99. <!-- 时间选择 -->
  100. <view class="select-time-xu" @click="openXuCalendar">
  101. <view class="select-time-one-xu">
  102. <text class="select-list">周四入住</text>
  103. <text class="select-list-time">07月21日</text>
  104. </view>
  105. <view class="select-center">
  106. <view class="select-line1"></view>
  107. <view class="select-circle">1晚</view>
  108. <view class="select-line2"></view>
  109. </view>
  110. <view class="select-time-one-xu">
  111. <text class="select-list">周五离店</text>
  112. <text class="select-list-time">07月22日</text>
  113. </view>
  114. <uni-calendar ref="calendar_xu" :selected="info.selected" class="uni-calendar--hook" :clear-date="true" :date="info.date" :insert="info.insert" :lunar="info.lunar" :startDate="info.startDate"
  115. :endDate="info.endDate" :range="info.range" @confirm="confirmXu" @close="closeXu"/>
  116. </view>
  117. <text class="popup_xu_txt">注:办理续住最多7天,如超过7天需要重新预定</text>
  118. <!-- 支付框 -->
  119. <view class="fukuan">
  120. <view class="fu-price"><text style="font-size: 28rpx;">总计:</text>¥20.00</view>
  121. <view class="fu-zhifu">立即支付</view>
  122. </view>
  123. </view>
  124. </uni-popup>
  125. </view>
  126. </template>
  127. <script>
  128. /**
  129. * 获取任意时间
  130. */
  131. function getDate(date, AddDayCount = 0) {
  132. if (!date) {
  133. date = new Date()
  134. }
  135. if (typeof date !== 'object') {
  136. date = date.replace(/-/g, '/')
  137. }
  138. const dd = new Date(date)
  139. dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
  140. const y = dd.getFullYear()
  141. const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
  142. const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
  143. return {
  144. fullDate: y + '-' + m + '-' + d,
  145. year: y,
  146. month: m,
  147. date: d,
  148. day: dd.getDay()
  149. }
  150. }
  151. // 导入图片
  152. import room1 from '../../static/index/swiper_img1.svg'
  153. import room2 from '../../static/index/swiper_img1.svg'
  154. export default {
  155. data() {
  156. return {
  157. showCalendar: false,
  158. info: {
  159. lunar: true,
  160. range: true,
  161. insert: false,
  162. selected: [],
  163. startDate:'',
  164. date:'',
  165. endDate:''
  166. },
  167. room:[
  168. {id:1,room_img:({ url: "../../static/index/room_image.svg" }),name:'01户型',before_price:'¥419',price:'¥0.00',mark1:'22m',mark2:'无早',mark3:'大床'},
  169. {id:2,room_img:'url(../../static/index/index_bg.svg)',name:'02户型',before_price:'¥419',price:'¥0.00',mark1:'22m',mark2:'无早',mark3:'大床'},
  170. {id:3,room_img:({ url: "../../static/index/room_image.svg" }),name:'01户型',before_price:'¥419',price:'¥0.00',mark1:'22m',mark2:'无早',mark3:'大床'},
  171. {id:4,room_img:'url(../../static/index/index_bg.svg)',name:'02户型',before_price:'¥419',price:'¥0.00',mark1:'22m',mark2:'无早',mark3:'大床'},
  172. ],
  173. indicatorDots: true,//滚动图片提示条默认出现
  174. img:[
  175. {
  176. value: '1',
  177. srcUrl:room1,
  178. name: '图1'
  179. },
  180. {
  181. value: '2',
  182. srcUrl:room2,
  183. name: '图2'
  184. },
  185. ],
  186. phone:'15079248859',//电话
  187. }
  188. },
  189. onLoad() {
  190. },
  191. onReady() {
  192. this.$nextTick(() => {
  193. this.showCalendar = true
  194. })
  195. // TODO 模拟请求异步同步数据
  196. setTimeout(() => {
  197. console.log('date:'+getDate(new Date()).fullDate)
  198. console.log('startDate:'+getDate(new Date()).fullDate)
  199. console.log('endDate:'+getDate(new Date(),6).fullDate)
  200. this.info.date = getDate(new Date()).fullDate
  201. this.info.startDate = getDate(new Date()).fullDate
  202. this.info.endDate = getDate(new Date(),6).fullDate
  203. this.info.selected = [{
  204. date: getDate(new Date(),-3).fullDate,
  205. info: '打卡'
  206. },
  207. {
  208. date: getDate(new Date(),-2).fullDate,
  209. info: '签到',
  210. data: {
  211. custom: '自定义信息',
  212. name: '自定义消息头'
  213. }
  214. },
  215. {
  216. date: getDate(new Date(),-1).fullDate,
  217. info: '已打卡'
  218. }
  219. ]
  220. }, 2000)
  221. },
  222. methods: {
  223. // 跳转到入住须知
  224. navigateToXuzhi(){
  225. uni.navigateTo({
  226. url: "../ruzhuxuzhi/ruzhuxuzhi",
  227. });
  228. },
  229. // 跳转到公寓详情
  230. navigateToXiangqing(){
  231. uni.navigateTo({
  232. url: "../gongyuxiangqing/gongyuxiangqing",
  233. });
  234. },
  235. // 订房间
  236. navigateToOrderRoom() {
  237. uni.navigateTo({
  238. url: "../order_room/order_room",
  239. });
  240. },
  241. //办理入住跳转
  242. navigateToDairuzhu(){
  243. uni.navigateTo({
  244. url: "../my_orderlist/my_orderlist?Inv=2",
  245. })
  246. },
  247. //办理退房
  248. navigateToTuifang(){
  249. uni.navigateTo({
  250. url:"../my_orderlist/my_orderlist?Inv=3"
  251. })
  252. },
  253. //户型详情弹窗
  254. inputDialogToggle() {
  255. this.$refs.popup.open()
  256. },
  257. popupClose() {
  258. this.$refs.popup.close()
  259. },
  260. //办理续住弹窗
  261. navigateToXuzhu(){
  262. this.$refs.popup_xuzhu.open()
  263. },
  264. popupXuzhuClose() {
  265. this.$refs.popup_xuzhu.close()
  266. },
  267. // 日期选择器弹窗
  268. openCalendar() {
  269. this.$refs.calendar.open()
  270. },
  271. close(){
  272. console.log('弹窗关闭');
  273. },
  274. confirm(e) {
  275. console.log('confirm 返回:', e)
  276. if(e.range.data.length<2){
  277. uni.showToast({
  278. icon:'none',
  279. title:'请选择时间范围'
  280. })
  281. return
  282. }
  283. },
  284. change(e) {
  285. console.log('1change 返回:', e)
  286. // 模拟动态打卡
  287. if (this.info.selected.length > 5) return
  288. this.info.selected.push({
  289. date: e.fulldate,
  290. info: '打卡'
  291. })
  292. },
  293. // 续住里日期选择器弹窗
  294. openXuCalendar() {
  295. this.$refs.calendar_xu.open()
  296. },
  297. closeXu(){
  298. console.log('弹窗关闭');
  299. },
  300. confirmXu(e) {
  301. console.log('confirm 返回:', e)
  302. },
  303. //拨打电话
  304. telphone(phone){
  305. uni.makePhoneCall({
  306. phoneNumber: phone ,
  307. }) // 传参带入号码即可
  308. },
  309. //地图导航
  310. mapDaohang(){
  311. uni.getLocation({
  312. type: 'wgs84',
  313. success: function (res) {
  314. console.log('当前位置的经度:' + res.longitude);
  315. console.log('当前位置的纬度:' + res.latitude);
  316. let longitude=res.longitude
  317. let latitude=res.latitude
  318. let name=res.name//
  319. let address=res.address//地址
  320. wx.openLocation({
  321. latitude,
  322. longitude,
  323. name,
  324. address,
  325. scale:18//缩放比例
  326. })
  327. }
  328. });
  329. }
  330. }
  331. }
  332. </script>
  333. <style>
  334. @import url("./css/index.css");
  335. </style>