'
+ +'
'
+ '
'+esc(head)+'
'
- + '
'
+ + '
'
+ '
'+esc(stub)+'
'
+ + '
'
+ + '
✓ 已归档原图已开放下载
'
+'
'
- +'
'
- +'按住下面那截存根,往外一撕 —— 撕下来就算确认收货。
'
- +'
✓ 已归档 · 原图已开放下载
'
+ +'
按住存根,往外撕
'
+'
'
+''
+'
');
- 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 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; });
+ /* 指引手指放在存根上方偏中间(存根位置要等弹窗排好版才量得准) */
+ 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(()=>{
- 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']});
$('#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
=1 && !ready){
+ 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;
}
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);
- st.style.transition=reduce?'opacity .3s':'transform 1.1s var(--ease-drawer),opacity 1s var(--ease-out)';
- st.style.transform=reduce?'':'translate('+(Math.cos(ang)*260).toFixed(0)+'px,'+(Math.sin(ang)*260).toFixed(0)+'px) '
- +'rotate('+((dx<0?-1:1)*(22+Math.random()*10)).toFixed(1)+'deg)';
+ wrap.classList.remove('ready'); st.classList.remove('ready-stub');
+ burst();
+ 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';
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');
- tip.textContent='嘶 —— 存根撕下来了';
+ try{ if(navigator.vibrate) navigator.vibrate([12,40,24]); }catch(_){}
+ tip.textContent='嘶 —— 撕下来了';
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');
}
/* 拖:pointer 事件 + capture;没拉够松手 → 弹回 */
let sx=0, sy=0, dragging=false, lx=0, ly=0;
st.addEventListener('pointerdown',e=>{
if(done) return;
+ stopHint();
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.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(done) 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)';
if(card) card.style.transition='transform .5s var(--ease-out)';
st.style.transform=''; if(card) card.style.transform='';
wrap.style.setProperty('--tear-p','0');
- tip.textContent='没撕下来 —— 再用力往外拉一点';
+ tip.textContent='差一点 —— 再往外拉多一些';
};
st.addEventListener('pointerup',up); st.addEventListener('pointercancel',up);
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;
mo.disconnect();
if(how==='cancel'){ btn.disabled=false; btn.textContent=keep; return; }
- /* 撕下来了 → 这时才真的确认收货;动画演完(约 1.6s)再关 */
+ /* 撕下来了 → 这时才真的确认收货;演出(闪光 → 粒子 → 印章)演完再关 */
let jj=null;
const t0=Date.now();
try{
@@ -2136,12 +2287,13 @@ async function tearAndAccept(btn, oid, token, after){
body:JSON.stringify({oid:oid, token:token})});
jj=await rr.json();
}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){
+ closeModal();
toast('确认失败:'+((jj&&jj.error)||'未知'));
btn.disabled=false; btn.textContent=keep; return;
}
+ await new Promise(r=>setTimeout(r, Math.max(0, (reduce?700:2300)-(Date.now()-t0))));
+ closeModal();
toast('已确认收货 —— 原图可以下载了');
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}
.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}
+/* 三色灯·张数核对(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}
@@ -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}
details pre{background:rgba(255,255,255,.04) !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}
.mask{background:rgba(5,7,15,.72) !important}
.modal{background:#161A2C !important;border-color:#232842 !important;color:var(--txt) !important}