Files
wechat_wc/dist/pages/product/index.js
T
lhmin0604andClaude eea6c3feef fix(diy): 草稿持久化 + 进入工作台即设计中 + 编辑页空态兜底
修正工作流批次①(问题 2+3+4):
- 问题2: 贴纸变化防抖 800ms 落缓存+服务端静默同步,
  useDidHide/卸载前强制 flush;中途退出不再丢布局
- 问题3: 进入工作台(新建/继续)即 PATCH designing(SUBMITTED),
  取代原「确认完成才提交」触发点
- 问题4: 草稿实时写缓存后贴纸编辑页始终能读到 stickers;
  另加 notFound 空态(未找到贴纸提示 + 返回工作台),
  handleEditSticker 跳转前 flushDraft 关闭防抖竞态窗口

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-12 19:07:07 +08:00

1 line
7.0 KiB
JavaScript

"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[612],{4120:function(s,e,a){var c=a(7842),n=a(436),l=a(5544),r=a(118),i=a(758),t=a.n(i),o=a(6540),d=a(5234),m=a(1457),h=a(6845),x=a(9703),p=a(9201),j=a(5414),u=a(9674),N=a(3053),S=a(9513),g=a(4848);function f(){var s=(0,x.wR)(),e=(s.theme,s.resolvedTheme),a=(0,p.c)();(0,j.l)(e);var c=(0,o.useState)(!1),i=(0,l.A)(c,2),f=i[0],E=i[1],Y=(0,o.useState)(1),v=(0,l.A)(Y,2),y=v[0],b=v[1],k=t().getCurrentInstance().router,w=k?k.params:void 0,T=w&&w.id?w.id:"",B=(0,d.y9)(T);if(!B)return(0,g.jsxs)(r.Ss,{className:"theme-".concat(e),children:[(0,g.jsx)(u.A,{}),(0,g.jsx)(N.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".page-header",showBack:!0}),(0,g.jsx)(r.Ss,{className:"product-page",children:(0,g.jsx)(r.Ss,{className:"page-header",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:(0,g.jsxs)(r.Ss,{className:"page-header-inner",children:[(0,g.jsx)(r.Ss,{className:"back-btn",style:{position:"fixed",left:"30rpx",top:"".concat(a.menuButtonTop,"px"),zIndex:41},onTap:function(){return t().navigateBack()},children:(0,g.jsx)(r.EY,{className:"back-arrow",children:"\u2190"})}),(0,g.jsx)(r.Ss,{className:"nav-placeholder"}),(0,g.jsx)(r.EY,{className:"nav-title",children:"\u5546\u54c1\u672a\u627e\u5230"}),(0,g.jsx)(r.Ss,{className:"nav-placeholder"})]})})})]});var A=B.specs&&B.specs.length>0?B.specs.find(function(s){return s[0].indexOf("\u5de5\u827a")>=0}):void 0,q=A?A[1]:"\u6fc0\u5149\u5fae\u96d5",P=function(){b(1),E(!0)},C=function(){(0,h.x9)({productId:B.id,productName:B.name,unitPrice:B.price,count:y}).then(function(s){(0,m.Fu)([s].concat((0,n.A)((0,m.p_)()))),t().showToast({title:"\u5df2\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355 x".concat(y),icon:"success"})}).catch(function(){(0,m.cY)(B,y),t().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u52a0\u5165\u672c\u5730\u6e05\u5355 x".concat(y),icon:"none"})}).finally(function(){E(!1),setTimeout(function(){return t().navigateBack()},1200)})},F=function(){t().navigateTo({url:"/pages/diy/index?source=product&productId=".concat(B.id,"&quantity=1")})},I=function(s){b(function(e){return Math.max(1,Math.min(99,e+s))})};return(0,g.jsxs)(r.Ss,{className:"theme-".concat(e),children:[(0,g.jsx)(u.A,{}),(0,g.jsx)(N.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".page-header",showBack:!0}),(0,g.jsxs)(r.Ss,{className:"product-page",children:[(0,g.jsx)(r.Ss,{className:"page-header",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:(0,g.jsxs)(r.Ss,{className:"page-header-inner",children:[(0,g.jsx)(r.Ss,{className:"back-btn",style:{position:"fixed",left:"30rpx",top:"".concat(a.menuButtonTop,"px"),zIndex:41},onTap:function(){return t().navigateBack()},children:(0,g.jsx)(r.EY,{className:"back-arrow",children:"\u2190"})}),(0,g.jsx)(r.Ss,{className:"nav-placeholder"}),(0,g.jsx)(r.EY,{className:"nav-title",children:"\u5546\u54c1\u8be6\u60c5"}),(0,g.jsx)(r.Ss,{className:"nav-placeholder"})]})}),(0,g.jsx)(r.Ss,{className:"hero-section",children:(0,g.jsx)(r.RC,{className:"hero-swiper",circular:!0,autoplay:!0,interval:3e3,duration:500,indicatorDots:!0,indicatorColor:"var(--border-strong)",indicatorActiveColor:"var(--accent-primary)",children:B.images&&B.images.length>0?B.images.map(function(s,e){return(0,g.jsx)(r.wu,{children:(0,g.jsx)(r.Ss,{className:"hero-block",children:(0,g.jsx)(r._V,{className:"hero-image",src:s,mode:"aspectFill"})})},e)}):(0,g.jsx)(r.wu,{children:(0,g.jsx)(r.Ss,{className:"hero-block hero-block-fallback",children:(0,g.jsx)(r._V,{className:"hero-fallback-icon",src:(0,d.QE)(B),mode:"aspectFit"})})})})}),(0,g.jsx)(r.Ss,{className:"detail-card surface-card",children:(0,g.jsxs)(r.Ss,{className:"price-line",children:[(0,g.jsxs)(r.Ss,{className:"price-left",children:[(0,g.jsx)(r.EY,{className:"detail-title",children:B.name}),(0,g.jsx)(r.EY,{className:"detail-desc",children:B.desc})]}),(0,g.jsxs)(r.Ss,{className:"price-right",children:[(0,g.jsxs)(r.EY,{className:"price",children:["\xa5",B.price]}),B.originalPrice&&B.originalPrice>B.price&&(0,g.jsxs)(r.EY,{className:"price-old",children:["\xa5",B.originalPrice]})]})]})}),(0,g.jsxs)(r.Ss,{className:"detail-card surface-card",children:[(0,g.jsxs)(r.Ss,{className:"spec-row",children:[(0,g.jsx)(r.EY,{className:"spec-key",children:"\u5355\u4ef7"}),(0,g.jsxs)(r.EY,{className:"spec-value",children:["\xa5",B.price]})]}),(0,g.jsxs)(r.Ss,{className:"spec-row",children:[(0,g.jsx)(r.EY,{className:"spec-key",children:"\u5de5\u671f"}),(0,g.jsx)(r.EY,{className:"spec-value",children:B.leadTime})]}),(0,g.jsxs)(r.Ss,{className:"spec-row",children:[(0,g.jsx)(r.EY,{className:"spec-key",children:"\u5c3a\u5bf8"}),(0,g.jsxs)(r.EY,{className:"spec-value",children:[B.mask.width," \xd7 ",B.mask.height," px"]})]}),(0,g.jsxs)(r.Ss,{className:"spec-row",children:[(0,g.jsx)(r.EY,{className:"spec-key",children:"\u5b9a\u5236\u5de5\u827a"}),(0,g.jsx)(r.EY,{className:"spec-value",children:q})]})]}),(0,g.jsxs)(r.Ss,{className:"detail-card surface-card",children:[(0,g.jsx)(r.EY,{className:"section-title",children:"\u5546\u54c1\u4ecb\u7ecd"}),(0,g.jsx)(r.EY,{className:"detail-text",children:B.description})]}),(0,g.jsxs)(S.A,{children:[(0,g.jsxs)(r.Ss,{className:"price-summary",children:[(0,g.jsx)(r.EY,{className:"summary-label",children:"\u8d77\u4ef7"}),(0,g.jsxs)(r.EY,{className:"summary-price",children:["\xa5",B.price]})]}),(0,g.jsx)(r.Ss,{className:"btn-secondary",onTap:P,children:(0,g.jsx)(r.EY,{children:"\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355"})}),(0,g.jsx)(r.Ss,{className:"btn-primary",onTap:F,children:(0,g.jsx)(r.EY,{children:"\u7acb\u5373\u4e0b\u5355"})})]}),f&&(0,g.jsx)(r.Ss,{className:"modal-overlay",children:(0,g.jsxs)(r.Ss,{className:"modal-card surface-card",children:[(0,g.jsx)(r.EY,{className:"modal-title",children:"\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355"}),(0,g.jsxs)(r.Ss,{className:"modal-product",children:[(0,g.jsx)(r._V,{className:"modal-icon-img",src:(0,d.QE)(B),mode:"aspectFit"}),(0,g.jsx)(r.EY,{className:"modal-name",children:B.name})]}),(0,g.jsxs)(r.Ss,{className:"quantity-row",children:[(0,g.jsx)(r.EY,{className:"qty-label",children:"\u6570\u91cf"}),(0,g.jsxs)(r.Ss,{className:"qty-control",children:[(0,g.jsx)(r.Ss,{className:"qty-btn",onTap:function(){return I(-1)},children:"\uff0d"}),(0,g.jsx)(r.EY,{className:"qty-num",children:y}),(0,g.jsx)(r.Ss,{className:"qty-btn",onTap:function(){return I(1)},children:"\uff0b"})]})]}),(0,g.jsxs)(r.Ss,{className:"modal-total",children:[(0,g.jsx)(r.EY,{className:"total-label",children:"\u5c0f\u8ba1"}),(0,g.jsxs)(r.EY,{className:"total-price",children:["\xa5",(B.price*y).toFixed(2)]})]}),(0,g.jsxs)(r.Ss,{className:"modal-actions",children:[(0,g.jsx)(r.Ss,{className:"btn-secondary",onTap:function(){return E(!1)},children:(0,g.jsx)(r.EY,{children:"\u53d6\u6d88"})}),(0,g.jsx)(r.Ss,{className:"btn-primary",onTap:C,children:(0,g.jsx)(r.EY,{children:"\u786e\u5b9a"})})]})]})})]})]})}var E={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u5546\u54c1\u8be6\u60c5"};Page((0,c.createPageConfig)(f,"pages/product/index",{root:{cn:[]}},E||{}))}},function(s){var e=function(e){return s(s.s=e)};s.O(0,[907,96,76],function(){return e(4120)});s.O()}]);