合并merchant文件
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
<<<<<<< HEAD
|
||||
<!-- 商家端 - 订单详情页面 -->
|
||||
=======
|
||||
<!-- 商家端 - 订单详情页面 -->
|
||||
>>>>>>> local-backup-root-cyj
|
||||
<template>
|
||||
<view class="order-detail-page">
|
||||
<!-- 订单状态头部 -->
|
||||
@@ -114,20 +118,32 @@
|
||||
<!-- 操作按钮 -->
|
||||
<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"
|
||||
@@ -163,7 +179,11 @@
|
||||
@change="onLogisticsChange"
|
||||
>
|
||||
<view class="picker-value">
|
||||
<<<<<<< HEAD
|
||||
{{ selectedLogistics.name || '请选择物流公司' }}
|
||||
=======
|
||||
{{ selectedLogistics?.name || '请选择物流公司' }}
|
||||
>>>>>>> local-backup-root-cyj
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
@@ -240,8 +260,20 @@
|
||||
updated_at: '',
|
||||
items: [] as OrderItemType[]
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
addressData: {} as AddressType,
|
||||
|
||||
=======
|
||||
addressData: {
|
||||
recipient_name: '',
|
||||
phone: '',
|
||||
province: '',
|
||||
city: '',
|
||||
district: '',
|
||||
detail_address: ''
|
||||
} as AddressType,
|
||||
|
||||
>>>>>>> local-backup-root-cyj
|
||||
showShipModal: false,
|
||||
logisticsCompanies: [
|
||||
{ name: '顺丰速运', code: 'SF' },
|
||||
@@ -252,27 +284,51 @@
|
||||
{ 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) {
|
||||
id = options['id'] as string
|
||||
} else if (options.id != null) {
|
||||
id = options.id as string
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -289,12 +345,17 @@
|
||||
.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
|
||||
|
||||
@@ -321,11 +382,47 @@
|
||||
}
|
||||
|
||||
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) {
|
||||
realData = (response.data as any)['0'];
|
||||
isArrLike = true;
|
||||
}
|
||||
console.log('--- EXTRACTED realData ---', isArrLike);
|
||||
const rawData = realData as UTSJSONObject
|
||||
if (rawData == null) return
|
||||
|
||||
this.order = {
|
||||
id: String(rawData['id'] ?? '') || '',
|
||||
order_no: String(rawData['order_no'] ?? '') || '',
|
||||
user_id: String(rawData['user_id'] ?? '') || '',
|
||||
merchant_id: String(rawData['merchant_id'] ?? '') || '',
|
||||
order_status: Number(rawData['order_status'] ?? 0) || 1,
|
||||
total_amount: Number(rawData['total_amount'] ?? 0) || 0,
|
||||
product_amount: Number(rawData['product_amount'] ?? 0) || 0,
|
||||
shipping_fee: Number(rawData['shipping_fee'] ?? 0) || 0,
|
||||
discount_amount: Number(rawData['discount_amount'] ?? 0) || 0,
|
||||
paid_amount: Number(rawData['paid_amount'] ?? 0) || 0,
|
||||
shipping_address: String(rawData['shipping_address'] ?? '') || '{}',
|
||||
remark: String(rawData['remark'] ?? '') || '',
|
||||
shipping_company: String(rawData['carrier_name'] ?? rawData['shipping_company'] ?? '') || '',
|
||||
tracking_number: String(rawData['tracking_no'] ?? rawData['tracking_number'] ?? '') || '',
|
||||
paid_at: String(rawData['paid_at'] ?? '') || '',
|
||||
shipped_at: String(rawData['shipped_at'] ?? '') || '',
|
||||
created_at: String(rawData['created_at'] ?? '') || '',
|
||||
updated_at: String(rawData['updated_at'] ?? '') || '',
|
||||
items: []
|
||||
}
|
||||
|
||||
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') || '',
|
||||
@@ -335,6 +432,17 @@
|
||||
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'] ?? '') || '',
|
||||
sku_id: String(orderItem['sku_id'] ?? '') || '',
|
||||
product_name: String(orderItem['product_name'] ?? '') || '',
|
||||
sku_name: String(orderItem['sku_name'] ?? '') || '',
|
||||
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)
|
||||
}
|
||||
@@ -442,7 +550,11 @@
|
||||
},
|
||||
|
||||
async confirmShip() {
|
||||
<<<<<<< HEAD
|
||||
if (!this.selectedLogistics.name) {
|
||||
=======
|
||||
if (this.selectedLogistics == null || !this.selectedLogistics?.name) {
|
||||
>>>>>>> local-backup-root-cyj
|
||||
uni.showToast({ title: '请选择物流公司', icon: 'none' })
|
||||
return
|
||||
}
|
||||
@@ -456,25 +568,39 @@
|
||||
.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() {
|
||||
@@ -501,7 +627,11 @@
|
||||
.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
|
||||
}
|
||||
@@ -529,7 +659,11 @@
|
||||
.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
|
||||
}
|
||||
@@ -841,7 +975,11 @@
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
<<<<<<< HEAD
|
||||
z-index: 1000;
|
||||
=======
|
||||
z-index: 99;
|
||||
>>>>>>> local-backup-root-cyj
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
@@ -849,6 +987,11 @@
|
||||
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 {
|
||||
@@ -923,3 +1066,23 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>>>> local-backup-root-cyj
|
||||
|
||||
Reference in New Issue
Block a user