752 lines
35 KiB
JavaScript
752 lines
35 KiB
JavaScript
import { defineComponent, ref, reactive, computed, withAsyncContext, resolveDirective, unref, mergeProps, withCtx, createVNode, createBlock, openBlock, withDirectives, Fragment, renderList, watch, createTextVNode, toDisplayString, useSSRContext } from 'vue';
|
|
import { ssrRenderComponent, ssrRenderAttrs, ssrInterpolate, ssrGetDirectiveProps, ssrRenderAttr, ssrRenderList, ssrRenderClass } from 'vue/server-renderer';
|
|
import { u as useRouter$1, a as useConfigStore, t as useCartStore, b as useUserStore, aw as getOneProduct, q as __nuxt_component_0, C as getSupabaseStorageUrl, E as APP_TYPE, G as Badge, D as reactiveProjectName, ae as useProduct, j as __nuxt_component_1$3, aq as Tag, ac as __nuxt_component_4 } from './server.mjs';
|
|
import { _ as _imports_0, a as _imports_1 } from './cart-DMkYna66.mjs';
|
|
import { B as BasicIconOld } from './BasicIconOld-93vAWohq.mjs';
|
|
import { i as img_gif } from './post_loading-BiySI7bp.mjs';
|
|
import { Swiper, SwiperSlide } from 'swiper/vue';
|
|
import { Zoom, Navigation, Pagination } from 'swiper/modules';
|
|
import { e as empty_user } from './empty_user-BaUNCdgf.mjs';
|
|
import { cloneDeep } from 'lodash-es';
|
|
import { u as usePrice } from './usePrice-B-5-jXKQ.mjs';
|
|
import { B as BasicSelect } from './BasicSelect-DMW6tJJc.mjs';
|
|
import { _ as _sfc_main$6, a as _sfc_main$7$1, b as _sfc_main$5$1, e as _sfc_main$6$1, C as CommentAddEdit } from './moreOptionProduct-N01tC6Zc.mjs';
|
|
import { _ as _sfc_main$7 } from './like-BhIOg3YL.mjs';
|
|
import { u as useAsyncData } from './asyncData-BzPAimvL.mjs';
|
|
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
|
|
import '../_/nitro.mjs';
|
|
import 'node:http';
|
|
import 'node:https';
|
|
import 'node:events';
|
|
import 'node:buffer';
|
|
import 'node:fs';
|
|
import 'node:url';
|
|
import 'consola';
|
|
import 'ipx';
|
|
import 'node:path';
|
|
import 'node:crypto';
|
|
import 'pinia';
|
|
import '@supabase/supabase-js';
|
|
import '@babel/runtime/helpers/esm/extends';
|
|
import '@babel/runtime/helpers/esm/objectSpread2';
|
|
import '@ant-design/colors';
|
|
import '@ctrl/tinycolor';
|
|
import 'stylis';
|
|
import 'vue-types';
|
|
import 'axios';
|
|
import '@ant-design/icons-vue';
|
|
import 'resize-observer-polyfill';
|
|
import 'dom-align';
|
|
import 'lodash-es/uniq.js';
|
|
import 'lodash-es/pick.js';
|
|
import 'lodash-es/isPlainObject.js';
|
|
import 'lodash-es/debounce.js';
|
|
import 'lodash-es/cloneDeep.js';
|
|
import 'async-validator';
|
|
import 'lodash-es/find.js';
|
|
import 'lodash-es/isEqual.js';
|
|
import 'compute-scroll-into-view';
|
|
import 'lodash-es/intersection.js';
|
|
import 'lodash-es/omit.js';
|
|
import 'lodash-es/isNumber.js';
|
|
import 'throttle-debounce';
|
|
import 'lodash-es/fromPairs.js';
|
|
import 'lodash-es/partition.js';
|
|
import '../routes/renderer.mjs';
|
|
import 'vue-bundle-renderer/runtime';
|
|
import 'unhead/server';
|
|
import 'devalue';
|
|
import 'unhead/utils';
|
|
import './index-CM92jef_.mjs';
|
|
import '@vueuse/gesture';
|
|
import '@headlessui/vue';
|
|
import 'framesync';
|
|
import 'popmotion';
|
|
import 'style-value-types';
|
|
import './UserProfilePic-CmaGJi8K.mjs';
|
|
import './BasicButton-B9iMRxfW.mjs';
|
|
import './useDateTime-D8RCoGwW.mjs';
|
|
import 'moment';
|
|
import 'moment-timezone';
|
|
import 'moment-jalaali';
|
|
import 'date-fns';
|
|
import 'date-fns/locale';
|
|
import 'vue-content-loader';
|
|
import './product-EzgZgQkP.mjs';
|
|
import './handle-B6YUQ-uU.mjs';
|
|
|
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
__name: "ProductInf",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
inf: {}
|
|
},
|
|
setup(__props) {
|
|
const props = __props;
|
|
useRouter$1();
|
|
const config = useConfigStore();
|
|
const userStore = useUserStore();
|
|
const _product = computed(() => {
|
|
return useProduct(props.inf, variantSelected.value);
|
|
});
|
|
useCartStore();
|
|
const variantPrice = ref(0);
|
|
const variantPriceWithDiscount = ref(0);
|
|
const variantStock = ref(0);
|
|
const variantSelected = ref(void 0);
|
|
const variantAllSelected = ref(false);
|
|
computed(() => {
|
|
return (_product.value.priceWithDiscount.value && _product.value.price.value) <= 0 ? 0 : (100 - (_product.value.priceWithDiscount.value ?? 0) * 100 / (_product.value.price.value ?? 0)).toFixed(0);
|
|
});
|
|
computed(() => {
|
|
return (variantPriceWithDiscount.value && variantPrice.value) <= 0 ? 0 : (100 - (variantPriceWithDiscount.value ?? 0) * 100 / (variantPrice.value ?? 0)).toFixed(0);
|
|
});
|
|
computed(() => {
|
|
let available = false;
|
|
if (props.inf?.type === "variant") {
|
|
if (variantStock.value > 0) {
|
|
available = true;
|
|
}
|
|
} else {
|
|
if (props?.inf?.count > 0) {
|
|
available = true;
|
|
}
|
|
}
|
|
return available;
|
|
});
|
|
computed(() => {
|
|
return _product.value?.attributesUsedInVariants?.value ?? [];
|
|
});
|
|
const variantsAttrsToShow = ref([]);
|
|
const variantsSelected = ref([]);
|
|
const variantsAttrsToShowPrimary = ref([]);
|
|
let wholeVariantsArrayHasThisVal;
|
|
const lastIndex = ref(-1);
|
|
function doNullValue(index) {
|
|
for (let i = index; i < variantsSelected.value.length; i++) {
|
|
variantsSelected.value[i].selected_variant = void 0;
|
|
}
|
|
}
|
|
watch(variantsSelected, () => {
|
|
handleChange();
|
|
}, { deep: true });
|
|
function checkPrice() {
|
|
let isFull = true;
|
|
variantsSelected.value.every((x, index) => {
|
|
if (variantsAttrsToShow.value[index].attribute_values_arr?.length != 0 && !x?.selected_variant) {
|
|
isFull = false;
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
});
|
|
if (isFull) {
|
|
_product.value.variants.value?.forEach((x) => {
|
|
let isEqual = true;
|
|
x.variant_attribute_values?.forEach((y, index) => {
|
|
if (!variantsSelected.value.some((val) => val.selected_variant == y.attribute_values.id)) {
|
|
isEqual = false;
|
|
}
|
|
});
|
|
if (isEqual) {
|
|
variantPrice.value = x.price;
|
|
variantPriceWithDiscount.value = x.price_with_discount;
|
|
variantStock.value = x.stock;
|
|
variantSelected.value = x;
|
|
variantAllSelected.value = true;
|
|
}
|
|
});
|
|
} else {
|
|
variantPrice.value = 0;
|
|
variantPriceWithDiscount.value = 0;
|
|
variantStock.value = 0;
|
|
variantSelected.value = void 0;
|
|
variantAllSelected.value = false;
|
|
}
|
|
}
|
|
function variantsArrayHasThisVal(val) {
|
|
const oldWholeVariantsArrayHasThisVal = cloneDeep(wholeVariantsArrayHasThisVal);
|
|
wholeVariantsArrayHasThisVal = oldWholeVariantsArrayHasThisVal?.filter((z) => z.variant_attribute_values?.some((j) => j.attribute_values.id === val));
|
|
}
|
|
function handleChange(val, index) {
|
|
variantsAttrsToShowPrimary.value.push(variantsAttrsToShow.value);
|
|
wholeVariantsArrayHasThisVal = cloneDeep(_product.value.variants.value);
|
|
variantsAttrsToShow.value.forEach((x) => {
|
|
const itemSelected = variantsSelected.value.find((y) => y.attribute_id == x.attribute_id)?.selected_variant;
|
|
if (itemSelected) {
|
|
lastIndex.value++;
|
|
variantsArrayHasThisVal(itemSelected);
|
|
}
|
|
variantsAttrsToShow.value.forEach((x2) => {
|
|
if (x2.attribute_id !== val?.attribute_id) {
|
|
x2.attribute_values_arr = [];
|
|
x2.attribute_values = [];
|
|
wholeVariantsArrayHasThisVal?.forEach((y) => {
|
|
y?.variant_attribute_values?.forEach((z) => {
|
|
if (z.attribute_values.attributes.id === x2.attribute_id && !x2.attribute_values?.includes(z.attribute_values.id)) {
|
|
x2.attribute_values_arr?.push({
|
|
attribute_id: z.attribute_values.attributes.id,
|
|
id: z.attribute_values.id,
|
|
value: z.attribute_values.value
|
|
});
|
|
x2.attribute_values?.push(z.attribute_values.id);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|
|
});
|
|
checkPrice();
|
|
}
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_ClientOnly = __nuxt_component_0;
|
|
const _component_AFormItem = __nuxt_component_1$3;
|
|
_push(`<div${ssrRenderAttrs(_attrs)}><div class="mx-4 mt-5"><div class="font-bold text-lg">${ssrInterpolate(_product.value.title)}</div><div class="flex justify-between items-center w-full gap-5 mt-3"><div class="flex gap-4"><div class="items-center gap-1 flex md:hidden"><div class="font-semibold text-xl">${ssrInterpolate(unref(usePrice)(_product.value.price.value ?? 0, true, ""))}</div><div>${ssrInterpolate(unref(config).priceUnit)}</div></div>`);
|
|
if (_product.value.hasDiscount.value) {
|
|
_push(`<div class="flex items-center gap-1"><div class="slanted-strike text-xs">${ssrInterpolate(unref(usePrice)(_product.value?.originalPrice.value ?? 0, true, ""))}</div><div class="mr-1 text-xs">${ssrInterpolate(unref(config).priceUnit)}</div><div class="mr-2 text-xs bg-primary text-white px-2 py-1px rounded">${ssrInterpolate(_product.value?.discountPercent?.value)}% </div></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div></div>`);
|
|
_push(ssrRenderComponent(_component_ClientOnly, null, {}, _parent));
|
|
if (_ctx.inf?.type === "variant" && variantsAttrsToShow.value.length > 0 && _ctx.inf.owner_id !== unref(userStore).user?.id && (("APP_TYPE" in _ctx ? _ctx.APP_TYPE : unref(APP_TYPE)) === "single" && !unref(config).isSeller || ("APP_TYPE" in _ctx ? _ctx.APP_TYPE : unref(APP_TYPE)) === "multi")) {
|
|
_push(`<div class="w-full mt5"><!--[-->`);
|
|
ssrRenderList(variantsAttrsToShow.value, (val, index) => {
|
|
_push(`<div class="w-full">`);
|
|
if (val.attribute_values_arr.length != 0 && (index == 0 ? true : variantsSelected.value[index - 1].selected_variant)) {
|
|
_push(`<div class="flex py-1">`);
|
|
_push(ssrRenderComponent(_component_AFormItem, {
|
|
label: val.attribute?.name,
|
|
class: "flex-1 attrCustomCss"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(ssrRenderComponent(BasicSelect, {
|
|
items: val.attribute_values_arr,
|
|
showSearch: false,
|
|
placeholder: unref(config).useString("pleaseSelectAnOption"),
|
|
value: variantsSelected.value[index].selected_variant,
|
|
"onUpdate:value": ($event) => variantsSelected.value[index].selected_variant = $event,
|
|
onChange: ($event) => handleChange($event),
|
|
"key-name": "id",
|
|
"allow-clear": false,
|
|
"value-name": "value",
|
|
class: "attrCustomCss"
|
|
}, null, _parent2, _scopeId));
|
|
} else {
|
|
return [
|
|
createVNode(BasicSelect, {
|
|
items: val.attribute_values_arr,
|
|
showSearch: false,
|
|
placeholder: unref(config).useString("pleaseSelectAnOption"),
|
|
value: variantsSelected.value[index].selected_variant,
|
|
"onUpdate:value": ($event) => variantsSelected.value[index].selected_variant = $event,
|
|
onChange: ($event) => handleChange($event),
|
|
"key-name": "id",
|
|
"allow-clear": false,
|
|
"value-name": "value",
|
|
class: "attrCustomCss"
|
|
}, null, 8, ["items", "placeholder", "value", "onUpdate:value", "onChange"])
|
|
];
|
|
}
|
|
}),
|
|
_: 2
|
|
}, _parent));
|
|
_push(`<div class="relative flex-self-end mb10px"><div class="${ssrRenderClass([variantsSelected.value[index].selected_variant ? "cursor-pointer border-red" : "cursor-not-allowed border-gray-3", "border-2px border-solid border-1 rounded-e-lg p-2px bg-gray-50"])}">`);
|
|
_push(ssrRenderComponent(BasicIconOld, {
|
|
icon: "vuesax-linear:add",
|
|
color: variantsSelected.value[index]?.selected_variant ? "red" : "gray",
|
|
class: [variantsSelected.value[index]?.selected_variant ? "cursor-pointer" : "cursor-not-allowed", "rotate-45"],
|
|
onClick: () => {
|
|
variantsSelected.value[index].selected_variant = void 0;
|
|
doNullValue(index);
|
|
}
|
|
}, null, _parent));
|
|
_push(`</div></div></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div>`);
|
|
});
|
|
_push(`<!--]--></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (_ctx.inf.owner_id !== unref(userStore).user?.id) {
|
|
_push(`<div class="text-gray-6 mt-3 text-xs text-center px-1">${ssrInterpolate(unref(config).useString("addToCartWillPlaceYourOrderIntoCartAndYouCanCompleteOrderInCartMenu"))}</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div></div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$5 = _sfc_main$5.setup;
|
|
_sfc_main$5.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/product/components/ProductInf.vue");
|
|
return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
|
|
};
|
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
__name: "ProductDetail",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
attrs: {},
|
|
description: {},
|
|
category: {},
|
|
brand: {},
|
|
weight: {},
|
|
fee: {}
|
|
},
|
|
setup(__props) {
|
|
const props = __props;
|
|
const config = useConfigStore();
|
|
const filteredParams = computed(() => {
|
|
return props.attrs?.filter((x) => x.use_in_product_page) || [];
|
|
});
|
|
const showAll = ref(false);
|
|
const visibleParams = computed(() => {
|
|
return showAll.value ? filteredParams.value : filteredParams.value.slice(0, 1);
|
|
});
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_ATag = Tag;
|
|
const _component_ClientOnly = __nuxt_component_0;
|
|
const _component_a_divider = __nuxt_component_4;
|
|
if (filteredParams.value?.length > 0 || _ctx.description || _ctx.weight || _ctx.fee) {
|
|
_push(`<div${ssrRenderAttrs(mergeProps({ class: "rounded-xl md:overflow-y-auto mt-5 md:mt-0 md:flex-1 max-h-30rem md:max-h-unset mx-4" }, _attrs))}><div class="font-bold text-lg">${ssrInterpolate(unref(config).useString("aboutProduct"))}</div>`);
|
|
if (filteredParams.value?.length > 0 || _ctx.weight || _ctx.fee || _ctx.category) {
|
|
_push(`<!--[-->`);
|
|
if (_ctx.category?.title) {
|
|
_push(`<div class="flex mt-3 items-center gap-2"><div class="bg-emerald-950 w-2 h-2 rounded-full"></div><div class="flex gap-3 items-center md:text-base text-sm"><div class="text-gray-400 font-semibold text-xs">${ssrInterpolate(unref(config).useString("category"))}:</div><div class="flex mr-2 justify-center items-center gap-1 text-xs">${ssrInterpolate(_ctx.category?.title)}</div></div></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (_ctx.brand?.title) {
|
|
_push(`<div class="flex mt-3 items-center gap-2"><div class="bg-emerald-950 w-2 h-2 rounded-full"></div><div class="flex gap-3 items-center md:text-base text-sm"><div class="text-gray-400 font-semibold text-xs">${ssrInterpolate(unref(config).useString("brands"))}:</div><div class="flex mr-2 justify-center items-center gap-1 text-xs">${ssrInterpolate(_ctx.brand?.title)}</div></div></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (_ctx.category?.id === 1 || _ctx.category?.id === 2) {
|
|
_push(`<div class="flex mt-3 items-center gap-2"><div class="bg-emerald-950 w-2 h-2 rounded-full"></div><div class="flex gap-3 items-center md:text-base text-sm"><div class="text-gray-400 font-semibold text-xs">${ssrInterpolate(unref(config).useString("weight"))}:</div><div class="flex mr-2 justify-center items-center gap-1 text-xs">${ssrInterpolate(_ctx.weight)} ${ssrInterpolate(unref(config).useString("gram"))}</div></div></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (_ctx.category?.id === 1 || _ctx.category?.id === 2) {
|
|
_push(`<div class="flex mt-3 items-center gap-2"><div class="bg-emerald-950 w-2 h-2 rounded-full"></div><div class="flex gap-3 items-center md:text-base text-sm"><div class="text-gray-400 font-semibold text-xs">${ssrInterpolate(unref(config).useString("percentFee"))}:</div><div class="flex mr-2 justify-center items-center gap-1 text-xs">${ssrInterpolate(_ctx.fee)} % </div></div></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<!--[-->`);
|
|
ssrRenderList(visibleParams.value, (item, index) => {
|
|
_push(`<div class="flex mt-3 items-center gap-2"><div class="bg-emerald-950 w-2 h-2 rounded-full"></div><div class="flex gap-3 items-center md:text-base text-sm"><div class="text-gray-400 font-semibold text-xs">${ssrInterpolate(item.attributes?.name)}:</div><div class="flex mr-2 justify-center items-center gap-1 text-xs"><!--[-->`);
|
|
ssrRenderList(item?.attribute_values_arr, (val, i) => {
|
|
_push(ssrRenderComponent(_component_ATag, {
|
|
key: i,
|
|
class: "text-gray-400 p2px"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`${ssrInterpolate(val.value)}`);
|
|
} else {
|
|
return [
|
|
createTextVNode(toDisplayString(val.value), 1)
|
|
];
|
|
}
|
|
}),
|
|
_: 2
|
|
}, _parent));
|
|
});
|
|
_push(`<!--]--></div></div></div>`);
|
|
});
|
|
_push(`<!--]-->`);
|
|
_push(ssrRenderComponent(_component_ClientOnly, null, {}, _parent));
|
|
_push(`<!--]-->`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (_ctx.description) {
|
|
_push(`<!--[-->`);
|
|
if (filteredParams.value?.length > 0) {
|
|
_push(ssrRenderComponent(_component_a_divider, null, null, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<div class="mt-2 text-justify text-caption whitespace-pre-line">${ssrInterpolate(_ctx.description)}</div><!--]-->`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$4 = _sfc_main$4.setup;
|
|
_sfc_main$4.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/product/components/ProductDetail.vue");
|
|
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
|
|
};
|
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
__name: "ProductSeller",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
seller: {}
|
|
},
|
|
setup(__props) {
|
|
const config = useConfigStore();
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _directive_lazy = resolveDirective("lazy");
|
|
let _temp0;
|
|
_push(`<div${ssrRenderAttrs(mergeProps({ class: "mx-4 mt-5" }, _attrs))}><div class="font-bold text-lg">${ssrInterpolate(unref(config).useString("aboutSeller"))}</div><div class="mt-3 flex"><img${ssrRenderAttrs(_temp0 = mergeProps({
|
|
class: "w-4rem h-4rem rounded-full border-1 border-solid border-gray",
|
|
alt: "instagram"
|
|
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(getSupabaseStorageUrl)(_ctx.seller?.avatar), loading: unref(empty_user), error: unref(empty_user) })))}>${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}<div class="ms-5 w-full"><div class="text-sm font-bold">${ssrInterpolate(_ctx.seller?.name)}</div><div class="text-gray-6 truncate text-xs w-7/8 mt-1">${ssrInterpolate(_ctx.seller?.bio)}</div><div class="text-xs text-gray-6 font-bold mt-1">${ssrInterpolate(unref(config).useString("followedByNUsers", _ctx.seller?.stats?.total_customer))}</div></div></div></div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$3 = _sfc_main$3.setup;
|
|
_sfc_main$3.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/product/components/ProductSeller.vue");
|
|
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
|
|
};
|
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
__name: "likeSaveComment",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
product: {}
|
|
},
|
|
emits: ["update:product"],
|
|
setup(__props, { emit: __emit }) {
|
|
const emits = __emit;
|
|
const props = __props;
|
|
useConfigStore();
|
|
const user = useUserStore();
|
|
useRouter$1();
|
|
const addFunctionLoading = ref(false);
|
|
const commentPostId = ref();
|
|
const commentVisible = ref(false);
|
|
const post = computed({
|
|
get() {
|
|
return props.product;
|
|
},
|
|
set(val) {
|
|
emits("update:product", val);
|
|
}
|
|
});
|
|
function addCommentId(id) {
|
|
post.value.comments.push({ id });
|
|
}
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(`<div${ssrRenderAttrs(mergeProps({ class: "flex gap-4 items-center justify-between" }, _attrs))}><div class="flex items-center gap-4"><div class="flex items-center gap-1"${ssrRenderAttr("aria-disabled", addFunctionLoading.value)}>`);
|
|
_push(ssrRenderComponent(_sfc_main$7, {
|
|
"is-liked": unref(post).likes?.some((x) => x.user_id === unref(user).user?.id)
|
|
}, null, _parent));
|
|
_push(` ${ssrInterpolate(unref(post)?.likes?.length ?? 0)}</div><div class="flex items-center gap-1">`);
|
|
_push(ssrRenderComponent(_sfc_main$7$1, null, null, _parent));
|
|
_push(` ${ssrInterpolate(unref(post)?.comments?.length ?? 0)}</div><div class="flex items-center gap-1">`);
|
|
_push(ssrRenderComponent(_sfc_main$5$1, null, null, _parent));
|
|
_push(`</div></div><div>`);
|
|
_push(ssrRenderComponent(_sfc_main$6$1, {
|
|
"is-saved": unref(post).saved?.some((x) => x.user_id === unref(user).user?.id)
|
|
}, null, _parent));
|
|
_push(`</div>`);
|
|
_push(ssrRenderComponent(CommentAddEdit, {
|
|
id: commentPostId.value,
|
|
open: commentVisible.value,
|
|
"onUpdate:open": ($event) => commentVisible.value = $event,
|
|
onAddCommentId: addCommentId
|
|
}, null, _parent));
|
|
_push(`</div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$2 = _sfc_main$2.setup;
|
|
_sfc_main$2.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/product/components/likeSaveComment.vue");
|
|
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
|
|
};
|
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
__name: "index",
|
|
__ssrInlineRender: true,
|
|
async setup(__props) {
|
|
let __temp, __restore;
|
|
const router = useRouter$1();
|
|
const stateNextButton = ref(true);
|
|
const statePreButton = ref(false);
|
|
ref(false);
|
|
const images = ref([]);
|
|
const modules = [Zoom, Navigation, Pagination];
|
|
const config = useConfigStore();
|
|
const cartStore = useCartStore();
|
|
const userStore = useUserStore();
|
|
reactive({
|
|
visible: false,
|
|
position: 0
|
|
});
|
|
const optionVisible = ref(false);
|
|
const optionPostId = ref();
|
|
const id = computed(() => router.currentRoute.value.params.id);
|
|
function openOption(id2) {
|
|
optionPostId.value = id2;
|
|
optionVisible.value = true;
|
|
}
|
|
const { data } = ([__temp, __restore] = withAsyncContext(async () => useAsyncData("product", async () => {
|
|
return (await getOneProduct(id.value ?? "")).product;
|
|
})), __temp = await __temp, __restore(), __temp);
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_ClientOnly = __nuxt_component_0;
|
|
const _component_a_badge = Badge;
|
|
const _directive_lazy = resolveDirective("lazy");
|
|
let _temp0, _temp1;
|
|
_push(`<div${ssrRenderAttrs(_attrs)} data-v-73faf474><div class="absolute top-0 w-inherit right-0 left-0" data-v-73faf474><div class="flex justify-between items-center w-full p4" data-v-73faf474><div class="flex items-center gap-2" data-v-73faf474>`);
|
|
_push(ssrRenderComponent(_component_ClientOnly, null, {}, _parent));
|
|
if (unref(data)) {
|
|
_push(`<div class="font-semibold flex items-center gap-3" data-v-73faf474><img${ssrRenderAttrs(_temp0 = mergeProps({
|
|
alt: "instagram",
|
|
class: "rounded-full w-2rem h-2rem"
|
|
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(getSupabaseStorageUrl)(unref(data)?.users?.avatar), loading: unref(empty_user), error: unref(empty_user) })))} data-v-73faf474>${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""} ${ssrInterpolate(unref(data)?.users?.name)}</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div>`);
|
|
if (unref(data)) {
|
|
_push(`<div class="flex items-center gap-8px" data-v-73faf474>`);
|
|
if (unref(config).isSeller && ("APP_TYPE" in _ctx ? _ctx.APP_TYPE : unref(APP_TYPE)) === "multi") {
|
|
_push(ssrRenderComponent(_component_a_badge, {
|
|
count: unref(cartStore).count,
|
|
dir: "ltr"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<div data-v-73faf474${_scopeId}>`);
|
|
if (unref(config).isNightStore) {
|
|
_push2(`<img${ssrRenderAttr("src", _imports_0)} class="w-1.8rem -mt1" alt="" data-v-73faf474${_scopeId}>`);
|
|
} else {
|
|
_push2(`<img${ssrRenderAttr("src", _imports_1)}${ssrRenderAttr("alt", unref(reactiveProjectName))} class="w-1.8rem -mt1" data-v-73faf474${_scopeId}>`);
|
|
}
|
|
_push2(`</div>`);
|
|
} else {
|
|
return [
|
|
createVNode("div", {
|
|
onClick: ($event) => unref(router).push({ name: "cart" })
|
|
}, [
|
|
unref(config).isNightStore ? (openBlock(), createBlock("img", {
|
|
key: 0,
|
|
src: _imports_0,
|
|
class: "w-1.8rem -mt1",
|
|
alt: ""
|
|
})) : (openBlock(), createBlock("img", {
|
|
key: 1,
|
|
src: _imports_1,
|
|
alt: unref(reactiveProjectName),
|
|
class: "w-1.8rem -mt1"
|
|
}, null, 8, ["alt"]))
|
|
], 8, ["onClick"])
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (unref(userStore).user?.id === unref(data).owner_id) {
|
|
_push(ssrRenderComponent(BasicIconOld, {
|
|
icon: "vuesax-linear:more",
|
|
class: "rotate-90",
|
|
size: "24",
|
|
onClick: ($event) => openOption(id.value)
|
|
}, null, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div><div class="h-90vh overflow-y-auto pb-10vh" data-v-73faf474>`);
|
|
if (images.value) {
|
|
_push(ssrRenderComponent(unref(Swiper), {
|
|
class: "!flex !flex-row !gab-15 md:mt-2",
|
|
"slides-per-view": 1,
|
|
freeMode: false,
|
|
watchSlidesProgress: true,
|
|
loop: true,
|
|
"space-between": 0,
|
|
modules,
|
|
pagination: { el: ".custom-pagination", clickable: true },
|
|
zoom: true,
|
|
navigation: {
|
|
nextEl: ".goCategoryNext",
|
|
prevEl: ".goCategoryBack"
|
|
},
|
|
onReachEnd: () => {
|
|
statePreButton.value = true;
|
|
},
|
|
onReachBeginning: () => {
|
|
stateNextButton.value = true;
|
|
},
|
|
onFromEdge: () => {
|
|
stateNextButton.value = false;
|
|
statePreButton.value = false;
|
|
}
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<!--[-->`);
|
|
ssrRenderList(images.value, (item) => {
|
|
_push2(ssrRenderComponent(unref(SwiperSlide), null, {
|
|
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
if (_push3) {
|
|
_push3(`<div class="swiper-zoom-container" data-v-73faf474${_scopeId2}>`);
|
|
if (item.type === "video") {
|
|
_push3(`<div class="video-container" data-v-73faf474${_scopeId2}><video${ssrRenderAttr("src", unref(getSupabaseStorageUrl)(item.url))} playsinline muted loop class="video" data-v-73faf474${_scopeId2}></video></div>`);
|
|
} else {
|
|
_push3(`<div class="w-full aspect-square flex items-center" data-v-73faf474${_scopeId2}><img${ssrRenderAttrs(_temp1 = mergeProps({
|
|
alt: unref(reactiveProjectName),
|
|
class: "w-full h-full object-contain"
|
|
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(getSupabaseStorageUrl)(item.url), loading: unref(img_gif), error: unref(img_gif) })))} data-v-73faf474${_scopeId2}>${"textContent" in _temp1 ? ssrInterpolate(_temp1.textContent) : _temp1.innerHTML ?? ""}</div>`);
|
|
}
|
|
_push3(`</div>`);
|
|
} else {
|
|
return [
|
|
createVNode("div", { class: "swiper-zoom-container" }, [
|
|
item.type === "video" ? (openBlock(), createBlock("div", {
|
|
key: 0,
|
|
class: "video-container"
|
|
}, [
|
|
createVNode("video", {
|
|
ref_for: true,
|
|
ref: "videos",
|
|
src: unref(getSupabaseStorageUrl)(item.url),
|
|
playsinline: "",
|
|
muted: "",
|
|
loop: "",
|
|
class: "video"
|
|
}, null, 8, ["src"])
|
|
])) : (openBlock(), createBlock("div", {
|
|
key: 1,
|
|
class: "w-full aspect-square flex items-center"
|
|
}, [
|
|
withDirectives(createVNode("img", {
|
|
alt: unref(reactiveProjectName),
|
|
class: "w-full h-full object-contain"
|
|
}, null, 8, ["alt"]), [
|
|
[_directive_lazy, { src: unref(getSupabaseStorageUrl)(item.url), loading: unref(img_gif), error: unref(img_gif) }]
|
|
])
|
|
]))
|
|
])
|
|
];
|
|
}
|
|
}),
|
|
_: 2
|
|
}, _parent2, _scopeId));
|
|
});
|
|
_push2(`<!--]-->`);
|
|
} else {
|
|
return [
|
|
(openBlock(true), createBlock(Fragment, null, renderList(images.value, (item) => {
|
|
return openBlock(), createBlock(unref(SwiperSlide), null, {
|
|
default: withCtx(() => [
|
|
createVNode("div", { class: "swiper-zoom-container" }, [
|
|
item.type === "video" ? (openBlock(), createBlock("div", {
|
|
key: 0,
|
|
class: "video-container"
|
|
}, [
|
|
createVNode("video", {
|
|
ref_for: true,
|
|
ref: "videos",
|
|
src: unref(getSupabaseStorageUrl)(item.url),
|
|
playsinline: "",
|
|
muted: "",
|
|
loop: "",
|
|
class: "video"
|
|
}, null, 8, ["src"])
|
|
])) : (openBlock(), createBlock("div", {
|
|
key: 1,
|
|
class: "w-full aspect-square flex items-center"
|
|
}, [
|
|
withDirectives(createVNode("img", {
|
|
alt: unref(reactiveProjectName),
|
|
class: "w-full h-full object-contain"
|
|
}, null, 8, ["alt"]), [
|
|
[_directive_lazy, { src: unref(getSupabaseStorageUrl)(item.url), loading: unref(img_gif), error: unref(img_gif) }]
|
|
])
|
|
]))
|
|
])
|
|
]),
|
|
_: 2
|
|
}, 1024);
|
|
}), 256))
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<div class="custom-pagination relative py-2 -mt-6 z-1000" data-v-73faf474></div>`);
|
|
_push(ssrRenderComponent(_sfc_main$2, {
|
|
product: unref(data),
|
|
class: "px-4"
|
|
}, null, _parent));
|
|
_push(ssrRenderComponent(_sfc_main$5, { inf: unref(data) }, null, _parent));
|
|
_push(`<div class="${ssrRenderClass([unref(config).isNightStore ? "bg-zinc-9" : "bg-gray-100", "h-2 mt-5 w-full bg-gray-100"])}" data-v-73faf474></div>`);
|
|
_push(ssrRenderComponent(_sfc_main$4, {
|
|
class: "md:w-full",
|
|
brand: unref(data)?.brands,
|
|
category: unref(data)?.collections,
|
|
attrs: unref(data)?.product_attributes,
|
|
description: unref(data)?.description,
|
|
weight: unref(data)?.weight,
|
|
fee: unref(data)?.percent_fee
|
|
}, null, _parent));
|
|
if (unref(data)?.product_attributes?.filter((x) => x.use_in_product_page) || unref(data)?.description) {
|
|
_push(`<div class="${ssrRenderClass([unref(config).isNightStore ? "bg-zinc-9" : "bg-gray-100", "h-2 mt-5 w-full bg-gray-100"])}" data-v-73faf474></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(ssrRenderComponent(_sfc_main$3, {
|
|
seller: unref(data).users
|
|
}, null, _parent));
|
|
_push(`</div></div>`);
|
|
_push(ssrRenderComponent(_sfc_main$6, {
|
|
id: optionPostId.value,
|
|
open: optionVisible.value,
|
|
"onUpdate:open": ($event) => optionVisible.value = $event
|
|
}, null, _parent));
|
|
_push(`</div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
_sfc_main$1.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/product/index.vue");
|
|
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
};
|
|
const Index = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-73faf474"]]);
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "[id]",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(ssrRenderComponent(Index, _attrs, null, _parent));
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/product_detail/[id].vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { _sfc_main as default };
|
|
//# sourceMappingURL=_id_-CUp2Fz4a.mjs.map
|