my.vue 4.8 KB

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