|
|
@ -28,7 +28,7 @@ |
|
|
|
<view class="footer-btn pay-btn" v-if="orderDetail.status === '1'" @click="goToPay"> |
|
|
|
<text>去付款</text> |
|
|
|
</view> |
|
|
|
<view class="footer-btn review-btn" @click="goToReview"> |
|
|
|
<view class="footer-btn review-btn" v-if="orderDetail.status === 4" @click="goToReview"> |
|
|
|
<text>评价订单</text> |
|
|
|
</view> |
|
|
|
<view class="footer-btn contact-btn"> |
|
|
@ -57,6 +57,15 @@ |
|
|
|
import CancelOrderPopup from '@/pages_order/components/order/CancelOrderPopup.vue' |
|
|
|
import { getOrderList } from "@/api/system/user.js" |
|
|
|
import { getOpenIdKey } from '@/utils/auth' |
|
|
|
import { getOrderDetail } from '@/api/order/order.js' |
|
|
|
import { getOrderServiceText, getProductNameText } from '@/utils/serviceTime.js' |
|
|
|
|
|
|
|
// 服务时间段映射 |
|
|
|
const timeSlotMap = { |
|
|
|
'MORNING': '上午', |
|
|
|
'AFTERNOON': '下午', |
|
|
|
'EVENING': '晚上' |
|
|
|
} |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
@ -71,97 +80,7 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
orderId: null, |
|
|
|
orderDetail: { |
|
|
|
status: '1', // 1-待付款, 2-已接单, 3-服务中, 4-已完成 |
|
|
|
address: { |
|
|
|
address: '上海青浦区盈港路888号1-2号-东部公寓', |
|
|
|
contact: '联系电话: 18629356678' |
|
|
|
}, |
|
|
|
pets: [ |
|
|
|
{ |
|
|
|
name: '小咪', |
|
|
|
avatar: '/static/images/personal/pet.png', |
|
|
|
tag: '猫', |
|
|
|
gender: '女生', |
|
|
|
serviceDays: 2, |
|
|
|
serviceDates: ['03-20', '03-22'] |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '小汪', |
|
|
|
avatar: '/static/images/personal/pet.png', |
|
|
|
tag: '狗', |
|
|
|
gender: '男生', |
|
|
|
serviceDays: 3, |
|
|
|
serviceDates: ['03-20', '03-22', '03-25'] |
|
|
|
} |
|
|
|
], |
|
|
|
items: [ |
|
|
|
{ |
|
|
|
id: '07-07', |
|
|
|
name: '专业喂养', |
|
|
|
price: 75.00, |
|
|
|
pet: '小咪', |
|
|
|
quantity: 1 |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '07-08', |
|
|
|
name: '专业喂养 + 定制服务1项', |
|
|
|
price: 75.00, |
|
|
|
pet: '小汪', |
|
|
|
quantity: 1, |
|
|
|
customServices: [ |
|
|
|
{ |
|
|
|
name: '专业喂养', |
|
|
|
price: 75.00, |
|
|
|
quantity: 1 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '上门遛狗', |
|
|
|
price: 40.00, |
|
|
|
quantity: 1 |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '07-10', |
|
|
|
name: '专业喂养 + 定制服务2项', |
|
|
|
price: 95.00, |
|
|
|
pet: '小汪', |
|
|
|
quantity: 1, |
|
|
|
customServices: [ |
|
|
|
{ |
|
|
|
name: '专业喂养', |
|
|
|
price: 75.00, |
|
|
|
quantity: 1 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '上门遛狗', |
|
|
|
price: 40.00, |
|
|
|
quantity: 1 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '梳毛', |
|
|
|
price: 40.00, |
|
|
|
quantity: 1 |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
], |
|
|
|
totalAmount: 290.00, |
|
|
|
discount: 10.00, |
|
|
|
memberDiscount: 20.00, |
|
|
|
finalAmount: 260.00, |
|
|
|
remarks: { |
|
|
|
paymentMethod: '存于平台账户', |
|
|
|
isUrgent: true, |
|
|
|
notes: '* 到达05/2楼\n* 猫咪很胆小,请轻声说话,保持安静。猫粮放在门口柜子上,猫砂盆在卫生间。\n* 狗狗很活泼,喜欢玩球,球放在客厅的篮子里。' |
|
|
|
}, |
|
|
|
orderInfo: { |
|
|
|
orderNumber: 'fc241200396263', |
|
|
|
orderTime: '2024-12-03 13:05:57', |
|
|
|
paymentTime: '2024-12-03 13:06:06' |
|
|
|
} |
|
|
|
} |
|
|
|
orderDetail: {}, |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
@ -173,25 +92,103 @@ |
|
|
|
methods: { |
|
|
|
// 获取订单详情 |
|
|
|
getOrderDetail() { |
|
|
|
// 实际项目中应调用API获取订单详情 |
|
|
|
// 示例代码: |
|
|
|
/* |
|
|
|
const params = { |
|
|
|
openId: getOpenIdKey(), |
|
|
|
orderId: this.orderId |
|
|
|
}; |
|
|
|
|
|
|
|
getOrderDetail(params).then(res => { |
|
|
|
if (res && res.code === 200) { |
|
|
|
this.orderDetail = res.data; |
|
|
|
if (res) { |
|
|
|
// 处理接口返回的数据 |
|
|
|
const data = res; |
|
|
|
|
|
|
|
data.petVOList.forEach(pet => { |
|
|
|
pet.orderServiceText = getOrderServiceText(pet.id, data.orderServiceList) // 日期 |
|
|
|
pet.productNameText = getProductNameText(pet.id, data.orderItemList, data.orderServiceList) // 服务 |
|
|
|
}) |
|
|
|
|
|
|
|
// 构建符合组件渲染需要的数据结构 |
|
|
|
this.orderDetail = { |
|
|
|
// 地址信息 |
|
|
|
address: { |
|
|
|
address: data.receiverProvince + data.receiverCity + data.receiverDistrict + data.receiverDetailAddress, |
|
|
|
contact: data.receiverName + ' ' + data.receiverPhone |
|
|
|
}, |
|
|
|
|
|
|
|
// 宠物信息 |
|
|
|
pets: data.petVOList ? data.petVOList.map(pet => { |
|
|
|
return { |
|
|
|
id: pet.id, |
|
|
|
name: pet.name, |
|
|
|
avatar: pet.photo, |
|
|
|
gender: pet.gender, |
|
|
|
serviceDays: pet.orderServiceText ? pet.orderServiceText.length : 0, |
|
|
|
serviceDates: pet.orderServiceText || [], |
|
|
|
services: pet.productNameText || [] |
|
|
|
}; |
|
|
|
}) : [], |
|
|
|
|
|
|
|
// 服务项目列表 |
|
|
|
items: data.orderItemList.map((item, index) => { |
|
|
|
// 解析商品附加数据 |
|
|
|
let spData = {}; |
|
|
|
try { |
|
|
|
spData = JSON.parse(item.spData || '{}'); |
|
|
|
} catch (e) { |
|
|
|
console.error('解析商品附加数据失败', e); |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
id: index + 1, |
|
|
|
name: item.productName, |
|
|
|
price: item.salePrice, |
|
|
|
quantity: item.quantity, |
|
|
|
customServices: [] |
|
|
|
}; |
|
|
|
}), |
|
|
|
|
|
|
|
// 费用信息 |
|
|
|
totalAmount: data.totalAmount, |
|
|
|
discount: data.totalAmount - data.payAmount, |
|
|
|
finalAmount: data.payAmount, |
|
|
|
|
|
|
|
// 订单状态 |
|
|
|
status: data.status.toString(), |
|
|
|
|
|
|
|
// 备注信息 |
|
|
|
remarks: { |
|
|
|
keyHandoverMethod: '存于快递柜', |
|
|
|
isAdvanceFamiliar: true, |
|
|
|
priceInfo: `价格${data.payAmount}元`, |
|
|
|
serviceContent: '服务内容: 伴宠师将按照约定时间上门照顾宠物', |
|
|
|
serviceCondition: '服务保障: 购买此服务后,平台将安排伴宠师与您确认服务细节', |
|
|
|
notes: data.note || '' |
|
|
|
}, |
|
|
|
|
|
|
|
// 其他信息 |
|
|
|
orderInfo: { |
|
|
|
orderNumber: data.orderSn, |
|
|
|
orderTime: data.createTime, |
|
|
|
paymentTime: data.paymentTime |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
// 如果有服务信息,处理服务日期和时间段 |
|
|
|
if (data.orderServiceList && data.orderServiceList.length > 0) { |
|
|
|
// 处理服务日期和时间段 |
|
|
|
const serviceDate = data.orderServiceList[0].serviceDate; |
|
|
|
const serviceTime = data.orderServiceList[0].expectServiceTime; |
|
|
|
|
|
|
|
// 更新服务项目描述 |
|
|
|
if (this.orderDetail.items.length > 0) { |
|
|
|
this.orderDetail.items[0].serviceDate = serviceDate; |
|
|
|
this.orderDetail.items[0].serviceTime = timeSlotMap[serviceTime] || serviceTime; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.error('获取订单详情失败', err); |
|
|
|
}); |
|
|
|
*/ |
|
|
|
|
|
|
|
// 这里使用模拟数据 |
|
|
|
console.log('获取订单详情,ID:', this.orderId); |
|
|
|
}, |
|
|
|
|
|
|
|
// 去付款 |
|
|
@ -210,6 +207,7 @@ |
|
|
|
|
|
|
|
// 处理取消订单 |
|
|
|
handleCancelOrder() { |
|
|
|
// 待实现取消订单逻辑 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|