From 3b2f785c73b2d885e8a83a13f1d3c225935d55e7 Mon Sep 17 00:00:00 2001 From: admin <> Date: Thu, 12 Sep 2024 14:48:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=B6=E6=94=AF=E6=B1=87=E6=80=BB=20?= =?UTF-8?q?=E5=87=BA=E8=B4=A7=E4=BA=A7=E5=93=81=E6=B1=87=E6=80=BB=20?= =?UTF-8?q?=E6=94=B6=E8=B4=A7=E4=BA=A7=E5=93=81=E6=B1=87=E6=80=BB=20?= =?UTF-8?q?=E6=94=B6=E8=B4=A7=E6=B1=87=E6=80=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/PagesStatistics/paymentSummary.vue | 45 +++ src/PagesStatistics/receivePanel.vue | 316 ------------------- src/PagesStatistics/shipmentPanel.vue | 323 -------------------- src/components/Dialog/TimeRangeFilter.vue | 111 +++++++ src/components/Template/summaryTemplate.vue | 285 +++++++++++++++++ src/pages.json | 48 ++- src/pagesHome/count.vue | 28 +- src/pagesHome/index.vue | 42 +-- src/pagesReceiveData/productSummary.vue | 63 ++++ src/pagesReceiveData/summary.vue | 67 ++++ src/pagesShipmentData/productSummary.vue | 70 +++++ src/services/finance.ts | 10 + src/services/receive.ts | 9 + src/utils/enum.ts | 12 +- src/utils/http.ts | 2 +- src/utils/index.ts | 74 ++++- 16 files changed, 812 insertions(+), 693 deletions(-) create mode 100644 src/PagesStatistics/paymentSummary.vue delete mode 100644 src/PagesStatistics/receivePanel.vue delete mode 100644 src/PagesStatistics/shipmentPanel.vue create mode 100644 src/components/Dialog/TimeRangeFilter.vue create mode 100644 src/components/Template/summaryTemplate.vue create mode 100644 src/pagesReceiveData/productSummary.vue create mode 100644 src/pagesReceiveData/summary.vue create mode 100644 src/pagesShipmentData/productSummary.vue diff --git a/src/PagesStatistics/paymentSummary.vue b/src/PagesStatistics/paymentSummary.vue new file mode 100644 index 0000000..a2e6797 --- /dev/null +++ b/src/PagesStatistics/paymentSummary.vue @@ -0,0 +1,45 @@ + + \ No newline at end of file diff --git a/src/PagesStatistics/receivePanel.vue b/src/PagesStatistics/receivePanel.vue deleted file mode 100644 index f8424cb..0000000 --- a/src/PagesStatistics/receivePanel.vue +++ /dev/null @@ -1,316 +0,0 @@ - - - diff --git a/src/PagesStatistics/shipmentPanel.vue b/src/PagesStatistics/shipmentPanel.vue deleted file mode 100644 index c722db6..0000000 --- a/src/PagesStatistics/shipmentPanel.vue +++ /dev/null @@ -1,323 +0,0 @@ - - - diff --git a/src/components/Dialog/TimeRangeFilter.vue b/src/components/Dialog/TimeRangeFilter.vue new file mode 100644 index 0000000..fa753e9 --- /dev/null +++ b/src/components/Dialog/TimeRangeFilter.vue @@ -0,0 +1,111 @@ + + + \ No newline at end of file diff --git a/src/components/Template/summaryTemplate.vue b/src/components/Template/summaryTemplate.vue new file mode 100644 index 0000000..05511ca --- /dev/null +++ b/src/components/Template/summaryTemplate.vue @@ -0,0 +1,285 @@ + + + diff --git a/src/pages.json b/src/pages.json index 83b38e8..eb2b760 100644 --- a/src/pages.json +++ b/src/pages.json @@ -114,6 +114,18 @@ } ] }, + + { + "root": "pagesShipmentData", + "pages": [ + { + "path": "productSummary", + "style": { + "navigationBarTitleText": "出货产品汇总" + } + } + ] + }, { "root": "pagesShipment", "pages": [ @@ -182,24 +194,12 @@ { "root": "pagesStatistics", "pages": [ - { - "path": "receivePanel", - "style": { - "navigationBarTitleText": "收货汇总" - } - }, { "path": "supplierRanking", "style": { "navigationBarTitleText": "供应商排行" } }, - { - "path": "shipmentPanel", - "style": { - "navigationBarTitleText": "出货汇总" - } - }, { "path": "customerRanking", "style": { @@ -241,6 +241,29 @@ "style": { "navigationBarTitleText": "客户详情" } + }, + { + "path": "paymentSummary", + "style": { + "navigationBarTitleText": "收支汇总" + } + }, + ] + }, + { + "root": "pagesReceiveData", + "pages": [ + { + "path": "summary", + "style": { + "navigationBarTitleText": "收货汇总" + } + }, + { + "path": "productSummary", + "style": { + "navigationBarTitleText": "收货产品汇总" + } } ] }, @@ -505,4 +528,5 @@ "backgroundColor": "#F8F8F8" }, "lazyCodeLoading": "requiredComponents" + } diff --git a/src/pagesHome/count.vue b/src/pagesHome/count.vue index 3028399..4fe2ad8 100644 --- a/src/pagesHome/count.vue +++ b/src/pagesHome/count.vue @@ -29,7 +29,7 @@ height="60rpx" > - {{ + {{ child.title }} @@ -63,11 +63,20 @@ const list = reactive([ color: "green", child: [ { - icon: "1.png", + icon: "15.png", title: "收货汇总", fn: (item: any) => { uni.navigateTo({ - url: "/pagesStatistics/receivePanel", // 要跳转到的页面路径 + url: "/pagesReceiveData/summary", // 要跳转到的页面路径 + }); + }, + }, + { + icon: "1.png", + title: "收货产品汇总", + fn: (item: any) => { + uni.navigateTo({ + url: "/pagesReceiveData/productSummary", // 要跳转到的页面路径 }); }, }, @@ -106,10 +115,10 @@ const list = reactive([ child: [ { icon: "5.png", - title: "出货汇总", + title: "出货产品汇总", fn: (item: any) => { uni.navigateTo({ - url: "/pagesStatistics/shipmentPanel", // 要跳转到的页面路径 + url: "/pagesShipmentData/productSummary", // 要跳转到的页面路径 }); }, }, @@ -192,6 +201,15 @@ const list = reactive([ }); }, }, + { + icon: "16.png", + title: "收支汇总", + fn: (item: any) => { + uni.navigateTo({ + url: "/pagesStatistics/paymentSummary", // 要跳转到的页面路径 + }); + }, + }, ], }, ]); diff --git a/src/pagesHome/index.vue b/src/pagesHome/index.vue index 6ee946b..868fa66 100644 --- a/src/pagesHome/index.vue +++ b/src/pagesHome/index.vue @@ -45,13 +45,18 @@ 收货入库 - - + + + + 出货销售 - - + + + - diff --git a/src/pagesReceiveData/productSummary.vue b/src/pagesReceiveData/productSummary.vue new file mode 100644 index 0000000..ea1d363 --- /dev/null +++ b/src/pagesReceiveData/productSummary.vue @@ -0,0 +1,63 @@ + + \ No newline at end of file diff --git a/src/pagesReceiveData/summary.vue b/src/pagesReceiveData/summary.vue new file mode 100644 index 0000000..6c3956f --- /dev/null +++ b/src/pagesReceiveData/summary.vue @@ -0,0 +1,67 @@ + + \ No newline at end of file diff --git a/src/pagesShipmentData/productSummary.vue b/src/pagesShipmentData/productSummary.vue new file mode 100644 index 0000000..190e85b --- /dev/null +++ b/src/pagesShipmentData/productSummary.vue @@ -0,0 +1,70 @@ + + \ No newline at end of file diff --git a/src/services/finance.ts b/src/services/finance.ts index cecaf93..861bfe9 100644 --- a/src/services/finance.ts +++ b/src/services/finance.ts @@ -86,3 +86,13 @@ export const deleteRevenueDes = (data: any) => { data, }) } + +// 收支汇总 +export const getRevenuePaymentPage = (data: any) => { + return http({ + method: 'GET', + url: '/api/revenuedetails/getRevenuePaymentPage', + data, + }) +} + diff --git a/src/services/receive.ts b/src/services/receive.ts index 2d66e3e..e019f23 100644 --- a/src/services/receive.ts +++ b/src/services/receive.ts @@ -136,6 +136,15 @@ export const getTotal = () => { }; +// 收货汇总:根据设备分组 +export const deviceGroupBy = (data:any) => { + return http({ + method: "GET", + url: "/api/orderIn/deviceGroupBy", + data + }); +}; + diff --git a/src/utils/enum.ts b/src/utils/enum.ts index 74ccd0a..0418677 100644 --- a/src/utils/enum.ts +++ b/src/utils/enum.ts @@ -89,12 +89,14 @@ export enum StockCardType { // 今日 昨日 本月 本年 自定义 export enum TimeRange { - Today = 1, + Today = 1, // 今日 Yesterday = 2, - Month = 3, - Year = 4, - Custom = 5, - Week = 6 + Month = 3, // 本月 + Year = 4, // 本年 + Custom = 5, // 自定义 + Week = 6, // 本周 + Quarter = 7 // 本季 + } // 消息跳转类型 0=收货待定价1=收货待审核2=待出库3=出库审核 diff --git a/src/utils/http.ts b/src/utils/http.ts index e3aabc5..a4f712c 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -17,7 +17,7 @@ const obj = { invoke(options: UniApp.RequestOptions) { // 超时时间 options.timeout = 10000; - options.url = baseUrl + '/prod/sh0001' + options.url; + options.url = baseUrl + '/test/sh0001' + options.url; // 请求头标识 // 1.小程序唯一标识 // 'source-client': 'miniapp' diff --git a/src/utils/index.ts b/src/utils/index.ts index 8850567..7b6057f 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -58,17 +58,37 @@ export function getCurrentYearStartAndEnd() { } export function getCurrentWeekStartAndEnd() { - let startTime = getMonday("s", 0); - let endTime = getMonday("e", 0); - let time1 = new Date(getMonday("s", 0)).getTime(); - let time2 = new Date(new Date(new Date().setHours(0, 0, 0))).getTime(); - if (time1 > time2) { - startTime = getMonday("s", -1); - endTime = getMonday("e", -1); - } + // let startTime = getMonday("s", 0); + // let endTime = getMonday("e", 0); + // const time1 = new Date(getMonday("s", 0)).getTime(); + // const time2 = new Date(new Date(new Date().setHours(0, 0, 0))).getTime(); + // if (time1 > time2) { + // startTime = getMonday("s", -1); + // endTime = getMonday("e", -1); + // } + const currentDate = new Date(); + + // 获取本周第一天的日期 + const firstDay = new Date( + currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 1) + ); + + // 获取本周最后一天的日期 + const lastDay = new Date( + currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 7) + ); + + // 格式化日期为字符串,例如:"YYYY-MM-DD" + const format = function (date: any) { + const year = date.getFullYear(); + const month = date.getMonth() + 1; + const day = date.getDate(); + return year + "-" + month + "-" + day; + }; + return { - start: startTime, - end: endTime, + start: format(firstDay), + end: format(lastDay), }; } @@ -94,6 +114,35 @@ function getMonday(type: string, dates: number) { return y + "-" + m + "-" + d; } + +function getQuarterDates(date?:any) { + if (!date) date = new Date(); // 如果没有提供日期,则使用当前日期 + + let quarterStart; + let quarterEnd; + const month = date.getMonth(); // 获取月份,0-11 + + // 计算季度的起始日期和结束日期 + if (month >= 0 && month <= 2) { + quarterStart = new Date(date.getFullYear(), 0, 1); + quarterEnd = new Date(date.getFullYear(), 3, 0); + } else if (month >= 3 && month <= 5) { + quarterStart = new Date(date.getFullYear(), 3, 1); + quarterEnd = new Date(date.getFullYear(), 6, 0); + } else if (month >= 6 && month <= 8) { + quarterStart = new Date(date.getFullYear(), 6, 1); + quarterEnd = new Date(date.getFullYear(), 9, 0); + } else { + quarterStart = new Date(date.getFullYear(), 9, 1); + quarterEnd = new Date(date.getFullYear(), 12, 0); + } + + // 返回季度的起止时间字符串 + return { + start: formatDate(quarterStart, '{y}-{m}-{d}'), + end: formatDate(quarterEnd, '{y}-{m}-{d}') + }; +} export function deleteBaseKey(obj: any) { delete obj.createTime; delete obj.createUserId; @@ -197,7 +246,12 @@ export function timeRange(id: number) { } else if (id === TimeRange.Week) { startTime = formatDate(getCurrentWeekStartAndEnd().start, "{y}-{m}-{d}"); endTime = formatDate(getCurrentWeekStartAndEnd().end, "{y}-{m}-{d}"); + } else if (id === TimeRange.Quarter) { + startTime = formatDate(getQuarterDates().start, "{y}-{m}-{d}"); + endTime = formatDate(getQuarterDates().end, "{y}-{m}-{d}"); } + + return { startTime: startTime, endTime: endTime }; }