|
@@ -5,21 +5,36 @@ import utils from './utils'; |
|
@@ -5,21 +5,36 @@ import utils from './utils'; |
5
|
import cookies from './cookies';
|
5
|
import cookies from './cookies';
|
6
|
|
6
|
|
7
|
let abTestFlag = false; // ab测试
|
7
|
let abTestFlag = false; // ab测试
|
|
|
8
|
+let getPname = function () {
|
|
|
9
|
+ let pName = '';
|
|
|
10
|
+
|
|
|
11
|
+ if (utils.isMobile.iOS()) {
|
|
|
12
|
+ pName = 'iFP_SalesPromotion_h5';
|
|
|
13
|
+ }
|
|
|
14
|
+
|
|
|
15
|
+ if (utils.isMobile.Android()) {
|
|
|
16
|
+ pName = 'aFP_SalesPromotion_h5';
|
|
|
17
|
+ }
|
|
|
18
|
+
|
|
|
19
|
+ return pName;
|
|
|
20
|
+};
|
|
|
21
|
+
|
8
|
let _replaceData = function(el, cond, data, wh, fp) {
|
22
|
let _replaceData = function(el, cond, data, wh, fp) {
|
9
|
if (!data) {
|
23
|
if (!data) {
|
10
|
return;
|
24
|
return;
|
11
|
}
|
25
|
}
|
12
|
|
26
|
|
13
|
el.find('.brand-name').html(data.brand_name);
|
27
|
el.find('.brand-name').html(data.brand_name);
|
14
|
- el.find('.product-detail').attr('href', `//m.yohobuy.com/product/${data.product_skn}.html?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${data.product_skn}}}`);
|
28
|
+ el.find('.product-detail').attr('href', `//m.yohobuy.com/product/${data.product_skn}.html?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${data.product_skn},"from_page_name":"${getPname()}","from_page_param":"${location.href.split('?')[0]}"}}`);
|
15
|
el.find('.product-detail-img').attr('src', utils.image(data.default_images, wh.w, wh.h, 2, 75));
|
29
|
el.find('.product-detail-img').attr('src', utils.image(data.default_images, wh.w, wh.h, 2, 75));
|
16
|
el.find('.product-name').html(data.product_name);
|
30
|
el.find('.product-name').html(data.product_name);
|
17
|
el.find('.vip-price-val').html(`¥${data.vip_price}`);
|
31
|
el.find('.vip-price-val').html(`¥${data.vip_price}`);
|
18
|
el.find('.sale-price').html(`¥${data.sales_price}`);
|
32
|
el.find('.sale-price').html(`¥${data.sales_price}`);
|
|
|
33
|
+ el.data('skn', data.product_skn);
|
19
|
if (data.sales_price === data.market_price) {
|
34
|
if (data.sales_price === data.market_price) {
|
20
|
el.find('.market-price').hide();
|
35
|
el.find('.market-price').hide();
|
21
|
} else {
|
36
|
} else {
|
22
|
- el.find('.market-price').html(`¥${data.market_price}`).show();
|
37
|
+ el.find('.market-price').html(`¥${data.market_price}`).show();
|
23
|
}
|
38
|
}
|
24
|
|
39
|
|
25
|
let brandDom = el.find('.product-brand');
|
40
|
let brandDom = el.find('.product-brand');
|
|
@@ -41,7 +56,7 @@ let _replaceData = function(el, cond, data, wh, fp) { |
|
@@ -41,7 +56,7 @@ let _replaceData = function(el, cond, data, wh, fp) { |
41
|
fp.I_INDEX++;
|
56
|
fp.I_INDEX++;
|
42
|
brandDom.attr('fp', JSON.stringify(fp));
|
57
|
brandDom.attr('fp', JSON.stringify(fp));
|
43
|
}
|
58
|
}
|
44
|
- }
|
59
|
+ }
|
45
|
|
60
|
|
46
|
let listDom = el.find('.list-product');
|
61
|
let listDom = el.find('.list-product');
|
47
|
if (listDom) {
|
62
|
if (listDom) {
|
|
@@ -159,7 +174,7 @@ let _jsonp = function(el, param, cond){ |
|
@@ -159,7 +174,7 @@ let _jsonp = function(el, param, cond){ |
159
|
}
|
174
|
}
|
160
|
|
175
|
|
161
|
let $newGoods = el.find('.feature-product-info');
|
176
|
let $newGoods = el.find('.feature-product-info');
|
162
|
-
|
177
|
+
|
163
|
$newGoods.each(function(indx, perProduct) {
|
178
|
$newGoods.each(function(indx, perProduct) {
|
164
|
let $perProduct = $(perProduct);
|
179
|
let $perProduct = $(perProduct);
|
165
|
_replaceData($perProduct, cond, _getProductData(res), wh, fp);
|
180
|
_replaceData($perProduct, cond, _getProductData(res), wh, fp);
|
|
@@ -243,8 +258,8 @@ let _getProduct = function(param) { |
|
@@ -243,8 +258,8 @@ let _getProduct = function(param) { |
243
|
let yh_channel = utils.queryString().yh_channel;
|
258
|
let yh_channel = utils.queryString().yh_channel;
|
244
|
if (cond.abtest) {
|
259
|
if (cond.abtest) {
|
245
|
abTestFlag = true;
|
260
|
abTestFlag = true;
|
246
|
- }
|
|
|
247
|
-
|
261
|
+ }
|
|
|
262
|
+
|
248
|
if (yh_channel) {
|
263
|
if (yh_channel) {
|
249
|
cond.yh_channel = yh_channel;
|
264
|
cond.yh_channel = yh_channel;
|
250
|
}
|
265
|
}
|
|
@@ -288,4 +303,4 @@ export default { |
|
@@ -288,4 +303,4 @@ export default { |
288
|
});
|
303
|
});
|
289
|
}
|
304
|
}
|
290
|
}
|
305
|
}
|
291
|
-}; |
|
|
|
|
306
|
+}; |