update: 更新经营概况

This commit is contained in:
admin 2024-04-08 09:52:52 +08:00
parent 5add2a7e6b
commit dab730d30e
24 changed files with 785 additions and 351 deletions

View File

@ -0,0 +1,153 @@
<template>
<view class="c-card">
<page-view
@loadList="
(v) => {
getList(v);
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="0"
:isLoading="pageList.isLoading"
>
<view
v-for="(item, index) in pageList.list"
:key="index"
@click="getDetail(item)"
class="box"
>
<view class="bill">
<view
>{{ state.type === "1" ? "收货" : "出货" }}单号{{
state.type === "1" ? item.receiptNumber : item.orderNumber
}}</view
>
<view
>{{ state.type === "1" ? "应付" : "应收" }}金额<text class="num"
>¥{{
state.type === "1" ? item.balanceTotalPrice : item.totalPrice
}}</text
></view
>
</view>
<view class="time"> {{ item.createTime }} </view>
</view>
</page-view>
</view>
</template>
<script setup lang="ts">
import PageView from "@/components/PageView/index.vue";
import { ReceiveApi, ShipmentApi } from "@/services";
import { ScaleStatus } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app";
const pageList: PageResult<Order> = reactive({
isLoading: false,
noMoreData: false,
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const state = reactive({
id: "",
type: "",
name: "",
});
const getDetail = (item: Order | Shipment) => {
uni.navigateTo({
url: `/pagesStatistics/${
state.type === "1" ? "supplier" : "customer"
}/detail?name=${state.name}&obj=${JSON.stringify(item)}`, // 要跳转到的页面路径
});
};
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
pageList.isLoading = true;
let params: any = {
pageSize: pageList.pageSize,
pageNumber: pageList.pageNum,
scaleStatus: ScaleStatus.ToBePay,
};
if (state.id) {
params.userId = state.id;
}
if (state.type === "1") {
ReceiveApi.getOrderPage(params).then((res) => {
if (res.code === 200) {
(pageList as any).list = (res.data.list as any).map((item: any) => {
return { ...item, isChecked: false };
});
pageList.total = (res.data as any).total;
pageList.isLoading = false;
}
});
} else if (state.type === "2") {
ShipmentApi.getOrderPage(params).then((res) => {
if (res.code === 200) {
(pageList as any).list = (res.data.list as any).map((item: any) => {
return { ...item, isChecked: false };
});
pageList.total = (res.data as any).total;
pageList.isLoading = false;
}
});
}
};
onLoad((option: any) => {
const id = option.id;
state.type = option.type;
state.id = id;
state.name = option.name;
getList();
//
uni.setNavigationBarTitle({
title: state.name,
});
});
</script>
<style lang="scss" scoped>
.c-card {
margin: 30rpx 25rpx;
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
padding: 20rpx;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 26rpx;
color: #000000;
.box {
display: flex;
align-items: baseline;
justify-content: space-between;
padding: 15rpx 0rpx;
.num {
color: rgba(236, 15, 62, 1);
}
.bill {
view {
line-height: 60rpx;
}
}
.time {
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 22rpx;
color: #999999;
}
}
.box + .box {
border-top: 1px solid rgba(233, 233, 233, 0.76);
}
}
</style>

View File

@ -1,13 +1,13 @@
<template> <template>
<view class="c-layout"> <view class="c-layout">
<StatisticCard :list="list" /> <StatisticCard :list="list" />
<!-- {{ list }} -->
<view class="card-box"> <view class="card-box">
<view class="c-tab"> <view class="c-tab">
<text <text
v-for="(item, index) in tabList" v-for="(item, index) in tabList"
:key="index" :key="index"
:class="{ active: currentTab === item.name }" :class="{ active: currentTab === item.id }"
@click="handleTab(item)" @click="handleTab(item)"
> >
{{ item.name }} {{ item.name }}
@ -16,119 +16,172 @@
<view class="c-grid"> <view class="c-grid">
<view class="box"> <view class="box">
<view v-for="(item, index) in gridList1" :key="index"> <view v-for="(item, index) in gridList1" :key="index">
<text>{{ item.name }}</text><text>{{ item.isBefore ? item.unit : ''}} {{ randomNum(index)}} {{ item.isBefore ? '' : item.unit }} </text> <text v-if="item.name">{{ item.name }}</text
><text
>{{ item.isBefore ? item.unit : "" }} {{ item.num }}
{{ item.isBefore ? "" : item.unit }}
</text>
</view> </view>
</view> </view>
<view class="box"> <view class="box">
<view v-for="(item, index) in gridList2" :key="index"> <view v-for="(item, index) in gridList2" :key="index">
<text v-if="item.name">{{ item.name }}</text><text v-if="item.num">{{ item.isBefore ? item.unit : ''}} {{ randomNum(index) }} {{ item.isBefore ? '' : item.unit }} </text> <text v-if="item.name">{{ item.name }}</text
><text
>{{ item.isBefore ? item.unit : "" }} {{ item.num }}
{{ item.isBefore ? "" : item.unit }}
</text>
</view> </view>
</view> </view>
<view class="box"> <view class="box">
<view v-for="(item, index) in gridList3" :key="index"> <view v-for="(item, index) in gridList3" :key="index">
<text>{{ item.name }}</text><text>{{ item.isBefore ? item.unit : ''}} {{ randomNum(index) }} {{ item.isBefore ? '' : item.unit }} </text> <text>{{ item.name }}</text
><text
>{{ item.isBefore ? item.unit : "" }} {{ item.num }}
{{ item.isBefore ? "" : item.unit }}
</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<TimeRangeFilter :show="isShowTimeDialog" @handleDialog="handleDialog"/> <TimeRangeFilter
:show="isShowTimeDialog"
@handleDialog="handleDialog"
@handleOk="handleOk"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import StatisticCard from "@/components/StatisticCard/index.vue"; import StatisticCard from "@/components/StatisticCard/index.vue";
import TimeRangeFilter from './components/TimeRangeFilter.vue' import TimeRangeFilter from "./components/TimeRangeFilter.vue";
import { FinanceApi, ReceiveApi, ShipmentApi } from "@/services";
import { timeRange } from "@/utils";
const list = reactive([ const list = reactive([
{ {
num: 8923.0, num: 0,
name: "客户应收款总额", name: "客户应收款总额",
}, },
{ {
num: 8923.0, num: 0,
name: "供应商应付款总额", name: "供应商应付款总额",
}, },
]); ]);
const currentTab = ref("昨日"); const currentTab = ref(3);
const tabList = reactive([ const tabList = reactive([
{ {
id: 2,
name: "昨日", name: "昨日",
}, },
{ {
id: 3,
name: "本月", name: "本月",
}, },
{ {
id: 4,
name: "本年", name: "本年",
}, },
{ {
id: 5,
name: "自定义", name: "自定义",
}, },
]); ]);
const handleTab = (item: any) => { const handleTab = (item: any) => {
if (item.name === '自定义') { if (item.id === 5) {
handleDialog(true) handleDialog(true);
} else { } else {
currentTab.value = item.name; currentTab.value = item.id;
getOverview();
} }
}; };
const handleOk = (v: any) => {
state.startTime = v.startTime;
state.endTime = v.endTime;
currentTab.value = 5;
getOverview();
};
const randomNum = (index: number) => { const randomNum = (index: number) => {
return Math.floor(Math.random() * (10000 - 1 + 1)) + 1 + index return Math.floor(Math.random() * (10000 - 1 + 1)) + 1 + index;
} };
const gridList1 = reactive([ const gridList1 = reactive([
{ {
name: "出货收入", name: "总收入",
num: "6000.00", enName: "totalIncome",
unit: '¥', num: "",
isBefore: true unit: "¥",
isBefore: true,
}, },
{ {
name: "实际收入", name: "出货收入",
num: "6000.00", enName: "totalShipment",
unit: '¥', num: "",
isBefore: true unit: "¥",
isBefore: true,
},
{
name: "其他收入",
enName: "totalOther",
num: "",
unit: "¥",
isBefore: true,
},
{},
{
name: "总支出",
enName: "totalExpenditure",
num: "",
unit: "¥",
isBefore: true,
}, },
{ {
name: "收货支出", name: "收货支出",
num: "6000.00", enName: "totalReap",
unit: '¥', num: "",
isBefore: true unit: "¥",
isBefore: true,
}, },
{ {
name: "实际支出", name: "其他支出",
num: "6000.00", enName: "totalOther",
unit: '¥', num: "",
isBefore: true unit: "¥",
isBefore: true,
}, },
{ {
name: "杂费支出", name: "杂费支出",
num: "6000.00", enName: "totalIncidentals",
unit: '¥', num: "",
isBefore: true unit: "¥",
isBefore: true,
}, },
{ {
name: "运费支出", name: "运费支出",
num: "6000.00", enName: "totalFreight",
unit: '¥', num: "",
isBefore: true unit: "¥",
isBefore: true,
}, },
]); ]);
const gridList2 = reactive([ const gridList2 = reactive([
{ {
name: "出货实收金额", name: "出货实收金额",
num: "6000.00", enName: "actualReceived",
unit: '¥', num: "",
isBefore: true unit: "¥",
isBefore: true,
}, },
{ {
name: "出货应收金额", name: "出货应收金额",
num: "6000.00", enName: "receivable",
unit: '¥', num: "",
isBefore: true unit: "¥",
isBefore: true,
}, },
{ {
name: "出货笔数", name: "出货笔数",
enName: "orderOutNum",
num: "2", num: "2",
}, },
{ {
@ -137,96 +190,188 @@ const gridList2 = reactive([
}, },
{ {
name: "出货总重量", name: "出货总重量",
num: "6000.00", enName: "outTotalWeight",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
{ {
name: "出货净重(客户)", name: "出货净重(客户)",
num: "6000.00", enName: "customerTotalWeight",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
{ {
name: "出货重量(已结)", name: "出货重量(已结)",
num: "6000.00", enName: "payOutTotalWeight",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
{ {
name: "结算总重量", name: "结算总重量",
num: "6000.00", enName: "totalSettlement",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
{ {
name: "出货重量(未结)", name: "出货重量(未结)",
num: "6000.00", enName: "unPayOutTotalWeight",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
{ {
name: "结算重量(已结)", name: "结算重量(已结)",
num: "6000.00", enName: "payTotalSettlement",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
{ {
name: "净重误差", name: "净重误差",
num: "6000.00", enName: "netError",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
{ {
name: "结算总量(未结)", name: "结算总量(未结)",
num: "6000.00", enName: "unPayTotalSettlement",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
]); ]);
const gridList3 = reactive([ const gridList3 = reactive([
{ {
name: "收货总重量", name: "收货总重量",
num: "6000.00", enName: "payTotalWeight",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
{ {
name: "收货笔数", name: "收货笔数",
num: "2", enName: "orderInNum",
unit: '', num: "",
isBefore: false unit: "",
isBefore: false,
}, },
{ {
name: "收货重量(已付)", name: "收货重量(已付)",
num: "6000.00", enName: "paymentTotalPrice",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
{ {
name: "收货实付金额", name: "收货实付金额",
num: "6000.00", enName: "totalWeight",
unit: '¥', num: "",
isBefore: true unit: "¥",
isBefore: true,
}, },
{ {
name: "收货重量(未付)", name: "收货重量(未付)",
num: "6000.00", enName: "unPayTotalWeight",
unit: 'KG', num: "",
isBefore: false unit: "KG",
isBefore: false,
}, },
{ {
name: "收货应付金额", name: "收货应付金额",
num: "6000.00", enName: "unPaymentTotalPrice",
unit: '¥', num: "",
isBefore: true unit: "¥",
isBefore: true,
}, },
]); ]);
const isShowTimeDialog = ref(false) const isShowTimeDialog = ref(false);
const handleDialog = (v: boolean) => { const handleDialog = (v: boolean) => {
isShowTimeDialog.value = v isShowTimeDialog.value = v;
};
const state = reactive({
startTime: "",
endTime: "",
});
const getReceiveOverView = () => {
ReceiveApi.getOverview({
startTime: state.startTime,
endTime: state.endTime,
}).then((res: any) => {
if (res.code === 200) {
gridList3.map((item) => {
item.num = res.data[item.enName as string];
});
} }
});
};
const getShipmentOverView = () => {
ShipmentApi.getOverview({
startTime: state.startTime,
endTime: state.endTime,
}).then((res: any) => {
if (res.code === 200) {
gridList2.map((item) => {
item.num = res.data[item.enName as string];
});
}
});
};
const getPaymentCount = () => {
FinanceApi.getPaymentCount({
startTime: state.startTime,
endTime: state.endTime,
}).then((res: any) => {
if (res.code === 200) {
gridList1.map((item) => {
if (Object.keys(res.data).includes(item.enName + "")) {
item.num = res.data[item.enName as string];
}
});
}
});
};
const getRevenueCount = () => {
FinanceApi.getRevenueCount({
startTime: state.startTime,
endTime: state.endTime,
}).then((res: any) => {
if (res.code === 200) {
gridList1.map((item) => {
if (Object.keys(res.data).includes(item.enName + "")) {
item.num = res.data[item.enName as string];
}
});
}
});
};
const getOverview = () => {
if (currentTab.value < 5) {
const range = timeRange(currentTab.value);
state.startTime = range.startTime + " 00:00:00";
state.endTime = range.endTime + " 23:59:59";
} else if (currentTab.value === 5) {
state.startTime = state.startTime + " 00:00:00";
state.endTime = state.endTime + " 23:59:59";
}
getReceiveOverView();
getShipmentOverView();
getPaymentCount();
getRevenueCount();
};
onMounted(() => {
getOverview();
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.card-box { .card-box {
@ -237,7 +382,7 @@ const handleDialog = (v: boolean) => {
.c-tab { .c-tab {
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 27rpx; font-size: 28rpx;
color: #999999; color: #999999;
line-height: 41rpx; line-height: 41rpx;
display: flex; display: flex;
@ -256,7 +401,7 @@ const handleDialog = (v: boolean) => {
.c-grid { .c-grid {
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 21rpx; font-size: 24rpx;
color: #000000; color: #000000;
.box { .box {
padding: 30rpx; padding: 30rpx;
@ -268,7 +413,7 @@ const handleDialog = (v: boolean) => {
} }
} }
.box + .box { .box + .box {
border-top: 18rpx solid #F8F8F8; border-top: 18rpx solid #f8f8f8;
} }
} }
} }

View File

@ -43,7 +43,7 @@
</u-popup> </u-popup>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { formatDate, getCurrentMonthStartAndEnd, getCurrentYearStartAndEnd } from "@/utils"; import { formatDate, getCurrentMonthStartAndEnd, getCurrentYearStartAndEnd, timeRange } from "@/utils";
const props = defineProps<{ const props = defineProps<{
show: boolean; show: boolean;
@ -81,23 +81,10 @@ const handleCustom = () => {
} }
const handleSelect = (item: any) => { const handleSelect = (item: any) => {
const today = new Date();
const yesterday = new Date((today as any) - (24 * 60 * 60 * 1000));
state.currentStates = item.id; state.currentStates = item.id;
console.log(item); const range = timeRange(item.id)
if (item.id === 1) { state.startTime = range.startTime;
state.startTime = formatDate(today, "{y}-{m}-{d}"); state.endTime = range.endTime
state.endTime = formatDate(today, "{y}-{m}-{d}");
} else if (item.id === 2) {
state.startTime = formatDate(yesterday, "{y}-{m}-{d}");
state.endTime = formatDate(yesterday, "{y}-{m}-{d}");
} else if (item.id === 3) {
state.startTime = formatDate(getCurrentMonthStartAndEnd().start, "{y}-{m}-{d}");
state.endTime = formatDate(getCurrentMonthStartAndEnd().end, "{y}-{m}-{d}");
} else if (item.id === 4) {
state.startTime = formatDate(getCurrentYearStartAndEnd().start, "{y}-{m}-{d}");
state.endTime = formatDate(getCurrentYearStartAndEnd().end, "{y}-{m}-{d}");
}
emit("changeTime", {startTime: state.startTime, endTime: state.endTime}); emit("changeTime", {startTime: state.startTime, endTime: state.endTime});
emit("handleDialog", false); emit("handleDialog", false);
}; };

View File

@ -4,7 +4,7 @@
<view> <view>
<view class="box"> <view class="box">
<text @click="handleClose">取消</text> <text @click="handleClose">取消</text>
<text class="btn" @click="handleClose">完成</text> <text class="btn" @click="handleOk">完成</text>
</view> </view>
<uni-calendar <uni-calendar
:insert="true" :insert="true"
@ -19,17 +19,43 @@
</u-popup> </u-popup>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { formatDate } from '@/utils';
const props = defineProps<{ const props = defineProps<{
show: boolean, show: boolean,
}>() }>()
const emit = defineEmits(['handleDialog']); const emit = defineEmits(['handleDialog', 'handleOk']);
const handleClose = () => { const handleClose = () => {
emit('handleDialog', false) emit('handleDialog', false)
} }
const handleOk = () => {
emit('handleOk', {startTime: state.startTime, endTime: state.endTime})
emit('handleDialog', false)
}
const showCalendar = ref(false) const showCalendar = ref(false)
const state = reactive({
startTime: '',
endTime: ''
})
const handleChangeDate = (v: any) => { const handleChangeDate = (v: any) => {
console.log(v); const time1 = v.range.before;
const time2 = v.range.after;
if (time1 && time2) {
const date1 = new Date(time1);
const date2 = new Date(time2);
if (date1 < date2) {
state.startTime = formatDate(time1, "{y}-{m}-{d}");
state.endTime = formatDate(time2, "{y}-{m}-{d}");
} else if (date1 > date2) {
state.startTime = formatDate(time2, "{y}-{m}-{d}");
state.endTime = formatDate(time1, "{y}-{m}-{d}");
} else {
state.startTime = formatDate(time1, "{y}-{m}-{d}");
state.endTime = formatDate(time2, "{y}-{m}-{d}");
}
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,54 +0,0 @@
<template>
<view class="c-card">
<view v-for="item in 10" :key="item" @click="getDetail()">
<view class="bill">
<view>收货单号CHD2024012212314</view>
<view>应收金额<text class="num">¥1800.00</text></view>
</view>
<view class="time"> 2024-01-22 14:28:36 </view>
</view>
</view>
</template>
<script setup lang="ts">
const getDetail = () => {
uni.navigateTo({
url: "/pagesStatistics/customer/detail", //
});
}
</script>
<style lang="scss" scoped>
.c-card {
margin: 30rpx 25rpx;
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
padding: 20rpx;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 21rpx;
color: #000000;
> view {
display: flex;
align-items: baseline;
justify-content: space-between;
padding: 15rpx 0rpx;
.num {
color: rgba(236, 15, 62, 1);
}
.bill {
view {
line-height: 40rpx;
}
}
.time {
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 21rpx;
color: #999999;
}
}
> view + view {
border-top: 1px solid rgba(233, 233, 233, 0.76);
}
}
</style>

View File

@ -2,23 +2,27 @@
<view class="c-card"> <view class="c-card">
<view class="top"> <view class="top">
<view class="left"> <view class="left">
<view>上海奉贤两网融合大磅</view> <view>{{ state.order.deviceName || "-" }}</view>
<view>重一</view> <view>{{ state.order.productName || "" }}</view>
</view> </view>
<view> <view>
<text class="btn" @click="handleScenePhoto()">现场照片</text> <text class="btn" @click="handleScenePhoto(state.order.id)"
>现场照片</text
>
</view> </view>
</view> </view>
<view class="content"> <view class="content">
<view class="baseinfo"> <view class="baseinfo">
<view class="time"> 过磅时间2023-09-01 13:23:33 </view>
<view class="person"> <view class="person">
<view>定价人谭兵</view> <view>审核人{{ state.order.pricingUserName || "-" }}</view>
<view>审核人谭兵</view> <view class="time"> 过磅时间{{ state.order.tareTime }} </view>
</view> </view>
</view> </view>
<view style="padding: 30rpx 0rpx"> <view style="padding: 30rpx 0rpx">
<view> <text>收货单号</text><text> SHD20230901132333 </text></view> <view>
<text>出货单号</text
><text>{{ state.order.orderNumber }} </text></view
>
<view class="box"> <view class="box">
<view v-for="(item, index) in gridList1" :key="index"> <view v-for="(item, index) in gridList1" :key="index">
<text v-if="item.name">{{ item.name }}</text <text v-if="item.name">{{ item.name }}</text
@ -33,7 +37,7 @@
<view class="moreInfo"> <view class="moreInfo">
<view class="baseinfo"> <view class="baseinfo">
<view>客户收货</view> <view>客户收货</view>
<view class="time"> 收货时间2023-09-01 13:23:33 </view> <view class="time"> 收货时间{{ state.order.updateTime }} </view>
</view> </view>
<view class="box"> <view class="box">
<view v-for="(item, index) in gridList2" :key="index"> <view v-for="(item, index) in gridList2" :key="index">
@ -51,24 +55,28 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onLoad } from "@dcloudio/uni-app";
import { reactive } from "vue"; import { reactive } from "vue";
const gridList1 = reactive([ const gridList1 = reactive([
{ {
name: "毛重", name: "毛重",
num: "4080.00", enName: "grossWeight",
num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
{ {
name: "皮重", name: "皮重",
num: "3450.00", enName: "tare",
num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
{ {
name: "净重", name: "净重",
num: "640.00", enName: "netWeight",
num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
@ -76,73 +84,106 @@ const gridList1 = reactive([
const gridList2 = reactive([ const gridList2 = reactive([
{ {
name: "结算重量", name: "结算重量",
num: "640.00", enName: "settlementWeight",
num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
{ {
name: "结算单价", name: "结算单价",
num: "2.48", enName: "unitPrice",
num: "",
unit: "元/KG", unit: "元/KG",
isBefore: false, isBefore: false,
}, },
{ {
name: "预估总价", name: "预估总价",
num: "1587.00", enName: "estimatePrice",
num: "",
unit: "元", unit: "元",
isBefore: false, isBefore: false,
}, },
{ {
name: "货款金额", name: "货款金额",
num: "1587.00", enName: "totalPrice",
unit: "元", num: "",
isBefore: false,
},
{
name: "杂费",
num: "0",
unit: "元", unit: "元",
isBefore: false, isBefore: false,
}, },
{ {
name: "运费", name: "运费",
num: "0", enName: "freight",
num: "",
unit: "元",
isBefore: false,
},
{
name: "杂费",
enName: "incidentals",
num: "",
unit: "元", unit: "元",
isBefore: false, isBefore: false,
}, },
{ {
name: "实际收入", name: "实际收入",
num: "1587.00", enName: "realIncome",
num: "",
unit: "元", unit: "元",
isBefore: false, isBefore: false,
}, },
{}, {},
{ {
name: "净重误差", name: "净重误差",
num: "0.00", enName: "netWeightError",
num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
{}, {},
{ {
name: "结算状态", name: "结算状态",
num: "未结算", enName: "scaleStatus",
num: "",
unit: "", unit: "",
isBefore: false, isBefore: false,
}, },
{ {
name: "应收金额", name: "应收金额",
num: "1587.00", enName: "totalPrice",
num: "",
unit: "元", unit: "元",
isBefore: false, isBefore: false,
}, },
]); ]);
const handleScenePhoto = () => { const handleScenePhoto = (id: string) => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesScenePhoto/index", // url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, //
}); });
}; };
const state = reactive<any>({
order: {},
});
onLoad((option: any) => {
//
uni.setNavigationBarTitle({
title: option.name,
});
const order = JSON.parse(option.obj);
state.order = order;
gridList1.map((item: any) => {
item.num = order[item.enName as string];
});
gridList2.map((item: any) => {
if (item.name === "结算状态") {
item.num =
["待出货", "待过毛", "待审核", "已审未付", "已审已付"][
order[item.enName as string]
] || "-";
} else {
item.num = order[item.enName as string];
}
});
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.c-card { .c-card {
@ -152,7 +193,7 @@ const handleScenePhoto = () => {
border-radius: 13rpx; border-radius: 13rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 26rpx;
color: #000000; color: #000000;
.top { .top {
display: flex; display: flex;
@ -166,7 +207,7 @@ const handleScenePhoto = () => {
&:nth-child(2) { &:nth-child(2) {
color: rgba(236, 15, 62, 1); color: rgba(236, 15, 62, 1);
font-weight: 400; font-weight: 400;
font-size: 27rpx; font-size: 28rpx;
} }
} }
} }
@ -187,7 +228,7 @@ const handleScenePhoto = () => {
.time { .time {
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 21rpx; font-size: 24rpx;
color: #999999; color: #999999;
line-height: 40rpx; line-height: 40rpx;
} }

View File

@ -1,11 +1,11 @@
<template> <template>
<Search :name="'客户名称'" /> <Search :name="'客户名称'" @handleSearch="handleSearch"/>
<view class="c-card"> <view class="c-card">
<StatisticCard :list="list" /> <StatisticCard :list="list" />
<view class="detail"> <view class="detail">
<view v-for="(item, index) in 10" :key="index" @click="getDetail(item)"> <view v-for="(item, index) in billList" :key="index" @click="getDetail(item)">
<text>张小明{{ item }}</text> <text>{{ item.supplierName }}</text>
<text class="num">¥1800.00 <text class="tip"></text></text> <text class="num">¥{{ item.unPayTotalPrice }} <text class="tip"></text></text>
</view> </view>
</view> </view>
</view> </view>
@ -13,21 +13,38 @@
<script setup lang="ts"> <script setup lang="ts">
import Search from "@/components/Search/index.vue"; import Search from "@/components/Search/index.vue";
import StatisticCard from "@/components/StatisticCard/index.vue"; import StatisticCard from "@/components/StatisticCard/index.vue";
import { ShipmentApi } from "@/services";
const list = reactive([ const list = reactive([
{ {
num: 2, num: 0,
name: "欠款客户", name: "欠款客户",
}, },
{ {
num: 8923, num: 0,
name: "欠款金额", name: "欠款金额",
}, },
]); ]);
const getDetail = (item: any) => { const getDetail = (item: any) => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesStatistics/customer/billDetail", // url: "/pagesStatistics/billDetail?type=2&id=" + item.userId +`&name=${item.supplierName}`, //
}); });
}; };
const handleSearch = (v:string) => {
getList(v)
}
const billList = ref<any>([])
const getList = (v: string) => {
ShipmentApi.getReconciliation({userName: v}).then((res:any) => {
if (res.code === 200) {
list[0].num = res.data.supplierNum
list[1].num = res.data.unPayTotalPrice
billList.value = res.data.unPaySupplierVos
}
})
}
onMounted(() => {
getList('')
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.c-card { .c-card {
@ -41,7 +58,7 @@ const getDetail = (item: any) => {
padding: 20rpx; padding: 20rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 21rpx; font-size: 28rpx;
color: #000000; color: #000000;
> view { > view {
display: flex; display: flex;

View File

@ -1,54 +0,0 @@
<template>
<view class="c-card">
<view v-for="item in 10" :key="item" @click="getDetail()">
<view class="bill">
<view>收货单号CHD2024012212314</view>
<view>应付金额<text class="num">¥1800.00</text></view>
</view>
<view class="time"> 2024-01-22 14:28:36 </view>
</view>
</view>
</template>
<script setup lang="ts">
const getDetail = () => {
uni.navigateTo({
url: "/pagesStatistics/supplier/detail", //
});
}
</script>
<style lang="scss" scoped>
.c-card {
margin: 30rpx 25rpx;
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
padding: 20rpx;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 21rpx;
color: #000000;
> view {
display: flex;
align-items: baseline;
justify-content: space-between;
padding: 15rpx 0rpx;
.num {
color: rgba(236, 15, 62, 1);
}
.bill {
view {
line-height: 40rpx;
}
}
.time {
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 21rpx;
color: #999999;
}
}
> view + view {
border-top: 1px solid rgba(233, 233, 233, 0.76);
}
}
</style>

View File

@ -2,23 +2,28 @@
<view class="c-card"> <view class="c-card">
<view class="top"> <view class="top">
<view class="left"> <view class="left">
<view>上海奉贤两网融合大磅</view> <view>{{ state.order.deviceName || "-" }}</view>
<view>重一</view> <view>{{ state.order.productName || "" }}</view>
</view> </view>
<view> <view>
<text class="btn" @click="handleScenePhoto()">现场照片</text> <text class="btn" @click="handleScenePhoto(state.order.id)"
>现场照片</text
>
</view> </view>
</view> </view>
<view class="content"> <view class="content">
<view class="baseinfo"> <view class="baseinfo">
<view class="time"> 过磅时间2023-09-01 13:23:33 </view> <view class="time"> 过磅时间{{ state.order.grossTime }}</view>
<view class="person"> <view class="person">
<view>定价人谭兵</view> <view>定价人{{ state.order.pricingUserName || "-" }}</view>
<view>审核人谭兵</view> <view>审核人{{ state.order.reviewerUserName || "-" }}</view>
</view> </view>
</view> </view>
<view style="padding: 30rpx 0rpx"> <view style="padding: 30rpx 0rpx">
<view> <text>收货单号</text><text> SHD20230901132333 </text></view> <view>
<text>收货单号</text
><text> {{ state.order.receiptNumber }} </text></view
>
<view class="box"> <view class="box">
<view v-for="(item, index) in gridList1" :key="index"> <view v-for="(item, index) in gridList1" :key="index">
<text v-if="item.name">{{ item.name }}</text <text v-if="item.name">{{ item.name }}</text
@ -34,71 +39,110 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const gridList1 = reactive([ import { PaymentMethod } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app";
const gridList1 = reactive<any>([
{ {
name: "毛重", name: "毛重",
num: "4080.00", enName: "grossWeight",
num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
{ {
name: "皮重", name: "皮重",
num: "3450.00", enName: "tare",
num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
{ {
name: "扣杂", name: "扣杂",
num: "0.00", enName: "buckleMiscellaneous",
num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
{ {},
name: "",
num: "",
unit: "",
},
{ {
name: "净重", name: "净重",
num: "640.00", enName: "netWeight",
num: "",
unit: "KG", unit: "KG",
isBefore: false, isBefore: false,
}, },
{ {
name: "单价", name: "单价",
num: "2.48", enName: "price",
unit: "元/kg", num: "",
unit: "元/KG",
isBefore: false, isBefore: false,
}, },
{ {
name: "预估总价", name: "预估总价",
num: "1587.00", enName: "totalPrice",
num: "",
unit: "元", unit: "元",
isBefore: false, isBefore: false,
}, },
{ {
name: "货款金额", name: "货款金额",
num: "1587.00", enName: "balanceTotalPrice",
num: "",
unit: "元", unit: "元",
isBefore: false, isBefore: false,
}, },
{ {
name: "付款状态", name: "付款状态",
enName: "paymentMethod",
num: "未支付", num: "未支付",
isBefore: false, isBefore: false,
}, },
{ {
name: "应付金额", name: "应付金额",
num: "1587.00", enName: "balanceTotalPrice",
num: "",
unit: "元", unit: "元",
isBefore: false, isBefore: false,
}, },
]); ]);
const handleScenePhoto = () => { const handleScenePhoto = (id: any) => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesScenePhoto/index", // url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, //
}); });
}; };
const state = reactive<Order>({
order: {},
});
onLoad((option: any) => {
//
uni.setNavigationBarTitle({
title: option.name,
});
const order = JSON.parse(option.obj);
state.order = order;
gridList1.map((item: any) => {
if (item.name === "扣杂" || item.name === "扣点") {
if (order.buttonType === 0) {
item.name = "扣杂";
item.enName = "buckleMiscellaneous";
item.unit = "KG";
} else if (order.buttonType === 1) {
item.name = "扣点";
item.enName = "points";
item.unit = "%";
}
} else if (item.name === "付款状态") {
item.num =
["未支付", "现金", "银行卡", "微信", "支付宝"][
order[item.enName as string]
] || "未支付";
} else {
item.num = order[item.enName as string];
}
});
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.c-card { .c-card {
@ -108,7 +152,7 @@ const handleScenePhoto = () => {
border-radius: 13rpx; border-radius: 13rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 26rpx;
color: #000000; color: #000000;
.top { .top {
display: flex; display: flex;
@ -122,7 +166,7 @@ const handleScenePhoto = () => {
&:nth-child(2) { &:nth-child(2) {
color: rgba(236, 15, 62, 1); color: rgba(236, 15, 62, 1);
font-weight: 400; font-weight: 400;
font-size: 27rpx; font-size: 28rpx;
} }
} }
} }
@ -143,7 +187,7 @@ const handleScenePhoto = () => {
.time { .time {
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 21rpx; font-size: 24rpx;
color: #999999; color: #999999;
line-height: 40rpx; line-height: 40rpx;
} }

View File

@ -1,11 +1,11 @@
<template> <template>
<Search :name="'供应商名称'" /> <Search :name="'供应商名称'" @handleSearch="handleSearch"/>
<view class="c-card"> <view class="c-card">
<StatisticCard :list="list" /> <StatisticCard :list="list" />
<view class="detail"> <view class="detail">
<view v-for="(item, index) in 10" :key="index" @click="getDetail(item)"> <view v-for="(item, index) in billList" :key="index" @click="getDetail(item)">
<text>华明基地{{ item }}</text> <text>{{ item.supplierName }}</text>
<text class="num">¥1800.00 <text class="tip"></text></text> <text class="num">¥{{ item.unPayTotalPrice }} <text class="tip"></text></text>
</view> </view>
</view> </view>
</view> </view>
@ -13,21 +13,38 @@
<script setup lang="ts"> <script setup lang="ts">
import Search from "@/components/Search/index.vue"; import Search from "@/components/Search/index.vue";
import StatisticCard from "@/components/StatisticCard/index.vue"; import StatisticCard from "@/components/StatisticCard/index.vue";
import { ReceiveApi } from "@/services";
const list = reactive([ const list = reactive([
{ {
num: 2, num: 0,
name: "应付供应商", name: "应付供应商",
}, },
{ {
num: 8923, num: 0,
name: "应付金额", name: "应付金额",
}, },
]); ]);
const handleSearch = (v:string) => {
getList(v)
}
const billList = ref<any>([])
const getDetail = (item: any) => { const getDetail = (item: any) => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesStatistics/supplier/billDetail", // url: "/pagesStatistics/billDetail?type=1&id="+ item.userId +`&name=${item.supplierName}`, //
}); });
}; };
const getList = (v: string) => {
ReceiveApi.getReconciliation({userName: v}).then((res:any) => {
if (res.code === 200) {
list[0].num = res.data.supplierNum
list[1].num = res.data.unPayTotalPrice
billList.value = res.data.unPaySupplierVos
}
})
}
onMounted(() => {
getList('')
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.c-card { .c-card {
@ -41,7 +58,7 @@ const getDetail = (item: any) => {
padding: 20rpx; padding: 20rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 21rpx; font-size: 28rpx;
color: #000000; color: #000000;
> view { > view {
display: flex; display: flex;

View File

@ -13,12 +13,13 @@
:clearabled="true" :clearabled="true"
:showAction="false" :showAction="false"
placeholderColor="#C1C1C1" placeholderColor="#C1C1C1"
@search="handleSearch()"
></u-search> ></u-search>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const isShowSearch = ref(false); const isShowSearch = ref(false);
const keyword = ref(); const keyword = ref('');
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
name: string; name: string;
@ -27,6 +28,11 @@ const props = withDefaults(
name: '搜索内容', name: '搜索内容',
} }
); );
const emit = defineEmits(["handleSearch"]);
const handleSearch = () => {
emit("handleSearch", keyword.value)
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.search { .search {

View File

@ -13,7 +13,7 @@
<script setup lang="ts"> <script setup lang="ts">
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
list: Array; list: any;
}>(), }>(),
{ {
list: [], list: [],
@ -29,7 +29,7 @@ const props = withDefaults(
align-items: center; align-items: center;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 500; font-weight: 500;
font-size: 24rpx; font-size: 28rpx;
color: #000000; color: #000000;
text-align: center; text-align: center;
background: #ffffff; background: #ffffff;
@ -40,12 +40,12 @@ const props = withDefaults(
text-align: center; text-align: center;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 26rpx;
color: #000000; color: #000000;
border-left: 1px solid #e9e9e9; border-left: 1px solid #e9e9e9;
.num { .num {
font-weight: bold; font-weight: bold;
font-size: 27rpx; font-size: 28rpx;
} }
} }
</style> </style>

View File

@ -229,9 +229,9 @@
} }
}, },
{ {
"path": "supplier/billDetail", "path": "billDetail",
"style": { "style": {
"navigationBarTitleText": "供应商账单详情" "navigationBarTitleText": "账单详情"
} }
}, },
{ {
@ -240,12 +240,6 @@
"navigationBarTitleText": "供应商详情" "navigationBarTitleText": "供应商详情"
} }
}, },
{
"path": "customer/billDetail",
"style": {
"navigationBarTitleText": "客户账单详情"
}
},
{ {
"path": "customer/detail", "path": "customer/detail",
"style": { "style": {

View File

@ -43,7 +43,7 @@
</u-popup> </u-popup>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { formatDate, getCurrentMonthStartAndEnd, getCurrentYearStartAndEnd } from "@/utils"; import { formatDate, getCurrentMonthStartAndEnd, getCurrentYearStartAndEnd, timeRange } from "@/utils";
const props = defineProps<{ const props = defineProps<{
show: boolean; show: boolean;
@ -81,23 +81,12 @@ const handleCustom = () => {
} }
const handleSelect = (item: any) => { const handleSelect = (item: any) => {
const today = new Date();
const yesterday = new Date((today as any) - (24 * 60 * 60 * 1000));
state.currentStates = item.id; state.currentStates = item.id;
console.log(item); const range = timeRange(item.id)
if (item.id === 1) { state.startTime = range.startTime;
state.startTime = formatDate(today, "{y}-{m}-{d}"); state.endTime = range.endTime
state.endTime = formatDate(today, "{y}-{m}-{d}");
} else if (item.id === 2) {
state.startTime = formatDate(yesterday, "{y}-{m}-{d}");
state.endTime = formatDate(yesterday, "{y}-{m}-{d}");
} else if (item.id === 3) {
state.startTime = formatDate(getCurrentMonthStartAndEnd().start, "{y}-{m}-{d}");
state.endTime = formatDate(getCurrentMonthStartAndEnd().end, "{y}-{m}-{d}");
} else if (item.id === 4) {
state.startTime = formatDate(getCurrentYearStartAndEnd().start, "{y}-{m}-{d}");
state.endTime = formatDate(getCurrentYearStartAndEnd().end, "{y}-{m}-{d}");
}
emit("changeTime", {startTime: state.startTime, endTime: state.endTime, name: item.name}); emit("changeTime", {startTime: state.startTime, endTime: state.endTime, name: item.name});
emit("handleDialog", false); emit("handleDialog", false);
}; };

View File

@ -395,24 +395,6 @@ const appList = reactive([
}); });
}, },
}, },
// {
// icon: "12.png",
// title: "",
// fn: () => {
// // uni.navigateTo({
// // url: "/pagesApp/shipmentDetail", //
// // });
// },
// },
// {
// icon: "13.png",
// title: "",
// fn: () => {
// // uni.navigateTo({
// // url: "/pagesApp/receiveCl", //
// // });
// },
// },
{ {
icon: "14.png", icon: "14.png",
title: "人员管理", title: "人员管理",
@ -449,6 +431,24 @@ const appList = reactive([
}); });
}, },
}, },
{
icon: "12.png",
title: "支付明细",
fn: () => {
uni.navigateTo({
url: "/pagesApp/shipmentDetail", //
});
},
},
{
icon: "13.png",
title: "收入明细",
fn: () => {
uni.navigateTo({
url: "/pagesApp/receiveCl", //
});
},
},
]); ]);

View File

@ -61,7 +61,7 @@
</view> </view>
<view class="more"> <view class="more">
<view v-if="getIsShow()"> 收货单号SHD20230901132333 </view> <view v-if="getIsShow()"> 收货单号{{ state.order.receiptNumber }} </view>
<view v-if="getIsShow()"></view> <view v-if="getIsShow()"></view>
<view v-for="(item, index) in gridList1" :key="index"> <view v-for="(item, index) in gridList1" :key="index">
<text v-if="item.name">{{ item.name }}</text <text v-if="item.name">{{ item.name }}</text

View File

@ -440,7 +440,7 @@ const gridList3 = reactive([
}, },
{ {
name: "实际收入", name: "实际收入",
enName: "incidentals", enName: "realIncome",
num: "", num: "",
unit: "元", unit: "元",
isBefore: false, isBefore: false,

54
src/services/finance.ts Normal file
View File

@ -0,0 +1,54 @@
import { http } from '@/utils/http'
// 经营概况-支付明细
export const getPaymentCount = (data: any) => {
return http({
method: 'GET',
url: '/api/paymentdtails/getPaymentCount',
data,
})
}
// 经营概况-收入明细
export const getRevenueCount = (data: any) => {
return http({
method: 'GET',
url: '/api/revenuedetails/getRevenueCount',
data,
})
}
// 支付明细新增
export const addPaymentDetails = (data: any) => {
return http({
method: 'POST',
url: '/api/paymentdtails/addPaymentDetails',
data,
})
}
// 收入明细新增
export const addRevenueDes = (data: any) => {
return http({
method: 'POST',
url: '/api/recategory/addRevenueDes',
data,
})
}
// 分页查询支付明细
export const getPaymentDetailsPage = (data: any) => {
return http({
method: 'GET',
url: '/api/paymentdtails/getPaymentDetailsPage',
data,
})
}
// 支付明细-查看详情
export const getByPaymentId = (data: any) => {
return http({
method: 'GET',
url: '/api/paymentdtails/getByPaymentId',
data,
})
}

View File

@ -8,3 +8,4 @@ export * as StockCardApi from './stockCard'
export * as GoodsApi from './goods' export * as GoodsApi from './goods'
export * as SupplierApi from './supplier' export * as SupplierApi from './supplier'
export * as CustomerApi from './customer' export * as CustomerApi from './customer'
export * as FinanceApi from './finance'

View File

@ -108,6 +108,24 @@ export const reTare = (data: any) => {
}); });
}; };
// 收货单概况
export const getOverview = (data: any) => {
return http({
method: "GET",
url: "/api/orderIn/getOverview",
data
});
};
// 供应商对账
export const getReconciliation = (data: any) => {
return http({
method: "GET",
url: "/api/orderIn/getReconciliation",
data
});
};

View File

@ -104,6 +104,24 @@ export const reGrossWeight = (data: any) => {
}); });
}; };
// 收货单概况
export const getOverview = (data: any) => {
return http({
method: "GET",
url: "/api/orderOut/getOverview",
data
});
};
// 供应商对账
export const getReconciliation = (data: any) => {
return http({
method: "GET",
url: "/api/orderOut/getReconciliation",
data
});
};

View File

@ -83,3 +83,12 @@ export enum StockCardType {
Shipment = 1, Shipment = 1,
Receive = 2 Receive = 2
} }
// 今日 昨日 本月 本年 自定义
export enum TimeRange {
Today = 1,
Yesterday = 2,
Month = 3,
Year = 4,
Custom = 5
}

View File

@ -1,3 +1,5 @@
import { TimeRange } from "./enum";
export function formatDate(time: any, cFormat: string) { export function formatDate(time: any, cFormat: string) {
const format = cFormat || "{y}-{m}-{d}"; const format = cFormat || "{y}-{m}-{d}";
const date = new Date(time); const date = new Date(time);
@ -131,9 +133,30 @@ export function pageListInit() {
// 过滤掉属性值为null的 // 过滤掉属性值为null的
export function filterNullUndefined(obj: Object) { export function filterNullUndefined(obj: Object) {
return Object.entries(obj).reduce((acc: any, [key, value]) => { return Object.entries(obj).reduce((acc: any, [key, value]) => {
if (value !== null && value !== undefined && value !=='') { if (value !== null && value !== undefined && value !== "") {
acc[key] = value; acc[key] = value;
} }
return acc; return acc;
}, {}); }, {});
} }
export function timeRange(id: number) {
const today = new Date();
const yesterday = new Date((today as any) - 24 * 60 * 60 * 1000);
let startTime = "";
let endTime = "";
if (id === TimeRange.Today) {
startTime = formatDate(today, "{y}-{m}-{d}");
endTime = formatDate(today, "{y}-{m}-{d}");
} else if (id === TimeRange.Yesterday) {
startTime = formatDate(yesterday, "{y}-{m}-{d}");
endTime = formatDate(yesterday, "{y}-{m}-{d}");
} else if (id === TimeRange.Month) {
startTime = formatDate(getCurrentMonthStartAndEnd().start, "{y}-{m}-{d}");
endTime = formatDate(getCurrentMonthStartAndEnd().end, "{y}-{m}-{d}");
} else if (id === TimeRange.Year) {
startTime = formatDate(getCurrentYearStartAndEnd().start, "{y}-{m}-{d}");
endTime = formatDate(getCurrentYearStartAndEnd().end, "{y}-{m}-{d}");
}
return { startTime: startTime, endTime: endTime };
}