ownersinfo.vue 12 KB

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