Commit ea8ce604 by liimin

fix(订单详情): 修复物流信息显示问题并优化逻辑

- 新增logisticsInfo字段存储物流数据
- 区分自营商品和其他商品的物流信息展示
- 优化物流信息获取和显示条件判断
1 parent a352e683
...@@ -10,6 +10,7 @@ Page({ ...@@ -10,6 +10,7 @@ Page({
// OrderStatus, // OrderStatus,
expressInfo: null, //物流信息 expressInfo: null, //物流信息
isShowExpressPop: false, isShowExpressPop: false,
logisticsInfo:null,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -34,9 +35,11 @@ Page({ ...@@ -34,9 +35,11 @@ Page({
}, },
queryLogistics(subOrderCode) { queryLogistics(subOrderCode) {
wx.p.api.shopmallApi.queryLogistics({ subOrderCode }).then((data) => { wx.p.api.shopmallApi.queryLogistics({ subOrderCode }).then((data) => {
this.setData({ if(data.shipmentTrack&&data.shipmentTrack.length){
expressInfo: data, this.setData({
}); logisticsInfo: data,
})
}
}).catch((err) => { }).catch((err) => {
wx.p.sentry.reportError(`查询物流异常:${err.message}`, {subOrderCode,err}); wx.p.sentry.reportError(`查询物流异常:${err.message}`, {subOrderCode,err});
}); });
...@@ -62,7 +65,7 @@ Page({ ...@@ -62,7 +65,7 @@ Page({
receviveInfo: receiveName + receiveMobile, receviveInfo: receiveName + receiveMobile,
}, },
}); });
if (data.expressName) { if (data.expressName && this.data.orderInfo.goodsSource==GoodsSource.SELF) {
this.setData({ this.setData({
expressInfo: { expressInfo: {
expressName: data.expressName, expressName: data.expressName,
......
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
<Status title="{{Status.text}}" image="{{Status.image}}" tips="{{Status.tips}}"></Status> <Status title="{{Status.text}}" image="{{Status.image}}" tips="{{Status.tips}}"></Status>
</BlockBox> </BlockBox>
<!-- 云中鹤的有物流信息 --> <!-- 云中鹤的有物流信息 -->
<BlockBox wx:if="{{(orderInfo.goodsSource==1||!orderInfo.goodsSource) && expressInfo &&expressInfo.shipmentTrack&&expressInfo.shipmentTrack.length}}"> <BlockBox wx:if="{{logisticsInfo}}">
<view class="express-box" bindtap="showExpressPop"> <view class="express-box" bindtap="showExpressPop">
<view class="express-detail"> <view class="express-detail">
物流详情 物流详情
<mp-icon icon="arrow" color="var(--btnColor)" size="{{11}}"></mp-icon> <mp-icon icon="arrow" color="var(--btnColor)" size="{{11}}"></mp-icon>
</view> </view>
<Express expressInfo="{{expressInfo}}" showAll="{{false}}" /> <Express expressInfo="{{logisticsInfo}}" showAll="{{false}}"/>
</view> </view>
</BlockBox> </BlockBox>
<!-- 自营商品展示快递信息 --> <!-- 自营商品展示快递信息 -->
<BlockBox wx:if="{{orderInfo.goodsSource==2 && expressInfo}}"> <BlockBox wx:if="{{expressInfo}}">
<Expressage expressInfo="{{expressInfo}}"></Expressage> <Expressage expressInfo="{{expressInfo}}"></Expressage>
</BlockBox> </BlockBox>
<BlockBox> <BlockBox>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<!-- <BlockBox> <!-- <BlockBox>
<content item="{{orderInfo}}" /> <content item="{{orderInfo}}" />
</BlockBox> --> </BlockBox> -->
<Expresspop showExpress="{{isShowExpressPop}}" expressInfo="{{expressInfo}}" /> <Expresspop showExpress="{{isShowExpressPop}}" expressInfo="{{logisticsInfo}}" wx:if="{{logisticsInfo}}" />
</view> </view>
</block> </block>
<glsx-privacy appletName="积分商城"></glsx-privacy> <glsx-privacy appletName="积分商城"></glsx-privacy>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!