getoutpage.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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">
  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" :mask-close-able="false" 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" :mask-close-able="false" 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-popup class="popup qrcode-popup" v-model="showQrcode" :mask-close-able="false" mode="center" border-radius="20" width="90%">
  87. <vue-qrcode :value='qrcontent' :options="{ width: 200 }"></vue-qrcode>
  88. <view class="qrcode-popup-btn" @click="hideQrcode">关闭</view>
  89. </u-popup>
  90. <u-toast ref="uToast" />
  91. </view>
  92. </template>
  93. <script>
  94. //#ifdef APP-PLUS
  95. let speak = uni.requireNativePlugin("SpeechPlug");
  96. let ALog = uni.requireNativePlugin("AndroidLog")
  97. //#endif
  98. import VueQrcode from '@chenfengyuan/vue-qrcode'
  99. export default {
  100. components:{
  101. VueQrcode
  102. },
  103. data() {
  104. return {
  105. vehicleImage:'/static/img/default-car.png',
  106. showOrderDetails:false,//是否线上订单细节
  107. leaveDetail:[],
  108. orderID:'',
  109. orderInTime:'',
  110. orderOutTime:'',
  111. orderSpaceName:'',
  112. orderVehicleNo:'',
  113. totalAmount:'',
  114. oweAmount:'',
  115. duration:'',
  116. vehicleType:0,
  117. payStatus:null,
  118. showPayway:false,
  119. payParams:{
  120. orderList:[],
  121. code:''
  122. },
  123. showQrcode:false,
  124. qrcontent:'https://postest.bgzchina.com/mobilePay?sysId=ZDM20210510000088857402',
  125. }
  126. },
  127. onLoad(page) {
  128. this.orderID = page.orderID;
  129. this.orderInTime = page.orderInTime;
  130. this.orderOutTime = page.orderOutTime;
  131. this.orderSpaceName = page.orderSpaceName;
  132. this.orderVehicleNo = page.orderVehicleNo;
  133. //#ifdef APP-PLUS
  134. this.speaks(this.orderVehicleNo);
  135. //#endif
  136. // this.handleEntranceOutDetail();
  137. },
  138. onShow() {
  139. this.handleEntranceOutDetail();
  140. },
  141. methods:{
  142. openPage(path) {
  143. console.log('path',path);
  144. this.$u.route({
  145. url: path
  146. })
  147. },
  148. speaks(msg){
  149. speak?.speakAction(msg)
  150. },
  151. handleEntranceOutDetail(){
  152. this.$u.api.entranceOutDetail({spaceId:this.orderID})
  153. .then(res=>{
  154. // this.$refs.uToast.show({
  155. // title: res.msg,
  156. // type: 'success',
  157. // });
  158. this.leaveDetail = res.data;
  159. console.log('entranceOutDetail',res)
  160. }).catch(err=>{
  161. this.$refs.uToast.show({
  162. title: err.msg,
  163. type: 'error',
  164. });
  165. console.log('entranceOutDetail ',err)
  166. });
  167. },
  168. handleOut(res){
  169. this.showOrderDetails = true;
  170. },
  171. payThis(){
  172. this.showOrderDetails = false;
  173. this.showPayway = true;
  174. this.payParams.orderList.push(this.leaveDetail.orderId);
  175. },
  176. payAll(){
  177. this.showOrderDetails = false;
  178. this.showPayway = true;
  179. this.payParams.orderList.push(this.leaveDetail.orderId);
  180. this.leaveDetail.oweList.forEach(item=>{
  181. this.payParams.orderList.push(item.orderId);
  182. });
  183. },
  184. closePayway(){
  185. this.showPayway = false;
  186. },
  187. scanPay(){
  188. console.log('this.payParams',this.payParams);
  189. uni.scanCode({
  190. onlyFromCamera: true,
  191. success: function (res) {
  192. //#ifdef APP-PLUS
  193. ALog.info({msg:'条码内容:' + res.result});
  194. //#endif
  195. this.payParams.code = res.result;
  196. this.$u.api.gzbankSwept(this.payParams)
  197. .then(res=>{
  198. this.$refs.uToast.show({
  199. title: res.msg,
  200. type: 'success',
  201. });
  202. console.log('gzbankSwept',res)
  203. }).catch(err=>{
  204. this.$refs.uToast.show({
  205. title: err.msg,
  206. type: 'error',
  207. });
  208. console.log('gzbankSwept ',err)
  209. });
  210. console.log('条码类型:' + res.scanType);
  211. console.log('条码内容:' + res.result);
  212. },
  213. fail:function(err){
  214. //#ifdef APP-PLUS
  215. plus.nativeUI.toast('扫码失败');
  216. ALog.info({msg:'条码类型:err' + err});
  217. //#endif
  218. }
  219. });
  220. },
  221. qrPay(){
  222. console.log('this.payParams',this.payParams);
  223. this.$u.api.gzbankPolypay(this.payParams)
  224. .then(res=>{
  225. // this.$refs.uToast.show({
  226. // title: res.msg,
  227. // type: 'success',
  228. // });
  229. this.qrcontent = res.data.qrCodeUrl;
  230. console.log('this.qrcontent',this.qrcontent);
  231. this.showPayway = false;
  232. this.showQrcode = true;
  233. console.log('gzbankPolypay',res)
  234. }).catch(err=>{
  235. this.$refs.uToast.show({
  236. title: err.msg,
  237. type: 'error',
  238. });
  239. console.log('gzbankPolypay ',err)
  240. });
  241. },
  242. hideQrcode(){
  243. this.showQrcode = false;
  244. this.$u.route({
  245. url: 'pages/getout/getout',
  246. });
  247. },
  248. confirmOut(){
  249. this.$u.api.getOut({spaceId:this.orderID})
  250. .then(res=>{
  251. this.$refs.uToast.show({
  252. title: res.msg,
  253. type: 'success',
  254. url:'pages/getout/getout'
  255. });
  256. console.log('getOut',res)
  257. }).catch(err=>{
  258. this.$refs.uToast.show({
  259. title: err.msg,
  260. type: 'error',
  261. });
  262. console.log('getOut ',err)
  263. });
  264. },
  265. goOwelist(){
  266. this.$u.route({
  267. url: 'pages/owelist/owelist',
  268. params: {
  269. orderID: this.orderID
  270. }
  271. });
  272. },
  273. timeago(inTime,outTime){
  274. var time_start = new Date(inTime.replace(/-/g,'/'));
  275. var time_end = new Date(outTime.replace(/-/g,'/'));
  276. var clock_start = time_start.getTime();
  277. var clock_end = time_end.getTime();
  278. // console.log('currentTime',this.currentTime)
  279. const formatNumber = (num) => {
  280. num = num.toString()
  281. return num[1] ? num : '0' + num
  282. };
  283. var i_total_secs = Math.round(clock_end - clock_start);
  284. //计算出相差天数
  285. var days = Math.floor(i_total_secs / (24 * 3600 * 1000))
  286. //计算出小时数
  287. var leave1 = i_total_secs % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
  288. var hours = Math.floor(i_total_secs / (3600 * 1000))
  289. //计算相差分钟数
  290. var leave2 = i_total_secs % (3600 * 1000) //计算小时数后剩余的毫秒数
  291. var minutes = Math.floor(leave2 / (60 * 1000))
  292. //计算相差秒数
  293. var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
  294. var seconds = Math.round(leave3 / 1000)
  295. hours = formatNumber(hours);
  296. minutes = formatNumber(minutes);
  297. seconds = formatNumber(seconds);
  298. // console.log(days + '天' + hours + '个小时' + minutes + '分钟' + seconds + '秒');
  299. // this.frontDuration = hours + ':' + minutes + ':' + seconds;
  300. return hours + ':' + minutes + ':' + seconds
  301. }
  302. },
  303. computed:{
  304. frontDuration:function(){
  305. return this.timeago(this.orderInTime,this.orderOutTime)
  306. }
  307. }
  308. }
  309. </script>
  310. <style lang="scss">
  311. @import "./getoutpage.scss";
  312. </style>