添加mock数据
This commit is contained in:
@@ -78,6 +78,7 @@
|
||||
|
||||
<script lang="uts">
|
||||
import supa from '@/components/supadb/aksupainstance.uts'
|
||||
import { USE_MOCK, MOCK_MERCHANT_ID, MOCK_BALANCE, MOCK_FINANCE_STATS, getMockFinanceRecords } from '@/pages/mall/merchant/mock/merchant-mock-data.uts'
|
||||
|
||||
type RecordType = {
|
||||
id: string
|
||||
@@ -113,6 +114,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') || ''
|
||||
@@ -120,6 +125,11 @@
|
||||
},
|
||||
|
||||
async loadBalance() {
|
||||
if (USE_MOCK) {
|
||||
this.balance = MOCK_BALANCE
|
||||
this.stats = MOCK_FINANCE_STATS
|
||||
return
|
||||
}
|
||||
try {
|
||||
const response = await supa.from('ml_shops').select('balance').eq('merchant_id', this.merchantId).single().execute()
|
||||
|
||||
@@ -138,7 +148,12 @@
|
||||
|
||||
async loadRecords() {
|
||||
this.loading = true
|
||||
|
||||
if (USE_MOCK) {
|
||||
this.records = getMockFinanceRecords(this.currentTab) as RecordType[]
|
||||
this.loading = false
|
||||
this.refreshing = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
const response = await supa
|
||||
.from('ml_wallet_transactions')
|
||||
|
||||
Reference in New Issue
Block a user