cards.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. import request from "@/utils/request";
  2. // 查询学习卡列表
  3. export function listCards(query) {
  4. return request({
  5. url: "/dz/cards/list",
  6. method: "get",
  7. params: query,
  8. });
  9. }
  10. // 查询学习卡详细
  11. export function getCards(cardId) {
  12. return request({
  13. url: "/dz/cards/" + cardId,
  14. method: "get",
  15. });
  16. }
  17. // 新增学习卡
  18. export function addCards(data) {
  19. return request({
  20. url: "/dz/cards",
  21. method: "post",
  22. data: data,
  23. });
  24. }
  25. // 修改学习卡
  26. export function updateCards(data) {
  27. return request({
  28. url: "/dz/cards",
  29. method: "put",
  30. data: data,
  31. });
  32. }
  33. // 删除学习卡
  34. export function delCards(cardIds) {
  35. // 如果是数组,转换为逗号分隔的字符串
  36. const ids = Array.isArray(cardIds) ? cardIds.join(",") : cardIds;
  37. return request({
  38. url: "/dz/cards/" + ids,
  39. method: "delete",
  40. });
  41. }
  42. // 制卡
  43. export function issueCard(institutionId, type, count) {
  44. return request({
  45. url: "/dz/cards/issueCard",
  46. method: "post",
  47. params: {
  48. institutionId,
  49. type,
  50. count,
  51. },
  52. });
  53. }
  54. // 分配卡
  55. export function assignCard(params) {
  56. // 支持两种方式:
  57. // 1. 通过cardIds(选中的卡片ID列表)
  58. // 2. 通过begin和end(卡号段)
  59. return request({
  60. url: "/dz/cards/assignCard",
  61. method: "post",
  62. params: params,
  63. });
  64. }
  65. // 获取考生类型列表
  66. export function getExamTypes(location) {
  67. return request({
  68. url: "/front/user/examTypes",
  69. method: "get",
  70. params: {
  71. location,
  72. },
  73. });
  74. }
  75. // 获取代理商列表
  76. export function getAgentList(query) {
  77. return request({
  78. url: "/dz/agent/list",
  79. method: "get",
  80. params: query,
  81. });
  82. }
  83. // 缴费
  84. export function payCard(cardIds) {
  85. return request({
  86. url: "/dz/cards/change/pay",
  87. method: "post",
  88. params: {
  89. action: "Pay",
  90. cardIds: Array.isArray(cardIds) ? cardIds.join(",") : cardIds,
  91. },
  92. });
  93. }
  94. // 关卡
  95. export function closeCard(cardIds) {
  96. return request({
  97. url: "/dz/cards/change/close",
  98. method: "post",
  99. params: {
  100. action: "Close",
  101. cardIds: Array.isArray(cardIds) ? cardIds.join(",") : cardIds,
  102. },
  103. });
  104. }
  105. // 重开
  106. export function reopenCard(cardIds) {
  107. return request({
  108. url: "/dz/cards/change/reopen",
  109. method: "post",
  110. params: {
  111. action: "ReOpen",
  112. cardIds: Array.isArray(cardIds) ? cardIds.join(",") : cardIds,
  113. },
  114. });
  115. }
  116. // 退费
  117. export function refundCard(cardIds) {
  118. return request({
  119. url: "/dz/cards/change/refund",
  120. method: "post",
  121. params: {
  122. action: "Refund",
  123. cardIds: Array.isArray(cardIds) ? cardIds.join(",") : cardIds,
  124. },
  125. });
  126. }
  127. // 结算
  128. export function settleCard(cardIds) {
  129. return request({
  130. url: "/dz/cards/change/settlement",
  131. method: "post",
  132. params: {
  133. action: "Settlement",
  134. cardIds: Array.isArray(cardIds) ? cardIds.join(",") : cardIds,
  135. },
  136. });
  137. }
  138. // 续费
  139. export function renewCard(cardIds, days) {
  140. const params = {
  141. action: "Renew",
  142. cardIds: Array.isArray(cardIds) ? cardIds.join(",") : cardIds,
  143. };
  144. if (days != null) {
  145. params.days = days;
  146. }
  147. return request({
  148. url: "/dz/cards/change/renew",
  149. method: "post",
  150. params: params,
  151. });
  152. }
  153. // 获取学校列表
  154. export function getSchoolList(query) {
  155. return request({
  156. url: "/dz/school/getSchoolList",
  157. method: "get",
  158. params: query,
  159. });
  160. }
  161. // 获取校区列表
  162. export function getCampusSchoolList(query) {
  163. return request({
  164. url: "/dz/school/getCampusSchoolList",
  165. method: "get",
  166. params: query,
  167. });
  168. }
  169. // 关联校区
  170. export function associateCampus(params) {
  171. // 支持两种方式:
  172. // 1. 通过cardIds(选中的卡片ID列表)
  173. // 2. 通过begin和end(卡号段)
  174. return request({
  175. url: "/dz/cards/changeCampus",
  176. method: "post",
  177. params: params,
  178. });
  179. }
  180. // 申请开卡
  181. export function requestOpenCard(
  182. agentId,
  183. province,
  184. schoolId,
  185. beginCardNo,
  186. endCardNo
  187. ) {
  188. return request({
  189. url: "/dz/cards/openCard",
  190. method: "post",
  191. params: {
  192. agentId: agentId,
  193. locationId: province,
  194. schoolId,
  195. begin: beginCardNo,
  196. end: endCardNo,
  197. },
  198. });
  199. }
  200. // 统计学习卡数据
  201. export function getCardStatistics(query) {
  202. return request({
  203. url: "/dz/cards/statistics",
  204. method: "get",
  205. params: query,
  206. });
  207. }
  208. // 统计详情 - 查询学习卡列表
  209. export function getStatisticsDetail(query) {
  210. return request({
  211. url: "/dz/cards/statisticsDetail",
  212. method: "get",
  213. params: query,
  214. });
  215. }
  216. // 根据卡号获取用户信息
  217. export function getUserByCardId(cardId) {
  218. return request({
  219. url: "/dz/cards/cardUser/" + cardId,
  220. method: "get",
  221. params: {},
  222. });
  223. }
  224. // 更新卡用户信息
  225. export function updateCardUser(data) {
  226. return request({
  227. url: "/dz/cards/updateCardUser",
  228. method: "post",
  229. data: data,
  230. });
  231. }