import{d as a,r as e,P as t,z as n,o as l,p as o,c as s,g as d,f as r,h as i,w as u,j as c,l as m,t as g,u as b,m as f,n as h,F as v,e as p,x as I,E as k,k as P}from"./index.d07e372e.js";import{_ as y}from"./plugin-vue_export-helper.21dcd24c.js";var _=y(a({setup(a){const y=e({title:t.getTitle(),tab:{active:"detail",list:[{title:"详情",name:"detail",url:""},{title:"图+二维码",name:"pictureAndQrCode",url:""},{title:"二维码",name:"qrCode",url:""},{title:"无底高清",name:"skuImage",url:""},{title:"吊牌",name:"handTag",url:""}]},skuId:"",data:{},brand:{},otherInfo:{color:"",material:""}}),_=n((()=>{var a;if(!(null==(a=y.data)?void 0:a.skuJson))return"";return y.data.skuJson.find((a=>a.skuId==y.skuId))}));function L(a){const e=new Blob([a],{type:"image/jpg"});return new Promise(((a,t)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>a(n.result),n.onerror=a=>t(a)}))}function C(a){_.value&&("detail"==a?function(){console.log(y.otherInfo,"state.otherInfo");const a=y.tab.list.find((a=>"detail"==a.name));a&&!a.url&&s.imageDetail({brandLogo:y.brand.brandLogo,skuImage:_.value.mainImg,model:_.value.model,productPrice:_.value.productPrice,salePrice:_.value.salePrice,skuId:y.skuId,domain:d("subdomain"),specify:`W${_.value.specWidth}*H${_.value.specHeight}*D${_.value.specLength}`,color:y.otherInfo.color,lights:_.value.lightSourceCount||"",material:y.otherInfo.material,isSJS:null!==_.value.salePrice?1:0}).then((e=>{L(e).then((e=>{a.url=e}))}))}():"pictureAndQrCode"==a?function(){const a=y.tab.list.find((a=>"pictureAndQrCode"==a.name));a&&!a.url&&s.pictureAndQrCode({brandLogo:y.brand.brandLogo,skuImage:_.value.mainImg,model:_.value.model,skuId:y.skuId,domain:d("subdomain")}).then((e=>{L(e).then((e=>{a.url=e}))}))}():"qrCode"==a?function(){const a=y.tab.list.find((a=>"qrCode"==a.name));a&&!a.url&&s.imageQrCode({brandLogo:y.brand.brandLogo,model:_.value.model,skuId:y.skuId,domain:d("subdomain")}).then((e=>{L(e).then((e=>{a.url=e}))}))}():"skuImage"==a?function(){const a=y.tab.list.find((a=>"skuImage"==a.name));a&&!a.url&&s.skuImage({brandLogo:y.brand.brandLogo,skuImage:_.value.mainImg,model:_.value.model,productPrice:_.value.productPrice,salePrice:_.value.salePrice,skuId:y.skuId,domain:d("subdomain"),specify:`W${_.value.specWidth}*H${_.value.specHeight}*D${_.value.specLength}`,color:y.otherInfo.color,lights:_.value.lightSourceCount||"",material:y.otherInfo.material,isSJS:null!==_.value.salePrice?1:0}).then((e=>{L(e).then((e=>{a.url=e}))}))}():"handTag"==a&&function(){const a=y.tab.list.find((a=>"handTag"==a.name));a&&!a.url&&s.handTag({brandLogo:y.brand.brandLogo,skuImage:_.value.mainImg,model:_.value.model,productPrice:_.value.productPrice,skuId:y.skuId,domain:d("subdomain"),specify:`W${_.value.specWidth}*H${_.value.specHeight}*D${_.value.specLength}`,classify:y.data.classify,brandName:y.brand.brandName,material:y.otherInfo.material}).then((e=>{L(e).then((e=>{a.url=e}))}))}())}function w(){t.goBack()}return l((()=>{const a=t.getCurQuery();y.skuId=a.skuId,y.skuId?s.getProduct(y.skuId,{domain:d("subdomain")}).then((a=>{y.data=a;const e=y.data.labelJson.find((a=>"10011"==a.labelNum)),t=y.data.labelJson.find((a=>"10010"==a.labelNum));e&&(y.otherInfo.color=e.labelParams.map((a=>a.name)).join(",")),t&&(y.otherInfo.material=t.labelParams.map((a=>a.name)).join(",")),s.brandInfo({brandId:y.data.brandId}).then((a=>{y.brand=a;const e=y.tab.list.find((a=>a.name==y.tab.active));C(e?e.name:y.tab.list[0].name)}))})):o({url:"/pages/index"})})),(a,e)=>{const t=p("van-icon"),n=I,l=p("van-tab"),o=p("van-tabs"),s=p("van-sticky"),d=p("van-image");return r(),i(n,{class:"text-center"},{default:u((()=>[c(s,null,{default:u((()=>[c(n,{class:"sh mg-b-40"},{default:u((()=>[c(n,{class:"top-bar justify-center bg-white"},{default:u((()=>[c(t,{class:"top-left",name:"arrow-left",onClick:w}),c(n,{class:"top-center"},{default:u((()=>[m(g(b(y).title),1)])),_:1})])),_:1}),c(o,{class:"top_tab",active:b(y).tab.active,"onUpdate:active":e[0]||(e[0]=a=>b(y).tab.active=a),onChange:C,scrollspy:""},{default:u((()=>[(r(!0),f(v,null,h(b(y).tab.list,((a,e)=>(r(),i(l,{name:a.name},{title:u((()=>[c(n,{style:k(1==e?"width:78px":"")},{default:u((()=>[m(g(a.title),1)])),_:2},1032,["style"])])),_:2},1032,["name"])))),256))])),_:1},8,["active"])])),_:1})])),_:1}),c(n,{style:{height:"140vw"}},{default:u((()=>[(r(!0),f(v,null,h(b(y).tab.list,((a,e)=>(r(),f(v,null,[b(y).tab.active==a.name&&a.url?(r(),i(d,{key:0,"lazy-load":"","loading-icon":"https://img.edsmall.com/ROOT/ETao/fenxiao/h5/default.png","icon-size":"81vw",height:"126vw",width:"81vw",src:a.url},null,8,["src"])):P("v-if",!0)],64)))),256))])),_:1}),c(n,{class:"text-gray pd-20"},{default:u((()=>[m(g(">>长按上方图片保存<<"))])),_:1})])),_:1})}}}),[["__scopeId","data-v-f2a86a04"]]);export{_ as default};
