import { mapState } from 'vuex';
import uniNumberBox from '@/components/uni-number-box/uni-number-box.vue';
import uni from '@/utils/uniHooks';
// const app = getApp()
export default {
  components: { uniNumberBox },
  created() {
    // 超限提示
    this.crossMessage();
  },
  // beforeRouteLeave(to, from, next) {
  //   console.log(251251251251251251, to, from,);
  //   // 设置下一个路由的 meta
  //   to.meta.keepAlive = true; // 让 A 不缓存，即刷新
  //   next();
  // },
  data() {
    return {
      checkedList: [], // 已选优惠列表
      memberLevelReduce:[],
      memberGrade: {},
      consume: {},
      todayReduceDiscountMessage: '',
      isMemberDiscountDisabled: false,
    };
  },
  computed: {
    ...mapState({
      orderDetail: state => state.order.orderDetail,
      custTypeId: (state) => state.custTypeId,
      groupId: (state) => state.groupId,
      enableConsume: state => state.order.enableConsume,
      actualPayFee: state => state.order.actualPayFee,
      usingTotalDiscount: state => state.order.usingTotalDiscount,
      memberLevelDiscount: state => state.order.memberLevelDiscount,
    }),
  },
  mounted() {
    this.pageInit();
  },
  methods: {
    pageInit() {
      this.checkedList = []
      const {memberGrade, consume, memberLevelDiscount} = this.orderDetail.discountInfo;
      if (!memberLevelDiscount) {

      }
      this.memberGrade = {...memberGrade[0]}
      this.consume = {...consume[0]}
      if (memberGrade.length && memberGrade[0].defaultSelected) {
        this.checkedList.push('member')
      }
      if (memberGrade.length && consume[0].defaultSelected) {

        this.checkedList.push('reduces')
      }
      console.log(44444, this.checkedList);
    },
    setIsMemberDiscountDisabled() {
      this.todayReduceDiscountMessage = '当日'
    },
    actualFee() {},
    discountFee() {},
    confirm() {},
    crossMessage() {},
    checkboxChange() {},
    parkInfoEntity() {},
    isShowReduceDiscount() {},
    // todayReduceDiscountMessage() {},
    // 验证当前的选项是否可选择
    isCheck(type) {

    },

  },

};
