index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. import {
  2. get,
  3. put,
  4. putJ,
  5. postJ,
  6. deleteApi
  7. } from "@/utils/request";
  8. import Vue from "vue";
  9. /**
  10. * 获取信息列表
  11. */
  12. export async function getTableList(params) {
  13. const res = await get(Vue.prototype.apiUrl + `/eom/businessopportunity/page`, {
  14. params
  15. });
  16. if (res.code == 0) {
  17. return res.data;
  18. }
  19. return Promise.reject(new Error(res.message));
  20. }
  21. /**
  22. * 获取信息详情
  23. */
  24. export async function getDetail(id) {
  25. const res = await get(Vue.prototype.apiUrl + `/eom/businessopportunity/getById/${id}`, {});
  26. if (res.code == 0) {
  27. return res.data;
  28. }
  29. return Promise.reject(new Error(res.message));
  30. }
  31. /**
  32. * 更新客户信息
  33. */
  34. export async function businessopportunitySave(data) {
  35. let api = data.opportunity.id ? putJ : postJ
  36. const res = await api(Vue.prototype.apiUrl + `/eom/businessopportunity/` + (data.opportunity.id ? 'update' :
  37. 'save'), data);
  38. if (res.code == 0) {
  39. return res.data;
  40. }
  41. return Promise.reject(new Error(res.message));
  42. }
  43. /**
  44. * 删除事项
  45. */
  46. export async function deleteInformation(data) {
  47. const res = await deleteApi(Vue.prototype.apiUrl + '/eom/businessopportunity/delete', data);
  48. if (res.code == 0) {
  49. return res.data;
  50. }
  51. return Promise.reject(new Error(res.message));
  52. }
  53. /**
  54. * 获取跟进记录列表
  55. */
  56. export async function getfollowList(params) {
  57. const res = await get(Vue.prototype.apiUrl + `/eom/businessopportunityfollowup/page`,params);
  58. if (res.code == 0) {
  59. return res.data;
  60. }
  61. return Promise.reject(new Error(res.message));
  62. }
  63. /**
  64. * 更新信息
  65. */
  66. export async function savefollowList(data) {
  67. let api = data.id ? putJ : postJ
  68. const res = await api(Vue.prototype.apiUrl + `/eom/businessopportunityfollowup/` + (data.id ? 'update' :
  69. 'save'), data);
  70. if (res.code == 0) {
  71. return res.data;
  72. }
  73. return Promise.reject(new Error(res.message));
  74. }
  75. /**
  76. * 删除事项
  77. */
  78. export async function deletefollowList(data) {
  79. const res = await deleteApi(Vue.prototype.apiUrl +'/eom/businessopportunityfollowup/delete', data);
  80. if (res.code == 0) {
  81. return res.data;
  82. }
  83. return Promise.reject(new Error(res.message));
  84. }
  85. /**
  86. * 商机是否生成过报价单
  87. */
  88. export async function isHasGeneratedQuoteAPI(id) {
  89. const res = await request.get(`/eom/businessopportunity/hasGeneratedQuote/${id}`);
  90. if (res.data.code == 0) {
  91. return res.data.data;
  92. }
  93. return Promise.resolve(0);
  94. }
  95. /**
  96. * 商机是否生成过合同
  97. */
  98. export async function isHasGeneratedContractAPI(id) {
  99. const res = await request.get(`/eom/businessopportunity/hasGeneratedContract/${id}`);
  100. if (res.data.code == 0) {
  101. return res.data.data;
  102. }
  103. return Promise.resolve(0);
  104. }
  105. /**
  106. * 更新状态
  107. */
  108. export async function updateStatus(id, status) {
  109. const res = await request.get(`/eom/businessopportunity/updateStatus?id=` + id + '&status=' + status);
  110. if (res.data.code == 0) {
  111. return res.data;
  112. }
  113. return Promise.reject(new Error(res.data.message));
  114. }
  115. /**
  116. * 提交
  117. */
  118. export async function submit(data) {
  119. const res = await request.post(`/bpm/businessOpportunityApprove/submit`, data);
  120. if (res.data.code == 0) {
  121. return res.data.data;
  122. }
  123. return Promise.reject(new Error(res.data.message));
  124. }