api.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. const getHttp = () => uni.$u?.http;
  2. import qs from 'qs';
  3. import store from "../store/index.js";
  4. const mockApi = 'http://192.168.0.243:3001/mock-api/prod-api/crm';//本地mock服务地址
  5. const install = (app) => {
  6. const http = getHttp();
  7. if (!http) {
  8. console.warn('[api.js] uni.$u.http 未就绪,请确保 uview-plus 已先于 httpApi 注册');
  9. return;
  10. }
  11. // 挂载到 globalProperties.$u.api(uview-plus 已提供 $u)
  12. const gp = app.config.globalProperties
  13. if (!gp.$u) gp.$u = {}
  14. gp.$u.api = {
  15. login: (params = {}) => http.post('/auth/login', params), // 登录
  16. getInfo: (params = {}) => http.get('/system/user/getInfo', { params }), // 获取用户数据
  17. sysMessageReceive: (params = {}) => http.get('/message/sysMessageReceive/list?' + qs.stringify(params)), // 消息接受列表
  18. getAppMessageList: (params = {}) => http.get('/message/sysMessageReceive/getAppMessageList?' + qs.stringify(params)), // 消息列表接口
  19. getDicts: (dictType) => http.get('/system/dict/data/type/' + dictType), // 获取字典
  20. getPhoneFileterResult: (data = {}) => http.post('/collect/all/casePhoneFilter/getPhoneFileterResult', data), // 滤号
  21. listDetpUser: (data = {}) => http.post('/system/user/getDeptCustomer', data), // 查询部门人员列表
  22. getDeptListAll: (params = {}) => http.get('/system/dept/listAll', { params }), // 查询企业列表
  23. getDeptCustomerByOrg: (data = {}) => http.post('/system/user/getDeptCustomerByOrg', data, { params: data }), // 查询部门人员列表
  24. getDeptOwner: (data = {}) => http.post('/system/user/getDeptOwner', data), // 查询部门人员列表
  25. listByOrgDataScope: (params = {}) => http.get('/system/user/listByOrgDataScope', { params }), // 查询部门人员列表
  26. logout: () => http.delete("/auth/logout?systemCode=system_debt"), // 退出登录
  27. getUserProfile: (params = {}) => http.get('/system/user/profile?' + qs.stringify(params)), // 查询用户个人信息
  28. uploadAvatar: (url) => http.upload('/system/user/profile/avatar', { filePath: url, name: "avatarfile", timeout: 1000 * 60 * 10, custom: { loadingText: "上传中" } }),
  29. updateUserProfile: (data = {}) => http.put("/system/user/profile", data), // 更新个人信息
  30. getCofDeptBank: (params = {}) => http.get("/system/cofDeptBank/getCofDeptBank", params), // 查询机构配置
  31. getOutEquipmentByMacAddr: (mac, config) => http.get("system/caseOutEquipment/" + mac, config), // 根据mac地址获取外访设备状态可能为空
  32. addCaseOutEquipment: (data = {}) => http.post("system/caseOutEquipment", data), // 申请mac地址授权
  33. checkOutEquipment: (params = {}, config) => http.get("/system/caseOutEquipment/checkOutEquipment", { params, ...config }), // 检测外访设备是否有申请通过记录
  34. concatRecord: (files, params = {}) => http.upload('/fileVisit/concatRecord', { files, params, name: 'files', timeout: 1000 * 60 * 10, custom: { loadingText: "上传中" } }), // 合并录音并上传
  35. uploadFile: (url, params = {}) => http.upload('/file/aliossUpload', { filePath: url, params, name: "file", timeout: 1000 * 60 * 10, custom: { loadingText: "上传中" } }), // 上传文件
  36. watermarkUpload: (url, params = {}) => http.upload('/fileVisit/watermarkUpload', { filePath: url, params, name: "file", timeout: 1000 * 60 * 10, custom: { loadingText: "上传中" } }), // 上传文件
  37. getOutPolyline: (params = {}) => http.get("/system/caseOutPolyline/getOutPolyline", { params, custom: { loading: false } }), // 请求外访轨迹列表
  38. addOutPolyline: (data = {}) => http.post("/system/caseOutPolyline/addOutPolyline", data, { custom: { loading: false } }), // 添加外访轨迹
  39. updateUserPwd: (params = {}) => http.put("/system/user/profile/updatePwd?" + qs.stringify(params)), // 更新用户密码
  40. getSysVersion: (params = {}, config = {}) => http.get("/system/sysVersion/getSysVersion", { params, ...config, timeout: 2000 }), // 版本更新
  41. getBankDebtRule: (params = {}, config = {}) => http.get('/system/bankInfo/getBankDebtRule', { params, ...config }), // 获取委托方催收规则
  42. getBankContent: (params = {}, config = {}) => http.get('/system/bankInfo/getBankContent', { params, ...config }), // 催收状态
  43. getCofCallOutBindByUserId: (params = {}, config = {}) => http.get('/system/cofCallOutBind/getCofCallOutBindByUserId', { params, ...config }), // 获取分机号
  44. getCofShortcuts: (params = {}, config = {}) => http.get('/system/cofShortcuts/list', { params, ...config }), // 获取键盘速填
  45. getCofInfo: (params, config = {}) => http.get('/system/user/getCofInfo', { params, ...config }), // 获取权限
  46. extensionNumberState: (params, config = {}) => http.get("http://8.134.50.217:10085/cc/extensionNumberState", { params, custom: { loading: false } }), // 获取来电关联案件
  47. getSm4En: (str, config = {}) => http.get(store.state.user.path + '/caseMainInfo/getSm4En', { params: { str }, custom: { loading: false } }), // sm4加密
  48. setAPPLoginLimit: (params, config = {}) => http.get('/system/user/setAPPLoginLimit', { params, custom: { loading: false } }), // 设置设备码访问失败次数
  49. getAPPLoginLimit: (params, config = {}) => http.get('/system/user/getAPPLoginLimit', { params, custom: { loading: false }, timeout: 1000 }), // 获取设备码访问失败次数
  50. getExtensionStatus: (params, config = {}) => http.get('/sip/JcSip/getExtensionStatus', { params, custom: { loading: false } }), // 获取分机的状态
  51. setEffectiveCallerIdNumber: (params, config = {}) => http.get('/sip/JcSip/setEffectiveCallerIdNumber', { params, custom: { loading: false } }), // 固话设置号码
  52. getExtensionByUserId: (params, config = {}) => http.get('/sip/exten/getExtensionByUserId', { params, custom: { loading: false } }), // 通过用户id获取分机
  53. getLineByIds: (params, config = {}) => http.get('/sip/line/getLineByIds', { params, custom: { loading: false } }), // 根据线路获取线路
  54. getCodeImg: (params, config = {}) => http.get('/code', { params, custom: { loading: false }, timeout: 1500 }), // 获取验证码(主要用于判断配置是否正确)
  55. getAppSystemList: (params = {}, config = {}) => http.get('/system/sysVersion/getAppSystemList', { params, custom: { loading: false }, timeout: 1500 }), // 获取app的系统列表
  56. changeOnlineStatus: (data, config = {}) => http.put('/system/user/changeStatus', data), // 用户状态修改
  57. statisticsCaseState: (data, config = {}) => http.post(store.state.user.path + '/clueFixedFields/statisticsCaseState', data), // 统计线索阶段
  58. statisticsAddClueCount: (data, config = {}) => http.post(store.state.user.path + '/clueMainInfo/statisticsAddClueCount', data), // 统计添加阶段
  59. getClueMainInfoList: (params = {}, data = {}) => http.post(store.state.user.path + '/clueMainInfo/getClueMainInfoList?' + qs.stringify(params), data), // 线索列表
  60. getUserByUserIds: (params) => http.get('/system/user/getUserByUserIds', { params }), //
  61. getClueTagGroupVoList: (params = {}) => http.get(store.state.user.path + "/clueTagGroup/getClueTagGroupVoList", { params }), // 获取线索标签;
  62. getClueMainInfoVoById: (params = {}, config = {}) => http.get(store.state.user.path + "/clueMainInfo/getClueMainInfoVoById", { params, custom: { loading: false }, timeout: 1500 }), // 获取线索详情;
  63. updateClueFixedFieldsClueState: (data, config = {}) => http.post(store.state.user.path + '/clueFixedFields/updateClueFixedFieldsClueState', data),
  64. updateClueFixedFieldsAllTags: (data, config = {}) => http.post(store.state.user.path + '/clueFixedFields/updateClueFixedFieldsAllTags', data),
  65. getClueMainInfoById: (params = {}, config = {}) => http.get(store.state.user.path + '/clueMainInfo/getClueMainInfoById', { params, ...config }),
  66. getClueAdInfoByClueId: (params = {}, config = {}) => http.get(store.state.user.path + '/clueAdInfo/getClueAdInfoByClueId', { params, ...config }),
  67. getClueFollowList: (params = {}, config = {}) => http.get(store.state.user.path + '/clueFollow/getClueFollowList', { params, ...config }),
  68. getClueFollowListByClueId: (params = {}, config = {}) => http.get(store.state.user.path + '/clueFollow/getClueFollowListByClueId', { params, ...config }),
  69. deleteClueFollow: (data, config = {}) => http.post(store.state.user.path + '/clueFollow/deleteClueFollow', data),
  70. updateClueFixedFieldsClueOwner: (data, config = {}) => http.post(store.state.user.path + '/clueFixedFields/updateClueFixedFieldsClueOwner', data),
  71. addClueFollow: (data, config = {}) => http.post(store.state.user.path + '/clueFollow/addClueFollow', data),
  72. getDictCascadeData: (params, config = {}) => http.get(store.state.user.path + '/dictCascadeData/list', { params, ...config }),
  73. selectAllDeptList: (params, config = {}) => http.get('/system/dept/selectAllDeptList', { params, ...config }),
  74. getIdByName: (params, config = {}) => http.get(store.state.user.path + "/clueMainInfo/getIdByName", { params, ...config }),
  75. addClueMainInfo: (data, config = {}) => http.post(store.state.user.path + '/clueMainInfo/addClueMainInfo', data),
  76. saveLog: (data, config = {}) => http.post("/system/access/saveLog", data, { custom: { loading: false } }),
  77. saveClueFile: (data, config = {}) => http.post(store.state.user.path + '/clueFile/saveClueFile', data),
  78. updateClueMainInfo: (data, config = {}) => http.post(store.state.user.path + '/clueMainInfo/updateClueMainInfo', data),
  79. selectPromotionStats: (data, config = {}) => http.post(store.state.user.path + '/promotionStats/selectPromotionStats', data),
  80. firstLogin: (data) => http.post('/system/user/firstLogin', data),
  81. shiYuWxLoginGetInfo: (params) => http.get('/auth/shiYuWxLoginGetInfo', { params, custom: { noAuth: true } }),
  82. deleteClueFile: (data) => http.delete(store.state.user.path + '/clueFile/deleteClueFile', data),
  83. getCallClueFileByClueId: (params) => http.get(store.state.user.path + '/clueFile/getCallClueFileByClueId', { params, custom: { noAuth: true } }),
  84. getClueSendFormCountByClueId: (params = {}, config = {}) => http.get(store.state.user.path + '/clueSendForm/getClueSendFormCountByClueId', { params }),
  85. // 订单相关接口
  86. selectClueOrderFormList: (params = {}, data = {}) => http.post(store.state.user.path + '/clueSendForm/list?' + qs.stringify(params), data),
  87. oderForm: (data = {}) => http.post(store.state.user.path + '/clueSendForm/oderForm', data),
  88. updateTags: (data = {}) => http.post(store.state.user.path + '/clueSendForm/updateTags', data),
  89. addOrderFollow: (data = {}) => http.post(store.state.user.path + '/orderFollow/addOrderFollow', data),
  90. getOrderFollowListByOrderId: (params = {}) => http.get(store.state.user.path + '/orderFollow/getOrderFollowListByOrderId', { params }),
  91. deleteOrder: (data = {}) => http.post(store.state.user.path + '/clueSendForm/deleteOrder', data),
  92. updateOrderState: (data = {}) => http.post(store.state.user.path + '/clueSendForm/updateOrderState', data),
  93. updateClueOrderForm: (data = {}) => http.post(store.state.user.path + '/clueSendForm/updateClueOrderForm', data),
  94. getOrderFollowListByClueId: (params = {}, config = {}) => http.get(store.state.user.path + '/orderFollow/getOrderFollowListByClueId', { params }),
  95. getDuplicateOrderFollowListByClueId: (params = {}, config = {}) => http.get(store.state.user.path + '/orderFollow/getDuplicateOrderFollowListByClueId', { params }),
  96. deleteOrderFollow: (data, config = {}) => http.post(store.state.user.path + '/orderFollow/deleteOrderFollow', data),
  97. getOrderFollowList: (params = {}, config = {}) => http.get(store.state.user.path + '/orderFollow/getOrderFollowList', { params }),
  98. selectCommissionList: (params = {}, data = {}) => http.post(store.state.user.path + '/clueCommissionForm/list?' + qs.stringify(params), data),
  99. getClueSendFormVoByOrderId: (params = {}, config = {}) => http.get(store.state.user.path + '/clueSendForm/getClueSendFormVoByOrderId', { params }),
  100. // 跟进记录相关接口
  101. getDuplicateClueFollowByClueId: (params, config = {}) => http.get(store.state.user.path + '/clueFollow/getDuplicateClueFollowByClueId', { params, ...config }),
  102. // 文件相关接口
  103. selectClueFileByDto: (data, config = {}) => http.post(store.state.user.path + '/clueFile/selectClueFileByDto', data, config),
  104. updateClueFile: (data, config = {}) => http.put(store.state.user.path + '/clueFile/updateClueFile', data),
  105. addReceiptForm: (data, config = {}) => http.post(store.state.user.path + '/clueReceiptForm', data),
  106. updateReceiptForm: (data, config = {}) => http.put(store.state.user.path + '/clueReceiptForm', data),
  107. listReceiptFormByOrderId: (orderFormId, config = {}) => http.get(store.state.user.path + '/clueReceiptForm/listByOrderId/' + orderFormId),
  108. getReceiptForm: (id, config = {}) => http.get(store.state.user.path + '/clueReceiptForm/' + id),
  109. delReceiptForm: (id, config = {}) => http.delete(store.state.user.path + '/clueReceiptForm/' + id),
  110. saveClueOrderForm: (data = {}) => http.post(store.state.user.path + '/clueSendForm/saveClueOrderForm', data),
  111. clueReceiptFormListByOrderId: (orderId, config = {}) => http.get(store.state.user.path + '/clueReceiptForm/listByOrderId/' + orderId),
  112. clueCommissionAdd: (data = {}) => http.post(store.state.user.path + '/clueCommissionForm', data),
  113. clueCommissionUpdate: (data = {}) => http.put(store.state.user.path + '/clueCommissionForm', data),
  114. clueCommissionById: (id, config = {}) => http.get(store.state.user.path + '/clueCommissionForm/' + id),
  115. clueCommissionRemove: (ids, config = {}) => http.post(store.state.user.path + '/clueCommissionForm/remove', ids),
  116. getCustomerManagerAllList: () => http.post('/system/user/getCustomerManagerAllList'),
  117. /** 角色下拉列表(系统模块,用于仓库字段权限配置选择角色) */
  118. getRoleOptionSelect: (config = {}) => http.get('/system/role/optionselect', config),
  119. /** 角色下拉列表(含超级管理员 admin,用于仓库字段/按钮权限配置) */
  120. getRoleOptionSelectAll: (config = {}) => http.get('/system/role/optionselect/all', config),
  121. getClueSendFormVoByOrderId: (params) => http.get(store.state.user.path + '/clueSendForm/getClueSendFormVoByOrderId?' + qs.stringify(params)),
  122. statisticsSendStatus: (data, config = {}) => http.post(store.state.user.path + '/clueSendForm/statisticsSendStatus', data), // 统计线索阶段
  123. // 支付相关接口
  124. saveOrderFileAndTransfer:(data={})=>http.post(store.state.user.path + '/storeInfo/saveOrderFileAndTransfer',data),
  125. //启动mock服务,把store.state.user.path换成mockApi 手机预览时需要使用电脑局域网IP,不能用localhost
  126. getPersonCards:(params)=>http.get(store.state.user.path+'/personCenter/getPersonCards',{ params }),//个人中心-获取个人中心数据
  127. getPersonLatestClue:(params)=>http.get(store.state.user.path+'/personCenter/getPersonLatestClue',{ params }),//个人中心-获取最新线索
  128. getPersonRanking:(params)=>http.get(store.state.user.path+'/personCenter/getPersonRanking',{ params }),//个人中心-获取个人排名
  129. getWareHouseCard:(params)=>http.get(store.state.user.path+'/warehouse/getWareHouseCard',{ params }),//仓库中心-获取仓库信息(无筛选)
  130. getWareHouseCardPost:(data)=>http.post(store.state.user.path+'/warehouse/getWareHouseCard', data || {}),//仓库中心-卡片数据(支持与列表相同筛选条件)
  131. inquiryChart:(data)=>http.post(store.state.user.path+'/warehouse/getPriceChart',data),//询价中心-获取询价图表数据
  132. addInquiry:(data)=>http.post(store.state.user.path+'/inquiryCenter/addInquiry',data),//添加/编辑询价 有id是编辑 没有id是添加
  133. inquiryDetail:(data)=>http.post(store.state.user.path+'/inquiryCenter/getInquiryDetail',data),//询价详情
  134. inquiryVerificationList:(params,data)=>http.post(store.state.user.path+'/inquiryCenter/inquiryVerificationList?' + qs.stringify(params), data),// 询价/核价列表
  135. wareHouseList:(params,data)=>http.post(store.state.user.path+'/warehouse/wareHouseList?' + qs.stringify(params), data),//仓库中心-获取仓库列表
  136. wareHouseDetail:(params)=>http.get(store.state.user.path+'/warehouse/wareHouseDetail',{ params }),//仓库中心-获取仓库详情
  137. /** 仓库字段权限:不传参时按当前登录用户 roles 合并返回 [{ fieldName, read, edit }, ...] */
  138. wareHouseFieldPermissions:(params)=>http.get(store.state.user.path+'/warehouse/fieldPermissions',{ params }),//仓库中心-字段读/编辑权限
  139. /** 仓库按钮权限:按当前登录用户角色合并返回 [{ buttonKey, enabled }, ...],用于列表/详情页控制编辑、删除按钮 */
  140. wareHouseButtonPermissions:(params)=>http.get(store.state.user.path+'/warehouse/buttonPermissions',{ params }),
  141. /** 仓库字段权限-配置:按角色查询/保存(管理端) */
  142. wareHouseFieldPermissionsConfigGet:(params)=>http.get(store.state.user.path+'/warehouse/fieldPermissions/config',{ params }),
  143. wareHouseFieldPermissionsConfigSave:(data)=>http.post(store.state.user.path+'/warehouse/fieldPermissions/config', data),
  144. wareHouseFieldPermissionsConfigDeleteByRole:(roleId)=>http.delete(store.state.user.path+'/warehouse/fieldPermissions/role/' + roleId),
  145. /** 仓库按钮权限-配置:按角色查询/保存(管理端) */
  146. wareHouseButtonPermissionsConfigGet:(params)=>http.get(store.state.user.path+'/warehouse/buttonPermissions/config',{ params }),
  147. wareHouseButtonPermissionsConfigSave:(data)=>http.post(store.state.user.path+'/warehouse/buttonPermissions/config', data),
  148. wareHouseLog:(params)=>http.get(store.state.user.path+'/warehouse/wareHouseLog',{ params }),//仓库中心-获取仓库操作日志
  149. wareHouseUpdate:(data)=>http.post(store.state.user.path+'/warehouse/wareHouseUpdate',data),//仓库中心-编辑商品库存
  150. wareHouseLock:(data)=>http.post(store.state.user.path+'/warehouse/wareHouseLock',data),//仓库中心-锁单
  151. wareHouseDown:(data)=>http.post(store.state.user.path+'/warehouse/wareHouseDown',data),//仓库中心-下架商品
  152. wareHouseAdd:(data)=>http.post(store.state.user.path+'/warehouse/wareHouseAdd',data),//仓库中心-新增商品
  153. wareHouseOpenOrder:(data)=>http.post(store.state.user.path+'/warehouse/wareHouseOpenOrder',data),//仓库中心-开单
  154. wareHouseFakeAdd:(data)=>http.post(store.state.user.path+'/warehouse/wareHouseFakeAdd',data),//仓库中心-假货新增
  155. wareHouseFakeEdit:(data)=>http.post(store.state.user.path+'/warehouse/wareHouseFakeEdit',data),//仓库中心-假货编辑
  156. wareHouseFakeList:(params,data)=>http.post(store.state.user.path+'/warehouse/wareHouseFakeList?' + qs.stringify(params), data),//仓库中心-假货列表
  157. xhlSystemSetList:(data)=>http.post(store.state.user.path+'/xhlSystemSet/list', data),//系统设置-列表
  158. wareHouseOrderList:(data)=>http.post(store.state.user.path+'/wareHouseOrder/list',data),//开单列表
  159. wareHouseOrderDelete:(data)=>http.delete(store.state.user.path+'/wareHouseOrder/' + data.id ),//删除开单
  160. wareHouseOrderDetail:(params)=>http.get(store.state.user.path+'/wareHouseOrder/'+params.id),//开单详情
  161. wareHouseOrderUpdate:(data)=>http.put(store.state.user.path+'/wareHouseOrder',data),//开单编辑
  162. wareHouseDelete:(data)=>http.delete(store.state.user.path+'/warehouse/' + data.id ),//仓库删除
  163. saveOrderFileAndTransfer: (data = {}) => http.post(store.state.user.path + '/storeInfo/saveOrderFileAndTransfer', data),
  164. selectModelList: (data) => http.post(store.state.user.path+'/warehouse/selectModelList' , data),// 价格趋势筛选
  165. searchModelByImage:(filePath, params = {})=>http.upload(store.state.user.path+'/warehouse/searchModelByImage',{ filePath, name: "file", params, timeout: 60000, custom: { loadingText: '识别中...' } }),//询价中心-以图搜型号
  166. // 删除订单分成数据
  167. deleteClueCommissionForm: (id, config = {}) => http.delete(store.state.user.path + '/clueCommissionForm/' + id),
  168. }
  169. }
  170. export default { install }