getoutpage.vue 5.7 KB

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