freight-web/src/PagesStatistics/businessOverview.vue

452 lines
9.3 KiB
Vue
Raw Normal View History

2024-03-04 07:10:11 +00:00
<template>
<view class="c-layout">
<StatisticCard :list="list" />
2024-04-08 01:52:52 +00:00
<!-- {{ list }} -->
2024-03-04 07:10:11 +00:00
<view class="card-box">
<view class="c-tab">
<text
v-for="(item, index) in tabList"
:key="index"
2024-04-08 01:52:52 +00:00
:class="{ active: currentTab === item.id }"
2024-03-04 07:10:11 +00:00
@click="handleTab(item)"
>
{{ item.name }}
</text>
</view>
<view class="c-grid">
2024-04-23 02:47:52 +00:00
<view v-if="currentTab === 5" class="time"
>{{ state.startTime.split(" ")[0] }} -
{{ state.endTime.split(" ")[0] }}</view
>
2024-03-04 07:10:11 +00:00
<view class="box">
<view v-for="(item, index) in gridList1" :key="index">
2024-04-08 01:52:52 +00:00
<text v-if="item.name">{{ item.name }}</text
><text
2024-04-23 02:47:52 +00:00
>{{ item.isBefore ? item.unit : "" }} {{ formatMoney(item.num) }}
2024-04-08 01:52:52 +00:00
{{ item.isBefore ? "" : item.unit }}
</text>
2024-03-04 07:10:11 +00:00
</view>
</view>
2024-04-08 01:52:52 +00:00
<view class="box">
2024-03-04 07:10:11 +00:00
<view v-for="(item, index) in gridList2" :key="index">
2024-04-08 01:52:52 +00:00
<text v-if="item.name">{{ item.name }}</text
2024-04-23 02:47:52 +00:00
><text :class="item.isHighLight ? 'highLight' : ''"
>{{ item.isBefore ? item.unit : "" }} {{ formatMoney(item.num) }}
2024-04-08 01:52:52 +00:00
{{ item.isBefore ? "" : item.unit }}
</text>
2024-03-04 07:10:11 +00:00
</view>
</view>
<view class="box">
<view v-for="(item, index) in gridList3" :key="index">
2024-04-08 01:52:52 +00:00
<text>{{ item.name }}</text
2024-04-23 02:47:52 +00:00
><text :class="item.isHighLight ? 'highLight' : ''"
>{{ item.isBefore ? item.unit : "" }} {{ formatMoney(item.num) }}
2024-04-08 01:52:52 +00:00
{{ item.isBefore ? "" : item.unit }}
</text>
2024-03-04 07:10:11 +00:00
</view>
</view>
</view>
</view>
</view>
2024-04-08 01:52:52 +00:00
<TimeRangeFilter
:show="isShowTimeDialog"
@handleDialog="handleDialog"
@handleOk="handleOk"
/>
2024-03-04 07:10:11 +00:00
</template>
<script setup lang="ts">
import StatisticCard from "@/components/StatisticCard/index.vue";
2024-04-08 01:52:52 +00:00
import TimeRangeFilter from "./components/TimeRangeFilter.vue";
import { FinanceApi, ReceiveApi, ShipmentApi } from "@/services";
2024-04-23 02:47:52 +00:00
import { formatMoney, timeRange } from "@/utils";
2024-03-04 07:10:11 +00:00
const list = reactive([
{
2024-04-08 01:52:52 +00:00
num: 0,
2024-03-04 07:10:11 +00:00
name: "客户应收款总额",
},
{
2024-04-08 01:52:52 +00:00
num: 0,
2024-03-04 07:10:11 +00:00
name: "供应商应付款总额",
},
]);
2024-04-08 01:52:52 +00:00
const currentTab = ref(3);
2024-03-04 07:10:11 +00:00
const tabList = reactive([
{
2024-04-08 01:52:52 +00:00
id: 2,
2024-03-04 07:10:11 +00:00
name: "昨日",
},
{
2024-04-08 01:52:52 +00:00
id: 3,
2024-03-04 07:10:11 +00:00
name: "本月",
},
{
2024-04-08 01:52:52 +00:00
id: 4,
2024-03-04 07:10:11 +00:00
name: "本年",
},
{
2024-04-08 01:52:52 +00:00
id: 5,
2024-03-04 07:10:11 +00:00
name: "自定义",
},
]);
const handleTab = (item: any) => {
2024-04-08 01:52:52 +00:00
if (item.id === 5) {
handleDialog(true);
2024-03-04 07:10:11 +00:00
} else {
2024-04-08 01:52:52 +00:00
currentTab.value = item.id;
getOverview();
2024-03-04 07:10:11 +00:00
}
};
2024-04-08 01:52:52 +00:00
const handleOk = (v: any) => {
state.startTime = v.startTime;
state.endTime = v.endTime;
currentTab.value = 5;
getOverview();
};
const randomNum = (index: number) => {
return Math.floor(Math.random() * (10000 - 1 + 1)) + 1 + index;
};
2024-03-04 07:10:11 +00:00
const gridList1 = reactive([
2024-04-08 01:52:52 +00:00
{
name: "总收入",
enName: "totalIncome",
num: "",
unit: "¥",
isBefore: true,
},
2024-03-04 07:10:11 +00:00
{
name: "出货收入",
2024-04-08 01:52:52 +00:00
enName: "totalShipment",
num: "",
unit: "¥",
isBefore: true,
},
{
name: "其他收入",
enName: "totalOther",
num: "",
unit: "¥",
isBefore: true,
2024-03-04 07:10:11 +00:00
},
2024-04-08 01:52:52 +00:00
{},
2024-03-04 07:10:11 +00:00
{
2024-04-08 01:52:52 +00:00
name: "总支出",
enName: "totalExpenditure",
num: "",
unit: "¥",
isBefore: true,
2024-03-04 07:10:11 +00:00
},
{
name: "收货支出",
2024-04-08 01:52:52 +00:00
enName: "totalReap",
num: "",
unit: "¥",
isBefore: true,
2024-03-04 07:10:11 +00:00
},
{
2024-04-08 01:52:52 +00:00
name: "其他支出",
enName: "totalOther",
num: "",
unit: "¥",
isBefore: true,
2024-03-04 07:10:11 +00:00
},
{
name: "杂费支出",
2024-04-08 01:52:52 +00:00
enName: "totalIncidentals",
num: "",
unit: "¥",
isBefore: true,
2024-03-04 07:10:11 +00:00
},
{
name: "运费支出",
2024-04-08 01:52:52 +00:00
enName: "totalFreight",
num: "",
unit: "¥",
isBefore: true,
2024-03-04 07:10:11 +00:00
},
]);
const gridList2 = reactive([
2024-04-08 01:52:52 +00:00
{
2024-03-04 07:10:11 +00:00
name: "出货实收金额",
2024-04-08 01:52:52 +00:00
enName: "actualReceived",
num: "",
unit: "¥",
isBefore: true,
2024-04-23 02:47:52 +00:00
isHighLight: true,
2024-03-04 07:10:11 +00:00
},
{
name: "出货应收金额",
2024-04-08 01:52:52 +00:00
enName: "receivable",
num: "",
unit: "¥",
isBefore: true,
2024-04-23 02:47:52 +00:00
isHighLight: true,
2024-03-04 07:10:11 +00:00
},
{
name: "出货笔数",
2024-04-08 01:52:52 +00:00
enName: "orderOutNum",
2024-03-04 07:10:11 +00:00
num: "2",
2024-04-23 02:47:52 +00:00
isHighLight: true,
2024-03-04 07:10:11 +00:00
},
{
name: "",
num: "",
},
{
name: "出货总重量",
2024-04-08 01:52:52 +00:00
enName: "outTotalWeight",
num: "",
unit: "KG",
isBefore: false,
2024-03-04 07:10:11 +00:00
},
{
name: "出货净重(客户)",
2024-04-08 01:52:52 +00:00
enName: "customerTotalWeight",
num: "",
unit: "KG",
isBefore: false,
2024-03-04 07:10:11 +00:00
},
{
name: "出货重量(已结)",
2024-04-08 01:52:52 +00:00
enName: "payOutTotalWeight",
num: "",
unit: "KG",
isBefore: false,
2024-03-04 07:10:11 +00:00
},
{
name: "结算总重量",
2024-04-08 01:52:52 +00:00
enName: "totalSettlement",
num: "",
unit: "KG",
isBefore: false,
2024-03-04 07:10:11 +00:00
},
{
name: "出货重量(未结)",
2024-04-08 01:52:52 +00:00
enName: "unPayOutTotalWeight",
num: "",
unit: "KG",
isBefore: false,
2024-03-04 07:10:11 +00:00
},
{
name: "结算重量(已结)",
2024-04-08 01:52:52 +00:00
enName: "payTotalSettlement",
num: "",
unit: "KG",
isBefore: false,
2024-03-04 07:10:11 +00:00
},
{
name: "净重误差",
2024-04-08 01:52:52 +00:00
enName: "netError",
num: "",
unit: "KG",
isBefore: false,
2024-03-04 07:10:11 +00:00
},
{
name: "结算总量(未结)",
2024-04-08 01:52:52 +00:00
enName: "unPayTotalSettlement",
num: "",
unit: "KG",
isBefore: false,
2024-03-04 07:10:11 +00:00
},
]);
const gridList3 = reactive([
{
name: "收货总重量",
2024-04-08 01:52:52 +00:00
enName: "payTotalWeight",
num: "",
unit: "KG",
isBefore: false,
2024-04-23 02:47:52 +00:00
isHighLight: true,
2024-03-04 07:10:11 +00:00
},
{
name: "收货笔数",
2024-04-08 01:52:52 +00:00
enName: "orderInNum",
num: "",
unit: "",
isBefore: false,
2024-04-23 02:47:52 +00:00
isHighLight: true,
2024-03-04 07:10:11 +00:00
},
{
name: "收货重量(已付)",
2024-04-08 01:52:52 +00:00
enName: "paymentTotalPrice",
num: "",
unit: "KG",
isBefore: false,
2024-03-04 07:10:11 +00:00
},
{
name: "收货实付金额",
2024-04-08 01:52:52 +00:00
enName: "totalWeight",
num: "",
unit: "¥",
isBefore: true,
2024-03-04 07:10:11 +00:00
},
{
name: "收货重量(未付)",
2024-04-08 01:52:52 +00:00
enName: "unPayTotalWeight",
num: "",
unit: "KG",
isBefore: false,
2024-03-04 07:10:11 +00:00
},
{
name: "收货应付金额",
2024-04-08 01:52:52 +00:00
enName: "unPaymentTotalPrice",
num: "",
unit: "¥",
isBefore: true,
2024-03-04 07:10:11 +00:00
},
]);
2024-04-08 01:52:52 +00:00
const isShowTimeDialog = ref(false);
2024-03-04 07:10:11 +00:00
const handleDialog = (v: boolean) => {
2024-04-08 01:52:52 +00:00
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();
};
2024-04-09 09:21:57 +00:00
// 获取客户/供应商应收应付总额
const getTotal = () => {
2024-04-23 02:47:52 +00:00
ReceiveApi.getTotal().then((res: any) => {
if (res.code === 200) {
const { unPayCustomerTotal, unPaySupplierTotal } = res.data;
list[0].num = unPayCustomerTotal;
list[1].num = unPaySupplierTotal;
2024-04-09 09:21:57 +00:00
}
2024-04-23 02:47:52 +00:00
});
};
2024-04-08 01:52:52 +00:00
onMounted(() => {
2024-04-23 02:47:52 +00:00
getTotal();
2024-04-08 01:52:52 +00:00
getOverview();
});
2024-03-04 07:10:11 +00:00
</script>
<style lang="scss" scoped>
.card-box {
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin-top: 25rpx;
.c-tab {
font-family: Source Han Sans CN;
font-weight: 400;
2024-04-08 01:52:52 +00:00
font-size: 28rpx;
2024-03-04 07:10:11 +00:00
color: #999999;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-around;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
text {
padding: 16rpx;
}
.active {
color: $u-primary;
border-bottom: 5rpx solid $u-primary;
border-radius: 5rpx;
}
}
.c-grid {
font-family: Source Han Sans CN;
font-weight: 400;
2024-04-08 01:52:52 +00:00
font-size: 24rpx;
2024-03-04 07:10:11 +00:00
color: #000000;
2024-04-23 02:47:52 +00:00
.time {
margin-top: 30rpx;
margin-right: 30rpx;
text-align: right;
font-size: 26rpx;
font-weight: bold;
}
2024-03-04 07:10:11 +00:00
.box {
padding: 30rpx;
display: grid;
grid-template-columns: repeat(2, 1fr);
flex: 1;
2024-04-23 02:47:52 +00:00
.highLight {
color: rgba(236, 15, 62, 1);
}
2024-03-04 07:10:11 +00:00
> view {
line-height: 50rpx;
}
}
.box + .box {
2024-04-08 01:52:52 +00:00
border-top: 18rpx solid #f8f8f8;
2024-03-04 07:10:11 +00:00
}
}
}
</style>