index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view>
  3. <view>asdfasdf asdf</view>
  4. <u-tabbar :list="vuex_tabBarList" :before-switch="beforeSwitch" :mid-button="false"></u-tabbar>
  5. </view>
  6. </template>
  7. <script>
  8. import {
  9. mapState,
  10. mapMutations,
  11. } from 'vuex'
  12. export default {
  13. data() {
  14. return {
  15. }
  16. },
  17. computed: {
  18. ...mapState(['hasLogin','vuex_vinScanNums','vuex_scanMaxNums','vuex_tabBarList']),
  19. userInfo(){
  20. return this.$store.state.vuex_userInfo
  21. },
  22. },
  23. methods: {
  24. // 扫描vin
  25. beforeSwitch(index){
  26. console.log(index)
  27. if(index==1){
  28. this.openCamera()
  29. }else{
  30. return true
  31. }
  32. },
  33. // 去扫描
  34. openCamera(){
  35. if(this.hasLogin){
  36. if(this.userInfo.sysUserFlag == '0'){
  37. if(this.vuex_vinScanNums < this.vuex_scanMaxNums){
  38. uni.navigateTo({
  39. url: "/pages/scan-frame/scan-frame"
  40. })
  41. }else{
  42. uni.showModal({
  43. title: '提示',
  44. content: '个人用户扫描VIN仅限10次,您的次数已用完!',
  45. confirmText: '好的',
  46. showCancel: false,
  47. success(res) {}
  48. })
  49. }
  50. }else{
  51. uni.navigateTo({
  52. url: "/pages/scan-frame/scan-frame"
  53. })
  54. }
  55. }else{
  56. uni.navigateTo({
  57. url: '/pages/login/login'
  58. })
  59. }
  60. },
  61. }
  62. }
  63. </script>
  64. <style>
  65. </style>