payWechat.js 1.1 KB
//支付交互逻辑

define(function(require, exports, module) {
    $(function() {
        var Pay = {
            initialize: function() {
                this.bindEvents();
            },
            bindEvents: function() {
                var _this = this;
                this.orderDetailTag = $('#orderDetail'); //订单详情
                $('.show-more').on('click', function(e) { //切换显示订单详情
                    e.preventDefault();
                    _this.toggleOrder($(this));
                    _this.update();
                });
            },
            toggleOrder: function(target) {
                
                if (this.orderDetailTag.is(':animated')) {
                    return;
                }
                var lastText = target.find('span').text();
                var newText = target.find('span').attr('data-text');
                target.find('span').text(newText).attr('data-text', lastText);
                target.children('.icon').toggleClass('down');
                this.orderDetailTag.slideToggle();
            }
        };
        Pay.initialize();
    });
});