getoutpage.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="">
  3. <view class="car-info u-flex">
  4. <view class="car-info-img">
  5. <u-image :src="leaveDetail.vehicleImage||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">{{ leaveDetail.vehicleNo }}</view>
  10. <view class="position">车位:{{leaveDetail.spaceName}}</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">类型:{{leaveDetail.vehicleType|filterCarType}}</view>
  18. </view>
  19. </view>
  20. <view class="parking-info">
  21. <view class="parking-info-item">进场时间:{{leaveDetail.inTime}}</view>
  22. <view class="parking-info-item">出场时间:{{leaveDetail.outTime}}</view>
  23. <view class="parking-info-item">停车时长:{{leaveDetail.duration}}</view>
  24. <view class="parking-info-item">本次应收:<span class="u-type-primary">{{leaveDetail.totalAmount}}元</span></view>
  25. <view class="parking-info-item u-flex u-row-between" @click="goOwelist">
  26. <view class="">
  27. 历史欠费:<span class="u-type-warning">{{leaveDetail.oweAmount}}元</span>
  28. </view>
  29. <u-icon name="arrow-right" color="#7B7B7B" size="28"></u-icon>
  30. </view>
  31. </view>
  32. <view class="bottom-btn-wrap" v-if="leaveDetail.payStatus==0">
  33. <view class="bottom-btn-box u-flex">
  34. <view class="bottom-btn bg-blue" @click="handleOut">出场</view>
  35. <view class="bottom-btn bg-gray" @click="openPage('pages/getout/getout')">取消</view>
  36. </view>
  37. </view>
  38. <!-- 订单细节 -->
  39. <u-popup class="popup orderDetails" v-model="showOrderDetails" mode="center" border-radius="20" width="90%">
  40. <view class="popup-title">温馨提示</view>
  41. <view class="details-body">
  42. <dl><dt>停车时长:</dt> <dd>{{leaveDetail.duration}}</dd></dl>
  43. <dl><dt>车辆类型:</dt> <dd>{{leaveDetail.vehicleType|filterCarType}}</dd></dl>
  44. <dl><dt>本次应收:</dt> <dd class="u-type-primary">{{leaveDetail.totalAmount}}元</dd></dl>
  45. <dl><dt>历史欠费:</dt> <dd class="u-type-warning">{{leaveDetail.oweAmount}}元</dd></dl>
  46. <view class="tip">
  47. 你是否将该车辆出场,如果是请点击确认,否则点击取消!
  48. </view>
  49. </view>
  50. <view class="details-footer u-flex u-row-between">
  51. <view class="details-footer-btn details-footer-btn--blue" @click="payAll">全部缴费</view>
  52. <view class="details-footer-btn details-footer-btn--yellow" @click="payThis">本次缴费</view>
  53. <view class="details-footer-btn bg-gray" @click="openPage('pages/getout/getout')">取消</view>
  54. </view>
  55. </u-popup>
  56. <!-- 支付方式 -->
  57. <u-popup class="popup payway-popup" v-model="showPayway" mode="center" border-radius="20" width="90%">
  58. <view class="popup-title">支付方式</view>
  59. <view class="popup-body u-flex u-row-between">
  60. <view class="payway-item" @click="$refs.uToast.show({title: '暂不支持'})">
  61. <u-image src="/static/img/payway-xj.png" width="143" height="143"></u-image>
  62. <!-- <view class="icon-wrap">
  63. <u-icon name="rmb-circle-fill" color="#FFC02D" size="66"></u-icon>
  64. </view> -->
  65. 现金支付
  66. </view>
  67. <view class="payway-item" @click="scanPay">
  68. <u-image src="/static/img/payway-scan.png" width="143" height="143"></u-image>
  69. <!-- <view class="icon-wrap">
  70. <u-icon name="scan" color="#FFC02D" size="66"></u-icon>
  71. </view> -->
  72. 扫码收费
  73. </view>
  74. <view class="payway-item" @click="qrPay">
  75. <u-image src="/static/img/payway-qr.png" width="143" height="143"></u-image>
  76. <!-- <view class="icon-wrap">
  77. <u-icon name="rmb-circle-fill" color="#FFC02D" size="66"></u-icon>
  78. </view> -->
  79. 收款码
  80. </view>
  81. </view>
  82. <view class="popup-footer payway-popup-footer">
  83. <view class="payway-popup-btn" @click="closePayway">关闭</view>
  84. </view>
  85. </u-popup>
  86. <u-toast ref="uToast" />
  87. </view>
  88. </template>
  89. <script>
  90. //#ifdef APP-PLUS
  91. let speak = uni.requireNativePlugin("SpeechPlug");
  92. let ALog = uni.requireNativePlugin("AndroidLog")
  93. //#endif
  94. export default {
  95. data() {
  96. return {
  97. vehicleImage:'/static/img/default-car.png',
  98. showOrderDetails:false,//是否线上订单细节
  99. leaveDetail:[],
  100. orderID:'',
  101. orderInTime:'',
  102. orderOutTime:'',
  103. orderSpaceName:'',
  104. orderVehicleNo:'',
  105. totalAmount:'',
  106. oweAmount:'',
  107. duration:'',
  108. vehicleType:0,
  109. payStatus:null,
  110. showPayway:false,
  111. payParams:{
  112. orderList:[],
  113. code:''
  114. }
  115. }
  116. },
  117. onLoad(page) {
  118. this.orderID = page.orderID;
  119. this.orderInTime = page.orderInTime;
  120. this.orderOutTime = page.orderOutTime;
  121. this.orderSpaceName = page.orderSpaceName;
  122. this.orderVehicleNo = page.orderVehicleNo;
  123. //#ifdef APP-PLUS
  124. this.speaks(this.orderVehicleNo);
  125. //#endif
  126. // this.handleEntranceOutDetail();
  127. },
  128. onShow() {
  129. this.handleEntranceOutDetail();
  130. },
  131. methods:{
  132. openPage(path) {
  133. console.log('path',path);
  134. this.$u.route({
  135. url: path
  136. })
  137. },
  138. speaks(msg){
  139. speak?.speakAction(msg)
  140. },
  141. handleEntranceOutDetail(){
  142. this.$u.api.entranceOutDetail({spaceId:this.orderID})
  143. .then(res=>{
  144. // this.$refs.uToast.show({
  145. // title: res.msg,
  146. // type: 'success',
  147. // });
  148. this.leaveDetail = res.data;
  149. console.log('entranceOutDetail',res)
  150. }).catch(err=>{
  151. this.$refs.uToast.show({
  152. title: err.msg,
  153. type: 'error',
  154. });
  155. console.log('entranceOutDetail ',err)
  156. });
  157. },
  158. handleOut(res){
  159. this.showOrderDetails = true;
  160. },
  161. payThis(){
  162. this.showOrderDetails = false;
  163. this.showPayway = true;
  164. this.payParams.orderList.push(this.leaveDetail.orderId);
  165. },
  166. payAll(){
  167. this.showOrderDetails = false;
  168. this.showPayway = true;
  169. this.payParams.orderList.push(this.leaveDetail.orderId);
  170. this.leaveDetail.oweList.forEach(item=>{
  171. this.payParams.orderList.push(item.orderId);
  172. });
  173. },
  174. closePayway(){
  175. this.showPayway = false;
  176. },
  177. scanPay(){
  178. console.log('this.payParams',this.payParams);
  179. ALog('开始扫描');
  180. //#ifdef APP-PLUS
  181. ALog('开始扫描111');
  182. //#endif
  183. uni.scanCode({
  184. onlyFromCamera: true,
  185. success: function (res) {
  186. //#ifdef APP-PLUS
  187. plus.nativeUI.toast(res.result);
  188. ALog('条码类型:' + res.scanType);
  189. //#endif
  190. console.log('条码类型:' + res.scanType);
  191. console.log('条码内容:' + res.result);
  192. },
  193. fail:function(err){
  194. //#ifdef APP-PLUS
  195. ALog('条码类型:err' + err);
  196. //#endif
  197. }
  198. });
  199. this.$u.api.gzbankSwept()
  200. .then(res=>{
  201. this.$refs.uToast.show({
  202. title: res.msg,
  203. type: 'success',
  204. });
  205. console.log('gzbankSwept',res)
  206. }).catch(err=>{
  207. this.$refs.uToast.show({
  208. title: err.msg,
  209. type: 'error',
  210. });
  211. console.log('gzbankSwept ',err)
  212. });
  213. },
  214. qrPay(){
  215. console.log('this.payParams',this.payParams);
  216. },
  217. confirmOut(){
  218. this.$u.api.getOut({spaceId:this.orderID})
  219. .then(res=>{
  220. this.$refs.uToast.show({
  221. title: res.msg,
  222. type: 'success',
  223. url:'pages/getout/getout'
  224. });
  225. console.log('getOut',res)
  226. }).catch(err=>{
  227. this.$refs.uToast.show({
  228. title: err.msg,
  229. type: 'error',
  230. });
  231. console.log('getOut ',err)
  232. });
  233. },
  234. goOwelist(){
  235. this.$u.route({
  236. url: 'pages/owelist/owelist',
  237. params: {
  238. orderID: this.orderID
  239. }
  240. });
  241. },
  242. timeago(inTime,outTime){
  243. var time_start = new Date(inTime.replace(/-/g,'/'));
  244. var time_end = new Date(outTime.replace(/-/g,'/'));
  245. var clock_start = time_start.getTime();
  246. var clock_end = time_end.getTime();
  247. // console.log('currentTime',this.currentTime)
  248. const formatNumber = (num) => {
  249. num = num.toString()
  250. return num[1] ? num : '0' + num
  251. };
  252. var i_total_secs = Math.round(clock_end - clock_start);
  253. //计算出相差天数
  254. var days = Math.floor(i_total_secs / (24 * 3600 * 1000))
  255. //计算出小时数
  256. var leave1 = i_total_secs % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
  257. var hours = Math.floor(i_total_secs / (3600 * 1000))
  258. //计算相差分钟数
  259. var leave2 = i_total_secs % (3600 * 1000) //计算小时数后剩余的毫秒数
  260. var minutes = Math.floor(leave2 / (60 * 1000))
  261. //计算相差秒数
  262. var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
  263. var seconds = Math.round(leave3 / 1000)
  264. hours = formatNumber(hours);
  265. minutes = formatNumber(minutes);
  266. seconds = formatNumber(seconds);
  267. // console.log(days + '天' + hours + '个小时' + minutes + '分钟' + seconds + '秒');
  268. // this.frontDuration = hours + ':' + minutes + ':' + seconds;
  269. return hours + ':' + minutes + ':' + seconds
  270. }
  271. },
  272. computed:{
  273. frontDuration:function(){
  274. return this.timeago(this.orderInTime,this.orderOutTime)
  275. }
  276. }
  277. }
  278. </script>
  279. <style lang="scss">
  280. @import "./getoutpage.scss";
  281. </style>