coupons.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import fly from "./main";
  2. import store from "@/store/index"
  3. //优惠券领取列表
  4. export function getCouponReceiveList($limit = 0) {
  5. let $params = {}
  6. $params['limit'] = $limit
  7. $params['status'] = 1
  8. $params['access_token'] = wx.getStorageSync('token')
  9. return fly.post('coupon/coupon-receive-list', $params)
  10. }
  11. //已优惠券列表
  12. export function getCouponList($limit = 0) {
  13. let $params = {}
  14. $params['limit'] = $limit
  15. $params['access_token'] = wx.getStorageSync('token')
  16. return fly.post('coupon/coupon-list', $params)
  17. }
  18. //已过期优惠券列表
  19. export function getOverdueCouponList($limit = 0) {
  20. let $params = {}
  21. $params['limit'] = $limit
  22. $params['access_token'] = wx.getStorageSync('token')
  23. return fly.post('coupon/coupon-expire-list', $params)
  24. }
  25. //待领取优惠券
  26. export function couponReceive($item) {
  27. let $params = {}
  28. $params['coupon_category_id'] = $item.coupon_category_id
  29. $params['start_time'] = $item.validity_time.start_time
  30. $params['end_time'] = $item.validity_time.end_time
  31. $params['access_token'] = wx.getStorageSync('token')
  32. return fly.post('coupon/coupon-receive', $params)
  33. }
  34. //获取首次登录领取优惠券ID
  35. export function couponReceiveFirstID() {
  36. let $params = {
  37. "access_token": wx.getStorageSync('token'),
  38. }
  39. return fly.post('coupon/member-coupon', $params)
  40. }
  41. //首次登录领取优惠券
  42. export function couponReceiveFirst($item) {
  43. let $params = {
  44. "access_token": wx.getStorageSync('token'),
  45. "coupon_category_id": $item.ID,
  46. "start_time": $item.start_time,
  47. "end_time": $item.end_time,
  48. }
  49. return fly.post('coupon/coupon-receive', $params)
  50. }
  51. //支付时优惠券
  52. export function payCoupon($item) {
  53. let $params = {
  54. "access_token": wx.getStorageSync('token'),
  55. "price": $item.priceParam,
  56. "goods_id": $item.goods_id,
  57. }
  58. return fly.get('coupon/choose-coupon', $params)
  59. }
  60. // 外发卡券信息(无参数)
  61. export function outputCoupon() {
  62. let $params = {
  63. "access_token": wx.getStorageSync('token'),
  64. }
  65. return fly.post('coupon/out-list', $params)
  66. }
  67. // 外发卡券信息(有other参数)
  68. export function outCardCoupon() {
  69. let $params = {
  70. "access_token": wx.getStorageSync('token'),
  71. }
  72. return fly.post('coupon/out-card', $params)
  73. }