queryOrder.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="container">
  3. <view>
  4. <!-- #ifdef MP-WEIXIN -->
  5. <NavigateBar title="订单查询" control="back" bgcolor="#a09cc4"></NavigateBar>
  6. <!-- #endif -->
  7. <!-- #ifdef MP-ALIPAY -->
  8. <NavigateBar title="订单查询" bgcolor="#a09cc4"></NavigateBar>
  9. <!-- #endif -->
  10. </view>
  11. <view class="text-item">
  12. <u-input v-model="name" clearable type="text" prefixIcon="account" prefixIconStyle="font-size: 60rpx;"
  13. shape="circle" placeholder="请输入姓名"></u-input>
  14. </view>
  15. <view class="text-item">
  16. <u-input v-model="phone" clearable type="number" prefixIcon="phone" prefixIconStyle="font-size: 60rpx;"
  17. shape="circle" placeholder="请输入电话号码" maxlength="11"></u-input>
  18. </view>
  19. <view class="btn">
  20. <u-button text="点击查询" color="#9e97c3" @click="gotoQueryOrderResult"></u-button>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. mapState,
  27. mapMutations
  28. } from 'vuex'
  29. import NavigateBar from "../../components/navigateBar/navigate-bar.vue";
  30. export default {
  31. components: {
  32. NavigateBar
  33. },
  34. data() {
  35. return {
  36. name: '',
  37. phone: '',
  38. orderList: []
  39. };
  40. },
  41. computed: {
  42. ...mapState('m_user', ['userInfo']),
  43. ...mapState('m_business', ['currentHotel'])
  44. },
  45. methods: {
  46. ...mapMutations('m_business', ['updateReservationInfo', 'updateQueryOrderResult']),
  47. async gotoQueryOrderResult() {
  48. this.orderList = []
  49. if (!this.name && !this.phone) {
  50. uni.$showMsg('请填写信息!')
  51. return
  52. }
  53. let res = await uni.$http.post('/order/reservation', {
  54. name: this.name,
  55. phone: this.phone,
  56. hotelId: this.currentHotel.hotelId,
  57. pageNo: 1,
  58. pageSize: 10
  59. })
  60. this.orderList = res.data.data.records
  61. if (this.orderList.length > 0) {
  62. this.updateQueryOrderResult(this.orderList)
  63. uni.navigateTo({
  64. url: '/subpkg_checkin/queryOrderResult/queryOrderResult'
  65. })
  66. } else {
  67. uni.$showMsg('未查询到预定信息!')
  68. }
  69. }
  70. },
  71. onLoad() {
  72. // this.name = this.userInfo.name
  73. },
  74. // #ifdef MP-WEIXIN
  75. onShareAppMessage(info) {
  76. return {
  77. title: '源享住',
  78. path: 'pages/login/login',
  79. imageUrl: "/static/logo.png"
  80. }
  81. }
  82. // #endif
  83. }
  84. </script>
  85. <style>
  86. page {
  87. background-color: #EFEFF4;
  88. }
  89. </style>
  90. <style lang="less" scoped>
  91. .container {
  92. display: flex;
  93. flex-direction: column;
  94. .text-item {
  95. width: 90vw;
  96. margin: 20rpx 40rpx 0;
  97. background-color: #FFFFFF;
  98. border-radius: 38rpx;
  99. }
  100. .btn {
  101. bottom: 340rpx;
  102. left: 40rpx;
  103. right: 40rpx;
  104. position: fixed;
  105. }
  106. }
  107. </style>