修改数据库并修改页面样式
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
// 内网环境 - 本地部署的 Supabase
|
||||
// IP: 192.168.1.62
|
||||
// Kong HTTP Port: 8000
|
||||
export const SUPA_URL: string = 'http://192.168.1.62:8000'
|
||||
export const SUPA_URL: string = 'http://192.168.1.62:13000'
|
||||
export const SUPA_KEY: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzY4ODMwNjI0LCJleHAiOjE5MjY1MTA2MjR9.mDVl-kIOdRK9v6VTxo0TDF8r7X7xk3PZXazaavHyVvg'
|
||||
|
||||
// WebSocket 实时连接(内网使用 ws:// 而非 wss://)
|
||||
export const WS_URL: string = 'ws://192.168.1.62:8000/realtime/v1/websocket'
|
||||
export const WS_URL: string = 'ws://192.168.1.62:13000/realtime/v1/websocket'
|
||||
|
||||
// 备用配置(已注释,如需切换可取消注释)
|
||||
// 开发环境 - 其他内网地址
|
||||
|
||||
@@ -454,7 +454,7 @@
|
||||
confirmPickup() {
|
||||
// TODO: 调用API确认取货
|
||||
if (this.currentTask) {
|
||||
this.currentTask.status = 4 // 更新状态为“已取货”
|
||||
this.currentTask.status = 5 // 更新状态为“已取货”
|
||||
}
|
||||
uni.showToast({
|
||||
title: '取货完成',
|
||||
@@ -462,16 +462,16 @@
|
||||
})
|
||||
},
|
||||
|
||||
startDelivery() {
|
||||
// TODO: 调用API开始配送
|
||||
if (this.currentTask) {
|
||||
this.currentTask.status = 5 // 更新状态为“配送中”
|
||||
}
|
||||
uni.showToast({
|
||||
title: '开始配送',
|
||||
icon: 'success'
|
||||
})
|
||||
},
|
||||
// startDelivery() {
|
||||
// // TODO: 调用API开始配送
|
||||
// if (this.currentTask) {
|
||||
// this.currentTask.status = 5 // 更新状态为“配送中”
|
||||
// }
|
||||
// uni.showToast({
|
||||
// title: '开始配送',
|
||||
// icon: 'success'
|
||||
// })
|
||||
// },
|
||||
|
||||
// 显示确认送达弹框
|
||||
showConfirmDeliveryDialog() {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<!-- 配送端 - 订单详情页 -->
|
||||
<template>
|
||||
<view class="delivery-order-detail">
|
||||
<!-- 返回按钮 -->
|
||||
@@ -180,16 +179,6 @@
|
||||
</template>
|
||||
|
||||
<script lang="uts">
|
||||
import type { OrderType, OrderItemType, MerchantType } from '@/types/mall-types.uts'
|
||||
|
||||
type DeliveryInfoType = {
|
||||
distance: number
|
||||
estimated_time: number
|
||||
courier_id: string
|
||||
pickup_time: string
|
||||
delivery_time: string
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -207,8 +196,8 @@ export default {
|
||||
payment_status: 0,
|
||||
delivery_address: {},
|
||||
created_at: ''
|
||||
} as OrderType,
|
||||
orderItems: [] as Array<OrderItemType & { product_image: string }>,
|
||||
},
|
||||
orderItems: [],
|
||||
merchant: {
|
||||
id: '',
|
||||
user_id: '',
|
||||
@@ -222,49 +211,50 @@ export default {
|
||||
rating: 0,
|
||||
total_sales: 0,
|
||||
created_at: ''
|
||||
} as MerchantType,
|
||||
},
|
||||
deliveryInfo: {
|
||||
distance: 0,
|
||||
estimated_time: 0,
|
||||
courier_id: '',
|
||||
pickup_time: '',
|
||||
delivery_time: ''
|
||||
} as DeliveryInfoType,
|
||||
},
|
||||
pickupAddress: '',
|
||||
customerNote: '',
|
||||
merchantNote: '',
|
||||
deliveryNote: '', // 配送备注
|
||||
deliveryNote: '',
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options: any) {
|
||||
const orderId = options.id as string
|
||||
// 👇 从 URL 参数获取 status
|
||||
// ✅ 从 URL 参数获取 status
|
||||
const status = parseInt(options.status as string) || 0
|
||||
|
||||
if (orderId) {
|
||||
// 将从 URL 获取的状态赋值给 order 对象
|
||||
this.order.id = orderId
|
||||
this.order.status = status // 👈 设置状态
|
||||
this.order.status = status // ✅ 设置传入的状态
|
||||
this.loadOrderDetail(orderId)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 返回上一页
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
|
||||
loadOrderDetail(orderId: string) {
|
||||
// ✅ 保留从 URL 获取的状态
|
||||
const originalStatus = this.order.status
|
||||
|
||||
// 模拟加载订单详情数据
|
||||
// 注意:现在 status 的值在 onLoad 时已经从 URL 获取并设置,这里可以依据它来调整数据加载逻辑(如果需要)
|
||||
// 为了演示,我们保持模拟数据不变,但实际应用中可以根据 status 加载不同的数据
|
||||
this.order = {
|
||||
...this.order, // 保留从 URL 获取的 id 和 status
|
||||
const mockOrder = {
|
||||
id: orderId,
|
||||
order_no: 'ORD202401150001',
|
||||
user_id: 'user_001',
|
||||
merchant_id: 'merchant_001',
|
||||
// ✅ 使用传入的 status,而不是硬编码
|
||||
status: originalStatus,
|
||||
total_amount: 299.98,
|
||||
discount_amount: 30.00,
|
||||
delivery_fee: 8.00,
|
||||
@@ -279,6 +269,9 @@ export default {
|
||||
created_at: '2024-01-15 14:30:00'
|
||||
}
|
||||
|
||||
// ✅ 合并数据,保留传入的 status
|
||||
Object.assign(this.order, mockOrder)
|
||||
|
||||
this.orderItems = [
|
||||
{
|
||||
id: 'item_001',
|
||||
@@ -324,7 +317,6 @@ export default {
|
||||
},
|
||||
|
||||
getStatusDesc(): string {
|
||||
// 根据 order.status 动态返回描述
|
||||
if (this.order.status >= 5) {
|
||||
return '订单已送达完成'
|
||||
} else if (this.order.status === 4) {
|
||||
@@ -349,37 +341,14 @@ export default {
|
||||
return Object.keys(specifications).map(key => `${key}: ${specifications[key]}`).join(', ')
|
||||
},
|
||||
|
||||
// ✅ 新增:点击“正在取货”按钮
|
||||
confirmArrivedAtPickup() {
|
||||
// 仅在订单未完成时执行
|
||||
if (this.order.status < 5) {
|
||||
uni.showModal({
|
||||
title: '正在取货',
|
||||
content: '确认已到达商家,开始取货?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.order.status = 3 // 更新状态为取货中
|
||||
uni.showToast({
|
||||
title: '已进入取货流程',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// ✅ 保留:点击“确认取货”按钮
|
||||
confirmPickup() {
|
||||
// 仅在订单未完成时执行
|
||||
if (this.order.status < 5) {
|
||||
uni.showModal({
|
||||
title: '确认取货',
|
||||
content: '确认已从商家处取到商品?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.order.status = 4 // 更新状态为已取货
|
||||
this.deliveryInfo.pickup_time = new Date().toISOString()
|
||||
this.order.status = 4 // 更新为已取货
|
||||
uni.showToast({
|
||||
title: '取货确认成功',
|
||||
icon: 'success'
|
||||
@@ -390,17 +359,14 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// ✅ 保留:点击“确认送达”按钮
|
||||
confirmDelivery() {
|
||||
// 仅在订单未完成时执行
|
||||
if (this.order.status < 5) {
|
||||
uni.showModal({
|
||||
title: '确认送达',
|
||||
content: '确认商品已送达到顾客手中?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.order.status = 5 // 更新状态为已完成
|
||||
this.deliveryInfo.delivery_time = new Date().toISOString()
|
||||
this.order.status = 5 // 更新为已完成
|
||||
uni.showToast({
|
||||
title: '送达确认成功',
|
||||
icon: 'success'
|
||||
@@ -411,16 +377,14 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// ✅ 保留:接受订单
|
||||
acceptOrder() {
|
||||
// 仅在订单未完成时执行
|
||||
if (this.order.status < 5) {
|
||||
uni.showModal({
|
||||
title: '接受订单',
|
||||
content: '确定接受这个配送订单吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.order.status = 2 // 更新状态为已接单
|
||||
this.order.status = 2 // 更新为已接单
|
||||
uni.showToast({
|
||||
title: '订单接受成功',
|
||||
icon: 'success'
|
||||
@@ -431,9 +395,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// ✅ 保留:拒绝订单
|
||||
rejectOrder() {
|
||||
// 仅在订单未完成时执行
|
||||
if (this.order.status < 5) {
|
||||
uni.showModal({
|
||||
title: '拒绝订单',
|
||||
@@ -451,9 +413,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// ✅ 保留:启动导航(用于“前往取货”按钮)
|
||||
startNavigation() {
|
||||
// 仅在订单未完成时执行
|
||||
if (this.order.status < 5) {
|
||||
uni.showToast({
|
||||
title: '正在启动导航',
|
||||
@@ -471,15 +431,11 @@ export default {
|
||||
|
||||
callCustomer() {
|
||||
const phone = this.getDeliveryAddress().phone
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phone
|
||||
})
|
||||
uni.makePhoneCall({ phoneNumber: phone })
|
||||
},
|
||||
|
||||
callMerchant() {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: this.merchant.contact_phone
|
||||
})
|
||||
uni.makePhoneCall({ phoneNumber: this.merchant.contact_phone })
|
||||
},
|
||||
|
||||
contactService() {
|
||||
@@ -492,13 +448,14 @@ export default {
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* ... 保持原有 style 部分不变 ... */
|
||||
/* 保持原有样式不变 */
|
||||
.delivery-order-detail {
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
padding-bottom: 160rpx;
|
||||
}
|
||||
|
||||
/* ... 其余样式保持原样 ... */
|
||||
/* 返回按钮头部 */
|
||||
.back-header {
|
||||
background-color: #fff;
|
||||
@@ -866,18 +823,18 @@ export default {
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
gap: 15rpx;
|
||||
flex-wrap: wrap; /* 允许按钮换行 */
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
flex: 1;
|
||||
min-width: 120rpx; /* 设置最小宽度 */
|
||||
min-width: 120rpx;
|
||||
height: 70rpx;
|
||||
border-radius: 35rpx;
|
||||
font-size: 26rpx;
|
||||
border: none;
|
||||
margin: 5rpx; /* 添加外边距 */
|
||||
box-sizing: border-box; /* 确保宽高包含边距 */
|
||||
margin: 5rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.action-btn.accept, .action-btn.complete {
|
||||
|
||||
Reference in New Issue
Block a user