order_mark.vue 12 KB

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