order.js 1.24 KB
// require('css/common.less');
// require('css/order.less');

// var $ = require('jquery');
var Common = require('common');
var Popup = require('popup');
var Circle = require('circle');

Common.initialize();
Circle.initialize();
Popup.initialize();

var Order = {
	initialize: function(){
		this.bindEvents();
	},
	bindEvents: function(){
		var _this = this;
		var _move = $('.actions .move');
		$('.m-slide-btn').on('touchend', 'li', function(e){
			e.preventDefault();
			$(this).addClass('on').siblings().removeClass('on');
			var color = $(this).attr('data-color');
			var action = $(this).attr('data-action');
			_this._action = action;
			_move.css({
				transform: 'translateX('+ $(this).index() +'00%)',
				WebkitTransform: 'translateX('+ $(this).index() +'00%)',
				backgroundColor: color
			});
		});

		$('.actions').on('transitionEnd webkitTransitionEnd mozTransitionEnd', '.move', function(){
			_this[_this._action] && _this[_this._action]();
		});

		$('#cancelPopupBtn').on('click', function(){
			$('.m-slide-btn').find('li').eq(1).trigger('touchend');
		});
	},
	giveup: function(){
		// alert('已放弃');
		window.location.href = 'order_pauseing.html';
	},
	recive: function(){
		$('#confirmOrderBtn').trigger('click');
	}
};
Order.initialize();