customer.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. import request from '@/utils/request'
  2. /**
  3. * 新建编辑
  4. * @param {*} data
  5. */
  6. export function crmCustomerSaveAPI(data) {
  7. const url = data.id && data.name ? 'update' : 'save'
  8. return request({
  9. url: 'crm/customer/' + url,
  10. method: 'post',
  11. data: data,
  12. headers: {
  13. 'Content-Type': 'application/json;charset=UTF-8'
  14. }
  15. })
  16. }
  17. /**
  18. * 列表
  19. * @param {*} data
  20. */
  21. export function crmCustomerIndexAPI(data) {
  22. return request({
  23. url: 'crm/customer/index',
  24. method: 'post',
  25. data: data
  26. })
  27. }
  28. /**
  29. * 删除
  30. * @param {*} data
  31. */
  32. export function crmCustomerDeleteAPI(data) {
  33. return request({
  34. url: 'crm/customer/delete',
  35. method: 'post',
  36. data: data,
  37. headers: {
  38. 'Content-Type': 'application/json;charset=UTF-8'
  39. }
  40. })
  41. }
  42. /**
  43. * 公海列表
  44. * @param {*} data
  45. */
  46. export function crmCustomerPoolListAPI(data) {
  47. return request({
  48. url: 'crm/customerPool/index',
  49. method: 'post',
  50. data: data
  51. })
  52. }
  53. /**
  54. * 删除
  55. * @param {*} data
  56. */
  57. export function crmCustomerPoolDeleteAPI(data) {
  58. return request({
  59. url: 'crm/customerPool/delete',
  60. method: 'post',
  61. data: data,
  62. headers: {
  63. 'Content-Type': 'application/json;charset=UTF-8'
  64. }
  65. })
  66. }
  67. /**
  68. * 设置公海
  69. * @param {*} data
  70. */
  71. export function crmCustomerPoolSetAPI(data) {
  72. return request({
  73. url: 'admin/setting/setPool',
  74. method: 'post',
  75. data: data,
  76. headers: {
  77. 'Content-Type': 'application/json;charset=UTF-8'
  78. }
  79. })
  80. }
  81. /**
  82. * 公海设置列表
  83. * @param {*} data
  84. */
  85. export function crmCustomerPoolSetListAPI(data) {
  86. return request({
  87. url: 'admin/setting/pool',
  88. method: 'post',
  89. data: data,
  90. headers: {
  91. 'Content-Type': 'application/json;charset=UTF-8'
  92. }
  93. })
  94. }
  95. /**
  96. * 公海设置删除
  97. */
  98. export function crmCustomerPoolSetDeleteAPI(data) {
  99. return request({
  100. url: 'admin/setting/deletePool',
  101. method: 'post',
  102. data: data
  103. })
  104. }
  105. /**
  106. * 公海设置详情
  107. * @param {*} data
  108. */
  109. export function crmCustomerPoolSetDetailAPI(data) {
  110. return request({
  111. url: 'admin/setting/readPool',
  112. method: 'post',
  113. data: data
  114. })
  115. }
  116. /**
  117. * 公海启停
  118. * @param {*} data
  119. */
  120. export function crmCustomerPoolSetChangeStatusAPI(data) {
  121. return request({
  122. url: 'admin/setting/changePool',
  123. method: 'post',
  124. data: data
  125. })
  126. }
  127. /**
  128. * 公海客户转移
  129. * prePoolId 转出公海id
  130. * postPoolId 转入公海id
  131. * @param {*} data
  132. */
  133. export function crmCustomerPoolSetTransferAPI(data) {
  134. return request({
  135. url: 'admin/setting/transferPool',
  136. method: 'post',
  137. data: data
  138. })
  139. }
  140. /**
  141. * 转移数据源
  142. * @param {*} data
  143. */
  144. export function crmCustomerPoolSetNameListAPI(data) {
  145. return request({
  146. url: 'admin/setting/pool',
  147. method: 'post',
  148. data: data
  149. })
  150. }
  151. /**
  152. * 客户管理用到的公海列表
  153. * @param {*} data
  154. */
  155. export function crmCustomerPoolNameListAPI(data) {
  156. return request({
  157. url: 'crm/customerPool/pondList',
  158. method: 'post',
  159. data: data
  160. })
  161. }
  162. /**
  163. * 获取客户级别选项接口
  164. * @param {*} data
  165. */
  166. export function crmCustomerPoolQueryLevelAPI(data) {
  167. return request({
  168. url: 'admin/setting/customerLevel',
  169. method: 'post',
  170. data: data
  171. })
  172. }
  173. /**
  174. * 详情
  175. */
  176. export function crmCustomerReadAPI(data) {
  177. return request({
  178. url: `crm/${data.pool_id ? 'customerPool' : 'customer'}/read`,
  179. method: 'post',
  180. data: data
  181. })
  182. }
  183. // 操作
  184. /**
  185. * 客户锁定,解锁
  186. * @param {*} data
  187. */
  188. export function crmCustomerLockAPI(data) {
  189. return request({
  190. url: 'crm/customer/lock',
  191. method: 'post',
  192. data: data
  193. })
  194. }
  195. /**
  196. * 客户放入公海
  197. * @param {*} data
  198. * customer_id 客户数组
  199. */
  200. export function crmCustomerPutInPoolAPI(data) {
  201. return request({
  202. url: 'crm/customer/putInPool',
  203. method: 'post',
  204. data: data,
  205. headers: {
  206. 'Content-Type': 'application/json;charset=UTF-8'
  207. }
  208. })
  209. }
  210. /**
  211. * 客户转移
  212. * @param {*} data
  213. */
  214. export function crmCustomerTransferAPI(data) {
  215. return request({
  216. url: 'crm/customer/transfer',
  217. method: 'post',
  218. data: data,
  219. headers: {
  220. 'Content-Type': 'application/json;charset=UTF-8'
  221. }
  222. })
  223. }
  224. /**
  225. * 客户导出
  226. * @param {*} data
  227. * customer_id 客户ID
  228. */
  229. export function crmCustomerExcelExportAPI(data) {
  230. return request({
  231. url: 'crm/customer/excelExport',
  232. method: 'post',
  233. data: data,
  234. headers: {
  235. 'Content-Type': 'application/json;charset=UTF-8'
  236. },
  237. responseType: 'blob'
  238. })
  239. }
  240. /**
  241. * 全部导出
  242. * @param {*} data
  243. */
  244. export function crmCustomerExcelAllExportAPI(data) {
  245. return request({
  246. url: 'crm/customer/excelExport',
  247. method: 'post',
  248. data: data,
  249. responseType: 'blob',
  250. headers: {
  251. 'Content-Type': 'application/json;charset=UTF-8'
  252. }
  253. })
  254. }
  255. /**
  256. * 客户导入
  257. * @param {*} data
  258. * customer_id 客户ID
  259. */
  260. export function crmCustomerExcelImportAPI(data) {
  261. var param = new FormData()
  262. Object.keys(data).forEach(key => {
  263. param.append(key, data[key])
  264. })
  265. return request({
  266. url: 'crm/customer/excelImport',
  267. method: 'post',
  268. data: param,
  269. headers: {
  270. 'Content-Type': 'multipart/form-data'
  271. }
  272. })
  273. }
  274. /**
  275. * 公海客户导入
  276. * @param {*} data
  277. * customer_id 客户ID
  278. */
  279. export function crmCustomerPoolExcelImportAPI(data) {
  280. var param = new FormData()
  281. Object.keys(data).forEach(key => {
  282. param.append(key, data[key])
  283. })
  284. return request({
  285. url: 'crm/customerPool/import',
  286. method: 'post',
  287. data: param,
  288. headers: {
  289. 'Content-Type': 'multipart/form-data'
  290. }
  291. })
  292. }
  293. /**
  294. * 客户导入模板下载
  295. * @param {*} data
  296. *
  297. */
  298. export const crmCustomerExcelDownloadURL = window.BASE_URL + 'crmCustomer/downloadExcel'
  299. export function crmCustomerDownloadExcelAPI(data) {
  300. return request({
  301. url: 'crm/customer/excelDownload',
  302. method: 'get',
  303. data: data,
  304. responseType: 'blob'
  305. })
  306. }
  307. /**
  308. * 客户公海导入模板下载
  309. * @param {*} data
  310. *
  311. */
  312. export function crmCustomerPoolDownloadExcelAPI(data) {
  313. return request({
  314. url: 'crm/customerPool/excelDownload',
  315. method: 'post',
  316. data: data,
  317. headers: {
  318. 'Content-Type': 'application/json;charset=UTF-8'
  319. },
  320. responseType: 'blob'
  321. })
  322. }
  323. /**
  324. * 公海导出
  325. * @param {*} data
  326. */
  327. export function crmCustomerPoolExcelExportAPI(data) {
  328. return request({
  329. url: 'crm/customerPool/export',
  330. method: 'post',
  331. data: data,
  332. headers: {
  333. 'Content-Type': 'application/json;charset=UTF-8'
  334. },
  335. responseType: 'blob',
  336. timeout: 60000
  337. })
  338. }
  339. /**
  340. * 公海全部导出
  341. * @param {*} data
  342. */
  343. export function crmCustomerPoolExcelAllExport(data) {
  344. return request({
  345. url: 'crm/customerPool/export',
  346. method: 'post',
  347. data: data,
  348. responseType: 'blob',
  349. headers: {
  350. 'Content-Type': 'application/json;charset=UTF-8'
  351. }
  352. })
  353. }
  354. /**
  355. * 公海字段查询
  356. * @param {*} data
  357. */
  358. export function crmCustomerPoolQueryPoolFieldAPI(data) {
  359. return request({
  360. url: 'admin/setting/poolField',
  361. method: 'post',
  362. data: data
  363. })
  364. }
  365. /**
  366. * 获取公海池 操作权限
  367. * @param {*} data
  368. */
  369. export function crmCustomerPoolQueryAuthAPI(data) {
  370. return request({
  371. // url: 'crm/customer/poolAuthority',
  372. url: 'crm/customerPool/authority',
  373. method: 'post',
  374. data: data
  375. })
  376. }
  377. /**
  378. * 客户分配
  379. * @param {*} data
  380. */
  381. export function crmCustomerDistributeAPI(data) {
  382. return request({
  383. url: 'crm/customerPool/distribute',
  384. method: 'post',
  385. data: data,
  386. headers: {
  387. 'Content-Type': 'application/json;charset=UTF-8'
  388. }
  389. })
  390. }
  391. /**
  392. * 客户领取
  393. * @param {*} data
  394. */
  395. export function crmCustomerReceiveAPI(data) {
  396. return request({
  397. url: 'crm/customerPool/receive',
  398. method: 'post',
  399. data: data,
  400. headers: {
  401. 'Content-Type': 'application/json;charset=UTF-8'
  402. }
  403. })
  404. }
  405. /**
  406. * 客户下联系人
  407. * @param {*} data
  408. */
  409. export function crmCustomerQueryContactsAPI(data) {
  410. return request({
  411. url: 'crm/contacts/index',
  412. method: 'post',
  413. data: data,
  414. headers: {
  415. 'Content-Type': 'application/json;charset=UTF-8'
  416. }
  417. })
  418. }
  419. /**
  420. * 客户下回访
  421. * @param {*} data
  422. */
  423. export function crmCustomerQueryVisitAPI(data) {
  424. return request({
  425. url: 'crm/visit/index',
  426. method: 'post',
  427. data: data,
  428. headers: {
  429. 'Content-Type': 'application/json;charset=UTF-8'
  430. }
  431. })
  432. }
  433. /**
  434. * 客户下商机
  435. * @param {*} data
  436. */
  437. export function crmCustomerQueryBusinessAPI(data) {
  438. return request({
  439. url: 'crm/business/index',
  440. method: 'post',
  441. data: data,
  442. headers: {
  443. 'Content-Type': 'application/json;charset=UTF-8'
  444. }
  445. })
  446. }
  447. /**
  448. * 客户下合同
  449. * @param {*} data
  450. */
  451. export function crmCustomerQueryContractAPI(data) {
  452. return request({
  453. url: 'crm/contract/index',
  454. method: 'post',
  455. data: data,
  456. headers: {
  457. 'Content-Type': 'application/json;charset=UTF-8'
  458. }
  459. })
  460. }
  461. /**
  462. * 客户下回款计划
  463. * @param {*} data
  464. */
  465. export function crmCustomerQueryReceivablesPlanAPI(data) {
  466. return request({
  467. url: 'crm/receivables_plan/index',
  468. method: 'post',
  469. data: data,
  470. headers: {
  471. 'Content-Type': 'application/json;charset=UTF-8'
  472. }
  473. })
  474. }
  475. /**
  476. * 客户下回款
  477. * @param {*} data
  478. */
  479. export function crmCustomerQueryReceivablesAPI(data) {
  480. return request({
  481. url: 'crm/receivables/index',
  482. method: 'post',
  483. data: data,
  484. headers: {
  485. 'Content-Type': 'application/json;charset=UTF-8'
  486. }
  487. })
  488. }
  489. // 团队操作
  490. /**
  491. * 团队成员创建
  492. * @param {*} data
  493. * types crm_leads
  494. * typesId 分类ID
  495. */
  496. export function crmCustomerSettingTeamSaveAPI(data) {
  497. return request({
  498. url: 'crm/setting/teamSave',
  499. method: 'post',
  500. data: data,
  501. headers: {
  502. 'Content-Type': 'application/json;charset=UTF-8'
  503. }
  504. })
  505. }
  506. export function crmCustomerSettingTeamDeleteAPI(data) {
  507. return request({
  508. url: 'crm/setting/teamSave',
  509. method: 'post',
  510. data: data,
  511. headers: {
  512. 'Content-Type': 'application/json;charset=UTF-8'
  513. }
  514. })
  515. }
  516. export function crmCustomerTeamMembersAPI(data) {
  517. return request({
  518. url: `crm/setting/team`,
  519. method: 'post',
  520. data
  521. })
  522. }
  523. export function crmCustomerUpdateMembersAPI(data) {
  524. return request({
  525. url: 'crm/setting/teamSave',
  526. method: 'post',
  527. data: data,
  528. headers: {
  529. 'Content-Type': 'application/json;charset=UTF-8'
  530. }
  531. })
  532. }
  533. /**
  534. * 退出团队
  535. * @param {*} data
  536. */
  537. export function crmCustomerExitTeamAPI(data) {
  538. return request({
  539. url: `crm/setting/quitTeam`,
  540. method: 'post',
  541. data
  542. })
  543. }
  544. /**
  545. * 客户标记跟进
  546. * @param {*} data
  547. * id 客户IDs
  548. */
  549. export function crmCustomerSetFollowAPI(data) {
  550. return request({
  551. url: 'crm/message/allDeal',
  552. method: 'post',
  553. data: data,
  554. headers: {
  555. 'Content-Type': 'application/json;charset=UTF-8'
  556. }
  557. })
  558. }
  559. /**
  560. * 客户成交状态修改
  561. * @param {*} data
  562. * id 客户IDs
  563. */
  564. export function crmCustomerDealStatusAPI(data) {
  565. return request({
  566. url: 'crm/customer/deal_status',
  567. method: 'post',
  568. data: data
  569. })
  570. }
  571. /**
  572. * 设置首要联系人
  573. * @param {*} data
  574. *
  575. */
  576. export function crmCustomerSetContactsAPI(data) {
  577. return request({
  578. url: 'crm/contacts/setPrimary',
  579. method: 'post',
  580. data: data,
  581. headers: {
  582. 'Content-Type': 'application/json;charset=UTF-8'
  583. }
  584. })
  585. }
  586. /**
  587. * 数据查重
  588. * @param {*} data
  589. *
  590. */
  591. export function crmCustomerDataCheckAPI(data) {
  592. return request({
  593. url: 'crm/index/queryRepeat',
  594. method: 'post',
  595. data: data,
  596. headers: {
  597. 'Content-Type': 'application/json;charset=UTF-8'
  598. }
  599. })
  600. }
  601. /**
  602. * 附件列表
  603. * @param {*} data
  604. *
  605. */
  606. export function crmCustomerFileListAPI(data) {
  607. return request({
  608. url: 'admin/file/index',
  609. method: 'post',
  610. data: data
  611. })
  612. }
  613. /**
  614. * tab数量
  615. * @param {*} data
  616. *
  617. */
  618. export function crmCustomerNumAPI(data) {
  619. return request({
  620. url: 'crm/customer/count',
  621. method: 'post',
  622. data: data
  623. })
  624. }
  625. /**
  626. * 客户标星
  627. * @param {*} data
  628. *
  629. */
  630. export function crmCustomerStarAPI(data) {
  631. return request({
  632. url: `crm/customer/star`,
  633. method: 'post',
  634. data
  635. })
  636. }
  637. /**
  638. * 发票信息
  639. * @param {*} data
  640. */
  641. export function crmCustomerInvoiceAPI(data) {
  642. return request({
  643. url: 'crm/invoice/index',
  644. method: 'post',
  645. data: data,
  646. headers: {
  647. 'Content-Type': 'application/json;charset=UTF-8'
  648. }
  649. })
  650. }
  651. /**
  652. * 发票抬头信息
  653. * @param {*} data
  654. */
  655. export function crmCustomerInvoiceInfoAPI(data) {
  656. return request({
  657. url: 'crm/invoiceInfo/index',
  658. method: 'post',
  659. data: data,
  660. headers: {
  661. 'Content-Type': 'application/json;charset=UTF-8'
  662. }
  663. })
  664. }
  665. /**
  666. * 9.0公海设置
  667. * @param {*} data
  668. */
  669. export function crmSettingConfig(data) {
  670. return request({
  671. url: 'crm/setting/config',
  672. method: 'post',
  673. data: data,
  674. headers: {
  675. 'Content-Type': 'application/json;charset=UTF-8'
  676. }
  677. })
  678. }
  679. /**
  680. * 9.0公海设置获取
  681. * @param {*} data
  682. */
  683. export function customerSettingData(data) {
  684. return request({
  685. url: 'crm/setting/configData',
  686. method: 'post',
  687. data: data,
  688. headers: {
  689. 'Content-Type': 'application/json;charset=UTF-8'
  690. }
  691. })
  692. }