sale.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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>
  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">退订:{{item.msg}}</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="-1" 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" style="margin-left: -9px;" />
  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(book.phone)">拨打</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" style="margin-left: -9px;" />
  53. </view>
  54. <u-divider style="padding-top: 10px;">订单处理</u-divider>
  55. <button class="btn" style="background-color:#67c23a;" @click="op(1)">确认</button>
  56. <button class="btn" @click="refuse_show = true">退订</button>
  57. </view>
  58. </u-popup>
  59. <!--预订订单信息-->
  60. <u-popup v-model="refuse_show" :mask-close-able="false" mode="center" border-radius="14" width="90%" height="auto" :closeable="true">
  61. <view class="u-popup">
  62. <view class="tttt" style="font-weight: bolder;">退订原因</view>
  63. <textarea placeholder="例如:抱歉,入住的时间段酒店客房已满,无法安排入住。" v-model="book.msg"></textarea>
  64. <button class="btn" @click="op(2)">确定</button>
  65. </view>
  66. </u-popup>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. ip: this.$http.urls.ip,
  74. tab: [{ name: '所有预订', state: '' }, { name: '待确认', state: 0 }, { name: '成功', state: 1 }, { name: '已退订', state: 2 }],
  75. numList: [{ name: '客户资料' }, { name: '订单确认' }, { name: '登记入住' }],
  76. current: 0,
  77. list: [],
  78. param: { pageNum: 1, state: '', role: 'sale' },
  79. loadMore: true,
  80. popup_show: false,
  81. refuse_show: false,
  82. book: {}
  83. };
  84. },
  85. onLoad() {
  86. this.getData();
  87. },
  88. methods: {
  89. //获取数据
  90. getData() {
  91. this.$http.request({
  92. url: this.$http.urls.order,
  93. data: this.param,
  94. loading: 'false',
  95. success: res => {
  96. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  97. res.data.rows.forEach(item => {
  98. item.createTime = this.$u.timeFrom(new Date(item.createTime.replace(/\-/g, '/')).getTime());
  99. this.list.push(item);
  100. });
  101. }
  102. });
  103. },
  104. change(index) {
  105. this.current = index;
  106. this.param.state = this.tab[index].state;
  107. this.refresh();
  108. },
  109. go(item) {
  110. uni.navigateTo({ url: '/pages/shop/detail?shopId=' + item.shopId });
  111. },
  112. detail(item) {
  113. this.book = JSON.parse(JSON.stringify(item));
  114. delete this.book.createTime;
  115. this.book.day = item.min + ' 至 ' + item.max;
  116. this.popup_show = true;
  117. },
  118. //拨打电话
  119. call(phoneNumber) {
  120. uni.makePhoneCall({
  121. phoneNumber: phoneNumber
  122. });
  123. },
  124. //处理订单
  125. op(index) {
  126. uni.showModal({
  127. title: '提示',
  128. content: '是否处理该订单?',
  129. success: res => {
  130. if (res.confirm) {
  131. this.book.state = index;
  132. this.$http.request({
  133. url: this.$http.urls.orderDeal,
  134. data: this.book,
  135. method: 'POST',
  136. success: res => {
  137. uni.showToast({ title: '操作成功' });
  138. this.refuse_show = false;
  139. this.popup_show = false;
  140. this.refresh();
  141. }
  142. });
  143. }
  144. }
  145. });
  146. },
  147. //刷新数据
  148. refresh() {
  149. this.loadMore = true;
  150. this.param.pageNum = 1;
  151. this.list = [];
  152. this.getData();
  153. }
  154. },
  155. //下拉刷新
  156. onPullDownRefresh() {
  157. setTimeout(() => {
  158. uni.stopPullDownRefresh();
  159. this.refresh();
  160. }, 1000);
  161. },
  162. //上拉加载
  163. onReachBottom() {
  164. if (this.loadMore) {
  165. this.param.pageNum++;
  166. this.getData();
  167. }
  168. }
  169. };
  170. </script>
  171. <style lang="scss">
  172. page {
  173. background-color: $page;
  174. }
  175. .list {
  176. padding: 0px 10px 25px 10px;
  177. .item {
  178. background-color: white;
  179. padding: 5px 13px 13px 13px;
  180. margin-top: 10px;
  181. border-radius: 4px;
  182. .hj {
  183. text-align: right;
  184. padding-top: 13px;
  185. color: $dar2;
  186. }
  187. }
  188. }
  189. textarea {
  190. border-radius: 5px;
  191. padding: 7px;
  192. width: 95%;
  193. height: 100px;
  194. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
  195. margin-bottom: 15px;
  196. }
  197. </style>