consumer模块完成度95%,完成部署消费者端(外网可访问consumer.meitizs.com),消费者小程序能正常运行在微信开发者工具上

This commit is contained in:
cyh666666
2026-03-05 16:54:00 +08:00
parent 7f7f723d93
commit 3b0e397714
728 changed files with 1495 additions and 985 deletions

View File

@@ -2779,6 +2779,11 @@ class SupabaseService {
// 批量更新购物车商品选中状态
async batchUpdateCartItemSelection(cartItemIds: string[], selected: boolean): Promise<boolean> {
try {
console.log('[batchUpdateCartItemSelection] 开始批量更新')
console.log('[batchUpdateCartItemSelection] cartItemIds:', JSON.stringify(cartItemIds))
console.log('[batchUpdateCartItemSelection] cartItemIds length:', cartItemIds.length)
console.log('[batchUpdateCartItemSelection] selected:', selected)
const userId = this.getCurrentUserId()
if (userId == null) {
console.error('用户未登录,无法更新购物车')
@@ -2795,6 +2800,9 @@ class SupabaseService {
.in('id', cartItemIds as any[])
.execute()
console.log('[batchUpdateCartItemSelection] response.error:', response.error)
console.log('[batchUpdateCartItemSelection] response.data:', JSON.stringify(response.data))
if (response.error != null) {
console.error('批量更新购物车商品选中状态失败:', response.error)
return false
@@ -3916,6 +3924,54 @@ class SupabaseService {
}
}
// 取消退款申请
async cancelRefund(orderId: string): Promise<RefundResponse> {
try {
console.log('[cancelRefund] 开始取消退款申请, orderId:', orderId)
const userId = this.getCurrentUserId()
if (userId == null) {
return { success: false, message: '请先登录' }
}
// 更新退款记录状态为已取消
const refundUpdateResponse = await supa
.from('ml_refunds')
.update({
status: 4, // 已取消
updated_at: new Date().toISOString()
})
.eq('order_id', orderId)
.eq('user_id', userId)
.eq('status', 1) // 只能取消待处理的退款
.execute()
if (refundUpdateResponse.error != null) {
console.error('取消退款记录失败:', refundUpdateResponse.error)
return { success: false, message: '取消失败: ' + (refundUpdateResponse.error.message ?? '未知错误') }
}
// 恢复订单状态为已完成(假设之前是已完成状态)
const orderUpdateResponse = await supa
.from('ml_orders')
.update({
order_status: 4, // 已完成
updated_at: new Date().toISOString()
})
.eq('id', orderId)
.execute()
if (orderUpdateResponse.error != null) {
console.error('恢复订单状态失败:', orderUpdateResponse.error)
// 不影响取消退款结果,只记录错误
}
return { success: true, message: '已取消退款申请' }
} catch (e) {
console.error('取消退款异常:', e)
return { success: false, message: '系统异常' }
}
}
// 再次购买
async rePurchase(order: any): Promise<boolean> {
try {