@@ -15,7 +15,7 @@ Vue.component('calc-item', {
1515 <div class="col">\
1616 <div class="form-group">\
1717 <label>Стоимость:</label>\
18- <input type="number " class="form-control" v-model.number="cost " disabled>\
18+ <input type="text " class="form-control" v-model.number="costs " disabled>\
1919 </div>\
2020 <button type="button" class="btn btn-outline-primary btn-block" v-on:click="remove">Удалить</button>\
2121 </div>\
@@ -29,7 +29,10 @@ Vue.component('calc-item', {
2929 } ,
3030 computed : {
3131 cost : function ( ) {
32- return Math . round ( ( 330 + Math . atan ( ( this . duration - 30 ) / 20 ) * 230 ) / 10 ) * 10
32+ return 330 + Math . atan ( ( this . duration - 30 ) / 20 ) * 230
33+ } ,
34+ costs : function ( ) {
35+ return this . round ( this . cost ) + ' / ' + this . round ( this . cost * .85 )
3336 }
3437 } ,
3538 methods : {
@@ -43,6 +46,9 @@ Vue.component('calc-item', {
4346 this . $emit ( 'update' , {
4447 duration : this . duration , cost : this . cost , index : this . index
4548 } )
49+ } ,
50+ round : function ( n ) {
51+ return Math . round ( n / 10 ) * 10
4652 }
4753 }
4854} )
@@ -58,13 +64,19 @@ var app = new Vue({
5864 } ,
5965 computed : {
6066 cost : function ( ) {
61- return Math . round ( ( 450 + Math . atan ( ( this . duration - 30 ) / 20 ) * 230 ) / 10 ) * 10
67+ return 450 + Math . atan ( ( this . duration - 30 ) / 20 ) * 230
6268 } ,
6369 totalDuration : function ( ) {
6470 return this . duration + this . additionalDuration
6571 } ,
6672 totalCost : function ( ) {
6773 return this . cost + this . additionalCost
74+ } ,
75+ costs : function ( ) {
76+ return this . round ( this . cost ) + ' / ' + this . round ( this . cost * .85 )
77+ } ,
78+ totalCosts : function ( ) {
79+ return this . round ( this . totalCost ) + ' / ' + this . round ( this . totalCost * .85 )
6880 }
6981 } ,
7082 methods : {
@@ -108,6 +120,9 @@ var app = new Vue({
108120 this . additionalCost -= item . cost
109121
110122 this . additional . splice ( index , 1 )
123+ } ,
124+ round : function ( n ) {
125+ return Math . round ( n / 10 ) * 10
111126 }
112127 }
113128} )
0 commit comments