my.vue 5.0 KB

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