发货后页面展示。

This commit is contained in:
Dev
2026-10-14 16:43:39 +08:00
parent 645a037126
commit cc0c6729a7
7 changed files with 103 additions and 17 deletions
@@ -18,6 +18,8 @@ Page({
backRefresh: false, // 用于接收其他页面back时的状态
formatCreateTime: '', //格式化订单创建时间
logisticsNodes: [],
shipFiles: [], // 发货附件 [{url, name}],为空时隐藏
shipImages: [], // 发货凭证图片 URL 列表,为空时隐藏
/** 订单评论状态 */
orderHasCommented: true,
},
@@ -115,6 +117,8 @@ Page({
this.setData({
order,
_order,
shipFiles: this.getShipFiles(order),
shipImages: (order.orderShip?.imagesList || []).map((item) => item.url).filter(Boolean),
formatCreateTime: order.formatCreateTime, // 格式化订单创建时间
countDownTime: this.computeCountDownTime(order),
addressEditable: false,
@@ -128,6 +132,29 @@ Page({
});
},
// 发货附件:优先取发货单上传的附件,旧订单没有时回退到商品的下载文件
getShipFiles(order) {
const files = (order.orderShip?.filesList || []).filter((item) => item.url);
if (files.length) {
return files;
}
const goodsInfo = order.orderGoods?.[0]?.goodsInfo;
if (goodsInfo?.downloadFile) {
return [{ url: goodsInfo.downloadFile, name: goodsInfo.downloadFileBasename || goodsInfo.downloadFile }];
}
return [];
},
// 凭证图片预览
onShipImagePreview(e) {
const { index } = e.currentTarget.dataset;
const { shipImages } = this.data;
wx.previewImage({
current: shipImages[index],
urls: shipImages,
});
},
// 展开物流节点
flattenNodes(nodes) {
return (nodes || []).reduce((res, node) => {
@@ -224,14 +251,17 @@ Page({
copyText(e) {
const { text } = e.currentTarget.dataset;
if (!text) {
return;
}
wx.setClipboardData({
data: text,
success(res) {
data: String(text),
success() {
wx.showToast({
title: '复制成功',
icon: 'success',
duration: 2000
})
});
}
});
},