MyOrder.vue
7.9 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
<template>
<div class="myorder">
<cube-page type="myorder-view" title="我的订单">
<div slot="content">
<van-tabs v-model="active " class="tab-margin" :color="gcfg.BackgroundColor" @change="OnChange">
<van-tab title="全部订单">
<div class="oneorder" v-for="(item, idx) in OrderList" :key="idx">
<van-cell-group
<van-cell :title="'订单编号:'+item.order_no">
<van-tag slot="right-icon" :type="item.showType">{{item.showText}}</van-tag>
</van-cell>
<van-cell is-link :to="'./myorder/detail?id='+item.id">
<div slot="title" class='tile_sp'>
<span v-for="(goodsitem, key) in item.goods" :key="key">
{{goodsitem.goods_name}} * {{goodsitem.total_num}} </br>
</span>
</div>
</van-cell>
<van-cell :title="'合计:¥'+item.pay_price+' 数量: '+item.goods.length" :label="item.creattime_text">
<div slot="right-icon">
<van-button size="small" class="bt-zs" :to="'./myorder/detail?id='+item.id">订单详情</van-button>
</div>
</van-cell>
</van-cell-group>
</div>
</van-tab>
<van-tab title="未付款">
<div class="oneorder" v-for="(item, idx) in OrderList" :key="idx" v-if="item.showType=='danger'">
<van-cell-group>
<van-cell :title="'订单编号:'+item.order_no">
<van-tag slot="right-icon" :type="item.showType">{{item.showText}}</van-tag>
</van-cell>
<van-cell is-link :to="'./myorder/detail?id='+item.id">
<div slot="title" class='tile_sp'>
<span v-for="(goodsitem, key) in item.goods" :key="key">
{{goodsitem.goods_name}} * {{goodsitem.total_num}} </br>
</span>
</div>
</van-cell>
<van-cell :title="'合计:¥'+item.pay_price+' 数量: '+item.goods.length" :label="item.creattime_text">
<div slot="right-icon">
<van-button size="small" class="bt-zs" :to="'./myorder/detail?id='+item.id">订单详情</van-button>
</div>
</van-cell>
</van-cell-group>
</div>
</van-tab>
<van-tab title="待发货">
<div class="oneorder" v-for="(item, idx) in OrderList" :key="idx" v-if="item.showType=='success'">
<van-cell-group
<van-cell :title="'订单编号:'+item.order_no">
<van-tag slot="right-icon" :type="item.showType">{{item.showText}}</van-tag>
</van-cell>
<van-cell is-link :to="'./myorder/detail?id='+item.id">
<div slot="title" class='tile_sp'>
<span v-for="(goodsitem, key) in item.goods" :key="key">
{{goodsitem.goods_name}} * {{goodsitem.total_num}} </br>
</span>
</div>
</van-cell>
<van-cell :title="'合计:¥'+item.pay_price+' 数量: '+item.goods.length" :label="item.creattime_text">
<div slot="right-icon">
<van-button size="small" class="bt-zs" :to="'./myorder/detail?id='+item.id">订单详情</van-button>
</div>
</van-cell>
</van-cell-group>
</div>
</van-tab>
<van-tab title="待收货">
<div class="oneorder" v-for="(item, idx) in OrderList" :key="idx" v-if="item.showType=='primary'">
<van-cell-group
<van-cell :title="'订单编号:'+item.order_no">
<van-tag slot="right-icon" :type="item.showType">{{item.showText}}</van-tag>
</van-cell>
<van-cell is-link :to="'./myorder/detail?id='+item.id">
<div slot="title" class='tile_sp'>
<span v-for="(goodsitem, key) in item.goods" :key="key">
{{goodsitem.goods_name}} * {{goodsitem.total_num}} </br>
</span>
</div>
</van-cell>
<van-cell :title="'合计:¥'+item.pay_price+' 数量: '+item.goods.length" :label="item.creattime_text">
<div slot="right-icon">
<van-button size="small" class="bt-zs" :to="'./myorder/detail?id='+item.id">订单详情</van-button>
</div>
</van-cell>
</van-cell-group>
</div>
</van-tab>
</van-tabs>
<div v-if="isNoData" class="liteshop-notcont" style="margin-top:130px;">
<div class="img">
<img src="@/assets/no-data.png"/>
</div>
<span class="cont">订单空空如也</span>
</div>
</div>
</cube-page>
<cube-view></cube-view>
</div>
</template>
<script>
import CubeView from '@/components/TP/cube-view'
import CubePage from './TP/cube-page.vue'
import * as util from '@/utils/network'
export default {
components: {
CubePage,
CubeView,
},
data() {
return {
OrderList:[],
active:this.$route.query.showType,
isNoData:true,
gcfg:[]
};
},
created: function () {
this.get_my_order()
this.gcfg = this.$store.getters.getGcfg
},
watch:{
"$store.state.gcfg": function(){
this.gcfg = this.$store.getters.getGcfg
},
$route(to,from) {
console.log(to)
console.log(from)
if(to.path=='/my/myorder' && from.path=='/my/myorder/detail'){
this.get_my_order()
}
},
},
methods: {
get_my_order(){
var url = "/addons/litestore/api.order/my"
let that = this;
//这里直接调用网络接口
util.get(url,{},
function (result) {
console.log(result.data);
//这里对状态 进行分类
result.data.forEach(function(item, index, arr){
if (item.pay_status == "20" && item.freight_status == "10" && item.order_status == "10" && item.receipt_status == "10" ){
arr[index].showText="待发货";
arr[index].showType ="success";
arr[index].showactive = 2;
}
if (item.pay_status == "20" && item.freight_status == "20" && item.order_status == "10" && item.receipt_status == "10"){
arr[index].showText = "待收货";
arr[index].showType = "primary";
arr[index].showactive = 3;
}
if (item.pay_status == "10" && item.freight_status == "10" && item.order_status == "10" && item.receipt_status == "10") {
arr[index].showText = "待付款";
arr[index].showType = "danger";
arr[index].showactive = 1;
}
if (item.pay_status == "20" && item.freight_status == "20" && item.order_status == "30" && item.receipt_status == "20") {
arr[index].showText = "已完成";
arr[index].showType = "";
}
});
that.OrderList = result.data
that.check_is_noData();
},
);
},
check_is_noData(){
let that = this;
var isnodata = true;
that.OrderList.forEach(function (item, index, arr) {
if (that.active == 0) {
isnodata = false
} else {
if (item.showactive == that.active) {
isnodata = false
}
}
});
that.isNoData = isnodata
},
OnChange(){
let that = this;
that.check_is_noData();
}
}
}
</script>
<style>
.myorder{
height: 100%;
position: absolute;
width: 100%;
top: 0;
z-index: 28;
}
.myorder .cube-page >.wrapper .content {
margin: 0;
}
.myorder .bt-zs {
background-color:#6d189e!important;
color:white!important;
}
.myorder .tile_sp{
color:#999;
}
.myorder .right-padding{
margin-right: 0.6em;
}
.myorder .oneorder{
margin-top:0.3em;
box-shadow: 0 1px 2px #dfb3f8;
}
.liteshop-notcont {
margin:130px 100px;
}
.myorder .liteshop-notcont .img {
width: 180px;
height: 120px;
margin: 0 auto;
}
.myorder .liteshop-notcont .img image {
width: 100%;
height: 100%;
}
.myorder .liteshop-notcont .cont {
display: block;
text-align: center;
font-size: 16px;
color: #6d189e;
margin-top: 60px;
}
</style>