logistics.vue
4.11 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
<template>
<div class="logistics-page">
<!-- 导航栏 -->
<div class="nav"
:style="{'paddingTop': top.value + 'px'}">
<!-- navBar -->
<nav-bar v-if="!isWeChat.value"
@back="back"
:navs="navs">
</nav-bar>
</div>
<div class="pl"
:class="{'is-cnlive': isCNLive2.value, 'not-is-wechat': !isWeChat.value, 'not-is-cnlive': !isCNLive2.value, 'is-open-app': isOpenApp.value}"
:style="{'paddingTop': top.value + 'px'}"></div>
<!-- 主区域 -->
<div class="main-box">
<!-- 物流单号信息 -->
<logistics-bar :logistics="datas">
</logistics-bar>
<!-- 物流详细信息列表 -->
<logistics-list-com :logistics="datas">
</logistics-list-com>
</div>
</div>
</template>
<script>
// 引入组件
import navBar from '@/components/navBar/navBar';
import logisticsBar from '@/components/logisticsBar/logisticsBar';
import logisticsListCom from '@/components/logisticsListCom/logisticsListCom';
export default {
name: 'logisticsPage',
data () {
return {
title: "",
query: {},
navs: null, // navBar配置参数
datas: null // 数据
}
},
components: {
navBar,
logisticsBar,
logisticsListCom
},
created (options) {
// 设置标题
this.$set(this, 'title', '物流详情');
// 设置地址栏请求参数
this.$set(this, "query", options);
this.$set(this, "navs", {
back: {
img: "static/img/icon_back.png"
},
title: this.title
});
// 活动物流查询
this.luckDrawExpress();
// #ifdef H5 || APP-PLUS
// 更新页面title
this.$emit("updateHead");
// #endif
},
// #endif
methods: {
/**
* 活动物流查询
*/
luckDrawExpress () {
// 必要参数
if (this.query.orderId && this.query.orderId != '0' && this.query.orderId != '000') {
// 显示loading
uni.showLoading({
title: "",
mask: true
});
// 请求接口
this.http("/Api/" + (this.getApiVersion().luckdraw) + "/luckDrawExpress", {
id: this.query.orderId
}, this.luckDrawExpressCallback, {
method: "POST"
});
} else {
// 订单号错误提示
this.showToast('订单号错误~');
// 定时返回
setTimeout(() => {
// 后退
this.back();
}, 2000);
}
},
/**
* 活动物流查询回调
* @param {Object} res [服务器返回数据]
* @param {Object} res [扩展参数]
*/
luckDrawExpressCallback (res, ext) {
// 隐藏loading
uni.hideLoading();
// 返回处理
if (res.statusCode === 200 && res.data.code == 200) {
// 解构数据
let { data: datas } = res.data;
// 设置参数
this.$set(this, 'datas', datas);
} else if (res.statusCode === 200 && res.data.code == 400) {
// 获取地址列表出错
this.showToast(res.data.message);
// 定时返回
setTimeout(() => {
// 后退
this.back();
}, 2000);
} else {
// 获取地址列表出错
this.showToast("获取物流详情出错");
// 定时返回
setTimeout(() => {
// 后退
this.back();
}, 2000);
}
},
/**
* 返回
*/
back () {
// 判断是否有返回函数
if (typeof this.helper.$Apps2 === 'object' && typeof this.helper.$Apps2.back === 'function') {
// 调用返回
this.helper.$Apps2.back();
} else {
// 后退
uni.navigateBack({
delta: 1
});
}
}
},
head: {
title () {
return {
inner: this.title
}
}
},
watch: {
/**
* 设置页面标题
* @param {Object} newVal [标题新值]
*/
title (newVal) {
/* 设置页面标题 开始 */
this.setTitle(newVal);
/* 设置页面标题 结束 */
}
}
}
</script>
<style rel="stylesheet/less" lang="less">
@import './logistics';
</style>