installment.page.js 1008 Bytes
var $ = require('yoho-jquery'),
    ellipsis = require('yoho-mlellipsis'),
    ListData = require('./installment-goods'),
    lazyLoad = require('yoho-jquery-lazyload');

require('../common');

lazyLoad($('img.lazy'));
ellipsis.init();

new ListData({
    url: '/home/installment/get-goods',
    page: 1,
    boxArea: $('#goods-list')
});

function setDetailText() {
    var $this, $title;

    $('.good-detail-text .name').each(function() {
        $this = $(this);
        $title = $this.find('a');

        $title[0].mlellipsis(2);
    });
}

setDetailText();

$('.detail-tab span').on('click', function() {
    $(this).addClass('on').siblings().removeClass('on');
    $('.installment-cont').hide().eq($(this).index()).show();

    if ($(this).index() === 1) {
        setDetailText();
        lazyLoad($('img.lazy'));
    }
});

window.setCookie('installmentUid', window.queryString.uid);
window.setCookie('udid', window.queryString.udid);
window.setCookie('clientType', window.queryString.client_type);