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
<template>
<div class="ybPaySuccess">
<div class="h2">
<img :src="icon_yes" alt /> 恭喜您,成功抢购课程!
</div>
<div class="top">
<img class="qr" :src="imgguide" alt />
<img v-if="userCourse.teacher_qr" class="qrcode" :src="userCourse.teacher_qr" />
</div>
<!-- <img class='logo' :src="logo" alt=""> -->
</div>
</template>
<script>
import icon_yes from "../../assets/yb/icon_yes@2x.png";
import imgguide from "../../assets/shop/imgguide@2x.png";
import logo from "../../assets/yb/logo@2x.png";
import {
getCourseInfoApi,
getwechatParam,
getUserDetailApi,
getGoodsDetailApi
} from "../../service/api";
export default {
name: "guide",
components: {},
data() {
return {
icon_yes: icon_yes,
logo: logo,
groupDetail: {},
userCourse: {},
imgguide: imgguide
};
},
mounted() {
this.initPage();
},
methods: {
initPage() {
if (window.location.href.indexOf("invite_code") > -1) {
this.invite_code = this.$route.query.invite_code;
}
this.userCourse = JSON.parse(localStorage.getItem("userCourse"));
console.log(this.userCourse);
this.user_id = JSON.parse(localStorage.getItem("userDesc")).user_id;
this.shopId = this.$route.query.shopId;
getGoodsDetailApi(this.shopId).then(data=>{
// debugger
data.desc = JSON.parse(data.desc);
data.goods_desc = JSON.parse(data.goods_desc);
data.share_desc = JSON.parse(data.share_desc);
this.groupDetail = data;
this.invite_code = this.$route.query.invite_code;
if(this.type && this.type === 0){
this.price=data.single_price/100
}else{
this.price = data.group_price/100
}
this.$nextTick(()=>{
this.orderFlag = true
})
this.onShare();
});
let invite = this.invite_code;
getUserDetailApi().then(res => {
this.userDesc = Object.assign({}, res);
// console.log(this.userDesc)
this.subscribe = this.userDesc.open_info.is_subscribe;
localStorage.setItem("userDesc", JSON.stringify(res));
}).catch(res => {
if (localStorage.getItem("userDesc")) {
}
});
},
handleInviteCode() {
if (!this.invite_code) {
this.this_code = "CC-USER-" + this.user_id;
} else {
let invite_code = this.invite_code.split("-");
if (
invite_code.length > 2 &&
(invite_code[1] === "TEACHER" || invite_code[1] === "XXMM")
) {
invite_code[1] = "USER";
}
let code = `${invite_code[0]}-${invite_code[1]}`;
this.this_code = `${code}-${this.user_id}`;
}
},
onShare: function(type) {
this.handleInviteCode();
let URL = `${process.env.BUY_URL}shopId=${this.shopId}&invite_code=${this.this_code}`;
console.log(this.groupDetail.share_desc)
this.enableShare({
product_title: this.groupDetail.share_desc.title,
desc: this.groupDetail.share_desc.content,
shareIcon: this.groupDetail.share_desc.img.length !== 0 ? this.groupDetail.share_desc.img[0].url : '',
shareUrl: URL
});
},
enableShare: function(option) {
let that = this;
getwechatParam({
api_list: "onMenuShareAppMessage,onMenuShareTimeline",
url: window.location.href.split("#")[0]
}).then(wechatRes => {
wx.config({
debug: false,
appId: wechatRes.appId,
timestamp: parseInt(wechatRes.timestamp),
nonceStr: wechatRes.nonceStr,
signature: wechatRes.signature,
jsApiList: wechatRes.jsApiList
});
wx.ready(function() {
wx.onMenuShareTimeline({
title: option.product_title, // 分享标题
desc: option.desc, // 分享描述
link: option.shareUrl, // 分享链接
imgUrl:
option.shareIcon ||
"https://cdn.singsingenglish.com/singsing/recommend/logo-refer.png", // 分享图标
success: function() {
console.log("分享成功");
},
cancel: function() {
// alert("失败")
console.log("分享失败");
}
});
wx.onMenuShareAppMessage({
title: option.product_title, // 分享标题
desc: option.desc, // 分享描述
link: option.shareUrl, // 分享链接
imgUrl:
option.shareIcon ||
"https://cdn.singsingenglish.com/singsing/recommend/logo-refer.png", // 分享图标
success: function() {},
cancel: function() {}
});
});
});
}
}
};
</script>
<style scoped lang="less">
@import "../../util/public";
.ybPaySuccess {
background: #ffffff;
text-align: center;
border-top: 1px solid transparent;
.top {
margin: 35 * @toVw auto;
width: 326 * @toVw;
// background: #FFEAAD;
border-radius: 24 * @toVw;
position: relative;
img {
max-width: 100%;
}
.qr {
// position: absolute;
// left: 25 * @toVw;
width: 326 * @toVw;
// top: 31*@toVw;
border-radius: 10 * @toVw;
}
.qrcode {
position: absolute;
top: 110 * @toVw;
left: 68 * @toVw;
width: 189 * @toVw;
z-index: 1;
}
p {
position: absolute;
top: 270 * @toVw;
width: 100%;
text-align: center;
color: #6f5c25;
font-weight: bold;
font-size: 17 * @toVw;
}
}
.h2 {
font-size: 17 * @toVw;
font-weight: bold;
text-align: center;
margin-top: 30 * @toVw;
img {
width: 24 * @toVw;
position: relative;
top: 2 * @toVw;
}
}
.logo {
position: fixed;
left: 130 * @toVw;
bottom: 20 * @toVw;
width: 125 * @toVw;
}
}
@media screen and (orientation: landscape) {
}
</style>