Commit 752ba09b by 施宇

111

parent 1c2aa189
...@@ -26,6 +26,15 @@ ...@@ -26,6 +26,15 @@
height: 20px; height: 20px;
line-height: 20px; line-height: 20px;
} }
.sample .fx_text {
color: #999;
}
.sample .fx_text div {
padding: 0 15px 10px;
}
.sample .fx_text span {
color: #ffa200;
}
.sample .nav { .sample .nav {
padding: 0 15px ; padding: 0 15px ;
} }
......
...@@ -11,6 +11,15 @@ ...@@ -11,6 +11,15 @@
span{color:#333;font-size: 16px;} span{color:#333;font-size: 16px;}
font{font-size: 12px;color:#999;margin-left: 10px;height:20px;line-height: 20px;} font{font-size: 12px;color:#999;margin-left: 10px;height:20px;line-height: 20px;}
} }
.fx_text{
color:#999;
div{
padding:0 15px 10px;
}
span{
color:#ffa200
}
}
.nav{ .nav{
padding:0 15px ; padding:0 15px ;
.van-hairline--top-bottom::after { .van-hairline--top-bottom::after {
......
...@@ -7,6 +7,21 @@ ...@@ -7,6 +7,21 @@
<span>猎芯自营</span> <span>猎芯自营</span>
<font>品现货 1片起订 3小时发货</font> <font>品现货 1片起订 3小时发货</font>
</div> </div>
<div class="fx_text" v-if="fxType">
<!-- 邀请记录不为0 -->
<div class="fx_text_one" v-if="fxType == 1">
我已邀请好友
<span>{{inviteCount}}</span> 人,剩余领取次数
<span>{{applyCount}}</span>
</div>
<!-- 邀请记录为0 -->
<div class="fx_text_two" v-else-if="fxType == 2">
当前可领取次数为:
<span>{{applyCount}}</span> 次,分享可额外获得领取机会
</div>
<!-- 未登入 -->
<div class="fx_text_three" v-else>分享可额外获得领取机会</div>
</div>
<div class="nav" v-if="classList.length"> <div class="nav" v-if="classList.length">
<van-tabs <van-tabs
v-model="active" v-model="active"
...@@ -96,8 +111,11 @@ export default { ...@@ -96,8 +111,11 @@ export default {
active: 0, active: 0,
getPop: false, //获得机会弹窗,没机会时展示 getPop: false, //获得机会弹窗,没机会时展示
loadingYp: false, loadingYp: false,
applyCount: 0,
inviteCount: 0,
p: 1, p: 1,
classId: "", classId: "",
fxType: 0,
shareUrl: shareUrl:
window.location.origin + window.location.origin +
"/v3/samplereg?uid=" + "/v3/samplereg?uid=" +
...@@ -117,7 +135,7 @@ export default { ...@@ -117,7 +135,7 @@ export default {
this.loadingYp = now; this.loadingYp = now;
}, },
classList(now) { classList(now) {
if(now.length){ if (now.length) {
this.p = 1; this.p = 1;
this.classId = now[0].id; this.classId = now[0].id;
this.getGoodList(); this.getGoodList();
...@@ -128,8 +146,16 @@ export default { ...@@ -128,8 +146,16 @@ export default {
this.$store.dispatch({ this.$store.dispatch({
type: "getClasslist" type: "getClasslist"
}); });
this.judgeLogin();
}, },
methods: { methods: {
judgeLogin() {
if (getCookie("Yo4teW_uid")) {
this.getCount();
} else {
this.fxType = 3;
}
},
getGoodList() { getGoodList() {
this.$store.dispatch({ this.$store.dispatch({
type: "getGoodList", type: "getGoodList",
...@@ -151,48 +177,41 @@ export default { ...@@ -151,48 +177,41 @@ export default {
getuserf() { getuserf() {
this.getPop = false; this.getPop = false;
}, },
getCount() {
let me = this;
Services.getUserSampleInfo()
.then(res => {
let data = res.data;
if (data.err_code == 0) {
me.applyCount = data.data.apply_count || 0;
me.inviteCount = data.data.invite_count || 0;
if (me.inviteCount == 0) {
me.fxType = 2;
} else {
me.fxType = 1;
}
} else if (data.err_code == "11012") {
window.location.href =
"/v3/login?referer=" + encodeURIComponent(window.location.href);
}
})
.catch(function(err) {});
},
yaoqing(id) { yaoqing(id) {
let loginpta = util.isLogin() ? true : false; let loginpta = util.isLogin() ? true : false;
let me = this;
if (!loginpta) { if (!loginpta) {
window.location.href = window.location.href =
"/v3/login?referer=" + encodeURIComponent(window.location.href); "/v3/login?referer=" + encodeURIComponent(window.location.href);
return; return;
} else { } else {
const toast = Toast({ if (this.applyCount) {
type: "loading", me.$router.push({
message: "领取中", path: "/sampleapply",
forbidClick: true, query: {
duration: 0 id: id
});
Services.getUserSampleInfo()
.then(res => {
toast.clear();
let data = res.data;
if (data.err_code == 0) {
if (data.data.apply_count != 0) {
me.$router.push({
path: "/sampleapply",
query: {
id: id
}
});
} else {
me.getPop = true;
}
} else if(data.err_code == '11012'){
Toast.fail("登录已超时,请重新登录");
window.location.href =
"/v3/login?referer=" + encodeURIComponent(window.location.href);
}else{
Toast.fail("领取失败");
} }
})
.catch(function(err) {
toast.clear();
Toast.fail("领取失败");
}); });
}
} }
} }
}, },
...@@ -205,5 +224,5 @@ export default { ...@@ -205,5 +224,5 @@ export default {
</script> </script>
<style scoped> <style scoped>
@import "../../assets/css/sample/sample.min.css"; @import "../../assets/css/sample/sample.css";
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment