index.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. import request from '@/router/axios';
  2. /**
  3. * 投诉查询参数类型定义
  4. * @typedef {Object} ComplaintQueryParams
  5. * @property {string} [complaintNo] - 投诉单号
  6. * @property {string} [title] - 投诉标题
  7. * @property {number} [complainantType] - 投诉人类型 1-消费者 2-经销商 3-分销商
  8. * @property {string} [customerCode] - 客户编码
  9. * @property {string} [customerName] - 客户名称
  10. * @property {string} [contactName] - 联系人姓名
  11. * @property {string} [contactPhone] - 联系人电话
  12. * @property {string} [complaintType] - 投诉类型
  13. * @property {number} [status] - 投诉状态 1-待处理 2-处理中 3-已完成 4-已关闭
  14. * @property {number} [replyStatus] - 回复状态 0-未回复 1-已回复
  15. * @property {string} [submitTimeStart] - 提交时间开始
  16. * @property {string} [submitTimeEnd] - 提交时间结束
  17. * @property {number} [current] - 当前页码
  18. * @property {number} [size] - 每页大小
  19. */
  20. /**
  21. * 投诉表单数据类型定义
  22. * @typedef {Object} ComplaintForm
  23. * @property {string} [id] - 投诉ID(修改时必填)
  24. * @property {string} [complaintNo] - 投诉单号(系统自动生成)
  25. * @property {number} complainantType - 投诉人类型 1-消费者 2-经销商 3-分销商
  26. * @property {string|number} [customerId] - 客户ID
  27. * @property {string} [customerCode] - 客户编码
  28. * @property {string} [customerName] - 客户名称
  29. * @property {string} contactName - 联系人姓名
  30. * @property {string} contactPhone - 联系人电话
  31. * @property {string} title - 投诉标题
  32. * @property {string} content - 投诉内容
  33. * @property {string} complaintType - 投诉类型
  34. * @property {number} [visibleScope] - 可见范围
  35. * @property {number} [status] - 投诉状态 1-待处理 2-处理中 3-已完成 4-已关闭
  36. * @property {number} [replyStatus] - 回复状态 0-未回复 1-已回复
  37. * @property {string} [closeReason] - 关闭原因
  38. * @property {string} [submitTime] - 提交时间
  39. */
  40. /**
  41. * 投诉列表项类型定义
  42. * @typedef {Object} ComplaintRecord
  43. * @property {string} id - 投诉ID
  44. * @property {string} createUser - 创建用户ID
  45. * @property {string} createDept - 创建部门ID
  46. * @property {string} createTime - 创建时间
  47. * @property {string} updateUser - 更新用户ID
  48. * @property {string} updateTime - 更新时间
  49. * @property {number} status - 投诉状态 1-待处理 2-处理中 3-已完成 4-已关闭
  50. * @property {number} isDeleted - 是否删除 0-未删除 1-已删除
  51. * @property {string} complaintNo - 投诉单号
  52. * @property {number} complainantType - 投诉人类型 1-消费者 2-经销商 3-分销商
  53. * @property {string|number|null} customerId - 客户ID
  54. * @property {string|null} customerCode - 客户编码
  55. * @property {string|null} customerName - 客户名称
  56. * @property {string} contactName - 联系人姓名
  57. * @property {string} contactPhone - 联系人电话
  58. * @property {string} title - 投诉标题
  59. * @property {string} content - 投诉内容
  60. * @property {string} complaintType - 投诉类型
  61. * @property {number} visibleScope - 可见范围
  62. * @property {number} replyStatus - 回复状态 0-未回复 1-已回复
  63. * @property {string|null} closeReason - 关闭原因
  64. * @property {string} submitTime - 提交时间
  65. */
  66. /**
  67. * API响应类型定义
  68. * @template T
  69. * @typedef {Object} ApiResponse
  70. * @property {number} code - 响应码
  71. * @property {boolean} success - 是否成功
  72. * @property {T} data - 响应数据
  73. * @property {string} msg - 响应消息
  74. */
  75. /**
  76. * 分页结果类型定义
  77. * @template T
  78. * @typedef {Object} PageResult
  79. * @property {T[]} records - 数据记录
  80. * @property {number} total - 总记录数
  81. * @property {number} size - 每页大小
  82. * @property {number} current - 当前页码
  83. * @property {Array} orders - 排序信息
  84. * @property {boolean} optimizeCountSql - 是否优化count查询
  85. * @property {boolean} hitCount - 是否命中count缓存
  86. * @property {string|null} countId - count查询ID
  87. * @property {string|null} maxLimit - 最大限制
  88. * @property {boolean} searchCount - 是否查询count
  89. * @property {number} pages - 总页数
  90. */
  91. /**
  92. * 投诉分页查询
  93. * @param {number} current - 当前页码
  94. * @param {number} size - 每页大小
  95. * @param {ComplaintQueryParams} params - 查询参数
  96. * @returns {Promise<AxiosResponse<PageResult<ComplaintRecord>>>} 分页查询结果
  97. */
  98. export const getList = (current, size, params) => {
  99. return request({
  100. url: '/api/blade-factory/api/factory/complaint',
  101. method: 'get',
  102. params: {
  103. ...params,
  104. current,
  105. size
  106. }
  107. })
  108. }
  109. /**
  110. * 新增投诉
  111. * @param {ComplaintForm} row - 投诉表单数据
  112. * @returns {Promise<AxiosResponse<null>>} 操作结果
  113. */
  114. export const add = (row) => {
  115. return request({
  116. url: '/api/blade-factory/api/factory/complaint',
  117. method: 'post',
  118. data: row
  119. })
  120. }
  121. /**
  122. * 修改投诉
  123. * @param {ComplaintForm} row - 投诉表单数据
  124. * @returns {Promise<AxiosResponse<null>>} 操作结果
  125. */
  126. export const update = (row) => {
  127. return request({
  128. url: '/api/blade-factory/api/factory/complaint',
  129. method: 'put',
  130. data: row
  131. })
  132. }
  133. /**
  134. * 删除投诉
  135. * @param {string} ids - 投诉ID列表,多个用逗号分隔
  136. * @returns {Promise<ApiResponse<null>>} 操作结果
  137. */
  138. export const remove = (ids) => {
  139. return request({
  140. url: '/api/blade-factory/api/factory/complaint',
  141. method: 'delete',
  142. params: {
  143. ids
  144. }
  145. })
  146. }
  147. /**
  148. * 获取投诉详情
  149. * @param {string} complaintId - 投诉ID
  150. * @returns {Promise<ApiResponse<ComplaintRecord>>} 投诉详情
  151. */
  152. export const getDetail = (complaintId) => {
  153. return request({
  154. url: `/api/blade-factory/api/factory/complaint/${complaintId}`,
  155. method: 'get'
  156. })
  157. }
  158. /**
  159. * 更新投诉状态
  160. * @param {string} id - 投诉ID
  161. * @param {number} status - 新状态
  162. * @param {string} [closeReason] - 关闭原因(状态为已关闭时必填)
  163. * @returns {Promise<ApiResponse<null>>} 操作结果
  164. */
  165. export const updateStatus = (id, status, closeReason) => {
  166. return request({
  167. url: '/api/blade-factory/api/factory/complaint/status',
  168. method: 'put',
  169. data: {
  170. id,
  171. status,
  172. closeReason
  173. }
  174. })
  175. }
  176. /**
  177. * 批量更新投诉状态
  178. * @param {string[]} ids - 投诉ID数组
  179. * @param {number} status - 新状态
  180. * @param {string} [closeReason] - 关闭原因(状态为已关闭时必填)
  181. * @returns {Promise<ApiResponse<null>>} 操作结果
  182. */
  183. export const batchUpdateStatus = (ids, status, closeReason) => {
  184. return request({
  185. url: '/api/blade-factory/api/factory/complaint/batch-status',
  186. method: 'put',
  187. data: {
  188. ids,
  189. status,
  190. closeReason
  191. }
  192. })
  193. }