1394 lines
42 KiB
JavaScript
1394 lines
42 KiB
JavaScript
import { formatTime } from '../../../utils/util';
|
||
import { OrderStatus, LogisticsIconMap } from '../config';
|
||
import { fetchBusinessTime, fetchOrderDetail } from '../../../services/order/orderDetail';
|
||
import Toast from 'tdesign-miniprogram/toast/index';
|
||
import { getAddressPromise } from '../../../services/address/list';
|
||
import { config } from '../../../config/index';
|
||
|
||
Page({
|
||
data: {
|
||
pageLoading: true,
|
||
order: {}, // 后台返回的原始数据
|
||
_order: {}, // 内部使用和提供给 order-card 的数据
|
||
storeDetail: {},
|
||
countDownTime: null,
|
||
addressEditable: false,
|
||
backRefresh: false, // 用于接收其他页面back时的状态
|
||
formatCreateTime: '', //格式化订单创建时间
|
||
logisticsNodes: [],
|
||
/** 订单评论状态 */
|
||
orderHasCommented: true,
|
||
/** 提醒发货状态 */
|
||
isRemindingShip: false,
|
||
},
|
||
|
||
// 通用登录检查函数
|
||
checkLoginAndNavigate() {
|
||
const token = wx.getStorageSync('token');
|
||
if (!token) {
|
||
wx.showModal({
|
||
title: '提示',
|
||
content: '请先登录后再进行操作',
|
||
confirmText: '去登录',
|
||
cancelText: '取消',
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
wx.navigateTo({ url: '/pages/login/index' });
|
||
}
|
||
}
|
||
});
|
||
return false;
|
||
}
|
||
return true;
|
||
},
|
||
|
||
onLoad(query) {
|
||
console.log('[订单详情] 页面加载开始', {
|
||
query,
|
||
orderNo: query.orderNo,
|
||
refresh: query.refresh,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
this.orderNo = query.orderNo;
|
||
|
||
if (!this.orderNo) {
|
||
console.error('[订单详情] 缺少订单号参数');
|
||
wx.showToast({
|
||
title: '订单号不能为空',
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 检查是否需要刷新(来自支付结果页面)
|
||
if (query.refresh === '1') {
|
||
console.log('🔄 [订单详情] 检测到刷新标志,将在页面显示时刷新数据');
|
||
this.setData({ backRefresh: true });
|
||
}
|
||
|
||
console.log('[订单详情] 开始初始化', { orderNo: this.orderNo });
|
||
this.init();
|
||
this.navbar = this.selectComponent('#navbar');
|
||
this.pullDownRefresh = this.selectComponent('#wr-pull-down-refresh');
|
||
|
||
console.log('[订单详情] 页面加载完成');
|
||
},
|
||
|
||
onShow() {
|
||
console.log('[订单详情] 页面显示', {
|
||
backRefresh: this.data.backRefresh,
|
||
orderNo: this.orderNo,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
// 当从其他页面返回,并且 backRefresh 被置为 true 时,刷新数据
|
||
if (!this.data.backRefresh) {
|
||
return;
|
||
}
|
||
|
||
console.log('[订单详情] 执行数据刷新(支付状态更新)');
|
||
this.onRefresh();
|
||
this.setData({ backRefresh: false });
|
||
},
|
||
|
||
onPageScroll(e) {
|
||
this.pullDownRefresh && this.pullDownRefresh.onPageScroll(e);
|
||
},
|
||
|
||
onImgError(e) {
|
||
if (e.detail) {
|
||
console.error('[订单详情] 图片加载失败', e.detail);
|
||
}
|
||
},
|
||
|
||
// 页面初始化,会展示pageLoading
|
||
init() {
|
||
console.log('[订单详情] 初始化开始', {
|
||
orderNo: this.orderNo,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
this.setData({
|
||
pageLoading: true,
|
||
});
|
||
|
||
Promise.all([this.getDetail(), this.getStoreDetail()])
|
||
.then(() => {
|
||
console.log('[订单详情] 初始化完成');
|
||
this.setData({
|
||
pageLoading: false,
|
||
});
|
||
})
|
||
.catch((err) => {
|
||
console.error('[订单详情] 初始化失败', err);
|
||
this.setData({
|
||
pageLoading: false,
|
||
});
|
||
});
|
||
},
|
||
|
||
// 页面刷新,展示下拉刷新
|
||
onRefresh() {
|
||
console.log('[订单详情] 手动刷新开始', {
|
||
orderNo: this.orderNo,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
this.init();
|
||
|
||
// 如果上一页为订单列表,通知其刷新数据
|
||
const pages = getCurrentPages();
|
||
const lastPage = pages[pages.length - 2];
|
||
if (lastPage) {
|
||
console.log('[订单详情] 通知上一页刷新数据');
|
||
lastPage.data.backRefresh = true;
|
||
}
|
||
|
||
console.log('[订单详情] 手动刷新完成');
|
||
},
|
||
|
||
// 页面刷新,展示下拉刷新
|
||
onPullDownRefresh_(e) {
|
||
console.log('[订单详情] 下拉刷新开始', {
|
||
orderNo: this.orderNo,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
// 安全检查 e.detail 是否存在
|
||
const callback = e && e.detail && e.detail.callback;
|
||
|
||
return this.getDetail().then(() => {
|
||
console.log('[订单详情] 下拉刷新成功');
|
||
// 确保 callback 存在且是函数
|
||
if (callback && typeof callback === 'function') {
|
||
callback();
|
||
}
|
||
}).catch((error) => {
|
||
console.error('[订单详情] 下拉刷新失败:', error);
|
||
// 即使出错也要调用 callback 来结束刷新状态
|
||
if (callback && typeof callback === 'function') {
|
||
callback();
|
||
}
|
||
});
|
||
},
|
||
|
||
getDetail() {
|
||
const params = {
|
||
parameter: this.orderNo,
|
||
};
|
||
console.log('🔍 [订单详情] 开始获取订单详情,订单号:', this.orderNo);
|
||
|
||
return fetchOrderDetail(params).then((res) => {
|
||
console.log('📦 [订单详情] API响应数据:', res);
|
||
const order = res.data;
|
||
console.log('📋 [订单详情] 原始订单数据:', order);
|
||
|
||
// 处理_order对象中的价格字段
|
||
console.log('💰 [_order价格] 开始处理_order对象中的价格字段...');
|
||
const _orderPrices = {
|
||
paymentAmount: order.paymentAmount,
|
||
totalAmount: order.totalAmount
|
||
};
|
||
console.log('💰 [_order价格] 原始价格数据:', _orderPrices);
|
||
|
||
// 后端返回的价格是以分为单位,需要除以100转换为元
|
||
const convertedAmount = order.paymentAmount ? (order.paymentAmount / 100).toFixed(2) : '0.00';
|
||
const convertedTotalAmount = order.totalAmount ? (order.totalAmount / 100).toFixed(2) : '0.00';
|
||
|
||
console.log('💰 [_order价格] 格式化后价格:', {
|
||
amount: convertedAmount,
|
||
totalAmount: convertedTotalAmount
|
||
});
|
||
|
||
const _order = {
|
||
id: order.orderId,
|
||
orderNo: order.orderNo,
|
||
parentOrderNo: order.parentOrderNo,
|
||
storeId: order.storeId,
|
||
storeName: order.storeName,
|
||
status: order.orderStatus || order.status,
|
||
statusDesc: order.orderStatusName || order.statusName || this.getOrderStatusName(order.orderStatus || order.status),
|
||
amount: convertedAmount,
|
||
totalAmount: convertedTotalAmount,
|
||
logisticsNo: (order.logisticsVO && order.logisticsVO.logisticsNo) || '',
|
||
goodsList: (order.orderItemVOs || []).map((goods, index) => {
|
||
console.log(`🛍️ [商品处理] 处理商品 ${index + 1}:`, goods);
|
||
|
||
// 处理规格信息,将数组转换为字符串
|
||
let specsText = '';
|
||
if (goods.specifications && Array.isArray(goods.specifications)) {
|
||
specsText = goods.specifications.map(spec => `${spec.specTitle}:${spec.specValue}`).join(' ');
|
||
}
|
||
console.log(`📝 [规格处理] 商品 ${index + 1} 规格信息:`, goods.specifications, '-> 转换后:', specsText);
|
||
|
||
// 商品价格是以分为单位,需要除以100转换为元
|
||
const originalGoodsPrices = {
|
||
actualPrice: goods.actualPrice,
|
||
originPrice: goods.originPrice
|
||
};
|
||
console.log(`💰 [商品价格] 商品 ${index + 1} 价格:`, originalGoodsPrices);
|
||
|
||
const convertedPrice = goods.actualPrice ? (goods.actualPrice / 100).toFixed(2) : '0.00';
|
||
const convertedOriginPrice = goods.originPrice ? (goods.originPrice / 100).toFixed(2) : null;
|
||
|
||
console.log(`💰 [商品价格] 商品 ${index + 1} 格式化后价格:`, {
|
||
actualPrice: convertedPrice,
|
||
originPrice: convertedOriginPrice
|
||
});
|
||
|
||
return Object.assign({}, goods, {
|
||
id: goods.id,
|
||
thumb: goods.goodsPictureUrl || '',
|
||
title: goods.goodsName || '',
|
||
skuId: goods.skuId,
|
||
spuId: goods.spuId,
|
||
specs: specsText,
|
||
price: convertedPrice, // 将分转换为元,保留两位小数
|
||
originPrice: convertedOriginPrice, // 原价也需要转换
|
||
num: goods.buyQuantity,
|
||
titlePrefixTags: [],
|
||
buttons: goods.buttonVOs || [],
|
||
});
|
||
}),
|
||
buttons: [],
|
||
createTime: order.createdAt,
|
||
receiverAddress: this.composeAddress(order),
|
||
totalAmount: convertedTotalAmount,
|
||
payAmount: convertedAmount,
|
||
orderNo: order.orderNo,
|
||
status: order.orderStatus,
|
||
};
|
||
console.log('🛍️ [商品处理] 处理完成的商品列表:', _order.goodsList);
|
||
|
||
// 处理订单中的价格字段,格式化显示
|
||
console.log('💰 [价格格式化] 开始格式化订单价格...');
|
||
const originalPrices = {
|
||
totalAmount: order.totalAmount,
|
||
freightFee: order.freightFee,
|
||
discountAmount: order.discountAmount,
|
||
couponAmount: order.couponAmount,
|
||
paymentAmount: order.paymentAmount
|
||
};
|
||
console.log('💰 [价格格式化] 原始价格:', originalPrices);
|
||
|
||
// 添加调试信息
|
||
console.log('🔍 [调试] couponAmount 原始值:', order.couponAmount, '类型:', typeof order.couponAmount);
|
||
const couponAmountConverted = order.couponAmount ? (order.couponAmount / 100).toFixed(2) : '0.00';
|
||
console.log('🔍 [调试] couponAmount 转换后:', couponAmountConverted, '类型:', typeof couponAmountConverted);
|
||
|
||
const processedOrder = {
|
||
...order,
|
||
totalAmount: order.totalAmount ? (order.totalAmount / 100).toFixed(2) : '0.00',
|
||
freightFee: order.freightFee ? (order.freightFee / 100).toFixed(2) : '0.00',
|
||
discountAmount: order.discountAmount ? (order.discountAmount / 100).toFixed(2) : '0.00',
|
||
couponAmount: couponAmountConverted,
|
||
paymentAmount: order.paymentAmount ? (order.paymentAmount / 100).toFixed(2) : '0.00',
|
||
};
|
||
|
||
console.log('🔍 [调试] processedOrder.couponAmount:', processedOrder.couponAmount);
|
||
const formattedPrices = {
|
||
totalAmount: processedOrder.totalAmount,
|
||
freightFee: processedOrder.freightFee,
|
||
discountAmount: processedOrder.discountAmount,
|
||
couponAmount: processedOrder.couponAmount,
|
||
paymentAmount: processedOrder.paymentAmount
|
||
};
|
||
console.log('💰 [价格格式化] 格式化后价格:', formattedPrices);
|
||
|
||
// 处理地址信息
|
||
console.log('🏠 [地址处理] 开始处理地址信息...');
|
||
const addressText = this.composeAddress(order);
|
||
console.log('🏠 [地址处理] 生成的地址文本:', addressText);
|
||
|
||
console.log('✅ [数据设置] 设置页面数据...');
|
||
this.setData({
|
||
order: processedOrder,
|
||
_order,
|
||
formatCreateTime: this.formatOrderTime(order.createdAt), // 格式化订单创建时间
|
||
countDownTime: this.computeCountDownTime(order),
|
||
addressEditable:
|
||
[1, 3].includes(order.orderStatus), // 1未付款,3待发货时允许修改地址,已发货后不允许修改
|
||
isPaid: order.payStatus === 1, // 1已支付
|
||
invoiceStatus: 3, // 默认未开票
|
||
invoiceDesc: '',
|
||
invoiceType: '不开发票',
|
||
logisticsNodes: [],
|
||
});
|
||
console.log('✅ [数据设置] 页面数据设置完成');
|
||
}).catch((error) => {
|
||
console.error('获取订单详情失败:', error);
|
||
|
||
// 根据错误类型显示不同的提示信息
|
||
let errorMessage = '获取订单详情失败';
|
||
if (error.message) {
|
||
if (error.message.includes('订单不存在') || error.message.includes('无效的订单')) {
|
||
errorMessage = '订单不存在或已被删除';
|
||
} else if (error.message.includes('网络')) {
|
||
errorMessage = '网络连接失败,请检查网络后重试';
|
||
} else if (error.message.includes('无权访问')) {
|
||
errorMessage = '无权访问该订单';
|
||
} else {
|
||
errorMessage = error.message;
|
||
}
|
||
}
|
||
|
||
// 显示错误提示
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: errorMessage,
|
||
theme: 'error',
|
||
direction: 'column',
|
||
});
|
||
|
||
// 确保在出错时数据保持一致性
|
||
this.setData({
|
||
logisticsNodes: [],
|
||
order: {},
|
||
_order: {},
|
||
pageLoading: false,
|
||
});
|
||
|
||
// 如果是网络错误,提供重试选项
|
||
if (error.message && error.message.includes('网络')) {
|
||
wx.showModal({
|
||
title: '网络错误',
|
||
content: '网络连接失败,是否重新加载?',
|
||
confirmText: '重试',
|
||
cancelText: '取消',
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
this.init();
|
||
}
|
||
}
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
// 展开物流节点
|
||
flattenNodes(nodes) {
|
||
return (nodes || []).reduce((res, node) => {
|
||
return (node.nodes || []).reduce((res1, subNode, index) => {
|
||
res1.push({
|
||
title: index === 0 ? node.title : '', // 子节点中仅第一个显示title
|
||
desc: subNode.status,
|
||
date: formatTime(+subNode.timestamp, 'YYYY-MM-DD HH:mm:ss'),
|
||
icon: index === 0 ? LogisticsIconMap[node.code] || '' : '', // 子节点中仅第一个显示icon
|
||
});
|
||
return res1;
|
||
}, res);
|
||
}, []);
|
||
},
|
||
|
||
datermineInvoiceStatus(order) {
|
||
// 1-已开票
|
||
// 2-未开票(可补开)
|
||
// 3-未开票
|
||
// 4-门店不支持开票
|
||
return order.invoiceStatus;
|
||
},
|
||
|
||
// 拼接省市区
|
||
composeAddress(order) {
|
||
console.log('🏠 [地址组装] 开始组装地址,订单数据:', order);
|
||
|
||
if (!order || !order.logisticsVO) {
|
||
console.log('🏠 [地址组装] 订单或物流信息为空,返回默认地址');
|
||
return '暂无收货地址';
|
||
}
|
||
|
||
// 返回完整的地址字符串,而不是对象
|
||
// 从logisticsVO中获取地址信息
|
||
const logistics = order.logisticsVO;
|
||
console.log('🏠 [地址组装] 物流信息:', logistics);
|
||
|
||
const province = logistics.receiverProvince || '';
|
||
const city = logistics.receiverCity || '';
|
||
const district = logistics.receiverCountry || ''; // 注意:后端使用receiverCountry表示区县
|
||
const address = logistics.receiverAddress || '';
|
||
|
||
console.log('🏠 [地址组装] 地址组件:', {
|
||
province,
|
||
city,
|
||
district,
|
||
address,
|
||
receiverName: logistics.receiverName,
|
||
receiverPhone: logistics.receiverPhone
|
||
});
|
||
|
||
// 拼接完整地址
|
||
const fullAddress = `${province}${city}${district}${address}`.trim();
|
||
console.log('🏠 [地址组装] 组装完成的完整地址:', fullAddress);
|
||
|
||
// 如果地址为空,返回默认提示
|
||
const result = fullAddress || '暂无收货地址';
|
||
console.log('🏠 [地址组装] 最终返回地址:', result);
|
||
|
||
return result;
|
||
},
|
||
|
||
// 格式化订单时间
|
||
formatOrderTime(timeStr) {
|
||
if (!timeStr) {
|
||
return '未知时间';
|
||
}
|
||
|
||
try {
|
||
let date;
|
||
|
||
// 处理不同的时间格式
|
||
if (typeof timeStr === 'string') {
|
||
// 如果是字符串,尝试解析
|
||
if (timeStr.includes('T')) {
|
||
// ISO 格式: 2025-01-01T12:00:00Z
|
||
date = new Date(timeStr);
|
||
} else if (timeStr.includes('-')) {
|
||
// 日期格式: 2025-01-01 12:00:00
|
||
date = new Date(timeStr.replace(/-/g, '/'));
|
||
} else if (/^\d+$/.test(timeStr)) {
|
||
// 时间戳字符串
|
||
date = new Date(parseInt(timeStr));
|
||
} else {
|
||
date = new Date(timeStr);
|
||
}
|
||
} else if (typeof timeStr === 'number') {
|
||
// 时间戳数字
|
||
date = new Date(timeStr);
|
||
} else {
|
||
date = new Date(timeStr);
|
||
}
|
||
|
||
// 检查日期是否有效
|
||
if (isNaN(date.getTime())) {
|
||
console.warn('无效的时间格式:', timeStr);
|
||
return '时间格式错误';
|
||
}
|
||
|
||
return formatTime(date.getTime(), 'YYYY-MM-DD HH:mm');
|
||
} catch (error) {
|
||
console.error('时间格式化错误:', error, timeStr);
|
||
return '时间解析失败';
|
||
}
|
||
},
|
||
|
||
getStoreDetail() {
|
||
console.log('🏪 [店铺详情] 开始获取店铺详情');
|
||
fetchBusinessTime().then((res) => {
|
||
console.log('🏪 [店铺详情] API响应:', res);
|
||
if (res && res.data) {
|
||
const storeDetail = {
|
||
storeTel: res.data.telphone || '400-000-0000',
|
||
storeBusiness: (res.data.businessTime && Array.isArray(res.data.businessTime))
|
||
? res.data.businessTime.join('\n')
|
||
: '周一至周日: 9:00-18:00',
|
||
};
|
||
console.log('🏪 [店铺详情] 处理后的店铺信息:', storeDetail);
|
||
this.setData({ storeDetail });
|
||
} else {
|
||
console.log('🏪 [店铺详情] 响应数据为空,使用默认值');
|
||
// 设置默认值
|
||
const storeDetail = {
|
||
storeTel: '400-000-0000',
|
||
storeBusiness: '周一至周日: 9:00-18:00',
|
||
};
|
||
this.setData({ storeDetail });
|
||
}
|
||
}).catch((err) => {
|
||
console.error('❌ [店铺详情] 获取店铺详情失败:', err);
|
||
// 设置默认值
|
||
const storeDetail = {
|
||
storeTel: '400-000-0000',
|
||
storeBusiness: '周一至周日: 9:00-18:00',
|
||
};
|
||
this.setData({ storeDetail });
|
||
});
|
||
},
|
||
|
||
// 仅对待支付状态计算付款倒计时
|
||
// 返回时间若是大于2020.01.01,说明返回的是关闭时间,否则说明返回的直接就是剩余时间
|
||
computeCountDownTime(order) {
|
||
if (order.orderStatus !== OrderStatus.PENDING_PAYMENT) return null;
|
||
return order.autoCancelTime > 1577808000000 ? order.autoCancelTime - Date.now() : order.autoCancelTime;
|
||
},
|
||
|
||
onCountDownFinish() {
|
||
//this.setData({ countDownTime: -1 });
|
||
const { countDownTime, order } = this.data;
|
||
if (countDownTime > 0 || (order && order.groupInfoVo && order.groupInfoVo.residueTime > 0)) {
|
||
this.onRefresh();
|
||
}
|
||
},
|
||
|
||
onGoodsCardTap(e) {
|
||
const { index } = e.currentTarget.dataset;
|
||
const goods = this.data.order.orderItemVOs[index];
|
||
|
||
console.log('[订单详情] 商品卡片点击', {
|
||
index,
|
||
spuId: goods.spuId,
|
||
goodsName: goods.goodsName,
|
||
orderNo: this.orderNo,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
wx.navigateTo({ url: `/pages/goods/details/index?spuId=${goods.spuId}` });
|
||
},
|
||
|
||
onEditAddressTap() {
|
||
console.log('[订单详情] 编辑地址点击', {
|
||
orderNo: this.orderNo,
|
||
addressEditable: this.data.addressEditable,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
getAddressPromise()
|
||
.then((address) => {
|
||
console.log('[订单详情] 地址选择成功', address);
|
||
this.setData({
|
||
'order.logisticsVO.receiverName': address.name,
|
||
'order.logisticsVO.receiverPhone': address.phone,
|
||
'_order.receiverAddress': address.address,
|
||
});
|
||
})
|
||
.catch((error) => {
|
||
console.error('[订单详情] 地址选择失败', error);
|
||
});
|
||
|
||
wx.navigateTo({
|
||
url: `/pages/user/address/list/index?selectMode=1`,
|
||
});
|
||
},
|
||
|
||
onOrderNumCopy() {
|
||
const orderNo = this.data.order.orderNo;
|
||
console.log('[订单详情] 复制订单号', {
|
||
orderNo,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
wx.setClipboardData({
|
||
data: orderNo,
|
||
success: () => {
|
||
console.log('[订单详情] 订单号复制成功');
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '订单号已复制',
|
||
theme: 'success',
|
||
});
|
||
},
|
||
fail: (error) => {
|
||
console.error('[订单详情] 订单号复制失败', error);
|
||
}
|
||
});
|
||
},
|
||
|
||
onDeliveryNumCopy() {
|
||
const logisticsNo = this.data.order.logisticsVO.logisticsNo;
|
||
console.log('[订单详情] 复制物流单号', {
|
||
logisticsNo,
|
||
orderNo: this.orderNo,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
wx.setClipboardData({
|
||
data: logisticsNo,
|
||
success: () => {
|
||
console.log('[订单详情] 物流单号复制成功');
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '物流单号已复制',
|
||
theme: 'success',
|
||
});
|
||
},
|
||
fail: (error) => {
|
||
console.error('[订单详情] 物流单号复制失败', error);
|
||
}
|
||
});
|
||
},
|
||
|
||
// 订单操作按钮点击处理
|
||
onOrderButtonTap(e) {
|
||
const { type } = e.currentTarget.dataset;
|
||
const { order } = this.data;
|
||
|
||
console.log('[订单详情] ===== 按钮点击调试开始 =====');
|
||
console.log('[订单详情] 按钮点击事件详情', {
|
||
type: type,
|
||
typeType: typeof type,
|
||
originalEvent: e,
|
||
dataset: e.currentTarget.dataset,
|
||
orderNo: this.orderNo,
|
||
orderStatus: order?.orderStatus,
|
||
orderButtons: order?.orderButtons,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
// 检查按钮列表
|
||
if (order?.orderButtons) {
|
||
console.log('[订单详情] 当前订单按钮列表:');
|
||
order.orderButtons.forEach((btn, index) => {
|
||
console.log(`[订单详情] 按钮${index}: type=${btn.type}, name=${btn.name}, primary=${btn.primary}`);
|
||
});
|
||
}
|
||
|
||
console.log('[订单详情] 即将执行的操作类型:', type);
|
||
|
||
switch (type) {
|
||
case 1: // 取消订单
|
||
console.log('[订单详情] 执行取消订单操作');
|
||
this.cancelOrder();
|
||
break;
|
||
case 2: // 立即付款
|
||
console.log('[订单详情] 执行立即付款操作');
|
||
this.payOrder();
|
||
break;
|
||
case 3: // 提醒发货
|
||
console.log('[订单详情] 执行提醒发货操作');
|
||
this.remindShip();
|
||
break;
|
||
case 4: // 确认收货
|
||
console.log('[订单详情] 执行确认收货操作');
|
||
this.confirmReceive();
|
||
break;
|
||
case 5: // 申请售后
|
||
console.log('[订单详情] 执行申请售后操作');
|
||
this.applyAfterSale();
|
||
break;
|
||
case 6: // 评价
|
||
console.log('[订单详情] 执行评价操作');
|
||
this.goToComment();
|
||
break;
|
||
case 7: // 申请退款
|
||
console.log('[订单详情] 执行申请退款操作');
|
||
this.applyRefund();
|
||
break;
|
||
default:
|
||
console.warn('[订单详情] 未知操作类型:', type);
|
||
}
|
||
},
|
||
|
||
// 申请退款
|
||
applyRefund() {
|
||
console.log('[订单详情] ===== 申请退款函数被调用 =====');
|
||
console.log('[订单详情] 当前订单信息:', {
|
||
orderNo: this.orderNo,
|
||
orderData: this.data.order,
|
||
orderStatus: this.data.order?.orderStatus
|
||
});
|
||
|
||
// 跳转到退款申请页面
|
||
wx.navigateTo({
|
||
url: `/pages/refund/refund-apply/index?orderNo=${this.orderNo}`
|
||
});
|
||
},
|
||
|
||
// 执行申请退款
|
||
performApplyRefund() {
|
||
console.log('[订单详情] ===== 执行申请退款操作 =====');
|
||
console.log('[订单详情] 订单号:', this.orderNo);
|
||
|
||
if (!this.checkLoginAndNavigate()) {
|
||
console.error('[订单详情] 申请退款失败:未登录');
|
||
return;
|
||
}
|
||
|
||
const token = wx.getStorageSync('token');
|
||
|
||
wx.showLoading({ title: '处理中...' });
|
||
|
||
const requestUrl = `${config.apiBase}/orders/${this.data.order.orderNo || this.orderNo}/refund`;
|
||
console.log('[订单详情] 发送申请退款请求', {
|
||
url: requestUrl,
|
||
orderNo: this.orderNo
|
||
});
|
||
|
||
wx.request({
|
||
url: requestUrl,
|
||
method: 'PUT',
|
||
header: {
|
||
'Authorization': `Bearer ${token}`,
|
||
'Content-Type': 'application/json'
|
||
},
|
||
success: (res) => {
|
||
wx.hideLoading();
|
||
console.log('[订单详情] 申请退款API响应', {
|
||
statusCode: res.statusCode,
|
||
data: res.data,
|
||
orderNo: this.orderNo
|
||
});
|
||
|
||
if (res.statusCode === 200 && res.data.code === 200) {
|
||
console.log('[订单详情] 申请退款成功');
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '退款申请已提交',
|
||
theme: 'success',
|
||
});
|
||
// 刷新订单详情
|
||
setTimeout(() => {
|
||
this.getDetail();
|
||
}, 1000);
|
||
} else {
|
||
console.error('[订单详情] 申请退款失败', res.data);
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: res.data.message || '申请退款失败',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
},
|
||
fail: (error) => {
|
||
wx.hideLoading();
|
||
console.error('[订单详情] 申请退款网络错误', error);
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '网络错误',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
// 取消订单
|
||
cancelOrder() {
|
||
console.log('[订单详情] 显示取消订单确认弹窗', {
|
||
orderNo: this.orderNo,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
wx.showModal({
|
||
title: '确认取消',
|
||
content: '确定要取消这个订单吗?',
|
||
success: (res) => {
|
||
console.log('[订单详情] 取消订单确认结果', {
|
||
confirm: res.confirm,
|
||
orderNo: this.orderNo
|
||
});
|
||
|
||
if (res.confirm) {
|
||
this.performCancelOrder();
|
||
} else {
|
||
console.log('[订单详情] 用户取消了取消订单操作');
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
// 执行取消订单
|
||
performCancelOrder() {
|
||
console.log('[订单详情] 开始执行取消订单', {
|
||
orderNo: this.orderNo,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
|
||
if (!this.checkLoginAndNavigate()) {
|
||
console.error('[订单详情] 取消订单失败:未登录');
|
||
return;
|
||
}
|
||
|
||
const token = wx.getStorageSync('token');
|
||
|
||
wx.showLoading({ title: '取消中...' });
|
||
|
||
const requestUrl = `${config.apiBase}/orders/${this.data.order.orderNo || this.orderNo}/cancel`;
|
||
console.log('[订单详情] 发送取消订单请求', {
|
||
url: requestUrl,
|
||
orderNo: this.orderNo
|
||
});
|
||
|
||
wx.request({
|
||
url: requestUrl,
|
||
method: 'PUT',
|
||
header: {
|
||
'Authorization': `Bearer ${token}`,
|
||
'Content-Type': 'application/json'
|
||
},
|
||
data: {
|
||
order_no: this.data.order.orderNo || this.orderNo
|
||
},
|
||
success: (res) => {
|
||
wx.hideLoading();
|
||
console.log('[订单详情] 取消订单API响应', {
|
||
statusCode: res.statusCode,
|
||
data: res.data,
|
||
orderNo: this.orderNo
|
||
});
|
||
|
||
if (res.statusCode === 200 && res.data.code === 200) {
|
||
console.log('[订单详情] 取消订单成功');
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '订单已取消',
|
||
theme: 'success',
|
||
});
|
||
// 刷新订单详情
|
||
setTimeout(() => {
|
||
this.getDetail();
|
||
}, 1000);
|
||
} else {
|
||
console.error('[订单详情] 取消订单失败', res.data);
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: res.data.message || '取消失败',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
},
|
||
fail: (error) => {
|
||
wx.hideLoading();
|
||
console.error('[订单详情] 取消订单网络错误', error);
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '网络错误',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
// 立即付款
|
||
payOrder() {
|
||
if (!this.checkLoginAndNavigate()) {
|
||
return;
|
||
}
|
||
|
||
const token = wx.getStorageSync('token');
|
||
|
||
wx.showLoading({ title: '创建支付订单...' });
|
||
|
||
wx.request({
|
||
url: `${config.apiBase}/payment/create`,
|
||
method: 'POST',
|
||
header: {
|
||
'Authorization': `Bearer ${token}`,
|
||
'Content-Type': 'application/json'
|
||
},
|
||
data: {
|
||
orderNo: this.data.order.orderNo || this.orderNo,
|
||
paymentMethod: 'wechat'
|
||
},
|
||
success: (res) => {
|
||
if (res.statusCode === 200 && res.data.code === 200) {
|
||
const paymentData = res.data.data;
|
||
|
||
// 如果返回了微信支付参数,调用微信支付SDK
|
||
if (paymentData && paymentData.payInfo) {
|
||
wx.hideLoading();
|
||
wx.showLoading({ title: '调起微信支付...' });
|
||
|
||
try {
|
||
const payInfo = typeof paymentData.payInfo === 'string'
|
||
? JSON.parse(paymentData.payInfo)
|
||
: paymentData.payInfo;
|
||
|
||
console.log('微信支付参数:', payInfo);
|
||
|
||
wx.requestPayment({
|
||
timeStamp: payInfo.timeStamp,
|
||
nonceStr: payInfo.nonceStr,
|
||
package: payInfo.package,
|
||
signType: payInfo.signType || 'RSA',
|
||
paySign: payInfo.paySign,
|
||
success: (payRes) => {
|
||
wx.hideLoading();
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '支付成功',
|
||
theme: 'success',
|
||
});
|
||
// 刷新订单详情
|
||
setTimeout(() => {
|
||
this.getDetail();
|
||
}, 1000);
|
||
},
|
||
fail: (payErr) => {
|
||
wx.hideLoading();
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: payErr.errMsg || '支付失败',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
});
|
||
} catch (parseErr) {
|
||
wx.hideLoading();
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '支付参数解析失败',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
} else {
|
||
// 如果没有返回微信支付参数,可能是模拟支付成功
|
||
wx.hideLoading();
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '支付成功',
|
||
theme: 'success',
|
||
});
|
||
// 刷新订单详情
|
||
setTimeout(() => {
|
||
this.getDetail();
|
||
}, 1000);
|
||
}
|
||
} else {
|
||
wx.hideLoading();
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: res.data.message || '创建支付订单失败',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
},
|
||
fail: () => {
|
||
wx.hideLoading();
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '网络错误',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
// 提醒发货
|
||
remindShip() {
|
||
console.log('[订单详情] ===== 提醒发货函数被调用 =====');
|
||
console.log('[订单详情] 当前订单信息:', {
|
||
orderNo: this.orderNo,
|
||
orderData: this.data.order,
|
||
orderStatus: this.data.order?.orderStatus
|
||
});
|
||
|
||
// 检查是否正在处理中
|
||
if (this.data.isRemindingShip) {
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '正在处理中,请稍候...',
|
||
theme: 'warning',
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 检查订单状态
|
||
const orderStatus = this.data.order?.orderStatus;
|
||
if (orderStatus !== 2 && orderStatus !== 3) {
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '当前订单状态不支持提醒发货',
|
||
theme: 'warning',
|
||
});
|
||
return;
|
||
}
|
||
|
||
wx.showModal({
|
||
title: '提醒发货',
|
||
content: '确定要提醒商家尽快发货吗?提醒后商家会收到通知。',
|
||
confirmText: '确定提醒',
|
||
cancelText: '取消',
|
||
success: (res) => {
|
||
console.log('[订单详情] 提醒发货弹窗响应:', res);
|
||
if (res.confirm) {
|
||
console.log('[订单详情] 用户确认提醒发货,执行操作');
|
||
this.performRemindShip();
|
||
} else {
|
||
console.log('[订单详情] 用户取消提醒发货');
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
// 执行提醒发货
|
||
performRemindShip() {
|
||
console.log('[订单详情] ===== 执行提醒发货操作 =====');
|
||
console.log('[订单详情] 订单号:', this.orderNo);
|
||
|
||
if (!this.checkLoginAndNavigate()) {
|
||
return;
|
||
}
|
||
|
||
const token = wx.getStorageSync('token');
|
||
|
||
// 设置加载状态
|
||
this.setData({
|
||
isRemindingShip: true
|
||
});
|
||
|
||
// 显示加载提示
|
||
wx.showLoading({
|
||
title: '提醒发货中...',
|
||
mask: true
|
||
});
|
||
|
||
const url = `${config.apiBase}/orders/${this.data.order.orderNo || this.orderNo}/remind-ship`;
|
||
console.log('[订单详情] 提醒发货请求URL:', url);
|
||
|
||
wx.request({
|
||
url: url,
|
||
method: 'PUT',
|
||
header: {
|
||
'Authorization': `Bearer ${token}`,
|
||
'Content-Type': 'application/json'
|
||
},
|
||
success: (res) => {
|
||
console.log('[订单详情] 提醒发货响应:', res);
|
||
if (res.statusCode === 200 && res.data.code === 200) {
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '提醒发货成功,商家已收到通知',
|
||
theme: 'success',
|
||
});
|
||
// 刷新订单信息
|
||
this.getDetail();
|
||
} else {
|
||
console.error('[订单详情] 提醒发货失败:', res.data);
|
||
let errorMessage = '提醒发货失败';
|
||
if (res.data.message) {
|
||
if (res.data.message.includes('订单不存在')) {
|
||
errorMessage = '订单信息异常,请刷新页面重试';
|
||
} else if (res.data.message.includes('状态')) {
|
||
errorMessage = '订单状态不支持提醒发货';
|
||
} else {
|
||
errorMessage = res.data.message;
|
||
}
|
||
}
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: errorMessage,
|
||
theme: 'error',
|
||
});
|
||
}
|
||
},
|
||
fail: (err) => {
|
||
console.error('[订单详情] 提醒发货请求失败:', err);
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '网络连接失败,请检查网络后重试',
|
||
theme: 'error',
|
||
});
|
||
},
|
||
complete: () => {
|
||
// 隐藏加载提示
|
||
wx.hideLoading();
|
||
// 重置加载状态
|
||
this.setData({
|
||
isRemindingShip: false
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
// 确认收货
|
||
confirmReceive() {
|
||
console.log('[订单详情] ===== 确认收货函数被调用 =====');
|
||
console.log('[订单详情] 当前订单信息:', {
|
||
orderNo: this.orderNo,
|
||
orderData: this.data.order,
|
||
orderStatus: this.data.order?.orderStatus
|
||
});
|
||
|
||
wx.showModal({
|
||
title: '确认收货',
|
||
content: '确定已收到商品吗?确认后将无法撤销。',
|
||
success: (res) => {
|
||
console.log('[订单详情] 确认收货弹窗响应:', res);
|
||
if (res.confirm) {
|
||
console.log('[订单详情] 用户确认收货,执行操作');
|
||
this.performConfirmReceive();
|
||
} else {
|
||
console.log('[订单详情] 用户取消确认收货');
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
// 执行确认收货
|
||
performConfirmReceive() {
|
||
if (!this.checkLoginAndNavigate()) {
|
||
return;
|
||
}
|
||
|
||
const token = wx.getStorageSync('token');
|
||
|
||
wx.showLoading({ title: '确认中...' });
|
||
|
||
wx.request({
|
||
url: `${config.apiBase}/orders/${this.data.order.orderNo || this.orderNo}/receive`,
|
||
method: 'PUT',
|
||
header: {
|
||
'Authorization': `Bearer ${token}`,
|
||
'Content-Type': 'application/json'
|
||
},
|
||
data: {
|
||
order_no: this.data.order.orderNo || this.orderNo
|
||
},
|
||
success: (res) => {
|
||
wx.hideLoading();
|
||
if (res.statusCode === 200 && res.data.code === 200) {
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '确认收货成功',
|
||
theme: 'success',
|
||
});
|
||
// 刷新订单详情
|
||
setTimeout(() => {
|
||
this.getDetail();
|
||
}, 1000);
|
||
} else {
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: res.data.message || '确认收货失败',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
},
|
||
fail: () => {
|
||
wx.hideLoading();
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '网络错误',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
// 申请售后
|
||
applyAfterSale() {
|
||
console.log('[订单详情] ===== 申请售后函数被调用 =====');
|
||
console.log('[订单详情] 当前订单信息:', {
|
||
orderNo: this.orderNo,
|
||
orderData: this.data.order,
|
||
orderStatus: this.data.order?.orderStatus
|
||
});
|
||
|
||
const { order } = this.data;
|
||
if (!order || !order.orderNo) {
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '订单信息异常,请刷新页面重试',
|
||
theme: 'error',
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 检查订单状态是否支持申请售后
|
||
const orderStatus = order.orderStatus;
|
||
if (orderStatus === 1) { // 未付款
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '未付款订单不支持申请售后',
|
||
theme: 'warning',
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (orderStatus === 7) { // 已取消
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '已取消订单不支持申请售后',
|
||
theme: 'warning',
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 获取第一个商品信息用于售后申请
|
||
const firstGoods = order.goodsList && order.goodsList[0];
|
||
if (!firstGoods) {
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '商品信息异常,无法申请售后',
|
||
theme: 'error',
|
||
});
|
||
return;
|
||
}
|
||
|
||
console.log('[订单详情] 跳转到申请售后页面', {
|
||
orderNo: order.orderNo,
|
||
goodsId: firstGoods.goodsId,
|
||
orderStatus: orderStatus
|
||
});
|
||
|
||
// 跳转到申请售后页面
|
||
wx.navigateTo({
|
||
url: `/pages/order/apply-service/index?orderNo=${order.orderNo}&goodsId=${firstGoods.goodsId}&orderStatus=${orderStatus}`,
|
||
success: () => {
|
||
console.log('[订单详情] 成功跳转到申请售后页面');
|
||
},
|
||
fail: (error) => {
|
||
console.error('[订单详情] 跳转申请售后页面失败:', error);
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '跳转失败,请重试',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
// 去评价
|
||
goToComment() {
|
||
console.log('[订单详情] ===== 评价函数被调用 =====');
|
||
console.log('[订单详情] 当前订单信息:', {
|
||
orderNo: this.orderNo,
|
||
orderData: this.data.order,
|
||
orderStatus: this.data.order?.orderStatus
|
||
});
|
||
|
||
const { order } = this.data;
|
||
console.log('[订单详情] ', order);
|
||
if (!order || !order.orderNo) {
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '订单信息异常,请刷新页面重试',
|
||
theme: 'error',
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 检查订单状态是否支持评价
|
||
const orderStatus = order.orderStatus;
|
||
if (orderStatus !== 6) { // 只有已完成的订单才能评价
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '只有已完成的订单才能评价',
|
||
theme: 'warning',
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 获取第一个商品信息用于评价
|
||
const firstGoods = order.orderItemVOs && order.orderItemVOs[0];
|
||
if (!firstGoods) {
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '商品信息异常,无法评价',
|
||
theme: 'error',
|
||
});
|
||
return;
|
||
}
|
||
|
||
console.log('[订单详情] 跳转到评价页面', {
|
||
firstGoods:firstGoods,
|
||
orderNo: order.orderNo,
|
||
goodsId: firstGoods.spuId,
|
||
title: firstGoods.goodsName,
|
||
imgUrl: firstGoods.goodsPictureUrl
|
||
});
|
||
// 跳转到评价页面
|
||
wx.navigateTo({
|
||
url: `/pages/goods/comments/create/index?orderNo=${order.orderNo}&goodsId=${firstGoods.spuId}&title=${encodeURIComponent(firstGoods.goodsName || '')}&imgUrl=${encodeURIComponent(firstGoods.goodsPictureUrl || '')}&specs=${encodeURIComponent(firstGoods.specs || '')}`,
|
||
success: () => {
|
||
console.log('[订单详情] 成功跳转到评价页面');
|
||
},
|
||
fail: (error) => {
|
||
console.error('[订单详情] 跳转评价页面失败:', error);
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '跳转失败,请重试',
|
||
theme: 'error',
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
onToInvoice() {
|
||
wx.navigateTo({
|
||
url: `/pages/order/invoice/index?orderNo=${this.data._order.orderNo}`,
|
||
});
|
||
},
|
||
|
||
onSuppleMentInvoice() {
|
||
wx.navigateTo({
|
||
url: `/pages/order/receipt/index?orderNo=${this.data._order.orderNo}`,
|
||
});
|
||
},
|
||
|
||
onDeliveryClick() {
|
||
const logisticsData = {
|
||
nodes: this.data.logisticsNodes,
|
||
company: this.data.order.logisticsVO.logisticsCompanyName,
|
||
logisticsNo: this.data.order.logisticsVO.logisticsNo,
|
||
phoneNumber: this.data.order.logisticsVO.logisticsCompanyTel,
|
||
};
|
||
wx.navigateTo({
|
||
url: `/pages/order/delivery-detail/index?data=${encodeURIComponent(JSON.stringify(logisticsData))}`,
|
||
});
|
||
},
|
||
|
||
/** 跳转订单评价 */
|
||
navToCommentCreate() {
|
||
wx.navigateTo({
|
||
url: `/pages/order/createComment/index?orderNo=${this.orderNo}`,
|
||
});
|
||
},
|
||
|
||
/** 跳转拼团详情/分享页*/
|
||
toGrouponDetail() {
|
||
wx.showToast({ title: '点击了拼团' });
|
||
},
|
||
|
||
clickService() {
|
||
Toast({
|
||
context: this,
|
||
selector: '#t-toast',
|
||
message: '您点击了联系客服',
|
||
});
|
||
},
|
||
|
||
onOrderInvoiceView() {
|
||
wx.navigateTo({
|
||
url: `/pages/order/invoice/index?orderNo=${this.orderNo}`,
|
||
});
|
||
},
|
||
|
||
// 获取订单状态名称
|
||
getOrderStatusName(status) {
|
||
const statusMap = {
|
||
1: '未付款',
|
||
2: '待发货', // 统一为待发货
|
||
3: '待发货', // 统一为待发货
|
||
4: '已发货',
|
||
5: '待收货',
|
||
6: '已完成',
|
||
7: '已取消',
|
||
8: '退货中',
|
||
9: '已退款'
|
||
};
|
||
return statusMap[status] || '未知状态';
|
||
},
|
||
});
|