接入商品评论数据
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
<!-- 商家端 - 订单详情页面 -->
|
||||
=======
|
||||
<!-- 商家端 - 订单详情页面 -->
|
||||
>>>>>>> local-backup-root-cyj
|
||||
<template>
|
||||
<view class="order-detail-page">
|
||||
<!-- 订单状态头部 -->
|
||||
@@ -118,32 +114,20 @@
|
||||
<!-- 操作按钮 -->
|
||||
<view class="action-buttons">
|
||||
<view
|
||||
<<<<<<< HEAD
|
||||
v-if="order.order_status === 1"
|
||||
=======
|
||||
v-if="order.order_status === 2"
|
||||
>>>>>>> local-backup-root-cyj
|
||||
class="action-btn primary"
|
||||
@click="shipOrder"
|
||||
>
|
||||
去发货
|
||||
</view>
|
||||
<view
|
||||
<<<<<<< HEAD
|
||||
v-if="order.order_status === 2"
|
||||
=======
|
||||
v-if="order.order_status === 3"
|
||||
>>>>>>> local-backup-root-cyj
|
||||
class="action-btn primary"
|
||||
@click="viewLogistics"
|
||||
>
|
||||
查看物流
|
||||
</view>
|
||||
<<<<<<< HEAD
|
||||
<view
|
||||
=======
|
||||
<view
|
||||
>>>>>>> local-backup-root-cyj
|
||||
v-if="order.order_status === 3"
|
||||
class="action-btn primary"
|
||||
@click="confirmDelivery"
|
||||
@@ -179,11 +163,7 @@
|
||||
@change="onLogisticsChange"
|
||||
>
|
||||
<view class="picker-value">
|
||||
<<<<<<< HEAD
|
||||
{{ selectedLogistics.name || '请选择物流公司' }}
|
||||
=======
|
||||
{{ selectedLogistics?.name || '请选择物流公司' }}
|
||||
>>>>>>> local-backup-root-cyj
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
@@ -260,10 +240,6 @@
|
||||
updated_at: '',
|
||||
items: [] as OrderItemType[]
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
addressData: {} as AddressType,
|
||||
|
||||
=======
|
||||
addressData: {
|
||||
recipient_name: '',
|
||||
phone: '',
|
||||
@@ -273,7 +249,6 @@
|
||||
detail_address: ''
|
||||
} as AddressType,
|
||||
|
||||
>>>>>>> local-backup-root-cyj
|
||||
showShipModal: false,
|
||||
logisticsCompanies: [
|
||||
{ name: '顺丰速运', code: 'SF' },
|
||||
@@ -284,20 +259,11 @@
|
||||
{ name: 'EMS', code: 'EMS' },
|
||||
{ name: '京东物流', code: 'JD' }
|
||||
] as LogisticsType[],
|
||||
<<<<<<< HEAD
|
||||
selectedLogistics: {} as LogisticsType,
|
||||
=======
|
||||
selectedLogistics: { name: '', code: '' } as LogisticsType,
|
||||
>>>>>>> local-backup-root-cyj
|
||||
trackingNumber: ''
|
||||
}
|
||||
},
|
||||
|
||||
<<<<<<< HEAD
|
||||
onLoad(options: any) {
|
||||
const id = options.id as string
|
||||
if (id) {
|
||||
=======
|
||||
onLoad(options: any) { console.log('--- DEBUG ON LOAD ---', options)
|
||||
let id = ''
|
||||
if (options['id'] != null) {
|
||||
@@ -307,28 +273,18 @@
|
||||
}
|
||||
|
||||
if (id !== '') {
|
||||
>>>>>>> local-backup-root-cyj
|
||||
this.orderId = id
|
||||
this.loadOrderDetail()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
<<<<<<< HEAD
|
||||
async loadOrderDetail() {
|
||||
try {
|
||||
=======
|
||||
async loadOrderDetail() { console.log('--- DEBUG LOAD ORDER DETAIL ---', this.orderId); try {
|
||||
>>>>>>> local-backup-root-cyj
|
||||
const response = await supa
|
||||
.from('ml_orders')
|
||||
.select(`
|
||||
*,
|
||||
<<<<<<< HEAD
|
||||
order_items!inner (
|
||||
=======
|
||||
ml_order_items (
|
||||
>>>>>>> local-backup-root-cyj
|
||||
id,
|
||||
order_id,
|
||||
product_id,
|
||||
@@ -345,44 +301,12 @@
|
||||
.single()
|
||||
.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
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
const rawData = response.data as UTSJSONObject
|
||||
if (rawData == null) return
|
||||
|
||||
this.order = {
|
||||
id: rawData.getString('id') || '',
|
||||
order_no: rawData.getString('order_no') || '',
|
||||
user_id: rawData.getString('user_id') || '',
|
||||
merchant_id: rawData.getString('merchant_id') || '',
|
||||
order_status: rawData.getNumber('order_status') || 1,
|
||||
total_amount: rawData.getNumber('total_amount') || 0,
|
||||
product_amount: rawData.getNumber('product_amount') || 0,
|
||||
shipping_fee: rawData.getNumber('shipping_fee') || 0,
|
||||
discount_amount: rawData.getNumber('discount_amount') || 0,
|
||||
paid_amount: rawData.getNumber('paid_amount') || 0,
|
||||
shipping_address: rawData.getString('shipping_address') || '{}',
|
||||
remark: rawData.getString('remark') || '',
|
||||
shipping_company: rawData.getString('shipping_company') || '',
|
||||
tracking_number: rawData.getString('tracking_number') || '',
|
||||
paid_at: rawData.getString('paid_at') || '',
|
||||
shipped_at: rawData.getString('shipped_at') || '',
|
||||
created_at: rawData.getString('created_at') || '',
|
||||
updated_at: rawData.getString('updated_at') || '',
|
||||
items: []
|
||||
}
|
||||
|
||||
const itemsObj = rawData.get('order_items')
|
||||
=======
|
||||
console.log('--- DEBUG RAW ORDER DATA ---', response.data); let realData = response.data;
|
||||
let isArrLike = false;
|
||||
if (response.data != null && (response.data as any)['0'] != null) {
|
||||
@@ -416,23 +340,11 @@
|
||||
}
|
||||
|
||||
const itemsObj = rawData['ml_order_items']
|
||||
>>>>>>> local-backup-root-cyj
|
||||
if (itemsObj != null && Array.isArray(itemsObj)) {
|
||||
const itemsArray = itemsObj as any[]
|
||||
for (let i = 0; i < itemsArray.length; i++) {
|
||||
const orderItem = itemsArray[i] as UTSJSONObject
|
||||
this.order.items.push({
|
||||
<<<<<<< HEAD
|
||||
id: orderItem.getString('id') || '',
|
||||
order_id: orderItem.getString('order_id') || '',
|
||||
product_id: orderItem.getString('product_id') || '',
|
||||
sku_id: orderItem.getString('sku_id') || '',
|
||||
product_name: orderItem.getString('product_name') || '',
|
||||
sku_name: orderItem.getString('sku_name') || '',
|
||||
price: orderItem.getNumber('price') || 0,
|
||||
quantity: orderItem.getNumber('quantity') || 0,
|
||||
image_url: orderItem.getString('image_url') || '',
|
||||
=======
|
||||
id: String(orderItem['id'] ?? '') || '',
|
||||
order_id: String(orderItem['order_id'] ?? '') || '',
|
||||
product_id: String(orderItem['product_id'] ?? '') || '',
|
||||
@@ -442,7 +354,6 @@
|
||||
price: Number(orderItem['price'] ?? 0) || 0,
|
||||
quantity: Number(orderItem['quantity'] ?? 0) || 0,
|
||||
image_url: String(orderItem['image_url'] ?? '') || '',
|
||||
>>>>>>> local-backup-root-cyj
|
||||
sku_snapshot: ''
|
||||
} as OrderItemType)
|
||||
}
|
||||
@@ -550,11 +461,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
|
||||
}
|
||||
@@ -568,39 +475,23 @@
|
||||
.from('ml_orders')
|
||||
.update({
|
||||
order_status: 3,
|
||||
<<<<<<< HEAD
|
||||
shipping_company: this.selectedLogistics.name,
|
||||
tracking_number: this.trackingNumber,
|
||||
=======
|
||||
shipping_status: 2,
|
||||
carrier_name: this.selectedLogistics?.name, tracking_no: this.trackingNumber,
|
||||
>>>>>>> local-backup-root-cyj
|
||||
shipped_at: new Date().toISOString(),
|
||||
updated_at: new Date().toISOString()
|
||||
})
|
||||
.eq('id', this.order.id)
|
||||
.execute()
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (response.error != null) {
|
||||
uni.showToast({ title: '发货失败', icon: 'none' })
|
||||
=======
|
||||
if (response.error != null || (response.status ?? 200) >= 400) {
|
||||
let msg = response.error?.message ?? (response.data != null ? JSON.stringify(response.data) : '请检查网络或登录状态'); uni.showToast({ title: '发货被拦截: ' + msg, icon: 'none', duration: 4500 }); console.error('SUPABASE API ERR:', response)
|
||||
>>>>>>> local-backup-root-cyj
|
||||
return
|
||||
}
|
||||
|
||||
uni.showToast({ title: '发货成功', icon: 'success' })
|
||||
this.closeShipModal()
|
||||
this.loadOrderDetail()
|
||||
<<<<<<< HEAD
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '发货失败', icon: 'none' })
|
||||
}
|
||||
=======
|
||||
} catch (e) { uni.showToast({ title: '发货发生异常', icon: 'none' }); console.error(e) }
|
||||
>>>>>>> local-backup-root-cyj
|
||||
},
|
||||
|
||||
viewLogistics() {
|
||||
@@ -627,11 +518,7 @@
|
||||
.eq('id', this.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
|
||||
}
|
||||
@@ -659,11 +546,7 @@
|
||||
.eq('id', this.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
|
||||
}
|
||||
@@ -975,11 +858,7 @@
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
<<<<<<< HEAD
|
||||
z-index: 1000;
|
||||
=======
|
||||
z-index: 99;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
@@ -987,11 +866,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 {
|
||||
@@ -1065,24 +941,4 @@
|
||||
color: #007AFF;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>>>> local-backup-root-cyj
|
||||
</style>
|
||||
Reference in New Issue
Block a user