diff --git a/App.vue b/App.vue index f5057a9..0e709ea 100644 --- a/App.vue +++ b/App.vue @@ -8,7 +8,7 @@ // 如果还没有 token,则设置一个测试 token const token = uni.getStorageSync('token') if (!token) { - const testToken = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImUzMDY4YzNjLThiOTMtNGExNy1hNmFlLWY1NDg5ZTJjYmYyOSJ9.k1cspIDAA_Z357hbRC0PY3PPwRLjTlvezrq37rgVVSYL_T11nDjF3IOWw7QZoEK1uZKYKNn_rAhuqKGOoopvWw' + const testToken = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImQ0ODJhYzdlLTBiYzgtNGFhNC1hMDI2LWVkMWU4YWQ3YmJkYiJ9._m4s6mcpjAHtk4u9r6LMMfIQHSCXDPCTfiWVOTyopZfbsxVFiLkY4ovec3M3u2E9KKm_jIH2fLhAduW4rfAZHQ' uni.setStorageSync('token', testToken) console.log('已设置测试 token:', testToken) } diff --git a/common/api.js b/common/api.js index 20bda64..2d38078 100644 --- a/common/api.js +++ b/common/api.js @@ -117,3 +117,103 @@ export const submitTask = ({ id, submitAttaches, submitRemark }) => { }); }; +/** + * 获取客户列表 + * @param {Object} params 请求参数(可选) + * @param {string[]} params.statusList 客户状态列表:["1"] 正在跟进, ["2"] 待跟进 + * @param {string} params.excludeld 排除id + * @param {string[]} params.ids id列表 + * @param {string} params.intent 意向 + * @param {string} params.createDate 创建日期 (yyyy-MM-dd) + * @param {string} params.joinUserld 参与人id + * @param {string} params.lastFollowDate 上次跟进日期 (yyyy-MM-dd) + * @param {string} params.nextFollowDate 下次跟进日期 (yyyy-MM-dd) + * @param {string} params.nextFollowDateStart 下次跟进日期开始 (yyyy-MM-dd) + * @param {string} params.nextFollowDateEnd 下次跟进日期结束 (yyyy-MM-dd) + * @param {string[]} params.createDateRange 创建日期范围 (yyyy-MM-dd) + * @param {string[]} params.saleList 销售列表 + * @returns {Promise} 返回客户列表 { total: number, rows: array } + */ +export const getCustomerList = (params = {}) => { + const queryParams = []; + + // 处理数组参数 + if (params.statusList && Array.isArray(params.statusList) && params.statusList.length > 0) { + params.statusList.forEach(status => { + queryParams.push(`statusList=${encodeURIComponent(status)}`); + }); + } + + if (params.ids && Array.isArray(params.ids) && params.ids.length > 0) { + params.ids.forEach(id => { + queryParams.push(`ids=${encodeURIComponent(id)}`); + }); + } + + if (params.createDateRange && Array.isArray(params.createDateRange) && params.createDateRange.length > 0) { + params.createDateRange.forEach(date => { + queryParams.push(`createDateRange=${encodeURIComponent(date)}`); + }); + } + + if (params.saleList && Array.isArray(params.saleList) && params.saleList.length > 0) { + params.saleList.forEach(sale => { + queryParams.push(`saleList=${encodeURIComponent(sale)}`); + }); + } + + // 处理字符串参数 + if (params.excludeld) { + queryParams.push(`excludeld=${encodeURIComponent(params.excludeld)}`); + } + + if (params.intent) { + queryParams.push(`intent=${encodeURIComponent(params.intent)}`); + } + + if (params.createDate) { + queryParams.push(`createDate=${encodeURIComponent(params.createDate)}`); + } + + if (params.joinUserld) { + queryParams.push(`joinUserld=${encodeURIComponent(params.joinUserld)}`); + } + + if (params.lastFollowDate) { + queryParams.push(`lastFollowDate=${encodeURIComponent(params.lastFollowDate)}`); + } + + if (params.nextFollowDate) { + queryParams.push(`nextFollowDate=${encodeURIComponent(params.nextFollowDate)}`); + } + + if (params.nextFollowDateStart) { + queryParams.push(`nextFollowDateStart=${encodeURIComponent(params.nextFollowDateStart)}`); + } + + if (params.nextFollowDateEnd) { + queryParams.push(`nextFollowDateEnd=${encodeURIComponent(params.nextFollowDateEnd)}`); + } + + const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : ''; + + return uni.$uv.http.get(`bst/customer/list${queryString}`, { + custom: { + auth: true // 启用 token 认证 + } + }); +}; + +/** + * 获取客户详情 + * @param {string} id 客户ID + * @returns {Promise} 返回客户详情 + */ +export const getCustomerDetail = (id) => { + return uni.$uv.http.get(`customer/${id}`, { + custom: { + auth: true // 启用 token 认证 + } + }); +}; + diff --git a/components/CustomerManagement.vue b/components/CustomerManagement.vue new file mode 100644 index 0000000..983a912 --- /dev/null +++ b/components/CustomerManagement.vue @@ -0,0 +1,579 @@ + + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue index fa2d4e2..c5de374 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,31 +1,37 @@