Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | <template> <div v-if="bundleProducts" class="border-black mt-5"> <div class="text-uppercase font-weight-bold p-2 w-100 bundle-products-title" > check out this bundle: </div> <div class="p-1"> <div v-for="bundleProduct in bundleProducts" :key="bundleProduct.id" class="border-black p-3" > <h6 style="display: none" class="text-center gold"> {{ bundleProduct.title }} </h6> <p style="display: none" class="text-center"> {{ bundleProduct.description }} </p> <div v-for="(product, index) in bundleProduct.products" :key="product.id + index" class="class" > <div v-if="(index - 1) % 2"> <div v-if="bundleProduct.products[index + 1]" class="row p-2"> <div class="col-5 p-0 d-flex flex-column"> <div class="m-auto p-2"> <PreloaderImage :classStyle="'m-auto'" :image="bundleProduct.products[index + 1].image[0].url" /> </div> <div class="d-flex flex-column justify-content-between mt-3"> <span class="font-weight-light text-center gold" v-html=" colorTitleNumbers( bundleProduct.products[index + 1].title, 'col-black' ) " > </span> <span class="font-weight-light text-center col-black"> ${{ bundleProduct.products[index + 1].price | formatNumber }} </span> </div> </div> <div class=" wrap-plus col-2 p-0 mx-auto d-flex align-items-center justify-content-center " > <p class="text-center plus">+</p> </div> <div class="col-5 p-0 d-flex flex-column"> <div class="m-auto p-2"> <PreloaderImage :classStyle="'m-auto'" :image="bundleProduct.products[index].image[0].url" /> </div> <div class="d-flex flex-column justify-content-between mt-3"> <span class="font-weight-light text-center gold" v-html=" colorTitleNumbers( bundleProduct.products[index].title, 'col-black' ) " > </span> <span class="font-weight-light text-center col-black"> ${{ bundleProduct.products[index].price | formatNumber }} </span> </div> </div> </div> <div v-else class="d-flex justify-content-center"> <div class="col-5 p-0 d-flex flex-column"> <div class="m-auto p-2"> <PreloaderImage :classStyle="'m-auto'" :image="bundleProduct.products[index].image[0].url" /> </div> <div class="d-flex flex-column justify-content-between mt-3"> <span class="font-weight-light text-center color-blue" v-html=" colorTitleNumbers( bundleProduct.products[index].title, 'col-black' ) " > </span> <span class="font-weight-light text-center col-black"> ${{ bundleProduct.products[index].price | formatNumber }} </span> </div> </div> </div> </div> </div> <div class="mt-4 d-flex flex-column"> <p class="text-uppercase font-weight-bold text-center m-0"> bundle price: ${{ bundleProduct.price }} </p> <p class="text-center"> You save: $ {{ bundleProduct.products.reduce( (prVal, curVal) => prVal + curVal.price, 0 ) - bundleProduct.price }}! </p> <button v-if="product.status === 'published'" class=" py-2 px-4 rounded btn btn-dark d-flex justify-content-center align-items-center text-uppercase text-nowrap add-cart-button " v-on:click="addToCart(bundleProduct)" > <span class="icon icon-bag mr-2 d-none d-lg-flex"></span> Add to cart </button> </div> </div> </div> </div> </template> <script> import { mapActions } from "vuex"; import { colorTitleNumbers } from "~/helpers"; import PreloaderImage from "~/components/PreloaderImage"; export default { name: "BundleProducts", props: { product: Object, }, components: { PreloaderImage }, data: () => ({ bundleProducts: null, }), methods: { colorTitleNumbers, ...mapActions({ addBundle: "order/addBundle", }), addToCart(bundle) { this.addBundle(bundle); }, }, async mounted() { try { const result = await this.$strapi.$bundles.findOne( this.product.bundle.id ); this.bundleProducts = [result]; this.bundleProducts = this.bundleProducts.map((item) => { item.products.length = 2; return item; }); } catch (error) {} }, }; </script> <style csoped> .border-black { border: 1px solid #ccc; border-radius: 4px; } .color-blue { color: #42b4e4; } .wrap-plus { margin-top: -60px; } .plus { font-size: 2rem; font-weight: bold; } .bundle-products-title { background-color: #f5f5f5; border-radius: 4px 4px 0 0; } .add-cart-button { background-color: #1f2020; color: #fff; } .icon-bag { width: 14px; height: 14px; background-image: url("../../assets/icons/shopping-bag.svg"); filter: invert(98%) sepia(98%) saturate(0%) hue-rotate(326deg) brightness(103%) contrast(102%); } </style> |