下单页:撕票根改成抽卡式演出;第 1 步可返回;三色灯张数核对红黄框修复
- 撕票根(金钻:参考二游抽卡,做精致点):待撕时撕线金光呼吸 + 虚拟手指拽存根引导; 拉扯时撕线渐亮、撕口冒方块火花,过撕开点一抖 + 震动 + 「松手!」;撕下时金色闪光 + 撕线金光展开 + MC 方块粒子四散下落 + 存根旋飞 + 本体金边一闪 + 「已归档」印章盖下,空位收起。 票据在这个弹窗里改成白纸。减少动效时只留淡入淡出。 - 手机性能适配那条「所有动画压到 0.12s」把撕票根也压没了(「动画太快」的根子),撕票根排除在外。 - 第 1 步加「← 返回,换个下单方式」:回落地页;卡密路进来的清掉卡密 / 张数规则 / 预选模板。 - 三色灯·张数核对:改版的 .tpl.sel 绿框带 !important,把多了标红 / 少了标黄盖成了绿的;补回(含 5.5% 淡底、深色模式)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+180
-20
@@ -302,6 +302,75 @@ body[data-step="5"] .prog i:nth-child(-n+4){background:var(--acc)}
|
|||||||
.tear-grab.grabbing{cursor:grabbing;box-shadow:0 10px 26px rgba(0,0,0,.28),0 0 0 1px rgba(232,178,58,.45) inset}
|
.tear-grab.grabbing{cursor:grabbing;box-shadow:0 10px 26px rgba(0,0,0,.28),0 0 0 1px rgba(232,178,58,.45) inset}
|
||||||
.tear-grab:focus-visible{outline:2px solid var(--acc);outline-offset:2px}
|
.tear-grab:focus-visible{outline:2px solid var(--acc);outline-offset:2px}
|
||||||
.tearwrap .tear-edge{opacity:calc(.55 + var(--tear-p,0)*.45);transform:scaleY(calc(1 + var(--tear-p,0)*.5))}
|
.tearwrap .tear-edge{opacity:calc(.55 + var(--tear-p,0)*.45);transform:scaleY(calc(1 + var(--tear-p,0)*.5))}
|
||||||
|
/* ===== 撕票根 · 抽卡式演出(金钻 2026-10-07:「参考二游抽卡动画,做精致点;不撕的时候有指引动画,撕下来有动画」)
|
||||||
|
① 待撕:撕线金光呼吸 + 一只「虚拟手指」按住存根往外拽,存根跟着被拽一下(循环;一碰就停)
|
||||||
|
② 拉扯:越拉撕线越亮、撕口冒方块火花;拉过撕开点 → 一抖 + 震动 + 「松手!」
|
||||||
|
③ 撕下:撕线处白金闪光 + 方块粒子四散下落 + 存根旋飞 + 本体一震泛金边 + 「已归档」印章盖下
|
||||||
|
全部只动 transform / opacity / box-shadow;减少动效时只留淡入淡出 */
|
||||||
|
.tearwrap{--gold:#F2C14D}
|
||||||
|
.tear-edge{position:relative}
|
||||||
|
.tear-edge::after{content:"";position:absolute;left:4%;right:4%;top:50%;height:2px;margin-top:-1px;border-radius:2px;
|
||||||
|
background:linear-gradient(90deg,rgba(242,193,77,0),var(--gold) 18%,#fff6d8 50%,var(--gold) 82%,rgba(242,193,77,0));
|
||||||
|
box-shadow:0 0 8px 1px rgba(242,193,77,.55);opacity:calc(var(--tear-p,0)*1.1);pointer-events:none}
|
||||||
|
@keyframes edgeBreath{0%,100%{opacity:.18}50%{opacity:.85}}
|
||||||
|
.tearwrap.hinting .tear-edge::after{animation:edgeBreath 1.8s ease-in-out infinite}
|
||||||
|
.tearwrap.ready .tear-edge::after{opacity:1;box-shadow:0 0 14px 3px rgba(242,193,77,.75)}
|
||||||
|
@keyframes stubTug{0%,58%,100%{transform:none}68%{transform:translate(4px,9px) rotate(1.8deg)}
|
||||||
|
78%{transform:translate(1px,2px) rotate(.4deg)}86%{transform:translate(2px,4px) rotate(.9deg)}93%{transform:none}}
|
||||||
|
.tearwrap.hinting .tear-stub{animation:stubTug 2.6s cubic-bezier(.3,.7,.3,1) .6s infinite}
|
||||||
|
.tear-hand{position:absolute;z-index:3;width:30px;height:30px;margin:-15px 0 0 -15px;border-radius:50%;pointer-events:none;opacity:0;
|
||||||
|
background:radial-gradient(circle,rgba(255,255,255,.95) 0 34%,rgba(255,255,255,.35) 35% 60%,rgba(255,255,255,0) 62%);
|
||||||
|
box-shadow:0 0 0 2px rgba(60,133,39,.55),0 4px 14px rgba(30,40,70,.25)}
|
||||||
|
@keyframes handPull{0%{opacity:0;transform:scale(1.25)}12%{opacity:1;transform:scale(1)}22%{transform:scale(.82)}
|
||||||
|
58%{opacity:1;transform:scale(.82)}68%{opacity:1;transform:translate(26px,58px) scale(.82)}
|
||||||
|
80%,100%{opacity:0;transform:translate(34px,72px) scale(.9)}}
|
||||||
|
.tearwrap.hinting .tear-hand{animation:handPull 2.6s cubic-bezier(.4,0,.2,1) .6s infinite}
|
||||||
|
.tear-grab.ready-stub{border-color:rgba(242,193,77,.9)!important;box-shadow:0 12px 28px rgba(0,0,0,.25),0 0 0 2px rgba(242,193,77,.6),0 0 18px rgba(242,193,77,.45)}
|
||||||
|
@keyframes readyJolt{0%,100%{translate:0 0}25%{translate:-1.5px 0}50%{translate:1.5px 0}75%{translate:-1px 0}}
|
||||||
|
.tearwrap.ready .tear-card{animation:readyJolt .22s linear}
|
||||||
|
/* 撕下:本体一震 + 金边一闪;印章盖下 */
|
||||||
|
@keyframes cardGlow{0%{box-shadow:0 0 0 0 rgba(242,193,77,0)}25%{box-shadow:0 0 0 2px rgba(242,193,77,.9),0 0 26px 4px rgba(242,193,77,.45)}
|
||||||
|
100%{box-shadow:0 0 0 1px rgba(242,193,77,.35),0 0 0 0 rgba(242,193,77,0)}}
|
||||||
|
.tearwrap.torn .tear-card{animation:bodyKick .6s var(--ease-out),cardGlow 1.5s ease-out both}
|
||||||
|
.tear-seal{position:absolute;right:14px;bottom:26px;z-index:4;pointer-events:none;opacity:0;
|
||||||
|
padding:6px 12px 5px;border:2.5px solid #3C8527;border-radius:6px;color:#3C8527;background:rgba(255,255,255,.82);
|
||||||
|
font:700 17px/1.1 var(--pixel,inherit);letter-spacing:.12em;transform:rotate(-8deg);
|
||||||
|
box-shadow:0 0 0 3px rgba(60,133,39,.14),0 8px 18px -8px rgba(30,60,30,.35)}
|
||||||
|
.tear-seal small{display:block;margin-top:3px;font:600 10.5px/1.2 system-ui,sans-serif;letter-spacing:.04em;color:#4a7a3a}
|
||||||
|
@keyframes sealSlam{0%{opacity:0;transform:rotate(-8deg) scale(2.3)}55%{opacity:1;transform:rotate(-8deg) scale(.9)}
|
||||||
|
72%{transform:rotate(-8deg) scale(1.05)}100%{opacity:1;transform:rotate(-8deg) scale(1)}}
|
||||||
|
.tearwrap.torn .tear-seal{animation:sealSlam .5s cubic-bezier(.2,.9,.3,1.2) .45s both}
|
||||||
|
/* 粒子 / 闪光层(fixed,盖在弹窗上面,不被弹窗裁掉) */
|
||||||
|
.tear-fx{position:fixed;inset:0;z-index:9999;pointer-events:none;overflow:hidden}
|
||||||
|
/* 白底弹窗上白光等于没有 → 闪光用金色;再加一道沿撕线向两边展开的光 */
|
||||||
|
.tear-flash{position:absolute;width:360px;height:150px;margin:-75px 0 0 -180px;border-radius:50%;
|
||||||
|
background:radial-gradient(closest-side,rgba(255,214,102,.85),rgba(242,193,77,.45) 45%,rgba(242,193,77,0));
|
||||||
|
mix-blend-mode:multiply;animation:tearFlash .7s ease-out forwards}
|
||||||
|
@keyframes tearFlash{0%{opacity:0;transform:scale(.3,.5)}15%{opacity:1}100%{opacity:0;transform:scale(1.4,1.1)}}
|
||||||
|
.tear-line{position:absolute;height:4px;margin-top:-2px;border-radius:4px;
|
||||||
|
background:linear-gradient(90deg,rgba(242,193,77,0),#F2C14D 20%,#E8913A 50%,#F2C14D 80%,rgba(242,193,77,0));
|
||||||
|
box-shadow:0 0 12px 2px rgba(242,193,77,.7);animation:tearLine .65s cubic-bezier(.2,.8,.2,1) forwards}
|
||||||
|
@keyframes tearLine{0%{opacity:1;transform:scaleX(.15)}60%{opacity:1;transform:scaleX(1.1)}100%{opacity:0;transform:scaleX(1.25) scaleY(.4)}}
|
||||||
|
/* 票据在这个弹窗里做成白纸(原来的深灰底在白光页面上发闷) */
|
||||||
|
.tearwrap .tear-card,.tearwrap .tear-stub{background:linear-gradient(180deg,#fffefa,#fbf8ef);color:#4a5060;
|
||||||
|
border:1px solid rgba(30,36,64,.1);box-shadow:0 10px 24px -16px rgba(40,50,90,.35)}
|
||||||
|
.tearwrap .tear-card{border-bottom:0;border-radius:var(--r,9px) var(--r,9px) 0 0}
|
||||||
|
.tearwrap .tear-stub{border-top:0;border-style:solid dashed dashed}
|
||||||
|
.tearwrap .tear-edge{background:
|
||||||
|
linear-gradient(-45deg,transparent 49%,rgba(30,36,64,.14) 49%) 0 0/12px 12px repeat-x,
|
||||||
|
linear-gradient(45deg,transparent 49%,rgba(30,36,64,.14) 49%) 6px 0/12px 12px repeat-x,#fcfaf3}
|
||||||
|
.tear-px{position:absolute;width:var(--s);height:var(--s);margin:calc(var(--s)/-2) 0 0 calc(var(--s)/-2);background:var(--c);
|
||||||
|
box-shadow:inset -1px -2px 0 rgba(0,0,0,.22),inset 1px 1px 0 rgba(255,255,255,.45);animation:pxBurst var(--t) cubic-bezier(.15,.75,.35,1) forwards}
|
||||||
|
@keyframes pxBurst{0%{opacity:1;transform:translate(0,0) rotate(0) scale(1)}
|
||||||
|
55%{opacity:1;transform:translate(var(--dx),var(--dy)) rotate(var(--r)) scale(1)}
|
||||||
|
100%{opacity:0;transform:translate(calc(var(--dx)*1.12),calc(var(--dy) + 70px)) rotate(calc(var(--r)*1.6)) scale(.6)}}
|
||||||
|
.tear-spark{animation:pxSpark .55s ease-out forwards}
|
||||||
|
@keyframes pxSpark{0%{opacity:1;transform:translate(0,0) scale(1)}100%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.4)}}
|
||||||
|
@media (prefers-reduced-motion:reduce){
|
||||||
|
.tearwrap.hinting .tear-stub,.tearwrap.hinting .tear-hand,.tearwrap.hinting .tear-edge::after,.tearwrap.ready .tear-card{animation:none}
|
||||||
|
.tearwrap.torn .tear-card{animation:none}
|
||||||
|
.tearwrap.torn .tear-seal{animation:none;opacity:1}
|
||||||
|
}
|
||||||
|
|
||||||
/* 收货凭证(小票)弹窗 */
|
/* 收货凭证(小票)弹窗 */
|
||||||
.ticket{white-space:pre;overflow:auto;max-width:100%;-webkit-overflow-scrolling:touch;max-height:62vh;font:11.5px/1.5 ui-monospace,Menlo,Consolas,monospace;
|
.ticket{white-space:pre;overflow:auto;max-width:100%;-webkit-overflow-scrolling:touch;max-height:62vh;font:11.5px/1.5 ui-monospace,Menlo,Consolas,monospace;
|
||||||
@@ -640,7 +709,11 @@ html[data-skin="1"] .se-b{animation-name:se-drift-b-mild}
|
|||||||
-webkit-backdrop-filter:none!important;backdrop-filter:none!important;
|
-webkit-backdrop-filter:none!important;backdrop-filter:none!important;
|
||||||
background:rgba(18,20,21,.95)!important}
|
background:rgba(18,20,21,.95)!important}
|
||||||
.wrap,.pg-box,.head,.tpl,.ord{box-shadow:none!important}
|
.wrap,.pg-box,.head,.tpl,.ord{box-shadow:none!important}
|
||||||
*,*::before,*::after{animation-duration:.12s!important;transition-duration:.09s!important}
|
/* ⚠️ 2026-10-07:撕票根那一套排除在外 —— 原来连它也被压成 0.12s,手机上撕凭证「一闪就没了」
|
||||||
|
(金钻说「动画太快」的根子在这)。它只动 transform / opacity,不吃性能。 */
|
||||||
|
:not(.tearwrap,.tearwrap *,.tear-fx,.tear-fx *),
|
||||||
|
:not(.tearwrap,.tearwrap *,.tear-fx,.tear-fx *)::before,
|
||||||
|
:not(.tearwrap,.tearwrap *,.tear-fx,.tear-fx *)::after{animation-duration:.12s!important;transition-duration:.09s!important}
|
||||||
img[loading="lazy"]{content-visibility:auto}
|
img[loading="lazy"]{content-visibility:auto}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -729,6 +802,7 @@ html[data-skin="1"] .se-b{animation-name:se-drift-b-mild}
|
|||||||
|
|
||||||
<!-- Step 1 -->
|
<!-- Step 1 -->
|
||||||
<section class="card" id="step1">
|
<section class="card" id="step1">
|
||||||
|
<button type="button" class="linkbtn" id="backEntry" style="margin-bottom:8px">← 返回,换个下单方式</button>
|
||||||
<div class="step"><span class="num">1</span><h2>上传皮肤 · 自动质检</h2></div>
|
<div class="step"><span class="num">1</span><h2>上传皮肤 · 自动质检</h2></div>
|
||||||
<div class="hint">支持 64 / 128 / 256 / 512 / 1024 等任何分辨率的皮肤(.png,单个文件最大 10MB)。质检在你的浏览器里本地完成。</div>
|
<div class="hint">支持 64 / 128 / 256 / 512 / 1024 等任何分辨率的皮肤(.png,单个文件最大 10MB)。质检在你的浏览器里本地完成。</div>
|
||||||
|
|
||||||
@@ -1309,6 +1383,21 @@ function startFlow(mode){
|
|||||||
gotoStep(1);
|
gotoStep(1);
|
||||||
}
|
}
|
||||||
$('#goPrepay').onclick=()=>startFlow('prepay');
|
$('#goPrepay').onclick=()=>startFlow('prepay');
|
||||||
|
/* 返回落地页(金钻 2026-10-07:进了网页下单、还没传皮肤时没路可退)。
|
||||||
|
传过的皮肤留着(换条路还是同一张);从卡密那条路进来的,把卡密 / 张数规则 / 卡密预选的模板清掉,
|
||||||
|
免得改走网页下单时混进去 —— 再走卡密路会重新校验一遍。 */
|
||||||
|
function backToEntry(){
|
||||||
|
if(S.mode==='code'){
|
||||||
|
S.codes=[]; S.rule={n_fix:0,n_max:0,n_free:false,lock_tpl:false,tpls:[],loose:false};
|
||||||
|
S.templates=new Set(); try{ syncTplUI(); }catch(e){}
|
||||||
|
}
|
||||||
|
S.mode=''; try{ S.trail=[]; }catch(e){}
|
||||||
|
['step1','step2','step3','step4'].forEach(id=>{ $('#'+id).style.display='none'; });
|
||||||
|
$('#step0').style.display='';
|
||||||
|
delete document.body.dataset.step;
|
||||||
|
window.scrollTo({top:0,behavior:(window.matchMedia&&matchMedia('(prefers-reduced-motion:reduce)').matches)?'auto':'smooth'});
|
||||||
|
}
|
||||||
|
$('#backEntry').onclick=backToEntry;
|
||||||
$('#addSkin').onclick=()=>{ $('#file2').click(); };
|
$('#addSkin').onclick=()=>{ $('#file2').click(); };
|
||||||
$('#addTpl').onclick=()=>{ if($('#tplPick')) $('#tplPick').style.display=''; renderTplPick(); };
|
$('#addTpl').onclick=()=>{ if($('#tplPick')) $('#tplPick').style.display=''; renderTplPick(); };
|
||||||
$('#file2').onchange=(e)=>{
|
$('#file2').onchange=(e)=>{
|
||||||
@@ -2052,57 +2141,118 @@ async function tearAndAccept(btn, oid, token, after){
|
|||||||
const head=lines.slice(0,cut).join('\n'), stub=lines.slice(cut).join('\n') || '(存根)';
|
const head=lines.slice(0,cut).join('\n'), stub=lines.slice(cut).join('\n') || '(存根)';
|
||||||
openModal('<div style="font-size:13.5px;font-weight:700;color:var(--txt-2);margin-bottom:8px">'
|
openModal('<div style="font-size:13.5px;font-weight:700;color:var(--txt-2);margin-bottom:8px">'
|
||||||
+'收货凭证 · 撕角留档</div>'
|
+'收货凭证 · 撕角留档</div>'
|
||||||
+'<div class="tearwrap" id="tearWrap">'
|
+'<div class="tearwrap hinting" id="tearWrap">'
|
||||||
+ '<pre class="ticket tear-card">'+esc(head)+'</pre>'
|
+ '<pre class="ticket tear-card">'+esc(head)+'</pre>'
|
||||||
+ '<div class="tear-edge"></div>'
|
+ '<div class="tear-edge" id="tearEdge"></div>'
|
||||||
+ '<pre class="tear-stub tear-grab" id="tearStub" tabindex="0" role="button" '
|
+ '<pre class="tear-stub tear-grab" id="tearStub" tabindex="0" role="button" '
|
||||||
+ 'aria-label="撕下存根,确认收货">'+esc(stub)+'</pre>'
|
+ 'aria-label="撕下存根,确认收货">'+esc(stub)+'</pre>'
|
||||||
|
+ '<span class="tear-hand" id="tearHand" aria-hidden="true"></span>'
|
||||||
|
+ '<div class="tear-seal" aria-hidden="true">✓ 已归档<small>原图已开放下载</small></div>'
|
||||||
+'</div>'
|
+'</div>'
|
||||||
+'<div style="font-size:12px;color:var(--dim2);margin-top:10px" id="tearTip">'
|
+'<div style="font-size:12px;color:var(--dim2);margin-top:10px" id="tearTip">按住存根,往外撕</div>'
|
||||||
+'按住下面那截存根,往外一撕 —— 撕下来就算确认收货。</div>'
|
|
||||||
+'<div class="tear-stamp">✓ 已归档 · 原图已开放下载</div>'
|
|
||||||
+'<div class="btns" style="margin-top:10px" id="tearBtns">'
|
+'<div class="btns" style="margin-top:10px" id="tearBtns">'
|
||||||
+'<button class="ghost" type="button" id="tearNow">直接撕下</button>'
|
+'<button class="ghost" type="button" id="tearNow">直接撕下</button>'
|
||||||
+'<button class="ghost" type="button" id="tearCancel">先不收货</button></div>');
|
+'<button class="ghost" type="button" id="tearCancel">先不收货</button></div>');
|
||||||
const wrap=$('#tearWrap'), st=$('#tearStub'), tip=$('#tearTip'), card=wrap.querySelector('.tear-card');
|
const wrap=$('#tearWrap'), st=$('#tearStub'), tip=$('#tearTip'), card=wrap.querySelector('.tear-card'),
|
||||||
|
edge=$('#tearEdge'), hand=$('#tearHand');
|
||||||
const reduce=matchMedia('(prefers-reduced-motion: reduce)').matches;
|
const reduce=matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||||
const NEED=110; /* 拉多远才撕得下来(px) */
|
const NEED=110; /* 拉多远才撕得下来(px) */
|
||||||
let done=false, cancelled=false, finish;
|
const PAL=['#3C8527','#5BAA3C','#7CC24F','#F2C14D','#E8A53A','#FFD45E','#5FB4F0']; /* 白底上要看得见:不用白 */
|
||||||
|
let done=false, finish, ready=false, lastSpark=0;
|
||||||
const outcome=new Promise(r=>{ finish=r; });
|
const outcome=new Promise(r=>{ finish=r; });
|
||||||
|
/* 指引手指放在存根上方偏中间(存根位置要等弹窗排好版才量得准) */
|
||||||
|
requestAnimationFrame(()=>{ try{
|
||||||
|
hand.style.left=(st.offsetLeft+st.offsetWidth*0.42)+'px'; hand.style.top=(st.offsetTop+18)+'px';
|
||||||
|
}catch(e){} });
|
||||||
|
const stopHint=()=>wrap.classList.remove('hinting');
|
||||||
/* 弹窗被关掉(点遮罩 / 先不收货)而还没撕 → 当没发生 */
|
/* 弹窗被关掉(点遮罩 / 先不收货)而还没撕 → 当没发生 */
|
||||||
const mo=new MutationObserver(()=>{
|
const mo=new MutationObserver(()=>{
|
||||||
if(!done && !$('#mask').classList.contains('show')){ cancelled=true; finish('cancel'); }
|
if(!done && !$('#mask').classList.contains('show')){ finish('cancel'); }
|
||||||
});
|
});
|
||||||
mo.observe($('#mask'),{attributes:true,attributeFilter:['class']});
|
mo.observe($('#mask'),{attributes:true,attributeFilter:['class']});
|
||||||
$('#tearCancel').onclick=()=>{ closeModal(); };
|
$('#tearCancel').onclick=()=>{ closeModal(); };
|
||||||
|
|
||||||
|
/* 撕口在屏幕上的位置(粒子从这里出来) */
|
||||||
|
function edgePoint(fx){
|
||||||
|
const r=edge.getBoundingClientRect();
|
||||||
|
return {x:r.left+r.width*(fx==null?0.5:fx), y:r.top+r.height/2, w:r.width};
|
||||||
|
}
|
||||||
|
function fxLayer(){ const l=document.createElement('div'); l.className='tear-fx'; document.body.appendChild(l);
|
||||||
|
setTimeout(()=>l.remove(),1600); return l; }
|
||||||
|
function px(layer,x,y,o){
|
||||||
|
const e=document.createElement('i'); e.className=o.cls||'tear-px';
|
||||||
|
e.style.cssText='left:'+x.toFixed(1)+'px;top:'+y.toFixed(1)+'px;--s:'+o.s+'px;--c:'+o.c+';--dx:'+o.dx.toFixed(1)
|
||||||
|
+'px;--dy:'+o.dy.toFixed(1)+'px;--r:'+(o.r||0).toFixed(0)+'deg;--t:'+(o.t||900)+'ms';
|
||||||
|
layer.appendChild(e);
|
||||||
|
}
|
||||||
|
/* 拉扯时撕口冒火花:越拉越密 */
|
||||||
|
function sparks(p,fx){
|
||||||
|
if(reduce) return;
|
||||||
|
const now=performance.now(); if(now-lastSpark<(110-p*70)) return; lastSpark=now;
|
||||||
|
const pt=edgePoint(fx), l=fxLayer(), n=1+Math.round(p*2);
|
||||||
|
for(let i=0;i<n;i++){
|
||||||
|
px(l, pt.x+(Math.random()-.5)*40, pt.y, {cls:'tear-px tear-spark', s:4+Math.round(Math.random()*2),
|
||||||
|
c:PAL[3+Math.floor(Math.random()*3)], dx:(Math.random()-.5)*40, dy:-10-Math.random()*26});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function burst(){
|
||||||
|
if(reduce) return;
|
||||||
|
const pt=edgePoint(0.5), l=fxLayer();
|
||||||
|
const f=document.createElement('div'); f.className='tear-flash'; f.style.left=pt.x+'px'; f.style.top=pt.y+'px'; l.appendChild(f);
|
||||||
|
const ln=document.createElement('div'); ln.className='tear-line';
|
||||||
|
ln.style.cssText='left:'+(pt.x-pt.w/2)+'px;top:'+pt.y+'px;width:'+pt.w+'px'; l.appendChild(ln);
|
||||||
|
for(let i=0;i<40;i++){
|
||||||
|
const a=-Math.PI*(0.08+Math.random()*0.84) + (Math.random()<.3?Math.PI:0); /* 大多往上 / 两侧,少数往下 */
|
||||||
|
const v=70+Math.random()*150;
|
||||||
|
px(l, pt.x+(Math.random()-.5)*pt.w*0.7, pt.y, {s:5+Math.round(Math.random()*5), c:PAL[Math.floor(Math.random()*PAL.length)],
|
||||||
|
dx:Math.cos(a)*v, dy:Math.sin(a)*v*0.8, r:(Math.random()-.5)*540, t:800+Math.round(Math.random()*500)});
|
||||||
|
}
|
||||||
|
}
|
||||||
function pose(dx,dy){
|
function pose(dx,dy){
|
||||||
const d=Math.hypot(dx,dy), p=Math.min(1,d/NEED);
|
const d=Math.hypot(dx,dy), p=Math.min(1,d/NEED);
|
||||||
const rot=Math.max(-18,Math.min(18, dx*0.07 + Math.max(0,dy)*0.035*(dx<0?-1:1)));
|
const rot=Math.max(-18,Math.min(18, dx*0.07 + Math.max(0,dy)*0.035*(dx<0?-1:1)));
|
||||||
st.style.transform='translate('+(dx*0.62).toFixed(1)+'px,'+(dy*0.82).toFixed(1)+'px) rotate('+rot.toFixed(2)+'deg)';
|
st.style.transform='translate('+(dx*0.62).toFixed(1)+'px,'+(dy*0.82).toFixed(1)+'px) rotate('+rot.toFixed(2)+'deg)';
|
||||||
if(card) card.style.transform='rotate('+(-p*0.5).toFixed(2)+'deg)';
|
if(card) card.style.transform='rotate('+(-p*0.5).toFixed(2)+'deg)';
|
||||||
wrap.style.setProperty('--tear-p', p.toFixed(3));
|
wrap.style.setProperty('--tear-p', p.toFixed(3));
|
||||||
tip.textContent = p<0.15 ? '按住下面那截存根,往外一撕 —— 撕下来就算确认收货。'
|
if(p>=1 && !ready){
|
||||||
: p<0.75 ? '再用点力……' : '松手就撕下来了';
|
ready=true; wrap.classList.add('ready'); st.classList.add('ready-stub');
|
||||||
|
try{ if(navigator.vibrate) navigator.vibrate(18); }catch(_){}
|
||||||
|
}else if(p<1 && ready){ ready=false; wrap.classList.remove('ready'); st.classList.remove('ready-stub'); }
|
||||||
|
tip.textContent = p<0.15 ? '按住存根,往外撕' : p<1 ? '再用点力……' : '松手!';
|
||||||
|
if(p>0.25) sparks(p, 0.5+Math.max(-.4,Math.min(.4,dx/300)));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
function tear(dx,dy){
|
function tear(dx,dy){
|
||||||
if(done) return; done=true;
|
if(done) return; done=true; stopHint();
|
||||||
const ang=Math.atan2(Math.max(dy,40), dx||8);
|
const ang=Math.atan2(Math.max(dy,40), dx||8);
|
||||||
st.style.transition=reduce?'opacity .3s':'transform 1.1s var(--ease-drawer),opacity 1s var(--ease-out)';
|
wrap.classList.remove('ready'); st.classList.remove('ready-stub');
|
||||||
st.style.transform=reduce?'':'translate('+(Math.cos(ang)*260).toFixed(0)+'px,'+(Math.sin(ang)*260).toFixed(0)+'px) '
|
burst();
|
||||||
+'rotate('+((dx<0?-1:1)*(22+Math.random()*10)).toFixed(1)+'deg)';
|
st.style.transition=reduce?'opacity .3s':'transform 1.1s cubic-bezier(.2,.7,.2,1),opacity 1s var(--ease-out)';
|
||||||
|
st.style.transform=reduce?'':'translate('+(Math.cos(ang)*300).toFixed(0)+'px,'+(Math.sin(ang)*300).toFixed(0)+'px) '
|
||||||
|
+'rotate('+((dx<0?-1:1)*(30+Math.random()*16)).toFixed(1)+'deg)';
|
||||||
st.style.opacity='0';
|
st.style.opacity='0';
|
||||||
if(card){ card.style.transition='transform .5s var(--ease-out)'; card.style.transform=''; }
|
if(card){ card.style.transition='transform .5s var(--ease-out)'; card.style.transform=''; }
|
||||||
|
wrap.style.setProperty('--tear-p','0');
|
||||||
|
try{ const sl=wrap.querySelector('.tear-seal'); /* 印章盖在票据本体右下角(存根飞走后那块是空的) */
|
||||||
|
sl.style.bottom='auto'; sl.style.top=Math.max(8, card.offsetTop+card.offsetHeight-sl.offsetHeight-12)+'px'; }catch(_){}
|
||||||
wrap.classList.add('torn');
|
wrap.classList.add('torn');
|
||||||
tip.textContent='嘶 —— 存根撕下来了';
|
try{ if(navigator.vibrate) navigator.vibrate([12,40,24]); }catch(_){}
|
||||||
|
tip.textContent='嘶 —— 撕下来了';
|
||||||
const b=$('#tearBtns'); if(b) b.style.visibility='hidden';
|
const b=$('#tearBtns'); if(b) b.style.visibility='hidden';
|
||||||
|
/* 存根飞远了 → 把它留下的空位和按钮行收起来,印章那一帧不空落落 */
|
||||||
|
if(!reduce) setTimeout(()=>{ try{
|
||||||
|
const hh=st.offsetHeight;
|
||||||
|
st.style.marginBottom=(-hh)+'px'; st.style.transition+=',margin-bottom .45s var(--ease-out)';
|
||||||
|
if(b){ b.style.transition='max-height .45s var(--ease-out),margin .45s var(--ease-out)'; b.style.overflow='hidden';
|
||||||
|
b.style.maxHeight=b.offsetHeight+'px'; requestAnimationFrame(()=>{ b.style.maxHeight='0'; b.style.marginTop='0'; }); }
|
||||||
|
}catch(_){} }, 650);
|
||||||
finish('tear');
|
finish('tear');
|
||||||
}
|
}
|
||||||
/* 拖:pointer 事件 + capture;没拉够松手 → 弹回 */
|
/* 拖:pointer 事件 + capture;没拉够松手 → 弹回 */
|
||||||
let sx=0, sy=0, dragging=false, lx=0, ly=0;
|
let sx=0, sy=0, dragging=false, lx=0, ly=0;
|
||||||
st.addEventListener('pointerdown',e=>{
|
st.addEventListener('pointerdown',e=>{
|
||||||
if(done) return;
|
if(done) return;
|
||||||
|
stopHint();
|
||||||
dragging=true; sx=e.clientX; sy=e.clientY; lx=ly=0;
|
dragging=true; sx=e.clientX; sy=e.clientY; lx=ly=0;
|
||||||
st.setPointerCapture(e.pointerId); st.style.transition='none'; if(card) card.style.transition='none';
|
st.setPointerCapture(e.pointerId); st.style.transition='none'; if(card) card.style.transition='none';
|
||||||
st.classList.add('grabbing'); e.preventDefault();
|
st.classList.add('grabbing'); e.preventDefault();
|
||||||
@@ -2115,11 +2265,12 @@ async function tearAndAccept(btn, oid, token, after){
|
|||||||
if(!dragging) return; dragging=false; st.classList.remove('grabbing');
|
if(!dragging) return; dragging=false; st.classList.remove('grabbing');
|
||||||
if(done) return;
|
if(done) return;
|
||||||
if(Math.hypot(lx,ly)>=NEED){ tear(lx,ly); return; }
|
if(Math.hypot(lx,ly)>=NEED){ tear(lx,ly); return; }
|
||||||
|
ready=false; wrap.classList.remove('ready'); st.classList.remove('ready-stub');
|
||||||
st.style.transition='transform .5s cubic-bezier(.3,1.5,.5,1)';
|
st.style.transition='transform .5s cubic-bezier(.3,1.5,.5,1)';
|
||||||
if(card) card.style.transition='transform .5s var(--ease-out)';
|
if(card) card.style.transition='transform .5s var(--ease-out)';
|
||||||
st.style.transform=''; if(card) card.style.transform='';
|
st.style.transform=''; if(card) card.style.transform='';
|
||||||
wrap.style.setProperty('--tear-p','0');
|
wrap.style.setProperty('--tear-p','0');
|
||||||
tip.textContent='没撕下来 —— 再用力往外拉一点';
|
tip.textContent='差一点 —— 再往外拉多一些';
|
||||||
};
|
};
|
||||||
st.addEventListener('pointerup',up); st.addEventListener('pointercancel',up);
|
st.addEventListener('pointerup',up); st.addEventListener('pointercancel',up);
|
||||||
st.addEventListener('keydown',e=>{ if(e.key==='Enter'||e.key===' '){ e.preventDefault(); tear(30,90); } });
|
st.addEventListener('keydown',e=>{ if(e.key==='Enter'||e.key===' '){ e.preventDefault(); tear(30,90); } });
|
||||||
@@ -2128,7 +2279,7 @@ async function tearAndAccept(btn, oid, token, after){
|
|||||||
const how=await outcome;
|
const how=await outcome;
|
||||||
mo.disconnect();
|
mo.disconnect();
|
||||||
if(how==='cancel'){ btn.disabled=false; btn.textContent=keep; return; }
|
if(how==='cancel'){ btn.disabled=false; btn.textContent=keep; return; }
|
||||||
/* 撕下来了 → 这时才真的确认收货;动画演完(约 1.6s)再关 */
|
/* 撕下来了 → 这时才真的确认收货;演出(闪光 → 粒子 → 印章)演完再关 */
|
||||||
let jj=null;
|
let jj=null;
|
||||||
const t0=Date.now();
|
const t0=Date.now();
|
||||||
try{
|
try{
|
||||||
@@ -2136,12 +2287,13 @@ async function tearAndAccept(btn, oid, token, after){
|
|||||||
body:JSON.stringify({oid:oid, token:token})});
|
body:JSON.stringify({oid:oid, token:token})});
|
||||||
jj=await rr.json();
|
jj=await rr.json();
|
||||||
}catch(e){ jj={ok:false, error:(e&&e.message)||'网络错误'}; }
|
}catch(e){ jj={ok:false, error:(e&&e.message)||'网络错误'}; }
|
||||||
await new Promise(r=>setTimeout(r, Math.max(0, (reduce?600:1700)-(Date.now()-t0))));
|
|
||||||
closeModal();
|
|
||||||
if(!jj || !jj.ok){
|
if(!jj || !jj.ok){
|
||||||
|
closeModal();
|
||||||
toast('确认失败:'+((jj&&jj.error)||'未知'));
|
toast('确认失败:'+((jj&&jj.error)||'未知'));
|
||||||
btn.disabled=false; btn.textContent=keep; return;
|
btn.disabled=false; btn.textContent=keep; return;
|
||||||
}
|
}
|
||||||
|
await new Promise(r=>setTimeout(r, Math.max(0, (reduce?700:2300)-(Date.now()-t0))));
|
||||||
|
closeModal();
|
||||||
toast('已确认收货 —— 原图可以下载了');
|
toast('已确认收货 —— 原图可以下载了');
|
||||||
if(after) after();
|
if(after) after();
|
||||||
}
|
}
|
||||||
@@ -4416,6 +4568,12 @@ details pre{background:rgba(30,36,64,.04) !important;color:var(--txt-3) !importa
|
|||||||
.seg label:has(input:checked),.seg .on,.seg [aria-pressed=true]{background:#fff !important;color:var(--txt) !important;box-shadow:inset 0 0 0 2px var(--mc-green) !important}
|
.seg label:has(input:checked),.seg .on,.seg [aria-pressed=true]{background:#fff !important;color:var(--txt) !important;box-shadow:inset 0 0 0 2px var(--mc-green) !important}
|
||||||
.tpl{background:#fff !important;border:2px solid rgba(30,36,64,.08) !important;border-radius:8px !important}
|
.tpl{background:#fff !important;border:2px solid rgba(30,36,64,.08) !important;border-radius:8px !important}
|
||||||
.tpl.on,.tpl.sel,.tpl:has(input:checked){border-color:var(--mc-green) !important;box-shadow:0 0 0 3px rgba(91,170,60,.2) !important}
|
.tpl.on,.tpl.sel,.tpl:has(input:checked){border-color:var(--mc-green) !important;box-shadow:0 0 0 3px rgba(91,170,60,.2) !important}
|
||||||
|
/* 三色灯·张数核对(2026-10-07 修):上一行的绿框带 !important,把「多了标红 / 少了标黄」整个盖成绿的了。
|
||||||
|
卡密限定张数时:多了 → 已选的整片红;少了 → 整片黄;正好 → 绿(上一行)。底色同质检报告,5.5% 的淡 tint。 */
|
||||||
|
.tpl.over,.tpl.over.sel{border-color:#e05a5a !important;box-shadow:0 0 0 3px rgba(224,90,90,.16) !important;
|
||||||
|
background:linear-gradient(rgba(224,90,90,.055),rgba(224,90,90,.055)),#fff !important}
|
||||||
|
.tpl.short,.tpl.short.sel{border-color:#e8b23a !important;box-shadow:0 0 0 3px rgba(232,178,58,.18) !important;
|
||||||
|
background:linear-gradient(rgba(232,178,58,.055),rgba(232,178,58,.055)),#fff !important}
|
||||||
|
|
||||||
/* ---------- 弹窗 / 提示 ---------- */
|
/* ---------- 弹窗 / 提示 ---------- */
|
||||||
.mask{background:rgba(236,240,248,.72) !important;-webkit-backdrop-filter:blur(6px) !important;backdrop-filter:blur(6px) !important}
|
.mask{background:rgba(236,240,248,.72) !important;-webkit-backdrop-filter:blur(6px) !important;backdrop-filter:blur(6px) !important}
|
||||||
@@ -4742,6 +4900,8 @@ header:not(.top){background:none !important;border:0 !important;box-shadow:none
|
|||||||
.drop:hover,.drop.over{background:rgba(255,255,255,.06) !important}
|
.drop:hover,.drop.over{background:rgba(255,255,255,.06) !important}
|
||||||
details pre{background:rgba(255,255,255,.04) !important}
|
details pre{background:rgba(255,255,255,.04) !important}
|
||||||
.tpl{background:#171B2E !important;border-color:rgba(255,255,255,.08) !important}
|
.tpl{background:#171B2E !important;border-color:rgba(255,255,255,.08) !important}
|
||||||
|
.tpl.over,.tpl.over.sel{background:linear-gradient(rgba(224,90,90,.08),rgba(224,90,90,.08)),#171B2E !important;border-color:#e05a5a !important}
|
||||||
|
.tpl.short,.tpl.short.sel{background:linear-gradient(rgba(232,178,58,.08),rgba(232,178,58,.08)),#171B2E !important;border-color:#e8b23a !important}
|
||||||
.seg label:has(input:checked),.seg .on,.seg [aria-pressed=true]{background:#1C2136 !important}
|
.seg label:has(input:checked),.seg .on,.seg [aria-pressed=true]{background:#1C2136 !important}
|
||||||
.mask{background:rgba(5,7,15,.72) !important}
|
.mask{background:rgba(5,7,15,.72) !important}
|
||||||
.modal{background:#161A2C !important;border-color:#232842 !important;color:var(--txt) !important}
|
.modal{background:#161A2C !important;border-color:#232842 !important;color:var(--txt) !important}
|
||||||
|
|||||||
Reference in New Issue
Block a user