index.83193c7c.js 6.8 KB

1
  1. import{d as g,b as c,s as d,p,D as b,e as S,i as e,A as n,by as w,aw as D,B as k,$ as I}from"./index.7994470a.js";import{S as C,a as P}from"./index.889feca1.js";import{I as T}from"./index.2fbdc579.js";import{C as v}from"./index.9cdb5783.js";import{C as u}from"./index.777f4790.js";import{I as m}from"./index.01765498.js";import{R as $,a as x}from"./index.9dc8689d.js";import"./index.c9af17c2.js";import{T as B}from"./index.0262b810.js";import{R as q,C as _}from"./index.80389b79.js";import{C as E}from"./index.aaa3ed2b.js";import{s as h}from"./share.905d1919.js";import{q as y}from"./index.570461cd.js";import{getAssetsHomeFile as H}from"./index.5011e82a.js";import"./icon_discount.535f7618.js";import"./share-vip-tips.16c5753d.js";import"./share-banner.3808bbad.js";import"./wx_bg.cce2a6c0.js";import"./index.9b67dbb3.js";import"./bars.4f1962a6.js";import"./icon_album_active.ce98b2a8.js";import"./icon_music_active.3b316ab8.js";import"./index.363c593b.js";import"./index.b2bac310.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",A="_priceGroup_i7yn2_24",G="_price_i7yn2_24",V="_delPrice_i7yn2_37",R="_stock_i7yn2_43",z="_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",K="_photoDetail_i7yn2_129",Q="_goodsDetail_i7yn2_133",X="_actionBar_i7yn2_136",Y="_addCertBtn_i7yn2_157",Z="_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:A,price:G,delPrice:V,stock:R,goodsName:z,row:M,col:O,"radio-group":"_radio-group_i7yn2_61",radio:j,badge:F,section:J,detail:U,photoDetail:K,goodsDetail:Q,actionBar:X,addCertBtn:Y,buyGroup:Z,selectWrap:tt,shareBtn:et,shareWrap:ot,sharePic:st,shareLeft:it,shareShopTitle:at,shareShopDes:rt,shareShopValue:lt,shareShopOldPrice:nt,wxpopup:ct};function pt(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!I(t)}var At=g({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(d.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?${y.stringify(i)}`):(p({api:"openWebView",content:{url:`${location.origin}/student/#/goodsDetail?${y.stringify(i)}`,orientation:1,isHideTitle:!1}}),p({api:"back"}))}else d.platformType==="TEACHER"&&b.alert({title:"\u63D0\u793A",message:"\u8BF7\u4F7F\u7528\u9177\u4E50\u79C0\u5B66\u751F\u7AEF\u626B\u7801\u6253\u5F00"}).then(()=>{p({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}`;h(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){m({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,f)=>(t.srcElement==l&&(o=f),l.src));m({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}`;h(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(u,{center:!0,border:!1},{title:()=>e("div",{class:a.priceGroup},[e("span",{class:a.price},[e("i",null,[n("\xA5")]),w(this.getPrice)])])}),e(u,{center:!0,border:!1,title:i.name,titleClass:[a.goodsName,"van-ellipsis"]},null)]}),e(q,{class:[a.row,"mb12"]},{default:()=>[e(_,{span:4,class:a.col},{default:()=>[n("\u89C4\u683C")]}),e(_,{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},pt(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{At as default};