PageSourceSearch

https://cdn01.sela.ru/s3/sela/js/cart2.js?_=1790933143

js sela.ru collected 2026-10-03 22:55:08 UTC 59,455 bytes, 1,098 lines download raw bytes

1(() => {
2
3    Vue.component('v-style', {
4        render: function (createElement) {
5            return createElement('style', this.$slots.default)
6        }
7    });
8
9    sela.components.cart_item = Vue.component('cart_item', {
10        props: ['item', 'count', 'available'],
11        watch: {
12            'item.sela_select': function (newVal, oldVal) {
13                if (!this.$parent.isLoading) {
14                    this.$parent.itemUpdate(this.item.id, {sela_select: newVal});
15                }
16            },
17            'item.quantity': function (newVal, oldVal) {
18                if (!this.$parent.isLoading) {
19                    this.$parent.itemUpdate(this.item.id, {quantity: newVal, quantityOld: oldVal});
20                }
21            },
22        },
23        data: function () {
24            return {
25                disable: false,
26            }
27        },
28        methods: {
29            deleteItem: function (id) {
30                this.disable = true;
31                return this.$parent.deleteItem(id);
32            },
33            favoriteItem(id) {
34
35                window.parent.postMessage({
36                    type: 'TAPTIC_ENGINE',
37                    impact: 'light'
38                }, '*');
39
40                const index = this.$parent.user.favorite.indexOf(id);
41
42                if (index !== -1) {
43                    this.$parent.user.favorite.splice(index, 1);
44                }
45                else {
46                    this.$parent.user.favorite.push(id);
47                }
48
49                fetch('/eshop/favorite/' + (index !== -1 ? 'delete' : 'add') + '/?product_id=' + id, {
50                    method: 'GET',
51                    cache: 'no-cache',
52                    credentials: 'include',
53                    headers: {
54                        "X-Requested-With": "XMLHttpRequest"
55                    }
56                })
57                .then(response => response.json())
58                .then(response => {
59
60                    window.sela.userUpdate();
61
62
63                    dataLayer.push({
64                        'event':(index !== -1 ? 'remove_from_wishlist' : 'add_to_wishlist'),
65                        "ecommerce": {
66                            "currency": "RUB",
67                            //"value": that.product.price,
68                            "items": [{
69                                "item_id": id,
70                                //"item_name": that.product.name,
71                                //"price": that.product.price,
72                                "quantity": 1
73                            }]
74                        }
75                    });
76
77                    if (typeof(mindbox) == 'function') {
78
79                        let productList = [];
80
81                        response.data.forEach(item => {
82                            productList.push({
83                                product: {
84                                    ids: {
85                                        catalog: item.product_id
86                                    }
87                                },
88                                count: 1,
89                                price: item.price_alt
90                            });
91                        });
92
93                        mindbox("async", {
94                            operation: "setwishlist",
95                            data: {
96                                productList: productList
97                            },
98                        });
99
100                    }
101
102
103                });
104
105            },
106        },
107        template: `
108        
109            <div v-bind:class="['cart-table-item', (disable) ? 'cart-table-item__disable' : '']">
110                
111                <div class="cart-table-item_select">
112                    <label v-if="available" class="sela-checkbox">
113                        <span class="sela-checkbox_wrap" style="font-size:24px">
114                            <input type="checkbox" v-model="item.sela_select" :disabled="!available || this.$parent.isLoading">
115                            <span>
116                                <svg width="15" height="10" viewBox="0 0 15 10" fill="none" xmlns="http://www.w3.org/2000/svg">
117                                    <path d="M1 5L5.64648 9" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
118                                    <path d="M5.64844 9L13.6484 1" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
119                                </svg>
120                            </span>
121                        </span>
122                    </label>
123                </div>
124                
125
126                <a v-bind:href="item.full_url" class="cart-table-item_pic" target="_blank">
127                    <img :src="item.image2x" v-bind:srcset="item.image2x + ' 2x'"
128                         :alt="item.product_name" class="cart-table-item_pic-img"
129                         width="120" height="168"
130                         onerror="this.srcset='/s3/sela/img/product_thumb.png, /s3/sela/img/product_thumb.png 2x'">
131                    <span v-if="!available" class="cart-table-item_pic-txt">
132                        Разобрали
133                    </span>
134                </a>
135
136
137                <div class="cart-table-item_data">
138
139                    <a v-bind:href="item.full_url" v-bind:class="['cart-table-item_name', (!available) ? 'cart-table-item_name__gray' : '']" target="_blank">{{ item.product_name }}</a>
140
141                    <div class="cart-table-item_size">{{ item.sku_color }} · {{ item.sku_size }}</div>
142
143                    <div v-if="available && count <= 5" class="cart-table-item_available">
144                        <template v-if="count == 1">
145                            последний
146                        </template>
147                        <template v-else>
148                            осталось {{ count }} шт                        
149                        </template>
150                    </div>
151
152                    <div class="cart-table-item_price">
153                        <div class="cart-table-item_price-numbers mb-1">
154                            <b :class="item.compare_price > 0 && available ? 'text-primary' : ''"><animated-number :number="item.price * item.quantity"></animated-number></b>
155                            <!--<b>{{ window.sela.utils.formatPrice(item.price * item.quantity) }}</b>-->
156                            <s v-if="item.compare_price > 0 && available" class="opacity-75"><animated-number :number="item.compare_price * item.quantity"></animated-number></s>    
157                            
158                            <div v-if="item.quantity > 1 && available" class="opacity-50 fs-7">
159                                <animated-number :number="item.price"></animated-number>/шт.
160                            </div>
161                                     
162                        </div>
163                        <button v-if="(available && item.upselling.length > 0) || (!available && item.crossselling.length > 0)" class="btn p-0 cart-table-item_replace d-lg-none" @click="$root.upselling(item, available)" style="width:120px;">
164                            <template v-if="available">
165                                <template v-if="item.collection=='Sela HOME'">                                
166                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none">
167                                        <path d="M2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5V9.5C11 9.84874 11 10.0231 10.9617 10.1662C10.8576 10.5544 10.5544 10.8576 10.1662 10.9617C10.0231 11 9.84874 11 9.5 11H6.5C4.01472 11 2 8.98528 2 6.5Z" fill="currentColor"></path>
168                                        <path d="M13 14.5C13 14.1513 13 13.9769 13.0383 13.8338C13.1424 13.4456 13.4456 13.1424 13.8338 13.0383C13.9769 13 14.1513 13 14.5 13H17.5C19.9853 13 22 15.0147 22 17.5C22 19.9853 19.9853 22 17.5 22C15.0147 22 13 19.9853 13 17.5V14.5Z" fill="currentColor"></path>
169                                        <path d="M2 17.5C2 15.0147 4.01472 13 6.5 13H9.2C9.83006 13 10.1451 13 10.3857 13.1226C10.5974 13.2305 10.7695 13.4026 10.8774 13.6143C11 13.8549 11 14.1699 11 14.8V17.5C11 19.9853 8.98528 22 6.5 22C4.01472 22 2 19.9853 2 17.5Z" fill="currentColor"></path>
170                                        <path d="M13 6.5C13 4.01472 15.0147 2 17.5 2C19.9853 2 22 4.01472 22 6.5C22 8.98528 19.9853 11 17.5 11H14.2857C14.1365 11 14.0618 11 13.999 10.9929C13.4775 10.9342 13.0658 10.5225 13.0071 10.001C13 9.93818 13 9.86355 13 9.71429V6.5Z" fill="currentColor"></path>
171                                    </svg>
172                                    вся серия
173                                </template>
174                                <template v-else>
175                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none">
176                                        <path d="M21.7148 15.5485L18.9364 17.2116C18.8266 17.2757 18.6962 17.2943 18.5728 17.2636C18.4495 17.2328 18.3431 17.1551 18.2762 17.047C18.2437 16.993 18.2222 16.9331 18.2129 16.8707C18.2036 16.8083 18.2067 16.7447 18.222 16.6835C18.2373 16.6223 18.2646 16.5648 18.3022 16.5141C18.3398 16.4635 18.387 16.4208 18.4412 16.3884L18.5813 16.3045L17.8073 15.1463C17.737 15.0401 17.7117 14.9103 17.7369 14.7855C17.7621 14.6607 17.8359 14.5
17651 17.9419 14.4805C18.0479 14.4099 15.8751 15.775 16 15.8C16.1248 15.825 19.7292 18.2941 19.8 18.4L21.7148 15.5485L21.5264 14.5417L20.9117 11.256C20.8494 10.9252 20.6734 10.6266 20.4142 10.4118C20.155 10.1971 19.8289 10.0797 19.4923 10.08H12.1115C11.7747 10.079 11.4482 10.1961 11.1888 10.411C10.9295 10.6258 10.7537 10.9249 10.6921 11.256L9.54523 17.3856L13.7667 18.6L14.2 15C14.2 15 13.1534 15.4197 13.2118 15.3951C13.2702 15.3705 13.3328 15.3578 13.3962 15.3575C13.4595 15.3572 13.5223 15.3695 13.5808 15.3936C13.6394 15.4177 13.6927 15.4531 13.7375 15.4978C13.7823 15.5426 13.8179 15.5957 13.8421 15.6542C13.8663 15.7128 13.8788 15.7755 13.8786 15.8388C13.8785 15.9022 13.8659 15.9649 13.8415 16.0233C13.8171 16.0817 13.7813 16.1348 13.7363 16.1794L12.2929 17.6194C12.2313 17.681 9.62979 17.3646 9.54523 17.3856L9.351 18.4237L8.70013 21.9024C8.6743 22.041 8.67928 22.1836 8.71471 22.3201C8.75014 22.4566 8.81515 22.5836 8.90514 22.6922C8.99513 22.8007 9.1079 22.8881 9.23545 22.9483C9.363 23.0084 9.50221 23.0397 9.64321 23.04H13.7667C13.9702 23.0411 14.1689 22.9775 14.334 22.8585C14.4992 22.7394 14.6223 22.5711 14.6856 22.3776L15.8019 18.9648L16.9181 22.3776C16.9815 22.5711 17.1046 22.7394 17.2698 22.8585C17.4349 22.9775 17.6336 23.0411 17.8371 23.04H21.9606C22.1016 23.0397 22.2408 23.0084 22.3683 22.9482C22.4959 22.8881 22.6086 22.8007 22.6986 22.6922C22.7886 22.5836 22.8536 22.4566 22.8891 22.3201C22.9245 22.1836 22.9295 22.041 22.9036 21.9024L21.7148 15.5485ZM8.76583 16.32H5.69778C5.44294 16.3201 5.1985 16.219 5.01808 16.039C4.83767 15.859 4.73604 15.6148 4.73548 15.36V10.8568L6.34866 10.0521L7.19197 11.7347C7.2489 11.8488 7.34886 11.9357 7.46983 11.9761C7.59081 12.0166 7.7229 12.0073 7.83705 11.9504C7.9512 11.8935 8.03806 11.7935 8.07851 11.6725C8.11897 11.5516 8.10971 11.4195 8.05277 11.3053C8.05145 11.3026 7.46584 10.1342 7.20947 9.62273L7.88832 9.28409L8.15426 9.81469C8.21163 9.9281 8.31156 10.0142 8.4322 10.0542C8.55285 10.0941 8.68441 10.0847 8.79814 10.028C8.91187 9.97125 8.99852 9.87181 9.03917 9.75139C9.07982 9.63097 9.07115 9.49936 9.01507 9.38531C9.01448 9.38414 8.89901 9.15378 8.74912 8.85469L9.28101 8.58937C9.3374 8.56111 9.38766 8.52202 9.42894 8.47434C9.47022 8.42665 9.50171 8.3713 9.52159 8.31144C9.54148 8.25159 9.54939 8.1884 9.54486 8.12549C9.54032 8.06259 9.52345 8.00118 9.49518 7.9448C9.46692 7.88841 9.42783 7.83814 9.38015 7.79686C9.33246 7.75559 9.27711 7.7241 9.21725 7.70422C9.1574 7.68433 9.09421 7.67642 9.0313 7.68096C8.9684 7.68549 8.907 7.70236 8.85061 7.73063L8.31872 7.99594C8.16842 7.69608 8.05277 7.46531 8.05277 7.46531C7.99583 7.35116 7.89588 7.26431 7.7749 7.22386C7.65392 7.1834 7.52183 7.19266 7.40768 7.2496C7.29353 7.30654 8.09322 6.32233 8.05277 6.44331C8.01231 6.56429 10.143 8.19729 10.2 8.31144L8.31872 12.6L4.73548 10.8568V9.78336V8.32101L3.86692 8.57508C3.67925 8.62958 3.47947 8.62592 3.29392 8.56458C3.10838 8.50324 2.94578 8.38711 2.82757 8.23149L1.27393 6.17461C1.19767 6.0737 1.14214 5.95869 1.11054 5.83622C1.07894 5.71375 1.07189 5.58623 1.08979 5.46102C1.1077 5.33581 1.15022 5.21538 1.21488 5.10668C1.27955 4.99798 1.36509 4.90315 1.46658 4.82766L6.53109 1.05539C6.60245 1.00225 6.68712 0.96989 6.77573 0.961906C6.86435 0.953922 6.95344 0.970621 7.03315 1.01016C7.80657 1.42354 8.67 1.63981 9.54696 1.63981C10.4239 1.63981 11.2873 1.42354 12.0608 1.01016C12.1405 0.970699 12.2297 0.954043 12.3183 0.962025C12.4069 0.970007 12.4916 1.00232 12.5631 1.05539L13.841 2.00728L15 2.87057L14.4 6.2C14.2882 6.14316 11.9195 5.96224 11.8 6C11.6804 6.03776 12.0099 4.09252 12.0099 4.09252L11.9737 4.45281C12.0093 4.573 12.0907 4.6744 12.2004 4.73517L12.0213 5.03297C11.9787 5.10585 11.956 5.18865 11.9555 5.27306C11.955 5.35746 11.9768 5.44052 12.0185 5.51389C12.0602 5.58725 12.1205 5.64836 12.1934 5.69106C12.2662 5.73377 12.3489 5.75659 12.4333 5.75722C12.516 5.75696 12.5973 5.73571 12.6696 5.69545C12.7418 5.65518 12.8027 5.59724 12.8464 5.52703C12.8464 5.52703 12.9288 5.39004 13.0613 5.1697L13.1809 5.22937C13.2948 5.28646 13.4267 5.29596 13.5476 5.2558C13.6685 5.21564 13.7684 5.1291 13.8255 5.01522C13.8826 4.90135 13.8921 4.76946 13.8519 4.64857C13.8118 4.52769 13.7252 4.42771 13.6114 4.37063L13.5579 4.34397C13.8974 3.77939 14.2962 3.11628 14.616 2.58457L17.6274 4.82766C17.7287 4.90324 17.8141 4.99811 17.8787 5.10682C17.9433 5.21552 17.9858 5.33592 18.0037 5.46109C18.0216 5.58626 18.0146 5.71373 17.983 5.83618C17.9515 5.95863 17.8961 6.07364 17.82 6.17461L16.2661 8.23172C16.148 8.38738 15.9854 8.50354 15.7998 8.56484C15.6142 8.62615 15.4144 8.62972 15.2268 8.57508L14.3585 8.32101V9.12H12.1115C11.5503 9.11866 11.0064 9.314 10.5
176742 9.6721C10.1421 10.0302 9.8491 10.5284 9.74618 11.0801L8.76583 16.32Z" fill="currentColor"></path>
177                                    </svg>
178                                    с&nbsp;чем носить                                
179                                </template>
180                            </template>
181                            <template v-else>
182                                похожие
183                            </template>
184                        </button>
185                    </div>
186
187                    <div class="cart-table-item_controls">
188
189                        <button class="btn p-0 cart-table-item_btn cart-table-item_btn-favorite" :class="$parent.user.favorite.includes(item.product_id) ? 'is-active-favorite' : ''" :data-product_id="item.product_id" @click="favoriteItem(item.product_id)">
190                            <svg width="22" height="20" viewBox="0 0 22 20" fill="none" xmlns="http://www.w3.org/2000/svg">
191                                <path d="M15.696 1C13.652 1 11.887 2.197 11 3.943C10.113 2.197 8.348 1 6.304 1C3.374 1 1 3.457 1 6.481C1 9.505 2.817 12.277 5.165 14.554C7.513 16.831 11 19 11 19C11 19 14.374 16.867 16.835 14.554C19.46 12.088 21 9.514 21 6.481C21 3.448 18.626 1 15.696 1Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
192                            </svg>
193                        </button>
194
195                        <button class="btn p-0 cart-table-item_btn cart-table-item_btn-del" @click="deleteItem(item.id)" :disabled="this.$parent.isLoading">
196                            <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
197                                <path d="M1 1L17 17" stroke="currentColor" stroke-width="2" stroke-miterlimit="10" stroke-linecap="round"/>
198                                <path d="M17 1L1 17" stroke="currentColor" stroke-width="2" stroke-miterlimit="10" stroke-linecap="round"/>
199                            </svg>
200                        </button>
201
202                        <!--
203                        <span class="sela-mobile-hide" style="color:#A2A09E;font-size:14px;height:32px;line-height:32px;">{{ window.sela.utils.formatPrice(item.price) }}</span>
204                        -->
205
206                        <div class="d-flex flex-column align-items-end gap-2">
207
208                            <button v-if="(available && item.upselling.length > 0) || (!available && item.crossselling.length > 0)" class="btn p-0 cart-table-item_replace d-none d-lg-flex" @click="$root.upselling(item, available)" style="width:120px;">
209                                <template v-if="available">
210                                    <template v-if="item.collection=='Sela HOME'">                                
211                                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none">
212                                            <path d="M2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5V9.5C11 9.84874 11 10.0231 10.9617 10.1662C10.8576 10.5544 10.5544 10.8576 10.1662 10.9617C10.0231 11 9.84874 11 9.5 11H6.5C4.01472 11 2 8.98528 2 6.5Z" fill="currentColor"></path>
213                                            <path d="M13 14.5C13 14.1513 13 13.9769 13.0383 13.8338C13.1424 13.4456 13.4456 13.1424 13.8338 13.0383C13.9769 13 14.1513 13 14.5 13H17.5C19.9853 13 22 15.0147 22 17.5C22 19.9853 19.9853 22 17.5 22C15.0147 22 13 19.9853 13 17.5V14.5Z" fill="currentColor"></path>
214                                            <path d="M2 17.5C2 15.0147 4.01472 13 6.5 13H9.2C9.83006 13 10.1451 13 10.3857 13.1226C10.5974 13.2305 10.7695 13.4026 10.8774 13.6143C11 13.8549 11 14.1699 11 14.8V17.5C11 19.9853 8.98528 22 6.5 22C4.01472 22 2 19.9853 2 17.5Z" fill="currentColor"></path>
215                                            <path d="M13 6.5C13 4.01472 15.0147 2 17.5 2C19.9853 2 22 4.01472 22 6.5C22 8.98528 19.9853 11 17.5 11H14.2857C14.1365 11 14.0618 11 13.999 10.9929C13.4775 10.9342 13.0658 10.5225 13.0071 10.001C13 9.93818 13 9.86355 13 9.71429V6.5Z" fill="currentColor"></path>
216                                        </svg>
217                                        вся серия
218                                    </template>
219                                    <template v-else>
220                                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewB
220ox="0 0 24 24" fill="none">
221                                            <path d="M21.7148 15.5485L18.9364 17.2116C18.8266 17.2757 18.6962 17.2943 18.5728 17.2636C18.4495 17.2328 18.3431 17.1551 18.2762 17.047C18.2437 16.993 18.2222 16.9331 18.2129 16.8707C18.2036 16.8083 18.2067 16.7447 18.222 16.6835C18.2373 16.6223 18.2646 16.5648 18.3022 16.5141C18.3398 16.4635 18.387 16.4208 18.4412 16.3884L18.5813 16.3045L17.8073 15.1463C17.737 15.0401 17.7117 14.9103 17.7369 14.7855C17.7621 14.6607 17.8359 14.551 17.9419 14.4805C18.0479 14.4099 15.8751 15.775 16 15.8C16.1248 15.825 19.7292 18.2941 19.8 18.4L21.7148 15.5485L21.5264 14.5417L20.9117 11.256C20.8494 10.9252 20.6734 10.6266 20.4142 10.4118C20.155 10.1971 19.8289 10.0797 19.4923 10.08H12.1115C11.7747 10.079 11.4482 10.1961 11.1888 10.411C10.9295 10.6258 10.7537 10.9249 10.6921 11.256L9.54523 17.3856L13.7667 18.6L14.2 15C14.2 15 13.1534 15.4197 13.2118 15.3951C13.2702 15.3705 13.3328 15.3578 13.3962 15.3575C13.4595 15.3572 13.5223 15.3695 13.5808 15.3936C13.6394 15.4177 13.6927 15.4531 13.7375 15.4978C13.7823 15.5426 13.8179 15.5957 13.8421 15.6542C13.8663 15.7128 13.8788 15.7755 13.8786 15.8388C13.8785 15.9022 13.8659 15.9649 13.8415 16.0233C13.8171 16.0817 13.7813 16.1348 13.7363 16.1794L12.2929 17.6194C12.2313 17.681 9.62979 17.3646 9.54523 17.3856L9.351 18.4237L8.70013 21.9024C8.6743 22.041 8.67928 22.1836 8.71471 22.3201C8.75014 22.4566 8.81515 22.5836 8.90514 22.6922C8.99513 22.8007 9.1079 22.8881 9.23545 22.9483C9.363 23.0084 9.50221 23.0397 9.64321 23.04H13.7667C13.9702 23.0411 14.1689 22.9775 14.334 22.8585C14.4992 22.7394 14.6223 22.5711 14.6856 22.3776L15.8019 18.9648L16.9181 22.3776C16.9815 22.5711 17.1046 22.7394 17.2698 22.8585C17.4349 22.9775 17.6336 23.0411 17.8371 23.04H21.9606C22.1016 23.0397 22.2408 23.0084 22.3683 22.9482C22.4959 22.8881 22.6086 22.8007 22.6986 22.6922C22.7886 22.5836 22.8536 22.4566 22.8891 22.3201C22.9245 22.1836 22.9295 22.041 22.9036 21.9024L21.7148 15.5485ZM8.76583 16.32H5.69778C5.44294 16.3201 5.1985 16.219 5.01808 16.039C4.83767 15.859 4.73604 15.6148 4.73548 15.36V10.8568L6.34866 10.0521L7.19197 11.7347C7.2489 11.8488 7.34886 11.9357 7.46983 11.9761C7.59081 12.0166 7.7229 12.0073 7.83705 11.9504C7.9512 11.8935 8.03806 11.7935 8.07851 11.6725C8.11897 11.5516 8.10971 11.4195 8.05277 11.3053C8.05145 11.3026 7.46584 10.1342 7.20947 9.62273L7.88832 9.28409L8.15426 9.81469C8.21163 9.9281 8.31156 10.0142 8.4322 10.0542C8.55285 10.0941 8.68441 10.0847 8.79814 10.028C8.91187 9.97125 8.99852 9.87181 9.03917 9.75139C9.07982 9.63097 9.07115 9.49936 9.01507 9.38531C9.01448 9.38414 8.89901 9.15378 8.74912 8.85469L9.28101 8.58937C9.3374 8.56111 9.38766 8.52202 9.42894 8.47434C9.47022 8.42665 9.50171 8.3713 9.52159 8.31144C9.54148 8.25159 9.54939 8.1884 9.54486 8.12549C9.54032 8.06259 9.52345 8.00118 9.49518 7.9448C9.46692 7.88841 9.42783 7.83814 9.38015 7.79686C9.33246 7.75559 9.27711 7.7241 9.21725 7.70422C9.1574 7.68433 9.09421 7.67642 9.0313 7.68096C8.9684 7.68549 8.907 7.70236 8.85061 7.73063L8.31872 7.99594C8.16842 7.69608 8.05277 7.46531 8.05277 7.46531C7.99583 7.35116 7.89588 7.26431 7.7749 7.22386C7.65392 7.1834 7.52183 7.19266 7.40768 7.2496C7.29353 7.30654 8.09322 6.32233 8.05277 6.44331C8.01231 6.56429 10.143 8.19729 10.2 8.31144L8.31872 12.6L4.73548 10.8568V9.78336V8.32101L3.86692 8.57508C3.67925 8.62958 3.47947 8.62592 3.29392 8.56458C3.10838 8.50324 2.94578 8.38711 2.82757 8.23149L1.27393 6.17461C1.19767 6.0737 1.14214 5.95869 1.11054 5.83622C1.07894 5.71375 1.07189 5.58623 1.08979 5.46102C1.1077 5.33581 1.15022 5.21538 1.21488 5.10668C1.27955 4.99798 1.36509 4.90315 1.46658 4.82766L6.53109 1.05539C6.60245 1.00225 6.68712 0.96989 6.77573 0.961906C6.86435 0.953922 6.95344 0.970621 7.03315 1.01016C7.80657 1.42354 8.67 1.63981 9.54696 1.63981C10.4239 1.63981 11.2873 1.42354 12.0608 1.01016C12.1405 0.970699 12.2297 0.954043 12.3183 0.962025C12.4069 0.970007 12.4916 1.00232 12.5631 1.05539L13.841 2.00728L15 2.87057L14.4 6.2C14.2882 6.14316 11.9195 5.96224 11.8 6C11.6804 6.03776 12.0099 4.09252 12.0099 4.09252L11.9737 4.45281C12.0093 4.573 12.0907 4.6744 12.2004 4.73517L12.0213 5.03297C11.9787 5.10585 11.956 5.18865 11.9555 5.27306C11.955 5.35746 11.9768 5.44052 12.0185 5.51389C12.0602 5.58725 12.1205 5.64836 12.1934 5.69106C12.2662 5.73377 12.3489 5.75659 12.4333 5.75722C12.516 5.75696 12.5973 5.73571 12.6696 5.69545C12.7418 5.65518 12.8027 5.59724 12.8464 5.52703C12.8464 5.52703 12.9288 5.39004 13.0613 5.1697L13.1809 5.22937C13.2948 5.28
221646 13.4267 5.29596 13.5476 5.2558C13.6685 5.21564 13.7684 5.1291 13.8255 5.01522C13.8826 4.90135 13.8921 4.76946 13.8519 4.64857C13.8118 4.52769 13.7252 4.42771 13.6114 4.37063L13.5579 4.34397C13.8974 3.77939 14.2962 3.11628 14.616 2.58457L17.6274 4.82766C17.7287 4.90324 17.8141 4.99811 17.8787 5.10682C17.9433 5.21552 17.9858 5.33592 18.0037 5.46109C18.0216 5.58626 18.0146 5.71373 17.983 5.83618C17.9515 5.95863 17.8961 6.07364 17.82 6.17461L16.2661 8.23172C16.148 8.38738 15.9854 8.50354 15.7998 8.56484C15.6142 8.62615 15.4144 8.62972 15.2268 8.57508L14.3585 8.32101V9.12H12.1115C11.5503 9.11866 11.0064 9.314 10.5742 9.6721C10.1421 10.0302 9.8491 10.5284 9.74618 11.0801L8.76583 16.32Z" fill="currentColor"></path>
222                                        </svg>
223                                        с&nbsp;чем носить                                
224                                    </template>
225                                </template>
226                                <template v-else>
227                                    похожие                                
228                                </template> 
229                            </button>
230
231                            <div v-bind:class="['cart-table-item_qnt', this.$parent.isLoading ? 'cart-table-item_qnt__disable' : '']">
232                              
233                                <button v-if="item.quantity == 1" class="btn p-0" @click="deleteItem(item.id)">
234                                  <svg width="10" height="12" viewBox="0 0 10 12" fill="none" xmlns="http://www.w3.org/2000/svg">
235                                    <path fill-rule="evenodd" clip-rule="evenodd" d="M1.85633 2.00153C1.98293 0.862055 2.94608 0 4.09256 0H5.90744C7.05392 0 8.01707 0.862055 8.14367 2.00153L8.19906 2.5H10V4H9.34225L9.34216 4.00087L8.6885 10.2101C8.58135 11.228 7.723 12.0007 6.69949 12.0007H3.30053C2.27701 12.0007 1.41866 11.228 1.31152 10.2101L0.657955 4.00087L0.657864 4H0V2.5H1.80094L1.85633 2.00153ZM6.65285 2.16718L6.68983 2.5H3.31017L3.34715 2.16718C3.38935 1.78735 3.7104 1.5 4.09256 1.5H5.90744C6.2896 1.5 6.61065 1.78735 6.65285 2.16718ZM2.80328 10.0531L2.16624 4.00087H7.83387L7.19674 10.0531C7.16996 10.3075 6.95537 10.5007 6.69949 10.5007H3.30053C3.04465 10.5007 2.83007 10.3075 2.80328 10.0531Z" fill="currentColor"/>
236                                  </svg>
237                                </button>
238                                <button v-else class="btn p-0" @click="if (item.quantity >= 2) item.quantity = item.quantity-1" :disabled="item.quantity == 1">
239                                    <svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
240                                        <path d="M5 11H17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
241                                    </svg>
242                                </button>
243                              
244                                <input type="number" min="1" v-bind:max="count" v-model.number.lazy="item.quantity" readonly>
245                                <button class="btn p-0" @click="if (item.quantity < count) item.quantity = item.quantity+1" :disabled="item.quantity == count || !available">
246                                    <svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
247                                        <path d="M5 11H17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
248                                        <path d="M11 5L11 17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
249                                    </svg>
250                                </button>
251                            </div>
252
253                        </div>
254
255                    </div>
256
257                </div>
258
259            </div>
260        `
261    });
262
263    sela.components.cart = new Vue({
264        el: '#sela_cart',
265        components: {
266            'cart_item': sela.components.cart_item,
267            'animated-number': vue_sela_animated_number,
268            'sela-sheet': vue_sela_sheet,
269        },
270        data: {
271            isReady: false,
272            isLoading: false,
273            items: null,
274            available: {},
275            available_sources: {
276                main: {},
277                retail: {},
278            },
279            unavailable: [],
280            summary: {
281                count: {
282                    all: 0,
283                    available: 0,
284                    unavailable: 0,
285                    select: 0,
286                },
287                sum: 0,
288                discount: 0,
289                total: 0,
290                bonus: 0
291            },
292
293            selected: {},
294
295            shareLoad: true,
296            shareProducts: [],
297            shareProductsQuantity: 0,
298            shareProductsPrice: 0,
299            shareLoadToCart: false,
300            shareUrl: null,
301
302            promoLoad: true,
303            promoHtml: null,
304
305            user: {
306                favorite: JSON.parse(window.sessionStorage.getItem('sela_user')??'{}').favorite ?? [],
307            },
308
309            location_name: getCookie('location_name') ?? 'Москва',
310        },
311        computed: {
312
313        },
314        watch: {
315            'items': {
316                handler: function(items, itemsOld) {
317
318                    let gaItems = [];
319                    let advcakeItems = [];
320                    let mindboxItems = [];
321
322                    _.forEach(items, item => {
323
324                        mindboxItems.push({
325                            'product': {
326                                'sku': {
327                                    'ids': {
328                                        'catalog': parseInt(item.sku_id)
329                                    },
330                                    'price': parseInt(item.price)
331                                },
332                                'ids': {
333                                    'catalog': parseInt(item.product_id)
334                                }
335                            },
336                            'count': item.quantity,
337                            'price': item.price,
338                        });
339
340                        gaItems.push({
341                            'item_id': item.product_id,
342                            'item_name': item.name,
343                            'price': item.price,
344                            'quantity': item.quantity,
345                        });
346
347                        advcakeItems.push({
348                            'id': item.product_id,
349                            'name': item.name,
350                            'price': item.price,
351                            'quantity': item.quantity,
352                        });
353
354                    });
355
356
357                    // Первая загрузка
358                    if (itemsOld === null) {
359
360                        dataLayer.push({
361                            'event': 'view_cart',
362                            'ecommerce': {
363                                'currency': 'RUB',
364                                'value': this.summary.total,
365                                'items' : gaItems
366                            }
367                        });
368
369                        window.advcake_data = window.advcake_data || [];
370                        sela.user.then(contact => {
371                            window.advcake_data.push({
372                                pageType: 4,
373                                user: {
374                                    email: contact.user.email_md5
375                                },
376                                basketProducts: advcakeItems
377                            });
378                        });
379
380                    }
381
382                    if (typeof(mindbox) == 'function') {
383                        mindbox('async', {
384                            operation: 'setcart',
385                            data: mindboxItems.length ? {productList: mindboxItems} : {}
386                        });
387                    }
388
389                },
390                deep: true
391            }
392        },
393        created: function () {
394            sela.eventBus.$on('user-update', contact => {
395                this.user.favorite = contact.favorite;
396            });
397            sela.eventBus.$on('location-update', location => {
398                this.location_name = location.name;
399            });
400        },
401        mounted: function () {
402            let that = this;
403
404            that.$el.classList.remove('opacity-0');
405
406            this.getItems();
407
408            if (this.$refs.observerIntersecting !== undefined && that.$refs.observerButton !== undefined) {
409                const observer = new IntersectionObserver(function (entries, observer) {
410                    if (that.$refs.observerButton !== undefined) {
411                        if (!entries[0].isIntersecting) {
412                            that.$refs.observerButton.classList.add('sela-box-summary_sticky__flight')
413                        } else {
414                            that.$refs.observerButton.classList.remove('sela-box-summary_sticky__flight')
415                        }
416                    }
417                }, {
418                    threshold: 1
419                })
420                observer.observe(this.$refs.observerIntersecting)
421            }
422
423            const url = new URL(window.location.href);
424
425            if (url.searchParams.get("share")) {
426                this.getShareItems( url.searchParams.get("share") );
427            }
428
429        },
430        methods: {
431            sortItems(items) {
432
433                items = JSON.parse(JSON.stringify(items));
434
435                if (Array.isArray(items)) {
436
437                    return items.sort((a, b) => (a > b ? -1 : 1));
438
439                } else {
440
441                    return Object.entries(items)
442                        .sort(([a], [b]) => b - a)
443                        .map(([key, value]) => ({ key, value }));
444
445                }
446
447            },
448            selectedAll: function () {
449
450                let sela_select;
451                let ids = [];
452
453                this.isLoading = true;
454
455                sela_select = this.summary.count.available !== this.summary.count.select;
456
457                for (const [item_id, count] of Object.entries(this.available)) {
458                    this.items[item_id].sela_select = sela_select;
459                    this.$set(this.items, item_id, this.items[item_id]);
460                    ids.push(item_id);
461                }
462
463                this.itemsUpdate(ids, {sela_select: sela_select})
464
465            },
466            itemsUpdate: function (ids, data) {
467
468                this.updateItems('update', {
469                    ids: ids,
470                    data: data
471                });
472
473            },
474            itemUpdate: function (id, data) {
475
476                this.updateItems('update', {
477                    id: id,
478                    data: data
479                });
480
481            },
482            deleteItems: function () {
483                let that = this;
484
485                selaAlert('Удалить выбранные товары?', {
486                    buttons: [
487                        {
488                            label: 'Отмена',
489                            cssClass: 'btn-dark text-white',
490                        },
491                        {
492                            label: 'Удалить',
493                            cssClass: 'btn-primary text-white',
494                            close: true,
495                            callback: () => {
496
497                                let ids = [];
498
499                                for (const [item_id, item_data] of Object.entries(that.items)) {
500                                    if (item_data.sela_select) {
501                                        ids.push(parseInt(item_id));
502                                    }
503                                }
504
505                                for (const $component of that.$root.$children) {
506                                    if ($component.$options._componentTag === 'cart_item') {
507                                        if (ids.includes($component.$options._parentVnode.data.key)) {
508                                            $component.disable = true;
509                                        }
510                                    }
511                                }
512
513                                that.updateItems('del', {
514                                    ids: ids
515                                });
516
517                            },
518                        }
519                    ]
520                });
521
522            },
523            deleteItem: function (id) {
524
525                this.updateItems('del', {
526                    id: id
527                });
528
529            },
530            getItems: async function() {
531                let that = this;
532                that.isLoading = true;
533                //that.$el.classList.add('cart__loading', 'cart__reloading');
534
535                try {
536                    // Выполняем основной запрос
537                    const response = await fetch('api/v2/');
538                    const data = await response.json();
539
540                    // Обработка данных ответа
541                    if (data.data?.oms_settings) {
542                        sela_cart_settings = data.data.oms_settings;
543                    }
544
545                    if (data.data.alert) {
546                        if (typeof data.data.alert === 'string') {
547                            selaAlert(data.data.alert);
548                        } else {
549                            selaAlert(data.data.alert.title, {message: data.data.alert.message});
550                        }
551                    }
552
553                    // Обновление состояния компонента
554                    that.items = data.data.items;
555                    that.available = data.data.available;
556                    that.available_sources = data.data.available_sources;
557                    that.unavailable = data.data.unavailable;
558                    that.selected = data.data.selected;
559                    that.summary = data.data.summary;
560
561                    that.$forceUpdate();
562
563                    // Обработка истории просмотров
564                    let historyPromise = Promise.resolve();
565
566                    if (data.data.items == null) {
567                        const urls = JSON.parse(localStorage.getItem('products_history') ?? '[]');
568                        if (urls.length > 0) {
569                            let params = new URLSearchParams();
570                            urls.forEach((p) => params.append("p[]", p));
571
572                            historyPromise = fetch('/eshop/landing/products/?format=html&template=slide&title=вы+смотрели&' + params.toString())
573                                .then(response => response.text())
574                                .then(html => {
575                                    document.querySelector('#products_history').innerHTML = html;
576                                });
577                        }
578                    } else {
579                        sela.components.frisbuy?.$destroy();
580                        document.querySelector('#products_history').innerHTML = '';
581                    }
582
583                    // Ждем завершения операций с историей
584                    await historyPromise;
585
586                    // Возвращаем данные для последующей обработки
587                    return data;
588
589                } catch (error) {
590                    console.error(error);
591                    selaAlert('Что-то пошло не так');
592                    // Пробрасываем ошибку для обработки через .catch()
593                    throw error;
594                } finally {
595                    // Сбрасываем флаги загрузки в любом случае
596                    that.isReady = true;
597                    that.isLoading = false;
598                    that.$el.classList.remove('cart__loading', 'cart__reloading');
599                }
600            },
601            updateItems: function (method, body) {
602                let that = this;
603
604                that.isLoading = true;
605                that.$el.classList.add('cart__reloading');
606
607                fetch('api/v2/' + method + '/', {
608                    method: "POST",
609                    body: JSON.stringify(body),
610                    headers: {
611                        "content-type": "application/x-www-form-urlencoded",
612                        "X-Requested-With": "XMLHttpRequest"
613                    }
614                })
615                .then(function (response) {
616                    return response.json();
617                })
618                .then(function (response) {
619
620                    if (response.status === 'ok') {
621
622                        window.sela.userUpdate();
623
624                        if (response.data.alert) {
625                            if (typeof response.data.alert === 'string') {
626                                selaAlert(response.data.alert);
627                            } else {
628                                selaAlert(response.data.alert.title, {message: response.data.alert.message});
629                            }
630                        }
631
632                        let change_ids = [];
633                        if (body.id) {
634                            change_ids.push(body.id);
635                        }
636                        else if (body.ids) {
637                            change_ids = body.ids;
638                        }
639
640
641                        if (method === 'del') { // удаление
642
643                            change_ids.forEach(id => {
644
645                                dataLayer.push({
646                                    'event': 'remove_from_cart',
647                                    'ecommerce': {
648                                        'currency': 'RUB',
649                                        'value': that.items[id].price,
650                                        'items': [{
651                                            'item_id': that.items[id].product_id,
652                                            'item_name': that.items[id].name,
653                                            'price': that.items[id].price,
654                                            'quantity': that.items[id].quantity,
655                                            'item_variant': that.items[id].url
656                                        }]
657                                    }
658                                });
659
660                                window.parent.postMessage({
661                                    type: 'APPMETRICA',
662                                    method: 'reportECommerce',
663                                    params: [{
664                                        ecommerceEvent: 'removeCartItemEvent',
665                                        cartItem: {
666                                            product: {
667                                                sku: that.items[id].url,
668                                                name: that.items[id].name,
669                                                actualPrice: {
670                                                    amount: {
671                                                        amount: that.items[id].price,
672                                                        unit: 'RUB'
673                                                    }
674                                                },
675                                            },
676                                            price: {
677                                                amount: {
678                                                    amount: that.items[id].price,
679                                                    unit: 'RUB'
680                                                }
681                                            },
682                                            quantity: that.items[id].quantity,
683                                        }
684                                    }]
685                                }, '*');
686
687                            });
688
689                        }
690                        else if (method === 'update') { // изменение кол-ва
691
692                            if (body?.data?.quantity > 0) {
693
694                                change_ids.forEach(id => {
695
696                                    dataLayer.push({
697                                        'event': body.data.quantity > body.data.quantityOld ? 'add_to_cart' : 'remove_from_cart',
698                                        'ecommerce': {
699                                            'currency': 'RUB',
700                                            'value': that.items[id].price,
701                                            'items': [{
702                                                'item_id': that.items[id].product_id,
703                                                'item_name': that.items[id].name,
704                                                'price': that.items[id].price,
705                                                'quantity': 1,
706                                                'item_variant': that.items[id].url
707                                            }]
708                                        }
709                                    });
710
711                                    window.parent.postMessage({
712                                        type: 'APPMETRICA',
713                                        method: 'reportECommerce',
714                                        params: [{
715                                            ecommerceEvent: body.data.quantity > body.data.quantityOld ? 'addCartItemEvent' : 'removeCartItemEvent',
716                                            cartItem: {
717                                                product: {
718                                                    sku: that.items[id].url,
719                                                    name: that.items[id].name,
720                                                    actualPrice: {
721                                                        amount: {
722                                                            amount: that.items[id].price,
723                                                            unit: 'RUB'
724                                                        }
725                                                    },
726                                                },
727                                                price: {
728                                                    amount: {
729                                                        amount: that.items[id].price,
730                                                        unit: 'RUB'
731                                                    }
732                                                },
733                                                quantity: 1.0,
734                                            }
735                                        }]
736                                    }, '*');
737
738                                });
739
740                            }
741
742                        }
743
744
745
746                        that.items = response.data.items;
747                        that.available = response.data.available;
748                        that.available_sources = response.data.available_sources;
749                        that.unavailable = response.data.unavailable;
750                        that.summary = response.data.summary;
751
752                        that.isLoading = false;
753                        that.$el.classList.remove('cart__reloading');
754
755                        that.$forceUpdate();
756
757                        /*
758                        if (response.data.summary.count.all > 0) {
759                            document.getElementById('header_user_menu_cart').innerHTML = '<span>' + response.data.summary.count.all + '</span>';
760                            document.getElementById('header_user_menu_cart').style.display = 'flex';
761                        }
762                        */
763
764                    }
765                    else {
766
767                        throw new Error(response.errors);
768
769                    }
770
771                })
772                .catch (error => {
773                    console.error(error.message);
774
775                    that.isLoading = false;
776                    that.$el.classList.remove('cart__reloading');
777
778                    selaAlert('Что-то пошло не так');
779                });
780
781            },
782            shareCode: function () {
783                let that = this;
784
785                that.shareUrl = null;
786                that.shareLoad = true;
787
788                that.$refs.sheetShareQr.open();
789
790                fetch('/eshop/cart/share/')
791                .then(function (response) {
792                    return response.json();
793                })
794                .then(data => {
795
796                    that.shareUrl = data.data.url ?? (window.location.href).replace(window.location.search, '').replace(window.location.hash, '');
797                    that.shareLoad = false;
798
799                    that.$nextTick(() => {
800
801                        that.$refs.shareQr.setAttribute('src', TCQrcode.encodeAsBase64({
802                            text: that.shareUrl,
803                            width: 600,
804                            height: 600,
805                            background: '#000000',
806                            foreground: '#ffffff'
807                        }));
808
809                        setTimeout(()=>{
810                            that.$refs.sheetShareQr.updateHeight();
811                        }, 10);
812
813                    });
814
815                })
816                .catch(error => {
817
818                    that.shareUrl = (window.location.href).replace(window.location.search, '').replace(window.location.hash, '');
819                    that.shareLoad = false;
820
821                    that.$nextTick(() => {
822
823                        that.$refs.shareQr.setAttribute('src', TCQrcode.encodeAsBase64({
824                            text: that.shareUrl,
825                            width: 600,
826                            height: 600,
827                            background: '#000000',
828                            foreground: '#ffffff'
829                        }));
830
831                        setTimeout(()=>{
832                            that.$refs.sheetShareQr.updateHeight();
833                        }, 10);
834
835                    });
836
837                });
838
839            },
840            submit: function (number) {
841
842                if (JSON.parse(window.localStorage.getItem('sela_user'))?.user_auth!==!0) {
843
844                    sela.components.sheets.$refs.sheetAuth.open();
845
846                }
847                else {
848
849                    window.parent.postMessage({
850                        type: 'LOAD_START'
851                    }, '*');
852
853                    window.location = '/eshop/checkout2/';
854
855                }
856
857            },
858            upselling: function (item, available) {
859
860                let upsellingTitle = 'Похожие товары';
861
862                if (available) {
863                    if (item.collection === 'Sela HOME') {
864                        upsellingTitle = 'Вся серия';
865                    } else {
866                        upsellingTitle = 'С чем носить';
867                    }
868                }
869
870                window.dataLayer.push({
871                    'event': 'select_content',
872                    'ecommerce': {
873                        'content_type ': 'add_look',
874                        'content_id': available ? (item.collection === 'Sela HOME' ? 'Вся серия' : 'С чем носить') : 'Похожие'
875                    }
876                });
877
878                let urls = item.upselling;
879
880                if (!available) {
881                    if (item.crossselling) {
882                        urls = item.crossselling;
883                    }
884                }
885
886                sela.components.sheets.products.title = upsellingTitle;
887                sela.components.sheets.productsOpen(urls)
888
889            },
890            upsellingToCart(item) {
891                item.load = true;
892                this.isLoading = true
893
894                let params = new URLSearchParams();
895                params.append("sku_id", item.select_sku_id);
896
897                return fetch('/eshop/omni/cart/add/?items=1', {
898                    method: 'POST',
899                    cache: 'no-cache',
900                    credentials: 'include',
901                    headers: {
902                        'Content-Type': 'application/x-www-form-urlencoded',
903                        'X-Requested-With': 'XMLHttpRequest'
904                    },
905                    body: params
906                })
907                .then(response => response.json())
908                .then(response => {
909                    if (response.status === 'ok') {
910                        item.load = false;
911                        this.getItems().then(() => {
912                            this.$refs.sheetUpselling.close();
913                        });
914
915
916                        dataLayer.push({
917                            'event': 'add_to_cart',
918                            'ecommerce': {
919                                'currency': 'RUB',
920                                'value': item.price,
921                                'items': [{
922                                    'item_id': item.id,
923                                    'item_name': item.name,
924                                    'price': item.price,
925                                    'quantity': 1,
926                                    'item_variant': item.product_url
927                                }]
928                            }
929                        });
930
931                        window.parent.postMessage({
932                            type: 'APPMETRICA',
933                            method: 'reportECommerce',
934                            params: [{
935                                ecommerceEvent: 'addCartItemEvent',
936                                cartItem: {
937                                    product: {
938                                        sku: item.product_url,
939                                        name: item.name,
940                                        actualPrice: {
941                                            amount: {
942                                                amount: item.price,
943                                                unit: 'RUB'
944                                            }
945                                        },
946                                    },
947                                    price: {
948                                        amount: {
949                                            amount: item.price,
950                                            unit: 'RUB'
951                                        }
952                                    },
953                                    quantity: 1.0,
954                                }
955                            }]
956                        }, '*');
957
958                    }
959                    else {
960                        throw Error(response.errors);
961                    }
962                })
963                .catch(error => {
964                    item.load = false;
965                    this.isLoading = false;
966                    this.$refs.sheetUpselling.close();
967                });
968
969            },
970            getShareItems(code) {
971
972                this.shareLoad = true;
973
974                fetch('/eshop/cart/share/?code=' + code)
975                .then(response => {
976                    return response.json();
977                })
978                .then(response => {
979                    if (response.status === 'ok') {
980
981                        if (response.data.products.length > 0) {
982
983                            this.$refs.sheetShare.open()
984
985                            this.shareProducts = response.data.products;
986                            this.shareProductsQuantity = response.data.quantity;
987                            this.shareProductsPrice = response.data.price;
988
989                            this.shareLoad = false;
990                            this.$nextTick(() => {
991                                this.$refs.sheetShare.updateHeight();
992                            });
993                        }
994
995                    }
996                    else {
997                        throw Error(response.errors);
998                    }
999                })
1000                .catch(error => {
1001                    console.error(error);
1002                    this.shareLoad = false;
1003                });
1004
1005            },
1006            shareToCart() {
1007                this.isLoading = true
1008                this.shareLoadToCart = true;
1009
1010                const url = new URL(window.location.href);
1011                fetch('/eshop/cart/share/?code=' + url.searchParams.get("share"), {
1012                    method: 'POST',
1013                    cache: 'no-cache',
1014                    credentials: 'include',
1015                    headers: {
1016                        'Content-Type': 'application/x-www-form-urlencoded',
1017                        'X-Requested-With': 'XMLHttpRequest'
1018                    },
1019                })
1020                .then(response => response.json())
1021                .then(response => {
1022                    if (response.status === 'ok') {
1023
1024                        _.forEach(this.shareProducts, item => {
1025
1026                            dataLayer.push({
1027                                'event': 'add_to_cart',
1028                                'ecommerce': {
1029                                    'currency': 'RUB',
1030                                    'items': [{
1031                                        'item_id': item.id,
1032                                        'item_name': item.name,
1033                                        'price': item.price,
1034                                        'quantity': item.quantity,
1035                                        'item_variant': item.product_url
1036                                    }]
1037                                }
1038                            });
1039
1040                            window.parent.postMessage({
1041                                type: 'APPMETRICA',
1042                                method: 'reportECommerce',
1043                                params: [{
1044                                    ecommerceEvent: 'addCartItemEvent',
1045                                    cartItem: {
1046                                        product: {
1047                                            sku: item.product_url,
1048                                            name: item.name,
1049                                            actualPrice: {
1050                                                amount: {
1051                                                    amount: item.price,
1052                                                    unit: 'RUB'
1053                                                }
1054                                            },
1055                                        },
1056                                        price: {
1057                                            amount: {
1058                                                amount: item.price,
1059                                                unit: 'RUB'
1060                                            }
1061                                        },
1062                                        quantity: item.quantity,
1063                                    }
1064                                }]
1065                            }, '*');
1066
1067                        });
1068
1069
1070                        this.getItems().then(() => {
1071                            this.shareLoadToCart = false;
1072                            this.$refs.sheetShare.close();
1073                        })
1074
1075                    }
1076                    else {
1077                        throw Error(response.errors);
1078                    }
1079                })
1080                .catch(error => {
1081                    console.error(error);
1082                    this.isLoading = false;
1083                    this.shareLoadToCart = false;
1084                    this.$refs.sheetUpselling.close();
1085                });
1086
1087            },
1088            freeDeliveryThreshold (oms_settings) {
1089                const region_code = (getCookie('location_city_id') ?? '7700000000000').substring(0, 2).toString();
1090                if (region_code === '77' || region_code === '78') {
1091                    return oms_settings.free_delivery_threshold_msk;
1092                }
1093                return oms_settings.free_delivery_threshold_regions;
1094            }
1095        }
1096    });
1097
1098})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.