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
<template>
<div>
<mt-popup
v-model="showShare"
class="refer-share"
position="top">
<img :src="shareTipsUrl">
</mt-popup>
<div class="tips" v-if="orderList.length < 1">
暂无订单
</div>
<div v-for="data in orderList" class="list">
<div class="head">
<div class="bg-img" v-if="data.goods_desc" :style="{backgroundImage: `url(${data.goods_desc.img[0].url})`}">
</div>
<div class="content">
<div class="title">{{data.goods_name}}</div>
<div v-if="data.goods_desc" class="desc">{{data.goods_desc.desc}}</div>
<div class="time">付款时间:{{data.pay_at}}</div>
</div>
</div>
<div class="footer">
<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>
<span :class="{red:data.status === 1}">{{data.status | orderType}}</span>
</div>
</div>
</div>
</template>
<script>
import {getOrderListApi,getwechatParam} from "../service/api";
import {ORDERTYPE} from "../util/wordbook";
import shareUrl from '../assets/share.png'
import Toast from 'mint-ui'
import shareTipsUrl from '../assets/Bitmap@2x.png'
export default {
name: "order",
data(){
return {
orderList:[],
showShare:false,
shareTipsUrl:shareTipsUrl,
shareUrl:shareUrl
}
},
filters:{
orderType(value){
return ORDERTYPE[value]
}
},
mounted(){
this.initPage()
},
methods:{
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.showShare = true;
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=''`;
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";
.refer-share {
width: 100%;
}
.refer-share img {
position: absolute;
width: 80%;
right: 0;
}
.tips{
padding: 20 * @toVw;
font-size: 24px;
text-align: center;
color: #888888;
}
.list{
.bg-img{
width: 160*@toVw;
margin-right: 5 * @toVw;
height: 80*@toVw;
background-size:100% 100%;
}
.head{
display: flex;
justify-content: center;
align-items: center;
line-height: 1.4em;
position: relative;
flex-flow: row nowrap;
margin-left: 10px;
margin-right: 10px;
margin-top: 12px;
padding: 12px;
border: 1px solid #ccc;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
.content{
font-size: 3.2vw;
color: #999;
.title{
font-size: 3.73333vw;
color: #666;
}
}
}
.footer{
display: 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;
}
.share{
img{
width: 16 *@toVw;
display: inline-block;
margin-right: 3 * @toVw;
vertical-align: text-bottom;
}
}
.red{
color: #f06a33;
}
}
}
</style>