<template>
|
<view class="container">
|
<!-- Nav 返回由 goBack 接管,与底部取消按钮行为一致 -->
|
<Nav title="签署承诺书" @back="goBack" />
|
|
<!-- 进度提示卡片 -->
|
<view class="progress-card">
|
<view class="progress-header">
|
<view class="progress-icon-wrap">
|
<u-icon name="edit-pen" size="20" color="#fff" />
|
</view>
|
<view class="progress-info">
|
<text class="progress-title">发车前签署</text>
|
<text class="progress-desc">请完成以下承诺书签署后方可发车</text>
|
</view>
|
</view>
|
<view class="progress-bar-wrap">
|
<view class="progress-bar">
|
<view class="progress-fill" :style="{ width: progressPercent + '%' }" />
|
</view>
|
<text class="progress-num">{{ completedCount }}/{{ promiseList.length }}</text>
|
</view>
|
</view>
|
|
<!-- 承诺书列表 -->
|
<view class="section-title">签署文件</view>
|
<view class="promise-list">
|
<view
|
v-for="item in promiseList"
|
:key="item.id"
|
class="promise-item"
|
:class="{ 'item-completed': item.completed }"
|
@tap="goToSign(item)"
|
>
|
<view class="item-left">
|
<view class="item-check" :class="{ checked: item.completed }">
|
<u-icon :name="item.completed ? 'checkmark' : 'edit-pen'" :size="item.completed ? 14 : 16" color="#fff" />
|
</view>
|
<view class="item-content">
|
<text class="item-title">{{ item.title }}</text>
|
<text class="item-status" :class="{ completed: item.completed }">
|
{{ item.completed ? '已签署' : '待签署' }}
|
</text>
|
</view>
|
</view>
|
<view class="item-right">
|
<text v-if="!item.completed" class="go-sign">去签署</text>
|
<u-icon name="arrow-right" size="18" :color="item.completed ? '#c0c4cc' : '#4285f4'" />
|
</view>
|
</view>
|
</view>
|
|
<!-- 底部按钮 -->
|
<view class="bottom-bar">
|
<button class="cancel-btn" @tap="goBack">返回上一页</button>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
const PROMISE_CONFIG = Object.freeze([
|
{ id: 1, title: '货车司机出车前健康承诺书', path: '/pages/acknowledgement/index' },
|
{ id: 2, title: '遵纪守法承诺书', path: '/pages/observeLaw/index' }
|
])
|
|
export default {
|
data() {
|
return {
|
isCompleted: false
|
}
|
},
|
|
computed: {
|
promiseList() {
|
return PROMISE_CONFIG.map(item => ({
|
...item,
|
completed: this.isCompleted
|
}))
|
},
|
completedCount() {
|
return this.isCompleted ? PROMISE_CONFIG.length : 0
|
},
|
progressPercent() {
|
return (this.completedCount / PROMISE_CONFIG.length) * 100
|
}
|
},
|
|
onLoad(options) {
|
this.isCompleted = options?.uploadIshow === 'true'
|
},
|
|
methods: {
|
goToSign(item) {
|
uni.navigateTo({ url: item.path })
|
},
|
/**
|
* 安全返回到上传行程页(examine)
|
* 从页面栈中查找 examine 页面,计算正确的 delta 回退
|
* 避免承诺书页面 navigateTo 导致的栈堆积死循环
|
*/
|
goBack() {
|
const pages = getCurrentPages()
|
// 从栈底往上找 examine 页面
|
for (let i = pages.length - 2; i >= 0; i--) {
|
if (pages[i].route && pages[i].route.includes('pages/examine')) {
|
uni.navigateBack({ delta: pages.length - 1 - i })
|
return
|
}
|
}
|
// 兜底:直接返回上一页
|
uni.navigateBack({ delta: 1 })
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.container {
|
display: flex;
|
flex-direction: column;
|
height: 100vh;
|
background-color: #f5f7fa;
|
}
|
|
/* 进度卡片 */
|
.progress-card {
|
margin: 24rpx 24rpx 0;
|
padding: 32rpx;
|
background: linear-gradient(135deg, #4285f4 0%, #5b9ef4 100%);
|
border-radius: 20rpx;
|
box-shadow: 0 8rpx 24rpx rgba(66, 133, 244, 0.3);
|
}
|
|
.progress-header {
|
display: flex;
|
align-items: center;
|
margin-bottom: 28rpx;
|
}
|
|
.progress-icon-wrap {
|
width: 72rpx;
|
height: 72rpx;
|
border-radius: 50%;
|
background-color: rgba(255, 255, 255, 0.25);
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
margin-right: 20rpx;
|
flex-shrink: 0;
|
}
|
|
.progress-info {
|
display: flex;
|
flex-direction: column;
|
}
|
|
.progress-title {
|
font-size: 34rpx;
|
font-weight: 600;
|
color: #fff;
|
margin-bottom: 6rpx;
|
}
|
|
.progress-desc {
|
font-size: 24rpx;
|
color: rgba(255, 255, 255, 0.8);
|
}
|
|
.progress-bar-wrap {
|
display: flex;
|
align-items: center;
|
}
|
|
.progress-bar {
|
flex: 1;
|
height: 12rpx;
|
background-color: rgba(255, 255, 255, 0.3);
|
border-radius: 6rpx;
|
overflow: hidden;
|
margin-right: 16rpx;
|
}
|
|
.progress-fill {
|
height: 100%;
|
background-color: #fff;
|
border-radius: 6rpx;
|
transition: width 0.4s ease;
|
}
|
|
.progress-num {
|
font-size: 26rpx;
|
color: #fff;
|
font-weight: 500;
|
flex-shrink: 0;
|
}
|
|
/* 分区标题 */
|
.section-title {
|
font-size: 28rpx;
|
color: #909399;
|
padding: 28rpx 36rpx 16rpx;
|
}
|
|
/* 承诺书列表 */
|
.promise-list {
|
margin: 0 24rpx;
|
border-radius: 16rpx;
|
overflow: hidden;
|
background-color: #fff;
|
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
}
|
|
.promise-item {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
padding: 32rpx;
|
position: relative;
|
}
|
|
.promise-item + .promise-item {
|
border-top: 1rpx solid #f2f3f5;
|
}
|
|
.promise-item:active {
|
background-color: #f5f7fa;
|
}
|
|
.item-left {
|
display: flex;
|
align-items: center;
|
flex: 1;
|
min-width: 0;
|
}
|
|
.item-check {
|
width: 56rpx;
|
height: 56rpx;
|
border-radius: 50%;
|
background-color: #e6e8eb;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
margin-right: 24rpx;
|
flex-shrink: 0;
|
transition: background-color 0.3s;
|
}
|
|
.item-check.checked {
|
background-color: #52c41a;
|
}
|
|
.item-content {
|
display: flex;
|
flex-direction: column;
|
min-width: 0;
|
}
|
|
.item-title {
|
font-size: 30rpx;
|
color: #303133;
|
font-weight: 500;
|
margin-bottom: 8rpx;
|
overflow: hidden;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
}
|
|
.item-status {
|
font-size: 24rpx;
|
color: #ff6b6b;
|
}
|
|
.item-status.completed {
|
color: #52c41a;
|
}
|
|
.item-completed .item-title {
|
color: #909399;
|
}
|
|
.item-right {
|
display: flex;
|
align-items: center;
|
flex-shrink: 0;
|
margin-left: 16rpx;
|
}
|
|
.go-sign {
|
font-size: 24rpx;
|
color: #4285f4;
|
margin-right: 8rpx;
|
}
|
|
/* 底部按钮 */
|
.bottom-bar {
|
padding: 24rpx 24rpx;
|
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
|
background-color: #fff;
|
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.04);
|
}
|
|
.cancel-btn {
|
width: 100%;
|
height: 88rpx;
|
line-height: 88rpx;
|
font-size: 30rpx;
|
background-color: #f5f7fa;
|
color: #606266;
|
border-radius: 12rpx;
|
border: none;
|
font-weight: 500;
|
}
|
|
.cancel-btn::after {
|
border: none;
|
}
|
|
.cancel-btn:active {
|
background-color: #e8eaed;
|
}
|
</style>
|