-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproductShare.html
124 lines (123 loc) · 6.68 KB
/
productShare.html
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
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"><title>产品详情</title><link rel="stylesheet" href="./css/reset.css"><link rel="stylesheet" href="./static/css/swiper-4.2.6.min.css"><link rel="stylesheet" href="./css/productInfo.css"><style>body,html{height:100%}</style><script>var _PageHeight=document.documentElement.clientHeight,_PageWidth=document.documentElement.clientWidth,_LoadingTop=61<_PageHeight?(_PageHeight-61)/2:0,_LoadingLeft=215<_PageWidth?(_PageWidth-215)/2:0,_LoadingHtml='<div id="loadingDiv" style="position:absolute;left:0;width:100%;height:'+_PageHeight+'px;top:0;background:url(./img/loading2.gif) no-repeat center center;background-size:0.4rem 0.5rem;opacity:100;filter:alpha(opacity=100) ;z-index:10000;"></div>';function completeLoading(){if("complete"==document.readyState){var e=document.getElementById("loadingDiv");e.parentNode.removeChild(e),$("#loadingDiv").remove(),$("#main").css({opacity:100,filter:"alpha(opacity=100)"})}}document.write(_LoadingHtml),document.onreadystatechange=completeLoading</script></head><body><section id="main" style="position:relative;opacity:0"><div class="banner"></div><div class="goods"><div class="goodsPrice"><span class="icon">券后价</span>¥<span class="price"></span><span class="itemPrice"></span></div><div class="goodsName"></div><div class="goodsState borderB5"><div class="quantity"></div><div class="tip"></div></div><div class="header2"><div class="wrap"><img src="./img/logo.png" alt=""><div class="text"><span class="red">返利超人</span> <span>省钱又赚钱,更多优惠券等你发现</span></div></div><a id="dlApp" class="dlApp" href="#">下载APP</a></div><div class="footer2"><a class="dlApp" id="coupon" href="#">领五元券</a></div></div></section><script src="./js/rem.js"></script><script src="./js/zepto.js"></script><script src="./js/fastclick.js"></script><script src="./static/js/swiper-4.2.6.min.js" charset="utf-8"></script><script src="https://static.lkme.cc/linkedme.min.js"></script><script>window.onload = function() {
FastClick.attach(document.body);
//获取Url地址中userId参数
function getUrlParams(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); //定义正则表达式
var r = window.location.search.substr(1).match(reg);
if(r != null) return unescape(r[2]);
return null;
};
var channel = getUrlParams("channel"); //深度链接渠道
var invitation = getUrlParams("invitation"); //邀请码
var pageName = getUrlParams("pageName");
var userID = getUrlParams("userId"),
itemId = getUrlParams("itemId"),
coupon = getUrlParams("coupon"),
commission = getUrlParams("commission"),
itemUrl = getUrlParams("itemUrl"),
tmall = getUrlParams("tmall"),
nativeUrl = getUrlParams("nativeUrl"),
pageName = getUrlParams("pageName");
$.ajax({
url: ajaxUrl + "/get/tao/product/",
type: "GET",
dataType: "json", //指定服务器返回的数据类型
data: {
itemId: itemId,
userId: userID
},
success: function(data) {
var data = data.data;
console.log(data);
var bannerImg = data.itemPicUrl.split(","),
name = data.name,
itemPrice = parseFloat(data.itemPrice),
//commission = data.commission,
itemPicUrl = data.itemPicUrl,
//coupon = parseFloat(data.coupon),
sales = data.sales;
//tmall = data.tmall;
if(pageName == "newWebView") {
nativeUrl = data.nativeUrl;
itemUrl = data.itemUrl;
};
//渲染banenr图
$('.banner').css("background-image",`url(${bannerImg})`);
//领券
$("#coupon").html("领" + coupon + "元券");
//佣金
$(".tip").html("购买后返" + commission+ "元");
//价格
$(".price").html((itemPrice - coupon).toFixed(2));
if(tmall == 0) {
//淘宝原价
$(".itemPrice").html("淘宝价:¥<span style='text-decoration:line-through;'>" + itemPrice + "</span>");
//名称
$(".goodsName").html(`
<img src="./img/type_taobaol_icon.png" alt="" />${name}
`);
} else {
//天猫原价
$(".itemPrice").html("天猫价:¥<span style='text-decoration:line-through;'>" + itemPrice + "</span>");
//名称
$(".goodsName").html(`
<img src="./img/type_tmall_icon.png" alt="" />${name}
`);
}
//销量
$(".quantity").html("已售 " + sales);
linkedME()
},
error:function(error){
console.log(error);
}
});
function linkedME() {
linkedme.init("67aadce5ce66282a36433f6e352825cb", {
type: "live"
}, null);
var data = {};
data.type = "live"; //表示现在使用线上模式,如果填写"test", 表示测试模式.【可选】
data.feature = "功能名称"; // 自定义深度链接功能,多个用逗号分隔,【可选】
data.stage = "阶段名称"; // 自定义深度链接阶段,多个用逗号分隔,【可选】
data.channel = "渠道链接"; // 自定义深度链接渠道,多个用逗号分隔,【可选】
data.tags = "3"; // 自定义深度链接标签,多个用逗号分隔,【可选】
data.ios_custom_url = ""; // 自定义iOS平台下App的下载地址,如果是AppStore的下载地址可以不用填写,需填写http或https【可选】
data.ios_direct_open = ""; //未安装情况下,设置为true为直接打开ios_custom_url,默认为false【可选】
data.android_custom_url = ""; // 自定义安卓平台下App的下载地址,需填写http或https【可选】
data.android_direct_open = ""; //设置为true,所有情况下跳转android_custom_url,默认为false【可选】
var params = {
channel: channel,
invitation: invitation,
pageName: pageName,
itemId: itemId,
userId: userID,
coupon: coupon,
commission: commission,
itemUrl: itemUrl,
nativeUrl: nativeUrl,
tmall: tmall
};
data.params = JSON.stringify(params); //注意单引号和双引号的位置
linkedme.link(data, function(err, response) {
if(err) {
// 生成深度链接失败,返回错误对象err
} else {
/**
* 立即领取
*/
console.log("传递参数", data.params);
$(".dlApp").attr("href", response.url);
}
}, false);
}
/**
* 获取Url地址中userId参数 userID
*/
function getUrlParams(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); //定义正则表达式
var r = window.location.search.substr(1).match(reg);
if(r != null) return unescape(r[2]);
return null;
};
}</script></body></html>