affirmOrder.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  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. <view class="body">
  12. <!-- 房间信息区域 -->
  13. <view class="info">
  14. <view class="info_time">
  15. {{ info.startTimeMonth }}月{{ info.startTimeMonth }}日
  16. <text class="gap">星期{{ info.startTimeWeek }}</text>
  17. <view class="time_line"></view>
  18. <view class="time_num">{{ info.nightNum }}晚</view>
  19. <view class="time_line"></view>
  20. <view class="gap">{{ info.endTimeMonth }}月{{ info.endTimeDay }}日</view>
  21. <text>星期{{ info.endTimeWeek }}</text>
  22. </view>
  23. <view class="info_msg">大床房</view>
  24. <view class="info_type">
  25. <view class="type_item">包吃住型</view>
  26. <view class="type_item">包吃住型</view>
  27. <view class="type_item">包吃住型</view>
  28. </view>
  29. <view class="info_tag">
  30. <view class="tag_item">16-20㎡</view>
  31. <view class="tag_item">双人床</view>
  32. <view class="tag_item">窗户位于走廊/窗户较小</view>
  33. </view>
  34. </view>
  35. <!-- 入住信息区域 -->
  36. <view class="msg">
  37. <view class="msg_title">入住信息</view>
  38. <view class="msg_box">
  39. <view class="box_key">房间数量</view>
  40. <view class="box_value">{{ roomCount }}间</view>
  41. <view class="box_icon">
  42. <img class="img" src="../../static/index/add.png" @click="handleAdd" />
  43. <img class="img2" src="../../static/index/minus.png" @click="handleMinus" />
  44. </view>
  45. </view>
  46. <view class="msg_box">
  47. <view class="box_key">住客姓名</view>
  48. <view class="box_value">
  49. <input type="text" placeholder="请输入住客姓名" v-model="clientName" />
  50. </view>
  51. <view class="box_icon" @click="handleSelectClient">
  52. <img class="img2" src="../../static/index/people.png" />
  53. </view>
  54. </view>
  55. <view class="msg_box">
  56. <view class="box_key">联系电话</view>
  57. <view class="box_value">
  58. <input type="number" maxlength="11" placeholder="请输入联系电话" v-model="clientPhone" />
  59. </view>
  60. </view>
  61. <view class="msg_box" @click="handleSelectTime">
  62. <view class="box_key">预计到店</view>
  63. <view class="box_value" :class="{ color: !arriveTime }">{{ arriveTime ? arriveTime : '请选择预计到店时间' }}</view>
  64. <view class="box_icon">
  65. <img class="img3" src="../../static/index/right2.png" />
  66. </view>
  67. </view>
  68. <uv-datetime-picker
  69. ref="datetimePicker"
  70. v-model="timeValue"
  71. mode="datetime"
  72. :closeOnClickOverlay="false"
  73. confirmColor="#096562"
  74. :formatter="formatter"
  75. @confirm="confirm"
  76. ></uv-datetime-picker>
  77. </view>
  78. <!-- 费用信息区域 -->
  79. <view class="price">
  80. <view class="price_title">费用明细</view>
  81. <view class="price_box">
  82. <view class="box_key">在线支付</view>
  83. <view class="box_value">
  84. 1间1晚 共
  85. <text>¥</text>
  86. <span>280.00</span>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="all">
  91. <view class="all_title">
  92. <text>房费</text>
  93. <text class="mr_30">¥280</text>
  94. </view>
  95. <view class="all_box">
  96. <view class="box_list">
  97. <view class="list_item">2023-08-01</view>
  98. <view class="list_item">2023-08-02</view>
  99. </view>
  100. <view class="box_total">1 x ¥280</view>
  101. </view>
  102. </view>
  103. </view>
  104. <!-- 底部提交订单区域 -->
  105. <view class="foot">
  106. <view class="foot_left">
  107. <text>¥</text>
  108. {{ info.price }}
  109. </view>
  110. <view class="foot_right" @click="goPagePay">提交订单</view>
  111. </view>
  112. </view>
  113. </template>
  114. <script>
  115. export default {
  116. data() {
  117. return {
  118. info: {},
  119. // 预定房间数量
  120. roomCount: 1,
  121. // 住客姓名
  122. clientName: '张三',
  123. // 联系电话
  124. clientPhone: '13659865896',
  125. // 预计到店时间
  126. arriveTime: '',
  127. timeValue: Number(new Date())
  128. }
  129. },
  130. onLoad(options) {
  131. this.info = JSON.parse(options.info)
  132. // console.log(this.info)
  133. uni.$on('change', this.change)
  134. },
  135. methods: {
  136. change(e) {
  137. this.clientName = e.name
  138. },
  139. handleSelectClient() {
  140. uni.navigateTo({
  141. url: '/pages/common/common?type=1'
  142. })
  143. },
  144. confirm(e) {
  145. // console.log(e.value)
  146. let date = new Date(e.value)
  147. let month = date.getMonth() + 1
  148. let day = date.getDate()
  149. let H = date.getHours()
  150. let M = date.getMinutes()
  151. this.arriveTime = `${month}月${day}日${H}:${M}分之前`
  152. },
  153. formatter(type, value) {
  154. if (type === 'year') {
  155. return `${value}年`
  156. }
  157. if (type === 'month') {
  158. return `${value}月`
  159. }
  160. if (type === 'day') {
  161. return `${value}日`
  162. }
  163. return value
  164. },
  165. handleSelectTime() {
  166. this.$refs.datetimePicker.open()
  167. },
  168. handleAdd() {
  169. this.roomCount++
  170. },
  171. handleMinus() {
  172. if (this.roomCount > 1) {
  173. this.roomCount--
  174. } else {
  175. uni.showToast({
  176. title: '至少需要预定1间',
  177. icon: 'none'
  178. })
  179. }
  180. },
  181. // 提交订单按钮回调
  182. goPagePay() {
  183. let info = JSON.stringify(this.info)
  184. uni.navigateTo({
  185. url: `/pages/pay/pay?info=${info}`
  186. })
  187. },
  188. handleBack() {
  189. uni.navigateBack(1)
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="scss" scoped>
  195. .container {
  196. position: relative;
  197. display: flex;
  198. flex-direction: column;
  199. height: 100vh;
  200. overflow: hidden;
  201. background-color: #ebeced;
  202. .header {
  203. position: relative;
  204. height: 145rpx;
  205. overflow: hidden;
  206. img {
  207. width: 100%;
  208. }
  209. .header_title {
  210. position: absolute;
  211. top: 65rpx;
  212. left: 308rpx;
  213. color: #fff;
  214. font-size: 28rpx;
  215. }
  216. .header_icon {
  217. position: absolute;
  218. top: 76rpx;
  219. left: 5rpx;
  220. width: 47rpx;
  221. height: 47rpx;
  222. }
  223. }
  224. .body {
  225. height: calc(100vh - 271rpx);
  226. overflow-y: auto;
  227. .info {
  228. display: flex;
  229. flex-direction: column;
  230. box-sizing: border-box;
  231. padding: 0 30rpx;
  232. margin: 0 auto;
  233. margin-top: 18rpx;
  234. width: 710rpx;
  235. border-radius: 15rpx;
  236. background-color: #fff;
  237. .info_time {
  238. display: flex;
  239. align-items: center;
  240. margin-top: 20rpx;
  241. font-size: 32rpx;
  242. font-weight: bold;
  243. .time_line {
  244. width: 17rpx;
  245. height: 1rpx;
  246. background-color: #096562;
  247. }
  248. .time_num {
  249. box-sizing: border-box;
  250. padding: 0 15rpx;
  251. height: 46rpx;
  252. line-height: 46rpx;
  253. font-size: 24rpx;
  254. font-weight: 400;
  255. border-radius: 66rpx;
  256. border: 1rpx solid #096562;
  257. background-color: #f0f2f5;
  258. }
  259. .gap {
  260. margin: 0 10rpx;
  261. }
  262. text {
  263. font-size: 24rpx;
  264. font-weight: 400;
  265. }
  266. }
  267. .info_msg {
  268. margin-top: 15rpx;
  269. font-size: 28rpx;
  270. font-weight: bold;
  271. }
  272. .info_type {
  273. display: flex;
  274. flex-wrap: wrap;
  275. margin-top: 15rpx;
  276. .type_item {
  277. box-sizing: border-box;
  278. padding: 0 15rpx;
  279. margin-right: 20rpx;
  280. height: 41rpx;
  281. line-height: 41rpx;
  282. font-size: 24rpx;
  283. color: #fff;
  284. border-radius: 34rpx;
  285. background-color: #096562;
  286. }
  287. }
  288. .info_tag {
  289. display: flex;
  290. flex-wrap: wrap;
  291. margin: 18rpx 0 30rpx;
  292. color: #808080;
  293. font-size: 24rpx;
  294. .tag_item {
  295. margin-right: 20rpx;
  296. }
  297. }
  298. }
  299. .msg {
  300. box-sizing: border-box;
  301. padding-left: 26rpx;
  302. margin: auto;
  303. margin-top: 20rpx;
  304. width: 710rpx;
  305. border-radius: 15rpx;
  306. background-color: #fff;
  307. .msg_title {
  308. height: 87rpx;
  309. line-height: 87rpx;
  310. font-size: 28rpx;
  311. font-weight: bold;
  312. border-bottom: 1rpx solid #e6e6e6;
  313. }
  314. .msg_box {
  315. display: flex;
  316. align-items: center;
  317. height: 97rpx;
  318. font-size: 28rpx;
  319. border-bottom: 1rpx solid #e6e6e6;
  320. .box_key {
  321. width: 120rpx;
  322. color: #808080;
  323. }
  324. .box_value {
  325. margin-left: 30rpx;
  326. flex: 1;
  327. input {
  328. box-sizing: border-box;
  329. padding-right: 30rpx;
  330. width: 100%;
  331. }
  332. }
  333. .color {
  334. color: #808080;
  335. }
  336. .box_icon {
  337. display: flex;
  338. align-items: center;
  339. .img {
  340. width: 47rpx;
  341. height: 47rpx;
  342. }
  343. .img2 {
  344. margin: 0 30rpx;
  345. width: 37rpx;
  346. height: 37rpx;
  347. }
  348. .img3 {
  349. margin: 0 30rpx;
  350. width: 40rpx;
  351. height: 40rpx;
  352. }
  353. }
  354. }
  355. }
  356. .price {
  357. box-sizing: border-box;
  358. padding-left: 26rpx;
  359. margin: 20rpx auto;
  360. width: 710rpx;
  361. height: 197rpx;
  362. border-radius: 15rpx;
  363. background-color: #fff;
  364. .price_title {
  365. line-height: 92rpx;
  366. font-size: 28rpx;
  367. font-weight: bold;
  368. border-bottom: 1rpx solid #e6e6e6;
  369. }
  370. .price_box {
  371. display: flex;
  372. justify-content: space-between;
  373. align-items: center;
  374. height: 92rpx;
  375. font-size: 28rpx;
  376. .box_key {
  377. color: #808080;
  378. }
  379. .box_value {
  380. display: flex;
  381. align-items: center;
  382. text {
  383. color: #ff5733;
  384. font-size: 24rpx;
  385. }
  386. span {
  387. margin-right: 30rpx;
  388. color: #ff5733;
  389. }
  390. }
  391. }
  392. }
  393. .all {
  394. box-sizing: border-box;
  395. padding-left: 26rpx;
  396. margin: 0 auto 60rpx;
  397. width: 710rpx;
  398. border-radius: 15rpx;
  399. background-color: #fff;
  400. .all_title {
  401. display: flex;
  402. height: 92rpx;
  403. justify-content: space-between;
  404. align-items: center;
  405. font-size: 28rpx;
  406. font-weight: bold;
  407. border-bottom: 1rpx solid #e6e6e6;
  408. .mr_30 {
  409. margin-right: 30rpx;
  410. }
  411. }
  412. .all_box {
  413. box-sizing: border-box;
  414. padding-right: 26rpx;
  415. display: flex;
  416. justify-content: space-between;
  417. font-size: 28rpx;
  418. .box_list {
  419. margin-bottom: 28rpx;
  420. color: #808080;
  421. .list_item {
  422. margin-top: 30rpx;
  423. }
  424. }
  425. .box_total {
  426. display: flex;
  427. justify-content: center;
  428. align-items: center;
  429. }
  430. }
  431. }
  432. }
  433. .foot {
  434. position: absolute;
  435. left: 0;
  436. right: 0;
  437. bottom: 0;
  438. padding: 0 20rpx;
  439. display: flex;
  440. justify-content: space-between;
  441. align-items: center;
  442. height: 126rpx;
  443. background-color: #fff;
  444. .foot_left {
  445. margin-top: -10rpx;
  446. font-size: 40rpx;
  447. color: #ff5733;
  448. text {
  449. font-size: 24rpx;
  450. }
  451. }
  452. .foot_right {
  453. margin-top: -10rpx;
  454. display: flex;
  455. justify-content: center;
  456. align-items: center;
  457. width: 238rpx;
  458. height: 80rpx;
  459. color: #fff;
  460. font-size: 32rpx;
  461. border-radius: 64rpx;
  462. background-color: #096562;
  463. }
  464. }
  465. }
  466. </style>