queryOrder.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="container">
  3. <view class="text-item">
  4. <u-input v-model="name" clearable type="text" prefixIcon="account" prefixIconStyle="font-size: 60rpx;"
  5. shape="circle" placeholder="请输入姓名"></u-input>
  6. </view>
  7. <view class="text-item">
  8. <u-input v-model="phone" clearable type="number" prefixIcon="phone" prefixIconStyle="font-size: 60rpx;"
  9. shape="circle" placeholder="请输入电话号码" maxlength="11"></u-input>
  10. </view>
  11. <view class="btn-item">
  12. <u-button text="点击查询" color="#7796F5" @click="queryOrder"></u-button>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import {
  18. mapState,
  19. mapMutations
  20. } from 'vuex'
  21. export default {
  22. data() {
  23. return {
  24. name: '',
  25. phone: ''
  26. };
  27. },
  28. computed: {
  29. ...mapState('m_business', ['reservationInfo']),
  30. ...mapState('m_user', ['userInfo'])
  31. },
  32. methods: {
  33. ...mapMutations('m_business', ['updateReservationInfo']),
  34. async queryOrder() {
  35. if (this.name == '' && this.phone == '') {
  36. uni.$showMsg('请填写信息!')
  37. return
  38. }
  39. let res = await uni.$http.post('/hotelOrder/queryByCondition', {
  40. name: this.name,
  41. phone: this.phone,
  42. deleted: false,
  43. status: 1,
  44. pageNo: 1,
  45. pageSize: 1
  46. })
  47. console.log(res)
  48. if (res.data.data.records.length == 1) {
  49. this.updateReservationInfo(Object.assign(this.reservationInfo, {
  50. orderInfo: res.data.data.records[0]
  51. }))
  52. uni.navigateTo({
  53. url: '/subpkg_checkin/orderDetail/orderDetail'
  54. })
  55. } else {
  56. uni.$showMsg('未查询到预订信息!')
  57. }
  58. }
  59. },
  60. onLoad() {
  61. this.name = this.userInfo.name
  62. }
  63. }
  64. </script>
  65. <style lang="less">
  66. page {
  67. background-color: #EFEFF4;
  68. }
  69. .text-item {
  70. width: 90vw;
  71. margin: 40rpx auto;
  72. background-color: #FFFFFF;
  73. border-radius: 38rpx;
  74. }
  75. .btn-item {
  76. bottom: 340rpx;
  77. left: 30rpx;
  78. right: 30rpx;
  79. position: fixed;
  80. }
  81. </style>