cart-stat.js 696 Bytes
/**
 * Created by yoho on 2017-01-13.
 */

var $ = require('yoho-jquery');

function pyStat() {

    var money = $('.cartnew-sum .num strong').text();
    var items = [];

    $('#Y_CartListWrap li[data-role=pitem]').each(function() {
        var $t = $(this);

        if ($t.data('id')) {
            items.push({
                id: $t.data('skn'),
                count: $t.data('productnum'),
                price: $t.find('.product-price p.product-price').text()
            });
        }
    });

    window.py && window.py('event', 'viewCart', {
        money: money,
        items: items
    }).track('MC.Ok.7NFMIlCH_F_LE2riRlF2r_');
}

$(function() {
    setTimeout(pyStat, 3000);
});