...
|
...
|
@@ -4,6 +4,7 @@ const Swiper = require('yoho-swiper'); |
|
|
const yoho = require('../yoho-app');
|
|
|
const qs = require('yoho-qs');
|
|
|
const cookie = require('yoho-cookie');
|
|
|
const shopTmpl = require('activity/feature/shop-group.hbs');
|
|
|
|
|
|
global.jQuery = $;
|
|
|
|
...
|
...
|
@@ -260,6 +261,46 @@ function persenalCouponInit() { |
|
|
});
|
|
|
}
|
|
|
|
|
|
function shopGroupInit() {
|
|
|
$('.shop-individuation').each(function() {
|
|
|
const $this = $(this);
|
|
|
const config = $this.data('config');
|
|
|
|
|
|
config.activity_id = $('.feature-page').data('id');
|
|
|
|
|
|
if (yoho.isApp) {
|
|
|
config.app = {
|
|
|
uid: cookie.get('app_uid') || qs.uid,
|
|
|
app_version: cookie.get('app_version') || qs.app_version,
|
|
|
client_type: cookie.get('app_client_type') || qs.client_type,
|
|
|
session_key: cookie.get('app_session_key') || qs.session_key
|
|
|
};
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
url: '//m.yohobuy.com/activity/individuation/shop',
|
|
|
data: config,
|
|
|
dataType: 'jsonp'
|
|
|
}).then(res => {
|
|
|
if (res && res.data && res.data.length) {
|
|
|
config.renderData = res.data;
|
|
|
|
|
|
config.renderData.forEach(shop => {
|
|
|
if (config.jump2Shop === '0' && config.linkParams) {
|
|
|
shop.href = config.linkParams.replace(/\$shop_id/gi, shop.shops_id);
|
|
|
} else {
|
|
|
shop.href = `//m.yohobuy.com/product/shop?domain=${shop.shop_domain}&openby:yohobuy={"action":"go.shop","params":{"shop_id":${shop.shops_id},"shop_template_type":${shop.shop_template_type || "1"},"is_red_shop":${shop.is_red_shop || 1}}}`; // eslint-disable-line
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$this.replaceWith(shopTmpl(config));
|
|
|
} else {
|
|
|
$this.remove();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$(function() {
|
|
|
if ($('.over').length) {
|
|
|
// 过期/删除 状态的 活动
|
...
|
...
|
@@ -309,6 +350,9 @@ $(function() { |
|
|
// 个性化券查询
|
|
|
persenalCouponInit();
|
|
|
|
|
|
// 个性化店铺组
|
|
|
shopGroupInit();
|
|
|
|
|
|
// 小程序相关处理
|
|
|
if (window.__wxjs_environment === 'miniprogram') {
|
|
|
require('./miniprogram');
|
...
|
...
|
|