ownersinfo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <template>
  2. <view>
  3. <u-navbar
  4. title="停车记录查询"
  5. title-color="#fff"
  6. :custom-back="customBack"
  7. :border-bottom="false"
  8. back-icon-color="#CCE8FF"
  9. :background="{background: 'linear-gradient(145deg, #41AFF9 0%, #2D8CFB 100%)' }"></u-navbar>
  10. <!-- <u-empty class="u-m-t-50" text="很棒!没有欠费订单!" mode="list" v-if="listEmpty"></u-empty> -->
  11. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" >
  12. <view class="owelist">
  13. <view class="owelist-item" v-for="(item,index) in owelist" :key="item.id">
  14. <view class="item-header u-flex u-row-between">
  15. <view class="vehicle-no">{{item.vehicleNo}}</view>
  16. <view class="space-name">{{item.spaceName}}</view>
  17. </view>
  18. <view class="road-name u-flex">
  19. <u-icon name="map-fill" color="#3397FA" size="36"></u-icon>
  20. {{item.roadName}}
  21. </view>
  22. <view class="info-item">订单号:{{item.orderId}}</view>
  23. <view class="info-item">进场时间:{{item.inTime}}</view>
  24. <view v-if="item.orderStatus != 1" class="info-item">出场时间:{{item.outTime}}</view>
  25. <view v-if="item.orderStatus != 1" class="info-item">停车时长:{{item.duration}}</view>
  26. <view class="info-item">收费员:{{item.payeeName}}</view>
  27. <view v-if="item.orderStatus != 1" class="info-item">支付金额:<span class="amount">{{item.payAmount}}元</span></view>
  28. <view class="info-item">订单状态:{{item.orderStatus|filterOrderStatus}}</view>
  29. <view>
  30. <button v-if="item.orderStatus == 1" size="mini" type="primary" @click="onParkIn(item)">入场小票</button>
  31. <button v-if="item.orderStatus != 1" size="mini" type="warn" @click="onParkLeave(item)">出场小票</button>
  32. </view>
  33. </view>
  34. </view>
  35. </mescroll-body>
  36. <view class="button-wrap" v-if="owelist.length&&owelist.length>=1">
  37. <!-- <button class="button" type="primary" @click="all()">全部缴费</button> -->
  38. <button class="button" type="primary" @click="confirmPrice()">全部缴费</button>
  39. </view>
  40. <!-- 缴费提示-->
  41. <u-modal
  42. v-model="payTipsPop"
  43. :title-style="{color: '#404040'}"
  44. title="缴费提示"
  45. :show-confirm-button="true"
  46. confirm-text="立即缴费"
  47. :confirm-style="{backgroundColor: '#3397FA', color: '#fff'}"
  48. :show-cancel-button="true"
  49. cancel-text="取消"
  50. :cancel-style="{backgroundColor: '#EBF1FF', color: '#3397FA'}"
  51. @confirm="payTipsPopConfirm">
  52. <view class="slot-content">
  53. <view class="pay-tips">
  54. <text>{{payTipsItem.num}}</text>场停车欠费,共
  55. <text>{{payTipsItem.price}}</text>元
  56. </view>
  57. </view>
  58. </u-modal>
  59. <u-modal
  60. v-model="payWayPop"
  61. :title-style="{color: '#404040'}"
  62. title="缴费方式"
  63. :show-confirm-button="false"
  64. :show-cancel-button="false">
  65. <view class="slot-content">
  66. <view class="pay-way">
  67. <view class="pay-way-item" @click="cashPay">
  68. <image src="/static/img/payway-xj.png" mode=""></image>
  69. <view>现金支付</view>
  70. </view>
  71. <view class="pay-way-item" @click="scanPay">
  72. <image src="/static/img/payway-scan.png" mode=""></image>
  73. <view>扫码收费</view>
  74. </view>
  75. <view class="pay-way-item" @click="qrPay">
  76. <image src="/static/img/payway-qr.png" mode=""></image>
  77. <view>收款码</view>
  78. </view>
  79. </view>
  80. <button class="pay-way-close-btn" @click="payWayPop = false">关闭</button>
  81. </view>
  82. </u-modal>
  83. <u-popup class="popup cashPay-popup" v-model="showCash" :mask-close-able="false" mode="center" border-radius="20" width="90%">
  84. <view class="popup-title">本次收到缴费</view>
  85. <view class="popup-body u-flex">
  86. <view class="u-flex-1 ">您确认已收取现金<span style="color: red;">{{payTipsItem.price}}</span>元吗?</view>
  87. <!-- <view class="u-flex-1 change">找零{{changeMoney}}元</view> -->
  88. </view>
  89. <view class="popup-footer u-flex">
  90. <view class="popup-btn1" ><u-button type="primary" @click="consfimPayway">确认</u-button> </view>
  91. <view class="popup-btn2" ><u-button type="primary" :plain="true"@click="closecashPayway">关闭</u-button> </view>
  92. </view>
  93. </u-popup>
  94. <u-popup class="popup qrcode-popup" v-model="showQrcode" :mask-close-able="false" mode="center" border-radius="20" width="90%">
  95. <tki-qrcode
  96. ref="qrcode"
  97. cid="tki-qrcode-canvas"
  98. :val="qrcontent"
  99. :size="200"
  100. unit="px"
  101. background="#000000"
  102. foreground="#ffffff"
  103. pdground="#ffffff"
  104. :iconSize="40"
  105. :onval="true"
  106. :loadMake="false"
  107. :usingComponents="true"
  108. :showLoading="false"
  109. loadingText="loadingText"
  110. />
  111. <view class="qrcode-popup-btn" @click="hideQrcode">关闭</view>
  112. </u-popup>
  113. <u-toast ref="uToast" />
  114. </view>
  115. </template>
  116. <script>
  117. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  118. //#ifdef APP-PLUS
  119. let device = uni.requireNativePlugin("DeviceInfo");
  120. //#endif
  121. import tkiQrcode from "tki-qrcode";
  122. export default{
  123. components:{
  124. tkiQrcode
  125. },
  126. mixins: [MescrollMixin], // 使用mixin
  127. data(){
  128. return{
  129. change:'0',
  130. // cashMoney:'',
  131. showCash:false,
  132. qrcontent:'',
  133. showQrcode:false,
  134. payParams:{
  135. orderList:[],
  136. code:'',
  137. cashMoney:'',
  138. },
  139. currentItem: [],
  140. payWayPop: false,
  141. payTipsItem: {
  142. num: '',
  143. price: ''
  144. },
  145. payTipsPop: false,
  146. vehicleNo:'',
  147. listEmpty:false,
  148. owelist:[],
  149. pagination:Object.assign({}, {pageNo: 1,pageSize: 10}),
  150. }
  151. },
  152. onLoad(page){
  153. this.vehicleNo = page.vehicleNo;
  154. console.log('this.vehicleNo',this.vehicleNo)
  155. },
  156. onShow(){
  157. // this.owelist = [];
  158. },
  159. onReachBottom() {
  160. // this.getData();
  161. },
  162. computed:{
  163. changeMoney(){
  164. if(this.payParams.cashMoney>this.payTipsItem.price){
  165. return this.payParams.cashMoney-this.payTipsItem.price
  166. }else{
  167. return 0
  168. }
  169. }
  170. },
  171. methods:{
  172. cashPay(){
  173. this.showCash = true;
  174. },
  175. closecashPayway(){
  176. this.showCash = false;
  177. },
  178. consfimPayway(){
  179. if(this.payParams.cashMoney<this.payTipsItem.price){
  180. this.$refs.uToast.show({
  181. title: '支付金额小于欠费金额,不能支付',
  182. type: 'error',
  183. });
  184. }else{
  185. this.$u.api.cashPay(this.payParams)
  186. .then(res=>{
  187. uni.showLoading({
  188. title: '查询支付状态中'
  189. });
  190. this.timer = setInterval(() => {
  191. this.handlePayQuery(res.data.polyOrderId)
  192. }, 3000);
  193. }).catch(err=>{
  194. this.$refs.uToast.show({
  195. title: err.msg,
  196. type: 'error',
  197. });
  198. });
  199. }
  200. },
  201. qrPay(){
  202. console.log('this.payParams',this.payParams);
  203. this.$u.api.gzbankPolypay(this.payParams)
  204. .then(res=>{
  205. // this.$refs.uToast.show({
  206. // title: res.msg,
  207. // type: 'success',
  208. // });
  209. this.showPayway = false;
  210. this.showQrcode = true;
  211. setTimeout(()=>{
  212. this.qrcontent = res.data.qrCodeUrl;
  213. },500)
  214. // 启动定时器查询订单状态
  215. uni.showLoading({
  216. title: '等待支付中'
  217. });
  218. this.timer = setInterval(() => {
  219. this.handlePayQuery(res.data.polyOrderId)
  220. }, 3000);
  221. console.log('gzbankPolypay',res)
  222. }).catch(err=>{
  223. this.$refs.uToast.show({
  224. title: err.msg,
  225. type: 'error',
  226. });
  227. console.log('gzbankPolypay ',err)
  228. });
  229. },
  230. hideQrcode(){
  231. this.showQrcode = false;
  232. },
  233. scanPay(){
  234. setTimeout(() =>{
  235. uni.scanCode({
  236. onlyFromCamera: true,
  237. scanType:['barCode','qrCode'],
  238. success: (res) => {
  239. console.log(res)
  240. this.payParams.code = res.result;
  241. this.$u.api.gzbankSwept(this.payParams)
  242. .then(res=>{
  243. // 启动定时器查询订单状态
  244. uni.showLoading({
  245. title: '查询支付状态中'
  246. });
  247. this.timer = setInterval(() => {
  248. this.handlePayQuery(res.data.polyOrderId)
  249. }, 3000);
  250. }).catch(err=>{
  251. //#ifdef APP-PLUS
  252. plus.nativeUI.toast(err.msg);
  253. //#endif
  254. });
  255. },
  256. fail:function(err){
  257. //#ifdef APP-PLUS
  258. plus.nativeUI.toast('扫码失败');
  259. ALog.info({msg:'条码类型:err' + err});
  260. //#endif
  261. }
  262. });
  263. },2000)
  264. },
  265. handlePayQuery(polyOrderId){
  266. this.$u.api.payQuery({polyOrderId:polyOrderId})
  267. .then(res=>{
  268. // this.$refs.uToast.show({
  269. // title: res.msg,
  270. // type: 'success',
  271. // });
  272. // 支付成功后的页面跳转
  273. if (res.data.payStatus==1) {
  274. uni.hideLoading();
  275. clearInterval(this.timer)
  276. this.$refs.uToast.show({
  277. title:'支付成功',
  278. type: 'success',
  279. url:'pages/index/index',
  280. // params: {
  281. // vehicleNo:this.orderVehicleNo,
  282. // },
  283. duration:10000
  284. });
  285. };
  286. console.log('handlePayQuery',res)
  287. }).catch(err=>{
  288. this.$refs.uToast.show({
  289. title: err.msg,
  290. type: 'error',
  291. });
  292. console.log('handlePayQuery ',err)
  293. });
  294. },
  295. // 缴费提示弹框确认
  296. payTipsPopConfirm() {
  297. this.payWayPop = true
  298. },
  299. // 全部缴费确认
  300. confirmPrice(){
  301. let orderNum = 0, price = 0
  302. this.currentItem = []
  303. this.owelist.forEach(item => {
  304. console.log(item)
  305. if ((item.orderStatus == 2||item.orderStatus == 3) && item.payStatus !== 1 ) {
  306. price += item.payAmount
  307. orderNum ++
  308. this.currentItem.push(item.orderId);
  309. this.payParams.orderList.push(item.orderId);
  310. }
  311. })
  312. this.payTipsItem.num = orderNum
  313. this.payTipsItem.price = price
  314. if (orderNum !== 0 && price !== 0) {
  315. this.payTipsPop = true
  316. } else {
  317. this.$refs.uToast.show({
  318. title: '没有需要支付的订单',
  319. type: 'warning'
  320. })
  321. }
  322. },
  323. customBack(){
  324. uni.reLaunch({
  325. url: '/pages/index/index'
  326. });
  327. },
  328. downCallback(){
  329. this.mescroll.resetUpScroll();
  330. },
  331. upCallback(page){
  332. let pageNum = page.num; // 页码, 默认从1开始
  333. let pageSize = page.size; // 页长, 默认每页10条
  334. this.$u.api.vehicleList({vehicleNo:this.vehicleNo,pageNum:pageNum,pageSize:pageSize})
  335. .then(res=>{
  336. // uni.hideLoading();
  337. // this.$refs.uToast.show({
  338. // title: res.msg,
  339. // type: 'success',
  340. // });
  341. //设置列表数据
  342. let curPageData = res.data.rows;
  343. // 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
  344. let curPageLen = curPageData.length;
  345. let totalPage = res.data.pages;
  346. if(page.num == 1) this.owelist = []; //如果是第一页需手动置空列表
  347. this.owelist = this.owelist.concat(curPageData); //追加新数据
  348. // 请求成功,隐藏加载状态
  349. //后台接口有返回列表的总页数 totalPage
  350. this.mescroll.endByPage(curPageLen, totalPage);
  351. this.leaveDetail = res.data;
  352. // for (let item of res.data.rows) {
  353. // this.owelist.push(item)
  354. // }
  355. if(this.owelist.length<=0){this.listEmpty = true};
  356. console.log('vehicleList',res)
  357. }).catch(err=>{
  358. // uni.hideLoading();
  359. this.$refs.uToast.show({
  360. title: err.msg,
  361. type: 'error',
  362. });
  363. console.log('vehicleList ',err)
  364. });
  365. },
  366. onParkIn(item){
  367. this.$u.route({
  368. url:'pages/receipts/receiptsIn',
  369. params: {
  370. orderId:item.orderId
  371. }
  372. });
  373. // this.$u.api.printIn({orderId:item.orderId})
  374. // .then(res => {
  375. // if(res.code == 200){
  376. // //#ifdef APP-PLUS
  377. // device.print(res.data);
  378. // //#endif
  379. // plus.nativeUI.toast('打印成功');
  380. // }
  381. // })
  382. // .catch(err=>{
  383. // plus.nativeUI.toast('打印失败');
  384. // });
  385. },
  386. onParkLeave(item){
  387. this.$u.route({
  388. url:'pages/receipts/receiptsOut',
  389. params: {
  390. orderId:item.orderId
  391. }
  392. });
  393. // this.$u.api.printLeave({orderId:item.orderId})
  394. // .then(res => {
  395. // if(res.code == 200){
  396. // //#ifdef APP-PLUS
  397. // device.print(res.data);
  398. // //#endif
  399. // plus.nativeUI.toast('打印成功');
  400. // }
  401. // })
  402. // .catch(err=>{
  403. // plus.nativeUI.toast('打印失败');
  404. // });
  405. }
  406. }
  407. }
  408. </script>
  409. <style lang="scss">
  410. @import './ownersinfo.scss'
  411. </style>