api.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import { request } from '/@/utils/service';
  2. const apiPrefix = '/api/choice/competitor_monitor/';
  3. export function getTableData(query: any) {
  4. return request({
  5. url: apiPrefix,
  6. method: 'GET',
  7. params: query
  8. });
  9. }
  10. export function createProductMonitor(body: any) {
  11. return request({
  12. url: '/api/choice/reviews_monitor/',
  13. method: 'POST',
  14. data: body
  15. });
  16. }
  17. export function getGroupOptions(query: any) {
  18. return request({
  19. url: '/api/choice/goods/tags/',
  20. method: 'GET',
  21. params: query
  22. });
  23. }
  24. export function getBrandsOptions(query: any) {
  25. return request({
  26. url: '/api/choice/goods/brands/',
  27. method: 'GET',
  28. params: query
  29. });
  30. }
  31. export function getShopsOptions(query: any) {
  32. return request({
  33. url: '/api/choice/marketplace_shops/select/',
  34. method: 'GET',
  35. params: query
  36. });
  37. }
  38. export function updateRow(body: any) {
  39. return request({
  40. url: apiPrefix + `${body.id}/` ,
  41. method: 'PUT',
  42. params: { partial: 1 },
  43. data: body
  44. });
  45. }
  46. export function deleteRow(body: any) {
  47. return request({
  48. url: apiPrefix + `${body.id}/` ,
  49. method: 'DELETE',
  50. data: body
  51. });
  52. }
  53. export function batchDeleteRow(body: any) {
  54. return request({
  55. url: apiPrefix + 'multiple_delete/',
  56. method: 'DELETE',
  57. data: body
  58. });
  59. }
  60. // 导入
  61. export function upload(body: any){
  62. return request({
  63. url: '/api/choice/reviews_monitor/import_data/',
  64. method: 'POST',
  65. data: body,
  66. });
  67. }
  68. // 导出
  69. export function exportData(query: any) {
  70. return request({
  71. url: '/api/choice/reviews_monitor/export_data/',
  72. method: 'GET',
  73. params: query,
  74. responseType: 'blob'
  75. });
  76. }