Himall.Web/Areas/Mobile/Templates/APP/Scripts/orderComment.js

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

$(function () {
    checkOrderIsUncomment();
    initStarsReaction();

    $('#submit').click(function () {
        submitComment();
    });

});


function initStarsReaction() {
    $('.star-score i').click(function () {
        var i = $(this).index() + 1;
        $(this).parent().children('i').addClass('glyphicon-star').removeClass('glyphicon-star-empty');
        $(this).addClass('l').removeClass('b').nextAll('i').addClass('b').removeClass('l');
        $(this).prevAll('i').addClass('l').removeClass('b');
        $(this).siblings('input').val(i);
    });
}


function checkOrderIsUncomment() {
    var isValid = $('#isValid').val();
    if (!isValid) {
        $.dialog.tips('已经评论过该订单或订单无效!', function () {
            history.go(-1);//返回
        });
    }
}

function submitComment() {
    var commentsDiv = $('div[name="productComment"]');
    var comments = [];
    $.each(commentsDiv, function (i, comment) {
        comments.push({
            mark: $(this).find('input[name="mark"]').val(),
            content: $(this).find('[name="content"]').val(),
            orderItemId: $(this).attr('orderItemId')
        });
    });

    var orderId = QueryString('orderId');
    var comment = {
        orderId: orderId,
        serviceMark: $('#serviceMark').val(),
        deliveryMark: $('#deliveryMark').val(),
        packMark: $('#packMark').val(),
        productComments: comments
    };

    try {
        checkComments(comment);
        var loading = showLoading();
        var json = JSON.stringify(comment);
        $.post('/' + areaName + '/Comment/AddComment',
           { comment: json },
           function (result) {
               loading.close();
               if (result.success)
后面还有 27 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。