import{r as d,m}from"./index.b8b9219f.js";import{d as M,$ as n,T as g,b as t,Q as k,O as j,I as u,j as c,m as w,p,k as C,C as I,H as _,U as l,J as f,X as S,v as G,F as b,a0 as x,q as J,a1 as h,P as T}from"./vendor.2bcdc9cf.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{A as D}from"./index.bf47a6bc.js";import{C as Q}from"./index.4cc32b24.js";import"./index.903a2347.js";import"./shop-mall.fff18e3c.js";var B="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAeFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVyEiIAAAAJ3RSTlMAXXf78+MT1MBCjQ8J+Lap8ODdkHJcLR4Y6YiASTGtmGtlPDjYzWJYX2XLAAABFklEQVRIx+2U23KDIBRFdySggjHxEmOMzbUt//+HHaAzDvFo8KkPzXoRZs7WzXIGUKiuXH99I5hHoQ3JAWHUTDt2ewQgcj2wFXjFndvJo9zYJ08xT8Rc/RZNbFesyl7XYSezyaQLxx+YIuW/Nfz9JgLNyb0xb4cvbvW04DZxdfzX7XdTgtOjq3OHzyEZBFN1BCFuEDyqU4OAENy7OsUDNFnlC+7c9iwwhhKcuzVZZyT4DER2UVK/kxJc49NKUxhDCo5hDtAhiMq4gomtEMTKzL4D/zVwLdYexXU+0DD9TDMb6PWIfjaQlc/zZTZ/BnGLPG7iz7W+A1TAXmSXVRAXe5FxvQgOuSwgoeIl87EClOQsbJpxqfADHFZkXcRc0FsAAAAASUVORK5CYII=",N="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAwCAMAAAB64Ok7AAAAAXNSR0IArs4c6QAAAo5QTFRFA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hoeJioyNjY6RkpOUlZWWl5eYmZ6ipKWmp6mqq66us7S2ubq9wcLCw8TGx8jJzM7Oz9DQ0dLT1NbW2drb3N7i5OTm5+fo6urs7e7v8PHy8/P09fX39/j5+fr7+/z9/f7+jrsa3QAAAmRJREFUGBndwfdfTXEcB+A3ce29C1klskeDyN6b7E3ICEn23nurrOwt2VnZK0kkfd//jc8993p1zz3ndDt+9DxAVNxil9hBtWFTPIu8W+qALVn0dNIBOx5SJxF2DP5ET9n+sKNeeGRkZFTM4TxqxuFfhF6j0829JbE7PgQ69W7ThrwZ0GlfQBsKukMnlXYcg85c2pEOnU4UFxv51o0iDTqOzySzHfBpFMV26J2m6AKfkigmQS+RIhZGyx9saIwiyRRh0OtPcQQGXZVSX7c2w1+ZJPOrQ69BAclMGBxUTt921YEmgCID3u5QNIeXJrnKZQk00RSH4G0PxRh4WaHcxkITR7EI3mIotkGv8kt1puXK10q9rQHNAYre8BZMcR1FqpUDxivVD6g1+3gfuKRTNITBC5L5deHW9+rvH6fa3lB3S8NDlZ8kn8LoBEVPuAz7pUSuUpPhqTNFCowWUCyDpuwT5fKqKjxNpFgNowiKVGjaKLdV0NlGMRpGFXNIvveDUwfl1go65ylCYSKNoh2cKrxRmmdl4KnUB5Kf/WBiLcV0aGYqzTTohFBcgJkhFAfgMv+jUl8WQm8ExU6YCSgk+QhudXr0qA8vSRRTYOoeRSCsJVOEw9Q+ipGwlkkyvyZMTaR4fNkaRQbMhbIE9sPCFfo2ABZaZ9GXTbAUuOP+82Jknh2O/0+lCetm+cNcWEJCBIrRIoNkVkeYWVNAcj2spdApHSZ6URMNKxXzqQmC0RZqNsOK4zs1TWG0kZqNsHSUTpdgIrKQojAClgLOkbwVDDNzc8icOShGqYHzhpaHuaDpU4Pg9gc859M9U5VeagAAAABJRU5ErkJggg==";const R="_swipeItemImg_7rstw_1",O="_swipe_7rstw_1",v="_goodsHead_7rstw_17",K="_priceGroup_7rstw_24",E="_price_7rstw_24",U="_delPrice_7rstw_37",L="_stock_7rstw_43",P="_goodsName_7rstw_47",F="_row_7rstw_53",H="_col_7rstw_57",V="_radio_7rstw_61",W="_badge_7rstw_96",z="_section_7rstw_100",q="_detail_7rstw_104",X="_photoDetail_7rstw_129",Z="_goodsDetail_7rstw_133",Y="_actionBar_7rstw_136",$="_text_7rstw_158",tt="_addCertBtn_7rstw_163",st="_buyGroupBtn_7rstw_167",et="_buyGroup_7rstw_167",ot="_selectWrap_7rstw_185",it="_shareBtn_7rstw_191",at="_shareWrap_7rstw_197",rt="_sharePic_7rstw_207",At="_shareLeft_7rstw_212",ct="_shareRight_7rstw_215",lt="_shareShopTitle_7rstw_219",dt="_shareShopDes_7rstw_229",nt="_shareShopValue_7rstw_238",ut="_shareShopOldPrice_7rstw_242",pt="_imagesOverlayWrap_7rstw_249";var o={swipeItemImg:R,swipe:O,"custom-indicator":"_custom-indicator_7rstw_7",goodsHead:v,priceGroup:K,price:E,delPrice:U,stock:L,goodsName:P,row:F,col:H,"radio-group":"_radio-group_7rstw_61",radio:V,badge:W,section:z,detail:q,photoDetail:X,goodsDetail:Z,actionBar:Y,text:$,addCertBtn:tt,buyGroupBtn:st,buyGroup:et,selectWrap:ot,shareBtn:it,shareWrap:at,sharePic:rt,shareLeft:At,shareRight:ct,shareShopTitle:lt,shareShopDes:dt,shareShopValue:nt,shareShopOldPrice:ut,imagesOverlayWrap:pt};function It(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!G(s)}var Jt=M({name:"goods-detail",data(){return{id:this.$route.query.id,albumPics:[],product:{},radio:0,skuStockListTemp:[],detailMobileHtml:"",loading:!1,addGoodsShow:!1,selectGoodsItem:{},cartCount:0,showType:"cart",shareShow:!1}},computed:{skuStockList(){const s=this.product,i=this.skuStockListTemp.length>0?this.skuStockListTemp:[{id:-1,price:s.price,pic:s.pic,stock:s.stock,spData:null}];return i.forEach(a=>{if(a.spData){const e=JSON.parse(a.spData);a.spDataJson=e.reduce((r,A)=>(r+=A.value,r),""),a.sku=e.reduce((r,A)=>(r.push(`${A.key}: ${A.value}`),r),[]).join(",")}else a.spDataJson="\u9ED8\u8BA4"}),i},getPrice(){let s=this.skuStockList.filter(i=>i.id==this.radio);return s&&Array.isArray(s)&&s.length?s[0].price:0}},async mounted(){try{this.loading=!0;const s=await d.get(`/api-mall-portal/product/detail/${this.id}`);this.loading=!1;const i=s.data||{};if(this.albumPics=[i.product.pic].concat(i.product.albumPics.split(",")).filter(a=>a),this.product=i.product,this.skuStockListTemp=i.skuStockList||[],this.skuStockListTemp.length){let a=this.skuStockListTemp.length;for(let e=0;e=0){this.radio=r.id;break}}}this.detailMobileHtml=i.product.detailMobileHtml}catch{}this.getCartCount()},methods:{onPreview(s){n({images:this.albumPics,startPosition:s,closeable:!0,className:o.imagesOverlayWrap})},onShowImg(s){const{localName:i}=s.srcElement;if(i!=="img")return;let a=0;const e=document.querySelectorAll(".msgWrap img");let r=Array.from(e).map((A,y)=>(s.srcElement==A&&(a=y),A.src));n({images:r,startPosition:a,closeable:!0,className:o.imagesOverlayWrap})},onShowCart(s="cart"){this.selectGoodsItem={price:this.product.pic,stock:this.product.stock,skuStockList:this.skuStockListTemp.length?this.skuStockListTemp:void 0,brandName:this.product.brandName,productCategoryId:this.product.productCategoryId,name:this.product.name,productSn:this.product.productSn,productSubTitle:this.product.subTitle,id:this.product.id},this.showType=s,this.addGoodsShow=!0},onBuy(){if(!this.radio)return g("\u8BF7\u9009\u62E9\u89C4\u683C");console.log(!0)},async getCartCount(){try{let{code:s,data:i}=await d.get("/api-mall-portal/cart/list");s===200&&(this.cartCount=i.length)}catch{}}},render(){let s;const i=this.product,a=this.skuStockList.find(e=>e.id===this.radio);return t("div",{class:o.goodsDetail},[t(Q,null,null),t(k,{class:o.swipe,lazyRender:!0},{default:()=>[this.albumPics.map((e,r)=>t(j,null,{default:()=>[t(u,{class:o.swipeItemImg,src:e,onClick:()=>this.onPreview(r),fit:"cover"},null)]}))],indicator:e=>e.total>1&&t("div",{class:o["custom-indicator"]},[(e.active||0)+1,c(" / "),e.total])}),t(w,{border:!1,class:[o.goodsHead,"mb12"]},{default:()=>[t(p,{center:!0,border:!1},{title:()=>t("div",{class:o.priceGroup},[t("span",{class:o.price},[t("i",null,[c("\xA5")]),m(this.getPrice)])])}),t(p,{center:!0,border:!1,title:i.name,titleClass:[o.goodsName,"van-ellipsis"]},null)]}),t(C,{class:[o.row,"mb12"]},{default:()=>[t(I,{span:4,class:o.col},{default:()=>[c("\u89C4\u683C")]}),t(I,{span:20},{default:()=>[a?t("div",{class:o.selectWrap},[a.stock<=0?"\u5F53\u524D\u6B3E\u5F0F\u6682\u65F6\u7F3A\u8D27":`\u5DF2\u9009\u62E9 ${a.spDataJson}`]):t("div",null,[c("\u8BF7\u9009\u62E9 \u89C4\u683C")]),t(_,{class:o["radio-group"],modelValue:this.radio,"onUpdate:modelValue":e=>this.radio=e},It(s=this.skuStockList.map(e=>{const r=e.id===this.radio,A=r?"primary":"default";return t(l,{position:"top-right",content:e.stock<=0?"\u7F3A\u8D27":"",color:"#999999",class:o.badge,offset:[-20,0]},{default:()=>[t(f,{class:o.radio,name:e.id,disabled:e.stock<=0,onClick:()=>{e.stock<=0||(this.radio=e.id)}},{default:()=>[t(S,{size:"large",plain:r,type:A},{default:()=>[e.spDataJson]})]})]})}))?s:{default:()=>[s]})]})]}),this.detailMobileHtml&&t("div",{class:[o.section]},[t("div",{class:o.detail},[t("span",null,[c("\u56FE\u6587\u8BE6\u60C5")])]),t("div",{class:[o.photoDetail,"msgWrap"],onClick:this.onShowImg,innerHTML:this.detailMobileHtml},null)]),!this.loading&&t(b,null,[t(x,{class:o.actionBar,"safe-area-inset-bottom":!0},{default:()=>[t("div",{style:{display:"flex",alignItems:"center"}},[t(l,{content:this.cartCount,showZero:!1,onClick:()=>{this.$router.push("/cart")}},{default:()=>[t(u,{src:N,style:{width:"30px",height:"24px"}},null),t("div",{class:o.text},[c("\u8D2D\u7269\u8F66")])]}),t(l,{content:0,showZero:!1,style:{marginLeft:"32px"},onClick:()=>{this.$router.push("/")}},{default:()=>[t(J,{name:B,size:24},null),t("div",{class:o.text},[c("\u9996\u9875")])]})])],button:()=>t("div",{class:o.buyGroup},[t(h,{type:"primary",class:o.addCertBtn,text:"\u52A0\u5165\u8D2D\u7269\u8F66",onClick:()=>this.onShowCart()},null),t(h,{type:"primary",class:o.buyGroupBtn,text:"\u7ACB\u5373\u8D2D\u4E70",onClick:()=>this.onShowCart("cartConfirm")},null)])})]),t(T,{show:this.addGoodsShow,closeable:!0,position:"bottom",round:!0,onClose:()=>{this.addGoodsShow=!1}},{default:()=>[t(D,{show:this.addGoodsShow,onGetCartCount:()=>this.getCartCount(),item:this.selectGoodsItem,defaultRadio:this.radio,showType:this.showType},null)]})])}});export{Jt as default};