1 |
- import{d as A,b as C,s as d,e as u,T as y,i as t,N as p,A as l,by as h,aw as m,F as b,bB as k,aT as g,$ as w}from"./index.6b776f4b.js";import{S as v,a as I}from"./index.570314c1.js";import{I as L}from"./index.7cc0b0e7.js";import{C as P}from"./index.aa464e80.js";import{C as f}from"./index.7486196c.js";import{I as _}from"./index.bf33b691.js";import{R as T,a as D}from"./index.f8d8ddc0.js";import"./index.bebc33d1.js";import{T as W}from"./index.beb9a25a.js";import{R as B,C as S}from"./index.6bbd549f.js";import{S as U}from"./index.540a6a59.js";import{A as G}from"./index.6c305541.js";import{C as V}from"./index.33f0ddb9.js";import{i as R}from"./icon-share.324bceb0.js";import{C as O}from"./index.f8224084.js";import{u as E}from"./hooks.ad006126.js";import"./index.8e00d08c.js";import"./icon-sell-out.98742fd0.js";import"./shop-mall.043fc5f6.js";import"./index.f0306d29.js";import"./use-height.c83159bc.js";import"./code-down-load.ece1391b.js";import"./logo.bcac726b.js";import"./browser.ff6962bf.js";import"./icon_teacher.40b6f077.js";var N="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAABPhJREFUaEPtmVtoXFUUhv81GUcjtsRWUUdTM2efOJoSUQSxVSvUF6/1QVqo4AWU6otWQVCxVi0K9cVLfRAvKCr6EJ8qluhDEeslgsYLwUBkrzPqxNp4K2KKZjI9S3YzE3biZObMnDOXJHPekrPOWuvb/95r7b2HsMweWma8aAMvdcXbCrcVXmIj0J7SS0zQ/+EsX4WVUlJC3X8B/AZgGMDg5OTkWxMTE0cW8yyYVXgB4DlsInI4Fovt0Fq/AKDUALX8WFQFbNHsnZqa2jo+Pv5PyxPOS7BWYONmkJmvA+AvJuiyRct13eMBuL7v30hE9wI4eR7cDmZ+cskA2yDpdDqZz+ffA3Bh8f8icmR6evqcbDZ7cLFAV9WWUqnUaUT0NRGdYQFmAfzVCsBGACL6RkSe9jzv+1I5VQVsHDiOcxcRmSrdso8BB3CV53mf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dLRLaZNIjopUQisXN0dDRXfVoLfxE2TmTAruvuFpEH7FSJ6Cmt9YNRAoeNExmwUurPEr8fH2bmVVECh43TBq5VjbBTLWjcsHEiUzhsMQkKHDZOZMBBE262XRu42QrUO35b4XqPcLP9txVutgL1jt9WuN4j3Gz/y07h/wAWOi1b2uyxeAAAAABJRU5ErkJggg==";const z="_swipeItemImg_10kck_1",M="_swipe_10kck_1",F="_goodsHead_10kck_17",H="_priceGroup_10kck_24",x="_price_10kck_24",Z="_delPrice_10kck_37",j="_stock_10kck_43",q="_goodsName_10kck_47",J="_row_10kck_53",X="_col_10kck_57",K="_radio_10kck_61",Q="_badge_10kck_96",Y="_section_10kck_100",$="_detail_10kck_104",tt="_photoDetail_10kck_129",st="_goodsDetail_10kck_133",et="_actionBar_10kck_136",ot="_addCertBtn_10kck_157",at="_buyGroup_10kck_161",rt="_selectWrap_10kck_171",it="_shareBtn_10kck_177",ct="_shareWrap_10kck_183",lt="_sharePic_10kck_193",dt="_shareLeft_10kck_198",nt="_shareRight_10kck_201",ut="_shareShopTitle_10kck_205",pt="_shareShopDes_10kck_215",ht="_shareShopValue_10kck_224",mt="_shareShopOldPrice_10kck_228",kt="_imagesOverlayWrap_10kck_235";var e={swipeItemImg:z,swipe:M,"custom-indicator":"_custom-indicator_10kck_7",goodsHead:F,priceGroup:H,price:x,delPrice:Z,stock:j,goodsName:q,row:J,col:X,"radio-group":"_radio-group_10kck_61",radio:K,badge:Q,section:Y,detail:$,photoDetail:tt,goodsDetail:st,actionBar:et,addCertBtn:ot,buyGroup:at,selectWrap:rt,shareBtn:it,shareWrap:ct,sharePic:lt,shareLeft:dt,shareRight:nt,shareShopTitle:ut,shareShopDes:pt,shareShopValue:ht,shareShopOldPrice:mt,imagesOverlayWrap:kt};function gt(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!w(s)}var Ft=A({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,r=this.skuStockListTemp.length>0?this.skuStockListTemp:[{id:-1,price:s.price,pic:s.pic,stock:s.stock,spData:null}];return r.forEach(a=>{if(a.spData){const c=JSON.parse(a.spData);a.spDataJson=c.reduce((o,i)=>(o+=i.value,o),""),a.sku=c.reduce((o,i)=>(o.push(`${i.key}: ${i.value}`),o),[]).join(",")}else a.spDataJson="\u9ED8\u8BA4"}),r},getPrice(){let s=this.skuStockList.filter(r=>r.id==this.radio);return s&&Array.isArray(s)&&s.length?s[0].price:0},shareUrl(){const s=this.product.id;return C().isApp?`${location.origin}/teacher/#/shareMall?bizId=${s}&userId=${d.user.data.userId}&userType=${d.platformType}`:`${location.origin}/teacher.html#/shareMall?bizId=${s}&userId=${d.user.data.userId}&userType=${d.platformType}`}},async mounted(){try{this.loading=!0;const s=await u.get(`/api-mall-portal/product/detail/${this.id}`);this.loading=!1;const r=s.data||{};if(this.albumPics=[r.product.pic].concat(r.product.albumPics.split(",")).filter(a=>a),this.product=r.product,this.skuStockListTemp=r.skuStockList||[],this.skuStockListTemp.length){let a=this.skuStockListTemp.length;for(let c=0;c<a;c++){let o=this.skuStockListTemp[c];if(o.stock>=0){this.radio=o.id;break}}}this.detailMobileHtml=r.product.detailMobileHtml}catch{}this.getCartCount(),E("\u5546\u54C1\u8BE6\u60C5")},methods:{onPreview(s){_({images:this.albumPics,startPosition:s,closeable:!0,className:e.imagesOverlayWrap})},onShowImg(s){const{localName:r}=s.srcElement;if(r!=="img")return;let a=0;const c=document.querySelectorAll(".msgWrap img");let o=Array.from(c).map((i,n)=>(s.srcElement==i&&(a=n),i.src));_({images:o,startPosition:a,closeable:!0,className:e.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 y("\u8BF7\u9009\u62E9\u89C4\u683C");console.log(!0)},async getCartCount(){try{let{code:s,data:r}=await u.get("/api-mall-portal/cart/list");s===200&&(this.cartCount=r.length)}catch{}}},render(){let s;const r=this.product,a=this.skuStockList.find(o=>o.id===this.radio),c=this.product.pic+"?v="+Date.now();return t("div",{class:e.goodsDetail},[t(V,null,{right:()=>t("div",{class:e.shareBtn,onClick:()=>this.shareShow=!0},[t(p,{name:R,size:14,color:"#666"},null),t("span",{style:{marginLeft:"3px"}},[l("\u5206\u4EAB")])])}),t(v,{class:e.swipe,lazyRender:!0},{default:()=>[this.albumPics.map((o,i)=>t(I,null,{default:()=>[t(L,{class:e.swipeItemImg,src:o,onClick:()=>this.onPreview(i),fit:"cover"},null)]}))],indicator:o=>o.total>1&&t("div",{class:e["custom-indicator"]},[(o.active||0)+1,l(" / "),o.total])}),t(P,{border:!1,class:[e.goodsHead,"mb12"]},{default:()=>[t(f,{center:!0,border:!1},{title:()=>t("div",{class:e.priceGroup},[t("span",{class:e.price},[t("i",null,[l("\xA5")]),h(this.getPrice)])])}),t(f,{center:!0,border:!1,title:r.name,titleClass:[e.goodsName,"van-ellipsis"]},null)]}),t(B,{class:[e.row,"mb12"]},{default:()=>[t(S,{span:4,class:e.col},{default:()=>[l("\u89C4\u683C")]}),t(S,{span:20},{default:()=>[a?t("div",{class:e.selectWrap},[a.stock<=0?"\u5F53\u524D\u6B3E\u5F0F\u6682\u65F6\u7F3A\u8D27":`\u5DF2\u9009\u62E9 ${a.spDataJson}`]):t("div",null,[l("\u8BF7\u9009\u62E9 \u89C4\u683C")]),t(T,{class:e["radio-group"],modelValue:this.radio,"onUpdate:modelValue":o=>this.radio=o},gt(s=this.skuStockList.map(o=>{const i=o.id===this.radio,n=i?"primary":"default";return t(m,{position:"top-right",content:o.stock<=0?"\u7F3A\u8D27":"",color:"#999999",class:e.badge,offset:[-20,0]},{default:()=>[t(D,{class:e.radio,name:o.id,disabled:o.stock<=0,onClick:()=>{o.stock<=0||(this.radio=o.id)}},{default:()=>[t(W,{size:"large",plain:i,type:n},{default:()=>[o.spDataJson]})]})]})}))?s:{default:()=>[s]})]})]}),this.detailMobileHtml&&t("div",{class:[e.section]},[t("div",{class:e.detail},[t("span",null,[l("\u56FE\u6587\u8BE6\u60C5")])]),t("div",{class:[e.photoDetail,"msgWrap"],onClick:this.onShowImg,innerHTML:this.detailMobileHtml},null)]),!this.loading&&t(b,null,[t(U,{class:e.actionBar,"safe-area-inset-bottom":!0},{default:()=>[t(m,{content:this.cartCount,showZero:!1,onClick:()=>{this.$router.push("/cart")}},{default:()=>[t(p,{name:N,size:30},null)]})],button:()=>t("div",{class:e.buyGroup},[t(k,{type:"primary",class:e.addCertBtn,text:"\u52A0\u5165\u8D2D\u7269\u8F66",onClick:()=>this.onShowCart()},null),t(k,{type:"primary",text:"\u7ACB\u5373\u8D2D\u4E70",onClick:()=>this.onShowCart("cartConfirm")},null)])})]),t(g,{show:this.addGoodsShow,closeable:!0,position:"bottom",round:!0,onClose:()=>{this.addGoodsShow=!1}},{default:()=>[t(G,{show:this.addGoodsShow,onGetCartCount:()=>this.getCartCount(),item:this.selectGoodsItem,defaultRadio:this.radio,showType:this.showType},null)]}),t(g,{style:{background:"transparent"},show:this.shareShow,onClose:()=>this.shareShow=!1},{default:()=>[t(O,{shareUrl:this.shareUrl,teacherId:d.user.data.userId,shareType:"mall"},{default:()=>[t("div",{class:e.shareWrap},[t("div",{class:e.shareLeft},[t("img",{crossorigin:"anonymous",class:e.sharePic,src:c},null)]),t("div",{class:e.shareRight},[t("div",{class:e.shareShopTitle},[this.product.name]),a?t("div",{class:e.shareShopDes},[a.sku]):null,t("div",{class:e.shareShopValue},[t("span",{class:e.shareShopPrice},[h(this.getPrice)])])])])]})]})])}});export{Ft as default};
|