5c34676a
“wangming”
对会员端进行了设计
|
1
2
3
4
5
6
7
8
9
10
11
|
<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>
|
e1dcb3a0
“wangming”
1
|
12
|
<text class="subpage-subtitle">商品、支付与自提状态,一页为你清晰整理</text>
|
5c34676a
“wangming”
对会员端进行了设计
|
13
14
15
16
|
</view>
</view>
<view class="subpage-hero glass-card">
|
e1dcb3a0
“wangming”
1
|
17
18
19
|
<text class="hero-kicker">{{ statusText }}</text>
<text class="hero-title">{{ mainItemName }}</text>
<text class="hero-desc">订单编号 {{ order.orderNo }}</text>
|
5c34676a
“wangming”
对会员端进行了设计
|
20
21
|
</view>
|
e1dcb3a0
“wangming”
1
|
22
23
24
|
<view v-for="item in items" :key="item.id" class="order-item-card glass-card">
<image v-if="item.productImg" class="order-thumb" :src="item.productImg" mode="aspectFill" />
<view v-else class="order-art">
|
5c34676a
“wangming”
对会员端进行了设计
|
25
|
<view class="order-art-ring"></view>
|
e1dcb3a0
“wangming”
1
|
26
|
<text class="order-art-label">{{ shortLabel(item.productName) }}</text>
|
5c34676a
“wangming”
对会员端进行了设计
|
27
28
|
</view>
<view class="order-copy">
|
e1dcb3a0
“wangming”
1
|
29
30
31
|
<text class="order-name">{{ item.productName }}</text>
<text class="order-sku">{{ item.skuName || '默认规格' }} × {{ item.quantity }}</text>
<text class="order-amount">¥{{ item.amount }}</text>
|
5c34676a
“wangming”
对会员端进行了设计
|
32
33
34
|
</view>
</view>
|
d8035736
“wangming”
Refactor project ...
|
35
|
<lf-pickup-code
|
e1dcb3a0
“wangming”
1
|
36
37
38
39
|
v-if="order.orderStatus === 2 && order.pickupCode"
:code="order.pickupCode"
title="门店自提取件码"
desc="到自提门店出示取件码,门店核销后即可完成自提。"
|
d8035736
“wangming”
Refactor project ...
|
40
41
|
/>
|
e1dcb3a0
“wangming”
1
|
42
43
44
|
<view v-else-if="order.orderStatus === 1" class="subpage-card wait-card">
<text class="wait-title">支付完成后自动生成取件码</text>
<text class="wait-desc">当前订单尚未完成支付,支付成功后将自动生成取件码与自提信息。</text>
|
d8035736
“wangming”
Refactor project ...
|
45
46
47
|
</view>
<lf-pickup-complete
|
e1dcb3a0
“wangming”
1
|
48
|
v-else-if="order.orderStatus === 3"
|
d8035736
“wangming”
Refactor project ...
|
49
|
title="该订单已完成核销"
|
e1dcb3a0
“wangming”
1
|
50
51
52
|
desc="门店已完成核销与自提,本页不再展示取件码,可在下方查看核销时间与订单状态。"
:status="statusText"
:time="order.pickupTime"
|
d8035736
“wangming”
Refactor project ...
|
53
54
|
/>
|
5c34676a
“wangming”
对会员端进行了设计
|
55
|
<view class="subpage-card">
|
d8035736
“wangming”
Refactor project ...
|
56
|
<view class="section-head">
|
e1dcb3a0
“wangming”
1
|
57
|
<text class="section-title">订单信息</text>
|
d8035736
“wangming”
Refactor project ...
|
58
59
|
<text class="section-link">门店自提</text>
</view>
|
5c34676a
“wangming”
对会员端进行了设计
|
60
61
|
<view class="info-list">
<view class="info-row">
|
e1dcb3a0
“wangming”
1
|
62
63
|
<text class="info-label">订单编号</text>
<text class="info-value">{{ order.orderNo }}</text>
|
5c34676a
“wangming”
对会员端进行了设计
|
64
65
|
</view>
<view class="info-row">
|
e1dcb3a0
“wangming”
1
|
66
67
|
<text class="info-label">自提门店</text>
<text class="info-value">{{ order.storeName || '—' }}</text>
|
d8035736
“wangming”
Refactor project ...
|
68
|
</view>
|
e1dcb3a0
“wangming”
1
|
69
70
71
|
<view v-if="order.pickupCode" class="info-row">
<text class="info-label">取件码</text>
<text class="info-value">{{ order.pickupCode }}</text>
|
5c34676a
“wangming”
对会员端进行了设计
|
72
73
74
|
</view>
<view class="info-row">
<text class="info-label">下单时间</text>
|
e1dcb3a0
“wangming”
1
|
75
|
<text class="info-value">{{ formatTime(order.createTime) }}</text>
|
d8035736
“wangming”
Refactor project ...
|
76
|
</view>
|
e1dcb3a0
“wangming”
1
|
77
78
79
|
<view v-if="order.payTime" class="info-row">
<text class="info-label">支付时间</text>
<text class="info-value">{{ formatTime(order.payTime) }}</text>
|
d8035736
“wangming”
Refactor project ...
|
80
81
|
</view>
<view v-if="order.pickupTime" class="info-row">
|
e1dcb3a0
“wangming”
1
|
82
83
|
<text class="info-label">核销时间</text>
<text class="info-value">{{ formatTime(order.pickupTime) }}</text>
|
5c34676a
“wangming”
对会员端进行了设计
|
84
85
|
</view>
<view class="info-row">
|
e1dcb3a0
“wangming”
1
|
86
87
|
<text class="info-label">实付金额</text>
<text class="info-value">¥{{ order.payAmount }}</text>
|
5c34676a
“wangming”
对会员端进行了设计
|
88
|
</view>
|
e1dcb3a0
“wangming”
1
|
89
90
91
92
93
94
95
|
<view v-if="order.remark" class="info-row">
<text class="info-label">订单备注</text>
<text class="info-value">{{ order.remark }}</text>
</view>
<view class="info-row">
<text class="info-label">订单状态</text>
<text class="info-value">{{ statusText }}</text>
|
d8035736
“wangming”
Refactor project ...
|
96
97
98
99
|
</view>
</view>
</view>
|
5c34676a
“wangming”
对会员端进行了设计
|
100
|
<view class="cta-row">
|
d8035736
“wangming”
Refactor project ...
|
101
|
<view class="secondary-button" @tap="secondaryAction">{{ secondaryLabel }}</view>
|
5c34676a
“wangming”
对会员端进行了设计
|
102
103
104
105
106
107
108
|
<view class="primary-button" @tap="primaryAction">{{ primaryLabel }}</view>
</view>
</view>
</view>
</template>
<script>
|
e1dcb3a0
“wangming”
1
|
109
110
|
import { getOrderDetail, cancelOrder, prepay, mockPay } from '@/api/mall'
import { orderStatusText } from '@/utils/orderStatus'
|
5c34676a
“wangming”
对会员端进行了设计
|
111
112
113
114
|
export default {
data() {
return {
|
e1dcb3a0
“wangming”
1
|
115
116
|
orderId: '',
order: {}
|
5c34676a
“wangming”
对会员端进行了设计
|
117
118
119
|
}
},
computed: {
|
e1dcb3a0
“wangming”
1
|
120
121
|
items() {
return this.order.items || []
|
d8035736
“wangming”
Refactor project ...
|
122
|
},
|
e1dcb3a0
“wangming”
1
|
123
124
|
statusText() {
return orderStatusText(this.order.orderStatus)
|
d8035736
“wangming”
Refactor project ...
|
125
|
},
|
e1dcb3a0
“wangming”
1
|
126
127
128
129
|
mainItemName() {
const items = this.items
if (!items.length) return '绿纤商品'
return items.length > 1 ? `${items[0].productName} 等 ${items.length} 件` : items[0].productName
|
d8035736
“wangming”
Refactor project ...
|
130
|
},
|
5c34676a
“wangming”
对会员端进行了设计
|
131
|
primaryLabel() {
|
e1dcb3a0
“wangming”
1
|
132
133
|
switch (this.order.orderStatus) {
case 1:
|
d8035736
“wangming”
Refactor project ...
|
134
|
return '立即支付'
|
e1dcb3a0
“wangming”
1
|
135
136
|
case 2:
case 3:
|
d8035736
“wangming”
Refactor project ...
|
137
138
139
140
141
142
|
return '继续选购'
default:
return '返回订单'
}
},
secondaryLabel() {
|
e1dcb3a0
“wangming”
1
|
143
144
145
|
if (this.order.orderStatus === 1) return '取消订单'
if (this.order.orderStatus === 2 && this.order.pickupCode) return '复制取件码'
return '联系客服'
|
5c34676a
“wangming”
对会员端进行了设计
|
146
147
148
|
}
},
onLoad(options) {
|
e1dcb3a0
“wangming”
1
|
149
150
|
this.orderId = options.id
this.loadOrder()
|
d8035736
“wangming”
Refactor project ...
|
151
152
|
},
onShow() {
|
e1dcb3a0
“wangming”
1
|
153
|
if (this.orderId) this.loadOrder()
|
5c34676a
“wangming”
对会员端进行了设计
|
154
155
|
},
methods: {
|
e1dcb3a0
“wangming”
1
|
156
157
158
159
160
161
162
163
164
165
|
loadOrder() {
getOrderDetail(this.orderId)
.then((data) => {
this.order = data || {}
})
.catch(() => {})
},
formatTime(time) {
return time ? String(time).replace('T', ' ').slice(0, 16) : ''
},
|
5c34676a
“wangming”
对会员端进行了设计
|
166
167
168
169
170
171
|
shortLabel(title) {
return String(title || '绿纤').replace(/\s+/g, '').slice(0, 2)
},
goBack() {
uni.navigateBack({ fail: () => uni.redirectTo({ url: '/packageProfile/order-list/order-list' }) })
},
|
5c34676a
“wangming”
对会员端进行了设计
|
172
|
primaryAction() {
|
e1dcb3a0
“wangming”
1
|
173
174
|
if (this.order.orderStatus === 1) {
this.payOrder()
|
5c34676a
“wangming”
对会员端进行了设计
|
175
176
|
return
}
|
e1dcb3a0
“wangming”
1
|
177
|
if (this.order.orderStatus === 2 || this.order.orderStatus === 3) {
|
d8035736
“wangming”
Refactor project ...
|
178
179
180
|
uni.reLaunch({ url: '/packageMall/main/main' })
return
}
|
e1dcb3a0
“wangming”
1
|
181
|
uni.redirectTo({ url: '/packageProfile/order-list/order-list' })
|
5c34676a
“wangming”
对会员端进行了设计
|
182
|
},
|
d8035736
“wangming”
Refactor project ...
|
183
|
secondaryAction() {
|
e1dcb3a0
“wangming”
1
|
184
185
186
187
188
189
190
191
192
|
if (this.order.orderStatus === 1) {
this.doCancel()
return
}
if (this.order.orderStatus === 2 && this.order.pickupCode) {
uni.setClipboardData({
data: this.order.pickupCode,
success: () => uni.showToast({ title: '取件码已复制', icon: 'none' })
})
|
d8035736
“wangming”
Refactor project ...
|
193
194
|
return
}
|
5c34676a
“wangming”
对会员端进行了设计
|
195
|
uni.showToast({ title: '已为您接入专属客服', icon: 'none' })
|
e1dcb3a0
“wangming”
1
|
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
|
},
doCancel() {
uni.showModal({
title: '取消订单',
content: '确认取消该订单吗?',
success: (res) => {
if (!res.confirm) return
cancelOrder(this.orderId)
.then(() => {
uni.showToast({ title: '订单已取消', icon: 'none' })
this.loadOrder()
})
.catch(() => {})
}
})
},
payOrder() {
uni.showLoading({ title: '支付中', mask: true })
prepay({ OrderId: this.orderId })
.then((pay) => {
if (pay && pay.mock === true) {
return mockPay({ OrderId: this.orderId }).then(() => {
uni.hideLoading()
uni.showToast({ title: '支付成功', icon: 'none' })
this.loadOrder()
})
}
const params = (pay && pay.prepayParams) || {}
uni.hideLoading()
uni.requestPayment({
provider: 'wxpay',
timeStamp: params.timeStamp,
nonceStr: params.nonceStr,
package: params.package,
signType: params.signType,
paySign: params.paySign,
success: () => {
// TODO: 真实支付以微信回调 PayNotify 为准,此处刷新订单状态
this.loadOrder()
},
fail: () => uni.showToast({ title: '支付未完成', icon: 'none' })
})
})
.catch(() => {
uni.hideLoading()
})
|
5c34676a
“wangming”
对会员端进行了设计
|
242
243
244
245
246
247
248
249
250
251
252
253
254
|
}
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/mixins.scss';
@import '@/styles/subpage.scss';
.order-item-card {
display: flex;
padding: 28rpx;
margin-bottom: 24rpx;
|
d8035736
“wangming”
Refactor project ...
|
255
256
|
}
|
e1dcb3a0
“wangming”
1
|
257
258
259
260
261
|
.order-thumb {
width: 180rpx;
height: 180rpx;
border-radius: 28rpx;
flex-shrink: 0;
|
5c34676a
“wangming”
对会员端进行了设计
|
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
}
.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);
|
d8035736
“wangming”
Refactor project ...
|
276
|
overflow: hidden;
|
5c34676a
“wangming”
对会员端进行了设计
|
277
278
279
280
281
282
283
284
|
}
.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);
|
5c34676a
“wangming”
对会员端进行了设计
|
285
286
287
288
289
290
291
292
293
294
|
}
.order-art-label {
position: absolute;
font-size: 24rpx;
letter-spacing: 4rpx;
color: $brand-primary-deep;
font-weight: 600;
}
|
5c34676a
“wangming”
对会员端进行了设计
|
295
296
297
298
299
300
301
|
.order-copy {
flex: 1;
margin-left: 20rpx;
}
.order-name,
.order-sku,
|
d8035736
“wangming”
Refactor project ...
|
302
303
|
.order-amount,
.wait-title,
|
e1dcb3a0
“wangming”
1
|
304
|
.wait-desc {
|
5c34676a
“wangming”
对会员端进行了设计
|
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
|
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;
}
|
d8035736
“wangming”
Refactor project ...
|
326
|
|
d8035736
“wangming”
Refactor project ...
|
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
|
.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;
}
|
5c34676a
“wangming”
对会员端进行了设计
|
343
|
</style>
|