index.b13981f9.js 6.8 KB

1
  1. import{d as f,f as c,g as p,y as u,n as d,D as b,w as S,j as e,z as n,by as w,av as D,B as k,Z as I}from"./index.e6d6174e.js";import{S as C,a as P}from"./index.b4a53c6a.js";import{I as T}from"./index.67c54471.js";import{C as v}from"./index.4aea64de.js";import{C as m}from"./index.af99cf22.js";import{I as _}from"./index.4324e3af.js";import{R as $,a as x}from"./index.cbc70232.js";import"./index.d92a5aca.js";import{T as B}from"./index.05f2b7dd.js";import{R as q,C as h}from"./index.83d3716a.js";import{C as E}from"./index.b0eda115.js";import{s as y}from"./share.57719e8d.js";import{getAssetsHomeFile as H}from"./index.e3979e35.js";import"./icon_discount.535f7618.js";import"./share-vip-tips.16c5753d.js";import"./share-banner.3808bbad.js";import"./wx_bg.cce2a6c0.js";import"./index.43f63892.js";import"./bars.4f1962a6.js";import"./icon_album_active.ce98b2a8.js";import"./icon_music_active.3b316ab8.js";import"./index.884a0e76.js";import"./index.af98ec6d.js";import"./icon_teacher.40b6f077.js";import"./icon_timer2.5fb1750d.js";import"./icon-jiaozi.20e415ca.js";const L="_swipeItemImg_i7yn2_1",N="_swipe_i7yn2_1",W="_goodsHead_i7yn2_17",G="_priceGroup_i7yn2_24",A="_price_i7yn2_24",V="_delPrice_i7yn2_37",z="_stock_i7yn2_43",R="_goodsName_i7yn2_47",M="_row_i7yn2_53",O="_col_i7yn2_57",j="_radio_i7yn2_61",F="_badge_i7yn2_96",J="_section_i7yn2_100",U="_detail_i7yn2_104",Z="_photoDetail_i7yn2_129",K="_goodsDetail_i7yn2_133",Q="_actionBar_i7yn2_136",X="_addCertBtn_i7yn2_157",Y="_buyGroup_i7yn2_161",tt="_selectWrap_i7yn2_171",et="_shareBtn_i7yn2_177",ot="_shareWrap_i7yn2_183",st="_sharePic_i7yn2_193",it="_shareLeft_i7yn2_198",at="_shareShopTitle_i7yn2_201",rt="_shareShopDes_i7yn2_206",lt="_shareShopValue_i7yn2_212",nt="_shareShopOldPrice_i7yn2_216",ct="_wxpopup_i7yn2_220";var a={swipeItemImg:L,swipe:N,"custom-indicator":"_custom-indicator_i7yn2_7",goodsHead:W,priceGroup:G,price:A,delPrice:V,stock:z,goodsName:R,row:M,col:O,"radio-group":"_radio-group_i7yn2_61",radio:j,badge:F,section:J,detail:U,photoDetail:Z,goodsDetail:K,actionBar:Q,addCertBtn:X,buyGroup:Y,selectWrap:tt,shareBtn:et,shareWrap:ot,sharePic:st,shareLeft:it,shareShopTitle:at,shareShopDes:rt,shareShopValue:lt,shareShopOldPrice:nt,wxpopup:ct};function dt(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!I(t)}var Wt=f({name:"goods-detail",data(){return{id:this.$route.query.id,albumPics:[],product:{},radio:0,skuStockList:[],detailMobileHtml:"",loading:!1,wxStatus:!1}},computed:{getPrice(){let t=this.skuStockList.filter(o=>o.id==this.radio);return t&&Array.isArray(t)&&t.length?t[0].price:this.product.price}},created(){if(c().isApp)if(p.platformType==="STUDENT"){const{query:t}=this.$route,i=Object.assign({id:t.bizId,promoterId:t.userId},t);i.promoterId=t.userType&&t.userType=="STUDENT"?"":i.promoterId,c().ios?window.location.replace(`${location.origin}/student/#/goodsDetail?${u.stringify(i)}`):(d({api:"openWebView",content:{url:`${location.origin}/student/#/goodsDetail?${u.stringify(i)}`,orientation:1,isHideTitle:!1}}),d({api:"back"}))}else p.platformType==="TEACHER"&&b.alert({title:"\u63D0\u793A",message:"\u8BF7\u4F7F\u7528\u9177\u4E50\u79C0\u5B66\u751F\u7AEF\u626B\u7801\u6253\u5F00"}).then(()=>{d({api:"back"})});else{const{origin:t}=location,i=this.$route.query,o=t+`/student/#/goodsDetail?id=${i.bizId}&promoterId=${i.userType&&i.userType=="STUDENT"?"":i.userId}`;y(o,{})}},mounted(){this.getProduct()},methods:{locationReplace(t){history.replaceState?(history.replaceState(null,document.title,t),window.location.reload()):location.replace(t)},async getProduct(){this.loading=!0;let t={},i=[];try{const o=await S.post("/api-mall-portal/open/productProfit",{data:{bizId:this.$route.query.bizId,userId:this.$route.query.userId}});o.data&&o.data.productDetail&&(t=o.data.productDetail.product,i=o.data.productDetail.skuStockList||[])}catch{}this.product=t,this.skuStockList=i.map(o=>{if(o.spData){const s=JSON.parse(o.spData);o.spDataJson=s.reduce((r,l)=>(r+=l.value,r),""),o.sku=s.reduce((r,l)=>(r.push(`${l.key}: ${l.value}`),r),[]).join(",")}else o.spDataJson="\u9ED8\u8BA4";return o}),this.albumPics=[t.pic].concat(t.albumPics.split(",")).filter(o=>o),this.detailMobileHtml=t.detailMobileHtml,this.loading=!1},onPreview(t){_({images:this.albumPics,startPosition:t,closeable:!0})},onShowImg(t){const{localName:i}=t.srcElement;if(i!=="img")return;let o=0;const s=document.querySelectorAll(".msgWrap img");let r=Array.from(s).map((l,g)=>(t.srcElement==l&&(o=g),l.src));_({images:r,startPosition:o,closeable:!0})},onDetail(){if(c().weixin){this.wxStatus=!0;return}const{origin:t}=location,i=this.$route.query;let o=t+`/student/#/goodsDetail?id=${i.bizId}&promoterId=${i.userId}`;y(o,{}),setTimeout(()=>{location.href=t+"/student/#/download"},3e3)}},render(){let t;const i=this.product,o=this.skuStockList.find(s=>s.id===this.radio);return e("div",{class:a.goodsDetail},[e(C,{class:a.swipe,lazyRender:!0},{default:()=>[this.albumPics.map((s,r)=>e(P,null,{default:()=>[e(T,{class:a.swipeItemImg,src:s,onClick:()=>this.onPreview(r),fit:"cover"},null)]}))],indicator:s=>s.total>1&&e("div",{class:a["custom-indicator"]},[(s.active||0)+1,n(" / "),s.total])}),e(v,{border:!1,class:[a.goodsHead,"mb12"]},{default:()=>[e(m,{center:!0,border:!1},{title:()=>e("div",{class:a.priceGroup},[e("span",{class:a.price},[e("i",null,[n("\xA5")]),w(this.getPrice)])])}),e(m,{center:!0,border:!1,title:i.name,titleClass:[a.goodsName,"van-ellipsis"]},null)]}),e(q,{class:[a.row,"mb12"]},{default:()=>[e(h,{span:4,class:a.col},{default:()=>[n("\u89C4\u683C")]}),e(h,{span:20},{default:()=>[o?e("div",{class:a.selectWrap},[o.stock<=0?"\u5F53\u524D\u6B3E\u5F0F\u6682\u65F6\u7F3A\u8D27":`\u5DF2\u9009\u62E9 ${o.spDataJson}`]):e("div",{class:a.selectWrap},[n("\u8BF7\u9009\u62E9 \u89C4\u683C")]),e($,{class:a["radio-group"],modelValue:this.radio,"onUpdate:modelValue":s=>this.radio=s},dt(t=this.skuStockList.map(s=>{const r=s.id===this.radio,l=r?"primary":"default";return e(D,{position:"top-right",content:s.stock<=0?"\u7F3A\u8D27":"",color:"#999999",class:a.badge,offset:[-20,0]},{default:()=>[e(x,{class:a.radio,name:s.id,disabled:s.stock<=0,onClick:()=>{s.stock<=0||(this.radio=s.id)}},{default:()=>[e(B,{size:"large",plain:r,type:l},{default:()=>[s.spDataJson]})]})]})}))?t:{default:()=>[t]})]})]}),this.detailMobileHtml&&e("div",{class:[a.section]},[e("div",{class:a.detail},[e("span",null,[n("\u56FE\u6587\u8BE6\u60C5")])]),e("div",{class:[a.photoDetail,"msgWrap"],onClick:this.onShowImg,innerHTML:this.detailMobileHtml},null)]),e(E,{position:"bottom"},{default:()=>[e("div",{class:["btnGroup"],style:{paddingTop:"12px"}},[e(k,{block:!0,round:!0,type:"primary",onClick:this.onDetail},{default:()=>[n("\u4E0B\u8F7D\u9177\u4E50\u79C0\u8D2D\u4E70\u5546\u54C1")]})])]}),this.wxStatus&&e("div",{class:a.wxpopup,onClick:()=>{this.wxStatus=!1}},[e("img",{src:H("wx_bg.png"),alt:""},null)])])}});export{Wt as default};