affirmOrder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  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.startTimeDay }}日
  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">{{ info.item.hName }}</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">{{ info.item.hAreas }}㎡</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. {{ roomCount }}间{{ info.nightNum }}晚 共
  85. <text>¥</text>
  86. <span>{{ roomCount * info.item.price * info.nightNum }}.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">¥{{ roomCount * info.item.price * info.nightNum }}</text>
  94. </view>
  95. <view class="all_box">
  96. <view class="box_list">
  97. <view class="list_item" v-for="(item, index) in info.dayList" :key="index">{{ item }}</view>
  98. </view>
  99. <view class="box_total">{{ roomCount }}间 x {{ info.nightNum }}晚 x ¥{{ info.item.price }}</view>
  100. </view>
  101. </view>
  102. </view>
  103. <!-- 底部提交订单区域 -->
  104. <view class="foot">
  105. <view class="foot_left">
  106. <text>¥</text>
  107. {{ roomCount * info.item.price * info.nightNum }}
  108. </view>
  109. <view class="foot_right" @click="goPagePay">提交订单</view>
  110. </view>
  111. </view>
  112. </template>
  113. <script>
  114. export default {
  115. data() {
  116. return {
  117. info: {},
  118. // 预定房间数量
  119. roomCount: 1,
  120. // 住客姓名
  121. clientName: '',
  122. // 联系电话
  123. clientPhone: '',
  124. // 预计到店时间
  125. arriveTime: '',
  126. // 当前时间
  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. this.clientPhone = e.phone
  139. },
  140. handleSelectClient() {
  141. uni.navigateTo({
  142. url: '/pages/common/common?type=1'
  143. })
  144. },
  145. confirm(e) {
  146. // console.log(e.value)
  147. let date = new Date(e.value)
  148. let month = date.getMonth() + 1
  149. let day = date.getDate()
  150. let H = date.getHours()
  151. let M = date.getMinutes()
  152. this.arriveTime = `${month}月${day}日${H}:${M}分之前`
  153. },
  154. formatter(type, value) {
  155. if (type === 'year') {
  156. return `${value}年`
  157. }
  158. if (type === 'month') {
  159. return `${value}月`
  160. }
  161. if (type === 'day') {
  162. return `${value}日`
  163. }
  164. return value
  165. },
  166. handleSelectTime() {
  167. this.$refs.datetimePicker.open()
  168. },
  169. handleAdd() {
  170. this.roomCount++
  171. },
  172. handleMinus() {
  173. if (this.roomCount > 1) {
  174. this.roomCount--
  175. } else {
  176. uni.showToast({
  177. title: '至少需要预定1间',
  178. icon: 'none'
  179. })
  180. }
  181. },
  182. // 提交订单按钮回调
  183. async goPagePay() {
  184. if (!this.clientName) {
  185. uni.showToast({
  186. title: '请输入住客姓名',
  187. icon: 'none',
  188. mask: true
  189. })
  190. return
  191. }
  192. if (!this.clientPhone) {
  193. uni.showToast({
  194. title: '请输入联系电话',
  195. icon: 'none',
  196. mask: true
  197. })
  198. return
  199. }
  200. const res = await this.$myRequest({
  201. url: '/mhotel/abkcreateOrder.action',
  202. data: {
  203. houseId: this.info.item.id,
  204. startTime: this.info.queryStartTime,
  205. endTime: this.info.queryEndTime,
  206. houseOrderNumber: this.roomCount,
  207. userName: this.clientName,
  208. userPhone: this.clientPhone,
  209. userId: uni.getStorageSync('userInfo').id
  210. }
  211. })
  212. // console.log(res)
  213. if (res.code === 200) {
  214. let info = JSON.stringify({
  215. detaliInfo: this.info,
  216. houseOrderNumber: this.roomCount,
  217. userName: this.clientName,
  218. userPhone: this.clientPhone,
  219. price: this.roomCount * this.info.item.price * this.info.nightNum,
  220. orderNo: res.data
  221. })
  222. uni.navigateTo({
  223. url: `/pages/pay/pay?info=${info}`
  224. })
  225. }
  226. },
  227. handleBack() {
  228. uni.navigateBack(1)
  229. }
  230. }
  231. }
  232. </script>
  233. <style lang="scss" scoped>
  234. .container {
  235. position: relative;
  236. display: flex;
  237. flex-direction: column;
  238. height: 100vh;
  239. overflow: hidden;
  240. background-color: #ebeced;
  241. .header {
  242. position: relative;
  243. height: 145rpx;
  244. overflow: hidden;
  245. img {
  246. width: 100%;
  247. }
  248. .header_title {
  249. position: absolute;
  250. top: 65rpx;
  251. left: 308rpx;
  252. color: #fff;
  253. font-size: 28rpx;
  254. }
  255. .header_icon {
  256. position: absolute;
  257. top: 76rpx;
  258. left: 5rpx;
  259. width: 47rpx;
  260. height: 47rpx;
  261. }
  262. }
  263. .body {
  264. height: calc(100vh - 271rpx);
  265. overflow-y: auto;
  266. .info {
  267. display: flex;
  268. flex-direction: column;
  269. box-sizing: border-box;
  270. padding: 0 30rpx;
  271. margin: 0 auto;
  272. margin-top: 18rpx;
  273. width: 710rpx;
  274. border-radius: 15rpx;
  275. background-color: #fff;
  276. .info_time {
  277. display: flex;
  278. align-items: center;
  279. margin-top: 20rpx;
  280. font-size: 32rpx;
  281. font-weight: bold;
  282. .time_line {
  283. width: 17rpx;
  284. height: 1rpx;
  285. background-color: #096562;
  286. }
  287. .time_num {
  288. box-sizing: border-box;
  289. padding: 0 15rpx;
  290. height: 46rpx;
  291. line-height: 46rpx;
  292. font-size: 24rpx;
  293. font-weight: 400;
  294. border-radius: 66rpx;
  295. border: 1rpx solid #096562;
  296. background-color: #f0f2f5;
  297. }
  298. .gap {
  299. margin: 0 10rpx;
  300. }
  301. text {
  302. font-size: 24rpx;
  303. font-weight: 400;
  304. }
  305. }
  306. .info_msg {
  307. margin-top: 15rpx;
  308. font-size: 28rpx;
  309. font-weight: bold;
  310. }
  311. .info_type {
  312. display: flex;
  313. flex-wrap: wrap;
  314. margin-top: 15rpx;
  315. .type_item {
  316. box-sizing: border-box;
  317. padding: 0 15rpx;
  318. margin-right: 20rpx;
  319. height: 41rpx;
  320. line-height: 41rpx;
  321. font-size: 24rpx;
  322. color: #fff;
  323. border-radius: 34rpx;
  324. background-color: #096562;
  325. }
  326. }
  327. .info_tag {
  328. display: flex;
  329. flex-wrap: wrap;
  330. margin: 18rpx 0 30rpx;
  331. color: #808080;
  332. font-size: 24rpx;
  333. .tag_item {
  334. margin-right: 20rpx;
  335. }
  336. }
  337. }
  338. .msg {
  339. box-sizing: border-box;
  340. padding-left: 26rpx;
  341. margin: auto;
  342. margin-top: 20rpx;
  343. width: 710rpx;
  344. border-radius: 15rpx;
  345. background-color: #fff;
  346. .msg_title {
  347. height: 87rpx;
  348. line-height: 87rpx;
  349. font-size: 28rpx;
  350. font-weight: bold;
  351. border-bottom: 1rpx solid #e6e6e6;
  352. }
  353. .msg_box {
  354. display: flex;
  355. align-items: center;
  356. height: 97rpx;
  357. font-size: 28rpx;
  358. border-bottom: 1rpx solid #e6e6e6;
  359. .box_key {
  360. width: 120rpx;
  361. color: #808080;
  362. }
  363. .box_value {
  364. margin-left: 30rpx;
  365. flex: 1;
  366. input {
  367. box-sizing: border-box;
  368. padding-right: 30rpx;
  369. width: 100%;
  370. }
  371. }
  372. .color {
  373. color: #808080;
  374. }
  375. .box_icon {
  376. display: flex;
  377. align-items: center;
  378. .img {
  379. width: 47rpx;
  380. height: 47rpx;
  381. }
  382. .img2 {
  383. margin: 0 30rpx;
  384. width: 37rpx;
  385. height: 37rpx;
  386. }
  387. .img3 {
  388. margin: 0 30rpx;
  389. width: 40rpx;
  390. height: 40rpx;
  391. }
  392. }
  393. }
  394. }
  395. .price {
  396. box-sizing: border-box;
  397. padding-left: 26rpx;
  398. margin: 20rpx auto;
  399. width: 710rpx;
  400. height: 197rpx;
  401. border-radius: 15rpx;
  402. background-color: #fff;
  403. .price_title {
  404. line-height: 92rpx;
  405. font-size: 28rpx;
  406. font-weight: bold;
  407. border-bottom: 1rpx solid #e6e6e6;
  408. }
  409. .price_box {
  410. display: flex;
  411. justify-content: space-between;
  412. align-items: center;
  413. height: 92rpx;
  414. font-size: 28rpx;
  415. .box_key {
  416. color: #808080;
  417. }
  418. .box_value {
  419. display: flex;
  420. align-items: center;
  421. text {
  422. color: #ff5733;
  423. font-size: 24rpx;
  424. }
  425. span {
  426. margin-right: 30rpx;
  427. color: #ff5733;
  428. }
  429. }
  430. }
  431. }
  432. .all {
  433. box-sizing: border-box;
  434. padding-left: 26rpx;
  435. margin: 0 auto 60rpx;
  436. width: 710rpx;
  437. border-radius: 15rpx;
  438. background-color: #fff;
  439. .all_title {
  440. display: flex;
  441. height: 92rpx;
  442. justify-content: space-between;
  443. align-items: center;
  444. font-size: 28rpx;
  445. font-weight: bold;
  446. border-bottom: 1rpx solid #e6e6e6;
  447. .mr_30 {
  448. margin-right: 30rpx;
  449. }
  450. }
  451. .all_box {
  452. box-sizing: border-box;
  453. padding-right: 26rpx;
  454. display: flex;
  455. justify-content: space-between;
  456. font-size: 28rpx;
  457. .box_list {
  458. margin-bottom: 28rpx;
  459. color: #808080;
  460. .list_item {
  461. margin-top: 30rpx;
  462. }
  463. }
  464. .box_total {
  465. display: flex;
  466. justify-content: center;
  467. align-items: center;
  468. }
  469. }
  470. }
  471. }
  472. .foot {
  473. position: absolute;
  474. left: 0;
  475. right: 0;
  476. bottom: 0;
  477. padding: 0 20rpx;
  478. display: flex;
  479. justify-content: space-between;
  480. align-items: center;
  481. height: 126rpx;
  482. background-color: #fff;
  483. .foot_left {
  484. margin-top: -10rpx;
  485. font-size: 40rpx;
  486. color: #ff5733;
  487. text {
  488. font-size: 24rpx;
  489. }
  490. }
  491. .foot_right {
  492. margin-top: -10rpx;
  493. display: flex;
  494. justify-content: center;
  495. align-items: center;
  496. width: 238rpx;
  497. height: 80rpx;
  498. color: #fff;
  499. font-size: 32rpx;
  500. border-radius: 64rpx;
  501. background-color: #096562;
  502. }
  503. }
  504. }
  505. </style>