order_room.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <view class="content">
  3. <!-- 第一层表单 -->
  4. <view class="two_all">
  5. <!-- @click="openCalendar" -->
  6. <view class="select-time" v-if="roomType==1">
  7. <view class="select-time-one">
  8. <text class="select-list-time">{{startTime}}
  9. <text class="select-list">{{startWeek}}</text>
  10. </text>
  11. </view>
  12. <view class="select-center">
  13. <view class="select-line1"></view>
  14. <view class="select-circle">{{ruzhu_num}}晚</view>
  15. <view class="select-line2"></view>
  16. </view>
  17. <view class="select-time-one">
  18. <text class="select-list-time">{{endTime}}
  19. <text class="select-list">{{endWeek}}</text>
  20. </text>
  21. </view>
  22. </view>
  23. <view class="select-time" v-if="roomType==2">
  24. <view class="select-time-one">
  25. <text class="select-list-time">{{startTime}}
  26. <text class="select-list">{{startWeek}}</text>
  27. </text>
  28. </view>
  29. <view class="select-time-one">
  30. <!-- <text class="select-list-time" style="font-size: 12px;">{{zhongTime}} -->
  31. <text class="select-list">{{zhongshi}}小时</text>
  32. </text>
  33. </view>
  34. </view>
  35. <!-- 房型信息 -->
  36. <view class="select_name">{{typeName}}</view>
  37. <view class="select_type" v-if="roomType==1">全日房</view>
  38. <view class="select_type" v-else-if="roomType==2">钟点房</view>
  39. <view class="select_detail">
  40. {{roomArea}}㎡
  41. <text style="margin-left: 20px;">{{roomConfiguration}}</text>
  42. <!-- <text style="margin-left: 20px;">窗户位于走廊/窗户较小</text> -->
  43. </view>
  44. <uni-popup ref="popup_picker" :mask-click="true">
  45. <!-- <view class=popup_bg_picker> -->
  46. <uni-calendar :selected="info.selected" class="uni-calendar--hook" :clear-date="true" :date="info.date" :insert="info.insert" :lunar="info.lunar" :startDate="info.startDate"
  47. :endDate="info.endDate" :range="info.range" @change="change"/>
  48. <view style="height: 60px; background-color: #fff;">
  49. <view class="riliQueren" @click="popup_pickerClose">确定{{ruzhu_num}}晚</view>
  50. </view>
  51. <!-- </view> -->
  52. </uni-popup>
  53. </view>
  54. <!-- 第二层基本信息 -->
  55. <view class="second_basic">
  56. <view class="form_title">入住信息</view>
  57. <view class="form-line1"></view>
  58. <view class="form-num">房间数量:
  59. <text class="list-text">1间</text></view>
  60. <view class="form-line2"></view>
  61. <view class="form-name">住客姓名:
  62. <text class="list-text">{{cardName}}</text></view>
  63. <view class="form-line"></view>
  64. <view class="form-phone">联系电话:
  65. <text class="list-text">{{cardPhone}}</text></view>
  66. <view class="form-line"></view>
  67. <!-- <view class="uni-list-cell-db" v-if="roomType==1">预计到店:
  68. <picker style="margin-left: 70px;margin-top: -22px;"
  69. @change="bindPickerChange" :value="index" :range="array">
  70. <view class="uni-input" style="color: rgba(0, 0, 0, 1);">{{array[index]}}</view>
  71. <text class="jiantou">〉</text>
  72. </picker>
  73. </view> -->
  74. <view class="uni-list-cell-db" v-if="roomType==2">入住时段:
  75. <picker style="margin-left: 70px;margin-top: -22px;"
  76. @change="bindPickerChange2" :value="index2" :range="array2">
  77. <view class="uni-input" style="color: rgba(0, 0, 0, 1);">{{array2[index2]}}</view>
  78. <text class="jiantou">〉</text>
  79. </picker>
  80. </view>
  81. <view class="uni-list-cell-db" v-if="payMount>0">请选择身份:
  82. <picker style="float: right;" @change="bindPickerChangeShen" :value="indexS" :range="arrayShen">
  83. <view class="uni-input" style="color: rgba(0, 0, 0, 1);" v-if="indexS==0||indexS==1||indexS==2||indexS==3">{{arrayShen[indexS]}}</view>
  84. <text class="jiantou" style="margin-top: 0px;" v-else>〉</text>
  85. </picker>
  86. </view>
  87. <view class="uni-list-cell-db" v-if="payMount>0">申请理由:
  88. <picker style="float: right;" @change="bindPickerChangeLi" :value="indexL" :range="arrayLi">
  89. <view class="uni-input" style="color: rgba(0, 0, 0, 1);" v-if="indexL==0||indexL==1">{{arrayLi[indexL]}}</view>
  90. <text class="jiantou" style="margin-top: 0px;" v-else>〉</text>
  91. </picker>
  92. </view>
  93. <view style="height: 20rpx;"></view>
  94. </view>
  95. <!-- 第三层表单 -->
  96. <view class="third_basic">
  97. <view class="third_title">费用明细</view>
  98. <view class="third-line1"></view>
  99. <view class="third-num">在线支付:
  100. <text class="third-text">
  101. 1间
  102. <template v-if="roomType==1">{{ruzhu_num}}晚</template>
  103. </text>
  104. <text style="margin-left: 10rpx;">共
  105. <text class="third-text2">¥{{payMount}}</text>
  106. </text>
  107. </view>
  108. </view>
  109. <!-- 第四层房费 -->
  110. <view class="four_basic">
  111. <view class="four_title">房费
  112. <text style="margin-left: 533rpx;">¥{{payMount}}</text>
  113. </view>
  114. <view class="four-line1"></view>
  115. <view v-if="roomType==1">
  116. <view v-for="(item,index) in wanPrice" :key="index">
  117. <view class="four-num">
  118. {{item.date}}
  119. <text style="margin-left: 30rpx;">1晚共{{item.price}}</text>
  120. </view>
  121. </view>
  122. <view class="four-all">1间 x {{ruzhu_num}}晚</view>
  123. </view>
  124. <view v-if="roomType==2">
  125. <view>
  126. <view class="four-num">{{startDate}}</view>
  127. <view class="four-num2">{{endDate}}</view>
  128. </view>
  129. <view class="four-all">{{ruzhu_num}} x ¥{{roomPrice}}</view>
  130. </view>
  131. </view>
  132. <!-- 支付框 -->
  133. <view class="fukuan">
  134. <view class="fu-price">¥{{payMount}}</view>
  135. <view class="fu-zhifu" :class="{'room-button2': freeRoom == 0}">
  136. <!-- <text v-if="freeRoom==0">房间已满</text> -->
  137. <!-- v-else<text v-else @click="getOrderSubmit('warn')">立即支付</text> -->
  138. <text @click="postOrder('warn')">立即支付</text>
  139. </view>
  140. </view>
  141. <!-- 提交订单时弹框 -->
  142. <uni-popup ref="popup_order" type="dialog">
  143. <uni-popup-dialog :type="msgType" cancelText="关闭" confirmText="确定" :content="order_txt" @confirm="dialogConfirm"
  144. @close="dialogClose"></uni-popup-dialog>
  145. </uni-popup>
  146. </view>
  147. </template>
  148. <script>
  149. import {
  150. getuserinfo,
  151. getprice,
  152. getMeiprice,
  153. postOrder,
  154. getZhongTime
  155. } from '../../utils/api_hotel.js'
  156. /**
  157. * 获取任意时间
  158. */
  159. function getDate(date, AddDayCount = 0) {
  160. if (!date) {
  161. date = new Date()
  162. }
  163. if (typeof date !== 'object') {
  164. date = date.replace(/-/g, '/')
  165. }
  166. const dd = new Date(date)
  167. dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
  168. var a = new Array("日", "一", "二", "三", "四", "五", "六");
  169. var week = new Date().getDay();
  170. var week2 = new Date().getDay()+1;
  171. const y = dd.getFullYear()
  172. const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
  173. const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
  174. const h = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
  175. const f = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
  176. const s = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
  177. return {
  178. fullDate: y + '-' + m + '-' + d,
  179. fullDate2: y + '-' + m + '-' + d+' '+h+':'+f+':'+s,
  180. fullTime: m + '月' + d + '日',
  181. year: y,
  182. month: m,
  183. date: d,
  184. day: dd.getDay(),
  185. sWeek:"周"+ a[week],
  186. eWeek:"周"+ a[week2]
  187. }
  188. }
  189. export default {
  190. data() {
  191. return {
  192. showCalendar: false,
  193. info: {
  194. lunar: true,
  195. range: true,
  196. insert: true,
  197. selected: [],
  198. startDate:'',
  199. date:'',
  200. endDate:''
  201. },
  202. startTime:'',//到店日期
  203. endTime:'',//离店日期
  204. startDate:'',//默认到店日期接口数据
  205. endDate:'',//默认离店日期接口数据
  206. startWeek:'',// 默认入店日
  207. endWeek:'',// 默认离店
  208. array: ['18:00前到店', '19:00前到店', '20:00前到店', '21:00前到店'],
  209. index: 0,
  210. array2: [''],//钟点房
  211. index2: 0,
  212. //选择身份
  213. arrayShen:['学生','学生家长','朋友','老师'],
  214. indexS:5,
  215. //选择理由
  216. arrayLi:['探视','交流'],
  217. indexL:5,
  218. mayTime:'',// 预计到店时间
  219. typeName:'',//户型名
  220. textNum:0,//输入框当前字数
  221. cardName:'',//用户名
  222. cardPhone:'',//用户电话
  223. cardIdentity:'',//身份
  224. roomTypeId:'',//房间类型id
  225. remark:'',//备注要求
  226. payMount:0,//应付金额
  227. freeRoom:0,//剩余房间可预订的房间数
  228. ruzhu_num:1,//入住夜晚
  229. roomArea:'0',//房间面积
  230. roomType:1,//房间类型
  231. roomPrice:"",//房间单价
  232. roomConfiguration:'',//房间配置
  233. order_txt:'',//提交订单时信息
  234. msgType:'warn',
  235. zhongTime:'',//钟点房订的时间段
  236. zhongshi:'',//钟点房时间
  237. startDateZ:'',//钟点房默认到店日期接口数据
  238. endDateZ:'',//钟点房默认离店日期接口数据
  239. wanPrice:[],
  240. source:'',
  241. sourceId:'',
  242. data:{},
  243. }
  244. },
  245. onLoad(option) {
  246. this.data=JSON.parse(decodeURIComponent(option.data))
  247. console.log(JSON.parse(decodeURIComponent(option.data)))
  248. // this.payMount=Number(this.data.payMount)
  249. this.ruzhu_num=this.data.ruzhu_num
  250. this.roomArea=this.data.roomArea
  251. this.roomType=this.data.roomType
  252. this.roomConfiguration=this.data.roomConfiguration
  253. this.roomPrice=this.data.roomPrice
  254. this.freeRoom=this.data.surplusCount
  255. this.zhongTime=this.data.zhongTime
  256. this.zhongshi=this.data.zhongshi
  257. localStorage.setItem('roomTypeId',this.data.roomTypeId)
  258. localStorage.setItem('typeName',this.data.typeName)
  259. localStorage.setItem('startTime',this.data.startTime)
  260. localStorage.setItem('endTime',this.data.endTime)
  261. localStorage.setItem('enableStartTime',this.data.enableStartTime)
  262. localStorage.setItem('enableEndTime',this.data.enableEndTime)
  263. localStorage.setItem('zhongTime',this.data.zhongTime)
  264. localStorage.setItem('source',this.data.source)
  265. localStorage.setItem('sourceId',this.data.sourceId)
  266. },
  267. mounted() {
  268. this.source=localStorage.getItem('source')
  269. this.sourceId=localStorage.getItem('sourceId')
  270. this.roomTypeId=localStorage.getItem('roomTypeId')
  271. this.typeName=localStorage.getItem('typeName')
  272. this.startTime=localStorage.getItem('startTime')
  273. this.endTime=localStorage.getItem('endTime')
  274. this.zhongTime=localStorage.getItem('zhongTime')
  275. this.startDate=localStorage.getItem('enableStartTime')
  276. this.endDate=localStorage.getItem('enableEndTime')
  277. this.startWeek=this.getweekday(this.startDate)
  278. this.endWeek=this.getweekday(this.endDate)
  279. this.mayTime=this.startDate.substring(0,11)+"18:00:00"
  280. // console.log(this.getweekday(this.startDate))
  281. if(this.roomType==2){
  282. this.getZhongTime()
  283. }
  284. // window.location.href ='https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa46ef222053a1047&redirect_uri=https://chtech.ncjti.edu.cn/hotel/ihotel-api/ihotel/hotelUser/weixinAuth&response_type=code&scope=snsapi_base&state=pages/order_room/order_room#wechat_redirect';
  285. this.getUserInfo()
  286. },
  287. onReady() {
  288. this.$nextTick(() => {
  289. this.showCalendar = true
  290. })
  291. // TODO 模拟请求异步同步数据
  292. setTimeout(() => {
  293. this.info.date = getDate(new Date()).fullDate
  294. this.info.startDate = getDate(new Date()).fullDate
  295. this.info.endDate = getDate(new Date(),8).fullDate
  296. // this.startTime = getDate(new Date()).fullTime
  297. // this.endTime = getDate(new Date(),1).fullTime
  298. // this.startWeek = getDate(new Date()).sWeek
  299. // this.endWeek = getDate(new Date(),1).eWeek
  300. // this.ruzhu_num=1
  301. }, 20)
  302. },
  303. methods: {
  304. // 获取用户信息
  305. getUserInfo() {
  306. let _self = this
  307. var data="?userId="+localStorage.getItem('usersId')
  308. getuserinfo(data).then((res) => {
  309. if (res.success) {
  310. _self.cardName=res.data.userName
  311. _self.cardPhone=res.data.phone
  312. _self.cardIdentity=res.data.idCardInformation
  313. this.getjisuanprice()
  314. this.getWanPrice()
  315. return;
  316. } else {
  317. console.log('获取用户信息失败')
  318. }
  319. }).catch((err) => {
  320. this.$message.error(err.message)
  321. });
  322. },
  323. //获取钟点房可住时间段
  324. getZhongTime(){
  325. this.array2=[]
  326. let _self = this
  327. var data="?houseNumberId="+_self.roomTypeId+"&startTime="+_self.startDate
  328. +"&liveTime="+this.zhongshi
  329. getZhongTime(data).then((res) => {
  330. if (res.success) {
  331. res.data.forEach(data => {
  332. if(data.status=="可用"){
  333. _self.array2.push(data.hourDate)
  334. this.startDateZ=localStorage.getItem('enableStartTime').substring(0,11)+this.array2[0].substring(0,8)
  335. this.endDateZ=localStorage.getItem('enableEndTime').substring(0,11)+this.array2[0].substring(9,17)
  336. }
  337. })
  338. return;
  339. } else {
  340. console.log('失败')
  341. }
  342. }).catch((err) => {
  343. uni.showModal({
  344. content:err.message
  345. })
  346. });
  347. },
  348. // 计算每晚价格
  349. getWanPrice(){
  350. let _self = this
  351. var data="?houseId="+_self.roomTypeId+"&startTime="+_self.startDate
  352. +"&endTime="+_self.endDate
  353. getMeiprice(data).then((res) => {
  354. if (res.success) {
  355. _self.wanPrice=res.data
  356. return;
  357. } else {
  358. uni.showModal({
  359. content:res.message
  360. })
  361. }
  362. }).catch((err) => {
  363. uni.showModal({
  364. content:err.message
  365. })
  366. });
  367. },
  368. // 计算订单金额
  369. getjisuanprice() {
  370. this.payMount=0
  371. let _self = this
  372. var data="?userId="+localStorage.getItem('usersId')
  373. +
  374. "&houseId="+_self.roomTypeId+"&liveTime="+_self.startDate
  375. +"&leaveTime="+_self.endDate+"&houseOrderNumber=1"+"&source="+this.source
  376. getprice(data).then((res) => {
  377. if (res.success) {
  378. _self.payMount=res.data
  379. return;
  380. } else {
  381. uni.showModal({
  382. content:res.message
  383. })
  384. }
  385. }).catch((err) => {
  386. uni.showModal({
  387. content:err.message
  388. })
  389. });
  390. },
  391. // onBridgeReady () {
  392. // console.log('调用微信支付WeixinJSBridge')
  393. // var vm = this
  394. // WeixinJSBridge.invoke(
  395. // 'getBrandWCPayRequest', { // 下面参数内容都是后台返回的
  396. // "appId": "wxd87cbe1db0437303", //公众号ID,由商户传入
  397. // "timeStamp": "1720083271",//时间戳,自1970年以来的秒数
  398. // "nonceStr": "ORsH3qtW9wauQQ7iV5ovSm6n58s6Z2Nu", //随机串
  399. // "package": "prepay_id=wx041654316576072897ded7969912130000",
  400. // "signType": "RSA", //微信签名方式:
  401. // "paySign": "ZbyL2qiE9QScgwEHhObRn5/9VQgJQxLo0zKc7VxUK+Emeb3Eas/rzePUp89rHnUVYDCRJcbNsmuR2b1LHY4mydBZVnPy1vwHE/EOrCmdgALZ4J8GcQK0wTLNu9kMx97WR0f9TItPN/sR604df9ca5CKA4P40vNaUIEdK45mkqo3MR2IAdvyn+L8DhW49cL7jlsqIRiohVwwRsS4n06mX/yx1kuA339l7hbwnHaq7D4elvEqFYoMSHD8CR3XnoZ0HFE7Klu1RChMzgO4WUgVIMUxhsF6bhy5TkSea25OG/QWGZW/EHOl58bTCg3PorhZeJ/7fDkIC6pNRtKndrdsd+Q==" //微信签名
  402. // },
  403. // function(res){
  404. // if(res.err_msg == "get_brand_wcpay_request:ok" ) {} // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回 ok,但并不保证它绝对可靠。
  405. // }
  406. // )
  407. // },
  408. //创建订单
  409. postOrder(type){
  410. // var vm = this
  411. // if (typeof WeixinJSBridge === 'undefined') { // 微信浏览器内置对象。参考微信官方文档
  412. // if (document.addEventListener) {
  413. // document.addEventListener('WeixinJSBridgeReady', vm.onBridgeReady(), false)
  414. // } else if (document.attachEvent) {
  415. // document.attachEvent('WeixinJSBridgeReady', vm.onBridgeReady())
  416. // document.attachEvent('onWeixinJSBridgeReady', vm.onBridgeReady())
  417. // }
  418. // } else {
  419. // console.log('准备调用微信支付')
  420. // vm.onBridgeReady()
  421. // }
  422. if(this.roomType=='1'){
  423. var startDate=this.startDate
  424. var endDate=this.endDate
  425. }else {
  426. var startDate=this.startDateZ
  427. var endDate=this.endDateZ
  428. }
  429. if(this.indexS==5){
  430. uni.showModal({
  431. content:"请选择身份!"
  432. })
  433. return
  434. }
  435. if(this.indexL==5){
  436. uni.showModal({
  437. content:"请选择申请理由!"
  438. })
  439. return
  440. }
  441. this.payUrl=''
  442. let _self = this
  443. this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
  444. this.$axios.defaults.headers.common['user_head'] = localStorage.getItem('user_head');
  445. this.$axios.defaults.headers.common['Content-Type'] ='application/json'
  446. var data={
  447. "userId": localStorage.getItem('usersId'),
  448. "houseId": this.roomTypeId,
  449. "payPrice": this.payMount,
  450. "houseOrderNumber": 1,
  451. "liveDay": this.ruzhu_num,
  452. "reserveLiveTime": startDate,
  453. "reserveLeaveTime": endDate,
  454. "reservePhone": this.cardPhone,
  455. "reserveName": this.cardName,
  456. "source":this.source,
  457. "sourceId":this.sourceId,
  458. "identityType":this.indexS,
  459. "reason":this.indexL,
  460. }
  461. postOrder(data).then((res) => {
  462. if (res.success) {
  463. uni.navigateTo({
  464. url:'/pages/submit_order/submit_order?houseOrderId='+res.data.id
  465. })
  466. // if(res.data.payAmount==0) {
  467. // uni.navigateTo({
  468. // url:'../zhifuchenggong/zhifuchenggong?orderId='+res.data.orderId
  469. // })
  470. // } else {
  471. // window.location.href = res.data.payUrl;
  472. // }
  473. // return;
  474. } else {
  475. this.msgType = type
  476. this.order_txt=res.message
  477. this.$refs.popup_order.open()
  478. }
  479. }).catch((err) => {
  480. this.$message.error(err.message)
  481. });
  482. },
  483. // 计算指定时间是周几
  484. getweekday(date){
  485. // date例如:'2022-03-05'
  486. var weekArray = new Array("周日","周一", "周二", "周三", "周四", "周五", "周六")
  487. var weeka = weekArray[new Date(date).getDay()]
  488. return weeka
  489. },
  490. //日历选择器
  491. openCalendar() {
  492. this.$refs.popup_picker.open()
  493. },
  494. // 关闭全日房日历
  495. popup_pickerClose(){
  496. this.$refs.popup_picker.close()
  497. this.getjisuanprice()
  498. this.getWanPrice()
  499. },
  500. change(e) {
  501. // 模拟动态打卡
  502. // if (this.info.selected.length > 5) return
  503. this.info.selected=[
  504. {
  505. date: e.range.before,
  506. info: '到店'
  507. },
  508. {
  509. date: e.range.after,
  510. info: '离店'
  511. }
  512. ]
  513. if(e.range.before!=''&&e.range.after=='') {
  514. this.startWeek='周'+e.lunar.ncWeek.substring(2,3)
  515. } else if(e.range.before!=''&&e.range.after!=''){
  516. if((new Date(e.range.after).getTime())<(new Date(e.range.before).getTime())) {
  517. this.order_txt='离店日期不能小于到店日期'
  518. this.$refs.popup_order.open()
  519. this.info.selected=[]
  520. }else if(parseInt(((new Date(e.range.after).getTime())-(new Date(e.range.before).getTime()))/1000/60/60/24)>2){
  521. this.order_txt='预订时间不能超过两晚'
  522. this.$refs.popup_order.open()
  523. this.info.selected=[]
  524. }else if(parseInt(((new Date(e.range.after).getTime())-(new Date(e.range.before).getTime()))/1000/60/60/24)==2){
  525. this.order_txt='您此次申请了两晚,请注意若只住一晚可能会导致流程管理次数失效。'
  526. this.$refs.popup_order.open()
  527. this.endWeek='周'+e.lunar.ncWeek.substring(2,3)
  528. this.startTime=e.range.before.substring(5,7)+'月'+e.range.before.substring(8,10)+'日'
  529. this.endTime=e.range.after.substring(5,7)+'月'+e.range.after.substring(8,10)+'日'
  530. this.startDate = e.range.before +' '+localStorage.getItem('liveTime')
  531. this.endDate = e.range.after +' '+localStorage.getItem('leaveTime')
  532. this.ruzhu_num=parseInt(((new Date(e.range.after).getTime())-(new Date(e.range.before).getTime()))/1000/60/60/24)
  533. }else{
  534. this.endWeek='周'+e.lunar.ncWeek.substring(2,3)
  535. this.startTime=e.range.before.substring(5,7)+'月'+e.range.before.substring(8,10)+'日'
  536. this.endTime=e.range.after.substring(5,7)+'月'+e.range.after.substring(8,10)+'日'
  537. this.startDate = e.range.before +' '+localStorage.getItem('liveTime')
  538. this.endDate = e.range.after +' '+localStorage.getItem('leaveTime')
  539. this.ruzhu_num=parseInt(((new Date(e.range.after).getTime())-(new Date(e.range.before).getTime()))/1000/60/60/24)
  540. }
  541. }
  542. },
  543. //选择器
  544. bindPickerChange: function(e) {
  545. console.log('picker发送选择改变,携带值为', e.detail.value)
  546. this.index = e.detail.value
  547. this.mayTime = this.startDate.substring(0,11)+this.array[this.index].substring(0,5)+":00"
  548. // console.log(this.mayTime)
  549. },
  550. //钟点房选择器
  551. bindPickerChange2: function(e) {
  552. console.log('picker发送选择改变,携带值为', e.detail.value)
  553. this.index2 = e.detail.value
  554. console.log(this.array2[this.index2].substring(0,8),this.array2[this.index2])
  555. if(this.array2.length<=0){
  556. }else{
  557. this.startDateZ=localStorage.getItem('enableStartTime').substring(0,11)+this.array2[this.index2].substring(0,8)
  558. this.endDateZ=localStorage.getItem('enableEndTime').substring(0,11)+this.array2[this.index2].substring(9,17)
  559. }
  560. this.mayTime = this.startDate.substring(0,11)+this.array[this.index].substring(0,5)+":00"
  561. // console.log(this.mayTime)
  562. },
  563. //选择身份
  564. bindPickerChangeShen: function(e) {
  565. console.log('picker发送选择改变,携带值为', e.detail.value)
  566. this.indexS = e.detail.value
  567. },
  568. //申请理由
  569. bindPickerChangeLi: function(e) {
  570. this.indexL = e.detail.value
  571. },
  572. // 输入框
  573. bindTextAreaBlur: function (e) {
  574. this.textNum=e.detail.cursor
  575. this.remark=e.detail.value
  576. }
  577. }
  578. }
  579. </script>
  580. <style>
  581. @import url("./css/order_room.css");
  582. </style>