my.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view>
  3. <u-tabs :list="tab" active-color="#c74547" :is-scroll="false" :current="current" @change="change"></u-tabs>
  4. <view class="list">
  5. <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
  6. <view class="order_title" @click.stop="go(item)">
  7. <text>{{ item.shopName }}</text>
  8. <text class="icon">&#xe62d;</text>
  9. <view class="zhu">
  10. <text v-if="item.state == 0" style="color:#67c23a;">待酒店方确认</text>
  11. <text v-if="item.state == 1" style="color:#67c23a;">预定确认</text>
  12. <text v-if="item.state == 2" style="color:orange;">预定取消</text>
  13. </view>
  14. </view>
  15. <view class="r_item">
  16. <image :src="ip + item.shopRoom.pic" mode="aspectFill" class="pic"></image>
  17. <view class="con">
  18. <view class="title omit">{{ item.shopRoom.title }}</view>
  19. <view class="ms" style="padding-top:7px;">
  20. <text class="rmb">¥</text>
  21. <text class="price">{{ item.shopRoom.price }}</text>
  22. <text class="qi">起</text>
  23. </view>
  24. <view class="btn" @click.stop="call(item.bossPhone)" style="margin:8px 4px 0px 0px">电话</view>
  25. </view>
  26. <view class="clear"></view>
  27. </view>
  28. <view class="hj">{{ item.createTime }}</view>
  29. <view class="clear"></view>
  30. <view class="tk" v-if="item.state == 2">抱歉,入住的时间段酒店客房已满,无法安排入住。</view>
  31. </view>
  32. <view class="loading"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  33. </view>
  34. <!--预订订单信息-->
  35. <u-popup v-model="popup_show" :mask-close-able="false" mode="center" border-radius="14" width="90%" height="auto" :closeable="true">
  36. <view class="u-popup">
  37. <view class="tttt" style="font-weight: bolder;">预订信息</view>
  38. <u-steps :list="numList" mode="number" :current="-1" active-color="#c74547" style="margin: 20px 0px 20px 0px;"></u-steps>
  39. <view class="form_group hr">
  40. <view class="lable">我的姓名</view>
  41. <input v-model="book.name" :disabled="true" style="margin-left: -9px;" />
  42. </view>
  43. <view class="form_group hr">
  44. <view class="lable">联系方式</view>
  45. <input type="number" v-model="book.phone" :disabled="true" style="margin-left: -9px;" />
  46. </view>
  47. <view class="form_group hr">
  48. <view class="lable">入住日期</view>
  49. <input v-model="book.day" :disabled="true" style="margin-left: -9px;flex: 0.67;" />
  50. </view>
  51. <view class="form_group">
  52. <view class="lable">入住天数</view>
  53. <input :value="book.days + '天'" :disabled="true" style="margin-left: -9px;" />
  54. </view>
  55. <button class="btn" @click="op()" v-if="book.state==0">取消预定</button>
  56. </view>
  57. </u-popup>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. data() {
  63. return {
  64. ip: this.$http.urls.ip,
  65. tab: [{ name: '所有预订', state: '' }, { name: '待确认', state: 0 }, { name: '成功', state: 1 }, { name: '已退订', state: 2 }],
  66. numList: [{ name: '我的信息' }, { name: '订单确认' }, { name: '登记入住' }],
  67. current: 0,
  68. list: [],
  69. param: { pageNum: 1, state: '', role: 'member'},
  70. loadMore: true,
  71. popup_show: false,
  72. book: {}
  73. };
  74. },
  75. onLoad() {
  76. this.getData();
  77. },
  78. methods: {
  79. //获取数据
  80. getData() {
  81. this.$http.request({
  82. url: this.$http.urls.order,
  83. data: this.param,
  84. loading: 'false',
  85. success: res => {
  86. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  87. res.data.rows.forEach(item => {
  88. item.createTime = this.$u.timeFrom(new Date(item.createTime.replace(/\-/g, '/')).getTime());
  89. this.list.push(item);
  90. });
  91. }
  92. });
  93. },
  94. change(index) {
  95. this.current = index;
  96. this.param.state = this.tab[index].state;
  97. this.refresh();
  98. },
  99. go(item) {
  100. uni.navigateTo({ url: '/pages/shop/detail?shopId=' + item.shopId });
  101. },
  102. detail(item) {
  103. this.book = item;
  104. this.book.day = item.min + ' 至 ' + item.max;
  105. this.popup_show = true;
  106. },
  107. //拨打电话
  108. call(phoneNumber) {
  109. uni.makePhoneCall({
  110. phoneNumber: phoneNumber
  111. });
  112. },
  113. //取消预约
  114. op() {
  115. uni.showModal({
  116. title: '提示',
  117. content: '是否取消预约?',
  118. success: res => {
  119. if (res.confirm) {
  120. this.$http.request({
  121. url: this.$http.urls.orderDelete,
  122. data: { id: this.book.id},
  123. success: res => {
  124. uni.showToast({ title: '取消成功' });
  125. this.popup_show = false;
  126. this.refresh();
  127. }
  128. });
  129. }
  130. }
  131. });
  132. },
  133. //刷新数据
  134. refresh() {
  135. this.loadMore = true;
  136. this.param.pageNum = 1;
  137. this.list = [];
  138. this.getData();
  139. }
  140. },
  141. //下拉刷新
  142. onPullDownRefresh() {
  143. setTimeout(() => {
  144. uni.stopPullDownRefresh();
  145. this.refresh();
  146. }, 1000);
  147. },
  148. //上拉加载
  149. onReachBottom() {
  150. if (this.loadMore) {
  151. this.param.pageNum++;
  152. this.getData();
  153. }
  154. }
  155. };
  156. </script>
  157. <style lang="scss">
  158. page {
  159. background-color: $page;
  160. }
  161. .list {
  162. padding: 0px 10px 25px 10px;
  163. .item {
  164. background-color: white;
  165. padding: 5px 13px 13px 13px;
  166. margin-top: 10px;
  167. border-radius: 4px;
  168. .hj {
  169. text-align: right;
  170. padding-top: 13px;
  171. color: $dar2;
  172. }
  173. }
  174. }
  175. </style>