// 二维码状态
const consumeStatus = [{
  value: 'NORMAL',
  label: '正常'
}, {
  value: 'USED',
  label: '已核销'
}, {
  value: 'AUDITING',
  label: '审核中'
}, {
  value: 'CANCEL',
  label: '已退款'
}, {
  value: 'INVALID',
  label: '已失效'
}];
Component({
  props: {
    touristList: [] // 游玩人

  },
  data: {
    current: 0,
    consumeStatus
  },

  didUpdate(prevProps) {
    if (prevProps.touristList.length !== this.props.touristList.length) {
      this.setData({
        current: 0
      });
    }
  },

  methods: {
    onAnimationEnd({
      detail: {
        current
      }
    }) {
      this.setData({
        current
      });
    },

    nextCurrent() {
      if (this.data.current === this.props.touristList.length - 1) {
        this.setData({
          current: 0
        });
        return;
      }

      this.setData({
        current: this.data.current + 1
      });
    },

    prevCurrent() {
      if (this.data.current === 0) {
        this.setData({
          current: this.props.touristList.length - 1
        });
        return;
      }

      this.setData({
        current: this.data.current - 1
      });
    }

  }
});