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
<template>
<div>
<van-popup class="refer-share" position="top" v-model="showShare"><img :src="shareTipsUrl"></van-popup>
<!-- <div class="tips" v-if="orderList.length < 1">
暂无订单
</div> -->
<div v-if="orderList.length < 1" class="unStart">
<img :src="mok4" alt="">
<p>还没有订单哦~</p>
<div @click="goIndex">去逛逛吧</div>
</div>
<div class="listBox">
<div v-for="(data,index) in orderList" class="list">
<div class="head" >
<div @click="goDetail(index)" class="bg-img" v-if="data.goods_desc" :style="{backgroundImage: `url(${data.goods_desc.img[0].url})`}">
</div>
<div class="content">
<img @click="goDetail(index)" class="status" v-if="data.status!=0" :src="data | orderType" alt="">
<div @click="goDetail(index)" class="title">{{data.goods_name}}</div>
<div @click="goDetail(index)" v-if="data.goods_desc" class="desc">{{data.goods_desc.desc}}</div>
<div @click="goDetail(index)" class="time">付款时间:{{data.pay_at}}</div>
<div class="bottom"><span class="payMoney">实付:{{data.money/100}}元</span><span class="share" v-if="data.buy_type === 2 && data.status !== 4" @click="shareOrder(data)">
我要分享 <img :src="shareUrl"/>
</span>
<!-- <div class="pay" v-if="data.status==0">去付款</div> -->
</div>
</div>
</div>
<!-- <div class="footer">
<span :class="{red:data.status === 1}">{{}}</span>
</div> -->
</div>
</div>
</div>
</template>
<script>
import {getOrderListApi,getwechatParam} from "../service/api";
import {ORDERTYPE} from "../util/wordbook";
import {order} from "../util/imgUrl.js"
import shareUrl from '../assets/share.png'
import mok4 from '../assets/orderless.png'
import { Toast } from 'vant';
import shareTipsUrl from '../assets/Bitmap@2x.png'
export default {
name: "order",
data(){
return {
orderList:[],
showShare:false,
shareTipsUrl:shareTipsUrl,
shareUrl:shareUrl,
mok4:mok4,
shopId:'',
orderImg:order
}
},
filters:{
orderType(value){
if(value.buy_type === 2){
if(value.status == 1){
return order.orderStatus2
}else if(value.status == 4){
return order.orderStatus3
}
}else if(value.buy_type === 1 && value.status == 1){
return order.orderStatus1
}else if(value.status == 2){
return order.orderStatus4
}
// return ORDERTYPE[value]
},
// orderType(value){
// return ORDERTYPE[value]
// }
},
mounted(){
this.initPage()
},
methods:{
goDetail(index){
if(this.orderList[index].buy_type==1){
this.$router.push({
name: 'buySuccess',
query:{
out_trade_no:this.orderList[index].out_trade_no
}
});
}else{
this.$router.push({
name: 'success',
query:{
out_trade_no:this.orderList[index].out_trade_no
}
});
}
},
goIndex(){
this.$router.push({
name: "index"
});
},
initPage(){
getwechatParam({
api_list:'onMenuShareAppMessage,onMenuShareTimeline',
url:window.location.href.split('#')[0]
}).then(res=>{
wx.config({
debug: false,
appId: res.appId,
timestamp: parseInt(res.timestamp),
nonceStr: res.nonceStr,
signature: res.signature,
jsApiList: res.jsApiList
});
});
getOrderListApi({status:1}).then(res=>{
res.list.forEach(i=>{
if(i.goods_desc){
i.goods_desc= JSON.parse(i.goods_desc)
}
});
this.orderList = res.list
})
},
shareOrder(data){
this.$sa.track('buttonClick',{
tabTitle:'订单',
moduleTitle:'订单',
buttonType:'分享',
buttonName:'团购分享'
});
this.showShare = true;
let invite_code;
if(!data.invite_id || data.invite_id == '') {
invite_code = 'CC-USER-' + data.user_id;
}else if(data.invite_type === 'TEACHER'){
invite_code = `CC-USER-${data.user_id}`;
}else{
invite_code = `CC-${data.invite_type}-${data.user_id}`;
}
let shareData = JSON.parse(data.share_desc);
let that =this;
let shareUrl = `${process.env.BUY_URL}shopId=${data.goods_id}&groupId=${data.order_group_id}&invite_code=${invite_code}'`;
wx.onMenuShareAppMessage({
title: shareData.title, // 分享标题
desc: shareData.content,// 分享描述
link: shareUrl, // 分享链接
imgUrl: shareData.img[0]?shareData.img[0].url : 'https://cdn.singsingenglish.com/singsing/recommend/logo-refer.png', // 分享图标
success: function() {
Toast('分享成功');
that.showShare = false
},
});
wx.onMenuShareTimeline({
title: shareData.title, // 分享标题
desc: shareData.content,// 分享描述
link: shareUrl, // 分享链接
imgUrl: shareData.img[0]?shareData.img[0].url : 'https://cdn.singsingenglish.com/singsing/recommend/logo-refer.png', // 分享图标
success: function() {
Toast('分享成功');
that.showShare = false
},
});
}
}
}
</script>
<style scoped lang="less">
@import "../util/public";
.child-view{background: white;}
.unStart{
text-align: center;
img{width:300*@toVw; }
p{line-height: 22px;font-size: 16px;color: #666666;}
div{width:250*@toVw;height: 40*@toVw;line-height:40*@toVw;background: #40A9FF;color: white;border-radius: 20*@toVw;margin-top: 72*@toVw }
}
.refer-share {
width: 100%;overflow-y:visible;
}
.refer-share img {
position: absolute;
width: 80%;
right: 0;
z-index: 2002;
}
.tips{
padding: 20 * @toVw;
font-size: 24px;
text-align: center;
color: #888888;
}
.listBox{padding: 15*@toVw;}
.list{
box-shadow:1px 3*@toVw 8*@toVw 0px rgba(0,0,0,0.1);
border-radius:15*@toVw;
overflow: hidden;
margin-bottom: 10px;
.bg-img{
width: 108*@toVw;
height:108*@toVw ;
margin-right: 15 * @toVw;
margin-left: 0 * @toVw;
background-size:100% 100%;
}
.head{
display: flex;
display: -webkit-flex;
justify-content: center;
align-items: center;
line-height: 1.6em;
position: relative;
flex-flow: row nowrap;
// margin-right: 10px;
.content{
font-size: 12* @toVw;
color: #999;
margin-left: 0;
position: relative;
.title{
width: 160* @toVw;margin-left: 0; overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
color: #666;
font-size: 15* @toVw;
}
.desc{width: 160* @toVw;margin-left: 0; overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap}
.status{position: absolute;width:60* @toVw ;right: 0;}
.bottom{display: flex;display: -webkit-flex;justify-content: space-between;
width: 226*@toVw;
.share{
margin-right: 10 *@toVw;
img{
width: 13 *@toVw;
display: inline-block;
margin-right: 3 * @toVw;
vertical-align: text-bottom;
}
}
.payMoney{margin-left: 0;}
.pay{width: 70* @toVw;height: 28* @toVw;border:1px solid rgba(244,99,99,1);color:rgba(244,99,99,1);
text-align: center;line-height: 28* @toVw;border-radius: 14* @toVw; }
}
}
}
.footer{
display: flex;
display: -webkit-flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: center;
margin-left: 10px;
margin-right: 10px;
padding: 6px 12px;
color: #999;
font-size: 12 * @toVw;
border: 1px solid #ccc;
border-top: none;
border-bottom-left-radius: 9px;
border-bottom-right-radius: 9px;
box-shadow: 0px 2px 1px 0px rgba(0,0,0,0.1);
span{
margin: 0;
line-height: 20 * @toVw;
}
.red{
color: #f06a33;
}
}
}
</style>