发货后页面展示。
This commit is contained in:
@@ -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
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -58,14 +58,27 @@
|
||||
</view>
|
||||
</view> -->
|
||||
<block wx:if="{{order.orderShip}}">
|
||||
<view class="pay-item">
|
||||
<text>下载地址</text>
|
||||
<view class="pay-item__right">
|
||||
<text class="order-no normal-color">{{order.orderGoods[0].goodsInfo.downloadFileBasename}}</text>
|
||||
<view class="pay-item__right__copy" data-text="{{order.orderGoods[0].goodsInfo.downloadFile}}" bind:tap="copyText">复制</view>
|
||||
<block wx:if="{{shipFiles.length}}">
|
||||
<view class="pay-item">
|
||||
<text>附件下载</text>
|
||||
<text class="pay-item__tips">点击复制地址,在浏览器中打开下载</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-bottom border-bottom-margin" />
|
||||
<view class="ship-file" wx:for="{{shipFiles}}" wx:key="url" data-text="{{item.url}}" bind:tap="copyText">
|
||||
<t-icon name="file" size="32rpx" color="#787878" />
|
||||
<text class="ship-file__name">{{item.name}}</text>
|
||||
<view class="ship-file__copy">复制</view>
|
||||
</view>
|
||||
<view class="border-bottom border-bottom-margin" />
|
||||
</block>
|
||||
<block wx:if="{{shipImages.length}}">
|
||||
<view class="pay-item">
|
||||
<text>凭证图片</text>
|
||||
</view>
|
||||
<view class="ship-images">
|
||||
<image wx:for="{{shipImages}}" wx:key="*this" class="ship-images__item" mode="aspectFill" src="{{item}}" data-index="{{index}}" bind:tap="onShipImagePreview" />
|
||||
</view>
|
||||
<view class="border-bottom border-bottom-margin" />
|
||||
</block>
|
||||
<view class="pay-item">
|
||||
<text>激活码</text>
|
||||
<view class="pay-item__right">
|
||||
|
||||
@@ -199,6 +199,49 @@
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.order-detail .pay-detail .pay-item .pay-item__tips {
|
||||
font-size: 22rpx;
|
||||
color: var(--text-placeholder);
|
||||
}
|
||||
|
||||
.order-detail .ship-file {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx 20rpx;
|
||||
margin-bottom: 16rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: var(--bg-page);
|
||||
}
|
||||
|
||||
.order-detail .ship-file__name {
|
||||
flex: 1;
|
||||
margin: 0 16rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
color: var(--text-primary);
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.order-detail .ship-file__copy {
|
||||
flex-shrink: 0;
|
||||
font-size: 24rpx;
|
||||
color: var(--brand);
|
||||
}
|
||||
|
||||
.order-detail .ship-images {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
padding-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.order-detail .ship-images__item {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: var(--bg-page);
|
||||
}
|
||||
|
||||
.order-detail .pay-detail .pay-service {
|
||||
width: 100%;
|
||||
height: 72rpx;
|
||||
|
||||
Reference in New Issue
Block a user