添加mock数据
This commit is contained in:
@@ -348,6 +348,7 @@
|
||||
<script lang="uts">
|
||||
import supa from '@/components/supadb/aksupainstance.uts'
|
||||
import MerchantTabBar from '@/components/merchant-tabbar/MerchantTabBar.uvue'
|
||||
import { USE_MOCK, MOCK_MERCHANT_ID, getMockOrdersByStatus, getMockAftersaleByStatus, getMockOrderTabCounts, getMockAftersaleTabCounts } from '@/pages/mall/merchant/mock/merchant-mock-data.uts'
|
||||
|
||||
type OrderItemType = {
|
||||
id: string
|
||||
@@ -531,6 +532,10 @@
|
||||
},
|
||||
|
||||
async initMerchantId() {
|
||||
if (USE_MOCK) {
|
||||
this.merchantId = MOCK_MERCHANT_ID
|
||||
return
|
||||
}
|
||||
try {
|
||||
const session = supa.getSession()
|
||||
if (session != null && session.user != null) {
|
||||
@@ -547,7 +552,14 @@
|
||||
async loadOrders() {
|
||||
if (this.loading) return
|
||||
this.loading = true
|
||||
|
||||
if (USE_MOCK) {
|
||||
const filtered = getMockOrdersByStatus(this.currentTab)
|
||||
this.orders = filtered as OrderType[]
|
||||
this.hasMore = false
|
||||
this.loading = false
|
||||
this.refreshing = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let query = supa
|
||||
.from('ml_orders')
|
||||
@@ -664,6 +676,18 @@
|
||||
},
|
||||
|
||||
async loadOrderCounts() {
|
||||
if (USE_MOCK) {
|
||||
const c = getMockOrderTabCounts()
|
||||
this.orderTabs[0].count = c.pending
|
||||
this.orderTabs[1].count = c.inprogress
|
||||
this.orderTabs[2].count = c.completed
|
||||
this.orderTabs[3].count = c.total
|
||||
const ac = getMockAftersaleTabCounts()
|
||||
this.aftersaleTabs[0].count = ac.total
|
||||
this.aftersaleTabs[1].count = ac.refunding
|
||||
this.aftersaleTabs[2].count = ac.refunded
|
||||
return
|
||||
}
|
||||
try {
|
||||
const response = await supa
|
||||
.from('ml_orders')
|
||||
@@ -740,6 +764,14 @@
|
||||
async loadAftersaleOrders() {
|
||||
if (this.aftersaleLoading) return
|
||||
this.aftersaleLoading = true
|
||||
if (USE_MOCK) {
|
||||
const filtered = getMockAftersaleByStatus(this.currentAftersaleTab)
|
||||
this.aftersaleOrders = filtered as OrderType[]
|
||||
this.aftersaleHasMore = false
|
||||
this.aftersaleLoading = false
|
||||
this.aftersaleRefreshing = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let query = supa
|
||||
.from('ml_orders')
|
||||
|
||||
Reference in New Issue
Block a user