sen
1 天以前 7ed2a032d0724e68aec8af940f2ce0023a9f0eb7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<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>