Files
wechat_wc/dist/pages/shop/detail/index.js
T

1 line
6.6 KiB
JavaScript

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