liu_lake vor 5 Monaten
Ursprung
Commit
b9317d7d43
2 geänderte Dateien mit 76 neuen und 32 gelöschten Zeilen
  1. 10 10
      admin-ui/src/api/order/index.ts
  2. 66 22
      admin-ui/src/views/welcome/index.vue

+ 10 - 10
admin-ui/src/api/order/index.ts

@@ -37,14 +37,6 @@ export function update<T>(id: string, data: any): Promise<Result<T>> {
   return put(`/sys/pay/order/update/${id}`, {}, data);
 }
 
-/**
- * 删除用户
- * @param userIds .
- * @returns  .
- */
-export function del<T>(userIds: string[]): Promise<Result<T>> {
-  return deleteRequest(`/sys/pay/order/remove`, {}, userIds);
-}
 
 
 /**
@@ -57,8 +49,6 @@ export function queryPayStatus<T>(id: string): Promise<Result<T>> {
 }
 
 
-
-
 /**
  * 订单回调
  * @param id .
@@ -67,3 +57,13 @@ export function queryPayStatus<T>(id: string): Promise<Result<T>> {
 export function orderCallback<T>(id: string): Promise<Result<T>> {
   return get(`/sys/pay/order/callback/${id}`,{});
 }
+
+
+/**
+ * 首页统计
+ * @param id .
+ * @returns  .
+ */
+export function total<T>(): Promise<Result<T>> {
+  return get(`/sys/pay/order/total`);
+}

+ 66 - 22
admin-ui/src/views/welcome/index.vue

@@ -1,10 +1,10 @@
 <script setup lang="ts">
-import {reactive} from "vue";
+import {onMounted, reactive} from "vue";
+import * as $api from "@/api/order/index";
 
 defineOptions({
   name: "Welcome"
 });
-
 const data = reactive({
   today: {
     // 数量
@@ -76,6 +76,21 @@ const data = reactive({
   }
 });
 
+onMounted(() => {
+  total();
+  setInterval(function(){
+    total();
+  }, 30000);
+
+});
+const total = () => {
+  $api.total().then((res: any) => {
+    data.today = res.result.today;
+    data.yesterday = res.result.yesterday;
+    data.lastWeek = res.result.lastWeek;
+    data.lastMonth = res.result.lastMonth;
+  });
+};
 </script>
 
 <template>
@@ -90,7 +105,10 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{ data.today.quantity.valid }}</span>
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
+                  data.today.quantity.valid
+                }}</span>
                 / {{ data.today.quantity.total }}
               </div>
             </div>
@@ -106,7 +124,11 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{ data.today.amount.valid }}</span> /
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
+                  data.today.amount.valid
+                }}</span>
+                /
                 {{ data.today.amount.total }}
               </div>
             </div>
@@ -122,7 +144,10 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{ data.today.earnings.valid }}</span>
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
+                  data.today.earnings.valid
+                }}</span>
               </div>
             </div>
           </div>
@@ -139,9 +164,11 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
                   data.yesterday.quantity.valid
-                }}</span> / {{ data.yesterday.quantity.total }}
+                }}</span>
+                / {{ data.yesterday.quantity.total }}
               </div>
             </div>
           </div>
@@ -156,9 +183,11 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
                   data.yesterday.amount.valid
-                }}</span> / {{ data.yesterday.amount.total }}
+                }}</span>
+                / {{ data.yesterday.amount.total }}
               </div>
             </div>
           </div>
@@ -173,9 +202,11 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
                   data.yesterday.earnings.valid
-                }}</span></div>
+                }}</span>
+              </div>
             </div>
           </div>
         </div>
@@ -191,9 +222,11 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
                   data.lastWeek.quantity.valid
-                }}</span> / {{ data.lastWeek.quantity.total }}
+                }}</span>
+                / {{ data.lastWeek.quantity.total }}
               </div>
             </div>
           </div>
@@ -208,7 +241,10 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{ data.lastWeek.amount.valid }}</span>
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
+                  data.lastWeek.amount.valid
+                }}</span>
                 / {{ data.lastWeek.amount.total }}
               </div>
             </div>
@@ -224,9 +260,11 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
                   data.lastWeek.earnings.valid
-                }}</span></div>
+                }}</span>
+              </div>
             </div>
           </div>
         </div>
@@ -242,9 +280,11 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
                   data.lastMonth.quantity.valid
-                }}</span> / {{ data.lastMonth.quantity.total }}
+                }}</span>
+                / {{ data.lastMonth.quantity.total }}
               </div>
             </div>
           </div>
@@ -259,9 +299,11 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
                   data.lastMonth.amount.valid
-                }}</span> / {{ data.lastMonth.amount.total }}
+                }}</span>
+                / {{ data.lastMonth.amount.total }}
               </div>
             </div>
           </div>
@@ -276,9 +318,11 @@ const data = reactive({
         <div class="ep-bg-purple">
           <div class="text">
             <div class="text-center h-[40px]">
-              <div class="text-xl font-bold"><span class="text-red-700 text-2xl">{{
+              <div class="text-xl font-bold">
+                <span class="text-red-700 text-2xl">{{
                   data.lastMonth.earnings.valid
-                }}</span></div>
+                }}</span>
+              </div>
             </div>
           </div>
         </div>