Commit 0185cd92 by liimin

feat(components): 优化 Popup 组件并添加 Copy 组件

- 在 app.json 中添加 Copy 组件页面
- 优化 Popup 组件,添加新属性和功能:
  - showCloseButton: 是否显示关闭按钮
  - showFooter: 是否显示底部按钮
  - headerColor: 设置头部背景颜色
- 在 ReturnAddressBox 和 ExpressPop 组件中集成 Copy 组件
- 调整 ExpressPop 组件样式,优化物流信息展示
1 parent aadb1eeb
...@@ -90,7 +90,8 @@ ...@@ -90,7 +90,8 @@
"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" "pages/order/express/express",
"pages/order/components/Copy/Copy"
] ]
} }
], ],
......
...@@ -37,7 +37,19 @@ Component({ ...@@ -37,7 +37,19 @@ Component({
only: { only: {
type: Boolean, type: Boolean,
value: true value: true
} },
showCloseButton: {
type: Boolean,
value: false
},
showFooter: {
type: Boolean,
value: true
},
headerColor: {
type: String,
value: ''
},
}, },
/** /**
......
...@@ -2,17 +2,18 @@ ...@@ -2,17 +2,18 @@
<view class="popup-bg" bindtap="hidePopup"></view> <view class="popup-bg" bindtap="hidePopup"></view>
<view class="popup-content {{close?'close':''}}" style="height:{{height}}"> <view class="popup-content {{close?'close':''}}" style="height:{{height}}">
<block wx:if="{{title}}"> <block wx:if="{{title}}">
<view class="popup-title text-center">{{title}}</view> <view class="popup-title text-center" style="background:{{headerColor}}">{{title}}
<view class="popup-close" wx:if="{{showCloseButton}}" bindtap="hidePopup">
<mp-icon icon="close2" color="#B1B1B3" size="20"></mp-icon>
</view>
</view>
</block> </block>
<view class="popup-slot {{title?'':'notitle' }}"> <view class="popup-slot {{title?'':'notitle' }}">
<slot></slot> <slot></slot>
</view> </view>
<view class="popup-footer isFullSucreen" wx:if="{{only}}"> <view class="popup-footer isFullSucreen" wx:if="{{showFooter}}">
<view class="cancel btn text-center" bindtap="hidePopup">取消</view> <view class="cancel btn text-center" wx:if="{{only}}" bindtap="hidePopup">取消</view>
<view class="confirm btn text-center" bindtap="confirm">确定</view> <view class="confirm {{only?'btn':'doubtn'}} text-center" bindtap="confirm">确定</view>
</view>
<view class="popup-footer isFullSucreen" wx:else>
<view class="confirm doubtn text-center" bindtap="confirm">确定</view>
</view> </view>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -43,6 +43,18 @@ ...@@ -43,6 +43,18 @@
font-size: 32rpx; font-size: 32rpx;
color: #333333; color: #333333;
border-bottom: 2rpx solid #EBEDF0; border-bottom: 2rpx solid #EBEDF0;
border-radius: 20rpx 20rpx 0 0;
position: relative;
}
.popup-close {
position: absolute;
right: 40rpx;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
} }
.popup-slot { .popup-slot {
......
...@@ -50,10 +50,10 @@ ...@@ -50,10 +50,10 @@
/* 时间轴连接线 */ /* 时间轴连接线 */
.timeline-node__line { .timeline-node__line {
position: absolute; position: absolute;
top: 20rpx; top: 18rpx;
left: 18rpx; left: 18rpx;
height: calc(100% - 20rpx); height: calc(100% - 16rpx);
border-left: 2rpx solid #e8e8ea; border-left: 1px solid #e8e8ea;
z-index: 0; z-index: 0;
} }
......
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"mp-icon": "weui-miniprogram/icon/icon", "mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet",
"mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet" "Copy": "../../../components/Copy/Copy"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="text-box"> <view class="text-box">
<view class="header"> <view class="header">
<view class="title">商品寄回地址</view> <view class="title">商品寄回地址</view>
<view class="copy">复制</view> <Copy />
</view> </view>
<block wx:for="{{address}}" wx:key="index"> <block wx:for="{{address}}" wx:key="index">
<view class="item"> <view class="item">
......
// packageMine/pages/order/components/Copy/Copy.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"style": "v2"
}
.copy {
background: #e8e8ea;
border-radius: 18rpx;
font-weight: 400;
font-size: 22rpx;
color: #707071;
padding: 4rpx 18rpx;
}
\ No newline at end of file \ No newline at end of file
<!--packageMine/pages/order/components/Copy/Copy.wxml-->
<view class="copy">复制</view>
\ No newline at end of file \ No newline at end of file
...@@ -5,10 +5,11 @@ Component({ ...@@ -5,10 +5,11 @@ Component({
showExpress: { showExpress: {
type: Boolean, type: Boolean,
value: false, value: false,
observer(newVal) {
console.log("🚀 ~ observer ~ observer:", newVal)
},
}, },
expressInfo:{
type: Object,
value: {}
}
}, },
data: { data: {
}, },
......
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"Express": "../Express/Express" "Express": "../Express/Express",
"Copy": "../Copy/Copy"
} }
} }
\ 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-content {
padding: 0 32rpx;
.express-info {
display: flex;
justify-content: space-between;
height: 88rpx;
border-bottom: 1px solid #eff0f2;
.express-info-item {
display: flex;
gap: 6rpx;
align-items: center;
font-weight: 400;
font-size: 28rpx;
color: #333435;
.logo {
width: 32rpx;
height: 32rpx;
border-radius: 50%;
overflow: hidden;
transform: translateY(1rpx);
}
}
}
}
<popup show="{{showExpress}}" only="{{false}}" title="物流详情" bindconfirm="onConfirmPopup"> <popup show="{{showExpress}}" show-close-button="{{true}}" showFooter="{{false}}" headerColor="#F7F7F7" title="物流详情" bindconfirm="onConfirmPopup">
<view class="popup-content"> <view class="popup-content">
<view class="express-info">
<view class="express-info-item">
<view class="logo">
<glsx-image src="{{expressInfo.logo||'https://picsum.photos/200/200'}}" />
</view>
<text>{{expressInfo.name||"顺丰快递"}}</text>
<text>{{expressInfo.number||'SF12222222222222'}}</text>
</view>
<view class="express-info-item">
<Copy />
</view>
</view>
<Express /> <Express />
</view> </view>
</popup> </popup>
\ 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!