Commit 14d35e73 by liimin

refactor(order): 重构订单详情页面布局和样式

- 调整了多个组件的样式,包括 BlockBox、DeliveryInfo、OrderAmount、OrderGoods、OrderInfo 等
- 优化了订单信息的展示结构,增加了订单顶部和底部区域
- 统一了样式变量的使用,替换了部分硬编码的样式值
- 调整了部分组件的属性和结构,提高了组件的复用性和可维护性
1 parent 12971e11
Showing 23 changed files with 109 additions and 54 deletions
.block{ .block{
border-radius: 16rpx; border-radius: 16rpx;
background-color: #fff; background-color: #fff;
padding: var(--margin); padding: 24rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
\ No newline at end of file \ No newline at end of file
const { mockDeliveryInfoData } = require('./mock.js'); const { mockDeliveryInfoData } = require('./mock.js');
Component({ Component({
options: {
addGlobalClass: true,
styleIsolation: 'apply-shared', // 启用样式隔离并共享样式
},
properties: { properties: {
orderInfo: { orderInfo: {
type: Object, type: Object,
......
<block wx:if="{{orderInfo.deliveryCompany}}"> <view class="title">发货信息</view>
<view class="title">发货信息</view> <view class="item">
<view class="item"> <view class="label">收货地址:</view>
<view class="label">物流信息:</view>
<view class="value">{{orderInfo.deliveryCompany || ''}}{{orderInfo.deliveryNumber || ''}}</view> <view class="value">{{orderInfo.deliveryCompany || ''}}{{orderInfo.deliveryNumber || ''}}</view>
</view>
<view class="item">
<view class="label">物流进度:</view>
<view class="value">
{{deliveryStatus[orderInfo.deliveryStatus]}}
</view>
</view>
</block>
\ No newline at end of file \ No newline at end of file
</view>
\ No newline at end of file \ No newline at end of file
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
.item { .item {
display: flex; display: flex;
align-items: center; align-items: flex-start;
font-size: 24rpx; font-size: 24rpx;
min-height: 48rpx; min-height: 48rpx;
line-height: 48rpx; line-height: 48rpx;
font-weight: 400;
color: #6e6e7a;
} }
.item .label { .item .label {
...@@ -19,5 +21,4 @@ ...@@ -19,5 +21,4 @@
.item .value { .item .value {
width: calc(100% - 150rpx); width: calc(100% - 150rpx);
color: #656566;
} }
const mockDeliveryInfoData = { const mockDeliveryInfoData = {
orderInfo: { orderInfo: {
deliveryCompany: '顺丰快递', deliveryCompany: '深圳市南山区留仙大道3370号南山智园崇文园区1号楼14层深圳广联赛讯有限公司',
deliveryNumber: 'SF1234567890', deliveryNumber: 'SF1234567890',
deliveryStatus: 2 deliveryStatus: 2
}, },
......
const { mockDeliveryInfoData } = require('./mock.js');
Component({
properties: {
orderInfo: {
type: Object,
value: {}
},
deliveryStatus: {
type: Object,
value: {}
}
},
data: {
// Mock数据用于开发和测试
...mockDeliveryInfoData
},
methods: {
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class="item">
<view class="label">收货地址:</view>
<view class="value">{{orderInfo.deliveryCompany || ''}}{{orderInfo.deliveryNumber || ''}}</view>
</view>
\ 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
const { mockOrderAmountData } = require('./mock.js'); const { mockOrderAmountData } = require('./mock.js');
Component({ Component({
options: {
addGlobalClass: true,
styleIsolation: 'apply-shared'
},
properties: { properties: {
orderInfo: { orderInfo: {
type: Object, type: Object,
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
font-size: 36rpx; font-size: 36rpx;
.unit { .unit {
font-size: 20rpx; font-size: 20rpx;
margin-left: 4rpx;
} }
} }
...@@ -41,5 +42,6 @@ ...@@ -41,5 +42,6 @@
font-size: 48rpx; font-size: 48rpx;
.unit { .unit {
font-size: 24rpx; font-size: 24rpx;
margin-left: 4rpx;
} }
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="title">订单金额</view> <view class="title">订单金额</view>
<view class="price-item"> <view class="price-item">
商品总价 商品总价
<view class="amount">{{orderInfo.orderPrice}} <text class="unit">积分</text></view> <view class="amount">{{orderInfo.orderPrice}}<text class="unit">积分</text></view>
</view> </view>
<view class="price-item line"> <view class="price-item line">
运费 运费
...@@ -10,6 +10,6 @@ ...@@ -10,6 +10,6 @@
</view> </view>
<view class="price-item"> <view class="price-item">
<view></view> <view></view>
<view class="price sum">{{orderInfo.payPrice}} <text class="unit">积分</text></view> <view class="price sum">{{orderInfo.payPrice}}<text class="unit">积分</text></view>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
const { mockOrderGoodsData } = require('./mock.js'); const { mockOrderGoodsData } = require('./mock.js');
Component({ Component({
options: {
addGlobalClass: true,
styleIsolation: 'isolated'
},
properties: { properties: {
orderInfo: { orderInfo: {
type: Object, type: Object,
......
const { mockOrderInfoData } = require('./mock.js'); const { mockOrderInfoData } = require('./mock.js');
Component({ Component({
options: {
addGlobalClass: true,
styleIsolation: 'isolated'
},
properties: { properties: {
orderInfo: { orderInfo: {
type: Object, type: Object,
......
{ {
"component": true, "component": true,
"usingComponents": {} "style": "v2",
"usingComponents": {
"content": "/packageMine/pages/order/index/components/Content/Content",
"BlockBox": "/packageMine/pages/order/components/BlockBox/BlockBox",
"order-action-buttons": "/packageMine/pages/order/index/components/OrderActionButtons/OrderActionButtons"
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -8,9 +8,11 @@ ...@@ -8,9 +8,11 @@
.item { .item {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 24rpx; font-size: 26rpx;
min-height: 48rpx; min-height: 48rpx;
line-height: 48rpx; line-height: 48rpx;
font-weight: 400;
color: #7a8299;
} }
.item.flex-start { .item.flex-start {
...@@ -23,5 +25,20 @@ ...@@ -23,5 +25,20 @@
.item .value { .item .value {
width: calc(100% - 150rpx); width: calc(100% - 150rpx);
color: #656566; color: #1b233d;
text-align: right;
word-wrap: break-word;
}
.order-box {
.order-content {
border-top: 1rpx solid #f0f1f5;
margin-top: 35rpx;
padding-top: 35rpx;
}
.order-bottom {
height: 64rpx;
padding: 30rpx;
border-top: 1rpx solid #f0f1f5;
margin-top: 35rpx;
}
} }
<view class="title">订单信息</view> <view class="title">订单信息</view>
<block wx:for="{{orderObj}}" wx:key="index"> <!-- <OrderGoods orderInfo="{{orderInfo}}"></OrderGoods> -->
<view class="order-box">
<view class="order-top">
<content item="{{orderInfo}}" />
</view>
<view class="order-content">
<block wx:for="{{orderObj}}" wx:key="index">
<view class="item {{item.alignItems}}"> <view class="item {{item.alignItems}}">
<view class="label">{{item.label}}:</view> <view class="label">{{item.label}}:</view>
<view class="value"> <view class="value">
<block wx:if="{{item.enum}}"> <block wx:if="{{item.enum}}">{{statusEnum[orderInfo[item.key]]|| ''}}</block>
{{statusEnum[orderInfo[item.key]]|| ''}}
</block>
<block wx:else>{{orderInfo[item.key] || ''}}</block> <block wx:else>{{orderInfo[item.key] || ''}}</block>
</view> </view>
</view> </view>
</block>
\ No newline at end of file \ No newline at end of file
</block>
</view>
<view class="order-bottom">
<order-action-buttons item="{{orderInfo}}" />
</view>
</view>
\ No newline at end of file \ No newline at end of file
...@@ -9,13 +9,9 @@ ...@@ -9,13 +9,9 @@
<BlockBox> <BlockBox>
<OrderInfo orderInfo="{{orderInfo}}" orderObj="{{orderObj}}" statusEnum="{{statusEnum}}"></OrderInfo> <OrderInfo orderInfo="{{orderInfo}}" orderObj="{{orderObj}}" statusEnum="{{statusEnum}}"></OrderInfo>
</BlockBox> </BlockBox>
<BlockBox> <!-- <BlockBox>
<OrderInfo orderInfo="{{orderInfo}}" orderObj="{{orderObj}}" statusEnum="{{statusEnum}}"></OrderInfo>
</BlockBox>
<BlockBox>
<!-- <OrderGoods orderInfo="{{orderInfo}}"></OrderGoods> -->
<content item="{{orderInfo}}" /> <content item="{{orderInfo}}" />
</BlockBox> </BlockBox> -->
<BlockBox> <BlockBox>
<OrderAmount orderInfo="{{orderInfo}}"></OrderAmount> <OrderAmount orderInfo="{{orderInfo}}"></OrderAmount>
</BlockBox> </BlockBox>
......
...@@ -5,11 +5,13 @@ ...@@ -5,11 +5,13 @@
align-items: flex-start; align-items: flex-start;
font-size: 24rpx; font-size: 24rpx;
color: #656566; color: #656566;
justify-content: space-between;
margin-bottom: 16rpx;
margin-right: 16rpx;
} }
.bottom .total { .bottom .total {
position: relative; position: relative;
bottom: 16rpx;
} }
.bottom .price { .bottom .price {
......
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
} }
.goods { .goods {
height: 208rpx; height: 160rpx;
padding: 24rpx 24rpx 24rpx 0;
box-sizing: border-box;
display: flex; display: flex;
margin-bottom: 24rpx;
}
.goods:last-child {
margin-bottom: 0;
} }
.addTo { .addTo {
...@@ -68,6 +70,7 @@ ...@@ -68,6 +70,7 @@
color: #656566; color: #656566;
font-size: 24rpx; font-size: 24rpx;
display: flex; display: flex;
margin-right: 24rpx;
} }
.info-bottom { .info-bottom {
......
/* components/orderActionButtons.wxss */ /* components/orderActionButtons.wxss */
.btn-box { .btn-box {
position: absolute;
right: 24rpx; right: 24rpx;
bottom: 16rpx; bottom: 16rpx;
display: flex; display: flex;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
margin-bottom: 20rpx; margin-bottom: 20rpx;
background-color: #fff; background-color: #fff;
box-sizing: border-box; box-sizing: border-box;
border-radius: var(--borderRadius); border-radius: 24rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!