affirmOrder.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <view class="container">
  3. <!-- 导航栏图片区域 -->
  4. <view class="header">
  5. <img src="../../static/my/headerImg.png" />
  6. <!-- 标题区域 -->
  7. <view class="header_title">民宿名称</view>
  8. <!-- 返回图标区域 -->
  9. <img class="header_icon" src="../../static/index/left.png" @click="handleBack" />
  10. </view>
  11. <!-- 房间信息区域 -->
  12. <view class="info">
  13. <view class="info_time">
  14. {{ info.startTimeMonth }}月{{ info.startTimeMonth }}日
  15. <text class="gap">星期{{ info.startTimeWeek }}</text>
  16. <view class="time_line"></view>
  17. <view class="time_num">{{ info.nightNum }}晚</view>
  18. <view class="time_line"></view>
  19. <view class="gap">{{ info.endTimeMonth }}月{{ info.endTimeDay }}日</view>
  20. <text>星期{{ info.endTimeWeek }}</text>
  21. </view>
  22. <view class="info_msg">大床房</view>
  23. <view class="info_type">
  24. <view class="type_item">包吃住型</view>
  25. <view class="type_item">包吃住型</view>
  26. <view class="type_item">包吃住型</view>
  27. </view>
  28. <view class="info_tag">
  29. <view class="tag_item">16-20㎡</view>
  30. <view class="tag_item">双人床</view>
  31. <view class="tag_item">窗户位于走廊/窗户较小</view>
  32. </view>
  33. </view>
  34. <!-- 入住信息区域 -->
  35. <view class="msg">
  36. <view class="msg_title">入住信息</view>
  37. <view class="msg_box">
  38. <view class="box_key">房间数量</view>
  39. <view class="box_value">{{ roomCount }}间</view>
  40. <view class="box_icon">
  41. <img class="img" src="../../static/index/add.png" @click="handleAdd" />
  42. <img class="img2" src="../../static/index/minus.png" @click="handleMinus" />
  43. </view>
  44. </view>
  45. <view class="msg_box">
  46. <view class="box_key">住客姓名</view>
  47. <view class="box_value">
  48. <input type="text" placeholder="请输入住客姓名" v-model="clientName" />
  49. </view>
  50. <view class="box_icon" @click="handleSelectClient">
  51. <img class="img2" src="../../static/index/people.png" />
  52. </view>
  53. </view>
  54. <view class="msg_box">
  55. <view class="box_key">联系电话</view>
  56. <view class="box_value">
  57. <input type="number" maxlength="11" placeholder="请输入联系电话" v-model="clientPhone" />
  58. </view>
  59. </view>
  60. <view class="msg_box" @click="handleSelectTime">
  61. <view class="box_key">预计到店</view>
  62. <view class="box_value" :class="{ color: !arriveTime }">{{ arriveTime ? arriveTime : '请选择预计到店时间' }}</view>
  63. <view class="box_icon">
  64. <img class="img3" src="../../static/index/right2.png" />
  65. </view>
  66. </view>
  67. <uv-datetime-picker
  68. ref="datetimePicker"
  69. v-model="timeValue"
  70. mode="datetime"
  71. :closeOnClickOverlay="false"
  72. confirmColor="#096562"
  73. :formatter="formatter"
  74. @confirm="confirm"
  75. ></uv-datetime-picker>
  76. </view>
  77. <view class="foot">
  78. <view class="foot_left">
  79. <text>¥</text>
  80. {{ info.price }}
  81. </view>
  82. <view class="foot_right" @click="goPagePay">提交订单</view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. data() {
  89. return {
  90. info: {},
  91. // 预定房间数量
  92. roomCount: 1,
  93. // 住客姓名
  94. clientName: '张三',
  95. // 联系电话
  96. clientPhone: '13659865896',
  97. // 预计到店时间
  98. arriveTime: '',
  99. timeValue: Number(new Date())
  100. }
  101. },
  102. onLoad(options) {
  103. this.info = JSON.parse(options.info)
  104. // console.log(this.info)
  105. uni.$on('change', this.change)
  106. },
  107. methods: {
  108. change(e) {
  109. this.clientName = e.name
  110. },
  111. handleSelectClient() {
  112. uni.navigateTo({
  113. url: '/pages/common/common?type=1'
  114. })
  115. },
  116. confirm(e) {
  117. // console.log(e.value)
  118. let date = new Date(e.value)
  119. let month = date.getMonth() + 1
  120. let day = date.getDate()
  121. let H = date.getHours()
  122. let M = date.getMinutes()
  123. this.arriveTime = `${month}月${day}日${H}:${M}分之前`
  124. },
  125. formatter(type, value) {
  126. if (type === 'year') {
  127. return `${value}年`
  128. }
  129. if (type === 'month') {
  130. return `${value}月`
  131. }
  132. if (type === 'day') {
  133. return `${value}日`
  134. }
  135. return value
  136. },
  137. handleSelectTime() {
  138. this.$refs.datetimePicker.open()
  139. },
  140. handleAdd() {
  141. this.roomCount++
  142. },
  143. handleMinus() {
  144. if (this.roomCount > 1) {
  145. this.roomCount--
  146. } else {
  147. uni.showToast({
  148. title: '至少需要预定1间',
  149. icon: 'none'
  150. })
  151. }
  152. },
  153. // 提交订单按钮回调
  154. goPagePay() {
  155. let info = JSON.stringify(this.info)
  156. uni.navigateTo({
  157. url: `/pages/pay/pay?info=${info}`
  158. })
  159. },
  160. handleBack() {
  161. uni.navigateBack(1)
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .container {
  168. position: relative;
  169. display: flex;
  170. flex-direction: column;
  171. min-height: 100vh;
  172. background-color: #ebeced;
  173. .header {
  174. position: relative;
  175. height: 125rpx;
  176. overflow: hidden;
  177. img {
  178. width: 100%;
  179. }
  180. .header_title {
  181. position: absolute;
  182. top: 65rpx;
  183. left: 308rpx;
  184. color: #fff;
  185. font-size: 28rpx;
  186. }
  187. .header_icon {
  188. position: absolute;
  189. top: 56rpx;
  190. left: 5rpx;
  191. width: 47rpx;
  192. height: 47rpx;
  193. }
  194. }
  195. .info {
  196. display: flex;
  197. flex-direction: column;
  198. box-sizing: border-box;
  199. padding: 0 30rpx;
  200. margin: 0 auto;
  201. margin-top: 18rpx;
  202. width: 710rpx;
  203. border-radius: 15rpx;
  204. background-color: #fff;
  205. .info_time {
  206. display: flex;
  207. align-items: center;
  208. margin-top: 20rpx;
  209. font-size: 32rpx;
  210. font-weight: bold;
  211. .time_line {
  212. width: 17rpx;
  213. height: 1rpx;
  214. background-color: #096562;
  215. }
  216. .time_num {
  217. box-sizing: border-box;
  218. padding: 0 15rpx;
  219. height: 46rpx;
  220. line-height: 46rpx;
  221. font-size: 24rpx;
  222. font-weight: 400;
  223. border-radius: 66rpx;
  224. border: 1rpx solid #096562;
  225. background-color: #f0f2f5;
  226. }
  227. .gap {
  228. margin: 0 10rpx;
  229. }
  230. text {
  231. font-size: 24rpx;
  232. font-weight: 400;
  233. }
  234. }
  235. .info_msg {
  236. margin-top: 15rpx;
  237. font-size: 28rpx;
  238. font-weight: bold;
  239. }
  240. .info_type {
  241. display: flex;
  242. flex-wrap: wrap;
  243. margin-top: 15rpx;
  244. .type_item {
  245. box-sizing: border-box;
  246. padding: 0 15rpx;
  247. margin-right: 20rpx;
  248. height: 41rpx;
  249. line-height: 41rpx;
  250. font-size: 24rpx;
  251. color: #fff;
  252. border-radius: 34rpx;
  253. background-color: #096562;
  254. }
  255. }
  256. .info_tag {
  257. display: flex;
  258. flex-wrap: wrap;
  259. margin: 18rpx 0 30rpx;
  260. color: #808080;
  261. font-size: 24rpx;
  262. .tag_item {
  263. margin-right: 20rpx;
  264. }
  265. }
  266. }
  267. .msg {
  268. box-sizing: border-box;
  269. padding-left: 26rpx;
  270. margin: auto;
  271. margin-top: 20rpx;
  272. width: 710rpx;
  273. border-radius: 15rpx;
  274. background-color: #fff;
  275. .msg_title {
  276. height: 87rpx;
  277. line-height: 87rpx;
  278. font-size: 28rpx;
  279. font-weight: bold;
  280. border-bottom: 1rpx solid #e6e6e6;
  281. }
  282. .msg_box {
  283. display: flex;
  284. align-items: center;
  285. height: 97rpx;
  286. font-size: 28rpx;
  287. border-bottom: 1rpx solid #e6e6e6;
  288. .box_key {
  289. width: 120rpx;
  290. color: #808080;
  291. }
  292. .box_value {
  293. margin-left: 30rpx;
  294. flex: 1;
  295. input {
  296. box-sizing: border-box;
  297. padding-right: 30rpx;
  298. width: 100%;
  299. }
  300. }
  301. .color {
  302. color: #808080;
  303. }
  304. .box_icon {
  305. display: flex;
  306. align-items: center;
  307. .img {
  308. width: 47rpx;
  309. height: 47rpx;
  310. }
  311. .img2 {
  312. margin: 0 30rpx;
  313. width: 37rpx;
  314. height: 37rpx;
  315. }
  316. .img3 {
  317. margin: 0 30rpx;
  318. width: 40rpx;
  319. height: 40rpx;
  320. }
  321. }
  322. }
  323. }
  324. .foot {
  325. position: absolute;
  326. left: 0;
  327. right: 0;
  328. bottom: 0;
  329. padding: 0 20rpx;
  330. display: flex;
  331. justify-content: space-between;
  332. align-items: center;
  333. height: 126rpx;
  334. background-color: #fff;
  335. .foot_left {
  336. margin-top: -10rpx;
  337. font-size: 40rpx;
  338. color: #ff5733;
  339. text {
  340. font-size: 24rpx;
  341. }
  342. }
  343. .foot_right {
  344. margin-top: -10rpx;
  345. display: flex;
  346. justify-content: center;
  347. align-items: center;
  348. width: 238rpx;
  349. height: 80rpx;
  350. color: #fff;
  351. font-size: 32rpx;
  352. border-radius: 64rpx;
  353. background-color: #096562;
  354. }
  355. }
  356. }
  357. </style>