接入商品评论数据
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
<!-- 商家端 - 订单管理页面 -->
|
||||
=======
|
||||
<!-- 商家端 - 订单管理页面 -->
|
||||
>>>>>>> local-backup-root-cyj
|
||||
<template>
|
||||
<view class="orders-page">
|
||||
<!-- 标签页切换 -->
|
||||
@@ -100,22 +96,14 @@
|
||||
</view>
|
||||
<view class="order-actions">
|
||||
<view
|
||||
<<<<<<< HEAD
|
||||
v-if="order.order_status === 1"
|
||||
=======
|
||||
v-if="order.order_status === 2"
|
||||
>>>>>>> local-backup-root-cyj
|
||||
class="action-btn primary"
|
||||
@click.stop="shipOrder(order)"
|
||||
>
|
||||
发货
|
||||
</view>
|
||||
<view
|
||||
<<<<<<< HEAD
|
||||
v-if="order.order_status === 2"
|
||||
=======
|
||||
v-if="order.order_status === 3"
|
||||
>>>>>>> local-backup-root-cyj
|
||||
class="action-btn info"
|
||||
@click.stop="viewLogistics(order)"
|
||||
>
|
||||
@@ -159,11 +147,7 @@
|
||||
@change="onLogisticsChange"
|
||||
>
|
||||
<view class="picker-value">
|
||||
<<<<<<< HEAD
|
||||
{{ selectedLogistics.name || '请选择物流公司' }}
|
||||
=======
|
||||
{{ selectedLogistics?.name || '请选择物流公司' }}
|
||||
>>>>>>> local-backup-root-cyj
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
@@ -238,11 +222,7 @@
|
||||
{ name: '待发货', status: 2, count: 0 },
|
||||
{ name: '待收货', status: 3, count: 0 },
|
||||
{ name: '已完成', status: 4, count: 0 },
|
||||
<<<<<<< HEAD
|
||||
{ name: '退款', status: 0, count: 0 }
|
||||
=======
|
||||
{ name: '退款', status: 6, count: 0 }
|
||||
>>>>>>> local-backup-root-cyj
|
||||
] as TabType[],
|
||||
currentTab: -2,
|
||||
searchKeyword: '',
|
||||
@@ -277,11 +257,7 @@
|
||||
const statusMap: Record<string, number> = {
|
||||
'pending': 1,
|
||||
'shipped': 3,
|
||||
<<<<<<< HEAD
|
||||
'refund': 0,
|
||||
=======
|
||||
'refund': 6,
|
||||
>>>>>>> local-backup-root-cyj
|
||||
'completed': 4
|
||||
}
|
||||
this.currentTab = statusMap[type] ?? -2
|
||||
@@ -325,11 +301,7 @@
|
||||
.from('ml_orders')
|
||||
.select(`
|
||||
*,
|
||||
<<<<<<< HEAD
|
||||
order_items!inner (
|
||||
=======
|
||||
order_items (
|
||||
>>>>>>> local-backup-root-cyj
|
||||
id,
|
||||
order_id,
|
||||
product_id,
|
||||
@@ -348,14 +320,9 @@
|
||||
.limit(this.limit)
|
||||
|
||||
if (this.currentTab !== -2) {
|
||||
<<<<<<< HEAD
|
||||
if (this.currentTab === 0) {
|
||||
query = query.eq('order_status', 0)
|
||||
=======
|
||||
if (this.currentTab === 6) {
|
||||
// 退款状态同时查询 0 和 6
|
||||
query = query.in('order_status', [0, 6])
|
||||
>>>>>>> local-backup-root-cyj
|
||||
} else {
|
||||
query = query.eq('order_status', this.currentTab)
|
||||
}
|
||||
@@ -367,11 +334,7 @@
|
||||
|
||||
const response = await query.execute()
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (response.error != null) {
|
||||
=======
|
||||
if (response.error != null || (response.status ?? 200) >= 400) {
|
||||
>>>>>>> local-backup-root-cyj
|
||||
console.error('获取订单失败:', response.error)
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
return
|
||||
@@ -387,32 +350,20 @@
|
||||
const ordersData: OrderType[] = []
|
||||
for (let i = 0; i < rawData.length; i++) {
|
||||
const item = rawData[i]
|
||||
<<<<<<< HEAD
|
||||
const orderObj = item as UTSJSONObject
|
||||
=======
|
||||
const str = JSON.stringify(item)
|
||||
const orderObj = JSON.parse(str) as UTSJSONObject
|
||||
>>>>>>> local-backup-root-cyj
|
||||
|
||||
const order: OrderType = {
|
||||
id: orderObj.getString('id') || '',
|
||||
order_no: orderObj.getString('order_no') || '',
|
||||
user_id: orderObj.getString('user_id') || '',
|
||||
merchant_id: orderObj.getString('merchant_id') || '',
|
||||
<<<<<<< HEAD
|
||||
order_status: orderObj.getNumber('order_status') || 1,
|
||||
=======
|
||||
order_status: orderObj.getNumber('order_status') ?? (orderObj.get('order_status') == null ? 1 : (orderObj.get('order_status') as number)),
|
||||
>>>>>>> local-backup-root-cyj
|
||||
total_amount: orderObj.getNumber('total_amount') || 0,
|
||||
product_amount: orderObj.getNumber('product_amount') || 0,
|
||||
shipping_fee: orderObj.getNumber('shipping_fee') || 0,
|
||||
paid_amount: orderObj.getNumber('paid_amount') || 0,
|
||||
<<<<<<< HEAD
|
||||
shipping_address: orderObj.getString('shipping_address') || '',
|
||||
=======
|
||||
shipping_address: orderObj.get('shipping_address') != null ? (typeof orderObj.get('shipping_address') === 'string' ? orderObj.getString('shipping_address')! : JSON.stringify(orderObj.get('shipping_address'))) : '',
|
||||
>>>>>>> local-backup-root-cyj
|
||||
remark: orderObj.getString('remark') || '',
|
||||
created_at: orderObj.getString('created_at') || '',
|
||||
updated_at: orderObj.getString('updated_at') || '',
|
||||
@@ -423,14 +374,10 @@
|
||||
if (itemsObj != null && Array.isArray(itemsObj)) {
|
||||
const itemsArray = itemsObj as any[]
|
||||
for (let j = 0; j < itemsArray.length; j++) {
|
||||
<<<<<<< HEAD
|
||||
const orderItem = itemsArray[j] as UTSJSONObject
|
||||
=======
|
||||
const rawItem = itemsArray[j]
|
||||
const itemStr = JSON.stringify(rawItem)
|
||||
const orderItem = JSON.parse(itemStr) as UTSJSONObject
|
||||
|
||||
>>>>>>> local-backup-root-cyj
|
||||
order.items.push({
|
||||
id: orderItem.getString('id') || '',
|
||||
order_id: orderItem.getString('order_id') || '',
|
||||
@@ -482,10 +429,6 @@
|
||||
const rawData = response.data as any[]
|
||||
if (rawData != null) {
|
||||
for (let i = 0; i < rawData.length; i++) {
|
||||
<<<<<<< HEAD
|
||||
const item = rawData[i] as UTSJSONObject
|
||||
const status = item.getNumber('order_status') || 1
|
||||
=======
|
||||
const row = rawData[i]
|
||||
const istr = JSON.stringify(row)
|
||||
const item = JSON.parse(istr) as UTSJSONObject
|
||||
@@ -495,16 +438,11 @@
|
||||
status = (typeof status_val === 'number') ? (status_val as number) : parseInt(status_val.toString())
|
||||
}
|
||||
|
||||
>>>>>>> local-backup-root-cyj
|
||||
if (status === 1) counts[1]++
|
||||
else if (status === 2) counts[2]++
|
||||
else if (status === 3) counts[3]++
|
||||
else if (status === 4) counts[4]++
|
||||
<<<<<<< HEAD
|
||||
else if (status === 0) counts[0]++
|
||||
=======
|
||||
else if (status === 0 || status === 6) counts[0]++
|
||||
>>>>>>> local-backup-root-cyj
|
||||
total++
|
||||
}
|
||||
}
|
||||
@@ -574,11 +512,7 @@
|
||||
},
|
||||
|
||||
async confirmShip() {
|
||||
<<<<<<< HEAD
|
||||
if (!this.selectedLogistics.name) {
|
||||
=======
|
||||
if (this.selectedLogistics == null || !this.selectedLogistics?.name) {
|
||||
>>>>>>> local-backup-root-cyj
|
||||
uni.showToast({ title: '请选择物流公司', icon: 'none' })
|
||||
return
|
||||
}
|
||||
@@ -588,22 +522,6 @@
|
||||
}
|
||||
|
||||
try {
|
||||
<<<<<<< HEAD
|
||||
const response = await supa
|
||||
.from('ml_orders')
|
||||
.update({
|
||||
order_status: 3,
|
||||
shipping_company: this.selectedLogistics.name,
|
||||
tracking_number: this.trackingNumber,
|
||||
shipped_at: new Date().toISOString(),
|
||||
updated_at: new Date().toISOString()
|
||||
})
|
||||
.eq('id', this.currentOrder!.id)
|
||||
.execute()
|
||||
|
||||
if (response.error != null) {
|
||||
uni.showToast({ title: '发货失败', icon: 'none' })
|
||||
=======
|
||||
const payloadStr = JSON.stringify({
|
||||
order_status: 3,
|
||||
shipping_status: 2,
|
||||
@@ -627,7 +545,6 @@
|
||||
msg = rData.getString('message') ?? rData.getString('code') ?? JSON.stringify(rData);
|
||||
}
|
||||
if (!msg) msg = '请检查网络或登录状态'; uni.showToast({ title: '发货被拦截: ' + msg, icon: 'none', duration: 4500 }); console.error('SUPABASE API ERR:', response)
|
||||
>>>>>>> local-backup-root-cyj
|
||||
return
|
||||
}
|
||||
|
||||
@@ -635,22 +552,12 @@
|
||||
this.closeShipModal()
|
||||
this.loadOrders()
|
||||
this.loadOrderCounts()
|
||||
<<<<<<< HEAD
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '发货失败', icon: 'none' })
|
||||
}
|
||||
=======
|
||||
} catch (e) { uni.showToast({ title: '发货发生异常', icon: 'none' }); console.error(e) }
|
||||
>>>>>>> local-backup-root-cyj
|
||||
},
|
||||
|
||||
viewLogistics(order: OrderType) {
|
||||
uni.navigateTo({
|
||||
<<<<<<< HEAD
|
||||
url: `/pages/mall/merchant/logistics?orderId=${order.id}`
|
||||
=======
|
||||
url: `/pages/mall/consumer/logistics?orderId=${order.id}`
|
||||
>>>>>>> local-backup-root-cyj
|
||||
})
|
||||
},
|
||||
|
||||
@@ -667,11 +574,7 @@
|
||||
.eq('id', order.id)
|
||||
.execute()
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (response.error != null) {
|
||||
=======
|
||||
if (response.error != null || (response.status ?? 200) >= 400) {
|
||||
>>>>>>> local-backup-root-cyj
|
||||
uni.showToast({ title: '删除失败', icon: 'none' })
|
||||
return
|
||||
}
|
||||
@@ -692,12 +595,8 @@
|
||||
if (status === 2) return '待发货'
|
||||
if (status === 3) return '待收货'
|
||||
if (status === 4) return '已完成'
|
||||
<<<<<<< HEAD
|
||||
if (status === 0) return '退款中'
|
||||
=======
|
||||
if (status === 0 || status === 6) return '退款/售后'
|
||||
if (status === 7) return '退货完成'
|
||||
>>>>>>> local-backup-root-cyj
|
||||
if (status === 5 || status === -1) return '已取消'
|
||||
return '未知'
|
||||
},
|
||||
@@ -838,14 +737,9 @@
|
||||
|
||||
.order-card {
|
||||
background-color: #fff;
|
||||
<<<<<<< HEAD
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 20rpx;
|
||||
=======
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
||||
>>>>>>> local-backup-root-cyj
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -944,12 +838,6 @@
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
.product-spec {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-top: 8rpx;
|
||||
=======
|
||||
.product-name {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
@@ -970,28 +858,20 @@
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 4rpx;
|
||||
align-self: flex-start;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
}
|
||||
|
||||
.product-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
margin-left: 20rpx;
|
||||
min-width: 120rpx;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
}
|
||||
|
||||
.product-price {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
<<<<<<< HEAD
|
||||
font-weight: 500;
|
||||
=======
|
||||
font-weight: bold;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
}
|
||||
|
||||
.product-quantity {
|
||||
@@ -1004,14 +884,9 @@
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
<<<<<<< HEAD
|
||||
padding: 20rpx 24rpx;
|
||||
border-top: 1rpx solid #f5f5f5;
|
||||
=======
|
||||
padding: 24rpx;
|
||||
border-top: 1rpx solid #f8f8f8;
|
||||
background-color: #fafafa;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
}
|
||||
|
||||
.order-amount {
|
||||
@@ -1025,11 +900,7 @@
|
||||
}
|
||||
|
||||
.amount-value {
|
||||
<<<<<<< HEAD
|
||||
font-size: 28rpx;
|
||||
=======
|
||||
font-size: 32rpx;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
color: #FF3B30;
|
||||
font-weight: bold;
|
||||
margin-left: 10rpx;
|
||||
@@ -1041,11 +912,6 @@
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
<<<<<<< HEAD
|
||||
padding: 12rpx 24rpx;
|
||||
font-size: 24rpx;
|
||||
border-radius: 28rpx;
|
||||
=======
|
||||
min-width: 120rpx;
|
||||
height: 56rpx;
|
||||
display: flex;
|
||||
@@ -1055,24 +921,11 @@
|
||||
border-radius: 28rpx;
|
||||
border: 1rpx solid #eee;
|
||||
padding: 0 20rpx;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
}
|
||||
|
||||
.action-btn.primary {
|
||||
background-color: #007AFF;
|
||||
color: #fff;
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
|
||||
.action-btn.info {
|
||||
background-color: #E3F2FD;
|
||||
color: #1976D2;
|
||||
}
|
||||
|
||||
.action-btn.default {
|
||||
background-color: #F5F5F5;
|
||||
color: #666;
|
||||
=======
|
||||
border: none;
|
||||
}
|
||||
|
||||
@@ -1086,7 +939,6 @@
|
||||
background-color: #fff;
|
||||
color: #666;
|
||||
border-color: #ddd;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
}
|
||||
|
||||
.load-more, .no-more {
|
||||
@@ -1109,11 +961,7 @@
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
<<<<<<< HEAD
|
||||
z-index: 1000;
|
||||
=======
|
||||
z-index: 99;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
@@ -1121,11 +969,8 @@
|
||||
background-color: #fff;
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
position: relative;
|
||||
z-index: 99;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
@@ -1199,20 +1044,4 @@
|
||||
color: #007AFF;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>>>> local-backup-root-cyj
|
||||
</style>
|
||||
Reference in New Issue
Block a user