model.js 712 B

12345678910111213141516171819202122232425262728293031
  1. import request from '../../Utils/RequestUtils';
  2. import Toast from '../../flooks/Toast';
  3. const userCoupon = (now) => ({
  4. userCouponList: [],
  5. userCouponListHis: [],
  6. // 获取未过期的优惠券
  7. init() {
  8. return request
  9. .get(`/userCoupon/my`)
  10. .then((res) => {
  11. now({ userCouponList: res });
  12. })
  13. .catch(() => {
  14. now({ userCouponList: [] });
  15. });
  16. },
  17. // 获取过期的优惠券
  18. getBadList() {
  19. return request
  20. .get(`/userCoupon/myHis`)
  21. .then((res) => {
  22. now({ userCouponListHis: res });
  23. })
  24. .catch(() => {
  25. now({ userCouponListHis: [] });
  26. });
  27. },
  28. });
  29. export default userCoupon;