import { mapState } from "vuex";

export default {
  data() {
    return {
      componentName: '',
      theme: 'theme-mall',
    };
  },
  computed: {
    ...mapState({
      custTypeId: (state) => state.custTypeId,
      source: (state) => state.source,
    }),
  },
  watch:{
    source() {
      this.themeInit()
    }
  },
  mounted() {
    this.themeInit()
  },
  methods:{
    themeInit() {
      const com = ['purpleCom', 'blueCom', 'greenCom', 'officeBlueCom', 'purpleCom'];
      if ( this.custTypeId < 3 || !this.custTypeId) {
        this.componentName = 'baseParkingFeeCom';
        this.theme = 'theme-mall'
      } else {
        this.componentName = com[this.custTypeId];
        this.theme = 'theme-office'
      }
      if ( this.source === 'KIP' ) {
        this.theme = 'theme-office'
      }
      if ( this.source === 'PUDONG' ) {
        this.theme = 'theme-pudong'
      }
      if ( this.source === 'JINGAN' ) {
        this.theme = 'theme-jingan'
      }
      // TODO: 根据lbsId动态切换
      // this.theme = 'theme-pudong'
      // this.theme = 'theme-jingan'
    }
  }
}
