Commit a514a8dd by liimin

feat(order): 添加物流详情弹窗并优化订单详情页面

- 在订单详情页面添加物流详情弹窗功能
- 重构时间轴组件,增加节点样式和内容的自定义
- 移除 Express 组件,改为在订单详情页面直接调用时间轴组件
- 优化订单详情页面布局和样式
1 parent 40a9a0ce
Showing 24 changed files with 366 additions and 75 deletions
...@@ -86,7 +86,8 @@ ...@@ -86,7 +86,8 @@
"pages/coupon/center/center", "pages/coupon/center/center",
"pages/coupon/detail/detail", "pages/coupon/detail/detail",
"pages/coupon/recommend/recommend", "pages/coupon/recommend/recommend",
"pages/coupon/usedDetail/usedDetail" "pages/coupon/usedDetail/usedDetail",
"pages/order/express/express"
] ]
} }
], ],
...@@ -101,7 +102,7 @@ ...@@ -101,7 +102,7 @@
"mp-dialog": "weui-miniprogram/dialog/dialog", "mp-dialog": "weui-miniprogram/dialog/dialog",
"mp-cell": "weui-miniprogram/cell/cell", "mp-cell": "weui-miniprogram/cell/cell",
"mp-cells": "weui-miniprogram/cells/cells", "mp-cells": "weui-miniprogram/cells/cells",
"Dialog":"/components/Dialog/Dialog" "Dialog": "/components/Dialog/Dialog"
}, },
"style": "v2", "style": "v2",
"resolveAlias": { "resolveAlias": {
......
/*可视化地呈现时间流信息*/ /*可视化地呈现时间流信息*/
Component({ Component({
properties: { properties: {
list: { // 时间轴节点数据
// 时间轴列表 nodes: {
type: Array, type: Array,
value: [], value: [],
}, observer: function(newVal, oldVal) {
this.processNodes(newVal);
}
}
},
data: {
timeLineNodes: []
}, },
});
/**
* 组件内部方法
*/
methods: {
/**
* 预处理节点数据,添加样式类
* @param {Array} nodes - 节点数组
*/
processNodes(nodes) {
if (!nodes || !Array.isArray(nodes)) return;
const timeLineNodes = nodes.map(node => {
return {
...node,
dotClass: this.getNodeDotClass(node),
contentClass: this.getNodeContentClass(node)
};
});
this.setData({
timeLineNodes
});
},
/**
* 获取节点点的样式类
* @param {Object} item - 时间轴节点项
* @returns {String} 样式类名
*/
getNodeDotClass(item) {
// 直接根据节点属性返回对应的样式类
if (item.active) {
return 'timeline-node__dot timeline-node__dot--active';
} else if (item.type === 'special') {
return 'timeline-node__dot timeline-node__dot--spacial';
} else if (item.small) {
return 'timeline-node__dot timeline-node__dot--small';
} else {
return 'timeline-node__dot';
}
},
/**
* 获取节点内容的样式类
* @param {Object} item - 时间轴节点项
* @returns {String} 样式类名
*/
getNodeContentClass(item) {
// 非激活状态的内容使用灰色
if (item.type === 'special') {
return 'timeline-node__content--special';
}else if(item.active){
return 'active';
}
},
/**
* 判断是否显示节点点
* @param {Object} item - 时间轴节点项
* @returns {Boolean} 是否显示节点点
*/
shouldShowNodeDot(item) {
// 修复逻辑:所有节点默认都应该显示点
// 只有特定情况下才不显示
return true;
}
}
});
\ No newline at end of file \ No newline at end of file
.box { /* 时间轴容器 */
padding: 10rpx; .timeline-container {
padding: 20rpx 0;
} }
.one {
/* 时间轴节点 */
.timeline-node {
position: relative; position: relative;
padding-bottom: 40rpx; padding-bottom: 40rpx;
display: flex;
&:last-child {
padding-bottom: 0;
}
} }
.onedot {
left: -2rpx; /* 时间轴节点点容器 */
.timeline-node__dot-wrapper {
width: 36rpx;
display: flex;
justify-content: center;
align-items: flex-start;
flex-shrink: 0;
padding-top: 6rpx;
}
/* 时间轴节点点 */
.timeline-node__dot {
width: 20rpx; width: 20rpx;
height: 20rpx; height: 20rpx;
position: absolute;
background-color: #e8e8ea; background-color: #e8e8ea;
border-radius: 50%; border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
z-index: 1; z-index: 1;
&.highlight {
/* 激活状态的节点点 */
&.timeline-node__dot--active {
background-color: var(--btnColor); background-color: var(--btnColor);
} }
&.tiny { /* 小型节点点 */
&.timeline-node__dot--small {
width: 12rpx;
height: 12rpx;
}
/* 地址节点点 */
&.timeline-node__dot--spacial {
width: 12rpx; width: 12rpx;
height: 12rpx; height: 12rpx;
left: 2rpx;
} }
} }
.oneline {
/* 时间轴连接线 */
.timeline-node__line {
position: absolute; position: absolute;
left: 8rpx; top: 20rpx;
height: 100%; left: 18rpx;
border-left: 1rpx solid #f0f0f0; height: calc(100% - 20rpx);
border-left: 2rpx solid #e8e8ea;
z-index: 0;
} }
.onemain {
position: relative; /* 时间轴内容 */
padding-left: 56rpx; .timeline-node__content {
top: -6rpx; flex: 1;
.main { padding-left: 20rpx;
display: flex; color: #b1b1b3;
align-items: center; }
gap: 12rpx;
.title { .timeline-node__content--special {
font-weight: 500; .timeline-node__title,
font-size: 32rpx; .timeline-node__tip {
color: #282829; font-weight: 400;
} font-size: 24rpx;
.time { }
font-weight: 400; .timeline-node__title {
font-size: 24rpx; color: #282829;
color: #282829; }
} .timeline-node__tip {
color: #666666;
} }
} }
.onemaintitle {
/* 时间轴头部 */
.timeline-node__header {
display: flex;
margin-bottom: 16rpx;
margin-bottom: 16rpx; margin-bottom: 16rpx;
padding-top: 8rpx; align-items: center;
color: #909399; gap: 20rpx;
line-height: 1; }
font-size: 26rpx;
/* 时间轴标题 */
.timeline-node__title {
font-weight: 500;
font-size: 28rpx;
margin-bottom: 8rpx;
line-height: 1.4;
} }
.tip {
/* 时间轴时间 */
.timeline-node__time {
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #656566; line-height: 1.4;
}
/* 时间轴提示信息 */
.timeline-node__tip {
font-weight: 400;
font-size: 24rpx;
line-height: 1.5;
}
.active {
.timeline-node__title {
color: #282829;
}
.timeline-node__time {
color: #909399;
}
.timeline-node__tip {
color: #656566;
}
} }
<view class="box"> <!-- 时间轴组件 -->
<view wx:for="{{list}}" wx:key="index" class="one"> <view class="timeline-container">
<view class="onedot {{index==list.length-1?'highlight':''}} {{!item.status?'tiny':''}}"></view> <view wx:for="{{timeLineNodes}}" wx:key="index" class="timeline-node">
<view wx:if="{{index!=list.length-1}}" class="oneline"></view> <!-- 时间轴节点 -->
<view class="onemain "> <view class="timeline-node__dot-wrapper">
<view class="main"> <!-- 使用预处理的样式类 -->
<view class="title">{{item.status}}</view> <view class="{{item.dotClass}}"></view>
<view class="time">{{item.time}}</view>
</view>
<view class="tip" wx:for="{{item.tips}}" wx:for-item="tip">{{tip}}</view>
</view>
</view> </view>
<!-- 时间轴连接线 -->
<view wx:if="{{index !== timeLineNodes.length - 1}}" class="timeline-node__line"></view>
<!-- 时间轴内容 -->
<view class="timeline-node__content {{item.contentClass}} ">
<view class="timeline-node__header">
<view wx:if="{{item.title}}" class="timeline-node__title">{{item.title}}</view>
<view wx:if="{{item.time}}" class="timeline-node__time">{{item.time}}</view>
</view>
<view wx:for="{{item.tips}}" wx:key="index" class="timeline-node__tip">
{{item}}
</view>
</view>
</view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -12,27 +12,38 @@ Component({ ...@@ -12,27 +12,38 @@ Component({
}, },
}, },
data: { data: {
list: [ timelineData: [
{
time: "",
tips: ["深圳市南山区南山智园崇文园区1号楼14层","何万瑞 15077226060"],
status:'address'
},
{ {
time: "2021-02-02 10:30:30", time: "2021-02-02 10:30:30",
tips: ["这是主要内容部分这是主要内容部分这是主要内容部分这是主要内容部分这是主要内容部分"], tips: ["这是主要内容部分"],
status:'' title: "已发货",
type: 'normal',
active: true // 高亮显示
}, },
{ {
time: "2021-02-02 10:30:30", time: "2021-02-02 10:30:30",
tips: ["这是主要内容部分这是主要内容部分这是主要内容部分这是主要内容部分"], tips: ["这是主要内容部分"],
status:'已离开' title:'运输中',
type: 'normal',
small: true, // 小点显示
active:false
}, },
{ {
time: "2021-02-02 10:30:30", time: "2021-02-02 10:30:30",
tips: ["这是主要内容部分这是主要内容部分这是主要内容部分这是主要内容部分"], tips: ["这是主要内容部分11111111111",
status:'已离开' "这是主要内容部分11111111111",
"这是主要内容部分11111111111"
],
title:'运输中',
type: 'normal',
small: false, // 小点显示
active:false
}, },
{
title:'收货地址',
tips: ["这是主要内容部分"],
type: 'special' // 地址节点,使用专门的样式
}
], ],
}, },
}); });
\ No newline at end of file \ No newline at end of file
<view class="item"> <view class="item">
<TimeLine list="{{list}}"/> <TimeLine nodes="{{timelineData}}"/>
</view> </view>
\ No newline at end of file \ No newline at end of file
const { mockDeliveryInfoData } = require("./mock.js");
Component({
properties: {
showExpress: {
type: Boolean,
value: false,
observer(newVal) {
console.log("🚀 ~ observer ~ observer:", newVal)
},
},
},
data: {
},
});
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"Express": "../Express/Express"
}
}
\ No newline at end of file \ No newline at end of file
.popup-content{
padding: 32rpx;
}
\ No newline at end of file \ No newline at end of file
<popup show="{{showExpress}}" only="{{false}}" title="物流详情" bindconfirm="onConfirmPopup">
<view class="popup-content">
<Express />
</view>
</popup>
\ No newline at end of file \ No newline at end of file
const mockDeliveryInfoData = {
orderInfo: {
deliveryCompany: '深圳市南山区留仙大道3370号南山智园崇文园区1号楼14层深圳广联赛讯有限公司',
deliveryNumber: 'SF1234567890',
deliveryStatus: 2
},
deliveryStatus: {
1: "待发货",
2: "已发货",
3: "已收货",
}
};
module.exports = {
mockDeliveryInfoData
};
\ No newline at end of file \ No newline at end of file
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
} }
.order-bottom { .order-bottom {
height: 64rpx; height: 64rpx;
padding: 30rpx; padding-top: 24rpx;
border-top: 1rpx solid #f0f1f5; border-top: 1rpx solid #f0f1f5;
margin-top: 35rpx; margin-top: 35rpx;
} }
......
...@@ -13,6 +13,7 @@ Page({ ...@@ -13,6 +13,7 @@ Page({
...mockOrderDetailData, ...mockOrderDetailData,
OrderStatus, OrderStatus,
couponsList: [], couponsList: [],
isShowExpressPop:false,
orderObj: [ orderObj: [
{ {
label: "下单日期", label: "下单日期",
...@@ -137,4 +138,10 @@ Page({ ...@@ -137,4 +138,10 @@ Page({
qr: QR.createQrCodeImg(`t=1&c=${data}`), qr: QR.createQrCodeImg(`t=1&c=${data}`),
}); });
}, },
showExpressPop(){
console.log("🚀 ~ showExpressPop ~ showExpressPop:")
this.setData({
isShowExpressPop: true,
});
}
}); });
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"OrderGoods": "./components/OrderGoods/OrderGoods", "OrderGoods": "./components/OrderGoods/OrderGoods",
"OrderAmount": "./components/OrderAmount/OrderAmount", "OrderAmount": "./components/OrderAmount/OrderAmount",
"content": "/packageMine/pages/order/index/components/Content/Content", "content": "/packageMine/pages/order/index/components/Content/Content",
"Express": "./components/Express/Express" "Express": "../components/Express/Express",
"Expresspop": "../components/ExpressPop/ExpressPop"
} }
} }
\ No newline at end of file \ No newline at end of file
/* packageMine/pages/order/detail/detail.wxss */ /* packageMine/pages/order/detail/detail.wxss */
.layout { .layout {
padding: 24rpx 32rpx 68rpx; padding: 24rpx 32rpx 68rpx;
.express-box{
position: relative;
.express-detail{
position: absolute;
right: 24rpx;
top:10rpx;
color: var(--btnColor);
font-weight: 400;
font-size: 24rpx;
}
}
} }
.status-box { .status-box {
......
...@@ -7,7 +7,10 @@ ...@@ -7,7 +7,10 @@
<DeliveryInfo orderInfo="{{orderInfo}}" deliveryStatus="{{deliveryStatus}}"></DeliveryInfo> <DeliveryInfo orderInfo="{{orderInfo}}" deliveryStatus="{{deliveryStatus}}"></DeliveryInfo>
</BlockBox> </BlockBox>
<BlockBox> <BlockBox>
<Express /> <view class="express-box" bindtap="showExpressPop">
<view class="express-detail" >物流详情 <mp-icon icon="arrow" color="var(--btnColor)" size="{{11}}"></mp-icon></view>
<Express />
</view>
</BlockBox> </BlockBox>
<BlockBox> <BlockBox>
<OrderInfo orderInfo="{{orderInfo}}" orderObj="{{orderObj}}" statusEnum="{{statusEnum}}"></OrderInfo> <OrderInfo orderInfo="{{orderInfo}}" orderObj="{{orderObj}}" statusEnum="{{statusEnum}}"></OrderInfo>
...@@ -18,5 +21,6 @@ ...@@ -18,5 +21,6 @@
<BlockBox> <BlockBox>
<OrderAmount orderInfo="{{orderInfo}}"></OrderAmount> <OrderAmount orderInfo="{{orderInfo}}"></OrderAmount>
</BlockBox> </BlockBox>
<Expresspop showExpress="{{isShowExpressPop}}"/>
</view> </view>
</block> </block>
\ No newline at end of file \ No newline at end of file
// packageMine/pages/order/express/express.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageMine/pages/order/express/express.wxss */
\ No newline at end of file \ No newline at end of file
<!--packageMine/pages/order/express/express.wxml-->
<text>packageMine/pages/order/express/express.wxml</text>
\ 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!