Files
naive-ui-admin/mock/dashboard/console.ts
ahjung 7a62de39c2 2.0.0
2024-09-14 22:39:11 +08:00

45 lines
1.4 KiB
TypeScript

import { defineMock } from '@alova/mock';
import { faker } from '@faker-js/faker';
import { resultSuccess } from '../_util';
function getRandom(options) {
return Number(faker.commerce.price(options));
}
const result = {
//访问量
visits: {
dayVisits: getRandom({ min: 10000, max: 99999, dec: 2 }),
rise: getRandom({ min: 10000, max: 99999, dec: 0 }),
decline: getRandom({ min: 10000, max: 99999, dec: 0 }),
amount: getRandom({ min: 10000, max: 99999, dec: 2 }),
},
//销售额
saleroom: {
weekSaleroom: getRandom({ min: 10000, max: 99999, dec: 2 }),
amount: getRandom({ min: 10000, max: 99999, dec: 2 }),
degree: getRandom({ min: 10000, max: 99999, dec: 0 }),
},
//订单量
orderLarge: {
weekLarge: getRandom({ min: 10000, max: 99999, dec: 2 }),
rise: getRandom({ min: 10000, max: 99999, dec: 0 }),
decline: getRandom({ min: 10000, max: 99999, dec: 0 }),
amount: getRandom({ min: 10000, max: 99999, dec: 2 }),
},
//成交额度
volume: {
weekLarge: getRandom({ min: 10000, max: 99999, dec: 2 }),
rise: getRandom({ min: 10000, max: 99999, dec: 0 }),
decline: getRandom({ min: 10000, max: 99999, dec: 0 }),
amount: getRandom({ min: 10000, max: 99999, dec: 2 }),
},
};
export default defineMock({
// 主控台数据
'/api/dashboard/console': () => {
return resultSuccess(result);
},
});