移动系统liao
2025-02-17 557c2711a3e103ebc3d0492344eca9730d5e92b2
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
<template>
    <view class="wrap">
        <u-toast ref="uToast" /><u-no-network></u-no-network>
        <u-navbar title="物流信息" safeAreaInsetTop fixed placeholder>
            <view class="coreshop-navbar-left-slot" slot="left">
                <u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
                <u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
                <u-icon name="home" size="22" @click="goHome"></u-icon>
            </view>
            <view slot="right">
            </view>
        </u-navbar>
        <view v-if="isExpress">
            <view v-for="(item, index) in express" :key="index">
                <view>
                    <view class="u-order-desc">{{ item.context }}</view>
                    <view class="u-order-time">{{ item.time }}</view>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                add: '', // 收货地址
                express: {}, // 快递物流信息
            }
        },
        onLoad(options) {
            let params = options.params
            let arr = decodeURIComponent(params).split('&')
            let code, no, mobile
            for (var i = 0; i < arr.length; i++) {
                let key = arr[i].split("=")[0]
                if (key == 'code') {
                    code = arr[i].split("=")[1]
                }
                if (key == 'no') {
                    no = arr[i].split("=")[1]
                }
                if (key == 'add') {
                    this.add = arr[i].split('=')[1]
                }
                if (key == 'mobile') {
                    mobile = arr[i].split('=')[1]
                }
            }
 
            if (!code || !no) {
                this.$refs.uToast.show({
                    message: '缺少物流查询参数', type: 'error', complete: function () {
                        uni.navigateBack({
                            delta: 1
                        });
                    }
                });
            }
            this.expressInfo(code, no, mobile)
        },
        computed: {
            isExpress() {
                return Object.keys(this.express).length ? true : false
            }
        },
        methods: {
            expressInfo(code, no, mobile) {
                let data = {
                    code: code,
                    no: no,
                    mobile: mobile,
                }
                this.$u.api.logistics(data).then(res => {
                    if (res.status) {
                        let _info = res.data.data
                        this.express = _info
                    } else {
                        this.$u.toast(res.msg)
                    }
                })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    @import "expressDelivery.scss";
</style>