收款原型并进预览站:下单表单 + 收银台 / 订单页 + 收款后台(参考 Epusdt 收银台、独角数卡浏览器缓存查单)
- 预览站 order.html:模板多选、分辨率、皮肤三色灯(绿放行 / 黄勾无视风险 / 红拦住),吸底金额条; 「我的订单」= 本机下过的单 + 订单号/取件码查单。 - 新 pay.html:用站点「票据」样式做收银台(爱发电 / 支付宝扫码、二维码 + 倒计时、自动轮询、付好了没反应), 到账后同页变订单页;超时关闭态;取件码存根、复制订单链接。 - cms/pay.html:收款后台(待办 / 认领 / 渠道熔断 / 订单 / 支付单 / 流水)。演示控制台收进顶部预览横幅。 - 后端:订单记模板 / 分辨率 / 皮肤名,金额按模板数;取件码 10 位好抄;接口挂 /svc/,原型独立页撤掉。 - 测试 26 条;浏览器端到端 22 条(桌面 + 手机)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,183 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
||||||
|
<meta name="robots" content="noindex,nofollow">
|
||||||
|
<title>收银台 · 金钻客栈(设计预览)</title>
|
||||||
|
<meta name="theme-color" content="#FAFBFE">
|
||||||
|
<link rel="preload" href="assets/OPPOSans-B.woff2" as="font" type="font/woff2" crossorigin>
|
||||||
|
<link rel="stylesheet" href="assets/site.css?v=33">
|
||||||
|
<link rel="stylesheet" href="assets/pay.css?v=2">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="orbs" aria-hidden="true"><i class="o1"></i><i class="o2"></i><i class="o3"></i><i class="o4"></i><i class="o5"></i></div>
|
||||||
|
<div class="ribbon"><span><b>设计预览版</b>,方括号里的是占位内容</span></div>
|
||||||
|
<header class="top"><div class="wrap top-in"><a class="brand" href="index.html"><i class="gem-img" aria-hidden="true"></i><b>金钻客栈</b></a><nav class="nav" aria-label="导航"><a href="index.html">首页</a><a href="gallery.html">画展</a><a href="tools.html">工具与开源</a><a href="universe.html">金钻宇宙</a><a href="links.html">平台入口</a><a href="about.html">关于</a></nav><div class="desk-btn"><a class="btn-pill" href="order.html" aria-current="page"><span class="ic" aria-hidden="true"></span>自助渲染<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="M13 6l6 6-6 6"/></svg></a></div><a class="cms-ent" href="cms/" aria-label="内容管理" title="内容管理"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg></a></div></header>
|
||||||
|
<main class="wrap">
|
||||||
|
<div class="room-head svc-head"><div class="svc-ic" aria-hidden="true"><i class="gem-img"></i></div>
|
||||||
|
<div><h1 id="pTitle">收银台</h1><p id="pSub">选一种方式付款,到账后自动开始渲染。</p><p class="svc-line"><a href="order.html" style="color:inherit">← 回到自助渲染</a></p></div></div>
|
||||||
|
<section class="sec" style="padding-top:6px" aria-label="订单">
|
||||||
|
<div class="pass crystal pay" id="passCard">
|
||||||
|
<div class="main">
|
||||||
|
<div class="row"><div><div class="lbl">订单号</div><div class="code" id="pOid">—</div></div><span class="state" id="pState">读取中</span></div>
|
||||||
|
<div class="row" style="align-items:flex-end"><div><div class="lbl">应付</div><div class="amt" id="pAmt">—</div></div><div class="items" id="pItems"></div></div>
|
||||||
|
<div id="unpaidBox" hidden>
|
||||||
|
<div class="lbl" style="margin-bottom:8px">付款方式</div>
|
||||||
|
<div class="chs" id="chs"></div>
|
||||||
|
<div class="qrbox" id="qrbox" hidden style="margin-top:16px"><div class="qr" id="qr"></div><div id="qrInfo"></div></div>
|
||||||
|
<div class="row" style="justify-content:flex-start;gap:10px 14px;margin-top:16px">
|
||||||
|
<button type="button" class="btn btn-crystal btn-sm" id="btnCheck">付好了没反应?</button>
|
||||||
|
<span class="note" id="keep" style="margin:0"></span></div>
|
||||||
|
<div class="pmsg" id="pMsg" hidden style="margin-top:10px"></div>
|
||||||
|
</div>
|
||||||
|
<div id="paidBox" hidden>
|
||||||
|
<div class="paid-hero"><div class="ok" aria-hidden="true">✓</div><div><b>已付款,正在排队出图</b><p>不用再做任何操作。出图后在这一页看预览、确认收货、下载原图。</p></div></div>
|
||||||
|
<div class="prog" id="pProg" aria-hidden="true" style="margin-top:14px"></div>
|
||||||
|
<div class="note" id="paidAt"></div>
|
||||||
|
</div>
|
||||||
|
<div id="closedBox" hidden>
|
||||||
|
<div class="pmsg bad">这张订单超过 24 小时没付款,已经自动关闭。如果其实付过了,系统会在 72 小时内自动认回来;也可以点下面立即查一次。</div>
|
||||||
|
<div class="row" style="justify-content:flex-start;gap:10px;margin-top:12px"><a class="btn btn-prism btn-sm" href="order.html#tpl">重新下单</a><button type="button" class="btn btn-crystal btn-sm" id="btnCheck2">付好了没反应?</button></div>
|
||||||
|
<div class="pmsg" id="pMsg2" hidden style="margin-top:10px"></div>
|
||||||
|
</div>
|
||||||
|
<div id="missBox" hidden><div class="pmsg bad">没找到这张订单:链接里缺了取件码,或者取件码不对。去「我的订单」用订单号和取件码查。</div>
|
||||||
|
<a class="btn btn-crystal btn-sm" href="order.html#pass" style="margin-top:12px">我的订单</a></div>
|
||||||
|
<details id="logBox" hidden><summary class="note" style="cursor:pointer">付款记录</summary><table class="plog" id="plog"></table></details>
|
||||||
|
</div>
|
||||||
|
<div class="stub">
|
||||||
|
<div><div class="lbl">取件码</div><div class="code" id="pTok">—</div></div>
|
||||||
|
<div class="barcode" aria-hidden="true"></div>
|
||||||
|
<div style="font-size:13px;color:var(--ink-3);line-height:1.7">记好订单号和取件码,换了手机也能查单、取图。</div>
|
||||||
|
<button type="button" class="btn btn-crystal btn-sm" id="btnCopy">复制订单链接</button>
|
||||||
|
<a class="btn btn-crystal btn-sm" href="order.html#pass">我的订单</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<p class="note" style="margin-top:28px;line-height:1.9">非官方 Minecraft 产品,与 Mojang 无关<br>有问题来 QQ 群找金钻:123456789</p>
|
||||||
|
</main>
|
||||||
|
<nav class="tabbar" aria-label="导航"><a href="index.html"><svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 10.5 12 3l9 7.5"/><path d="M5 9.5V21h14V9.5"/><path d="M10 21v-6h4v6"/></svg><span>首页</span></a><a href="gallery.html"><svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21"/></svg><span>画展</span></a><a class="mid" href="order.html" aria-current="page"><i aria-hidden="true"></i><span>渲染</span></a><a href="universe.html"><svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="5"/><path d="M4.2 15.6c-1.6 2.5 4.2 2.4 9.6-.2s9-6.6 7.5-8.6c-.8-1-2.9-.9-5.4 0"/></svg><span>宇宙</span></a><button type="button" data-sheet="more" aria-expanded="false" aria-controls="more"><i class="ic-a"><svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3.5" y="3.5" width="7" height="7" rx="2"/><rect x="13.5" y="3.5" width="7" height="7" rx="2"/><rect x="3.5" y="13.5" width="7" height="7" rx="2"/><rect x="13.5" y="13.5" width="7" height="7" rx="2"/></svg></i><i class="ic-b"><svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="M6 6l12 12"/></svg></i><span class="lb-a">更多</span><span class="lb-b">收起</span></button></nav>
|
||||||
|
<div class="sheet" id="more" hidden><div class="panel"><nav class="more-grid" aria-label="更多"><a href="tools.html" style="--zc:#4F86E8;--zc2:#2E5BD8"><i><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg></i><span>工具与开源</span></a><a href="links.html" style="--zc:#22B573;--zc2:#3C8527"><i><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></i><span>平台入口</span></a><a href="about.html" style="--zc:#E0533D;--zc2:#E8913A"><i><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg></i><span>关于</span></a></nav><p class="more-qq">QQ 群:屑钻小窝 123456789</p></div></div>
|
||||||
|
<footer class="foot-site"><div class="wrap foot-in"><a class="brand" href="index.html"><i class="gem-img" aria-hidden="true"></i><b>金钻客栈</b></a><span>© 2026 example.com</span><span>QQ 群:屑钻小窝 123456789</span><span class="sp"></span><span>备案号(已移除)</span></div></footer>
|
||||||
|
<script src="assets/vendor/qrcode.min.js"></script>
|
||||||
|
<script src="assets/pay.js?v=2"></script>
|
||||||
|
<script>
|
||||||
|
(function(){
|
||||||
|
'use strict';
|
||||||
|
var P=window.JZPay, $=function(i){return document.getElementById(i);};
|
||||||
|
var q=new URLSearchParams(location.search);
|
||||||
|
var S={oid:(q.get('o')||'').toUpperCase(), t:(q.get('t')||'').toUpperCase(), v:null, pay:null, timer:0, skew:0};
|
||||||
|
if(!S.t) S.t=P.tokenOf(S.oid);
|
||||||
|
var mobile=matchMedia('(max-width:760px), (pointer:coarse)').matches;
|
||||||
|
var PST={created:'等待付款',paid:'已到账',mismatch:'金额不足',closed:'已关闭',refunded:'已退款'};
|
||||||
|
|
||||||
|
function show(id,on){ $(id).hidden=!on; }
|
||||||
|
function nowSec(){ return Date.now()/1000+S.skew; } /* 服务器(演示)时钟 */
|
||||||
|
function render(v){
|
||||||
|
S.v=v; S.skew=v.now-Date.now()/1000; P.demoUpdate(v);
|
||||||
|
var o=v.order;
|
||||||
|
P.saveOrder({oid:o.oid,t:S.t,ts:o.created_at*1000,amount:o.amount,n:o.n_img});
|
||||||
|
$('pOid').textContent=o.oid; $('pTok').textContent=S.t;
|
||||||
|
var st=$('pState'); st.textContent=P.STATE[o.state]||o.state_text; st.className='state '+o.state;
|
||||||
|
$('pAmt').textContent='¥'+o.amount;
|
||||||
|
$('pItems').innerHTML=o.templates.map(function(t){ return '<span class="chip">'+P.esc(t.n)+'</span>'; }).join('')
|
||||||
|
+'<span class="chip num">'+o.res+'px</span>'+(o.skin_name?'<span class="chip">'+P.esc(o.skin_name)+'</span>':'');
|
||||||
|
var unpaid=o.state==='unpaid';
|
||||||
|
$('pTitle').textContent=unpaid?'收银台':'订单';
|
||||||
|
$('pSub').textContent=unpaid?'选一种方式付款,到账后自动开始渲染。':(o.state==='closed'?'这张订单已关闭。':'进度都在这一页看。');
|
||||||
|
show('unpaidBox',unpaid); show('paidBox',o.state==='waiting'||o.state==='working'||o.state==='done'); show('closedBox',o.state==='closed'); show('missBox',false);
|
||||||
|
if(o.state==='waiting'){
|
||||||
|
$('pProg').style.gridTemplateColumns='repeat('+o.n_img+',minmax(0,1fr))';
|
||||||
|
$('pProg').innerHTML=new Array(o.n_img+1).join('<i></i>');
|
||||||
|
$('paidAt').textContent=o.paid_at?('到账时间 '+P.full(o.paid_at)+' · 一共 '+o.n_img+' 张,排队中'):'';
|
||||||
|
}
|
||||||
|
/* 渠道 */
|
||||||
|
var box=$('chs'); box.innerHTML='';
|
||||||
|
v.channels.forEach(function(c){
|
||||||
|
var b=document.createElement('button'); b.type='button'; b.className='chx crystal '+(c.name==='afdian'?'afd':'ali'); b.disabled=!c.ok;
|
||||||
|
b.innerHTML=(c.name==='afdian'?'<span class="rec">推荐</span>':'')
|
||||||
|
+'<b><i aria-hidden="true">'+(c.name==='afdian'?'爱':'支')+'</i>'+(c.name==='afdian'?'爱发电':'支付宝扫码')+'</b>'
|
||||||
|
+'<span>'+(c.name==='afdian'?'跳到爱发电付款,到账自动确认':'在这一页扫码付款,秒级到账')+'</span>'
|
||||||
|
+(c.ok?'':'<span class="why">'+P.esc(c.reason)+'</span>');
|
||||||
|
b.setAttribute('aria-pressed',String(!!(S.pay&&S.pay.channel===c.name)));
|
||||||
|
b.onclick=function(){ choose(c.name); };
|
||||||
|
box.appendChild(b);
|
||||||
|
});
|
||||||
|
/* 当前支付单:还在用的那张优先;没有就取最新一张待付款的 */
|
||||||
|
var created=v.payments.filter(function(p){ return p.state==='created'; });
|
||||||
|
var keep=S.pay&&created.filter(function(p){ return p.pay_id===S.pay.pay_id; })[0];
|
||||||
|
S.pay=keep||created[created.length-1]||null;
|
||||||
|
[].forEach.call(box.children,function(b,i){ b.setAttribute('aria-pressed',String(!!(S.pay&&S.pay.channel===v.channels[i].name))); });
|
||||||
|
paintQR();
|
||||||
|
/* 记录 */
|
||||||
|
show('logBox',v.payments.length>0);
|
||||||
|
$('plog').innerHTML=v.payments.map(function(p){ return '<tr><td><code>'+P.esc(p.pay_id)+'</code></td><td>'+(p.channel==='afdian'?'爱发电':'支付宝')
|
||||||
|
+'</td><td>¥'+p.amount_due+(p.amount_paid!=null?' · 实付 ¥'+p.amount_paid:'')+'</td><td>'+P.esc(PST[p.state]||p.state)+'</td></tr>'; }).join('');
|
||||||
|
$('keep').textContent=unpaid?('订单保留 '+P.left(o.expire_at-nowSec())+',超时自动关闭'):'';
|
||||||
|
}
|
||||||
|
function paintQR(){
|
||||||
|
var p=S.pay, box=$('qrbox');
|
||||||
|
if(!p||!S.v||S.v.order.state!=='unpaid'){ box.hidden=true; return; }
|
||||||
|
box.hidden=false;
|
||||||
|
var d=p.display||{};
|
||||||
|
if(p.channel==='afdian'){
|
||||||
|
$('qr').innerHTML=P.qrSvg(d.url||'');
|
||||||
|
$('qrInfo').innerHTML='<h4>爱发电付款 ¥'+p.amount_due+'</h4>'
|
||||||
|
+'<p>'+(mobile?'点下面的按钮去爱发电付款。':'用手机扫左边的码,在爱发电付款;用这台电脑付就点下面的按钮。')+' 付完回到这一页,会自动变成「已付款」。</p>'
|
||||||
|
+'<a class="btn btn-prism btn-sm" href="'+P.esc(d.url)+'" target="_blank" rel="noopener">去爱发电付款</a>'
|
||||||
|
+'<div class="waitline" style="margin-top:14px">正在等待到账,不用刷新页面</div>';
|
||||||
|
}else{
|
||||||
|
$('qr').innerHTML=P.qrSvg(d.qr||'');
|
||||||
|
$('qrInfo').innerHTML='<h4>支付宝扫码 ¥'+p.amount_due+'</h4>'
|
||||||
|
+'<p>打开手机支付宝「扫一扫」,扫左边的二维码付款。</p>'
|
||||||
|
+'<div class="cd" id="cd">二维码有效 <b id="cdv">--:--</b></div>'
|
||||||
|
+(mobile?'<a class="btn btn-prism btn-sm" href="'+P.esc(d.qr)+'" target="_blank" rel="noopener">打开支付宝付款</a>':'<a href="'+P.esc(d.qr)+'" target="_blank" rel="noopener" style="font-size:13px">预览站:在这台设备打开模拟扫码页</a>')
|
||||||
|
+'<div class="waitline" style="margin-top:14px">正在等待到账,不用刷新页面</div>';
|
||||||
|
tick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function tick(){
|
||||||
|
var e=$('cdv'); if(!e||!S.pay) return;
|
||||||
|
var r=S.pay.expire_at-nowSec(); e.textContent=P.left(r); $('cd').classList.toggle('low',r<120);
|
||||||
|
if(r<=0){ $('qrInfo').querySelector('p').textContent='二维码已过期。点上面的「支付宝扫码」重新生成一张。'; }
|
||||||
|
}
|
||||||
|
setInterval(function(){ tick(); if(S.v&&S.v.order.state==='unpaid') $('keep').textContent='订单保留 '+P.left(S.v.order.expire_at-nowSec())+',超时自动关闭'; },1000);
|
||||||
|
|
||||||
|
function choose(ch){
|
||||||
|
$('pMsg').hidden=true;
|
||||||
|
P.api('POST','/pay',{oid:S.oid,t:S.t,channel:ch}).then(function(j){
|
||||||
|
if(!j.ok){ msg('pMsg',j.error,true); return refresh(); }
|
||||||
|
S.pay=j.payment; refresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function msg(id,t,bad){ var m=$(id); m.hidden=false; m.textContent=t; m.className='pmsg'+(bad?' bad':''); }
|
||||||
|
function check(id){
|
||||||
|
msg(id,'正在向支付渠道查询…');
|
||||||
|
P.api('POST','/check',{oid:S.oid,t:S.t}).then(function(j){ msg(id,j.msg||j.error||'',!j.found); refresh(); });
|
||||||
|
}
|
||||||
|
$('btnCheck').onclick=function(){ check('pMsg'); };
|
||||||
|
$('btnCheck2').onclick=function(){ check('pMsg2'); };
|
||||||
|
$('btnCopy').onclick=function(){
|
||||||
|
var u=location.origin+location.pathname+'?o='+S.oid+'&t='+S.t, b=this;
|
||||||
|
(navigator.clipboard?navigator.clipboard.writeText(u):Promise.reject()).then(function(){ b.textContent='已复制'; },function(){ prompt('复制这个链接',u); });
|
||||||
|
setTimeout(function(){ b.textContent='复制订单链接'; },1600);
|
||||||
|
};
|
||||||
|
|
||||||
|
function refresh(){
|
||||||
|
if(!S.oid||!S.t){ miss(); return Promise.resolve(); }
|
||||||
|
var url=(S.pay&&S.pay.state==='created'&&S.v&&S.v.order.state==='unpaid')
|
||||||
|
? '/pay?pay_id='+encodeURIComponent(S.pay.pay_id)+'&t='+encodeURIComponent(S.t)
|
||||||
|
: '/order?oid='+encodeURIComponent(S.oid)+'&t='+encodeURIComponent(S.t);
|
||||||
|
return P.api('GET',url).then(function(j){ if(j.ok) render(j); else if(!S.v) miss(); });
|
||||||
|
}
|
||||||
|
function miss(){ show('missBox',true); show('unpaidBox',false); $('pOid').textContent=S.oid||'—'; $('pState').textContent='查不到'; $('pTitle').textContent='订单'; }
|
||||||
|
function loop(){ clearTimeout(S.timer); if(document.visibilityState!=='visible') return;
|
||||||
|
refresh().then(function(){ S.timer=setTimeout(loop,(S.v&&S.v.order.state==='unpaid')?3000:8000); }); }
|
||||||
|
document.addEventListener('visibilitychange',function(){ if(document.visibilityState==='visible') loop(); });
|
||||||
|
P.demo.onChange=refresh;
|
||||||
|
loop();
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<script src="assets/site.js?v=32"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user