- add telecart_order_meta table and orders_count column for customers - introduce OcCustomerService and OrderMetaService for syncing OC data - rework OrderCreateService transaction flow, metadata handling and tests - increment telegram customer orders_count and expose it via handlers/UI - update stats dashboard with rub formatting, tooltips and customers count - sync SPA theme colors with Telegram WebApp and fix dark variant behavior - add helpers for RUB formatting and bool casting; simplify logs handler
23 lines
603 B
JavaScript
23 lines
603 B
JavaScript
import {defineStore} from "pinia";
|
|
import {apiGet, apiPost} from "@/utils/http.js";
|
|
|
|
export const useStatsStore = defineStore('stats', {
|
|
state: () => ({
|
|
items: {
|
|
orders_count: null,
|
|
orders_total_amount: null,
|
|
customers_count: null,
|
|
}
|
|
}),
|
|
|
|
actions: {
|
|
async fetchStats() {
|
|
const response = await apiPost('getDashboardStats');
|
|
this.items.orders_count = response.data?.data?.orders_count;
|
|
this.items.orders_total_amount = response.data?.data?.orders_total_amount;
|
|
this.items.customers_count = response.data?.data?.customers_count;
|
|
}
|
|
},
|
|
|
|
});
|