my_orderlist.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. <template>
  2. <view class="content" :scroll="false">
  3. <!-- 切换栏 -->
  4. <scroll-view :scroll-x="true" class="inv-h-w">
  5. <view :class="['inv-h',Inv==6?'inv-h-se':'']" @click="changeTab(6)">全部</view>
  6. <view :class="['inv-h',Inv==1?'inv-h-se':'']" @click="changeTab(1)">待支付</view>
  7. <view :class="['inv-h',Inv==3?'inv-h-se':'']" @click="changeTab(3)">待入住</view>
  8. <view :class="['inv-h',Inv==4?'inv-h-se':'']" @click="changeTab(4)">已入住</view>
  9. <view :class="['inv-h',Inv==9?'inv-h-se':'']" @click="changeTab(9)">已取消</view>
  10. <view :class="['inv-h',Inv==7?'inv-h-se':'']" @click="changeTab(7)">已退款</view>
  11. <view :class="['inv-h',Inv==5?'inv-h-se':'']" @click="changeTab(5)">待结账</view>
  12. <view :class="['inv-h',Inv==10?'inv-h-se':'']" @click="changeTab(10)">已支付未入住</view>
  13. <view :class="['inv-h',Inv==8?'inv-h-se':'']" @click="changeTab(8)">已完成</view>
  14. </scroll-view>
  15. <!-- 订单样式 -->
  16. <uni-list class="room-kuang">
  17. <view class="room-xinxi" v-for="(item,index) in troom" :key="index">
  18. <view @click="navigateToOrderMark(item.id)">
  19. <image class="room-image" :src="item.url"></image>
  20. <view class="room-name">
  21. <!-- {{item.roomNumber}} -->
  22. <view class="room-time3" v-if="item.roomType==1">全日房</view>
  23. <view class="room-time3" v-if="item.roomType==2">钟点房</view>
  24. <view v-if="item.orderStatus == 1" style="float: right;display: block ruby;margin-left: 10px;">
  25. <view class="room-type">
  26. <text>待支付</text>
  27. </view>
  28. <text class="room-count-txt">剩余</text>
  29. <uv-count-down class="room-count" color="#FF5733" :time="new Date((item.createTime).replace(/-/g,'/')).getTime() + 2 * 60 * 1000 - new Date().getTime()" format="mm:ss" @finish="finish(timeupSecond,item)"></uv-count-down>
  30. </view>
  31. <view class="room-type2" v-else>
  32. <text v-if="item.orderStatus==10">已支付未入住</text>
  33. <text v-if="item.orderStatus==9">已取消</text>
  34. <text v-if="item.orderStatus==7">已退款</text>
  35. <text v-if="item.orderStatus==3">待入住</text>
  36. <text v-if="item.orderStatus==4">已入住</text>
  37. <text v-if="item.orderStatus==5">
  38. 待结账
  39. </text>
  40. <text v-if="item.orderStatus==8">已完成</text>
  41. </view>
  42. </view>
  43. <view class="room-time" v-if="item.roomType==1">{{item.reserveLiveTime|snippet}}-{{item.reserveLeaveTime|snippet}}</view>
  44. <view class="room-time" v-if="item.roomType==2">{{item.reserveLiveTime}}-{{item.reserveLeaveTime|snippet2}}</view>
  45. <view class="room-order">订单号:{{item.orderNumber}}</view>
  46. <view class="room-price">¥{{item.payPrice}}</view>
  47. </view>
  48. <!-- v-if="item.orderStatus != 5 && item.orderStatus != 3 && item.orderStatus != 4" 无删除时-->
  49. <view style="position: relative;height: 30px; margin-left: 50%;">
  50. <view class="room-button2" :class="{'room-button3': item.orderStatus == 1}" v-if="item.orderStatus != 10">
  51. <text v-if="item.orderStatus == 9||item.orderStatus == 7" @click="navigateToZaici(item.reserveLiveTime,item.reserveLeaveTime,item.id,item)">再次预定</text>
  52. <text v-if="item.orderStatus == 1" @click="getOrderPay(item.id,item.price)">支付</text>
  53. <text v-if="item.orderStatus == 5" @click="navigateToJiezhang(item.id)">去处理</text>
  54. <text v-if="item.orderStatus == 8" @click="navigateToWanchengZaici(item.id,item)">再次预定</text>
  55. <!-- <text v-if="item.orderStatus == 3" @click="openRu(item.id,'warn')">办理入住</text> -->
  56. <text v-if="item.orderStatus == 4" @click="openTui(item.orderNumber,item.houseNumberId,'warn')">退房</text>
  57. <text v-if="item.orderStatus == 3 && item.payPrice==0" @click="openQu(item.orderNumber,item.houseNumberId,'warn')">取消订单</text>
  58. <text v-else-if="item.orderStatus == 3 && item.payPrice!=0" @click="openQu(item.orderNumber,item.houseNumberId,'warn')">办理退款</text>
  59. </view>
  60. <view class="room-button" v-if="item.orderStatus == 1">
  61. <!-- <text v-if="item.orderStatus == 9" @click="openDel(item.id,'warn')">删除</text> -->
  62. <text v-if="item.orderStatus == 1" @click="openQu(item.orderNumber,item.houseNumberId,'warn')">取消订单</text>
  63. <!-- <text v-if="item.orderStatus == 8" @click="openDel(item.id,'warn')">删除</text> -->
  64. <!-- <text v-if="item.orderStatus == 3 && item.payPrice==0" @click="openQu(item.orderNumber,item.houseNumberId,'warn')">取消订单</text>
  65. <text v-else @click="openQu(item.orderNumber,item.houseNumberId,'warn')">办理退款</text> -->
  66. <!-- <text v-if="item.orderStatu == 4" @click="navigateToXuzhu">续住</text> -->
  67. </view>
  68. </view>
  69. <view class="room-line" v-if="index<(troom.length-1)"></view>
  70. </view>
  71. </uni-list>
  72. <!-- 提示时弹框 -->
  73. <uni-popup ref="popup_order2" type="dialog">
  74. <uni-popup-dialog :type="msgType2" cancelText="关闭" confirmText="确定" :content='order_txt2' @confirm="dialogConfirm"
  75. @close="dialogClose"></uni-popup-dialog>
  76. </uni-popup>
  77. <uni-popup ref="popup_order" type="dialog">
  78. <uni-popup-dialog :type="msgType" cancelText="关闭" :content='order_txt'></uni-popup-dialog>
  79. </uni-popup>
  80. <!-- 办理续住弹窗 -->
  81. <uni-popup ref="popup_xuzhu" type="dialog" :mask-click="false">
  82. <view class="popup_bg_xu">
  83. <text class="popup_title">办理续住</text>
  84. <text class="popup_error" @click="popupXuzhuClose"></text>
  85. <text class="popup_xu_line"></text>
  86. <!-- 时间选择 -->
  87. <view class="select-time-xu" @click="openXuCalendar">
  88. <view class="select-time-one-xu">
  89. <text class="select-list">周四入住</text>
  90. <text class="select-list-time">07月21日</text>
  91. </view>
  92. <view class="select-center">
  93. <view class="select-line1"></view>
  94. <view class="select-circle">1晚</view>
  95. <view class="select-line2"></view>
  96. </view>
  97. <view class="select-time-one-xu">
  98. <text class="select-list">周五离店</text>
  99. <text class="select-list-time">07月22日</text>
  100. </view>
  101. </view>
  102. <text class="popup_xu_txt">注:办理续住最多7天,如超过7天需要重新预定</text>
  103. <!-- 支付框 -->
  104. <view class="fukuan">
  105. <view class="fu-price"><text style="font-size: 28rpx;">总计:</text>¥20.00</view>
  106. <view class="fu-zhifu">立即支付</view>
  107. </view>
  108. </view>
  109. </uni-popup>
  110. <uni-popup ref="popup_xu" :mask-click="true">
  111. <uni-calendar :selected="infoXu.selected" class="uni-calendar--hook" :clear-date="true" :date="infoXu.date" :insert="infoXu.insert" :lunar="infoXu.lunar" :startDate="infoXu.startDate"
  112. :endDate="infoXu.endDate" :range="infoXu.range" @change="changeXu"/>
  113. </uni-popup>
  114. </view>
  115. </template>
  116. <script>
  117. /**
  118. * 获取任意时间
  119. */
  120. function getDate(date, AddDayCount = 0) {
  121. if (!date) {
  122. date = new Date()
  123. }
  124. if (typeof date !== 'object') {
  125. date = date.replace(/-/g, '/')
  126. }
  127. const dd = new Date(date)
  128. dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
  129. var a = new Array("日", "一", "二", "三", "四", "五", "六");
  130. var week = new Date().getDay();
  131. var week2 = new Date().getDay()+1;
  132. const y = dd.getFullYear()
  133. const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
  134. const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
  135. const h = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
  136. const f = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
  137. const s = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
  138. return {
  139. fullDate: y + '-' + m + '-' + d,
  140. fullDate2: y + '-' + m + '-' + d+' '+h+':'+f+':'+s,
  141. fullTime: m + '月' + d + '日',
  142. year: y,
  143. month: m,
  144. date: d,
  145. day: dd.getDay(),
  146. sWeek:"周"+ a[week],
  147. eWeek:"周"+ a[week2]
  148. }
  149. }
  150. // 导入图片
  151. import room1 from '../../static/index/room_image.svg'
  152. import room2 from '../../static/index/room_image.svg'
  153. import {
  154. getorderpage,
  155. getorderpay,
  156. getorderreturn,
  157. getorderhold,
  158. getorderdelete,
  159. quxiaoorder,
  160. getchapay
  161. } from '../../utils/api_hotel.js'
  162. export default {
  163. data(){
  164. return {
  165. Inv: 6,
  166. // room:[],
  167. troom:[],
  168. timeupSecond:null,
  169. //续住里选择器
  170. infoXu: {
  171. lunar: true,
  172. range: true,
  173. insert: true,
  174. selected: [],
  175. startDate:'',
  176. date:'',
  177. endDate:'',
  178. order_txt:'',//提交订单时信息
  179. },
  180. msgType:'warn',
  181. msgType2:'warn',
  182. order_txt:'',//
  183. order_txt2:'',//
  184. tankuang:false,//弹框是否确定
  185. order_txt_id:'',
  186. houseNumberId:'',//房间id
  187. curPage:1,
  188. pageSize:10,
  189. total: 0,
  190. loadStatus: '',
  191. appId: "", //公众号ID,由商户传入
  192. timeStamp: "", //时间戳,自1970年以来的秒数
  193. nonceStr: "", //随机串
  194. package: "",
  195. signType: "", //微信签名方式:
  196. paySign:'',
  197. }
  198. },
  199. filters:{
  200. //字过长变为...
  201. snippet: function(value) {
  202. if(value.length>10) {
  203. return value.slice(0,4)+'/'+value.slice(5,7)+'/'+value.slice(8, 10);
  204. } else {
  205. return value.slice(0,4)+'/'+value.slice(5,7)+'/'+value.slice(8, 10);
  206. }
  207. },
  208. //字过长变为...
  209. snippet2: function(value) {
  210. if(value.length>10) {
  211. return value.slice(11,19);
  212. }
  213. },
  214. },
  215. onShow() {
  216. // 模拟从后台拿到的数据
  217. // var room = []
  218. // list数组中为每一项添加双向绑定的属性---这个属性要在页面显示(onShow)添加
  219. // room.forEach(el => el.isChecked = false);
  220. // this.room = room;
  221. // this.troom = room;//真实数据赋值给页面数据
  222. this.changeTab(this.Inv)
  223. this.getOrderPage(this.Inv)
  224. },
  225. //下拉刷新
  226. onPullDownRefresh() {
  227. this.curPage = 1;
  228. this.getOrderPage(this.Inv)
  229. setTimeout(function () {
  230. uni.stopPullDownRefresh();
  231. }, 1000);
  232. },
  233. //上拉加载
  234. onReachBottom() {
  235. let allTotal = this.curPage * this.pageSize
  236. if (allTotal < this.total) {
  237. this.loadStatus = 'loading'
  238. this.curPage += 1
  239. this.getOrderPage(this.Inv)
  240. }else {
  241. this.loadStatus = 'nomore'
  242. }
  243. },
  244. onLoad(option) {
  245. this.Inv=option.Inv;
  246. },
  247. /**
  248. * 生命周期函数--监听页面卸载
  249. */
  250. onUnload: function () {
  251. clearInterval(this.timer);
  252. },
  253. mounted(){
  254. },
  255. onReady() {
  256. this.$nextTick(() => {
  257. this.showCalendar = true
  258. })
  259. // TODO 模拟请求异步同步数据
  260. setTimeout(() => {
  261. // console.log('date:'+getDate(new Date()).fullDate)
  262. // console.log('startDate:'+getDate(new Date()).fullDate)
  263. // console.log('endDate:'+getDate(new Date(),6).fullDate)
  264. this.infoXu.date = getDate(new Date()).fullDate
  265. this.infoXu.startDate = getDate(new Date()).fullDate
  266. this.infoXu.endDate = getDate(new Date(),6).fullDate
  267. }, 2000)
  268. },
  269. methods:{
  270. // 订单列表
  271. getOrderPage() {
  272. let _self = this
  273. var Inv2=this.Inv
  274. // _self.troom = []
  275. // _self.room = []
  276. if (this.Inv==6) {
  277. Inv2=''
  278. }
  279. var data='?page='+this.curPage+"&size="+this.pageSize+"&status="+Inv2+"&userId="+localStorage.getItem('usersId')
  280. getorderpage(data).then((res) => {
  281. if (res.success) {
  282. if (this.curPage == 1) {
  283. _self.troom = res.data.records
  284. // _self.room = res.data.records
  285. } else {
  286. _self.troom = [..._self.troom, ...res.data.records]
  287. // _self.room = [..._self.room, ...res.data.records]
  288. }
  289. uni.stopPullDownRefresh();
  290. uni.hideLoading()
  291. _self.total=res.data.total
  292. console.log(_self.troom,'_self.troom')
  293. return;
  294. } else {
  295. // uni.showModal({
  296. // content:"没有符合条件的数据!"
  297. // })
  298. }
  299. }).catch((err) => {
  300. // uni.showModal({
  301. // content:err.message
  302. // })
  303. });
  304. },
  305. //待确认的弹框操作
  306. dialogConfirm() {
  307. this.$refs.popup_order2.close()
  308. this.tankuang=true
  309. if(this.tankuang==true) {
  310. if(this.order_txt2=='确定删除?') {
  311. this.getOrderDelete(this.order_txt_id)
  312. } else if(this.order_txt2=='确定退房?') {
  313. this.getOrderReturn(this.order_txt_id,this.houseNumberId)
  314. } else if(this.order_txt2=='确定入住?') {
  315. this.getOrderHold(this.order_txt_id)
  316. } else if(this.order_txt2=='确定取消订单?') {
  317. this.getOrderCancel(this.order_txt_id,this.houseNumberId)
  318. }
  319. }
  320. },
  321. dialogClose(){
  322. this.$refs.popup_order2.close()
  323. },
  324. //删除弹框
  325. openDel(id,type){
  326. this.order_txt_id=id
  327. this.msgType2 = type
  328. this.order_txt2='确定删除?'
  329. this.$refs.popup_order2.open()
  330. },
  331. //退房弹框
  332. openTui(orderNumber,houseNumberId,type) {
  333. this.order_txt_id=orderNumber
  334. this.houseNumberId=houseNumberId
  335. this.msgType2 = type
  336. this.order_txt2='确定退房?'
  337. this.$refs.popup_order2.open()
  338. },
  339. //入住弹框
  340. openRu(id,type) {
  341. this.order_txt_id=id
  342. this.msgType2 = type
  343. this.order_txt2='确定入住?'
  344. this.$refs.popup_order2.open()
  345. },
  346. //取消订单弹框
  347. openQu(orderNumber,houseNumberId,type) {
  348. this.order_txt_id=orderNumber
  349. this.houseNumberId=houseNumberId
  350. this.msgType2 = type
  351. this.order_txt2='确定取消订单?'
  352. this.$refs.popup_order2.open()
  353. },
  354. // 支付订单
  355. getOrderPay(id,price) {
  356. // alert('支付',localStorage.getItem('openId2'))
  357. // if(!localStorage.getItem('openId2')){
  358. // uni.navigateTo({
  359. // url:'/pages/huoquCode/huoquCode'
  360. // })
  361. // return
  362. // }
  363. let _self = this
  364. var data={
  365. "houseOrderId": id, //订单号id
  366. "usersId": localStorage.getItem('usersId'), //用户id
  367. "totalPrice": price //支付金额
  368. }
  369. getorderpay(data).then((res) => {
  370. if (res.success) {
  371. if(res.data){
  372. _self.appId=res.data.appId
  373. _self.timeStamp=res.data.timeStamp
  374. _self.nonceStr=res.data.nonceStr
  375. _self.package=res.data.packageVal
  376. _self.signType=res.data.signType
  377. _self.paySign=res.data.paySign
  378. _self.onBridgeReady();
  379. }else{
  380. uni.navigateTo({
  381. url:'/pages/zhifuchenggong/zhifuchenggong'
  382. })
  383. }
  384. } else if(res.code=='500'){
  385. }
  386. }).catch((err) => {
  387. });
  388. },
  389. onBridgeReady() {
  390. WeixinJSBridge.invoke('getBrandWCPayRequest', {
  391. "appId": this.appId, //公众号ID,由商户传入
  392. "timeStamp": this.timeStamp, //时间戳,自1970年以来的秒数
  393. "nonceStr": this.nonceStr, //随机串
  394. "package": this.package,
  395. "signType": this.signType, //微信签名方式:
  396. "paySign": this.paySign //微信签名
  397. },
  398. function(res) {
  399. if (res.err_msg == "get_brand_wcpay_request:ok") {
  400. uni.reLaunch({
  401. url:'/pages/my_orderlist/my_orderlist?Inv=3'
  402. })
  403. // 使用以上方式判断前端返回,微信团队郑重提示:
  404. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  405. }else{
  406. this.chapayIf()
  407. }
  408. });
  409. },
  410. //查询是否支付成功
  411. chapayIf(){
  412. var data={
  413. "outTradeNo": this.orderNumber,//订单号id
  414. }
  415. getchapay(data).then((res) => {
  416. if (res.success) {
  417. if(res.data.tradeState=="SUCCESS"){
  418. uni.showModal({
  419. content:'支付成功',
  420. success: (res) => {
  421. uni.switchTab({
  422. url:'pages/my_orderlist/my_orderlist?Inv=3'
  423. })
  424. },
  425. })
  426. }else{
  427. uni.showModal({
  428. content:res.data.tradeStateDesc
  429. })
  430. }
  431. // return;
  432. } else {
  433. }
  434. }).catch((err) => {
  435. // uni.showModal({
  436. // content:err.message
  437. // })
  438. });
  439. },
  440. // 办理退房
  441. getOrderReturn(order_txt_id,houseNumberId) {
  442. let _self = this
  443. var data={
  444. "orderNumber": order_txt_id,//订单号
  445. "houseNumberId": houseNumberId//房间号id
  446. }
  447. getorderreturn(data).then((res) => {
  448. if (res.success) {
  449. this.order_txt='退房成功'
  450. this.$refs.popup_order.open()
  451. this.getOrderPage()
  452. return;
  453. } else {
  454. this.order_txt=res.message
  455. this.$refs.popup_order.open()
  456. }
  457. }).catch((err) => {
  458. uni.showModal({
  459. content:err.message
  460. })
  461. });
  462. // this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
  463. // this.$axios.put(`/hotel/ihotel-api/ihotel/hotelOrder/user/order/return/${this.order_txt_id}`,).then(res => {
  464. // res = res.data
  465. // if (res.success) {
  466. // this.order_txt='退房成功'
  467. // this.$refs.popup_order.open()
  468. // this.getOrderPage()
  469. // } else {
  470. // this.order_txt=res.message
  471. // this.$refs.popup_order.open()
  472. // }
  473. // });
  474. this.tankuang==false
  475. },
  476. // 办理入住
  477. getOrderHold(order_txt_id) {
  478. let _self = this
  479. var data="?houseOrderId="+order_txt_id+"&userId="+localStorage.getItem('usersId')
  480. getorderhold(data).then((res) => {
  481. if (res.success) {
  482. this.order_txt='办理入住成功'
  483. this.$refs.popup_order.open()
  484. this.getOrderPage()
  485. return;
  486. } else {
  487. this.order_txt=res.message
  488. this.$refs.popup_order.open()
  489. }
  490. }).catch((err) => {
  491. uni.showModal({
  492. content:err.message
  493. })
  494. });
  495. // this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
  496. // this.$axios.put(`/hotel/ihotel-api/ihotel/hotelOrder/user/order/hold/${this.order_txt_id}`,).then(res => {
  497. // res = res.data
  498. // if (res.success) {
  499. // this.order_txt='办理入住成功'
  500. // this.$refs.popup_order.open()
  501. // this.getOrderPage()
  502. // } else {
  503. // this.order_txt=res.message
  504. // this.$refs.popup_order.open()
  505. // }
  506. // });
  507. },
  508. // 删除订单
  509. getOrderDelete(order_txt_id) {
  510. let _self = this
  511. var data=order_txt_id
  512. getorderdelete(data).then((res) => {
  513. if (res.success) {
  514. this.order_txt='删除订单成功'
  515. this.$refs.popup_order.open()
  516. this.getOrderPage()
  517. return;
  518. } else {
  519. this.order_txt=res.message
  520. this.$refs.popup_order.open()
  521. }
  522. }).catch((err) => {
  523. this.$message.error(err.message)
  524. });
  525. // this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
  526. // this.$axios.delete(`/hotel/ihotel-api/ihotel/hotelOrder/user/order/${this.order_txt_id}`,).then(res => {
  527. // res = res.data
  528. // if (res.success) {
  529. // this.order_txt='删除订单成功'
  530. // this.$refs.popup_order.open()
  531. // this.getOrderPage()
  532. // } else {
  533. // this.order_txt=res.message
  534. // this.$refs.popup_order.open()
  535. // }
  536. // });
  537. this.tankuang==false
  538. },
  539. // 待支付取消订单
  540. getOrderCancel(order_txt_id,houseNumberId) {
  541. let _self = this
  542. // this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
  543. // this.$axios.defaults.headers.common['user_head'] = localStorage.getItem('user_head');
  544. // this.$axios.defaults.headers.common['Content-Type'] ='application/json'
  545. var data={
  546. "usersId": localStorage.getItem('usersId'),
  547. "orderNumber": order_txt_id, //订单号
  548. "houseNumberId": houseNumberId, //房间号id
  549. }
  550. quxiaoorder(data).then((res) => {
  551. if (res.success) {
  552. this.order_txt='订单已取消'
  553. this.$refs.popup_order.open()
  554. this.getOrderPage()
  555. return;
  556. } else {
  557. this.order_txt=res.message
  558. this.$refs.popup_order.open()
  559. }
  560. }).catch((err) => {
  561. uni.showModal({
  562. content:err.message
  563. })
  564. });
  565. },
  566. // 订单取消再次预订
  567. navigateToZaici(enableStartTime,enableEndTime,roomTypeId,item){
  568. uni.reLaunch({
  569. url:"/pages/index/index"
  570. // url: "../order_room/order_room?roomTypeId="+roomTypeId +"&enableStartTime="+enableStartTime+"&enableEndTime="+enableEndTime+"&startTime="+enableStartTime.substring(5,7)+'月'+enableStartTime.substring(8,10)+'日'+"&endTime="+enableEndTime.substring(5,7)+'月'+enableEndTime.substring(8,10)+'日'+"&typeName="+item.roomName+"&roomArea="+item.roomArea+"&roomType="+item.roomType+"&roomConfiguration="+item.roomConfiguration+"&roomPrice="+item.roomPrice+'&surplusCount='+item.surplusCount,
  571. // 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
  572. })
  573. },
  574. // 订单已完成再次预订
  575. navigateToWanchengZaici(roomTypeId){
  576. uni.reLaunch({
  577. url:"/pages/index/index"
  578. // url:'../order_room/order_room?roomTypeId='+roomTypeId
  579. })
  580. },
  581. //处理结账
  582. navigateToJiezhang(id) {
  583. uni.navigateTo({
  584. url:"/pages/order_mark/order_mark?orderId="+id
  585. })
  586. },
  587. /*
  588. * @Explain:选项卡点击切换
  589. */
  590. changeTab(Inv) {
  591. console.log(Inv)
  592. var that = this;
  593. this.Inv =Inv
  594. var arr = [];
  595. this.getOrderPage(this.Inv)
  596. // that.room.map(item => {//遍历真实数据,拿到所需要的数据放在页面数据tlist中,展示在页面上
  597. // if(item.orderStatus == this.Inv){
  598. // arr.push(item);
  599. // }
  600. // })
  601. // that.troom = arr;
  602. // if(this.Inv == 6){//获取全部数据
  603. // that.troom = that.room;
  604. // }
  605. //滚动到顶部
  606. uni.pageScrollTo({
  607. duration: 0, //过渡时间必须为0,否则运行到手机会报错
  608. scrollTop: 0 //滚动到实际距离是元素距离顶部的距离减去最外层盒子的滚动距离(如res.top - data.top)
  609. })
  610. },
  611. // 倒计时结束回调
  612. finish(timeupSecond,item) {
  613. // this.countDownTime = new Date(item.createTime).getTime() + 15 * 60 * 1000 - new Date().getTime()
  614. this.getOrderCancel(item.orderNumber,item.houseNumberId)
  615. },
  616. // 跳转到订单详情
  617. navigateToOrderMark(id) {
  618. uni.navigateTo({
  619. url: "/pages/order_mark/order_mark?orderId="+id,
  620. })
  621. uni.setStorageSync('orderId', id);
  622. // alert(localStorage.getItem('usersId'))
  623. },
  624. //办理续住弹窗
  625. navigateToXuzhu(){
  626. this.$refs.popup_xuzhu.open()
  627. },
  628. popupXuzhuClose() {
  629. this.$refs.popup_xuzhu.close()
  630. },
  631. // 续住里日期选择器弹窗
  632. openXuCalendar() {
  633. this.$refs.popup_xu.open()
  634. },
  635. changeXu(e) {
  636. console.log('1change 返回:', e)
  637. // 模拟动态打卡
  638. if (this.infoXu.selected.length > 5) return
  639. this.infoXu.selected.push({
  640. date: e.range.before,
  641. info: '到店'
  642. })
  643. this.infoXu.selected.push({
  644. date: e.range.after,
  645. info: '离店'
  646. })
  647. },
  648. },
  649. }
  650. </script>
  651. <style>
  652. @import url(./css/my_orderlist.css);
  653. </style>