import{aN as V,Q as Z,k as r,u as tt,aT as et,l as ot,R as i,X as at,aH as lt,W,N as o,o as u,A as D,b as k,a,aL as st,w as s,af as nt,c as m,f as I,d as T,aD as U,e as b,aM as rt,t as $,s as P,M as w,V as B,ae as it,G as ut}from"./index-BgKoOiXL.js";import{_ as ct}from"./TitleBreadcrumb.vue_vue_type_style_index_0_lang-DDmokmbX.js";import{g as x,c as dt,_ as ft,T as mt,a as pt,b as vt,G as gt,d as ht,e as kt}from"./TagsDetail-0k_1HSvq.js";import"./fileApi-CDbG3kVk.js";import"./shopTypeEnum-5xzXy4lw.js";import{e as It}from"./blankProductTypeEnum-7RSz3x1u.js";import{p as _}from"./productApi-B72qUL1o.js";import{_ as bt}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./carousel-DC3tZ2iJ.js";import"./customizer-CD6Yultk.js";import"./images-CPorGVJ6.js";import"./index-BfgpT_AC.js";import"./TagsItem-BwVqmkRx.js";/* empty css                                                       */import"./close-ju3PyIXP.js";import"./comment-BCzbFbfb.js";import"./eventBus-D2aAxCUG.js";const Pt={key:0,class:"ifram-con"},_t=["src"],yt={key:1},Mt={class:"collect"},Lt={class:"text-h3 my-2 mb-3"},St={class:"text-h3 mt-2 text-secondary"},Ct={key:0,style:{"font-size":"16px"},class:"text-decoration-line-through text-medium-emphasis ml-2"},Dt={__name:"ProductDetail",setup(Tt){V();const O=Z();let d=r(""),t=r({}),c=r(!1),y=r(!1),M=r(!1),L=r("");const p=r([{title:"Products",disabled:!1,to:"/products"},{title:"",disabled:!0,to:"#"}]),S=tt();et(G),ot(()=>{const e=S.query;console.log("urlParams",e),d.value=e.id});const E=i(()=>O.merchantInfoMutations.login);function G(){const e=S.query;d.value=e.id,y.value=!1,A(S.query.id),J()}function A(e){console.log("请求产品详情...."),c.value=!0,_().blankProductDetail(e,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0).then(n=>{if(y.value=!0,c.value=!1,n.data.blankProductInfo)if(n.data.blankProductInfo.isFavorite&&(g.value=n.data.blankProductInfo.isFavorite),t.value=n.data,sessionStorage.getItem("productsBreadcrumb")==null)p.value[1].title=n.data.blankProductInfo.model;else{let f=JSON.parse(sessionStorage.getItem("productsBreadcrumb"));p.value=[{title:"Products",disabled:!1,to:"/products"},{title:f.breadcrumbTitle,disabled:!1,to:"/products"},{title:"",disabled:!0,to:"#"}],p.value[2].title=n.data.blankProductInfo.model}})}let v=at([]);function J(){const e=_(),l={types:[It.JET.value],current:1,size:30,isIndexRecommend:!0};e.blankProductPage(l).then(n=>{v.value=n.data.records})}let C=r("");function R(e){C.value=e}const F=i(()=>{let e=0;return t.value.skuInfos&&t.value.skuInfos.forEach(l=>{l.id==C.value&&(t.value.blankProductInfo.favorableDiscount?e=l.price*(1-t.value.blankProductInfo.favorableDiscount):e=l.price)}),e}),N=i(()=>{let e=0;return t.value.skuInfos&&t.value.skuInfos.forEach(l=>{l.id==C.value&&(t.value.blankProductInfo.favorableDiscount,e=l.price)}),e}),z=i(()=>{if(JSON.stringify(t.value.logisticsMethodInfos)=="{}"||!t.value.blankProductInfo.minWeight)return null;var e=x(t.value.logisticsMethodInfos[0]),l=dt(t.value.blankProductInfo.minWeight/1e3,e,t.value.logisticsMethodInfos[0]);return l}),q=i(()=>JSON.stringify(t.value.logisticsMethodInfos)=="{}"||!t.value.blankProductInfo.minWeight?null:t.value.logisticsMethodInfos[0].name),H=i(()=>{if(JSON.stringify(t.value.logisticsMethodInfos)=="{}"||!t.value.blankProductInfo.minWeight)return null;var e=x(t.value.logisticsMethodInfos[0]);return console.log("defaultLogisticsMethodConfig...",e),e.deliveryTime}),j=i(()=>{if(JSON.stringify(t.value.logisticsMethodInfos)=="{}")return null;var e=x(t.value.logisticsMethodInfos[0]);return e.countryGroupLogoUrl}),Q=i(()=>t.value.minWeight?t.value.blankProductInfo.minWeight===tproductData.value.blankProductInfo.maxWeight?`${t.value.blankProductInfo.minWeight}g`:`${t.value.blankProductInfo.minWeight}-${t.value.blankProductInfo.maxWeight}g`:"");let g=r(!1);function X(){c.value=!0,_().blankProductFavorite(d.value).then(l=>{c.value=!1,g.value=!0})}function K(){c.value=!0,_().blankProductUnFavorite(d.value).then(l=>{c.value=!1,g.value=!1})}async function Y(){if(!E.value){W.push({path:"/login"});return}const e="https://c.jetprintapp.com/",l=V(),n=O.shopApiToken;l.host;const f=l.shop;var h=`${e}diyCustom?token=${n}&id=${d.value}`;console.log("shop...",f),f?(h=h+`&shop=${f}`,L.value=h,M.value=!0):window.open(h)}return lt("getProductDetail",A),window.addEventListener("message",e=>{console.log("查看消息来源...",e.data),e.data.type=="goProductSync"?W.push({path:"/productSync",query:{customProductId:e.data.customProductId,blankProductId:e.data.blankProductId}}):e.data.type=="goBack"&&(L.value="",M.value=!1)}),(e,l)=>{const n=ut("HeartFilledIcon");return o(M)?(u(),D("div",Pt,[k("iframe",{src:o(L),class:"ifram"},null,8,_t)])):(u(),D("div",yt,[a(st,{isShow:o(c)},null,8,["isShow"]),a(ct,{title:"Product Details",breadcrumbs:p.value},null,8,["breadcrumbs"]),a(it,{variant:"flat"},{default:s(()=>[a(nt,null,{default:s(()=>[JSON.stringify(o(t))!="{}"?(u(),m(B,{key:0},{default:s(()=>[a(I,{lg:"5",sm:"12",cols:"12"},{default:s(()=>[a(ft,{showImageList:o(t).showImageList},null,8,["showImageList"])]),_:1}),a(I,{lg:"7",sm:"12",cols:"12"},{default:s(()=>[k("div",Mt,[o(g)?(u(),m(T,{key:0,size:"small",icon:"",class:"ml-auto"},{default:s(()=>[a(U,{activator:"parent",location:"top"},{default:s(()=>[b("Remove from My Favourite")]),_:1}),a(n,{color:"#EC407A",onClick:K})]),_:1})):(u(),m(T,{key:1,size:"small",icon:"",class:"ml-auto"},{default:s(()=>[a(U,{activator:"parent",location:"top"},{default:s(()=>[b("Add to My Favourite")]),_:1}),a(o(rt),{color:"#828282",onClick:X})]),_:1}))]),a(mt,{base:o(t).blankProductInfo},null,8,["base"]),k("h3",Lt,$(o(t).blankProductInfo.model),1),k("h1",St,[b("$"+$(e.$filters.MoneyFormat(F.value))+" ",1),F.value!=N.value?(u(),D("span",Ct,"$"+$(e.$filters.MoneyFormat(N.value)),1)):P("",!0)]),a(w,{class:"mt-4"}),a(B,{class:"mt-4"},{default:s(()=>[a(I,{lg:"6",md:"6",sm:"6",xs:"12",cols:"12"},{default:s(()=>[a(pt,{minLogisticsPrice:z.value,deliveryMethod:q.value,deliveryTime:H.value,countryGroupLogoUrl:j.value},null,8,["minLogisticsPrice","deliveryMethod","deliveryTime","countryGroupLogoUrl"])]),_:1}),a(I,{lg:"6",md:"6",sm:"6",xs:"12",cols:"12"},{default:s(()=>[a(vt,{productionProcess:o(t).blankProductInfo.productionProcess,material:o(t).blankProductInfo.material,weight:Q.value,productionTime:o(t).blankProductInfo.productionTime},null,8,["productionProcess","material","weight","productionTime"])]),_:1})]),_:1}),a(w,{class:"mt-4"}),o(y)?(u(),m(gt,{key:0,skuInfos:o(t).skuInfos,"option1-name":o(t).blankProductInfo.skuOption1,"option1-type":o(t).blankProductInfo.skuOption1Type,"option2-name":o(t).blankProductInfo.skuOption2,"option2-type":o(t).blankProductInfo.skuOption2Type,"option3-name":o(t).blankProductInfo.skuOption3,"option3-type":o(t).blankProductInfo.skuOption3Type,onSkuChange:R},null,8,["skuInfos","option1-name","option1-type","option2-name","option2-type","option3-name","option3-type"])):P("",!0),a(w,{class:"mt-4"}),a(T,{class:"mt-4",block:"",size:"large",color:"secondary",onClick:Y},{default:s(()=>[b("Design")]),_:1})]),_:1})]),_:1})):P("",!0),a(ht,{productData:o(t),blankId:o(d)},null,8,["productData","blankId"])]),_:1})]),_:1}),o(v).value&&o(v).value.length>0?(u(),m(kt,{key:0,recommendProductList:o(v).value},null,8,["recommendProductList"])):P("",!0)]))}}},Ht=bt(Dt,[["__scopeId","data-v-4d0f2267"]]);export{Ht as default};