|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
-
-
-
- var selector = '#app-subscription-form';
- if($(selector).length) {
- var app = new Vue({
- el: selector,
- data: {
- showLoading: false,
- loading: true,
- products: []
- },
-
- mounted: function () {
- this.init();
- this.loading = false;
- },
-
- methods: {
- init: function () {
- var app = this;
- this.showLoading = true;
-
- axios.get("ajax-infos", {params: {idSubscription: $('#subscriptionform-id').val()}})
- .then(function (response) {
- app.products = response.data.products;
- app.showLoading = false;
- });
- },
- changeQuantityProductSubscription: function (increase, product) {
- var step = product.step ? parseFloat(product.step) : 1;
- if (!product.quantity) product.quantity = 0;
- var quantity = parseFloat(product.quantity);
- if (!increase) {
- step = -step;
- }
- if (quantity + step >= 0) {
- product.quantity = quantity + step;
- }
- if (!product.quantity) product.quantity = '';
- }
- }
- });
- }
|