flashbuy.js 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. import ajax from '../../util/ajax'
  2. import api from '../../util/api'
  3. export default {
  4. namespaced: true,
  5. state: {},
  6. mutations: {
  7. },
  8. actions: {
  9. getFlashbuyTemplateList () { // 获取抢购活动模板
  10. return new Promise((resolve, reject) => {
  11. ajax(api.activityManager.getFlashbuyTemplateList.url, {
  12. method: api.activityManager.getFlashbuyTemplateList.method,
  13. }).then(res => {
  14. resolve(res)
  15. }).catch(reject)
  16. })
  17. },
  18. getFlashbuyList ({ commit }, payload) { // 获取抢购活动列表
  19. return new Promise((resolve, reject) => {
  20. ajax(api.activityManager.getFlashbuyList.url, {
  21. method: api.activityManager.getFlashbuyList.method,
  22. queryData: { ...payload }
  23. }).then(res => {
  24. resolve(res)
  25. }).catch(reject)
  26. })
  27. },
  28. addFlashbuy ({ commit }, payload) { // 新增抢购活动
  29. return new Promise((resolve, reject) => {
  30. ajax(api.activityManager.addFlashbuy.url, {
  31. method: api.activityManager.addFlashbuy.method,
  32. data: { info: JSON.stringify(payload) }
  33. }).then(res => {
  34. resolve(res)
  35. }).catch(reject)
  36. })
  37. },
  38. getFlashbuyById ({ commit }, id) { // 获取抢购信息
  39. return new Promise((resolve, reject) => {
  40. ajax(api.activityManager.getFlashbuyById.url, {
  41. method: api.activityManager.getFlashbuyById.method,
  42. urlData: {
  43. id,
  44. },
  45. }).then(res => {
  46. resolve(res)
  47. }).catch(reject)
  48. })
  49. },
  50. editFlashbuy ({ commit }, payload) { // 更新抢购活动
  51. return new Promise((resolve, reject) => {
  52. ajax(api.activityManager.editFlashbuy.url, {
  53. method: api.activityManager.editFlashbuy.method,
  54. data: { info: JSON.stringify(payload) }
  55. }).then(res => {
  56. resolve(res)
  57. }).catch(reject)
  58. })
  59. },
  60. deleteFlashbuy ({ commit }, id) { // 删除抢购活动
  61. return new Promise((resolve, reject) => {
  62. ajax(api.activityManager.deleteFlashbuy.url, {
  63. method: api.activityManager.deleteFlashbuy.method,
  64. urlData: {
  65. id,
  66. },
  67. }).then(res => {
  68. resolve(res)
  69. }).catch(reject)
  70. })
  71. },
  72. getFlashbuyRecordsById ({ commit }, payload) { // 获取抢购活动记录列表
  73. return new Promise((resolve, reject) => {
  74. ajax(api.activityManager.getFlashbuyRecordsById.url, {
  75. method: api.activityManager.getFlashbuyRecordsById.method,
  76. urlData: {
  77. id: payload.id
  78. },
  79. queryData: { ...payload.info }
  80. }).then(res => {
  81. resolve(res)
  82. }).catch(reject)
  83. })
  84. },
  85. updateFlashbuyStatus ({ commit }, payload) { // 更新抢购活动状态
  86. return new Promise((resolve, reject) => {
  87. ajax(api.activityManager.updateFlashbuyStatus.url, {
  88. method: api.activityManager.updateFlashbuyStatus.method,
  89. urlData: {...payload},
  90. }).then(res => {
  91. resolve(res)
  92. }).catch(reject)
  93. })
  94. },
  95. getCardListByCaseId ({ commit }, id) { // 获取案场下卡列表
  96. return new Promise((resolve, reject) => {
  97. ajax(api.activityManager.getCardListByCaseId.url, {
  98. method: api.activityManager.getCardListByCaseId.method,
  99. urlData: {
  100. id,
  101. },
  102. }).then(res => {
  103. resolve(res)
  104. }).catch(reject)
  105. })
  106. },
  107. getCouponListByCaseId ({ commit }, id) { // 获取案场下券列表
  108. return new Promise((resolve, reject) => {
  109. ajax(api.activityManager.getCouponListByCaseId.url, {
  110. method: api.activityManager.getCouponListByCaseId.method,
  111. urlData: {
  112. id,
  113. },
  114. }).then(res => {
  115. resolve(res)
  116. }).catch(reject)
  117. })
  118. },
  119. }
  120. }