getoutpage.vue 6.0 KB

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