zhangwencui
2026-07-14 10ae883d6368fb8fc3f95620f610c3aaf6c6a3cd
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
<template>
  <view v-if="show" class="swm-mask" @touchmove.stop.prevent @tap.stop>
    <view class="swm-card" @tap.stop>
      <view class="swm-figure">
        <view v-if="status === 'waiting'" class="swm-scan-box">
          <view class="swm-scan-line" />
          <view class="swm-scan-corner tl" />
          <view class="swm-scan-corner tr" />
          <view class="swm-scan-corner bl" />
          <view class="swm-scan-corner br" />
        </view>
        <view v-else-if="status === 'done'" class="swm-check">
          <view class="swm-check-mark" />
        </view>
        <view v-else class="swm-warn">
          <view class="swm-warn-bar" />
          <view class="swm-warn-dot" />
        </view>
      </view>
      <view class="swm-title">{{ titleText }}</view>
      <view class="swm-sub">{{ subText }}</view>
    </view>
  </view>
</template>
 
<script setup>
  import { computed } from "vue";
 
  const props = defineProps({
    show: { type: Boolean, default: false },
    status: { type: String, default: "waiting" },
    title: { type: String, default: "" },
    subTitle: { type: String, default: "" },
  });
 
  const titleText = computed(() => {
    if (props.title) return props.title;
    if (props.status === "done") return "扫码完成";
    if (props.status === "timeout") return "扫码超时";
    return "等待扫码";
  });
 
  const subText = computed(() => {
    if (props.subTitle) return props.subTitle;
    if (props.status === "done") return "正在处理扫码结果";
    if (props.status === "timeout") return "未收到扫码数据,请重试";
    return "请对准二维码/条码进行扫描";
  });
</script>
 
<style scoped lang="scss">
  .swm-mask {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
  }
 
  .swm-card {
    width: 620rpx;
    padding: 36rpx 32rpx 30rpx;
    background: #ffffff;
    border-radius: 24rpx;
    box-shadow: 0 16rpx 44rpx rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    align-items: center;
  }
 
  .swm-figure {
    width: 260rpx;
    height: 260rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18rpx;
  }
 
  .swm-title {
    font-size: 34rpx;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.88);
    margin-bottom: 10rpx;
  }
 
  .swm-sub {
    font-size: 26rpx;
    color: rgba(0, 0, 0, 0.55);
    text-align: center;
    line-height: 38rpx;
  }
 
  .swm-scan-box {
    width: 220rpx;
    height: 220rpx;
    border-radius: 22rpx;
    background: rgba(25, 137, 250, 0.06);
    position: relative;
    overflow: hidden;
  }
 
  .swm-scan-line {
    position: absolute;
    left: 14rpx;
    right: 14rpx;
    height: 6rpx;
    top: 18rpx;
    border-radius: 6rpx;
    background: linear-gradient(90deg, rgba(25, 137, 250, 0), #1989fa, rgba(25, 137, 250, 0));
    animation: swmScan 1.2s linear infinite;
  }
 
  .swm-scan-corner {
    position: absolute;
    width: 34rpx;
    height: 34rpx;
    border-color: #1989fa;
    border-style: solid;
  }
 
  .swm-scan-corner.tl {
    left: 0;
    top: 0;
    border-width: 6rpx 0 0 6rpx;
    border-top-left-radius: 20rpx;
  }
 
  .swm-scan-corner.tr {
    right: 0;
    top: 0;
    border-width: 6rpx 6rpx 0 0;
    border-top-right-radius: 20rpx;
  }
 
  .swm-scan-corner.bl {
    left: 0;
    bottom: 0;
    border-width: 0 0 6rpx 6rpx;
    border-bottom-left-radius: 20rpx;
  }
 
  .swm-scan-corner.br {
    right: 0;
    bottom: 0;
    border-width: 0 6rpx 6rpx 0;
    border-bottom-right-radius: 20rpx;
  }
 
  @keyframes swmScan {
    0% {
      transform: translateY(0);
      opacity: 0.9;
    }
    90% {
      opacity: 0.95;
    }
    100% {
      transform: translateY(180rpx);
      opacity: 0.55;
    }
  }
 
  .swm-check {
    width: 180rpx;
    height: 180rpx;
    border-radius: 90rpx;
    background: rgba(18, 185, 129, 0.12);
    border: 6rpx solid rgba(18, 185, 129, 0.85);
    position: relative;
  }
 
  .swm-check-mark {
    position: absolute;
    left: 58rpx;
    top: 72rpx;
    width: 56rpx;
    height: 30rpx;
    border-left: 10rpx solid rgba(18, 185, 129, 0.95);
    border-bottom: 10rpx solid rgba(18, 185, 129, 0.95);
    transform: rotate(-45deg);
  }
 
  .swm-warn {
    width: 180rpx;
    height: 180rpx;
    border-radius: 90rpx;
    background: rgba(245, 158, 11, 0.12);
    border: 6rpx solid rgba(245, 158, 11, 0.9);
    position: relative;
  }
 
  .swm-warn-bar {
    position: absolute;
    left: 50%;
    top: 44rpx;
    width: 10rpx;
    height: 72rpx;
    border-radius: 10rpx;
    transform: translateX(-50%);
    background: rgba(245, 158, 11, 0.95);
  }
 
  .swm-warn-dot {
    position: absolute;
    left: 50%;
    bottom: 42rpx;
    width: 14rpx;
    height: 14rpx;
    border-radius: 14rpx;
    transform: translateX(-50%);
    background: rgba(245, 158, 11, 0.95);
  }
</style>