- 新增 PaymentCountdown、ProductImage 组件 - 完善 checkout/orders/orderDetail 订单支付链路与地址、商品、设计数据 - request 接口地址改为构建期注入并保留真实网络错误,默认兜底线上地址 - 同步重新构建 dist 产物
1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[95],{8955:function(e,a,s){var n=s(7842),t=s(9379),c=s(1212),i=s(436),r=s(467),l=s(5544),o=s(118),d=s(758),u=s.n(d),h=s(6540),p=s(5234),m=s(1457),x=s(7334),g=s(5848),f=s(9703),v=s(9201),j=s(5414),N=s(9674),S=s(3053),w=s(9513),y=s(4848);function b(){var e=(0,f.wR)(),a=(e.theme,e.resolvedTheme),s=(0,v.c)();(0,j.l)(a);var n=(0,h.useState)(null),d=(0,l.A)(n,2),b=d[0],k=d[1],A=(0,h.useState)(1),T=(0,l.A)(A,2),E=(T[0],T[1],(0,h.useState)("")),Y=(0,l.A)(E,2),D=Y[0],I=Y[1],O=(0,h.useState)(1),P=(0,l.A)(O,2),_=(P[0],P[1]),F=(0,h.useState)([]),M=(0,l.A)(F,2),B=M[0],R=M[1],z=(0,h.useState)(null),V=(0,l.A)(z,2),C=V[0],J=V[1],X=(0,h.useState)(!1),q=(0,l.A)(X,2),G=q[0],H=q[1],L=(0,h.useState)({x:0,y:0}),K=(0,l.A)(L,2),Q=K[0],U=K[1],W=(0,h.useState)(!1),Z=(0,l.A)(W,2),$=Z[0],ee=Z[1],ae=(0,h.useState)(!1),se=(0,l.A)(ae,2),ne=se[0],te=se[1],ce=(0,h.useState)(!1),ie=(0,l.A)(ce,2),re=ie[0],le=ie[1];(0,h.useEffect)(function(){var e=u().getCurrentInstance().router,a=e?e.params:void 0,s=a?a.source:void 0,n=a&&a.productId||a&&a.category,t=function(){var e=(0,r.A)((0,c.A)().m(function e(a,s){var n,t;return(0,c.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return n={id:"DSG"+Date.now(),productId:a.id,productName:a.name,productIcon:a.icon,unitPrice:a.price,count:s,status:"designing",createdAt:(new Date).toISOString().slice(0,10)},(0,m.Fu)([].concat((0,i.A)((0,m.p_)()),[n])),I(n.id),le(!0),e.p=1,e.n=2,(0,g.x9)({productId:n.productId,productName:n.productName,unitPrice:n.unitPrice,count:n.count,designData:n.designData});case 2:t=e.v,(0,m.Fu)((0,m.p_)().map(function(e){return e.id===n.id?t:e})),I(t.id),e.n=4;break;case 3:e.p=3,e.v;case 4:return e.p=4,le(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(a,s){return e.apply(this,arguments)}}();if("product"===s&&n){var l=(0,p.y9)(n);if(l){k(l);var o=Number(a?a.quantity:void 0)||1;_(o),t(l,o)}}else if("designList"===s&&a&&a.designId){var d=a.designId,h=(0,m.p_)(),x=h.find(function(e){return e.id===d});if(x){I(d),_(x.count);var f=(0,p.y9)(x.productId);if(f&&k(f),x.designData?x.designData.stickers:void 0)R(x.designData.stickers);else if(x.designData?x.designData.imageSrc:void 0){var v={id:"legacy_"+Date.now(),src:x.designData.imageSrc,x:x.designData.imagePos&&x.designData.imagePos.x||0,y:x.designData.imagePos&&x.designData.imagePos.y||0,scale:x.designData.imagePos&&x.designData.imagePos.scale||1,width:200,height:200,isOverlapping:!1};R([v])}}}else if(n){var j=(0,p.y9)(n);j&&(k(j),t(j,1))}},[]);var oe=function(e){for(var a=e.map(function(e){return(0,t.A)((0,t.A)({},e),{},{isOverlapping:!1})}),s=0;s<a.length;s++)for(var n=s+1;n<a.length;n++){var c=a[s],i=a[n],r=c.width*c.scale,l=c.height*c.scale,o=i.width*i.scale,d=i.height*i.scale;c.x<i.x+o&&c.x+r>i.x&&c.y<i.y+d&&c.y+l>i.y&&(a[s].isOverlapping=!0,a[n].isOverlapping=!0)}var u=a.some(function(e){return e.isOverlapping});return te(u),a},de=function(){u().chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){var a=e.tempFilePaths[0];u().getImageInfo({src:a,success:function(e){var s={id:"stk_"+Date.now(),src:a,x:0,y:0,scale:1,width:e.width,height:e.height,isOverlapping:!1},n=[].concat((0,i.A)(B),[s]),t=oe(n);R(t),J(s.id)},fail:function(){var e={id:"stk_"+Date.now(),src:a,x:0,y:0,scale:1,width:200,height:200,isOverlapping:!1},s=[].concat((0,i.A)(B),[e]),n=oe(s);R(n),J(e.id)}})}})},ue=function(e){var a=B.filter(function(a){return a.id!==e}),s=oe(a);R(s),C===e&&J(null)},he=function(e,a){var s=e.touches[0],n=B.find(function(e){return e.id===a});n&&(J(a),H(!0),U({x:s.clientX-n.x,y:s.clientY-n.y}))},pe=function(e){if(G&&C){var a=e.touches[0],s=B.map(function(e){return e.id!==C?e:(0,t.A)((0,t.A)({},e),{},{x:a.clientX-Q.x,y:a.clientY-Q.y})}),n=oe(s);R(n)}},me=function(){return H(!1)},xe=function(){C&&D&&u().navigateTo({url:"/pages/diy/stickerEdit/index?designId=".concat(D,"&stickerId=").concat(C)})},ge=function(e,a){var s=B.map(function(s){return s.id!==e?s:(0,t.A)((0,t.A)({},s),{},{scale:Math.max(.3,Math.min(3,s.scale+a))})}),n=oe(s);R(n)},fe=function(){u().navigateBack()},ve=function(){if(!b)return{width:300,height:420};var e={width:b.mask.width,height:b.mask.height};return"rect"===b.mask.shape&&(e.borderRadius=b.mask.borderRadius||0),"circle"===b.mask.shape&&(e.borderRadius="50%"),e},je=function(){var e=(0,r.A)((0,c.A)().m(function e(){var a;return(0,c.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!re){e.n=1;break}return u().showToast({title:"\u6b63\u5728\u521b\u5efa\u8bbe\u8ba1\uff0c\u8bf7\u7a0d\u5019",icon:"none"}),e.a(2);case 1:if(!ne){e.n=2;break}return u().showToast({title:"\u8d34\u7eb8\u4e0d\u80fd\u91cd\u53e0",icon:"none"}),e.a(2);case 2:if(!D){e.n=7;break}return e.n=3,(0,x.x5)({stickers:B,category:b,version:1});case 3:return a=e.v,(0,m.i5)(D,{designData:a}),e.p=4,e.n=5,(0,g.i5)(D,{designData:a,status:"designing"});case 5:e.n=7;break;case 6:e.p=6,e.v;case 7:ee(!1),u().navigateTo({url:"/pages/checkout/index?designId=".concat(D)});case 8:return e.a(2)}},e,null,[[4,6]])}));return function(){return e.apply(this,arguments)}}(),Ne=C?B.find(function(e){return e.id===C}):void 0,Se=Ne?Ne.scale:1;return b?(0,y.jsxs)(o.Ss,{className:"theme-".concat(a),children:[(0,y.jsx)(N.A,{}),(0,y.jsx)(S.A,{title:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0",targetSelector:".page-header.surface-card",showBack:!0}),(0,y.jsxs)(o.Ss,{className:"diy-page",children:[(0,y.jsx)(o.Ss,{className:"page-header surface-card",style:{paddingTop:"".concat(s.statusBarHeight+12,"px")},children:(0,y.jsxs)(o.Ss,{className:"flex-between",style:{width:"100%"},children:[(0,y.jsx)(o.EY,{className:"back-btn",onTap:fe,children:"\u2190"}),(0,y.jsx)(o.EY,{className:"page-title",children:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0"}),(0,y.jsx)(o.Ss,{className:"header-spacer"})]})}),(0,y.jsx)(o.Ss,{className:"canvas-wrapper surface-card mt-20",catchMove:!0,children:(0,y.jsxs)(o.Ss,{className:"canvas-area",style:ve(),children:[B.map(function(e){return(0,y.jsx)(o._V,{className:"canvas-image ".concat(e.isOverlapping?"overlap":""," ").concat(C===e.id?"active":""),src:e.src,style:{transform:"translate(".concat(e.x,"px, ").concat(e.y,"px) scale(").concat(e.scale,")"),opacity:G&&C===e.id?.8:1,zIndex:C===e.id?10:5,width:e.width||200,height:e.height||200},onTouchStart:function(a){return he(a,e.id)},onTouchMove:pe,onTouchEnd:me,onTap:function(){return J(e.id)},mode:"aspectFit"},e.id)}),(0,y.jsx)(o.Ss,{className:"mask-border",style:ve()})]})}),(0,y.jsxs)(o.Ss,{className:"sticker-panel surface-card mt-20",children:[(0,y.jsx)(o.EY,{className:"section-title",children:"\u8d34\u7eb8"}),(0,y.jsxs)(o.Ss,{className:"sticker-list",children:[B.map(function(e){return(0,y.jsxs)(o.Ss,{className:"sticker-thumb ".concat(e.isOverlapping?"overlap":""," ").concat(C===e.id?"active":""),children:[(0,y.jsx)(o._V,{src:e.src,className:"sticker-thumb-img",mode:"aspectFit",onTap:function(){return J(e.id)}}),(0,y.jsx)(o.Ss,{className:"sticker-del",onTap:function(){return ue(e.id)},children:(0,y.jsx)(o.EY,{className:"del-icon",children:"\xd7"})})]},e.id)}),(0,y.jsxs)(o.Ss,{className:"sticker-add-btn",onTap:de,children:[(0,y.jsx)(o.EY,{className:"add-icon",children:"+"}),(0,y.jsx)(o.EY,{className:"add-label",children:"\u6dfb\u52a0"})]})]}),ne&&(0,y.jsx)(o.EY,{className:"overlap-hint",children:"\u6709\u8d34\u7eb8\u91cd\u53e0\uff0c\u8bf7\u8c03\u6574\u4f4d\u7f6e"})]}),C&&(0,y.jsxs)(o.Ss,{className:"toolbar surface-card mt-20",children:[(0,y.jsxs)(o.Ss,{className:"tool-row",children:[(0,y.jsx)(o.EY,{className:"tool-label",children:"\u7f29\u653e"}),(0,y.jsxs)(o.Ss,{className:"flex-center",style:{gap:"20px"},children:[(0,y.jsx)(o.Ss,{className:"tool-btn",onTap:function(){return ge(C,-.1)},children:"\uff0d"}),(0,y.jsxs)(o.EY,{className:"tool-value",children:[Math.round(100*Se),"%"]}),(0,y.jsx)(o.Ss,{className:"tool-btn",onTap:function(){return ge(C,.1)},children:"\uff0b"})]})]}),(0,y.jsxs)(o.Ss,{className:"tool-row",children:[(0,y.jsx)(o.EY,{className:"tool-label",children:"\u63d0\u793a"}),(0,y.jsx)(o.EY,{className:"tool-hint",children:"\u62d6\u52a8\u8c03\u6574\u4f4d\u7f6e\uff0c\u8d34\u7eb8\u4e0d\u53ef\u91cd\u53e0"})]})]}),(0,y.jsx)(o.Ss,{className:"edit-btn-bar mt-20",children:(0,y.jsx)(o.Ss,{className:"edit-btn ".concat(C?"active":"disabled"),onTap:xe,children:(0,y.jsx)(o.EY,{children:"\u7f16\u8f91"})})}),(0,y.jsxs)(w.A,{children:[(0,y.jsx)(o.Ss,{className:"btn-primary",onTap:function(){return ee(!0)},children:(0,y.jsx)(o.EY,{children:"\u9884\u89c8\u6548\u679c"})}),(0,y.jsx)(o.Ss,{className:"btn-secondary",onTap:de,children:(0,y.jsx)(o.EY,{children:"\u6dfb\u52a0\u8d34\u7eb8"})})]}),$&&(0,y.jsx)(o.Ss,{className:"preview-overlay",children:(0,y.jsxs)(o.Ss,{className:"preview-card surface-card",children:[(0,y.jsx)(o.EY,{className:"preview-title",children:"\u786e\u8ba4\u6548\u679c"}),(0,y.jsx)(o.Ss,{className:"preview-canvas",style:ve(),children:B.map(function(e){return(0,y.jsx)(o._V,{className:"preview-image ".concat(e.isOverlapping?"overlap":""),src:e.src,style:{transform:"translate(".concat(e.x,"px, ").concat(e.y,"px) scale(").concat(e.scale,")"),width:e.width||200,height:e.height||200},mode:"aspectFit"},e.id)})}),(0,y.jsxs)(o.Ss,{className:"product-info",children:[(0,y.jsx)(o.EY,{className:"product-name",children:b.name}),(0,y.jsxs)(o.EY,{className:"product-size",children:["\u753b\u5e03\u5c3a\u5bf8: ",b.mask.width," \xd7 ",b.mask.height," px"]}),ne&&(0,y.jsx)(o.EY,{className:"overlap-hint",children:"\u8d34\u7eb8\u6709\u91cd\u53e0\uff0c\u4e0d\u53ef\u63d0\u4ea4"})]}),(0,y.jsxs)(o.Ss,{className:"preview-actions",children:[(0,y.jsx)(o.Ss,{className:"btn-secondary",onTap:function(){return ee(!1)},children:(0,y.jsx)(o.EY,{children:"\u8fd4\u56de\u4fee\u6539"})}),(0,y.jsx)(o.Ss,{className:"btn-primary ".concat(ne?"disabled":""),onTap:je,children:(0,y.jsx)(o.EY,{children:"\u786e\u8ba4\u5b8c\u6210"})})]})]})}),(0,y.jsx)(o.Ss,{className:"safe-bottom-placeholder"})]})]}):(0,y.jsxs)(o.Ss,{className:"theme-".concat(a),children:[(0,y.jsx)(N.A,{}),(0,y.jsx)(S.A,{title:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0",targetSelector:".page-header.surface-card",showBack:!0}),(0,y.jsx)(o.Ss,{className:"diy-page",children:(0,y.jsx)(o.EY,{className:"page-title",children:"\u52a0\u8f7d\u4e2d..."})})]})}var k={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"DIY\u5de5\u4f5c\u53f0"};Page((0,n.createPageConfig)(b,"pages/diy/index",{root:{cn:[]}},k||{}))}},function(e){var a=function(a){return e(e.s=a)};e.O(0,[907,96,76],function(){return a(8955)});e.O()}]); |