添加mock数据
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user