mrr.sj.front/components/step-tab/step-tab.vue

253 lines
5.7 KiB
Vue
Raw Normal View History

2026-03-24 11:45:13 +08:00
<template>
<view class="step-tab">
<view class="step-container">
<view class="step-item" :class="getStepClass(0)">
<view class="step-icon">
<image
v-if="mappedStep === 0"
2026-06-04 10:51:59 +08:00
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d62a1d01-52cb-418e-ba5b-afef513061b9.png"
2026-03-24 11:45:13 +08:00
class="step-img active-circle"
mode="aspectFit"
/>
<view v-else-if="mappedStep > 0" class="step-done">1</view>
2026-03-24 11:45:13 +08:00
<view v-else class="step-number">1</view>
</view>
<text class="step-text" :class="{ active: mappedStep === 0 }">入驻协议</text>
2026-03-24 11:45:13 +08:00
</view>
2026-03-24 11:45:13 +08:00
<view class="line-segment line-1">
<view class="line-progress" :class="{ active: line1Active, deactivating: line1Deactivating }"></view>
</view>
2026-03-24 11:45:13 +08:00
<view class="step-item" :class="getStepClass(1)">
<view class="step-icon">
<image
v-if="mappedStep === 1"
2026-06-04 10:51:59 +08:00
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d62a1d01-52cb-418e-ba5b-afef513061b9.png"
2026-03-24 11:45:13 +08:00
class="step-img active-circle"
mode="aspectFit"
/>
<view v-else-if="mappedStep > 1" class="step-done">2</view>
2026-03-24 11:45:13 +08:00
<view v-else class="step-number">2</view>
</view>
<text class="step-text" :class="{ active: mappedStep === 1 }">基本信息</text>
2026-03-24 11:45:13 +08:00
</view>
2026-03-24 11:45:13 +08:00
<view class="line-segment line-2">
<view class="line-progress" :class="{ active: line2Active, deactivating: line2Deactivating }"></view>
</view>
2026-03-24 11:45:13 +08:00
<view class="step-item" :class="getStepClass(2)">
<view class="step-icon">
<image
v-if="mappedStep === 2"
2026-06-04 10:51:59 +08:00
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d62a1d01-52cb-418e-ba5b-afef513061b9.png"
2026-03-24 11:45:13 +08:00
class="step-img active-circle"
mode="aspectFit"
/>
<view v-else-if="mappedStep > 2" class="step-done">3</view>
2026-03-24 11:45:13 +08:00
<view v-else class="step-number">3</view>
</view>
<text class="step-text" :class="{ active: mappedStep === 2 }">资质认证</text>
2026-03-24 11:45:13 +08:00
</view>
</view>
</view>
</template>
<script>
export default {
name: "StepTab",
props: {
mappedStep: {
2026-03-24 11:45:13 +08:00
type: Number,
default: 0
}
},
data() {
return {
prevStep: 0,
line1Active: false,
line2Active: false,
line1Deactivating: false,
line2Deactivating: false
2026-03-24 11:45:13 +08:00
};
},
watch: {
mappedStep(newVal, oldVal) {
2026-03-24 11:45:13 +08:00
this.prevStep = oldVal;
if (newVal > oldVal) {
if (newVal >= 1) {
this.line1Active = true;
this.line1Deactivating = false;
}
if (newVal >= 2) {
this.line2Active = true;
this.line2Deactivating = false;
}
} else if (newVal < oldVal) {
2026-03-24 11:45:13 +08:00
if (newVal < 2) {
this.line2Deactivating = true;
setTimeout(() => {
this.line2Active = false;
this.line2Deactivating = false;
}, 300);
2026-03-24 11:45:13 +08:00
}
if (newVal < 1) {
this.line1Deactivating = true;
setTimeout(() => {
this.line1Active = false;
this.line1Deactivating = false;
}, 300);
2026-03-24 11:45:13 +08:00
}
}
}
},
mounted() {
this.line1Active = this.mappedStep >= 1;
this.line2Active = this.mappedStep >= 2;
2026-03-24 11:45:13 +08:00
},
methods: {
getStepClass(stepIndex) {
if (stepIndex === this.mappedStep) {
2026-03-24 11:45:13 +08:00
return 'active';
}
else if (stepIndex < this.mappedStep) {
2026-03-24 11:45:13 +08:00
return 'completed';
}
return '';
}
}
}
</script>
<style scoped>
.step-tab {
height: 98rpx;
position: relative;
padding: 31rpx 0;
background-color: #fff;
}
.step-container {
display: flex;
justify-content: space-between;
align-items: center;
padding: 5rpx 60rpx;
position: relative;
z-index: 2;
}
.step-item {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
z-index: 2;
transition: all 0.3s ease;
flex: 1;
}
.step-icon {
width: 50rpx;
height: 50rpx;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 14rpx;
}
.step-img.active-circle {
width: 50rpx;
height: 50rpx;
}
.step-number {
width: 50rpx;
height: 50rpx;
border-radius: 50%;
background-color: #F4F6FA;
display: flex;
justify-content: center;
align-items: center;
font-size: 28rpx;
color: #999999;
font-weight: 500;
transition: all 0.3s ease;
}
.step-done {
width: 50rpx;
height: 50rpx;
border-radius: 50%;
background-color: #FAD0D3;
display: flex;
justify-content: center;
align-items: center;
font-size: 28rpx;
2026-06-02 11:39:23 +08:00
color: #FF4767;
2026-03-24 11:45:13 +08:00
font-weight: 500;
transition: all 0.3s ease;
box-shadow: inset 0 0 4rpx rgba(232, 16, 30, 0.2);
}
.step-text {
font-size: 24rpx;
color: #999;
font-weight: 400;
transition: all 0.3s ease;
}
.step-text.active {
color: #333333;
font-weight: 500;
}
.step-item.completed .step-text {
color: #333333;
font-weight: 500;
}
.line-segment {
position: relative;
height: 8rpx;
background-color: #F4F6FA;
border-radius: 4rpx;
top: -25rpx;
overflow: hidden;
width: 126rpx;
transition: all 0.3s ease;
}
.line-1 {
margin-left: 20rpx;
margin-right: 20rpx;
}
.line-2 {
margin-left: 20rpx;
margin-right: 20rpx;
}
.line-progress {
height: 100%;
width: 0%;
background-color: #F4F6FA;
border-radius: 4rpx;
transition: width 0.3s ease;
transform-origin: left center;
}
.line-progress.active {
width: 100%;
2026-06-02 11:39:23 +08:00
background-color: #FF4767;
2026-03-24 11:45:13 +08:00
transition: width 0.3s ease;
}
.line-progress.deactivating {
width: 0%;
2026-06-02 11:39:23 +08:00
background-color: #FF4767;
2026-03-24 11:45:13 +08:00
transition: width 0.3s ease;
transform-origin: right center;
}
</style>