orderSubmit.js 2.02 KB
define(function( require, exports, module ) {

	var _Pophint = require( 'pophint' );

	require( 'fancybox' );
//	require( 'pickDtae' );
	require( 'region' );

	$( function(){

		// 删除联系人
		$( '.d-remove' ).click(function(){
			new _Pophint( this,{
	            operation: function( target ){
					//确定要执行的操作
	                $( target ).parents( 'li' ).remove();
				}, 
	            content: "确定要删除吗?",
	            showButton:true
	        });
		});

		//联系人 弹层
		$( '.fancybox' ).fancybox({
            scrolling: 'visible'
		});


//		// 日期选择
//		$( '.view-delivery' ).each(function(){
//			new PickDtae( this , '2014/8/6 08:40', 66, function(k, y){
//				console.log(k+'==='+y);
//			});
//		});

        //日期选择
        region.start();

        //配送方式切换
        $( ".different-type" ).click( function(){
            var href = $(this).attr("href");

            $(".delivery-address-area").hide();
            $(href).show();
        } );

        //提交订单弹框
		$( '.ds-operation .submitBtn' ).click(function(){
			new _Pophint( this,{
	            operation: function( target ){
					//确定要执行的操作
	                $( target ).parents( 'li' ).remove();
				}, 
	            content: $('.some-invalid').html(),
	            showButton: true,
                onName: '继续提交'
	        });
		});


	});


    var Scrolls = function(){

        var $window = $(window); 
        var $fixedName = $(".order-table"),
            $suspend   = $(".suspend");
        var initScroll = parseInt($fixedName.position().top);

        function listen(){

            $window.scroll( function(){
                var _t = parseInt($(this).scrollTop());

                if ( _t > initScroll ){
                    $suspend.show();
                }else {
                    $suspend.hide();
                }
            } );

        };

        return {
            listen: listen
        };
        
    };

    var scrollTab = Scrolls();

    scrollTab.listen();

});