Files
wechat_wc/dist/pages/shop/detail/index.js
T
2026-08-04 11:07:38 +08:00

1 line
6.3 KiB
JavaScript

"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[158],{3483:function(s,e,c){var a=c(7842),o=c(5544),t=c(118),n=c(758),i=c.n(n),r=c(6540),l=c(5234),h=c(4848),p=function(s,e,c){return Math.min(Math.max(s,e),c)},d=function(s,e,c){return s+(e-s)*c},x=function(s){return 1-Math.pow(1-s,3)};function m(){var s,e,c=(0,r.useState)(667),a=(0,o.A)(c,2),n=a[0],m=a[1],u=(0,r.useState)(0),g=(0,o.A)(u,2),j=g[0],N=g[1],b=null===(s=i().getCurrentInstance().router)||void 0===s?void 0:s.params,f=(null===b||void 0===b?void 0:b.id)||"",v=l.zv.find(function(s){return s.id===f});(0,r.useEffect)(function(){try{var s=i().getSystemInfoSync();m(s.windowHeight)}catch(s){}},[]);var y=(0,r.useCallback)(function(s){var e,c,a=null!==(e=null===(c=s.detail)||void 0===c?void 0:c.scrollTop)&&void 0!==e?e:0,o=1.2*n,t=p(a/o,0,1);N(t)},[n]),S=(0,r.useMemo)(function(){var s=j,e=0,c=0;if(s<=.4){var a=x(s/.4);e=d(0,32,a),c=d(0,38,a)}else if(s<=.55){var o=(s-.4)/.15;e=d(32,34,o),c=d(38,41,o)}else e=34,c=41;var t=0;t=s<=.4?0:s<=.7?d(0,-75,(s-.4)/.3):-75;var n=1;n=s<=.35?1:s<=.48?p(1-(s-.35)/.13,0,1):0;var i=0;i=s<=.55?0:s<=.7?(s-.55)/.15:1;var r=1,l=0;if(s<=.05)r=0,l=60;else if(s<=.22){var h=(s-.05)/.17;r=x(h),l=d(60,0,x(h))}var m=1;return s<=.15&&(m=p(1-s/.15,0,1)),{topCrop:e,bottomCrop:c,translateY:t,heroInfoOpacity:n,bandOpacity:i,contentOpacity:r,contentOffset:l,backBtnOpacity:m,visibleHeight:100-e-c}},[j]),Y=(0,r.useMemo)(function(){return(null===v||void 0===v?void 0:v.tone)||[28,22,18]},[v]);return v?(0,h.jsxs)(t.Ss,{className:"shop-detail-page",children:[(0,h.jsxs)(t.Ss,{className:"shop-hero-fixed",children:[(0,h.jsx)(t.Ss,{className:"shop-hero-clip",style:{height:"".concat(n*S.visibleHeight/100,"px"),overflow:"hidden",transform:"translateY(".concat(n*S.translateY/100,"px)")},children:(0,h.jsx)(t._V,{className:"shop-hero-img",src:(null===(e=v.images)||void 0===e?void 0:e[0])||v.iconImg||"",mode:"aspectFill",style:{width:"100%",height:"".concat(n,"px"),position:"absolute",top:"".concat(-n*S.topCrop/100,"px"),left:0}})}),(0,h.jsx)(t.Ss,{className:"shop-hero-overlay",style:{background:"linear-gradient(to bottom, rgba(".concat(Y[0],", ").concat(Y[1],", ").concat(Y[2],", 0) 0%, rgba(").concat(Y[0],", ").concat(Y[1],", ").concat(Y[2],", 0.55) 40%, rgba(").concat(Y[0],", ").concat(Y[1],", ").concat(Y[2],", 0.95) 100%)")}}),(0,h.jsxs)(t.Ss,{className:"shop-hero-info",style:{opacity:S.heroInfoOpacity},children:[(0,h.jsx)(t.EY,{className:"shop-hero-title",children:v.name}),(0,h.jsx)(t.EY,{className:"shop-hero-subtitle",children:v.subtitle||v.desc}),(0,h.jsxs)(t.Ss,{className:"shop-hero-price-row",children:[(0,h.jsxs)(t.EY,{className:"shop-hero-price",children:["\xa5",v.price]}),v.originalPrice&&v.originalPrice>v.price&&(0,h.jsxs)(t.EY,{className:"shop-hero-original",children:["\xa5",v.originalPrice]})]})]})]}),(0,h.jsxs)(t.BM,{className:"shop-scroll",scrollY:!0,scrollEventThrottle:16,style:{height:"".concat(n,"px")},onScroll:y,children:[(0,h.jsx)(t.Ss,{style:{height:"".concat(.65*n,"px")}}),(0,h.jsxs)(t.Ss,{className:"shop-content",style:{backgroundColor:"rgb(".concat(Y[0],", ").concat(Y[1],", ").concat(Y[2],")")},children:[(0,h.jsxs)(t.Ss,{className:"shop-band",style:{opacity:S.bandOpacity,backgroundColor:"rgba(".concat(Y[0],", ").concat(Y[1],", ").concat(Y[2],", 0.88)"),backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[(0,h.jsx)(t.EY,{className:"shop-band-title",children:v.name}),(0,h.jsx)(t.EY,{className:"shop-band-subtitle",children:v.subtitle||v.desc}),(0,h.jsxs)(t.Ss,{className:"shop-band-price-row",children:[(0,h.jsxs)(t.EY,{className:"shop-band-price",children:["\xa5",v.price]}),v.originalPrice&&v.originalPrice>v.price&&(0,h.jsxs)(t.EY,{className:"shop-band-original",children:["\xa5",v.originalPrice]})]})]}),(0,h.jsxs)(t.Ss,{className:"shop-detail-body",style:{opacity:S.contentOpacity,transform:"translateY(".concat(S.contentOffset,"px)")},children:[v.story&&(0,h.jsxs)(t.Ss,{className:"shop-section",children:[(0,h.jsx)(t.EY,{className:"shop-section-title",children:"\u8bbe\u8ba1\u7406\u5ff5"}),(0,h.jsx)(t.EY,{className:"shop-section-text",children:v.story})]}),(0,h.jsx)(t.Ss,{className:"shop-divider"}),v.scene&&(0,h.jsxs)(t.Ss,{className:"shop-section",children:[(0,h.jsx)(t.EY,{className:"shop-section-title",children:"\u4f7f\u7528\u573a\u666f"}),(0,h.jsx)(t.EY,{className:"shop-section-text",children:v.scene})]}),v.tags&&v.tags.length>0&&(0,h.jsx)(t.Ss,{className:"shop-section",children:(0,h.jsx)(t.Ss,{className:"shop-tag-row",children:v.tags.map(function(s){return(0,h.jsx)(t.Ss,{className:"shop-tag",children:(0,h.jsx)(t.EY,{className:"shop-tag-text",children:s})},s)})})}),(0,h.jsx)(t.Ss,{className:"shop-divider"}),v.specs&&v.specs.length>0&&(0,h.jsxs)(t.Ss,{className:"shop-section",children:[(0,h.jsx)(t.EY,{className:"shop-section-title",children:"\u89c4\u683c\u53c2\u6570"}),(0,h.jsx)(t.Ss,{className:"shop-spec-table",children:v.specs.map(function(s){var e=(0,o.A)(s,2),c=e[0],a=e[1];return(0,h.jsxs)(t.Ss,{className:"shop-spec-row",children:[(0,h.jsx)(t.EY,{className:"shop-spec-key",children:c}),(0,h.jsx)(t.EY,{className:"shop-spec-val",children:a})]},c)})})]}),(0,h.jsx)(t.Ss,{className:"shop-bottom-spacer"})]})]})]},v.id),(0,h.jsx)(t.Ss,{className:"shop-back-btn",onTap:function(){return i().navigateBack()},style:{opacity:S.backBtnOpacity},children:(0,h.jsx)(t.EY,{className:"shop-back-arrow",children:"\u2190"})}),(0,h.jsxs)(t.Ss,{className:"shop-cta-bar",style:{backgroundColor:"rgba(".concat(Y[0],", ").concat(Y[1],", ").concat(Y[2],", 0.92)")},children:[(0,h.jsxs)(t.Ss,{className:"shop-cta-price-col",children:[(0,h.jsxs)(t.EY,{className:"shop-cta-price",children:["\xa5",v.price]}),v.originalPrice&&v.originalPrice>v.price&&(0,h.jsxs)(t.EY,{className:"shop-cta-original",children:["\xa5",v.originalPrice]})]}),(0,h.jsx)(t.Ss,{className:"shop-cta-btn",onTap:function(){return i().navigateTo({url:"/pages/product/index?id=".concat(v.id)})},children:(0,h.jsx)(t.EY,{className:"shop-cta-btn-text",children:"\u7acb\u5373\u5b9a\u5236"})})]})]}):(0,h.jsx)(t.Ss,{className:"shop-detail-page",children:(0,h.jsx)(t.EY,{style:{color:"#fff",padding:"40rpx"},children:"\u5546\u54c1\u4e0d\u5b58\u5728"})})}var u={navigationStyle:"custom"};Page((0,a.createPageConfig)(m,"pages/shop/detail/index",{root:{cn:[]}},u||{}))}},function(s){var e=function(e){return s(s.s=e)};s.O(0,[907,96,76],function(){return e(3483)});s.O()}]);