verification.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import ajax from '../../util/ajax'
  2. import api from '../../util/api'
  3. export default {
  4. namespaced: true,
  5. state: {
  6. courseVerifs: [],
  7. },
  8. mutations: {
  9. updateCourseList (state, payload) {
  10. state.courseVerifs = payload || []
  11. },
  12. },
  13. actions: {
  14. GetCourseVerList ({ commit }, {id, payload}) {
  15. return new Promise((resolve, reject) => {
  16. ajax(api.verification.coursebycode.url, {
  17. method: api.verification.coursebycode.method,
  18. urlData: {
  19. id,
  20. },
  21. queryData: {
  22. ...payload
  23. }
  24. }).then(res => {
  25. commit('updateCourseList', res)
  26. resolve(res)
  27. }).catch(reject)
  28. })
  29. },
  30. GetCourseVerListByTel ({ commit }, payload) {
  31. return new Promise((resolve, reject) => {
  32. ajax(api.verification.coursebytel.url, {
  33. method: api.verification.coursebytel.method,
  34. urlData: {
  35. tel: payload.tel
  36. },
  37. queryData: {
  38. ...payload
  39. }
  40. }).then(res => {
  41. commit('updateCourseList', res)
  42. resolve(res)
  43. }).catch(reject)
  44. })
  45. },
  46. CourseVerifs ({ commit }, payload) {
  47. ajax(api.verification.courseverify.url, {
  48. method: api.verification.courseverify.method,
  49. urlData: {
  50. id: payload.id
  51. }
  52. }).then(res => {
  53. if (payload.callback) {
  54. payload.callback()
  55. }
  56. })
  57. },
  58. drawVerify ({ commit }, { id }) {
  59. return new Promise((resolve, reject) => {
  60. ajax(api.verification.drawVerify.url, {
  61. method: api.verification.drawVerify.method,
  62. urlData: {
  63. id,
  64. }
  65. }).then(res => {
  66. resolve(res)
  67. }).catch(reject)
  68. })
  69. },
  70. drawVerifyList ({ commit }, { id }) {
  71. return new Promise((resolve, reject) => {
  72. ajax(api.verification.drawVerifyList.url, {
  73. method: api.verification.drawVerifyList.method,
  74. urlData: {
  75. id,
  76. }
  77. }).then(res => {
  78. resolve(res)
  79. }).catch(reject)
  80. })
  81. },
  82. getCustomerName ({ commit }, { id }) {
  83. return new Promise((resolve, reject) => {
  84. ajax(api.verification.getCustomerName.url, {
  85. method: api.verification.getCustomerName.method,
  86. urlData: {
  87. id,
  88. }
  89. }).then(res => {
  90. resolve(res)
  91. }).catch(reject)
  92. })
  93. },
  94. },
  95. }