This commit is contained in:
weipengfei 2024-01-02 16:59:15 +08:00
parent f137b40586
commit b89c36a328
5 changed files with 35 additions and 15 deletions

View File

@ -1,2 +1,2 @@
VITE_BASE_URL = '/' # VITE_BASE_URL = '/'
# VITE_BASE_URL = 'https://shop.lihaink.cn/api' VITE_BASE_URL = 'https://shop.lihaink.cn/api'

View File

@ -32,6 +32,11 @@ export const orderRanking = (data) => {
return axios.get('dataview/order_ranking', { params: data }); return axios.get('dataview/order_ranking', { params: data });
} }
// 三轮车订单排行
export const vehicleOrderRanking = (data) => {
return axios.get('dataview/vehicle_order_ranking', { params: data });
}
// 配送商品排行 // 配送商品排行
export const deliveredProductRanking = (data) => { export const deliveredProductRanking = (data) => {
return axios.get('dataview/delivered_product_ranking', { params: data }); return axios.get('dataview/delivered_product_ranking', { params: data });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 981 KiB

View File

@ -21,6 +21,22 @@ const hdClick = (e) => {
// } // }
} }
const formatTimestamp = (timestamp)=> {
const date = new Date(timestamp);
const year = date.getFullYear();
const month = ('0' + (date.getMonth() + 1)).slice(-2);
const day = ('0' + date.getDate()).slice(-2);
const hours = ('0' + date.getHours()).slice(-2);
const minutes = ('0' + date.getMinutes()).slice(-2);
const seconds = ('0' + date.getSeconds()).slice(-2);
const formattedDate = `${year}-${month}-${day}`;
const formattedTime = `${hours}:${minutes}:${seconds}`;
return `${formattedDate} ${formattedTime}`;
}
const initData = (data) => { const initData = (data) => {
let arr = []; let arr = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
@ -31,14 +47,14 @@ const initData = (data) => {
arr.push( arr.push(
[ [
`<div class="${calss}">${data[i].order_sn || '-'}</div>`, `<div class="${calss}">${data[i].order_sn || '-'}</div>`,
`<div class="${calss}">${data[i].receiver_name || '-'}</div>`,
`<div class="${calss}">${data[i].receiver_phone || '-'}</div>`,
`<div class="${calss}">${data[i].receiver_address || '-'}</div>`,
`<div class="${calss}">${data[i].product_name || '-'}</div>`,
`<div class="${calss}">${data[i].shop_name || '-'}</div>`,
`<div class="${calss}">${formatTimestamp(data[i].create_time*1000) || '-'}</div>`,
`<div class="${calss}">${titleText.value || '-'}</div>`,
`<div class="${calss}">${data[i].captain_name || '-'}</div>`, `<div class="${calss}">${data[i].captain_name || '-'}</div>`,
`<div class="${calss}">${data[i].user_phone || '-'}</div>`,
`<div class="${calss}">${data[i].user_address || '-'}</div>`,
`<div class="${calss}">${data[i].store_name || '-'}</div>`,
`<div class="${calss}">${data[i].mer_name || '-'}</div>`,
`<div class="${calss}">${data[i].create_time || '-'}</div>`,
`<div class="${calss}">${data[i].status || '-'}</div>`,
`<div class="${calss}">${data[i].courier || '-'}</div>`,
] ]
) )
} }

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { nextTick, onMounted, onUnmounted, reactive, ref } from "vue" import { nextTick, onMounted, onUnmounted, reactive, ref } from "vue"
import border from "../../../components/border.vue" import border from "../../../components/border.vue"
import { orderRanking } from "@/api/index.js" import { vehicleOrderRanking } from "@/api/index.js"
import { useAppStore } from "@/store/app.js" import { useAppStore } from "@/store/app.js"
const appStore = useAppStore(); const appStore = useAppStore();
@ -27,12 +27,11 @@ const autoScroll = () => {
const max = ref(0); const max = ref(0);
const loadOrderList = () => { const loadOrderList = () => {
orderRanking({ vehicleOrderRanking({
areaCode: appStore.address.areaCode, areaCode: appStore.address.areaCode,
streetCode: appStore.address.streetCode, streetCode: appStore.address.streetCode,
type: 1, // 1, 2
}).then((res) => { }).then((res) => {
items.value = res.data.townOrderList; items.value = res.data;
items.value.forEach(e => { items.value.forEach(e => {
if (e.order_count > max.value) max.value = e.order_count; if (e.order_count > max.value) max.value = e.order_count;
}) })
@ -57,7 +56,7 @@ onUnmounted(() => {
<template> <template>
<border> <border>
<div class="box"> <div class="box">
<div class="title">订单排行榜</div> <div class="title">三轮车订单排行榜</div>
<div <div
style=" style="
height: calc(100% - 3.75rem); height: calc(100% - 3.75rem);
@ -71,7 +70,7 @@ onUnmounted(() => {
<div class="rank" :class="index < 3 ? 'rank1' : 'rank2'"> <div class="rank" :class="index < 3 ? 'rank1' : 'rank2'">
{{ index + 1 }} {{ index + 1 }}
</div> </div>
<div class="name">{{ item.street_name }}</div> <div class="name">{{ item.license }}</div>
<div class="line"> <div class="line">
<div <div
class="line-body" class="line-body"