完成consumer端同步
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view class="favorites-content" :scroll-y="true">
|
||||
<scroll-view class="favorites-content" direction="vertical">
|
||||
<view v-if="favorites.length === 0 && !isLoading" class="empty-favorites">
|
||||
<text class="empty-icon">❤️</text>
|
||||
<text class="empty-text">暂无收藏商品</text>
|
||||
@@ -63,6 +63,7 @@
|
||||
<script setup lang="uts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { supabaseService } from '@/utils/supabaseService.uts'
|
||||
import { goToLogin } from '@/utils/utils.uts'
|
||||
|
||||
type FavoriteType = {
|
||||
id: string
|
||||
@@ -105,7 +106,7 @@ const loadFavorites = async () => {
|
||||
prod = itemObj.get('ml_products')
|
||||
}
|
||||
|
||||
let image = '/static/default-product.png'
|
||||
let image = '/static/images/default.png'
|
||||
let id = ''
|
||||
let name = '未知商品'
|
||||
let price = 0
|
||||
@@ -125,7 +126,7 @@ const loadFavorites = async () => {
|
||||
image = prodObj.getString('main_image_url') ?? image
|
||||
merchantId = prodObj.getString('merchant_id') ?? ''
|
||||
|
||||
if (image === '/static/default-product.png') {
|
||||
if (image === '/static/images/default.png') {
|
||||
const imgUrls = prodObj.getString('image_urls')
|
||||
if (imgUrls != null) {
|
||||
try {
|
||||
@@ -285,6 +286,11 @@ const viewProduct = (product: FavoriteType) => {
|
||||
}
|
||||
|
||||
const addToCart = async (product: FavoriteType) => {
|
||||
const userId = supabaseService.getCurrentUserId()
|
||||
if (userId == null || userId === '') {
|
||||
goToLogin('/pages/mall/consumer/favorites')
|
||||
return
|
||||
}
|
||||
uni.showLoading({ title: '检查商品...' })
|
||||
try {
|
||||
const merchantId = product.merchant_id ?? ''
|
||||
|
||||
Reference in New Issue
Block a user