getoutpage.vue 5.6 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">暂无</span></view>
  15. <view class="recharge" @click="$refs.uToast.show({title: '建设中'})">充值</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" @click="openPage('pages/getout/getout')">取消</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. export default {
  49. data() {
  50. return {
  51. showOrderDetails:false,//是否线上订单细节
  52. content:'',
  53. orderID:'',
  54. orderInTime:'',
  55. orderOutTime:'',
  56. orderSpaceName:'',
  57. orderVehicleNo:'',
  58. payStatus:null,
  59. }
  60. },
  61. onLoad(page) {
  62. this.orderID = page.orderID;
  63. this.orderInTime = page.orderInTime;
  64. this.orderOutTime = page.orderOutTime;
  65. this.orderSpaceName = page.orderSpaceName;
  66. this.orderVehicleNo = page.orderVehicleNo;
  67. this.handleEntranceOutDetail();
  68. },
  69. onShow() {
  70. this.handleEntranceOutDetail();
  71. },
  72. methods:{
  73. openPage(path) {
  74. console.log('path',path);
  75. this.$u.route({
  76. url: path
  77. })
  78. },
  79. handleEntranceOutDetail(){
  80. this.$u.api.entranceOutDetail({spaceId:this.orderID})
  81. .then(res=>{
  82. // this.$refs.uToast.show({
  83. // title: res.msg,
  84. // type: 'success',
  85. // });
  86. this.payAmount = res.data.payAmount;
  87. this.payStatus = res.data.payStatus;
  88. this.content = `
  89. <dl><dt>停车时长:</dt> <dd>` + this.frontDuration + `</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>` + '暂无' + `</dd></dl>`
  94. + `<dl><dt>应收:</dt><dd>` + res.data.payAmount + `</dd></dl>`
  95. + `<dl><dt>补交:</dt><dd><span class="u-type-warning">` + '暂无' + `<span></dd></dl>`
  96. + `<div class="tip">你是否将该车辆出场,如果是请点击确认,否则点击取消!</div>`;
  97. console.log('entranceOutDetail',res)
  98. }).catch(err=>{
  99. this.$refs.uToast.show({
  100. title: err.msg,
  101. type: 'error',
  102. });
  103. console.log('entranceOutDetail ',err)
  104. });
  105. },
  106. handleOut(res){
  107. this.showOrderDetails = true;
  108. },
  109. confirmOut(){
  110. this.$u.api.getOut({spaceId:this.orderID})
  111. .then(res=>{
  112. this.$refs.uToast.show({
  113. title: res.msg,
  114. type: 'success',
  115. url:'pages/getout/getout'
  116. });
  117. console.log('getOut',res)
  118. }).catch(err=>{
  119. this.$refs.uToast.show({
  120. title: err.msg,
  121. type: 'error',
  122. });
  123. console.log('getOut ',err)
  124. });
  125. },
  126. timeago(inTime,outTime){
  127. var time_start = new Date(inTime.replace(/-/g,'/'));
  128. var time_end = new Date(outTime.replace(/-/g,'/'));
  129. var clock_start = time_start.getTime();
  130. var clock_end = time_end.getTime();
  131. // console.log('currentTime',this.currentTime)
  132. const formatNumber = (num) => {
  133. num = num.toString()
  134. return num[1] ? num : '0' + num
  135. };
  136. var i_total_secs = Math.round(clock_end - clock_start);
  137. //计算出相差天数
  138. var days = Math.floor(i_total_secs / (24 * 3600 * 1000))
  139. //计算出小时数
  140. var leave1 = i_total_secs % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
  141. var hours = Math.floor(i_total_secs / (3600 * 1000))
  142. //计算相差分钟数
  143. var leave2 = i_total_secs % (3600 * 1000) //计算小时数后剩余的毫秒数
  144. var minutes = Math.floor(leave2 / (60 * 1000))
  145. //计算相差秒数
  146. var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
  147. var seconds = Math.round(leave3 / 1000)
  148. hours = formatNumber(hours);
  149. minutes = formatNumber(minutes);
  150. seconds = formatNumber(seconds);
  151. // console.log(days + '天' + hours + '个小时' + minutes + '分钟' + seconds + '秒');
  152. // this.frontDuration = hours + ':' + minutes + ':' + seconds;
  153. return hours + ':' + minutes + ':' + seconds
  154. }
  155. },
  156. computed:{
  157. frontDuration:function(){
  158. return this.timeago(this.orderInTime,this.orderOutTime)
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss">
  164. @import "./getoutpage.scss";
  165. </style>