
const getFruitIndex = function(calorie) {
	let  fruitIndex = [0,0,0];
	let currentCalorie = calorie;
	// console.log(currentCalorie);
	for (let i = 0; i < 3; i++) {
		for (let j = 0; j < this.fruitArray.length; j++) {
			if (currentCalorie >= this.fruitArray[j].value) {
				fruitIndex[i] = j;
			}
	
			if (currentCalorie >= this.fruitArray[fruitIndex[i]].value && j == this.fruitArray.length - 1) {
				currentCalorie -= this.fruitArray[fruitIndex[i]].value;
	
				// console.log("this.currentCalorie:"+i+"=", currentCalorie);
			}
	
		}
	}
	
	return fruitIndex;
}

export default {
	getFruitIndex,
	fruitArray: [{
		name: '问号',
		value: 0
	}, {
		name: '花生',
		value: 10
	}, {
		name: '虾饺',
		value: 50
	}, {
		name: '煎蛋',
		value: 100
	}, {
		name: '火腿',
		value: 150
	}, {
		name: '冰淇淋',
		value: 200
	}, {
		name: '中薯',
		value: 250
	}, {
		name: '炸鸡',
		value: 300
	}, {
		name: '可乐',
		value: 350
	}, {
		name: '奶油',
		value: 400
	}, {
		name: '炒饭',
		value: 450
	}, {
		name: '汉堡',
		value: 500
	}, {
		name: '东陂肉',
		value: 550
	}]
}