order-detail.vue
10.5 KB
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<template>
<view class="page-shell order-detail-page">
<view class="page-blur"></view>
<view class="page-blur-secondary"></view>
<view class="page-blur-tertiary"></view>
<view class="page-content subpage-content">
<view class="subpage-nav">
<view class="subpage-back" @tap="goBack">‹</view>
<view class="subpage-title-wrap">
<text class="subpage-title">订单详情</text>
<text class="subpage-subtitle">商品、核销与自提状态,一页为你清晰整理</text>
</view>
</view>
<view class="subpage-hero glass-card">
<text class="hero-kicker">{{ order.status }}</text>
<text class="hero-title">{{ order.title }}</text>
<text class="hero-desc">订单编号 {{ order.orderNo }} · 二维码核销自提</text>
</view>
<view class="order-item-card glass-card">
<view class="order-art">
<view class="order-art-ring"></view>
<text class="order-art-label">{{ shortLabel(order.title) }}</text>
</view>
<view class="order-copy">
<text class="order-name">{{ order.title }}</text>
<text class="order-sku">{{ order.collection }} · {{ order.sku }} × {{ order.quantity }}</text>
<text class="order-amount">实付 ¥{{ order.amount }}</text>
</view>
</view>
<lf-pickup-code
v-if="showVerifyCode"
:code="order.verifyCode"
:used="verifyUsed"
:desc="verifyDesc"
/>
<view v-else-if="order.statusKey === 'pay'" class="subpage-card wait-card">
<text class="wait-title">支付完成后自动生成核销二维码</text>
<text class="wait-desc">当前订单尚未完成支付,支付成功后将自动展示门店核销码与自提信息。</text>
</view>
<lf-pickup-complete
v-else
title="该订单已完成核销"
desc="门店已完成核销与自提,本页不再展示二维码,可在下方查看核销时间与订单状态。"
:status="order.status"
:time="order.pickupTime || order.verifyTime"
/>
<view class="subpage-card">
<view class="section-head">
<text class="section-title">核销信息</text>
<text class="section-link">门店自提</text>
</view>
<view class="info-list">
<view class="info-row">
<text class="info-label">核销方式</text>
<text class="info-value">二维码核销自提</text>
</view>
<view class="info-row">
<text class="info-label">适用门店</text>
<text class="info-value">任意门店可核销</text>
</view>
<view class="info-row">
<text class="info-label">使用时间</text>
<text class="info-value">任意时间可用</text>
</view>
<view v-if="order.verifyCode" class="info-row">
<text class="info-label">核销码</text>
<text class="info-value">{{ order.verifyCode }}</text>
</view>
<view class="info-row">
<text class="info-label">下单时间</text>
<text class="info-value">{{ order.createdAt || order.time }}</text>
</view>
<view v-if="order.verifyTime" class="info-row">
<text class="info-label">核销时间</text>
<text class="info-value">{{ order.verifyTime }}</text>
</view>
<view v-if="order.pickupTime" class="info-row">
<text class="info-label">自提完成</text>
<text class="info-value">{{ order.pickupTime }}</text>
</view>
<view class="info-row">
<text class="info-label">订单状态</text>
<text class="info-value">{{ order.status }}</text>
</view>
</view>
</view>
<view class="subpage-card">
<view class="section-head">
<text class="section-title">流程进度</text>
<text class="section-link">状态说明</text>
</view>
<view class="step-list">
<view v-for="item in processSteps" :key="item.title" class="step-item" :class="{ active: item.active }">
<view class="step-dot"></view>
<view class="step-copy">
<text class="step-title">{{ item.title }}</text>
<text class="step-desc">{{ item.desc }}</text>
</view>
</view>
</view>
</view>
<view class="cta-row">
<view class="secondary-button" @tap="secondaryAction">{{ secondaryLabel }}</view>
<view class="primary-button" @tap="primaryAction">{{ primaryLabel }}</view>
</view>
</view>
</view>
</template>
<script>
import { getDisplayOrderById, saveLatestPickupOrder } from '@/packageMall/data/orderFlow'
export default {
data() {
return {
order: getDisplayOrderById(5001)
}
},
computed: {
showVerifyCode() {
return this.order.statusKey === 'verify'
},
verifyUsed() {
return ['pickup'].indexOf(this.order.statusKey) > -1
},
verifyDesc() {
if (this.verifyUsed) {
return `门店已完成核销与自提${this.order.pickupTime ? ` · ${this.order.pickupTime}` : ''}`
}
return '到店出示二维码即可核销自提,支持任意时间任意门店使用。'
},
primaryLabel() {
switch (this.order.statusKey) {
case 'pay':
return '立即支付'
case 'verify':
case 'pickup':
return '继续选购'
default:
return '返回订单'
}
},
secondaryLabel() {
return this.order.statusKey === 'verify' ? '复制核销码' : '联系客服'
},
processSteps() {
const statusMap = {
pay: 1,
verify: 3,
pickup: 4
}
const currentStep = statusMap[this.order.statusKey] || 1
return [
{ title: '提交订单', desc: '商品已加入本次门店自提订单。', active: currentStep >= 1 },
{ title: '完成支付', desc: '支付成功后,系统会自动生成核销二维码。', active: currentStep >= 2 },
{ title: '到店核销', desc: '支持任意时间前往任意门店出示二维码并完成核销。', active: currentStep >= 3 },
{ title: '完成自提', desc: '核销成功后即可领取商品,订单进入完成状态。', active: currentStep >= 4 }
]
}
},
onLoad(options) {
this.order = getDisplayOrderById(options.id)
},
onShow() {
this.order = getDisplayOrderById(this.order.id)
},
methods: {
shortLabel(title) {
return String(title || '绿纤').replace(/\s+/g, '').slice(0, 2)
},
goBack() {
uni.navigateBack({ fail: () => uni.redirectTo({ url: '/packageProfile/order-list/order-list' }) })
},
goList() {
uni.redirectTo({ url: '/packageProfile/order-list/order-list' })
},
primaryAction() {
if (this.order.statusKey === 'pay') {
saveLatestPickupOrder({
orderId: this.order.id,
createdAt: this.order.createdAt || this.order.time,
status: '待核销',
statusKey: 'verify',
statusNote: '支付成功,核销二维码已生成,到店出示后即可自提。'
})
uni.navigateTo({ url: `/packageMall/payment-success/payment-success?orderId=${this.order.id}` })
return
}
if (['verify', 'pickup'].indexOf(this.order.statusKey) > -1) {
uni.reLaunch({ url: '/packageMall/main/main' })
return
}
this.goList()
},
secondaryAction() {
if (this.order.statusKey === 'verify' && this.order.verifyCode) {
uni.setClipboardData({ data: this.order.verifyCode, success: () => uni.showToast({ title: '核销码已复制', icon: 'none' }) })
return
}
uni.showToast({ title: '已为您接入专属客服', icon: 'none' })
}
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/mixins.scss';
@import '@/styles/subpage.scss';
.order-item-card {
display: flex;
padding: 28rpx;
margin-bottom: 24rpx;
transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 320ms ease;
}
.order-item-card:active {
transform: translateY(-4rpx);
}
.order-art {
width: 180rpx;
height: 180rpx;
border-radius: 28rpx;
flex-shrink: 0;
position: relative;
display: flex;
align-items: center;
justify-content: center;
background: rgba(241, 246, 241, 0.96);
border: 1rpx solid rgba(120, 146, 121, 0.14);
box-shadow: inset 0 1rpx 0 rgba(255, 255, 255, 0.65);
overflow: hidden;
}
.order-art-ring {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
border: 1rpx solid rgba(120, 146, 121, 0.18);
background: rgba(255, 255, 255, 0.45);
animation: lfPulseSoft 5.2s ease-in-out infinite;
}
.order-art-label {
position: absolute;
font-size: 24rpx;
letter-spacing: 4rpx;
color: $brand-primary-deep;
font-weight: 600;
}
.order-art::before {
content: '';
position: absolute;
right: -30rpx;
top: -30rpx;
width: 120rpx;
height: 120rpx;
border-radius: 50%;
background: radial-gradient(circle, rgba(210, 191, 156, 0.22), rgba(210, 191, 156, 0));
animation: lfFloatSoft 9.8s ease-in-out infinite;
}
.order-copy {
flex: 1;
margin-left: 20rpx;
}
.order-name,
.order-sku,
.order-amount,
.wait-title,
.wait-desc,
.step-title,
.step-desc {
display: block;
}
.order-name {
font-size: 30rpx;
line-height: 1.5;
font-weight: 700;
}
.order-sku {
margin-top: 16rpx;
font-size: 24rpx;
color: $text-secondary;
}
.order-amount {
margin-top: 18rpx;
font-size: 34rpx;
font-weight: 700;
color: $brand-primary-deep;
}
.wait-card {
margin-bottom: 24rpx;
}
.wait-title {
font-size: 30rpx;
font-weight: 700;
color: $text-primary;
}
.wait-desc {
margin-top: 14rpx;
font-size: 24rpx;
line-height: 1.8;
color: $text-secondary;
}
.step-item {
display: flex;
align-items: flex-start;
padding: 18rpx 0;
opacity: 0.62;
}
.step-item + .step-item {
border-top: 1rpx solid rgba(100, 140, 118, 0.08);
}
.step-item.active {
opacity: 1;
}
.step-dot {
width: 22rpx;
height: 22rpx;
margin: 12rpx 18rpx 0 0;
flex-shrink: 0;
border-radius: 50%;
background: rgba(210, 191, 156, 0.2);
box-shadow: inset 0 0 0 6rpx rgba(255, 255, 255, 0.8);
}
.step-item.active .step-dot {
background: $brand-primary-deep;
box-shadow: inset 0 0 0 6rpx rgba(255, 255, 255, 0.86), 0 0 0 8rpx rgba(100, 140, 118, 0.08);
}
.step-copy {
flex: 1;
}
.step-title {
font-size: 28rpx;
font-weight: 600;
color: $text-primary;
}
.step-desc {
margin-top: 10rpx;
font-size: 23rpx;
line-height: 1.8;
color: $text-secondary;
}
</style>