scan.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="cxd-login">
  3. <car-common ref="common" ></car-common>
  4. <u-navbar title="扫码打卡" :is-back="false" >
  5. <view class="slot-wrap"></view>
  6. </u-navbar>
  7. <view class="text-center" style=" padding: 1rem 0 1.5rem;" >
  8. <image v-if="result=='2'" src="/static/img/scanok.png"
  9. style="
  10. width: 202px;
  11. height: 172px;
  12. "
  13. ></image>
  14. <u-cell-group v-if="result=='2'" :border="false" >
  15. <u-cell-item :border-bottom="false" :title-style="{fontSize:'14px'}" :value-style="{textAlign:'left',color:'#000',paddingLeft:'10px',fontSize:'14px'}" title="打卡人 : " :arrow="false" :value="obj.driverName"></u-cell-item>
  16. <u-cell-item :border-bottom="false" :title-style="{fontSize:'14px'}" :value-style="{textAlign:'left',color:'#000',paddingLeft:'10px',fontSize:'14px'}" title="车牌号 : " :arrow="false" :value="obj.licensePlateNumber" ></u-cell-item>
  17. <u-cell-item :border-bottom="false" :title-style="{fontSize:'14px'}" :value-style="{textAlign:'left',color:'#000',paddingLeft:'10px',fontSize:'11px'}" title="打卡点 : " :arrow="false" :value="obj.place" ></u-cell-item>
  18. </u-cell-group>
  19. <h1 v-if="result=='3'">打卡失败</h1>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import * as API_user from '@/apis/user'
  25. export default {
  26. data() {
  27. return {
  28. id:'',
  29. obj:{},
  30. result:"1",
  31. }
  32. },
  33. methods: {
  34. getDriverAttendance(){
  35. API_user.driverAttendance({
  36. carNum:this.id
  37. }).then(response => {
  38. if(response.result){
  39. this.obj=response.data;
  40. this.$refs.common.showLoading(false,"打卡成功");
  41. this.result="2";
  42. }else{
  43. this.result="3";
  44. this.$refs.common.showLoading(false,response.message);
  45. }
  46. }).catch(error => {
  47. this.$refs.common.showLoading(false,error);
  48. })
  49. }
  50. },
  51. onLoad(temp) {
  52. this.id=temp.carNum;
  53. },onReady(){
  54. this.$refs.common.showLoading()
  55. if(this.carhelp.getOpenId()){
  56. this.getDriverAttendance();
  57. }
  58. }
  59. }
  60. </script>
  61. <style>
  62. </style>