ownersQuery.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view>
  3. <!-- <view class="taking-pictures" @click="getPic">点击拍照</view> -->
  4. <view class="wrap">
  5. <view class="new-plate-number">
  6. <view class="message-input-wrap" @click="messageInputClick">
  7. <u-message-input :maxlength="8" width="70" font-size="50" :disabled-keyboard="true" v-model="newPlateNumber"></u-message-input>
  8. </view>
  9. <u-keyboard ref="uKeyboard" mode="car" @change="keyboardChange" @backspace="backspace" v-model="keyboardshow"></u-keyboard>
  10. </view>
  11. <view class="f-padding">
  12. <u-button class="btn" type="primary" @click="submit">确认</u-button>
  13. <view class="tip">
  14. 通过输入车牌号查询车主的停车记录
  15. </view>
  16. </view>
  17. </view>
  18. <u-toast ref="uToast" />
  19. </view>
  20. </template>
  21. <script>
  22. //#ifdef APP-PLUS
  23. let ocr = uni.requireNativePlugin("OcrPlug");
  24. //#endif
  25. export default{
  26. data(){
  27. return{
  28. keyboardshow:false,
  29. newPlateNumber:'贵A12345',
  30. spaceId:'',
  31. vehicleClor:''
  32. }
  33. },
  34. onLoad(page){
  35. this.spaceId = page.spaceId;
  36. },
  37. methods:{
  38. getPic(){
  39. let that = this;
  40. ocr.ocrVehicleNo((ret) => {
  41. if (ret.success){
  42. that.confirmData.vehicleNo = ret.vehicleNo;
  43. //that.vehicleImage = 'data:image/png;base64,' + ret.imageBase64;
  44. // speak('成功识别车牌' + ret.vehicleNo);
  45. }else {
  46. plus.nativeUI.toast('识别失败');
  47. }
  48. });
  49. },
  50. messageInputClick(){
  51. this.keyboardshow = true;
  52. },
  53. // 按键被点击(点击退格键不会触发此事件)
  54. keyboardChange(val) {
  55. // 将每次按键的值拼接到value变量中,注意+=写法
  56. this.newPlateNumber += val;
  57. console.log(this.newPlateNumber);
  58. },
  59. // 退格键被点击
  60. backspace() {
  61. // 删除value的最后一个字符
  62. if(this.newPlateNumber.length) this.newPlateNumber = this.newPlateNumber.substr(0, this.newPlateNumber.length - 1);
  63. console.log(this.newPlateNumber);
  64. },
  65. submit(){
  66. this.$u.route({
  67. url: 'pages/ownersQuery/queryList/queryList',
  68. params: {
  69. vehicleNo: this.newPlateNumber
  70. }
  71. });
  72. return
  73. let param ={
  74. spaceId:this.spaceId,
  75. vehicleNo:this.newPlateNumber,
  76. };
  77. this.$u.api.entrance(param)
  78. .then(res=>{
  79. this.$refs.uToast.show({
  80. title: res.msg,
  81. type: 'success',
  82. url:'pages/getout/getout'
  83. });
  84. console.log('entrance',res)
  85. }).catch(err=>{
  86. this.$refs.uToast.show({
  87. title: err.msg,
  88. type: 'error',
  89. url:'pages/parking/parking'
  90. });
  91. console.log('entrance ',err)
  92. });
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. @import "./ownersQuery.scss";
  99. </style>