新订单提示效果

<script>
    function remind() {
        // 新订单提醒
        $.ajax({
            type    :'POST',
            url     :'__APP__/Index/checkNewOrder',
            data    : {},
            dataType:'json',
            success:function(data){
                console.log(data);
                if (data.data == 1){
                    // 右下角弹框
                    layer.open({
                        type:0,
                        title: '提示',
                        content: '您有新的订单,请及时查看',
                        anim: 2,
                        shade:0,
                        offset:"rb"
                    });
                }
            }
        });


        // 新订单提醒
        $.ajax({
            type    :'POST',
            url     :'__APP__/Index/checkNewGroupOrder',
            data    : {},
            dataType:'json',
            success:function(data){
                console.log(data);
                if (data.data == 1){
                    // 右下角弹框
                    layer.open({
                        type:0,
                        title: '提示',
                        content: '您有新的【拼团】订单,请及时查看',
                        anim: 2,
                        shade:0,
                        offset:"rb"
                    });
                }
            }
        });

    }
    setInterval("remind()",10000);
</script>

增加提示音

<script>
    function remind() {
        // 新订单提醒
        $.ajax({
            type: 'POST',
            url: '__APP__/Index/checkNewOrder',
            data: {},
            dataType: 'json',
            success: function (data) {
                console.log(data);
                if (data.data == 1) {
                    playSound();
                    // 右下角弹框
                    layer.open({
                        type: 0,
                        title: '提示',
                        content: '您有新的订单,请及时查看',
                        anim: 2,
                        shade: 0,
                        offset: "rb"
                    });
                }
            }
        });


        // 新订单提醒
        $.ajax({
            type: 'POST',
            url: '__APP__/Index/checkNewGroupOrder',
            data: {},
            dataType: 'json',
            success: function (data) {
                console.log(data);
                if (data.data == 1) {
                    playSound();
                    // 右下角弹框
                    layer.open({
                        type: 0,
                        title: '提示',
                        content: '您有新的【拼团】订单,请及时查看',
                        anim: 2,
                        shade: 0,
                        offset: "rb"
                    });
                }
            }
        });

    }


    let playSound = function () {
        let browser = window.navigator.userAgent.toLowerCase();
        if (browser.indexOf("ie") >= 0) {
            //IE内核浏览器
            let strEmbed = '<embed name="embedPlay" src="/admin/image/voice.mp3" autostart="true" hidden="true" loop="false"></embed>';
            if ($("body").find("embed").length <= 0)
                $("body").append(strEmbed);
            let embed = document.embedPlay;
            embed.volume = 100;
        } else {
            //非IE内核浏览器
            let strAudio = "<audio id='audioPlay' src='/admin/image/voice.mp3' hidden='true'>";

            if ($("#audioPlay").length <= 0) {
                $("body").append(strAudio);
            }
            let audio = document.getElementById("audioPlay");
            //浏览器支持 audio
            audio.play();
        }
    }

    setInterval("remind()", 10000);
</script>
原文地址:https://www.cnblogs.com/jiqing9006/p/11857356.html