index.43d5f35a.js 10 KB

1
  1. import{d as A,f as k,g as l,w as u,T as C,j as t,M as p,z as d,bz as h,av as m,F as b,bB as f,aR as g,Z as y}from"./index.394decd7.js";import{S as w,a as I}from"./index.f1b52763.js";import{I as q}from"./index.ae2dd816.js";import{C as D}from"./index.9462d7c5.js";import{C as _}from"./index.9e0d46e4.js";import{I as v}from"./index.ad0a7ec4.js";import{R as L,a as P}from"./index.4ef31a7f.js";import"./index.b91a923c.js";import{T}from"./index.dab716ce.js";import{R as W,C as S}from"./index.a9c78aa8.js";import{S as B}from"./index.2917b3bd.js";import{A as U}from"./index.eddb2d9d.js";import{C as G}from"./index.e6e212d8.js";import{i as V}from"./icon-share.4e09e300.js";import{C as R}from"./index.52a60bda.js";import{u as O}from"./hooks.9e5ee122.js";import"./index.424e7a76.js";import"./icon-sell-out.98742fd0.js";import"./shop-mall.61aa9572.js";import"./code-down-load.37c8e9cc.js";import"./logo.bcac726b.js";import"./browser.8379baf6.js";import"./html2canvas.esm.3d083717.js";import"./icon_teacher.40b6f077.js";var E="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAABPhJREFUaEPtmVtoXFUUhv81GUcjtsRWUUdTM2efOJoSUQSxVSvUF6/1QVqo4AWU6otWQVCxVi0K9cVLfRAvKCr6EJ8qluhDEeslgsYLwUBkrzPqxNp4K2KKZjI9S3YzE3biZObMnDOXJHPekrPOWuvb/95r7b2HsMweWma8aAMvdcXbCrcVXmIj0J7SS0zQ/+EsX4WVUlJC3X8B/AZgGMDg5OTkWxMTE0cW8yyYVXgB4DlsInI4Fovt0Fq/AKDUALX8WFQFbNHsnZqa2jo+Pv5PyxPOS7BWYONmkJmvA+AvJuiyRct13eMBuL7v30hE9wI4eR7cDmZ+cskA2yDpdDqZz+ffA3Bh8f8icmR6evqcbDZ7cLFAV9WWUqnUaUT0NRGdYQFmAfzVCsBGACL6RkSe9jzv+1I5VQVsHDiOcxcRmS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mJkwH19fYlcLrdLRLaZNIjopUQisXN0dDRXfVoLfxE2TmTAruvuFpEH7FSJ6Cmt9YNRAoeNExmwUurPEr8fH2bmVVECh43TBq5VjbBTLWjcsHEiUzhsMQkKHDZOZMBBE262XRu42QrUO35b4XqPcLP9txVutgL1jt9WuN4j3Gz/y07h/wAWOi1b2uyxeAAAAABJRU5ErkJggg==";const z="_swipeItemImg_1q0ve_1",N="_swipe_1q0ve_1",M="_goodsHead_1q0ve_17",F="_priceGroup_1q0ve_24",H="_price_1q0ve_24",Z="_delPrice_1q0ve_37",j="_stock_1q0ve_43",x="_goodsName_1q0ve_47",J="_row_1q0ve_53",X="_col_1q0ve_57",K="_radio_1q0ve_61",Q="_badge_1q0ve_96",Y="_section_1q0ve_100",$="_detail_1q0ve_104",tt="_photoDetail_1q0ve_129",st="_goodsDetail_1q0ve_133",et="_actionBar_1q0ve_136",ot="_addCertBtn_1q0ve_157",at="_buyGroup_1q0ve_161",rt="_selectWrap_1q0ve_170",it="_shareBtn_1q0ve_176",ct="_shareWrap_1q0ve_182",lt="_sharePic_1q0ve_192",dt="_shareLeft_1q0ve_197",nt="_shareRight_1q0ve_200",ut="_shareShopTitle_1q0ve_204",pt="_shareShopDes_1q0ve_214",ht="_shareShopValue_1q0ve_223",mt="_shareShopOldPrice_1q0ve_227",ft="_imagesOverlayWrap_1q0ve_234",gt="_cartDisabled_1q0ve_240";var e={swipeItemImg:z,swipe:N,"custom-indicator":"_custom-indicator_1q0ve_7",goodsHead:M,priceGroup:F,price:H,delPrice:Z,stock:j,goodsName:x,row:J,col:X,"radio-group":"_radio-group_1q0ve_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:ft,cartDisabled:gt};function _t(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!y(s)}var Mt=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,a=this.skuStockListTemp.length>0?this.skuStockListTemp:[{id:-1,price:s.price,pic:s.pic,stock:s.stock,spData:null}];return a.forEach(r=>{if(r.spData){const c=JSON.parse(r.spData);r.spDataJson=c.reduce((o,i)=>(o+=i.value,o),""),r.sku=c.reduce((o,i)=>(o.push(`${i.key}: ${i.value}`),o),[]).join(",")}else r.spDataJson="\u9ED8\u8BA4"}),a},getPrice(){const s=this.skuStockList.filter(a=>a.id==this.radio);return s&&Array.isArray(s)&&s.length?s[0].price:0},shareUrl(){const s=this.product.id;return k().isApp?`${location.origin}/teacher/#/shareMall?bizId=${s}&userId=${l.user.data.userId}&userType=${l.platformType}&p=tenant`:`${location.origin}/teacher.html#/shareMall?bizId=${s}&userId=${l.user.data.userId}&userType=${l.platformType}&p=tenant`},platformStatus(){const s=l.user.data,a=this.$route.query;return s.tenantId>0&&a.p=="tenant"}},async mounted(){try{this.loading=!0;const s=await u.get(`/api-mall-portal/product/detail/${this.id}`);this.loading=!1;const a=s.data||{};if(this.albumPics=[a.product.pic].concat(a.product.albumPics.split(",")).filter(r=>r),this.product=a.product,this.skuStockListTemp=a.skuStockList||[],this.skuStockListTemp.length){const r=this.skuStockListTemp.length;for(let c=0;c<r;c++){const o=this.skuStockListTemp[c];if(o.stock>=0){this.radio=o.id;break}}}this.detailMobileHtml=a.product.detailMobileHtml}catch{}this.getCartCount(),O("\u5546\u54C1\u8BE6\u60C5")},methods:{onPreview(s){v({images:this.albumPics,startPosition:s,closeable:!0,className:e.imagesOverlayWrap})},onShowImg(s){const{localName:a}=s.srcElement;if(a!=="img")return;let r=0;const c=document.querySelectorAll(".msgWrap img"),o=Array.from(c).map((i,n)=>(s.srcElement==i&&(r=n),i.src));v({images:o,startPosition:r,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 C("\u8BF7\u9009\u62E9\u89C4\u683C");console.log(!0)},async getCartCount(){try{const{code:s,data:a}=await u.get("/api-mall-portal/cart/list");s===200&&(this.cartCount=a.length)}catch{}}},render(){let s;const a=this.product,r=this.skuStockList.find(o=>o.id===this.radio),c=this.product.pic+"?v="+Date.now();return t("div",{class:e.goodsDetail},[t(G,null,{right:()=>t("div",{class:e.shareBtn,onClick:()=>this.shareShow=!0},[t(p,{name:V,size:14,color:"#666"},null),t("span",{style:{marginLeft:"3px"}},[d("\u5206\u4EAB")])])}),t(w,{class:e.swipe,lazyRender:!0},{default:()=>[this.albumPics.map((o,i)=>t(I,null,{default:()=>[t(q,{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,d(" / "),o.total])}),t(D,{border:!1,class:[e.goodsHead,"mb12"]},{default:()=>[t(_,{center:!0,border:!1},{title:()=>t("div",{class:e.priceGroup},[t("span",{class:e.price},[t("i",null,[d("\xA5")]),h(this.getPrice)])])}),t(_,{center:!0,border:!1,title:a.name,titleClass:[e.goodsName,"van-ellipsis"]},null)]}),t(W,{class:[e.row,"mb12"]},{default:()=>[t(S,{span:4,class:e.col},{default:()=>[d("\u89C4\u683C")]}),t(S,{span:20},{default:()=>[r?t("div",{class:e.selectWrap},[r.stock<=0?"\u5F53\u524D\u6B3E\u5F0F\u6682\u65F6\u7F3A\u8D27":`\u5DF2\u9009\u62E9 ${r.spDataJson}`]):t("div",null,[d("\u8BF7\u9009\u62E9 \u89C4\u683C")]),t(L,{class:e["radio-group"],modelValue:this.radio,"onUpdate:modelValue":o=>this.radio=o},_t(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(P,{class:e.radio,name:o.id,disabled:o.stock<=0,onClick:()=>{o.stock<=0||(this.radio=o.id)}},{default:()=>[t(T,{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,[d("\u56FE\u6587\u8BE6\u60C5")])]),t("div",{class:[e.photoDetail,"msgWrap"],onClick:this.onShowImg,innerHTML:this.detailMobileHtml},null)]),!this.loading&&t(b,null,[t(B,{class:e.actionBar,"safe-area-inset-bottom":!0},{default:()=>[t(m,{content:this.cartCount,showZero:!1,onClick:()=>{this.platformStatus||this.$router.push("/cart")}},{default:()=>[t(p,{name:E,size:30,class:this.platformStatus&&e.cartDisabled},null)]})],button:()=>t("div",{class:e.buyGroup},[t(f,{type:"primary",class:e.addCertBtn,text:"\u52A0\u5165\u8D2D\u7269\u8F66",disabled:this.platformStatus,onClick:()=>this.onShowCart()},null),t(f,{type:"primary",text:"\u7ACB\u5373\u8D2D\u4E70",disabled:this.platformStatus,onClick:()=>this.onShowCart("cartConfirm")},null)])})]),t(g,{show:this.addGoodsShow,closeable:!0,position:"bottom",round:!0,onClose:()=>{this.addGoodsShow=!1}},{default:()=>[t(U,{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(R,{shareUrl:this.shareUrl,teacherId:l.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]),r?t("div",{class:e.shareShopDes},[r.sku]):null,t("div",{class:e.shareShopValue},[t("span",{class:e.shareShopPrice},[h(this.getPrice)])])])])]})]})])}});export{Mt as default};