import {
  getCouponList
} from '~/services/coupon/getCouponList';

Page({
  data: {
    couponList: [],
  },

  onLoad() {
    this.init();
  },

  init() {
    this.fetchList();
  },

  fetchList() {
    // 优惠券接口
    getCouponList().then((couponList) => {
      this.setData({
        couponList
      });
    });
  },

  onPullDownRefresh_() {
    this.setData({
        couponList: [],
      },
      () => {
        this.fetchList();
      },
    );
  },
});