From 9c48a0c7d719edd9afafb60770a64fcf5f0cdd8c Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Mon, 19 May 2025 14:24:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor(market):=20=E9=87=8D=E6=9E=84=E5=B8=82?= =?UTF-8?q?=E5=9C=BA=E7=BA=BF=E7=B4=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除顶部筛选栏,改为通过 segmented 控件切换 - 重新组织数据结构,分离"我的客户"和"资源分配"的筛选条件和列表数据 - 优化列表加载逻辑,支持分别加载两个标签页的数据 - 添加资源共享接口 - 更新 API 地址配置 --- .gitignore | 3 +- api/apiRoute.js | 9 +- pages/market/clue/index.vue | 197 ++++++++++++++++++++---------------- 3 files changed, 120 insertions(+), 89 deletions(-) diff --git a/.gitignore b/.gitignore index fecf8ae..31eb5f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .hbuilderx -unpackage \ No newline at end of file +unpackage +/.idea \ No newline at end of file diff --git a/api/apiRoute.js b/api/apiRoute.js index 0ed38d9..40d201f 100644 --- a/api/apiRoute.js +++ b/api/apiRoute.js @@ -132,13 +132,20 @@ export default { return res; }) }, - //销售端 + //销售端-客户资源-添加 xs_addCustomerResources(data = {}) { let url = '/customerResources/add' return http.post(url, data).then(res => { return res; }) }, + //销售端-资源共享-列表 + xs_resourceSharingIndex(data = {}) { + let url = '/resourceSharing/index' + return http.get(url, data).then(res => { + return res; + }) + }, diff --git a/pages/market/clue/index.vue b/pages/market/clue/index.vue index 95c8802..8567a46 100644 --- a/pages/market/clue/index.vue +++ b/pages/market/clue/index.vue @@ -2,18 +2,7 @@ - - 全部({{countArr.type_0}}) - - 待跟进({{countArr.type_1}}) - - - 7天未跟进({{countArr.type_2}}) - - - 30天未成交({{countArr.type_3}}) - - + - + @@ -79,10 +68,7 @@ @scrolltolower="loadMoreData" style="height: 100vh;" > - - 今日待领({{countArr.lq_count}}/{{countArr.max_count}}) - - + @@ -158,17 +144,10 @@ export default { is_gh: '2',//1=资源分配,2=我的客户 }, - countArr:{ - type_0:0, - type_1:0, - type_2:0, - type_3:0, - max_count:0, - lq_count:0, - },//统计数组 - tableList:[],//表格数据 + + //顶部Tab栏 values: [ { id: 1, @@ -180,9 +159,28 @@ export default { // } ], select_type: 1,//筛选标签列表|1,2,3,4 - segmented_type: 1,//1=我的客户,2=资源分配 + segmented_type: 1,//当前选中的Tab栏目|1=我的客户,2=资源分配 userInfo:{},//用户信息 + //我的客户列表相关 + //筛选条件 + filteredData_1:{ + page:1,//当前页码 + limit:10,//每页返回数据条数 + total:10,//数据总条数 + }, + //数据列表 + tableList_1:[],//表格数据 + + //资源分配列表相关 + //筛选条件 + filteredData_2:{ + page:1,//当前页码 + limit:10,//每页返回数据条数 + total:10,//数据总条数 + }, + //数据列表 + tableList_2:[],//表格数据 } }, @@ -193,8 +191,17 @@ export default { //下拉刷新 async onPullDownRefresh() { //重置为第一页 - await this.resetFilteredData() - await this.getList() + if(this.segmented_type == 1){ + //我的客户 + await this.resetFilteredData_1() + await this.getList_1() + }else{ + //资源分配 + await this.resetFilteredData_2() + await this.getList_2() + } + + }, methods: { //初始化 @@ -239,10 +246,9 @@ export default { console.log('用户',this.userInfo) }, - - + //获取列表-我的客户相关 //加载更多(下一页) - loadMoreData() { + loadMoreData_1() { //判断是否加载 if (!this.isReachedBottom) { this.isReachedBottom = true;//设置为不可请求状态 @@ -250,21 +256,21 @@ export default { } }, //重置为第一页 - async resetFilteredData() { + async resetFilteredData_1() { this.isReachedBottom = false; // 重置状态,以便下次触发加载更多 - this.filteredData.page = 1//当前页码 - this.filteredData.limit = 10//每页返回数据条数 - this.filteredData.total = 10//数据总条数 + this.filteredData_1.page = 1//当前页码 + this.filteredData_1.limit = 10//每页返回数据条数 + this.filteredData_1.total = 10//数据总条数 }, - //获取我的客户列表 - async getList(){ + //获取列表-我的客户 + async getList_1(){ this.loading = true - let data = {...this.filteredData} + let data = {...this.filteredData_1} //判断是否还有数据 - if(this.filteredData.page * this.filteredData.limit > this.filteredData.total){ + if(this.filteredData_1.page * this.filteredData_1.limit > this.filteredData_1.total){ this.loading = false uni.showToast({ title: '暂无更多', @@ -274,7 +280,7 @@ export default { } if(data.page == 1){ - this.tableList = [] + this.tableList_1 = [] } let res = await marketApi.myClient(data) @@ -288,71 +294,88 @@ export default { return } - this.tableList = this.tableList.concat(res.data.list.data); // 使用 concat 方法 将新数据追加到数组中 + this.tableList_1 = this.tableList_1.concat(res.data.list.data); // 使用 concat 方法 将新数据追加到数组中 + + console.log('列表',this.tableList_1) + this.filteredData_1.total = res.data.list.total + this.filteredData_1.page++ - console.log('列表',this.tableList) - this.filteredData.total = res.data.list.total - this.filteredData.page++ - this.countArr = { - type_0:res.data.count[0], - type_1:res.data.count[1], - type_2:res.data.count[2], - type_3:res.data.count[3], - max_count:res.data.gh.max_count, - lq_count:res.data.gh.lq_count, - } }, - //设置筛选条件 - async setSelect(type) { - this.select_type = type - //重置为第一页 - await this.resetFilteredData() + //获取列表-资源分配相关 + //加载更多(下一页) + loadMoreData_2() { + //判断是否加载 + if (!this.isReachedBottom) { + this.isReachedBottom = true;//设置为不可请求状态 + this.getList(); + } + }, + //重置为第一页 + async resetFilteredData_2() { + this.isReachedBottom = false; // 重置状态,以便下次触发加载更多 + this.filteredData_2.page = 1//当前页码 + this.filteredData_2.limit = 10//每页返回数据条数 + this.filteredData_2.total = 10//数据总条数 + }, + //获取列表-资源分配 + async getList_2(){ + this.loading = true - if(this.segmented_type == 1){ - this.filteredData.is_gh = '2'//2=我的客户 - }else{ - this.filteredData.is_gh = '1'//1=资源分配 + let data = {...this.filteredData_2} + + //判断是否还有数据 + if(this.filteredData_2.page * this.filteredData_2.limit > this.filteredData_2.total){ + this.loading = false + uni.showToast({ + title: '暂无更多', + icon: 'none' + }) + return } - switch (type) { - //全部 - case 1: - this.filteredData.type = '0' - break - //待跟进 - case 2: - this.filteredData.type = '1' - break - //7天未跟进 - case 3: - this.filteredData.type = '2' - break - //30天未成交 - case 4: - this.filteredData.type = '3' - break + if(data.page == 1){ + this.tableList_2 = [] } - await this.getList() + + let res = await marketApi.myClient(data) + this.loading = false + this.isReachedBottom = false; + if (res.code != 1){ + uni.showToast({ + title: res.msg, + icon: 'none' + }) + return + } + + this.tableList_2 = this.tableList_2.concat(res.data.list.data); // 使用 concat 方法 将新数据追加到数组中 + + console.log('列表',this.tableList_2) + this.filteredData_2.total = res.data.list.total + this.filteredData_2.page++ }, + + //切换tag列表 async segmented(index) { this.select_type = 1 this.segmented_type = index.id//1=我的客户,2=资源分配 - //重置为第一页 - await this.resetFilteredData() if(this.segmented_type == 1){ - this.filteredData.is_gh = '2'//2=我的客户 + //我的客户 + //重置为第一页 + await this.resetFilteredData_1() + await this.getList_1() }else{ - this.filteredData.is_gh = '1'//1=资源分配 + //资源分配 + //重置为第一页 + await this.resetFilteredData_2() + await this.getList_2() } - - this.filteredData.type = '0' - await this.getList() }, //跳转页面-我的消息