添加mock数据

This commit is contained in:
2026-04-13 11:32:31 +08:00
parent 334e5936c9
commit 37141c1d6b
17 changed files with 1843 additions and 330 deletions

View File

@@ -68,6 +68,7 @@
<script lang="uts">
import supa from '@/components/supadb/aksupainstance.uts'
import { USE_MOCK, MOCK_MERCHANT_ID, getMockStats, getMockTrendData, MOCK_HOT_PRODUCTS } from '@/pages/mall/merchant/mock/merchant-mock-data.uts'
type ProductType = {
id: string
@@ -116,6 +117,10 @@
methods: {
async initMerchantId() {
if (USE_MOCK) {
this.merchantId = MOCK_MERCHANT_ID
return
}
try {
const session = supa.getSession()
this.merchantId = session?.user?.getString('id') || uni.getStorageSync('user_id') || ''
@@ -123,6 +128,13 @@
},
async loadStatistics() {
if (USE_MOCK) {
const s = getMockStats(this.dateRange)
this.stats = s
this.trendData = getMockTrendData(this.dateRange)
this.hotProducts = MOCK_HOT_PRODUCTS as ProductType[]
return
}
try {
const response = await supa
.from('ml_orders')