Browse Source

feat(api): 添加客户档案查询接口及相关类型定义

yz 1 month ago
parent
commit
4682284caa
1 changed files with 133 additions and 0 deletions
  1. 133 0
      src/api/common/index.js

+ 133 - 0
src/api/common/index.js

@@ -0,0 +1,133 @@
+import request from '@/router/axios';
+
+/**
+ * 客户查询参数类型定义
+ * @typedef {Object} CustomerQueryParams
+ * @property {number} [current=1] - 当前页码
+ * @property {number} [size=10] - 每页数量
+ * @property {string} [Customer_CODE] - 客户编码
+ * @property {string} [Customer_NAME] - 客户名称
+ * @property {string} [Customer_ShortName] - 客户简称
+ * @property {string} [CustomerCategory_CODE] - 客户分类编码
+ * @property {string} [Department_CODE] - 部门编码
+ * @property {string} [Saleser_CODE] - 销售员编码
+ * @property {number} [status] - 状态 0-禁用 1-启用
+ */
+
+/**
+ * 客户数据项类型定义
+ * @typedef {Object} CustomerItem
+ * @property {string} id - 客户ID
+ * @property {string} createUser - 创建用户ID
+ * @property {string} createDept - 创建部门ID
+ * @property {string} createTime - 创建时间
+ * @property {string} updateUser - 更新用户ID
+ * @property {string} updateTime - 更新时间
+ * @property {number} status - 状态
+ * @property {number} isDeleted - 是否删除
+ * @property {number} ORG_ID - 组织ID
+ * @property {string} ORG_CODE - 组织编码
+ * @property {string} ORG_NAME - 组织名称
+ * @property {number} Customer_ID - 客户ID
+ * @property {string} Customer_CODE - 客户编码
+ * @property {string} Customer_NAME - 客户名称
+ * @property {string} Customer_ShortName - 客户简称
+ * @property {number|null} CustomerCategory_ID - 客户分类ID
+ * @property {string|null} CustomerCategory_CODE - 客户分类编码
+ * @property {string|null} CustomerCategory_NAME - 客户分类名称
+ * @property {string} CreatedBy - 创建人
+ * @property {string} CreatedOn - 创建时间
+ * @property {string} ModifiedBy - 修改人
+ * @property {string} ModifiedOn - 修改时间
+ * @property {string} StateTaxNo - 税号
+ * @property {string} BuyerNoteName - 买方备注名称
+ * @property {string} BuyerBankAccount - 买方银行账户
+ * @property {string} BuyerBankAccountCode - 买方银行账户编码
+ * @property {string} extend9 - 扩展字段9
+ * @property {number} TaxSchedule_ID - 税率表ID
+ * @property {string} TaxSchedule_CODE - 税率表编码
+ * @property {string} TaxSchedule_NAME - 税率表名称
+ * @property {string} TaxRate - 税率
+ * @property {string|null} DescFlexField_PrivateDescSeg1 - 描述弹性字段1
+ * @property {string|null} DescFlexField_PrivateDescSeg2 - 描述弹性字段2
+ * @property {string|null} DescFlexField_PrivateDescSeg3 - 描述弹性字段3
+ * @property {number|null} Department_ID - 部门ID
+ * @property {string} Department_CODE - 部门编码
+ * @property {string} Department_NAME - 部门名称
+ * @property {number|null} Saleser_ID - 销售员ID
+ * @property {string} Saleser_CODE - 销售员编码
+ * @property {string} Saleser_NAME - 销售员名称
+ * @property {number} TradeCurrency_ID - 交易货币ID
+ * @property {string} TradeCurrency_CODE - 交易货币编码
+ * @property {string} TradeCurrency_NAME - 交易货币名称
+ * @property {number} PriceList_ID - 价格表ID
+ * @property {string} PriceList_CODE - 价格表编码
+ * @property {string} PriceList_NAME - 价格表名称
+ * @property {boolean} IsTaxPrice - 是否含税价格
+ * @property {number} ShippmentRule_ID - 发货规则ID
+ * @property {string} ShippmentRule_CODE - 发货规则编码
+ * @property {string} ShippmentRule_NAME - 发货规则名称
+ * @property {number} RecervalTerm_ID - 收款条件ID
+ * @property {string} RecervalTerm_CODE - 收款条件编码
+ * @property {string} RecervalTerm_NAME - 收款条件名称
+ * @property {number} ARConfirmTerm_ID - 应收立账条件ID
+ * @property {string} ARConfirmTerm_CODE - 应收立账条件编码
+ * @property {string} ARConfirmTerm_NAME - 应收立账条件名称
+ */
+
+
+/**
+ * API响应数据类型定义
+ * @typedef {Object} ApiResponse
+ * @property {number} code - 响应码
+ * @property {boolean} success - 是否成功
+ * @property {string} msg - 响应消息
+ * @property {Object} data - 响应数据
+ */
+
+/**
+ * 分页响应数据类型定义
+ * @typedef {Object} PageResponse
+ * @property {CustomerItem[]} records - 数据记录
+ * @property {number} total - 总记录数
+ * @property {number} size - 每页数量
+ * @property {number} current - 当前页码
+ * @property {Array} orders - 排序信息
+ * @property {boolean} optimizeCountSql - 是否优化count查询
+ * @property {boolean} hitCount - 是否命中count缓存
+ * @property {string|null} countId - count查询ID
+ * @property {number|null} maxLimit - 最大限制
+ * @property {boolean} searchCount - 是否查询count
+ * @property {number} pages - 总页数
+ */
+
+/**
+ * 获取客户档案列表
+ * @param {number} [current=1] - 当前页码
+ * @param {number} [size=10] - 每页数量
+ * @param {CustomerQueryParams} [params={}] - 查询参数
+ * @returns {Promise<ApiResponse<PageResponse>>} 客户档案列表响应
+ */
+export const getCustomerList = async (current = 1, size = 10, params = {}) => {
+  return request({
+    url: '/api/blade-factory/api/factory/view-customer',
+    method: 'get',
+    params: {
+      current,
+      size,
+      ...params
+    }
+  });
+};
+
+/**
+ * 获取客户档案详情
+ * @param {string} customerId - 客户ID
+ * @returns {Promise<ApiResponse<CustomerItem>>} 客户档案详情响应
+ */
+export const getCustomerDetail = async (customerId) => {
+  return request({
+    url: `/api/blade-factory/api/factory/view-customer/${customerId}`,
+    method: 'get'
+  });
+};