diff --git a/antis-ncc-admin/src/views/statisticsList/form12.vue b/antis-ncc-admin/src/views/statisticsList/form12.vue index c39d6cc..a676287 100644 --- a/antis-ncc-admin/src/views/statisticsList/form12.vue +++ b/antis-ncc-admin/src/views/statisticsList/form12.vue @@ -42,23 +42,6 @@ - - - - - - - - @@ -132,6 +115,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 查询 重置 @@ -242,7 +290,10 @@ export default { query: { MemberId: undefined, BelongStoreId: undefined, - BillingStoreId: undefined, + month: undefined, + organizationType: undefined, + departmentId: undefined, + BillingStoreIds: [], BillingUserId: undefined, PurchaseItemId: undefined, GiftItemId: undefined, @@ -252,6 +303,7 @@ export default { memberOptions: [], memberLoading: false, storeOptions: [], + departmentOptions: [], itemOptions: [], memberTypeOptions: [], list: [], @@ -266,15 +318,32 @@ export default { } }, created() { - this.initStoreOptions() + this.setDefaultMonth() + this.loadAllStores() this.initItemOptions() this.initMemberOptions() this.getMemberTypeOptions() this.search() }, + watch: { + // 监听年月变化,重新加载门店列表 + 'query.month'() { + this.$nextTick(() => { + this.initStoreOptions() + }) + } + }, methods: { - // 初始化门店选项 - initStoreOptions() { + // 设置默认年月(当前年月) + setDefaultMonth() { + const now = new Date() + const year = now.getFullYear() + const month = String(now.getMonth() + 1).padStart(2, '0') + this.query.month = `${year}${month}` + }, + + // 加载全部门店(当没有选择部门时) + loadAllStores() { request({ url: '/api/Extend/LqMdxx', method: 'GET', @@ -291,6 +360,112 @@ export default { }) }, + // 获取部门选项(根据组织类型) + loadDepartmentOptions() { + if (!this.query.organizationType) { + this.departmentOptions = [] + return + } + + request({ + url: '/api/Extend/Organize/GetByName', + method: 'GET', + data: { + organizeName: this.query.organizationType + } + }).then(res => { + this.departmentOptions = res.data || [] + // 如果部门ID不在新列表中,清空部门ID + if (this.query.departmentId) { + const exists = this.departmentOptions.some( + dept => (dept.Id || dept.id) === this.query.departmentId + ) + if (!exists) { + this.query.departmentId = undefined + this.query.BillingStoreIds = [] + this.storeOptions = [] + } + } + }).catch(() => { + this.departmentOptions = [] + }) + }, + + // 初始化门店选项(根据组织类型、部门、年月) + initStoreOptions() { + // 如果没有选择部门,加载全部门店 + if (!this.query.departmentId) { + this.loadAllStores() + return + } + + // 如果缺少必要参数,不加载门店列表 + if (!this.query.organizationType || !this.query.month) { + this.storeOptions = [] + return + } + + request({ + url: '/api/Extend/lqmdtarget/GetManagedStores', + method: 'POST', + data: { + month: this.query.month, + organizationType: this.query.organizationType, + departmentId: this.query.departmentId + } + }).then(res => { + if (res.data && Array.isArray(res.data)) { + // 将返回的数据格式转换为 storeOptions 需要的格式 + // 返回格式: [{ StoreId: "...", StoreName: "..." }] + // 需要格式: [{ id: "...", dm: "..." }] + this.storeOptions = res.data.map(store => ({ + id: store.StoreId, + dm: store.StoreName + })) + // 默认选中所有获取到的门店 + this.query.BillingStoreIds = this.storeOptions.map(store => store.id) + } else { + this.storeOptions = [] + this.query.BillingStoreIds = [] + } + }).catch(err => { + console.error('获取门店列表失败:', err) + this.$message({ + type: 'error', + message: '获取门店列表失败', + duration: 1500 + }) + this.storeOptions = [] + this.query.BillingStoreIds = [] + }) + }, + + // 处理年月变化 + handleMonthChange() { + this.$nextTick(() => { + this.initStoreOptions() + }) + }, + + // 处理组织类型变化 + handleOrganizationTypeChange() { + // 清空部门和门店 + this.query.departmentId = undefined + this.query.BillingStoreIds = [] + // 重新加载部门选项 + this.loadDepartmentOptions() + // 加载全部门店(因为部门已清空) + this.loadAllStores() + }, + + // 处理部门变化 + handleDepartmentChange() { + // 清空门店选择 + this.query.BillingStoreIds = [] + // 重新加载门店列表(如果有部门则加载部门管理的门店,否则加载全部门店) + this.initStoreOptions() + }, + // 初始化品项选项 initItemOptions() { request({ @@ -562,13 +737,20 @@ export default { this.query = { MemberId: undefined, BelongStoreId: undefined, - BillingStoreId: undefined, + month: undefined, + organizationType: undefined, + departmentId: undefined, + BillingStoreIds: [], BillingUserId: undefined, PurchaseItemId: undefined, GiftItemId: undefined, ExperienceItemId: undefined, memberType: undefined } + this.setDefaultMonth() + this.departmentOptions = [] + // 重置后加载全部门店 + this.loadAllStores() this.listQuery.currentPage = 1 this.listQuery.pageSize = 20 this.list = [] diff --git a/antis-ncc-admin/src/views/statisticsList/form13.vue b/antis-ncc-admin/src/views/statisticsList/form13.vue index b7fb441..b1c3cc4 100644 --- a/antis-ncc-admin/src/views/statisticsList/form13.vue +++ b/antis-ncc-admin/src/views/statisticsList/form13.vue @@ -111,10 +111,45 @@ + + + + + + + + + + + + + + + + + + @@ -255,7 +290,9 @@ export default { memberId: undefined, itemType: undefined, SourceType: undefined, - storeId: undefined + organizationType: undefined, + departmentId: undefined, + storeIds: [] }, activityOptions: [], itemOptions: [], @@ -263,6 +300,7 @@ export default { memberOptions: [], memberLoading: false, storeOptions: [], + departmentOptions: [], list: [], listLoading: false, total: 0, @@ -278,9 +316,17 @@ export default { this.initItemOptions() this.initItemTypeOptions() this.initMemberOptions() - this.initStoreOptions() + this.loadAllStores() this.search() }, + watch: { + // 监听开始时间变化,重新加载门店列表 + 'query.StartBillingTime'() { + this.$nextTick(() => { + this.initStoreOptions() + }) + } + }, methods: { // 设置默认时间范围(本月1号到现在) setDefaultTimeRange() { @@ -289,6 +335,13 @@ export default { this.query.StartBillingTime = this.formatDate(firstDayOfMonth) this.query.EndBillingTime = this.formatDate(now) + + // 时间设置后,如果有组织类型和部门,重新加载门店列表 + if (this.query.organizationType && this.query.departmentId) { + this.$nextTick(() => { + this.initStoreOptions() + }) + } }, // 初始化开单活动选项 @@ -364,8 +417,8 @@ export default { }) }, - // 初始化门店选项 - initStoreOptions() { + // 加载全部门店(当没有选择部门时) + loadAllStores() { request({ url: '/api/Extend/LqMdxx', method: 'GET', @@ -382,6 +435,116 @@ export default { }) }, + // 获取部门选项(根据组织类型) + loadDepartmentOptions() { + if (!this.query.organizationType) { + this.departmentOptions = [] + return + } + + request({ + url: '/api/Extend/Organize/GetByName', + method: 'GET', + data: { + organizeName: this.query.organizationType + } + }).then(res => { + this.departmentOptions = res.data || [] + // 如果部门ID不在新列表中,清空部门ID + if (this.query.departmentId) { + const exists = this.departmentOptions.some( + dept => (dept.Id || dept.id) === this.query.departmentId + ) + if (!exists) { + this.query.departmentId = undefined + this.query.storeIds = [] + this.storeOptions = [] + } + } + }).catch(() => { + this.departmentOptions = [] + }) + }, + + // 初始化门店选项(根据组织类型、部门、年月) + initStoreOptions() { + // 如果没有选择部门,加载全部门店 + if (!this.query.departmentId) { + this.loadAllStores() + return + } + + // 如果缺少必要参数,不加载门店列表 + if (!this.query.organizationType || !this.query.StartBillingTime) { + this.storeOptions = [] + return + } + + // 从开始时间提取年月(格式:YYYYMM) + // StartBillingTime 格式为 yyyy-MM-dd + const dateStr = this.query.StartBillingTime + if (!dateStr) { + this.storeOptions = [] + return + } + + // 提取年月,格式:YYYYMM + const monthStr = dateStr.substring(0, 4) + dateStr.substring(5, 7) + + request({ + url: '/api/Extend/lqmdtarget/GetManagedStores', + method: 'POST', + data: { + month: monthStr, + organizationType: this.query.organizationType, + departmentId: this.query.departmentId + } + }).then(res => { + if (res.data && Array.isArray(res.data)) { + // 将返回的数据格式转换为 storeOptions 需要的格式 + // 返回格式: [{ StoreId: "...", StoreName: "..." }] + // 需要格式: [{ id: "...", dm: "..." }] + this.storeOptions = res.data.map(store => ({ + id: store.StoreId, + dm: store.StoreName + })) + // 默认选中所有获取到的门店 + this.query.storeIds = this.storeOptions.map(store => store.id) + } else { + this.storeOptions = [] + this.query.storeIds = [] + } + }).catch(err => { + console.error('获取门店列表失败:', err) + this.$message({ + type: 'error', + message: '获取门店列表失败', + duration: 1500 + }) + this.storeOptions = [] + this.query.storeIds = [] + }) + }, + + // 处理组织类型变化 + handleOrganizationTypeChange() { + // 清空部门和门店 + this.query.departmentId = undefined + this.query.storeIds = [] + // 重新加载部门选项 + this.loadDepartmentOptions() + // 加载全部门店(因为部门已清空) + this.loadAllStores() + }, + + // 处理部门变化 + handleDepartmentChange() { + // 清空门店选择 + this.query.storeIds = [] + // 重新加载门店列表(如果有部门则加载部门管理的门店,否则加载全部门店) + this.initStoreOptions() + }, + // 会员远程搜索 remoteMemberMethod(query) { if (query !== '') { @@ -445,8 +608,8 @@ export default { if (this.query.SourceType) { params.SourceType = this.query.SourceType } - if (this.query.storeId) { - params.StoreId = this.query.storeId + if (this.query.storeIds && this.query.storeIds.length > 0) { + params.StoreIds = this.query.storeIds } request({ @@ -485,9 +648,14 @@ export default { memberId: undefined, itemType: undefined, SourceType: undefined, - storeId: undefined + organizationType: undefined, + departmentId: undefined, + storeIds: [] } this.setDefaultTimeRange() + this.departmentOptions = [] + // 重置后加载全部门店 + this.loadAllStores() this.listQuery.currentPage = 1 this.listQuery.pageSize = 20 this.list = [] diff --git a/antis-ncc-admin/src/views/statisticsList/form14.vue b/antis-ncc-admin/src/views/statisticsList/form14.vue index 04f7674..f4a0869 100644 --- a/antis-ncc-admin/src/views/statisticsList/form14.vue +++ b/antis-ncc-admin/src/views/statisticsList/form14.vue @@ -94,10 +94,45 @@ + + + + + + + + + + + + + + + + + + @@ -222,13 +257,16 @@ export default { MemberId: undefined, ItemType: undefined, SourceType: undefined, - StoreId: undefined + organizationType: undefined, + departmentId: undefined, + StoreIds: [] }, itemOptions: [], itemTypeOptions: [], memberOptions: [], memberLoading: false, storeOptions: [], + departmentOptions: [], list: [], listLoading: false, total: 0, @@ -243,9 +281,17 @@ export default { this.initItemOptions() this.initItemTypeOptions() this.initMemberOptions() - this.initStoreOptions() + this.loadAllStores() this.search() }, + watch: { + // 监听开始时间变化,重新加载门店列表 + 'query.StartConsumeTime'() { + this.$nextTick(() => { + this.initStoreOptions() + }) + } + }, methods: { // 设置默认时间范围(本月1号到现在) setDefaultTimeRange() { @@ -254,6 +300,13 @@ export default { this.query.StartConsumeTime = this.formatDate(firstDayOfMonth) this.query.EndConsumeTime = this.formatDate(now) + + // 时间设置后,如果有组织类型和部门,重新加载门店列表 + if (this.query.organizationType && this.query.departmentId) { + this.$nextTick(() => { + this.initStoreOptions() + }) + } }, // 初始化品项选项 @@ -311,8 +364,8 @@ export default { }) }, - // 初始化门店选项 - initStoreOptions() { + // 加载全部门店(当没有选择部门时) + loadAllStores() { request({ url: '/api/Extend/LqMdxx', method: 'GET', @@ -329,6 +382,116 @@ export default { }) }, + // 获取部门选项(根据组织类型) + loadDepartmentOptions() { + if (!this.query.organizationType) { + this.departmentOptions = [] + return + } + + request({ + url: '/api/Extend/Organize/GetByName', + method: 'GET', + data: { + organizeName: this.query.organizationType + } + }).then(res => { + this.departmentOptions = res.data || [] + // 如果部门ID不在新列表中,清空部门ID + if (this.query.departmentId) { + const exists = this.departmentOptions.some( + dept => (dept.Id || dept.id) === this.query.departmentId + ) + if (!exists) { + this.query.departmentId = undefined + this.query.StoreIds = [] + this.storeOptions = [] + } + } + }).catch(() => { + this.departmentOptions = [] + }) + }, + + // 初始化门店选项(根据组织类型、部门、年月) + initStoreOptions() { + // 如果没有选择部门,加载全部门店 + if (!this.query.departmentId) { + this.loadAllStores() + return + } + + // 如果缺少必要参数,不加载门店列表 + if (!this.query.organizationType || !this.query.StartConsumeTime) { + this.storeOptions = [] + return + } + + // 从开始时间提取年月(格式:YYYYMM) + // StartConsumeTime 格式为 yyyy-MM-dd + const dateStr = this.query.StartConsumeTime + if (!dateStr) { + this.storeOptions = [] + return + } + + // 提取年月,格式:YYYYMM + const monthStr = dateStr.substring(0, 4) + dateStr.substring(5, 7) + + request({ + url: '/api/Extend/lqmdtarget/GetManagedStores', + method: 'POST', + data: { + month: monthStr, + organizationType: this.query.organizationType, + departmentId: this.query.departmentId + } + }).then(res => { + if (res.data && Array.isArray(res.data)) { + // 将返回的数据格式转换为 storeOptions 需要的格式 + // 返回格式: [{ StoreId: "...", StoreName: "..." }] + // 需要格式: [{ id: "...", dm: "..." }] + this.storeOptions = res.data.map(store => ({ + id: store.StoreId, + dm: store.StoreName + })) + // 默认选中所有获取到的门店 + this.query.StoreIds = this.storeOptions.map(store => store.id) + } else { + this.storeOptions = [] + this.query.StoreIds = [] + } + }).catch(err => { + console.error('获取门店列表失败:', err) + this.$message({ + type: 'error', + message: '获取门店列表失败', + duration: 1500 + }) + this.storeOptions = [] + this.query.StoreIds = [] + }) + }, + + // 处理组织类型变化 + handleOrganizationTypeChange() { + // 清空部门和门店 + this.query.departmentId = undefined + this.query.StoreIds = [] + // 重新加载部门选项 + this.loadDepartmentOptions() + // 加载全部门店(因为部门已清空) + this.loadAllStores() + }, + + // 处理部门变化 + handleDepartmentChange() { + // 清空门店选择 + this.query.StoreIds = [] + // 重新加载门店列表(如果有部门则加载部门管理的门店,否则加载全部门店) + this.initStoreOptions() + }, + // 会员远程搜索 remoteMemberMethod(query) { if (query !== '') { @@ -390,8 +553,8 @@ export default { params.SourceType = this.query.SourceType } - if (this.query.StoreId) { - params.StoreId = this.query.StoreId + if (this.query.StoreIds && this.query.StoreIds.length > 0) { + params.StoreIds = this.query.StoreIds } request({ @@ -429,9 +592,14 @@ export default { MemberId: undefined, ItemType: undefined, SourceType: undefined, - StoreId: undefined + organizationType: undefined, + departmentId: undefined, + StoreIds: [] } this.setDefaultTimeRange() + this.departmentOptions = [] + // 重置后加载全部门店 + this.loadAllStores() this.listQuery.currentPage = 1 this.listQuery.pageSize = 10 this.list = [] diff --git a/antis-ncc-admin/src/views/statisticsList/form17.vue b/antis-ncc-admin/src/views/statisticsList/form17.vue index 7cbb676..fdc463a 100644 --- a/antis-ncc-admin/src/views/statisticsList/form17.vue +++ b/antis-ncc-admin/src/views/statisticsList/form17.vue @@ -4,7 +4,7 @@ - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 查询 重置 @@ -146,10 +211,16 @@ export default { memberIds: [], hasUpgradeMedicalBeauty: null, hasUpgradeTechBeauty: null, - hasUpgradeLifeBeauty: null + hasUpgradeLifeBeauty: null, + month: undefined, + organizationType: undefined, + departmentId: undefined, + storeIds: [] }, memberOptions: [], memberLoading: false, + storeOptions: [], + departmentOptions: [], list: [], listLoading: false, total: 0, @@ -160,10 +231,152 @@ export default { } }, created() { + this.setDefaultMonth() + this.loadAllStores() this.initMemberOptions() this.search() }, + watch: { + // 监听年月变化,重新加载门店列表 + 'query.month'() { + this.$nextTick(() => { + this.initStoreOptions() + }) + } + }, methods: { + // 设置默认年月(当前年月) + setDefaultMonth() { + const now = new Date() + const year = now.getFullYear() + const month = String(now.getMonth() + 1).padStart(2, '0') + this.query.month = `${year}${month}` + }, + + // 加载全部门店(当没有选择部门时) + loadAllStores() { + request({ + url: '/api/Extend/LqMdxx', + method: 'GET', + data: { + currentPage: 1, + pageSize: 1000 + } + }).then(res => { + if (res.data && res.data.list) { + this.storeOptions = res.data.list + } + }).catch(() => { + this.storeOptions = [] + }) + }, + + // 获取部门选项(根据组织类型) + loadDepartmentOptions() { + if (!this.query.organizationType) { + this.departmentOptions = [] + return + } + + request({ + url: '/api/Extend/Organize/GetByName', + method: 'GET', + data: { + organizeName: this.query.organizationType + } + }).then(res => { + this.departmentOptions = res.data || [] + // 如果部门ID不在新列表中,清空部门ID + if (this.query.departmentId) { + const exists = this.departmentOptions.some( + dept => (dept.Id || dept.id) === this.query.departmentId + ) + if (!exists) { + this.query.departmentId = undefined + this.query.storeIds = [] + this.storeOptions = [] + } + } + }).catch(() => { + this.departmentOptions = [] + }) + }, + + // 初始化门店选项(根据组织类型、部门、年月) + initStoreOptions() { + // 如果没有选择部门,加载全部门店 + if (!this.query.departmentId) { + this.loadAllStores() + return + } + + // 如果缺少必要参数,不加载门店列表 + if (!this.query.organizationType || !this.query.month) { + this.storeOptions = [] + return + } + + request({ + url: '/api/Extend/lqmdtarget/GetManagedStores', + method: 'POST', + data: { + month: this.query.month, + organizationType: this.query.organizationType, + departmentId: this.query.departmentId + } + }).then(res => { + if (res.data && Array.isArray(res.data)) { + // 将返回的数据格式转换为 storeOptions 需要的格式 + // 返回格式: [{ StoreId: "...", StoreName: "..." }] + // 需要格式: [{ id: "...", dm: "..." }] + this.storeOptions = res.data.map(store => ({ + id: store.StoreId, + dm: store.StoreName + })) + // 默认选中所有获取到的门店 + this.query.storeIds = this.storeOptions.map(store => store.id) + } else { + this.storeOptions = [] + this.query.storeIds = [] + } + }).catch(err => { + console.error('获取门店列表失败:', err) + this.$message({ + type: 'error', + message: '获取门店列表失败', + duration: 1500 + }) + this.storeOptions = [] + this.query.storeIds = [] + }) + }, + + // 处理年月变化 + handleMonthChange() { + this.$nextTick(() => { + this.initStoreOptions() + }) + }, + + // 处理组织类型变化 + handleOrganizationTypeChange() { + // 清空部门和门店 + this.query.departmentId = undefined + this.query.storeIds = [] + // 重新加载部门选项 + this.loadDepartmentOptions() + // 加载全部门店(因为部门已清空) + this.loadAllStores() + }, + + // 处理部门变化 + handleDepartmentChange() { + // 清空门店选择 + this.query.storeIds = [] + // 重新加载门店列表(如果有部门则加载部门管理的门店,否则加载全部门店) + this.initStoreOptions() + }, + // 初始化会员选项(加载前10个) initMemberOptions() { request({ @@ -244,6 +457,10 @@ export default { params.hasUpgradeLifeBeauty = this.query.hasUpgradeLifeBeauty } + if (this.query.storeIds && this.query.storeIds.length > 0) { + params.storeIds = this.query.storeIds + } + request({ url: '/api/Extend/lqstatistics/get-member-upgrade-statistics-list', method: 'POST', @@ -283,8 +500,16 @@ export default { memberIds: [], hasUpgradeMedicalBeauty: null, hasUpgradeTechBeauty: null, - hasUpgradeLifeBeauty: null + hasUpgradeLifeBeauty: null, + month: undefined, + organizationType: undefined, + departmentId: undefined, + storeIds: [] } + this.setDefaultMonth() + this.departmentOptions = [] + // 重置后加载全部门店 + this.loadAllStores() this.listQuery.pageIndex = 1 this.listQuery.pageSize = 10 this.list = [] diff --git a/antis-ncc-admin/src/views/statisticsList/form18.vue b/antis-ncc-admin/src/views/statisticsList/form18.vue index f1b4072..1e8725b 100644 --- a/antis-ncc-admin/src/views/statisticsList/form18.vue +++ b/antis-ncc-admin/src/views/statisticsList/form18.vue @@ -5,23 +5,6 @@ - - - - - - - - @@ -104,6 +88,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 查询 重置 @@ -238,7 +274,9 @@ export default { data() { return { query: { - StoreId: undefined, + organizationType: undefined, + departmentId: undefined, + StoreIds: [], StartTime: undefined, EndTime: undefined, ItemId: undefined, @@ -247,6 +285,7 @@ export default { MaxAmount: undefined }, storeOptions: [], + departmentOptions: [], itemOptions: [], itemCategoryOptions: [], list: [], @@ -285,11 +324,19 @@ export default { }, created() { this.setDefaultTimeRange() - this.initStoreOptions() + this.loadAllStores() this.initItemOptions() this.initItemCategoryOptions() this.search() }, + watch: { + // 监听开始时间变化,重新加载门店列表 + 'query.StartTime'() { + this.$nextTick(() => { + this.initStoreOptions() + }) + } + }, methods: { // 设置默认时间范围(本月1号到现在) setDefaultTimeRange() { @@ -297,10 +344,17 @@ export default { const firstDayOfMonth = new Date(now.getFullYear(), now.getMonth(), 1) this.query.StartTime = this.formatDate(firstDayOfMonth) this.query.EndTime = this.formatDate(now) + + // 时间设置后,如果有组织类型和部门,重新加载门店列表 + if (this.query.organizationType && this.query.departmentId) { + this.$nextTick(() => { + this.initStoreOptions() + }) + } }, - // 初始化门店选项 - initStoreOptions() { + // 加载全部门店(当没有选择部门时) + loadAllStores() { request({ url: '/api/Extend/LqMdxx', method: 'GET', @@ -317,6 +371,123 @@ export default { }) }, + // 获取部门选项(根据组织类型) + loadDepartmentOptions() { + if (!this.query.organizationType) { + this.departmentOptions = [] + return + } + + request({ + url: '/api/Extend/Organize/GetByName', + method: 'GET', + data: { + organizeName: this.query.organizationType + } + }).then(res => { + this.departmentOptions = res.data || [] + // 如果部门ID不在新列表中,清空部门ID + if (this.query.departmentId) { + const exists = this.departmentOptions.some( + dept => (dept.Id || dept.id) === this.query.departmentId + ) + if (!exists) { + this.query.departmentId = undefined + this.query.StoreIds = [] + this.storeOptions = [] + } + } + }).catch(() => { + this.departmentOptions = [] + }) + }, + + // 初始化门店选项(根据组织类型、部门、年月) + initStoreOptions() { + // 如果没有选择部门,加载全部门店 + if (!this.query.departmentId) { + this.loadAllStores() + return + } + + // 如果缺少必要参数,不加载门店列表 + if (!this.query.organizationType || !this.query.StartTime) { + this.storeOptions = [] + return + } + + // 从开始时间提取年月(格式:YYYYMM) + // StartTime 格式为 yyyy-MM-dd + const dateStr = this.query.StartTime + if (!dateStr) { + this.storeOptions = [] + return + } + + // 提取年月,格式:YYYYMM + const monthStr = dateStr.substring(0, 4) + dateStr.substring(5, 7) + + request({ + url: '/api/Extend/lqmdtarget/GetManagedStores', + method: 'POST', + data: { + month: monthStr, + organizationType: this.query.organizationType, + departmentId: this.query.departmentId + } + }).then(res => { + if (res.data && Array.isArray(res.data)) { + // 将返回的数据格式转换为 storeOptions 需要的格式 + // 返回格式: [{ StoreId: "...", StoreName: "..." }] + // 需要格式: [{ id: "...", dm: "..." }] + this.storeOptions = res.data.map(store => ({ + id: store.StoreId, + dm: store.StoreName + })) + // 默认选中所有获取到的门店 + this.query.StoreIds = this.storeOptions.map(store => store.id) + } else { + this.storeOptions = [] + this.query.StoreIds = [] + } + }).catch(err => { + console.error('获取门店列表失败:', err) + this.$message({ + type: 'error', + message: '获取门店列表失败', + duration: 1500 + }) + this.storeOptions = [] + this.query.StoreIds = [] + }) + }, + + // 处理开始时间变化 + handleStartTimeChange() { + this.$nextTick(() => { + this.initStoreOptions() + }) + }, + + // 处理组织类型变化 + handleOrganizationTypeChange() { + // 清空部门和门店 + this.query.departmentId = undefined + this.query.StoreIds = [] + // 重新加载部门选项 + this.loadDepartmentOptions() + // 加载全部门店(因为部门已清空) + this.loadAllStores() + }, + + // 处理部门变化 + handleDepartmentChange() { + // 清空门店选择 + this.query.StoreIds = [] + // 重新加载门店列表(如果有部门则加载部门管理的门店,否则加载全部门店) + this.initStoreOptions() + }, + // 初始化品项选项 initItemOptions() { request({ @@ -367,8 +538,8 @@ export default { params.ItemId = this.query.ItemId } - if (this.query.StoreId) { - params.StoreId = this.query.StoreId + if (this.query.StoreIds && this.query.StoreIds.length > 0) { + params.StoreIds = this.query.StoreIds } if (this.query.StartTime) { @@ -427,7 +598,9 @@ export default { // 重置查询条件 reset() { this.query = { - StoreId: undefined, + organizationType: undefined, + departmentId: undefined, + StoreIds: [], StartTime: undefined, EndTime: undefined, ItemId: undefined, @@ -436,6 +609,9 @@ export default { MaxAmount: undefined } this.setDefaultTimeRange() + this.departmentOptions = [] + // 重置后加载全部门店 + this.loadAllStores() this.listQuery.currentPage = 1 this.listQuery.pageSize = 10 this.list = [] diff --git a/antis-ncc-admin/src/views/statisticsList/form20.vue b/antis-ncc-admin/src/views/statisticsList/form20.vue index 8fdba6c..9f969c5 100644 --- a/antis-ncc-admin/src/views/statisticsList/form20.vue +++ b/antis-ncc-admin/src/views/statisticsList/form20.vue @@ -3,7 +3,7 @@ - + + + + + + + + + 查询 重置 @@ -139,14 +156,16 @@ export default { data() { return { query: { - month: '' + month: '', + departmentId: '' }, list: [], originalList: [], // 保存原始数据,用于取消排序时恢复 listLoading: false, summaryData: null, sortProp: '', - sortOrder: '' + sortOrder: '', + departmentOptions: [] // 部门选项列表 } }, computed: { @@ -158,6 +177,7 @@ export default { }, created() { this.setDefaultMonth() + this.loadDepartmentOptions() this.search() }, methods: { @@ -190,6 +210,11 @@ export default { Month: parseInt(month) } + // 如果选择了部门,添加部门筛选参数 + if (this.query.departmentId) { + params.DepartmentId = this.query.departmentId + } + request({ url: '/api/Extend/lqtechteachersalary/statistics', method: 'GET', @@ -306,6 +331,7 @@ export default { // 重置查询条件 reset() { this.setDefaultMonth() + this.query.departmentId = '' this.list = [] this.originalList = [] this.summaryData = null @@ -314,6 +340,21 @@ export default { this.search() }, + // 加载部门选项(科技部) + loadDepartmentOptions() { + request({ + url: '/api/Extend/Organize/GetByName', + method: 'GET', + data: { + organizeName: '科技部' + } + }).then(res => { + this.departmentOptions = res.data || [] + }).catch(() => { + this.departmentOptions = [] + }) + }, + // 格式化金额 formatMoney(amount) { if (amount === null || amount === undefined || amount === '') { diff --git a/antis-ncc-admin/src/views/statisticsList/form21.vue b/antis-ncc-admin/src/views/statisticsList/form21.vue new file mode 100644 index 0000000..8d57715 --- /dev/null +++ b/antis-ncc-admin/src/views/statisticsList/form21.vue @@ -0,0 +1,920 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 查询 + 重置 + 导出Excel + + + + + + + + + + + + {{ scope.row.storeName || '无' }} + + + + + + {{ scope.row.memberName || '无' }} + + + + + + {{ scope.row.memberPhone || '无' }} + + + + + + {{ formatDateTime(scope.row.refundTime) || '无' }} + + + + + + {{ scope.row.itemName || '无' }} + + + + + {{ scope.row.refundQuantity || 0 }} + + + + + ¥{{ formatMoney(scope.row.unitPrice) }} + + + + + ¥{{ formatMoney(scope.row.totalPrice) }} + + + + + {{ scope.row.performanceType || '无' }} + + + + + {{ scope.row.beautyType || '无' }} + + + + + + {{ scope.row.sourceType || '无' }} + + + + + + + {{ scope.row.itemCategory || '无' }} + + + + + + + + + + + + + + diff --git a/antis-ncc-admin/src/views/statisticsList/form7.vue b/antis-ncc-admin/src/views/statisticsList/form7.vue index c9a29d6..aee043e 100644 --- a/antis-ncc-admin/src/views/statisticsList/form7.vue +++ b/antis-ncc-admin/src/views/statisticsList/form7.vue @@ -5,20 +5,6 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + 查询 重置 @@ -151,7 +189,7 @@ 总人头数 - {{ summaryData.totalHeadCount || 0 }} + {{ formatNumber(summaryData.totalHeadCount) }} @@ -162,7 +200,7 @@ 总人次 - {{ summaryData.totalPersonCount || 0 }} + {{ formatNumber(summaryData.totalPersonCount) }} @@ -312,8 +350,9 @@ export default { data() { return { query: { - storeId: undefined, + organizationType: undefined, departmentId: undefined, + storeIds: [], startTime: undefined, endTime: undefined, currentPage: 1, @@ -334,17 +373,25 @@ export default { } else{ this.restoreQueryParams() } - this.initStoreOptions() - this.initDepartmentOptions() + this.loadAllStores() this.search() }, + watch: { + // 监听开始时间变化,重新加载门店列表 + 'query.startTime'() { + this.$nextTick(() => { + this.initStoreOptions() + }) + } + }, methods: { // 保存筛选条件到 sessionStorage saveQueryParams() { try { const paramsToSave = { - storeId: this.query.storeId, + organizationType: this.query.organizationType, departmentId: this.query.departmentId, + storeIds: this.query.storeIds, startTime: this.query.startTime, endTime: this.query.endTime, currentPage: this.query.currentPage, @@ -364,8 +411,9 @@ export default { if (savedParams) { const params = JSON.parse(savedParams) // 恢复筛选条件 - this.query.storeId = params.storeId || undefined + this.query.organizationType = params.organizationType || undefined this.query.departmentId = params.departmentId || undefined + this.query.storeIds = params.storeIds || [] this.query.startTime = params.startTime || undefined this.query.endTime = params.endTime || undefined this.query.currentPage = params.currentPage || 1 @@ -375,6 +423,19 @@ export default { if (!this.query.startTime || !this.query.endTime) { this.setDefaultTimeRange() } + + // 恢复部门选项和门店列表 + if (this.query.organizationType) { + this.loadDepartmentOptions() + } + if (this.query.departmentId && this.query.organizationType && this.query.startTime) { + this.$nextTick(() => { + this.initStoreOptions() + }) + } else { + this.loadAllStores() + } + sessionStorage.setItem('isshaixuan', false) } else { // 没有保存的条件,设置默认时间范围 @@ -394,10 +455,17 @@ export default { this.query.startTime = this.formatDateTime(firstDayOfMonth.getTime()) this.query.endTime = this.formatDateTime(now.getTime()) + + // 时间设置后,如果有组织类型和部门,重新加载门店列表 + if (this.query.organizationType && this.query.departmentId) { + this.$nextTick(() => { + this.initStoreOptions() + }) + } }, - // 初始化门店选项 - initStoreOptions() { + // 加载全部门店(当没有选择部门时) + loadAllStores() { request({ url: '/api/Extend/LqMdxx', method: 'GET', @@ -409,25 +477,120 @@ export default { this.storeOptions = res.data.list || [] }).catch(err => { console.error('获取门店列表失败:', err) + this.storeOptions = [] }) }, - // 初始化部门选项 - initDepartmentOptions() { + // 获取部门选项(根据组织类型) + loadDepartmentOptions() { + if (!this.query.organizationType) { + this.departmentOptions = [] + return + } + request({ - url: '/api/permission/Organize/96240625-934F-490B-8AA6-0BC775B18468/Department', - method: 'GET' + url: '/api/Extend/Organize/GetByName', + method: 'GET', + data: { + organizeName: this.query.organizationType + } + }).then(res => { + this.departmentOptions = res.data || [] + // 如果部门ID不在新列表中,清空部门ID + if (this.query.departmentId) { + const exists = this.departmentOptions.some( + dept => (dept.Id || dept.id) === this.query.departmentId + ) + if (!exists) { + this.query.departmentId = undefined + this.query.storeIds = [] + this.storeOptions = [] + } + } + }).catch(() => { + this.departmentOptions = [] + }) + }, + + // 初始化门店选项(根据组织类型、部门、年月) + initStoreOptions() { + // 如果没有选择部门,加载全部门店 + if (!this.query.departmentId) { + this.loadAllStores() + return + } + + // 如果缺少必要参数,不加载门店列表 + if (!this.query.organizationType || !this.query.startTime) { + this.storeOptions = [] + return + } + + // 从开始时间提取年月(格式:YYYYMM) + // startTime 格式为 yyyy-MM-dd HH:mm:ss + const dateStr = this.query.startTime + if (!dateStr) { + this.storeOptions = [] + return + } + + // 提取年月,格式:YYYYMM + const monthStr = dateStr.substring(0, 4) + dateStr.substring(5, 7) + + request({ + url: '/api/Extend/lqmdtarget/GetManagedStores', + method: 'POST', + data: { + month: monthStr, + organizationType: this.query.organizationType, + departmentId: this.query.departmentId + } }).then(res => { - // 将树形结构扁平化 - this.departmentOptions = res.data.list.map(item => ({ - id: item.id, - fullName: item.fullName - })) + if (res.data && Array.isArray(res.data)) { + // 将返回的数据格式转换为 storeOptions 需要的格式 + // 返回格式: [{ StoreId: "...", StoreName: "..." }] + // 需要格式: [{ id: "...", dm: "..." }] + this.storeOptions = res.data.map(store => ({ + id: store.StoreId, + dm: store.StoreName + })) + // 默认选中所有获取到的门店 + this.query.storeIds = this.storeOptions.map(store => store.id) + } else { + this.storeOptions = [] + this.query.storeIds = [] + } }).catch(err => { - console.error('获取部门列表失败:', err) + console.error('获取门店列表失败:', err) + this.$message({ + type: 'error', + message: '获取门店列表失败', + duration: 1500 + }) + this.storeOptions = [] + this.query.storeIds = [] }) }, + // 处理组织类型变化 + handleOrganizationTypeChange() { + // 清空部门和门店 + this.query.departmentId = undefined + this.query.storeIds = [] + // 重新加载部门选项 + this.loadDepartmentOptions() + // 加载全部门店(因为部门已清空) + this.loadAllStores() + }, + + // 处理部门变化 + handleDepartmentChange() { + // 清空门店选择 + this.query.storeIds = [] + // 重新加载门店列表(如果有部门则加载部门管理的门店,否则加载全部门店) + this.initStoreOptions() + }, + // 查询数据 @@ -441,8 +604,8 @@ export default { pageSize: this.query.pageSize } - if (this.query.storeId) { - params.StoreId = this.query.storeId + if (this.query.storeIds && this.query.storeIds.length > 0) { + params.StoreIds = this.query.storeIds } if (this.query.departmentId) { @@ -530,14 +693,18 @@ export default { // 重置查询条件 reset() { this.query = { - storeId: undefined, + organizationType: undefined, departmentId: undefined, + storeIds: [], startTime: undefined, endTime: undefined, currentPage: 1, pageSize: 20 } this.setDefaultTimeRange() + this.departmentOptions = [] + // 重置后加载全部门店 + this.loadAllStores() // 清除保存的筛选条件 try { sessionStorage.removeItem('form7_query_params') @@ -556,6 +723,14 @@ export default { return Number(amount).toFixed(2) }, + // 格式化数字,保留两位小数 + formatNumber(num) { + if (num === null || num === undefined || num === '') return '0.00' + const value = Number(num) + if (isNaN(value)) return '0.00' + return value.toFixed(2) + }, + // 格式化百分比 formatPercentage(ratio) { if (ratio === null || ratio === undefined) return '0.00%' diff --git a/绿纤uni-app/apis/modules/store.js b/绿纤uni-app/apis/modules/store.js new file mode 100644 index 0000000..19417f0 --- /dev/null +++ b/绿纤uni-app/apis/modules/store.js @@ -0,0 +1,20 @@ +import request from '@/service/request.js' +import config from '@/common/config.js' + +export default { + // 获取门店列表 + getStoreList(params) { + return request.get(`${config.getApiBaseUrl()}/api/Extend/LqMdxx`, params); + }, + + // 获取门店详情 + getStoreDetail(id) { + return request.get(`${config.getApiBaseUrl()}/api/Extend/LqMdxx/${id}`); + }, + + // 更新门店信息 + updateStore(id, data) { + return request.put(`${config.getApiBaseUrl()}/api/Extend/LqMdxx/${id}`, data); + } +} + diff --git a/绿纤uni-app/common/config.js b/绿纤uni-app/common/config.js index 6594ec3..36cb2fd 100644 --- a/绿纤uni-app/common/config.js +++ b/绿纤uni-app/common/config.js @@ -10,8 +10,8 @@ const ENV_CONFIG = { // 正式环境 production: { name: '正式环境', - // apiBaseUrl: 'http://erp_test.lvqianmeiye.com', - apiBaseUrl: 'https://erp.lvqianmeiye.com', + apiBaseUrl: 'http://erp_test.lvqianmeiye.com', + // apiBaseUrl: 'https://erp.lvqianmeiye.com', description: '生产环境服务器' } }; diff --git a/绿纤uni-app/pages.json b/绿纤uni-app/pages.json index ba6690a..44496ee 100644 --- a/绿纤uni-app/pages.json +++ b/绿纤uni-app/pages.json @@ -314,6 +314,13 @@ { "navigationBarTitleText" : "报销审核详情" } + }, + { + "path" : "pages/store-list/store-list", + "style" : + { + "navigationBarTitleText" : "门店管理" + } } ], "globalStyle": { diff --git a/绿纤uni-app/pages/index/index.vue b/绿纤uni-app/pages/index/index.vue index 5c544f7..19522dc 100644 --- a/绿纤uni-app/pages/index/index.vue +++ b/绿纤uni-app/pages/index/index.vue @@ -152,6 +152,12 @@ 毛巾记录 + + + + + 门店管理 + diff --git a/绿纤uni-app/pages/store-list/store-list.vue b/绿纤uni-app/pages/store-list/store-list.vue new file mode 100644 index 0000000..ada989d --- /dev/null +++ b/绿纤uni-app/pages/store-list/store-list.vue @@ -0,0 +1,732 @@ + + + + + + + + + + + + + {{ store.dm || '无' }} + + {{ store.zxzt || '无' }} + + + + + 单据门店 + {{ store.djmd || '无' }} + + + 城市 + {{ store.cs || '无' }} + + + + + 联系人 + {{ store.xm || '无' }} + + + 联系电话 + {{ store.dhhm || '无' }} + + + + + 座机 + {{ store.zj || '无' }} + + + 在职人数 + {{ store.zzrs || 0 }}人 + + + + + 开业时间 + {{ formatDate(store.kysj) }} + + + + + 地址 + {{ store.dz || '无' }} + + + + 修改在职人数 + + + + + + + + 正在加载门店数据... + + + + + + 正在加载更多... + + + + + 已加载全部数据 + + + + + 🏪 + 暂无门店数据 + 请稍后再试或联系管理员 + + + + + 🔍 + 未找到匹配的门店 + 请尝试其他搜索关键词 + + + + + + + 修改在职人数 + + + + 门店名称 + {{ currentStore.dm || '无' }} + + + 在职人数 + + + + + 取消 + + 确定 + + + + + + + + + + +