order_mark.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <view class="content">
  3. <!-- 第一层模块 -->
  4. <view class="one-order3" v-if="orderList.orderStatu == 5">
  5. <view class="one-order-title">订单已完成 / 期待您再次光临<text class="all-price">¥{{orderList.shouldFree}}</text></view>
  6. <view class="one-order-menshi">房费<text class="menshi-price">¥{{orderList.totalFree}}</text></view>
  7. <view class="room-button-6"@click="getOrderDelete(orderList.orderId)">
  8. <text>删除订单</text>
  9. </view>
  10. <view class="room-button2-6" @click="navigateToWanchengZaici(orderList.roomTypeId)">
  11. <text>再次预定</text>
  12. </view>
  13. </view>
  14. <view class="one-order3" v-else-if="orderList.orderStatu == 4">
  15. <view class="one-order-title">待结账</view>
  16. <view class="one-order-menshi" v-if="billXin.flag==1">
  17. 预退款<text class="menshi-price">¥{{billXin.refundFee}}</text>
  18. </view>
  19. <view class="one-order-menshi" v-if="billXin.flag==2">
  20. 预补缴<text class="menshi-price">¥{{billXin.supperFee}}</text>
  21. </view>
  22. <view class="room-button-6">
  23. <text>删除订单</text>
  24. </view>
  25. <view class="room-button2-6" v-if="billXin.flag==1">
  26. <text>退款</text>
  27. </view>
  28. <view class="room-button2-6" v-if="billXin.flag==2">
  29. <text>补缴</text>
  30. </view>
  31. </view>
  32. <view class="one-order" v-else>
  33. <view class="one-order-title">
  34. <text v-if="orderList.orderStatu == 0">订单已取消 / 期待您再次光临</text>
  35. <text v-if="orderList.orderStatu == 1">请在10分钟之内支付</text>
  36. <text v-if="orderList.orderStatu == 2">预定成功 / 等待您的入住</text>
  37. <text v-if="orderList.orderStatu == 3">办理成功 / 期待您的到来</text>
  38. <text class="all-price">¥{{orderList.payAmount}}</text>
  39. </view>
  40. <view class="one-order-yufukuan">
  41. 房费<text class="yufukuan-price">¥{{orderList.payAmount}}</text>
  42. </view>
  43. <view class="room-button" v-if="orderList.orderStatu != 2&& orderList.orderStatu != 3">
  44. <text v-if="orderList.orderStatu == 0" @click="navigateToZaici(orderList.enableStartTime,orderList.enableEndTime,orderList.roomTypeId)">再次预定</text>
  45. <text v-if="orderList.orderStatu == 1" @click="openQu()(orderList.orderId,'warn')">取消订单</text>
  46. </view>
  47. <view class="room-button2" :class="{'buttonNo': orderList.orderStatu == 3 || orderList.orderStatu == 2}">
  48. <text v-if="orderList.orderStatu == 0" @click="openDel(orderList.orderId,'warn')">删除</text>
  49. <text v-if="orderList.orderStatu == 1" @click="getOrderPay(orderList.orderId)">支付</text>
  50. <text v-if="orderList.orderStatu == 3" @click="openTui(orderList.orderId,'warn')">办理退房</text>
  51. <text v-if="orderList.orderStatu == 2" @click="openRu(orderList.orderId,'warn')">办理入住</text>
  52. </view>
  53. </view>
  54. <!-- 第二层模块 -->
  55. <view class="two-order" :class="{'two-order3': orderList.orderStatu == 3,'two-order4': orderList.orderStatu == 5||orderList.orderStatu == 4}">
  56. <view class="two-order-title">订单信息</view>
  57. <view class="two-order-name">预定信息:<text class="two-order-txt">{{orderList.userName}}</text></view>
  58. <view class="two-order-phone">手机号码:<text class="two-order-txt">{{orderList.userPhone}}</text></view>
  59. <view class="two-order-count">订 单 号:<text class="two-order-txt">{{orderList.orderId}}</text></view>
  60. <view class="two-order-time">下单时间:<text class="two-order-txt">{{orderList.createTime}}</text></view>
  61. <view class="two-order-xing">户 型:<text class="two-order-txt">{{orderList.roomNo}}</text></view>
  62. <view class="two-order-zhuTime">入离时间:<text class="two-order-txt" v-if="orderList.enableStartTime,orderList.enableEndTime">入住日{{orderList.enableStartTime.substring(11,16)}}后 离店日{{orderList.enableEndTime.substring(11,16)}}前</text></view>
  63. <view class="two-order-secret" v-if="orderList.orderStatu ==3">房间门锁密码:{{orderList.lockRealtimePassword}}</view>
  64. </view>
  65. <view class="order-mark">您的满意是我们最大的追求</view>
  66. <!-- 提示时弹框 -->
  67. <uni-popup ref="popup_order2" type="dialog">
  68. <uni-popup-dialog :type="msgType2" cancelText="关闭" confirmText="确定" :content='order_txt2' @confirm="dialogConfirm"
  69. @close="dialogClose"></uni-popup-dialog>
  70. </uni-popup>
  71. <uni-popup ref="popup_order" type="dialog">
  72. <uni-popup-dialog :type="msgType" cancelText="关闭" :content='order_txt'></uni-popup-dialog>
  73. </uni-popup>
  74. </view>
  75. </template>
  76. <script>
  77. export default {
  78. data(){
  79. return {
  80. orderList:'',//订单整体
  81. orderId:'',//订单号
  82. billXin:'',//结账信息
  83. order_txt:'',//弹框提示信息
  84. msgType:'warn',
  85. msgType2:'warn',
  86. order_txt:'',//
  87. order_txt2:'',//
  88. tankuang:false,//弹框是否确定
  89. order_txt_id:'',
  90. }
  91. },
  92. onShow() {
  93. // 获取当前小程序的页面栈
  94. let pages = getCurrentPages();
  95. // 数组中索引最大的页面--当前页面
  96. let currentPage = pages[pages.length-1];
  97. // 打印出当前页面中的 options
  98. this.orderId=currentPage.options.orderId
  99. this.getOrderInfo(this.orderId)
  100. this.getOrderBill(this.orderId)
  101. },
  102. onload(option){
  103. console.log('不能执行onload')
  104. },
  105. methods:{
  106. //获取每个订单详情
  107. getOrderInfo() {
  108. let _self = this
  109. _self.orderList = []
  110. this.$axios.get(`/hotel/ihotel-api/ihotel/hotelOrder/user/order/${this.orderId}`,
  111. {
  112. headers:{
  113. 'user_token':localStorage.getItem('token')
  114. }
  115. }
  116. ).then(res => {
  117. res = res.data
  118. if (res.success) {
  119. console.log(res)
  120. this.orderList=res.data
  121. } else {
  122. console.log('获取订单列表失败')
  123. }
  124. });
  125. },
  126. //待确认的弹框操作
  127. dialogConfirm() {
  128. this.$refs.popup_order2.close()
  129. this.tankuang=true
  130. if(this.tankuang==true) {
  131. if(this.order_txt2=='确定删除?') {
  132. this.getOrderDelete(this.order_txt_id)
  133. } else if(this.order_txt2=='确定退房?') {
  134. this.getOrderReturn(this.order_txt_id)
  135. } else if(this.order_txt2=='确定入住?') {
  136. this.getOrderHold(this.order_txt_id)
  137. } else if(this.order_txt2=='确定取消订单?') {
  138. this.getOrderCancel(this.order_txt_id)
  139. }
  140. }
  141. },
  142. dialogClose(){
  143. this.$refs.popup_order2.close()
  144. },
  145. //删除弹框
  146. openDel(orderId,type){
  147. this.order_txt_id=orderId
  148. this.msgType2 = type
  149. this.order_txt2='确定删除?'
  150. this.$refs.popup_order2.open()
  151. },
  152. //退房弹框
  153. openTui(orderId,type) {
  154. this.order_txt_id=orderId
  155. this.msgType2 = type
  156. this.order_txt2='确定退房?'
  157. this.$refs.popup_order2.open()
  158. },
  159. //入住弹框
  160. openRu(orderId,type) {
  161. this.order_txt_id=orderId
  162. this.msgType2 = type
  163. this.order_txt2='确定入住?'
  164. this.$refs.popup_order2.open()
  165. },
  166. //取消订单弹框
  167. openQu(orderId,type) {
  168. this.order_txt_id=orderId
  169. this.msgType2 = type
  170. this.order_txt2='确定取消订单?'
  171. this.$refs.popup_order2.open()
  172. },
  173. // 订单结账信息
  174. getOrderBill() {
  175. let _self = this
  176. this.$axios.get(`/hotel/ihotel-api/ihotel/hotelOrder/user/order/bill/${this.orderId}`,
  177. {
  178. headers:{
  179. 'user_token':localStorage.getItem('token')
  180. }
  181. }).then(res => {
  182. res = res.data
  183. if (res.success) {
  184. // console.log(res)
  185. if(res.data.flag!='3') {
  186. this.billXin=res.data
  187. }
  188. } else {
  189. console.log('获取结账信息失败')
  190. }
  191. });
  192. },
  193. // 订单取消再次预订
  194. navigateToZaici(enableStartTime,enableEndTime,roomTypeId){
  195. uni.navigateTo({
  196. url:"../order_room/order_room?enableStartTime="+enableStartTime+"&enableEndTime="+enableEndTime+"&startTime="+enableStartTime.substring(5,7)+'月'+enableStartTime.substring(8,10)+'日'+"&endTime="+enableEndTime.substring(5,7)+'月'+enableEndTime.substring(8,10)+'日'+"&roomTypeId="+roomTypeId
  197. })
  198. },
  199. // 待支付取消订单
  200. getOrderCancel(order_txt_id) {
  201. let _self = this
  202. this.$axios.defaults.headers.common['user_token'] = localStorage.getItem('token');
  203. this.$axios.put(`/hotel/ihotel-api/ihotel/hotelOrder/user/order/cancel/${this.order_txt_id}`,).then(res => {
  204. res = res.data
  205. if (res.success) {
  206. this.order_txt='取消成功'
  207. this.$refs.popup_order.open()
  208. this.getOrderInfo()
  209. } else {
  210. this.order_txt=res.message
  211. this.$refs.popup_order.open()
  212. }
  213. });
  214. },
  215. // 支付订单
  216. getOrderPay(orderId) {
  217. let _self = this
  218. this.$axios.get(`/hotel/ihotel-api/ihotel/hotelOrder/user/order/pay/${orderId}`,
  219. {
  220. headers:{
  221. 'user_token':localStorage.getItem('token')
  222. }
  223. }).then(res => {
  224. res = res.data
  225. if (res.success) {
  226. if(res.data.payAmount==0) {
  227. uni.navigateTo({
  228. url: '../zhifuchenggong/zhifuchenggong?orderId='+res.data.orderId
  229. })
  230. } else {
  231. window.location.href = res.data.payUrl;
  232. }
  233. } else {
  234. this.order_txt=res.message
  235. this.$refs.popup_order.open()
  236. console.log('支付失败')
  237. }
  238. });
  239. },
  240. // 删除订单
  241. getOrderDelete(order_txt_id) {
  242. let _self = this
  243. this.$axios.defaults.headers.common['user_token'] = localStorage.getItem('token');
  244. this.$axios.delete(`/hotel/ihotel-api/ihotel/hotelOrder/user/order/${this.order_txt_id}`,).then(res => {
  245. res = res.data
  246. if (res.success) {
  247. this.order_txt='删除订单成功'
  248. this.$refs.popup_order.open()
  249. this.getOrderInfo()
  250. } else {
  251. this.order_txt=res.message
  252. this.$refs.popup_order.open()
  253. }
  254. });
  255. },
  256. // 订单已完成再次预订
  257. navigateToWanchengZaici(roomTypeId){
  258. uni.navigateTo({
  259. url:'../order_room/order_room?roomTypeId='+roomTypeId
  260. })
  261. },
  262. // 办理入住
  263. getOrderHold(order_txt_id) {
  264. let _self = this
  265. this.$axios.defaults.headers.common['user_token'] = localStorage.getItem('token');
  266. this.$axios.put(`/hotel/ihotel-api/ihotel/hotelOrder/user/order/hold/${this.order_txt_id}`,).then(res => {
  267. res = res.data
  268. if (res.success) {
  269. this.order_txt='办理入住成功'
  270. this.$refs.popup_order.open()
  271. this.getOrderInfo()
  272. } else {
  273. this.order_txt=res.message
  274. this.$refs.popup_order.open()
  275. }
  276. });
  277. },
  278. // 办理退房
  279. getOrderReturn(order_txt_id) {
  280. let _self = this
  281. this.$axios.defaults.headers.common['user_token'] = localStorage.getItem('token');
  282. this.$axios.put(`/hotel/ihotel-api/ihotel/hotelOrder/user/order/return/${this.order_txt_id}`,).then(res => {
  283. res = res.data
  284. if (res.success) {
  285. this.order_txt='退房成功'
  286. this.$refs.popup_order.open()
  287. this.getOrderInfo()
  288. this.getOrderBill()
  289. } else {
  290. this.order_txt=res.message
  291. this.$refs.popup_order.open()
  292. }
  293. });
  294. },
  295. }
  296. }
  297. </script>
  298. <style>
  299. @import url("./css/order_mark.css");
  300. </style>