coupon.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import request from '@/sheep/request';
  2. const CouponApi = {
  3. // 获得优惠劵模板列表
  4. getCouponTemplateListByIds: (ids) => {
  5. return request({
  6. url: '/promotion/coupon-template/list-by-ids',
  7. method: 'GET',
  8. params: { ids },
  9. custom: {
  10. showLoading: false, // 不展示 Loading,避免领取优惠劵时,不成功提示
  11. showError: false,
  12. },
  13. });
  14. },
  15. // 获得优惠劵模版列表
  16. getCouponTemplateList: (spuId, productScope, count) => {
  17. return request({
  18. url: '/promotion/coupon-template/list',
  19. method: 'GET',
  20. params: { spuId, productScope, count },
  21. });
  22. },
  23. // 获得优惠劵模版分页
  24. getCouponTemplatePage: (params) => {
  25. return request({
  26. url: '/promotion/coupon-template/page',
  27. method: 'GET',
  28. params,
  29. });
  30. },
  31. // 获得优惠劵模版
  32. getCouponTemplate: (id) => {
  33. return request({
  34. url: '/promotion/coupon-template/get',
  35. method: 'GET',
  36. params: { id },
  37. });
  38. },
  39. // 我的优惠劵列表
  40. getCouponPage: (params) => {
  41. return request({
  42. url: '/promotion/coupon/page',
  43. method: 'GET',
  44. params,
  45. });
  46. },
  47. // 领取优惠券
  48. takeCoupon: (templateId) => {
  49. return request({
  50. url: '/promotion/coupon/take',
  51. method: 'POST',
  52. data: { templateId },
  53. custom: {
  54. auth: true,
  55. showLoading: true,
  56. loadingMsg: '领取中',
  57. showSuccess: true,
  58. successMsg: '领取成功',
  59. },
  60. });
  61. },
  62. // 获得客服会话
  63. getKefuConversationByRelID: (params) => {
  64. return request({
  65. url: '/promotion/kefu-conversation/getByRelID',
  66. method: 'GET',
  67. params,
  68. });
  69. },
  70. // 获得优惠劵
  71. getCoupon: (id) => {
  72. return request({
  73. url: '/promotion/coupon/get',
  74. method: 'GET',
  75. params: { id },
  76. });
  77. },
  78. // 获得未使用的优惠劵数量
  79. getUnusedCouponCount: () => {
  80. return request({
  81. url: '/promotion/coupon/get-unused-count',
  82. method: 'GET',
  83. custom: {
  84. showLoading: false,
  85. auth: true,
  86. },
  87. });
  88. },
  89. };
  90. export default CouponApi;