hotelBooking.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="pages">
  3. <div class="top-hotel-detail">
  4. <div style="font-size: 18px;">
  5. 丁真精品酒店理塘总店 四川省甘孜州理塘县理塘路口
  6. </div>
  7. <div>
  8. 商务大床房B
  9. </div>
  10. <div>
  11. 入住{{`2019-12-12`}} 离店{{`2019-12-13`}} 共1晚
  12. </div>
  13. </div>
  14. <div>
  15. <div class="form-flex">
  16. <div>
  17. 房间数
  18. </div>
  19. <div>
  20. <u-number-box v-model="form.roomNum" @change="valChange"></u-number-box>
  21. <u-icon name="arrow-right" color="#000" size="20"></u-icon>
  22. </div>
  23. </div>
  24. <div class="form-flex">
  25. <div>
  26. 入住人
  27. </div>
  28. <div @click="handleToContacts">
  29. <template v-if="form.name!=''">{{ form.name }} {{ form.phone }}</template>
  30. <template v-else>请选择联系人</template>
  31. <u-icon name="arrow-right" color="#000" size="20"></u-icon>
  32. </div>
  33. </div>
  34. <div class="form-flex" style="margin-top:20px">
  35. <div>
  36. 到店时间
  37. </div>
  38. <div @click="openTime">
  39. {{ form.time }}
  40. <u-icon name="arrow-right" color="#000" size="20"></u-icon>
  41. </div>
  42. </div>
  43. <div class="form-flex">
  44. <div>
  45. 优惠券
  46. </div>
  47. <div @click="handleToCoupon">
  48. {{ form.coupon }}
  49. <u-icon name="arrow-right" color="#000" size="20"></u-icon>
  50. </div>
  51. </div>
  52. <div class="form-flex">
  53. <div>
  54. 发票
  55. </div>
  56. <div @click="handleToBill">
  57. {{ form.bill }}
  58. <u-icon name="arrow-right" color="#000" size="20"></u-icon>
  59. </div>
  60. </div>
  61. <div class="form-flex">
  62. <div>
  63. 备注
  64. </div>
  65. <div style="flex:1;">
  66. <u-input placeholder="请输入备注" v-model="form.remarks"></u-input>
  67. <u-icon name="arrow-right" color="#000" size="20"></u-icon>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="bottom-submit">
  72. <div>
  73. <span style="color:rgb(0, 170 ,255)">338.00</span> 元 <span style="padding:3px 8px;border-radius:5px;border:1px solid rgb(0, 170 ,255);margin-left:5px;">明细</span>
  74. </div>
  75. <div>
  76. <u-button @click="submitHotel" type="primary">提交</u-button>
  77. </div>
  78. </div>
  79. <u-datetime-picker ref="datetimePicker" :show="show" v-model="nowTime" @confirm="confirmTime" mode="datetime"></u-datetime-picker>
  80. </view>
  81. </template>
  82. <script>
  83. export default {
  84. data() {
  85. return {
  86. form: {
  87. roomNum: 1, //房间数
  88. name: '', //入住人
  89. phone: '', //手机号
  90. time: '', //到店时间
  91. coupon: '', //优惠券
  92. bill: '', //发票
  93. remarks: '', //备注
  94. },
  95. nowTime:Number(new Date()),
  96. show: false,
  97. rules: {}
  98. }
  99. },
  100. filters: {
  101. //将时间戳格式化为yy-mm-dd hh:mm
  102. formatter(value) {
  103. if (!value) return ''
  104. const date = new Date(value)
  105. const formattedDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`
  106. return formattedDate
  107. }
  108. },
  109. methods: {
  110. valChange(val) {
  111. console.log(val)
  112. },
  113. handleToContacts() {
  114. uni.navigateTo({
  115. url: '/components/contacts/contacts'
  116. })
  117. },
  118. openTime() {
  119. this.show = true
  120. },
  121. onReady() {
  122. },
  123. confirmTime(obj) {
  124. console.log(this);
  125. this.form.time = this.$options.filters.formatter(obj.value)
  126. this.show = false
  127. },
  128. handleToCoupon(){
  129. uni.navigateTo({
  130. url: '/components/coupon/coupon'
  131. })
  132. },
  133. handleToBill(){
  134. uni.navigateTo({
  135. url: '/components/bill/bill'
  136. })
  137. },
  138. submitHotel(){
  139. console.log('提交');
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .pages {
  146. width: 100%;
  147. height: 100vh;
  148. background: #f5f5f5;
  149. }
  150. .top-hotel-detail {
  151. width: 100%;
  152. height: 200px;
  153. background: #032c4f;
  154. display: flex;
  155. flex-direction: column;
  156. justify-content: space-evenly;
  157. color: #fff;
  158. padding: 20px;
  159. box-sizing: border-box;
  160. }
  161. .form-flex {
  162. display: flex;
  163. justify-content: space-between;
  164. height: 30px;
  165. align-items: center;
  166. padding: 20px;
  167. background: #fff;
  168. div:nth-child(2) {
  169. display: flex;
  170. align-items: center;
  171. }
  172. }
  173. .bottom-submit{
  174. width:100%;
  175. height:90px;
  176. background:#fff;
  177. position:fixed;
  178. padding: 20px;
  179. bottom:0;
  180. left:0;
  181. display: flex;
  182. justify-content: space-between;
  183. align-items: center;
  184. box-sizing: border-box;
  185. }
  186. </style>