cshenfu
2024-06-27 58aa6e282bb343503be3cb198948328ea3ed7b79
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
<template>
    <view class="flex-col group_1">
        <view class="flex-col section_1" v-if="orderInfo && orderInfo.type != 'recharge'&& orderInfo.type != 'role'">
            <image src="/static/local/f9ca23eb45218e324ec476878fc42fee.png" class="image_2" />
            <view class="flex-row group_2">
                <text>{{address.name || '暂无地址'}}</text>
                <text class="text_2">{{address.phone_number}}</text>
            </view>
            <view class="flex-row group_3">
                <text class="text_3">{{address.province + address.city + address.area + address.detail}}</text>
            </view>
        </view>
        <view class="flex-row section_2">
            <block v-if="orderInfo && orderInfo.type != 'recharge'&& orderInfo.type != 'role'">
                <u-image :src="orderInfo.courseInfo.goods_thumb" :lazy-load="true" width="250" height="160"
                    border-radius="8rpx" mode="aspectFill">
                </u-image>
                <view class="flex-col group_4">
                    <text class="text_4">{{orderInfo.title}}</text>
                    <text class="text_5">¥{{orderInfo.total_fee / 100}}</text>
                </view>
            </block>
            <block v-else>
                <view class="group_4_text">
                    <text class="text_4">{{orderInfo.title}}</text>
                    <text class="text_5">¥{{orderInfo.total_fee / 100}}</text>
                </view>
            </block>
        </view>
        <view class="flex-col section_3">
            <view class="justify-between group_5">
                <text class="text_6">订单信息</text>
                <text class="text_7">{{orderStatus(orderInfo.status)}}</text>
            </view>
            <view class="justify-between group_6">
                <view class="flex-row group_7">
                    <text class="text_8">订单编号</text>
                    <text class="text_9">{{orderInfo.order_no}}</text>
                </view>
                <view class="flex-col items-center text-wrapper" @tap="copy">
                    <text>复制</text>
                </view>
            </view>
            <view class="flex-row group_8">
                <text class="text_11">下单时间</text>
                <view class="flex-col group_9">
                    <text>{{orderTime}}</text>
                </view>
            </view>
            <view class="flex-row group_10">
                <text class="text_14">订单总价</text>
                <text class="text_15">¥{{orderInfo.total_fee / 100}}</text>
            </view>
        </view>
        <u-toast ref="uToast" />
    </view>
</template>
 
<script>
    var that; // 当前页面对象
    var vk; // vk依赖
    export default {
        data() {
            // 页面数据变量
            return {
                orderInfo: {},
                address: {
                    name: '',
                    phone_number: '',
                    province: '',
                    city: '',
                    area: '',
                    detail: ''
                }
            }
        },
        // 监听 - 页面每次【加载时】执行(如:前进)
        onLoad(options = {}) {
            that = this;
            vk = that.vk;
            that.init(options)
        },
        // 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
        onReady() {},
        // 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
        onShow() {},
        // 监听 - 页面每次【隐藏时】执行(如:返回)
        onHide() {},
        computed: {
            // 订单状态
            orderStatus() {
                return (status) => {
                    switch (status) {
                        case 1:
                            return '待付款';
                        case 2:
                            return '已付款';
                        case 3:
                            return '退款审核中';
                        case 4:
                            return '已退款';
                        case 5:
                            return '退款中';
                        case -1:
                            return '已取消付款/退款';
                        case -2:
                            return '退款拒绝';
                        case -3:
                            return '退款失败';
                    }
                }
            },
            // 订单时间
            orderTime() {
                if (!that.orderInfo) return ''
                let timeStr = that.orderInfo._add_time_str.slice(0, -3)
                return timeStr
            }
        },
        // 函数
        methods: {
            // 页面数据初始化函数
            init(options) {
                // 获取本地存储的订单信息
                that.orderInfo = vk.getStorageSync('order-detail');
                if (vk.pubfn.isNotNull(that.orderInfo.courseInfo.address_info)) {
                    that.address = that.orderInfo.courseInfo.address_info
                }
            },
            // 复制订单号
            copy() {
                uni.setClipboardData({
                    data: that.orderInfo.order_no,
                    showToast: false,
                    success: () => {
                        this.$refs.uToast.show({
                            title: '复制成功',
                            type: 'success',
                            duration: 1200
                        })
                    }
                })
            }
        },
        destroyed() {
            vk.removeStorageSync('order-detail');
        }
    }
</script>
 
<style lang="scss" scoped>
    .group_1 {
        padding: 20rpx 20rpx;
        flex: 1 1 auto;
        overflow-y: auto;
        height: 100vh;
        padding: 20rpx;
        background: #F5F5F5;
 
        .section_1 {
            padding: 35rpx 20rpx;
            background-color: rgb(255, 255, 255);
            box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.06);
            border-radius: 12rpx;
            position: relative;
 
            .image_2 {
                width: 44rpx;
                height: 52rpx;
                position: absolute;
                top: 50%;
                transform: translate(0, -50%);
            }
 
            .group_2 {
                padding: 0 70rpx;
                color: rgb(33, 33, 33);
                font-size: 28rpx;
                line-height: 34rpx;
                white-space: nowrap;
 
                .text_2 {
                    margin-left: 33rpx;
                }
            }
 
            .group_3 {
                padding: 0 70rpx;
                color: rgb(102, 102, 102);
                font-size: 24rpx;
                line-height: 28rpx;
 
                .text_3 {
                    margin-top: 12rpx;
                    flex: 1 1 auto;
                    text-align: left;
                }
            }
        }
 
        .section_2 {
            margin-top: 20rpx;
            padding: 32rpx 18rpx 32rpx 20rpx;
            background-color: rgb(255, 255, 255);
            box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.06);
            border-radius: 12rpx;
 
            .group_4 {
                margin-left: 26rpx;
                margin-bottom: 4rpx;
                flex: 1 1 auto;
 
                .text_4 {
                    color: rgb(51, 51, 51);
                    font-size: 30rpx;
                    line-height: 35rpx;
                    word-break: break-all;
                    text-overflow: ellipsis;
                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                    -webkit-line-clamp: 2;
                    overflow: hidden;
                }
 
                .text_5 {
                    margin-left: 7rpx;
                    margin-top: 43rpx;
                    color: rgb(246, 21, 21);
                    font-size: 36rpx;
                    line-height: 43rpx;
                    white-space: nowrap;
                }
            }
 
            .group_4_text {
                flex: 1 1 auto;
                display: flex;
                justify-content: space-between;
 
                .text_4 {
                    color: rgb(51, 51, 51);
                    font-size: 30rpx;
                    line-height: 35rpx;
                }
 
                .text_5 {
                    color: rgb(246, 21, 21);
                    font-size: 36rpx;
                    line-height: 43rpx;
                    white-space: nowrap;
                }
            }
        }
 
        .section_3 {
            margin-top: 20rpx;
            background-color: rgb(255, 255, 255);
            box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.06);
            border-radius: 12rpx;
 
            .group_5 {
                padding: 33rpx 24rpx 31rpx 20rpx;
                font-weight: bold;
 
                .text_6 {
                    color: rgb(33, 33, 33);
                    font-size: 30rpx;
                    line-height: 36rpx;
                    white-space: nowrap;
                }
 
                .text_7 {
                    color: rgb(255, 12, 12);
                    font-size: 30rpx;
                    line-height: 36rpx;
                    white-space: nowrap;
                }
            }
 
            .group_6 {
                padding: 28rpx 20rpx 24rpx 30rpx;
                border-top: solid 2rpx rgb(245, 245, 245);
                border-bottom: solid 2rpx rgb(245, 245, 245);
 
                .group_7 {
                    margin: 7rpx 0 6rpx;
 
                    .text_8 {
                        color: rgb(102, 102, 102);
                        font-size: 28rpx;
                        line-height: 34rpx;
                        white-space: nowrap;
                    }
 
                    .text_9 {
                        margin-left: 34rpx;
                        color: rgb(33, 33, 33);
                        font-size: 28rpx;
                        line-height: 34rpx;
                        white-space: nowrap;
                    }
                }
 
                .text-wrapper {
                    padding: 11rpx 0 9rpx;
                    color: rgb(51, 51, 51);
                    font-size: 24rpx;
                    line-height: 29rpx;
                    white-space: nowrap;
                    border-radius: 24rpx;
                    background-image: url('/static/local/7aa0b96b5999998caaeda4fd65173f6f.png');
                    background-size: 100% 100%;
                    background-repeat: no-repeat;
                    width: 118rpx;
                    height: 48rpx;
                }
            }
 
            .group_8 {
                padding: 32rpx 30rpx 32rpx;
                border-bottom: solid 2rpx rgb(245, 245, 245);
 
                .text_11 {
                    color: rgb(102, 102, 102);
                    font-size: 28rpx;
                    line-height: 34rpx;
                    white-space: nowrap;
                }
 
                .group_9 {
                    margin-left: 34rpx;
                    color: rgb(33, 33, 33);
                    font-size: 28rpx;
                    line-height: 34rpx;
                    white-space: nowrap;
                    width: 280rpx;
                    position: relative;
 
                    .text_13 {
                        position: absolute;
                        right: 0;
                        top: 0;
                    }
                }
            }
 
            .group_10 {
                padding: 34rpx 30rpx 30rpx;
 
                .text_14 {
                    color: rgb(102, 102, 102);
                    font-size: 28rpx;
                    line-height: 34rpx;
                    white-space: nowrap;
                }
 
                .text_15 {
                    margin-left: 34rpx;
                    color: rgb(33, 33, 33);
                    font-size: 28rpx;
                    line-height: 34rpx;
                    white-space: nowrap;
                }
            }
        }
    }
</style>