first commit
This commit is contained in:
155
components/credit-header/credit-header.vue
Normal file
155
components/credit-header/credit-header.vue
Normal file
@@ -0,0 +1,155 @@
|
||||
<template>
|
||||
<view class="credit-header" :class="{ 'is-curved': curved }">
|
||||
<view :style="{ height: statusBarHeight + 'px' }"></view>
|
||||
<view class="nav-bar">
|
||||
<view v-if="showBack && canBack" class="back-btn" @tap="handleBack">
|
||||
<view class="back-arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="showBadge" class="zm-badge">
|
||||
<view class="zm-logo"><text class="zm-logo-text">芝</text></view>
|
||||
<text class="zm-text">芝麻信用</text>
|
||||
</view>
|
||||
<view class="hero-title">
|
||||
<text class="hero-slash">///</text>
|
||||
<text class="hero-text">{{ title }}</text>
|
||||
<text class="hero-slash">///</text>
|
||||
</view>
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
|
||||
defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 是否显示「芝麻信用」标识(押金页不显示)
|
||||
showBadge: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showBack: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 底部是否做成弧形(下单页)
|
||||
curved: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const statusBarHeight = ref(0)
|
||||
const canBack = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight || 0
|
||||
|
||||
// 支付宝端用透明原生导航栏自带的返回按钮(pages.json 里 navigationBarTextStyle 已设为白色),
|
||||
// 这里不再画第二个箭头;其他端没有原生导航栏,自己画。
|
||||
// #ifdef MP-ALIPAY
|
||||
canBack.value = false
|
||||
// #endif
|
||||
// #ifndef MP-ALIPAY
|
||||
canBack.value = getCurrentPages().length > 1
|
||||
// #endif
|
||||
})
|
||||
|
||||
function handleBack() {
|
||||
if (getCurrentPages().length > 1) {
|
||||
uni.navigateBack()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.credit-header {
|
||||
position: relative;
|
||||
padding-bottom: 72rpx;
|
||||
background: linear-gradient(180deg, #4a90ff 0%, #1e6bff 100%);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* 下单页:底部弧形,并给悬浮的品牌卡片留出上半部分高度 */
|
||||
.credit-header.is-curved {
|
||||
padding-bottom: 140rpx;
|
||||
border-radius: 0 0 50% 50% / 0 0 96rpx 96rpx;
|
||||
}
|
||||
|
||||
.nav-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 88rpx;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
|
||||
.back-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
}
|
||||
|
||||
.back-arrow {
|
||||
width: 22rpx;
|
||||
height: 22rpx;
|
||||
margin-left: 8rpx;
|
||||
border-left: 4rpx solid #ffffff;
|
||||
border-bottom: 4rpx solid #ffffff;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.zm-badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.zm-logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.zm-logo-text {
|
||||
font-size: 22rpx;
|
||||
font-weight: 600;
|
||||
color: #1e6bff;
|
||||
}
|
||||
|
||||
.zm-text {
|
||||
margin-left: 12rpx;
|
||||
font-size: 26rpx;
|
||||
color: rgba(255, 255, 255, 0.95);
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.hero-text {
|
||||
font-size: 40rpx;
|
||||
font-weight: 600;
|
||||
letter-spacing: 4rpx;
|
||||
}
|
||||
|
||||
.hero-slash {
|
||||
margin: 0 20rpx;
|
||||
font-size: 32rpx;
|
||||
font-style: italic;
|
||||
color: rgba(255, 255, 255, 0.55);
|
||||
}
|
||||
</style>
|
||||
96
components/rental-info/rental-info.vue
Normal file
96
components/rental-info/rental-info.vue
Normal file
@@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<view class="rental-info">
|
||||
<view class="info-row">
|
||||
<text class="row-label">租赁物品</text>
|
||||
<text class="row-value">{{ itemName }}</text>
|
||||
</view>
|
||||
<view class="info-row last">
|
||||
<text class="row-label">押金</text>
|
||||
<view class="row-value-wrap">
|
||||
<text v-if="creditFree" class="free-tag">免押金</text>
|
||||
<text class="amount" :class="{ 'is-free': creditFree }">{{ depositAmount }}</text>
|
||||
<text class="amount-unit" :class="{ 'is-free': creditFree }">元</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps({
|
||||
itemName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
depositAmount: {
|
||||
type: [Number, String],
|
||||
default: ''
|
||||
},
|
||||
// 信用免押时展示「免押金」标签,现场付押金时不展示
|
||||
creditFree: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.rental-info {
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 112rpx;
|
||||
border-bottom: 1rpx solid #eeeeee;
|
||||
}
|
||||
|
||||
.info-row.last {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.row-label {
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.row-value {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
}
|
||||
|
||||
.row-value-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.free-tag {
|
||||
margin-right: 12rpx;
|
||||
padding: 2rpx 10rpx;
|
||||
border: 1rpx solid rgba(30, 107, 255, 0.45);
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #1e6bff;
|
||||
}
|
||||
|
||||
.amount {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
}
|
||||
|
||||
.amount-unit {
|
||||
margin-left: 4rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
}
|
||||
|
||||
/* 免押时把原押金划掉 */
|
||||
.amount.is-free,
|
||||
.amount-unit.is-free {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user