ownersinfo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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 "><u-input v-model="payParams.cashMoney" type="number" :border="true" :clearable="false" placeholder="请输入本次收到的金额(元)" /></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. mixins: [MescrollMixin], // 使用mixin
  124. data(){
  125. return{
  126. change:'0',
  127. // cashMoney:'',
  128. showCash:false,
  129. qrcontent:'',
  130. showQrcode:false,
  131. payParams:{
  132. orderList:[],
  133. code:'',
  134. cashMoney:'',
  135. },
  136. currentItem: [],
  137. payWayPop: false,
  138. payTipsItem: {
  139. num: '',
  140. price: ''
  141. },
  142. payTipsPop: false,
  143. vehicleNo:'',
  144. listEmpty:false,
  145. owelist:[],
  146. pagination:Object.assign({}, {pageNo: 1,pageSize: 10}),
  147. }
  148. },
  149. onLoad(page){
  150. this.vehicleNo = page.vehicleNo;
  151. console.log('this.vehicleNo',this.vehicleNo)
  152. },
  153. onShow(){
  154. // this.owelist = [];
  155. },
  156. onReachBottom() {
  157. // this.getData();
  158. },
  159. computed:{
  160. changeMoney(){
  161. if(this.payParams.cashMoney>this.payTipsItem.price){
  162. return this.payParams.cashMoney-this.payTipsItem.price
  163. }else{
  164. return 0
  165. }
  166. }
  167. },
  168. methods:{
  169. cashPay(){
  170. this.showCash = true;
  171. },
  172. closecashPayway(){
  173. this.showCash = false;
  174. },
  175. consfimPayway(){
  176. if(this.payParams.cashMoney<this.payTipsItem.price){
  177. this.$refs.uToast.show({
  178. title: '支付金额小于欠费金额,不能支付',
  179. type: 'error',
  180. });
  181. }else{
  182. this.$u.api.cashPay(this.payParams)
  183. .then(res=>{
  184. uni.showLoading({
  185. title: '查询支付状态中'
  186. });
  187. this.timer = setInterval(() => {
  188. this.handlePayQuery(res.data.polyOrderId)
  189. }, 3000);
  190. }).catch(err=>{
  191. this.$refs.uToast.show({
  192. title: err.msg,
  193. type: 'error',
  194. });
  195. });
  196. }
  197. },
  198. qrPay(){
  199. console.log('this.payParams',this.payParams);
  200. this.$u.api.gzbankPolypay(this.payParams)
  201. .then(res=>{
  202. // this.$refs.uToast.show({
  203. // title: res.msg,
  204. // type: 'success',
  205. // });
  206. this.showPayway = false;
  207. this.showQrcode = true;
  208. setTimeout(()=>{
  209. this.qrcontent = res.data.qrCodeUrl;
  210. },500)
  211. // 启动定时器查询订单状态
  212. uni.showLoading({
  213. title: '等待支付中'
  214. });
  215. this.timer = setInterval(() => {
  216. this.handlePayQuery(res.data.polyOrderId)
  217. }, 3000);
  218. console.log('gzbankPolypay',res)
  219. }).catch(err=>{
  220. this.$refs.uToast.show({
  221. title: err.msg,
  222. type: 'error',
  223. });
  224. console.log('gzbankPolypay ',err)
  225. });
  226. },
  227. hideQrcode(){
  228. this.showQrcode = false;
  229. },
  230. scanPay(){
  231. setTimeout(() =>{
  232. uni.scanCode({
  233. onlyFromCamera: true,
  234. scanType:['barCode','qrCode'],
  235. success: (res) => {
  236. console.log(res)
  237. this.payParams.code = res.result;
  238. this.$u.api.gzbankSwept(this.payParams)
  239. .then(res=>{
  240. // 启动定时器查询订单状态
  241. uni.showLoading({
  242. title: '查询支付状态中'
  243. });
  244. this.timer = setInterval(() => {
  245. this.handlePayQuery(res.data.polyOrderId)
  246. }, 3000);
  247. }).catch(err=>{
  248. //#ifdef APP-PLUS
  249. plus.nativeUI.toast(err.msg);
  250. //#endif
  251. });
  252. },
  253. fail:function(err){
  254. //#ifdef APP-PLUS
  255. plus.nativeUI.toast('扫码失败');
  256. ALog.info({msg:'条码类型:err' + err});
  257. //#endif
  258. }
  259. });
  260. },2000)
  261. },
  262. handlePayQuery(polyOrderId){
  263. this.$u.api.payQuery({polyOrderId:polyOrderId})
  264. .then(res=>{
  265. // this.$refs.uToast.show({
  266. // title: res.msg,
  267. // type: 'success',
  268. // });
  269. // 支付成功后的页面跳转
  270. if (res.data.payStatus==1) {
  271. uni.hideLoading();
  272. clearInterval(this.timer)
  273. this.$refs.uToast.show({
  274. title:'支付成功',
  275. type: 'success',
  276. url:'pages/index/index',
  277. // params: {
  278. // vehicleNo:this.orderVehicleNo,
  279. // },
  280. duration:10000
  281. });
  282. };
  283. console.log('handlePayQuery',res)
  284. }).catch(err=>{
  285. this.$refs.uToast.show({
  286. title: err.msg,
  287. type: 'error',
  288. });
  289. console.log('handlePayQuery ',err)
  290. });
  291. },
  292. // 缴费提示弹框确认
  293. payTipsPopConfirm() {
  294. this.payWayPop = true
  295. },
  296. // 全部缴费确认
  297. confirmPrice(){
  298. let orderNum = 0, price = 0
  299. this.currentItem = []
  300. this.owelist.forEach(item => {
  301. console.log(item)
  302. if ((item.orderStatus == 2||item.orderStatus == 3) && item.payStatus !== 1 ) {
  303. price += item.payAmount
  304. orderNum ++
  305. this.currentItem.push(item.orderId);
  306. this.payParams.orderList.push(item.orderId);
  307. }
  308. })
  309. this.payTipsItem.num = orderNum
  310. this.payTipsItem.price = price
  311. if (orderNum !== 0 && price !== 0) {
  312. this.payTipsPop = true
  313. } else {
  314. this.$refs.uToast.show({
  315. title: '没有需要支付的订单',
  316. type: 'warning'
  317. })
  318. }
  319. },
  320. customBack(){
  321. uni.reLaunch({
  322. url: '/pages/index/index'
  323. });
  324. },
  325. downCallback(){
  326. this.mescroll.resetUpScroll();
  327. },
  328. upCallback(page){
  329. let pageNum = page.num; // 页码, 默认从1开始
  330. let pageSize = page.size; // 页长, 默认每页10条
  331. this.$u.api.vehicleList({vehicleNo:this.vehicleNo,pageNum:pageNum,pageSize:pageSize})
  332. .then(res=>{
  333. // uni.hideLoading();
  334. // this.$refs.uToast.show({
  335. // title: res.msg,
  336. // type: 'success',
  337. // });
  338. //设置列表数据
  339. let curPageData = res.data.rows;
  340. // 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
  341. let curPageLen = curPageData.length;
  342. let totalPage = res.data.pages;
  343. if(page.num == 1) this.owelist = []; //如果是第一页需手动置空列表
  344. this.owelist = this.owelist.concat(curPageData); //追加新数据
  345. // 请求成功,隐藏加载状态
  346. //后台接口有返回列表的总页数 totalPage
  347. this.mescroll.endByPage(curPageLen, totalPage);
  348. this.leaveDetail = res.data;
  349. // for (let item of res.data.rows) {
  350. // this.owelist.push(item)
  351. // }
  352. if(this.owelist.length<=0){this.listEmpty = true};
  353. console.log('vehicleList',res)
  354. }).catch(err=>{
  355. // uni.hideLoading();
  356. this.$refs.uToast.show({
  357. title: err.msg,
  358. type: 'error',
  359. });
  360. console.log('vehicleList ',err)
  361. });
  362. },
  363. onParkIn(item){
  364. this.$u.route({
  365. url:'pages/receipts/receiptsIn',
  366. params: {
  367. orderId:item.orderId
  368. }
  369. });
  370. // this.$u.api.printIn({orderId:item.orderId})
  371. // .then(res => {
  372. // if(res.code == 200){
  373. // //#ifdef APP-PLUS
  374. // device.print(res.data);
  375. // //#endif
  376. // plus.nativeUI.toast('打印成功');
  377. // }
  378. // })
  379. // .catch(err=>{
  380. // plus.nativeUI.toast('打印失败');
  381. // });
  382. },
  383. onParkLeave(item){
  384. this.$u.route({
  385. url:'pages/receipts/receiptsOut',
  386. params: {
  387. orderId:item.orderId
  388. }
  389. });
  390. // this.$u.api.printLeave({orderId:item.orderId})
  391. // .then(res => {
  392. // if(res.code == 200){
  393. // //#ifdef APP-PLUS
  394. // device.print(res.data);
  395. // //#endif
  396. // plus.nativeUI.toast('打印成功');
  397. // }
  398. // })
  399. // .catch(err=>{
  400. // plus.nativeUI.toast('打印失败');
  401. // });
  402. }
  403. }
  404. }
  405. </script>
  406. <style lang="scss">
  407. @import './ownersinfo.scss'
  408. </style>