getoutpage.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="wrap">
  3. <view class="car-info u-flex">
  4. <view class="car-info-img">
  5. <u-image src="../../../static/img/default-car.png" width="100%" height="100%"></u-image>
  6. </view>
  7. <view class="car-info-text u-flex-1">
  8. <view class="text-item">
  9. <view class="car">{{ orderVehicleNo }}</view>
  10. <view class="position">车位:{{orderSpaceName}}</view>
  11. </view>
  12. <view class="text-item" style="color: #3192FB;">临时卡</view>
  13. <view class="text-item u-flex u-flex u-row-between">
  14. <view class="">余额:<span class="balance">100元</span></view>
  15. <view class="recharge">充值</view>
  16. </view>
  17. <view class="text-item">类型:小车(计时)</view>
  18. </view>
  19. </view>
  20. <view class="parking-info">
  21. <view class="parking-info-item">进场时间:{{orderInTime}}</view>
  22. <view class="parking-info-item">出场时间:{{orderOutTime}}</view>
  23. <view class="parking-info-item">停车时长:{{frontDuration}}</view>
  24. <view class="parking-info-item">进场押金:0.0元</view>
  25. </view>
  26. <view class="bottom-btn-wrap" v-if="payStatus==0">
  27. <view class="bottom-btn-box u-flex">
  28. <view class="bottom-btn bg-blue" @click="handleOut">出场</view>
  29. <view class="bottom-btn bg-gray">取消</view>
  30. </view>
  31. </view>
  32. <!-- 订单细节 -->
  33. <u-modal v-model="showOrderDetails"
  34. title="温馨提示"
  35. cancel-text="取消"
  36. confirm-text="确认"
  37. :show-cancel-button="true"
  38. @confirm="confirmOut"
  39. :title-style="{color: '#404040',fontSize: '46rpx',borderBottom:'1px solid #D5D5D5',margin:'0 30rpx 30rpx',paddingBottom:'30rpx'}">
  40. <view class="slot-content">
  41. <rich-text class="orderDetails" :nodes="content"></rich-text>
  42. </view>
  43. </u-modal>
  44. <u-toast ref="uToast" />
  45. </view>
  46. </template>
  47. <script>
  48. import getUrlParams from "../../../utils/getUrlParams.js";
  49. export default {
  50. data() {
  51. return {
  52. showOrderDetails:false,//是否线上订单细节
  53. content:'',
  54. orderID:'',
  55. orderInTime:'',
  56. orderOutTime:'',
  57. orderSpaceName:'',
  58. orderVehicleNo:'',
  59. payStatus:null,
  60. }
  61. },
  62. onShow() {
  63. let locationLocaturl = window.location.hash;
  64. this.orderID = getUrlParams(locationLocaturl,"orderID");
  65. this.orderInTime = getUrlParams(locationLocaturl,"orderInTime");
  66. this.orderOutTime = getUrlParams(locationLocaturl,"orderOutTime");
  67. this.orderSpaceName = getUrlParams(locationLocaturl,"orderSpaceName");
  68. this.orderVehicleNo = getUrlParams(locationLocaturl,"orderVehicleNo");
  69. this.handleEntranceOutDetail();
  70. },
  71. methods:{
  72. openPage(path) {
  73. console.log('path',path);
  74. this.$u.route({
  75. url: path
  76. })
  77. },
  78. handleEntranceOutDetail(){
  79. this.$u.api.entranceOutDetail({spaceId:this.orderID})
  80. .then(res=>{
  81. // this.$refs.uToast.show({
  82. // title: res.msg,
  83. // type: 'success',
  84. // });
  85. this.payAmount = res.data.payAmount;
  86. this.payStatus = res.data.payStatus;
  87. this.content = `
  88. <dl><dt>停车时长:</dt> <dd>` + this.frontDuration + `</dd></dl>`
  89. + `<dl><dt>账户类型:</dt><dd>` + '暂无' + `</dd></dl>`
  90. + `<dl><dt>账户余额:</dt><dd>` + '暂无' + `</dd></dl>`
  91. + `<dl><dt>车辆类型:</dt><dd>` + '暂无' + `</dd></dl>`
  92. + `<dl><dt>押金:</dt><dd>` + '暂无' + `</dd></dl>`
  93. + `<dl><dt>应收:</dt><dd>` + res.data.payAmount + `</dd></dl>`
  94. + `<dl><dt>补交:</dt><dd><span class="u-type-warning">` + '暂无' + `<span></dd></dl>`
  95. + `<div class="tip">你是否将该车辆出场,如果是请点击确认,否则点击取消!</div>`;
  96. console.log('entranceOutDetail',res)
  97. }).catch(err=>{
  98. this.$refs.uToast.show({
  99. title: err.msg,
  100. type: 'error',
  101. });
  102. console.log('entranceOutDetail ',err)
  103. });
  104. },
  105. handleOut(res){
  106. this.showOrderDetails = true;
  107. },
  108. confirmOut(){
  109. this.$u.api.getOut({spaceId:this.orderID})
  110. .then(res=>{
  111. this.$refs.uToast.show({
  112. title: res.msg,
  113. type: 'success',
  114. url:'pages/getout/getout'
  115. });
  116. console.log('getOut',res)
  117. }).catch(err=>{
  118. this.$refs.uToast.show({
  119. title: err.msg,
  120. type: 'error',
  121. });
  122. console.log('getOut ',err)
  123. });
  124. },
  125. timeago(inTime,outTime){
  126. var time_start = new Date(inTime.replace(/-/g,'/'));
  127. var time_end = new Date(outTime.replace(/-/g,'/'));
  128. var clock_start = time_start.getTime();
  129. var clock_end = time_end.getTime();
  130. // console.log('currentTime',this.currentTime)
  131. const formatNumber = (num) => {
  132. num = num.toString()
  133. return num[1] ? num : '0' + num
  134. };
  135. var i_total_secs = Math.round(clock_end - clock_start);
  136. //计算出相差天数
  137. var days = Math.floor(i_total_secs / (24 * 3600 * 1000))
  138. //计算出小时数
  139. var leave1 = i_total_secs % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
  140. var hours = Math.floor(leave1 / (3600 * 1000))
  141. //计算相差分钟数
  142. var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
  143. var minutes = Math.floor(leave2 / (60 * 1000))
  144. //计算相差秒数
  145. var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
  146. var seconds = Math.round(leave3 / 1000)
  147. hours = formatNumber(hours);
  148. minutes = formatNumber(minutes);
  149. seconds = formatNumber(seconds);
  150. // console.log(days + '天' + hours + '个小时' + minutes + '分钟' + seconds + '秒');
  151. // this.frontDuration = hours + ':' + minutes + ':' + seconds;
  152. return hours + ':' + minutes + ':' + seconds
  153. }
  154. },
  155. computed:{
  156. frontDuration:function(){
  157. return this.timeago(this.orderInTime,this.orderOutTime)
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="scss">
  163. @import "./getoutpage.scss";
  164. </style>