Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fbcf573034 | |||
| 5ae5c8bc34 | |||
| d23aaa8771 | |||
| 2bf5b98ba2 | |||
| 4d1d69595b | |||
| cd3cc0d8fe | |||
| 56359f9623 | |||
| 3852d70520 |
@@ -101,12 +101,14 @@ svg{fill:none; stroke:currentColor;}
|
||||
.kpi .t{font-size:var(--fs-sm); color:var(--muted);}
|
||||
.kpi .v{font-size:24px; font-weight:700; color:var(--heading); margin-top:7px; letter-spacing:.3px; font-family:var(--font-mono);}
|
||||
.kpi.alert .v{color:var(--accent);}
|
||||
.kpi.warn .v{color:var(--warn);}
|
||||
.kpi .d{font-size:var(--fs-xs); margin-top:5px; display:inline-flex; align-items:center; gap:4px;}
|
||||
.up{color:var(--success);} .down{color:var(--danger);}
|
||||
.ic{width:30px; height:30px; border-radius:var(--r-md); display:flex; align-items:center; justify-content:center; float:right; margin-top:-2px;}
|
||||
.ic svg{width:17px; height:17px; stroke-width:1.8;}
|
||||
.ic-info{background:var(--info-soft); color:var(--primary);} .ic-ok{background:var(--ok-soft); color:var(--success);}
|
||||
.ic-blue{background:var(--info-soft); color:var(--brand400);} .ic-alert{background:var(--accent-soft); color:var(--accent);}
|
||||
.ic-warn{background:var(--warn-bg); color:var(--warn);} /* 暗黄(草稿类 KPI) */
|
||||
|
||||
/* ---- 表格 ---- */
|
||||
.table{background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); overflow:hidden; transition:background-color .28s,border-color .28s;}
|
||||
|
||||
@@ -382,6 +382,7 @@
|
||||
<div class="pcard"><div class="pcard-h"><h3>KPI 卡</h3><span class="tk">.kpi</span></div><div class="pcard-b">
|
||||
<div class="kpi" style="width:200px"><div class="ic ic-info"><svg viewBox="0 0 24 24"><use href="#i-box"/></svg></div><div class="t">SKU 总数</div><div class="v">1,284</div><div class="d up">▲ 2.3%</div></div>
|
||||
<div class="kpi alert" style="width:200px"><div class="ic ic-alert"><svg viewBox="0 0 24 24"><use href="#i-ic18"/></svg></div><div class="t">缺货预警</div><div class="v">17</div><div class="d down">需补货 6 项</div></div>
|
||||
<div class="kpi warn" style="width:200px"><div class="ic ic-warn"><svg viewBox="0 0 24 24"><use href="#i-ic06"/></svg></div><div class="t">草稿单数</div><div class="v">2</div><div class="d">待提交审核</div></div>
|
||||
</div></div>
|
||||
<div class="pcard"><div class="pcard-h"><h3>表格行</h3><span class="tk">.table thead/tbody</span></div><div class="pcard-b" style="display:block">
|
||||
<div class="table"><table><thead><tr><th>商品</th><th>分类</th><th class="num">库存</th><th><span class="fh filtered">状态 <svg class="funnel" viewBox="0 0 24 24"><use href="#i-ic68"/></svg></span></th></tr></thead><tbody>
|
||||
|
||||
@@ -99,21 +99,21 @@
|
||||
<script src="shell.js"></script>
|
||||
<script>
|
||||
const ITEMS=[
|
||||
{name:'茅台 飞天 53°',code:'MT-FT-500',spec:'500ml×6',series:'飞天',batch:'PZ240711',cat:'酱香',qty:128,unit:'件',cost:'¥2,680',price:'¥2680.00',prodDate:'2024-07-11',inDate:'2026-06-14',supplier:'贵州茅台经销',value:'¥34.3万',status:'在售'},
|
||||
{name:'五粮液 普五 52°',code:'WLY-PW-500',spec:'500ml×6',series:'普五',batch:'PZ240428',cat:'浓香',qty:64,unit:'件',cost:'¥1,050',price:'¥1050.00',prodDate:'2024-04-28',inDate:'2026-06-14',supplier:'宜宾五粮液',value:'¥6.7万',status:'在售'},
|
||||
{name:'剑南春 水晶剑',code:'JNC-SJ-500',spec:'500ml×6',series:'水晶剑',batch:'PZ231115',cat:'浓香',qty:8,unit:'件',cost:'¥438',price:'¥438.00',prodDate:'2023-11-15',inDate:'2026-06-12',supplier:'绵竹剑南春',value:'¥3,500',status:'缺货'},
|
||||
{name:'国窖 1573',code:'GJ-1573-500',spec:'500ml×6',series:'1573',batch:'PZ240208',cat:'浓香',qty:42,unit:'件',cost:'¥980',price:'¥980.00',prodDate:'2024-02-08',inDate:'2026-06-10',supplier:'泸州老窖',value:'¥4.1万',status:'在售'},
|
||||
{name:'洋河 梦之蓝 M6',code:'YH-M6-500',spec:'500ml×6',series:'梦之蓝M6',batch:'PZ240520',cat:'绵柔',qty:23,unit:'件',cost:'¥620',price:'¥620.00',prodDate:'2024-05-20',inDate:'2026-06-09',supplier:'洋河股份',value:'¥1.4万',status:'预警'},
|
||||
{name:'泸州老窖 特曲',code:'LZLJ-TQ-500',spec:'500ml×6',series:'特曲',batch:'PZ240630',cat:'浓香',qty:156,unit:'件',cost:'¥320',price:'¥320.00',prodDate:'2024-06-30',inDate:'2026-06-08',supplier:'泸州老窖',value:'¥5万',status:'在售'},
|
||||
{name:'习酒 窖藏 1988',code:'XJ-JC1988',spec:'500ml×6',series:'窖藏1988',batch:'PZ230918',cat:'酱香',qty:31,unit:'件',cost:'¥760',price:'¥760.00',prodDate:'2023-09-18',inDate:'2026-06-05',supplier:'贵州习酒',value:'¥2.4万',status:'在售'},
|
||||
{name:'汾酒 青花 20',code:'FJ-QH20-500',spec:'500ml×6',series:'青花20',batch:'PZ240112',cat:'清香',qty:0,unit:'件',cost:'¥420',price:'¥420.00',prodDate:'2024-01-12',inDate:'2026-06-03',supplier:'山西杏花村',value:'¥0',status:'缺货'},
|
||||
{name:'郎酒 红花郎 15',code:'LJ-HHL15',spec:'500ml×6',series:'红花郎15',batch:'PZ240325',cat:'酱香',qty:54,unit:'件',cost:'¥560',price:'¥560.00',prodDate:'2024-03-25',inDate:'2026-06-01',supplier:'四川郎酒',value:'¥3万',status:'在售'},
|
||||
{name:'古井贡 年份原浆',code:'GJG-NF-500',spec:'500ml×6',series:'年份原浆',batch:'PZ240802',cat:'浓香',qty:12,unit:'件',cost:'¥390',price:'¥390.00',prodDate:'2024-08-02',inDate:'2026-05-28',supplier:'古井贡酒',value:'¥4,700',status:'预警'},
|
||||
{name:'西凤酒 旗舰版',code:'XF-QJ-500',spec:'500ml×6',series:'旗舰版',batch:'PZ240614',cat:'凤香',qty:88,unit:'件',cost:'¥280',price:'¥280.00',prodDate:'2024-06-14',inDate:'2026-05-25',supplier:'陕西西凤',value:'¥2.5万',status:'在售'},
|
||||
{name:'水井坊 井台',code:'SJF-JT-500',spec:'500ml×6',series:'井台',batch:'PZ231209',cat:'浓香',qty:6,unit:'件',cost:'¥680',price:'¥680.00',prodDate:'2023-12-09',inDate:'2026-05-20',supplier:'四川水井坊',value:'¥4,100',status:'缺货'},
|
||||
{name:'茅台 飞天 53°',code:'MT-FT-500',spec:'500ml×6',series:'飞天',batch:'PZ240711',cat:'酱香',qty:128,unit:'件',cost:'¥2,680',price:'¥343,040',prodDate:'2024-07-11',inDate:'2026-06-14',supplier:'贵州茅台经销',value:'¥34.3万',status:'在售'},
|
||||
{name:'五粮液 普五 52°',code:'WLY-PW-500',spec:'500ml×6',series:'普五',batch:'PZ240428',cat:'浓香',qty:64,unit:'件',cost:'¥1,050',price:'¥67,200',prodDate:'2024-04-28',inDate:'2026-06-14',supplier:'宜宾五粮液',value:'¥6.7万',status:'在售'},
|
||||
{name:'剑南春 水晶剑',code:'JNC-SJ-500',spec:'500ml×6',series:'水晶剑',batch:'PZ231115',cat:'浓香',qty:8,unit:'件',cost:'¥438',price:'¥3,504',prodDate:'2023-11-15',inDate:'2026-06-12',supplier:'绵竹剑南春',value:'¥3,500',status:'缺货'},
|
||||
{name:'国窖 1573',code:'GJ-1573-500',spec:'500ml×6',series:'1573',batch:'PZ240208',cat:'浓香',qty:42,unit:'件',cost:'¥980',price:'¥41,160',prodDate:'2024-02-08',inDate:'2026-06-10',supplier:'泸州老窖',value:'¥4.1万',status:'在售'},
|
||||
{name:'洋河 梦之蓝 M6',code:'YH-M6-500',spec:'500ml×6',series:'梦之蓝M6',batch:'PZ240520',cat:'绵柔',qty:23,unit:'件',cost:'¥620',price:'¥14,260',prodDate:'2024-05-20',inDate:'2026-06-09',supplier:'洋河股份',value:'¥1.4万',status:'预警'},
|
||||
{name:'泸州老窖 特曲',code:'LZLJ-TQ-500',spec:'500ml×6',series:'特曲',batch:'PZ240630',cat:'浓香',qty:156,unit:'件',cost:'¥320',price:'¥49,920',prodDate:'2024-06-30',inDate:'2026-06-08',supplier:'泸州老窖',value:'¥5万',status:'在售'},
|
||||
{name:'习酒 窖藏 1988',code:'XJ-JC1988',spec:'500ml×6',series:'窖藏1988',batch:'PZ230918',cat:'酱香',qty:31,unit:'件',cost:'¥760',price:'¥23,560',prodDate:'2023-09-18',inDate:'2026-06-05',supplier:'贵州习酒',value:'¥2.4万',status:'在售'},
|
||||
{name:'汾酒 青花 20',code:'FJ-QH20-500',spec:'500ml×6',series:'青花20',batch:'PZ240112',cat:'清香',qty:0,unit:'件',cost:'¥420',price:'¥0',prodDate:'2024-01-12',inDate:'2026-06-03',supplier:'山西杏花村',value:'¥0',status:'缺货'},
|
||||
{name:'郎酒 红花郎 15',code:'LJ-HHL15',spec:'500ml×6',series:'红花郎15',batch:'PZ240325',cat:'酱香',qty:54,unit:'件',cost:'¥560',price:'¥30,240',prodDate:'2024-03-25',inDate:'2026-06-01',supplier:'四川郎酒',value:'¥3万',status:'在售'},
|
||||
{name:'古井贡 年份原浆',code:'GJG-NF-500',spec:'500ml×6',series:'年份原浆',batch:'PZ240802',cat:'浓香',qty:12,unit:'件',cost:'¥390',price:'¥4,680',prodDate:'2024-08-02',inDate:'2026-05-28',supplier:'古井贡酒',value:'¥4,700',status:'预警'},
|
||||
{name:'西凤酒 旗舰版',code:'XF-QJ-500',spec:'500ml×6',series:'旗舰版',batch:'PZ240614',cat:'凤香',qty:88,unit:'件',cost:'¥280',price:'¥24,640',prodDate:'2024-06-14',inDate:'2026-05-25',supplier:'陕西西凤',value:'¥2.5万',status:'在售'},
|
||||
{name:'水井坊 井台',code:'SJF-JT-500',spec:'500ml×6',series:'井台',batch:'PZ231209',cat:'浓香',qty:6,unit:'件',cost:'¥680',price:'¥4,080',prodDate:'2023-12-09',inDate:'2026-05-20',supplier:'四川水井坊',value:'¥4,100',status:'缺货'},
|
||||
];
|
||||
const STATUS=['全部','在售','预警','缺货'];
|
||||
const COLS=[{key:'product',label:'商品',fixed:true},{key:'spec',label:'规格'},{key:'series',label:'系列'},{key:'batch',label:'批次号'},{key:'qty',label:'库存',num:true},{key:'cost',label:'成本价',num:true},{key:'price',label:'单价',num:true},{key:'prodDate',label:'生产日期'},{key:'inDate',label:'入库时间'},{key:'supplier',label:'供应商'},{key:'status',label:'状态',filter:'status'},{key:'act',label:'操作',fixed:true}];
|
||||
const COLS=[{key:'product',label:'商品',fixed:true},{key:'spec',label:'规格'},{key:'series',label:'系列'},{key:'batch',label:'批次号'},{key:'qty',label:'库存',num:true},{key:'cost',label:'成本价',num:true},{key:'price',label:'总价',num:true},{key:'prodDate',label:'生产日期'},{key:'inDate',label:'入库时间'},{key:'supplier',label:'供应商'},{key:'status',label:'状态',filter:'status'},{key:'act',label:'操作',fixed:true}];
|
||||
const state={q:'',code:'',status:'全部',page:1,perPage:10,hidden:new Set()};
|
||||
|
||||
function setActive(k){ document.querySelectorAll('.nav[data-k]').forEach(e=>e.classList.toggle('active',e.dataset.k===k)); }
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
.head h1{margin:0; font-size:var(--fs-h1); font-weight:700; color:var(--title); letter-spacing:.3px;}
|
||||
.head .sub{font-size:var(--fs-sm); color:var(--muted); margin-bottom:2px;}
|
||||
.head .actions{margin-left:auto; display:flex; gap:10px;}
|
||||
.kpis{display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:20px;}
|
||||
.kpis{display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px;}
|
||||
.toolbar{display:flex; align-items:center; gap:10px; background:var(--surface); border:1px solid var(--border); border-bottom:none; border-radius:var(--r-lg) var(--r-lg) 0 0; padding:12px 14px; flex-wrap:wrap; transition:background-color .28s,border-color .28s;}
|
||||
.toolbar .searchbox{width:260px;}
|
||||
.toolbar .daterange{display:flex; align-items:center; gap:6px; height:34px; padding:0 11px; border:1px solid var(--border); border-radius:var(--r-md); background:var(--surface); font-size:var(--fs-sm); color:var(--text); cursor:pointer;}
|
||||
@@ -58,6 +58,7 @@
|
||||
<div class="kpi"><div class="ic ic-info"><svg viewBox="0 0 24 24"><use href="#i-download"/></svg></div><div class="t">本月入库笔数</div><div class="v">28</div><div class="d up">▲ 12% 较上月</div></div>
|
||||
<div class="kpi"><div class="ic ic-ok"><svg viewBox="0 0 24 24"><use href="#i-ic47"/></svg></div><div class="t">本月入库金额</div><div class="v">¥186万</div><div class="d up">▲ 8.4% 较上月</div></div>
|
||||
<div class="kpi alert click" onclick="filterStatus('待审核')"><div class="ic ic-alert"><svg viewBox="0 0 24 24"><use href="#i-ic42"/></svg></div><div class="t">待审核单数 · 点击筛选</div><div class="v">4</div><div class="d down">需尽快处理</div></div>
|
||||
<div class="kpi warn click" onclick="filterStatus('草稿')"><div class="ic ic-warn"><svg viewBox="0 0 24 24"><use href="#i-ic06"/></svg></div><div class="t">草稿单数 · 点击筛选</div><div class="v">2</div><div class="d">待提交审核</div></div>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<div class="searchbox"><svg viewBox="0 0 24 24"><use href="#i-search"/></svg><input id="searchInput" placeholder="搜索单号 / 供应商 / 酒名" oninput="state.q=this.value; state.page=1; render()"></div>
|
||||
@@ -153,6 +154,7 @@ const PARTY_LABEL='供应商';
|
||||
|
||||
|
||||
function money(n){ return '¥'+n.toLocaleString(); }
|
||||
function numf(n){ return (Number(n)||0).toLocaleString(); } /* 明细行内数字:去¥,缩一号(2026-07-03) */
|
||||
function filtered(){ return ORDERS.filter(o=>{
|
||||
if(state.status!=='全部'&&o.status!==state.status&&o.ret!==state.status)return false;
|
||||
if(state.party!=='全部'&&o.party!==state.party)return false;
|
||||
@@ -300,8 +302,8 @@ function auditBtns(o,idx){
|
||||
return '';
|
||||
}
|
||||
function openDetail(idx){ const o=ORDERS[idx]; document.getElementById('dTitle').textContent=o.no;
|
||||
let lh=`<div class="lines"><div class="lh" style="grid-template-columns:1fr 124px 40px 64px 78px"><span>商品 · 编码</span><span>系列 / 规格</span><span style="text-align:right">数量</span><span style="text-align:right">单价</span><span style="text-align:right">金额</span></div>`;
|
||||
o.lines.forEach(l=>{ const pi=PINFO[l.name]||{}; const pend=(l.price||0)<=0; const priceC=pend?'<span class="pending-price">待定价</span>':money(l.price); const amtC=pend?'<span class="pending-price">待定价</span>':money(l.qty*l.price); lh+=`<div class="lr" style="grid-template-columns:1fr 124px 40px 64px 78px;align-items:start"><span class="lcell"><span class="ln">${l.name}</span><span class="lcode">${pi.code||'—'}</span></span><span class="lcell"><span class="lser">${pi.series||'—'}</span><span class="lspec">${pi.spec||''}</span></span><span style="text-align:right;font-family:var(--font-mono)">${l.qty}</span><span style="text-align:right;font-family:var(--font-mono)">${priceC}</span><span class="amt">${amtC}</span></div>`; }); lh+='</div>';
|
||||
let lh=`<div class="lines"><div class="lh" style="grid-template-columns:1fr 124px 40px 64px 78px"><span>商品 · 编码</span><span>系列 / 规格</span><span style="text-align:right">数量</span><span style="text-align:right">进价(单瓶)</span><span style="text-align:right">总价</span></div>`;
|
||||
o.lines.forEach(l=>{ const pi=PINFO[l.name]||{}; const pend=(l.price||0)<=0; const priceC=pend?'<span class="pending-price">待定价</span>':numf(l.price); const amtC=pend?'<span class="pending-price">待定价</span>':numf(l.qty*l.price); lh+=`<div class="lr" style="grid-template-columns:1fr 124px 40px 64px 78px;align-items:start"><span class="lcell"><span class="ln">${l.name}</span><span class="lcode">${pi.code||'—'}</span></span><span class="lcell"><span class="lser">${pi.series||'—'}</span><span class="lspec">${pi.spec||''}</span></span><span style="text-align:right;font-family:var(--font-mono)">${l.qty}</span><span style="text-align:right;font-family:var(--font-mono)">${priceC}</span><span class="amt">${amtC}</span></div>`; }); lh+='</div>';
|
||||
const pendCount=o.lines.filter(l=>(l.price||0)<=0).length;
|
||||
const auditor=o.auditor?o.auditor:'<span style="color:var(--faint)">—</span>';
|
||||
document.getElementById('drawerBody').innerHTML=`<div class="drow"><span>单据日期</span><b>${o.date}</b></div><div class="drow"><span>${PARTY_LABEL}</span><b>${o.party}</b></div><div class="drow"><span>仓库</span><b>${o.wh}</b></div><div class="drow"><span>商品数</span><b>${o.count}</b></div><div class="drow"><span>入库员</span><b>${o.op}</b></div><div class="drow"><span>审核员</span><b>${auditor}</b></div><div class="drow"><span>状态</span><b><span class="badge b-${o.status}">${o.status}</span>${o.ret?` <span class="badge b-${o.ret}">${o.ret}</span>`:''}</b></div><label style="display:block;font-size:var(--fs-sm);color:var(--muted);margin:16px 0 8px;">入库明细</label>${lh}<div class="ltotal">合计金额 <b>${money(o.amount)}</b></div>`+
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
.head h1{margin:0; font-size:var(--fs-h1); font-weight:700; color:var(--title); letter-spacing:.3px;}
|
||||
.head .sub{font-size:var(--fs-sm); color:var(--muted); margin-bottom:2px;}
|
||||
.head .actions{margin-left:auto; display:flex; gap:10px;}
|
||||
.kpis{display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:20px;}
|
||||
.kpis{display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px;}
|
||||
.toolbar{display:flex; align-items:center; gap:10px; background:var(--surface); border:1px solid var(--border); border-bottom:none; border-radius:var(--r-lg) var(--r-lg) 0 0; padding:12px 14px; flex-wrap:wrap; transition:background-color .28s,border-color .28s;}
|
||||
.toolbar .searchbox{width:260px;}
|
||||
.toolbar .daterange{display:flex; align-items:center; gap:6px; height:34px; padding:0 11px; border:1px solid var(--border); border-radius:var(--r-md); background:var(--surface); font-size:var(--fs-sm); color:var(--text); cursor:pointer;}
|
||||
@@ -58,6 +58,7 @@
|
||||
<div class="kpi"><div class="ic ic-info"><svg viewBox="0 0 24 24"><use href="#i-ic53"/></svg></div><div class="t">本月出库笔数</div><div class="v">31</div><div class="d up">▲ 9% 较上月</div></div>
|
||||
<div class="kpi"><div class="ic ic-ok"><svg viewBox="0 0 24 24"><use href="#i-ic47"/></svg></div><div class="t">本月出库金额</div><div class="v">¥214万</div><div class="d up">▲ 6.2% 较上月</div></div>
|
||||
<div class="kpi alert click" onclick="filterStatus('待审核')"><div class="ic ic-alert"><svg viewBox="0 0 24 24"><use href="#i-ic42"/></svg></div><div class="t">待审核单数 · 点击筛选</div><div class="v">3</div><div class="d down">需尽快处理</div></div>
|
||||
<div class="kpi warn click" onclick="filterStatus('草稿')"><div class="ic ic-warn"><svg viewBox="0 0 24 24"><use href="#i-ic06"/></svg></div><div class="t">草稿单数 · 点击筛选</div><div class="v">2</div><div class="d">待提交审核</div></div>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<div class="searchbox"><svg viewBox="0 0 24 24"><use href="#i-search"/></svg><input id="searchInput" placeholder="搜索单号 / 客户 / 酒名" oninput="state.q=this.value; state.page=1; render()"></div>
|
||||
@@ -152,6 +153,7 @@ const PARTY_LABEL='客户';
|
||||
|
||||
|
||||
function money(n){ return '¥'+n.toLocaleString(); }
|
||||
function numf(n){ return (Number(n)||0).toLocaleString(); } /* 明细行内数字:去¥,缩一号(2026-07-03) */
|
||||
function filtered(){ return ORDERS.filter(o=>{
|
||||
if(state.status!=='全部'&&o.status!==state.status&&o.ret!==state.status)return false;
|
||||
if(state.party!=='全部'&&o.party!==state.party)return false;
|
||||
@@ -295,9 +297,9 @@ function auditBtns(o,idx){
|
||||
return '';
|
||||
}
|
||||
function openDetail(idx){ const o=ORDERS[idx]; document.getElementById('dTitle').textContent=o.no;
|
||||
const GRID='1fr 108px 36px 60px 60px 64px';
|
||||
let lh=`<div class="lines"><div class="lh" style="grid-template-columns:${GRID}"><span>商品 · 编码</span><span>系列 / 规格</span><span style="text-align:right">数量</span><span style="text-align:right">成本价</span><span style="text-align:right">售价</span><span style="text-align:right">利润</span></div>`;
|
||||
o.lines.forEach(l=>{ const pi=PINFO[l.name]||{}; const cost=l.cost!=null?l.cost:Math.round((l.price||0)*0.85); const pend=(l.price||0)<=0; const saleC=pend?'<span class="pending-price">待定价</span>':money(l.price); const profit=(l.price-cost)*l.qty; const profitC=pend?'<span class="pending-price">待定价</span>':`<span style="color:${profit<0?'var(--danger)':'var(--success)'}">${money(profit)}</span>`; lh+=`<div class="lr" style="grid-template-columns:${GRID};align-items:start"><span class="lcell"><span class="ln">${l.name}</span><span class="lcode">${pi.code||'—'}</span></span><span class="lcell"><span class="lser">${pi.series||'—'}</span><span class="lspec">${pi.spec||''}</span></span><span style="text-align:right;font-family:var(--font-mono)">${l.qty}</span><span style="text-align:right;font-family:var(--font-mono)">${money(cost)}</span><span style="text-align:right;font-family:var(--font-mono)">${saleC}</span><span class="amt">${profitC}</span></div>`; }); lh+='</div>';
|
||||
const GRID='1fr 96px 32px 56px 56px 62px 60px';
|
||||
let lh=`<div class="lines"><div class="lh" style="grid-template-columns:${GRID}"><span>商品 · 编码</span><span>系列 / 规格</span><span style="text-align:right">数量</span><span style="text-align:right">成本价</span><span style="text-align:right">售价</span><span style="text-align:right">总售价</span><span style="text-align:right">利润</span></div>`;
|
||||
o.lines.forEach(l=>{ const pi=PINFO[l.name]||{}; const cost=l.cost!=null?l.cost:Math.round((l.price||0)*0.85); const pend=(l.price||0)<=0; const saleC=pend?'<span class="pending-price">待定价</span>':numf(l.price); const profit=(l.price-cost)*l.qty; const profitC=pend?'<span class="pending-price">待定价</span>':`<span style="color:${profit<0?'var(--danger)':'var(--success)'}">${numf(profit)}</span>`; lh+=`<div class="lr" style="grid-template-columns:${GRID};align-items:start"><span class="lcell"><span class="ln">${l.name}</span><span class="lcode">${pi.code||'—'}</span></span><span class="lcell"><span class="lser">${pi.series||'—'}</span><span class="lspec">${pi.spec||''}</span></span><span style="text-align:right;font-family:var(--font-mono)">${l.qty}</span><span style="text-align:right;font-family:var(--font-mono);font-size:var(--fs-sm)">${numf(cost)}</span><span style="text-align:right;font-family:var(--font-mono);font-size:var(--fs-sm)">${saleC}</span><span class="amt" style="font-size:var(--fs-sm)">${pend?'<span class="pending-price">待定价</span>':numf(l.qty*l.price)}</span><span style="text-align:right;font-family:var(--font-mono);font-size:var(--fs-sm)">${profitC}</span></div>`; }); lh+='</div>';
|
||||
const pendCount=o.lines.filter(l=>(l.price||0)<=0).length;
|
||||
const auditor=o.auditor?o.auditor:'<span style="color:var(--faint)">—</span>';
|
||||
document.getElementById('drawerBody').innerHTML=`<div class="drow"><span>单据日期</span><b>${o.date}</b></div><div class="drow"><span>${PARTY_LABEL}</span><b>${o.party}</b></div><div class="drow"><span>仓库</span><b>${o.wh}</b></div><div class="drow"><span>商品数</span><b>${o.count}</b></div><div class="drow"><span>出库员</span><b>${o.op}</b></div><div class="drow"><span>审核员</span><b>${auditor}</b></div><div class="drow"><span>状态</span><b><span class="badge b-${o.status}">${o.status}</span>${o.ret?` <span class="badge b-${o.ret}">${o.ret}</span>`:''}</b></div><label style="display:block;font-size:var(--fs-sm);color:var(--muted);margin:16px 0 8px;">出库明细</label>${lh}<div class="ltotal">合计金额 <b>${money(o.amount)}</b></div><div class="ltotal" style="padding-top:4px">合计利润 <b style="color:var(--success)">${money(o.lines.reduce((s,l)=>{const c=l.cost!=null?l.cost:Math.round((l.price||0)*0.85);return s+((l.price||0)>0?((l.price-c)*l.qty):0);},0))}</b></div>`+
|
||||
|
||||
@@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.1.1] - 2026-07-03
|
||||
|
||||
### 新功能
|
||||
- 入库/出库管理各新增「草稿单数」卡片(审核卡片之后,点击直接筛选草稿单)。
|
||||
- 出库单详情明细在售价后新增「总售价」列。
|
||||
- 新建出库单从库存选择商品后,数量自动填入可用数量、售价自动填入入库时的参考售价。
|
||||
- 商品公开预览页支持返回(从 App 内进入时显示返回按钮)。
|
||||
|
||||
### 改进
|
||||
- 出库/入库详情明细:行内价格去掉 ¥ 符号并缩小一号,不再折行拥挤;列宽重排。
|
||||
- 入库明细列名更清晰:进价(单瓶)/ 总价;库存列表「单价」列改为「总价」(库存×成本);
|
||||
商品编辑抽屉改为 成本价(单瓶)/ 总成本价。
|
||||
|
||||
## [1.1.0] - 2026-07-03
|
||||
|
||||
> 定价与利润模型里程碑版(内容与 1.0.88 相同,版本号升为 1.1.0,与 server-v1.1.0 配套)。
|
||||
|
||||
### 新功能
|
||||
- 出库单详情全新明细:成本价、售价、利润三列一目了然,底部同时显示合计金额与合计利润(仅管理员可见成本与利润)。
|
||||
- 新建出库单:明细行实时显示每行利润(原「金额」列升级),底栏新增合计利润;商品名称下方直接展示商品编码。
|
||||
|
||||
### 改进
|
||||
- 入库单明细列头更清晰:进价(单瓶)、参考售价、总进价。
|
||||
- 退单窗口金额改按售价显示,与应收冲账口径一致。
|
||||
|
||||
## [1.0.87] - 2026-07-03
|
||||
|
||||
### 新功能
|
||||
|
||||
@@ -5,7 +5,18 @@
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.0.86] - 2026-07-03
|
||||
## [1.1.1] - 2026-07-03
|
||||
|
||||
### 修复
|
||||
- 财务页「应收/应付汇总」加载失败(v1.0.85 起全店受影响):多租户加固引入的数据库
|
||||
预处理协议兼容问题,已修复并补充服务端错误日志。
|
||||
|
||||
### 新功能
|
||||
- 出库/入库统计接口新增草稿单数,供列表页「草稿」卡片使用。
|
||||
|
||||
## [1.1.0] - 2026-07-03
|
||||
|
||||
> 定价数据模型里程碑版(内容与 1.0.86 相同,版本号升为 1.1.0)。
|
||||
|
||||
### 新功能
|
||||
- 出库单新增「总利润」:建单即计算入库,确认售价、确认进价(成本回填)后自动联动重算。
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -246,9 +247,13 @@ func (h *FinanceHandler) Summary(c *gin.Context) {
|
||||
WHERE f.shop_id = ? AND f.deleted_at IS NULL
|
||||
AND f.type IN ('payable','receivable')
|
||||
AND f.status = 'open'
|
||||
GROUP BY f.partner_id, f.type
|
||||
GROUP BY f.partner_id, f.type, p.name
|
||||
ORDER BY total_amount DESC
|
||||
`, shopID).Scan(&rows).Error; err != nil {
|
||||
// p.name 必须入 GROUP BY:JOIN 带 shop_id 条件后,MySQL 预处理协议
|
||||
// 推导不出 p.name 的函数依赖 → only_full_group_by 1055(文本协议却能过,
|
||||
// 故 CLI 直跑无法复现)。p.name 由 partner_id 唯一决定,加入不改分组粒度。
|
||||
log.Printf("finance summary query failed (shop %d): %v", shopID, err)
|
||||
util.RespondError(c, http.StatusInternalServerError, "QUERY_ERROR", "查询失败")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ type stockSummary struct {
|
||||
MonthCount int64 `json:"month_count"`
|
||||
MonthAmount float64 `json:"month_amount"`
|
||||
PendingCount int64 `json:"pending_count"`
|
||||
DraftCount int64 `json:"draft_count"`
|
||||
LastMonthCount int64 `json:"last_month_count"`
|
||||
LastMonthAmount float64 `json:"last_month_amount"`
|
||||
}
|
||||
@@ -201,6 +202,8 @@ func (h *StockInHandler) Summary(c *gin.Context) {
|
||||
s.LastMonthCount, s.LastMonthAmount = agg(prevFrom, prevTo)
|
||||
h.db.Model(&model.StockInOrder{}).
|
||||
Where("shop_id = ? AND status = ? AND deleted_at IS NULL", shopID, "pending").Count(&s.PendingCount)
|
||||
h.db.Model(&model.StockInOrder{}).
|
||||
Where("shop_id = ? AND status = ? AND deleted_at IS NULL", shopID, "draft").Count(&s.DraftCount)
|
||||
c.JSON(http.StatusOK, s)
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,8 @@ func (h *StockOutHandler) Summary(c *gin.Context) {
|
||||
s.LastMonthCount, s.LastMonthAmount = agg(prevFrom, prevTo)
|
||||
h.db.Model(&model.StockOutOrder{}).
|
||||
Where("shop_id = ? AND status = ? AND deleted_at IS NULL", shopID, "pending").Count(&s.PendingCount)
|
||||
h.db.Model(&model.StockOutOrder{}).
|
||||
Where("shop_id = ? AND status = ? AND deleted_at IS NULL", shopID, "draft").Count(&s.DraftCount)
|
||||
c.JSON(http.StatusOK, s)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ class StockSummary {
|
||||
final int monthCount;
|
||||
final double monthAmount;
|
||||
final int pendingCount;
|
||||
final int draftCount;
|
||||
final int lastMonthCount;
|
||||
final double lastMonthAmount;
|
||||
|
||||
@@ -11,6 +12,7 @@ class StockSummary {
|
||||
this.monthCount = 0,
|
||||
this.monthAmount = 0,
|
||||
this.pendingCount = 0,
|
||||
this.draftCount = 0,
|
||||
this.lastMonthCount = 0,
|
||||
this.lastMonthAmount = 0,
|
||||
});
|
||||
@@ -19,6 +21,7 @@ class StockSummary {
|
||||
monthCount: (j['month_count'] as num?)?.toInt() ?? 0,
|
||||
monthAmount: (j['month_amount'] as num?)?.toDouble() ?? 0,
|
||||
pendingCount: (j['pending_count'] as num?)?.toInt() ?? 0,
|
||||
draftCount: (j['draft_count'] as num?)?.toInt() ?? 0,
|
||||
lastMonthCount: (j['last_month_count'] as num?)?.toInt() ?? 0,
|
||||
lastMonthAmount: (j['last_month_amount'] as num?)?.toDouble() ?? 0,
|
||||
);
|
||||
|
||||
@@ -50,7 +50,7 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
static const _statusOptions = ['全部', '在售', '预警', '缺货'];
|
||||
|
||||
// 列序照原型 inventory.html COLS:商品/规格/系列/批次/库存/成本价/单价/生产/入库/供应商/状态/操作。
|
||||
// 成本价=入库进价(unitPrice),单价=售价(salePrice)。
|
||||
// 成本价=入库进价(unitPrice),总价=库存×成本价(2026-07-03 用户拍板:原「单价/参考售价」列换掉)。
|
||||
// 仓库/备注原型没有 → 默认隐藏的可选列(列设置可开)。
|
||||
static const _colDefs = [
|
||||
ColDef('product', '商品', required: true),
|
||||
@@ -59,7 +59,7 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
ColDef('batch', '批次号'),
|
||||
ColDef('qty', '库存'),
|
||||
ColDef('cost', '成本价'),
|
||||
ColDef('price', '单价'),
|
||||
ColDef('price', '总价'),
|
||||
ColDef('prodDate', '生产日期'),
|
||||
ColDef('inTime', '入库时间'),
|
||||
ColDef('supplier', '供应商'),
|
||||
@@ -274,7 +274,7 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
'批次号',
|
||||
'库存量',
|
||||
'成本价',
|
||||
'单价',
|
||||
'总价',
|
||||
'生产日期',
|
||||
'入库时间',
|
||||
'供应商',
|
||||
@@ -295,7 +295,9 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
item.batchNo,
|
||||
'${item.quantity.toStringAsFixed(0)} ${item.unit}'.trim(),
|
||||
item.unitPrice != null ? item.unitPrice!.toStringAsFixed(2) : '',
|
||||
item.salePrice != null ? item.salePrice!.toStringAsFixed(2) : '',
|
||||
item.unitPrice != null
|
||||
? (item.unitPrice! * item.quantity).toStringAsFixed(2)
|
||||
: '',
|
||||
item.productionDate ?? '',
|
||||
item.createdAt != null && item.createdAt!.length >= 10
|
||||
? item.createdAt!.substring(0, 10)
|
||||
@@ -362,11 +364,11 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
fontFamily: AppFonts.mono,
|
||||
fontFamilyFallback: AppFonts.monoFallback)),
|
||||
'price' => Text(
|
||||
item.salePrice != null
|
||||
? '¥${item.salePrice!.toStringAsFixed(2)}'
|
||||
: '待定价',
|
||||
style: item.salePrice == null
|
||||
? TextStyle(color: t.warn, fontWeight: FontWeight.w600)
|
||||
item.unitPrice != null
|
||||
? _fmtCost(item.unitPrice! * item.quantity)
|
||||
: '-',
|
||||
style: item.unitPrice == null
|
||||
? TextStyle(color: t.faint)
|
||||
: const TextStyle(
|
||||
fontFamily: AppFonts.mono,
|
||||
fontFamilyFallback: AppFonts.monoFallback)),
|
||||
|
||||
@@ -128,6 +128,17 @@ class _PublicProductScreenState extends State<PublicProductScreen> {
|
||||
if (_error != null || _data == null) {
|
||||
return Scaffold(
|
||||
backgroundColor: _kPaper,
|
||||
// 加载失败态也要能退回 App(canPop 时显示返回,扫码直达不显示)
|
||||
appBar: Navigator.of(context).canPop()
|
||||
? AppBar(
|
||||
backgroundColor: _kPaper,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(LucideIcons.arrowLeft, color: _kBurgundy),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
@@ -199,10 +210,14 @@ class _PublicProductScreenState extends State<PublicProductScreen> {
|
||||
_parseQuickSpecs(spec, batch?['production_date'] as String?);
|
||||
final productionDate = batch?['production_date'] as String?;
|
||||
|
||||
// App 内「预览」推入时可返回(canPop);顾客扫码/网页直达无返回栈则不渲染,
|
||||
// 页面对外保持纯净(本页为独立品牌样式,按钮用自有暖纸/酒红配色)。
|
||||
final canPop = Navigator.of(context).canPop();
|
||||
return Scaffold(
|
||||
backgroundColor: _kPaperDeep,
|
||||
body: SafeArea(
|
||||
child: Center(
|
||||
child: Stack(children: [
|
||||
Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 520),
|
||||
child: CustomScrollView(
|
||||
@@ -286,7 +301,28 @@ class _PublicProductScreenState extends State<PublicProductScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (canPop)
|
||||
Positioned(
|
||||
top: 12,
|
||||
left: 12,
|
||||
child: Material(
|
||||
color: _kPaper.withValues(alpha: 0.92),
|
||||
shape: const CircleBorder(
|
||||
side: BorderSide(color: _kBurgundyLight)),
|
||||
elevation: 2,
|
||||
child: InkWell(
|
||||
customBorder: const CircleBorder(),
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(9),
|
||||
child:
|
||||
Icon(LucideIcons.arrowLeft, size: 20, color: _kBurgundy),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -498,6 +498,14 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
||||
: DsKpiDelta.neutral,
|
||||
onTap: () => _setStatus('pending'),
|
||||
),
|
||||
DsKpi(
|
||||
title: '草稿单数 · 点击筛选',
|
||||
value: '${summary?.draftCount ?? 0}',
|
||||
icon: LucideIcons.filePen,
|
||||
tone: DsKpiTone.warn, // 暗黄(用户拍板)
|
||||
delta: (summary?.draftCount ?? 0) > 0 ? '待提交审核' : '点击筛选',
|
||||
onTap: () => _setStatus('draft'),
|
||||
),
|
||||
];
|
||||
|
||||
final mobile = context.isMobile;
|
||||
@@ -861,6 +869,8 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
||||
|
||||
static final _money =
|
||||
NumberFormat.currency(locale: 'zh_CN', symbol: '¥', decimalDigits: 0);
|
||||
// 明细行内数字(去 ¥,符号只留在合计)
|
||||
static final _num = NumberFormat('#,##0');
|
||||
static String _fmtQty(double q) =>
|
||||
q == q.roundToDouble() ? q.toStringAsFixed(0) : q.toString();
|
||||
|
||||
@@ -896,13 +906,14 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
||||
series: it.productSeries ?? '—',
|
||||
spec: it.productSpec ?? '',
|
||||
qty: _fmtQty(it.quantity),
|
||||
price: it.costPrice == 0 ? '待定价' : _money.format(it.costPrice),
|
||||
amount:
|
||||
it.costAmount == 0 ? '待定价' : _money.format(it.costAmount),
|
||||
price: it.costPrice == 0 ? '待定价' : _num.format(it.costPrice),
|
||||
amount: it.costAmount == 0 ? '待定价' : _num.format(it.costAmount),
|
||||
pending: it.costPrice == 0,
|
||||
))
|
||||
.toList(),
|
||||
totalText: o.costTotal != null ? _money.format(o.costTotal) : '—',
|
||||
priceLabel: '进价(单瓶)',
|
||||
amountLabel: '总价',
|
||||
actionGroups: _detailActionGroups(o),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ class _PickerItem {
|
||||
final String spec;
|
||||
final String unit;
|
||||
final double? costPrice; // 进价(成本,仅管理员可见列)
|
||||
final double? salePrice; // 参考售价(入库时填写,存 product.sale_price)
|
||||
final double availableQty;
|
||||
const _PickerItem({
|
||||
required this.productId,
|
||||
@@ -45,6 +46,7 @@ class _PickerItem {
|
||||
required this.spec,
|
||||
required this.unit,
|
||||
this.costPrice,
|
||||
this.salePrice,
|
||||
required this.availableQty,
|
||||
});
|
||||
}
|
||||
@@ -64,6 +66,7 @@ List<_PickerItem> _aggregatePickerItems(List<Inventory> rows) {
|
||||
spec: existing.spec,
|
||||
unit: existing.unit,
|
||||
costPrice: existing.costPrice ?? inv.unitPrice,
|
||||
salePrice: existing.salePrice ?? inv.salePrice,
|
||||
availableQty: existing.availableQty + inv.quantity,
|
||||
);
|
||||
} else {
|
||||
@@ -75,6 +78,7 @@ List<_PickerItem> _aggregatePickerItems(List<Inventory> rows) {
|
||||
spec: inv.spec,
|
||||
unit: inv.unit,
|
||||
costPrice: inv.unitPrice,
|
||||
salePrice: inv.salePrice,
|
||||
availableQty: inv.quantity,
|
||||
);
|
||||
}
|
||||
@@ -264,7 +268,7 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
setState(() {
|
||||
for (final item in selected) {
|
||||
if (_items.any((row) => row.productId == item.productId)) continue;
|
||||
_items.add(_ItemRow(
|
||||
final row = _ItemRow(
|
||||
productId: item.productId,
|
||||
productCode: item.productCode,
|
||||
productName: item.productName,
|
||||
@@ -272,7 +276,11 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
spec: item.spec,
|
||||
costPrice: item.costPrice,
|
||||
availableQty: item.availableQty,
|
||||
));
|
||||
salePrice: item.salePrice, // 售价默认带出入库时填的参考售价
|
||||
);
|
||||
// 数量默认带出可用数量(整箱出为主,改少比补多顺手)
|
||||
row.qtyCtrl.text = item.availableQty.toStringAsFixed(0);
|
||||
_items.add(row);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -532,6 +532,17 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
ref.read(stockOutListProvider.notifier).setStatus('pending');
|
||||
},
|
||||
),
|
||||
DsKpi(
|
||||
title: '草稿单数 · 点击筛选',
|
||||
value: '${summary?.draftCount ?? 0}',
|
||||
icon: LucideIcons.filePen,
|
||||
tone: DsKpiTone.warn, // 暗黄(用户拍板)
|
||||
delta: (summary?.draftCount ?? 0) > 0 ? '待提交审核' : '点击筛选',
|
||||
onTap: () {
|
||||
setState(() => _statusFilter = 'draft');
|
||||
ref.read(stockOutListProvider.notifier).setStatus('draft');
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
final mobile = context.isMobile;
|
||||
@@ -845,6 +856,8 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
|
||||
static final _money =
|
||||
NumberFormat.currency(locale: 'zh_CN', symbol: '¥', decimalDigits: 0);
|
||||
// 明细行内数字(去 ¥:列多时更紧凑,符号只留在合计)
|
||||
static final _num = NumberFormat('#,##0');
|
||||
static String _fmtQty(double q) =>
|
||||
q == q.roundToDouble() ? q.toStringAsFixed(0) : q.toString();
|
||||
|
||||
@@ -885,10 +898,10 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
series: it.productSeries ?? '—',
|
||||
spec: it.productSpec ?? '',
|
||||
qty: _fmtQty(it.quantity),
|
||||
price: pending ? '待定价' : _money.format(it.salePrice),
|
||||
amount: pending ? '待定价' : _money.format(it.saleAmount),
|
||||
cost: admin ? _money.format(it.costPrice) : null,
|
||||
profit: admin ? (pending ? '待定价' : _money.format(profit)) : null,
|
||||
price: pending ? '待定价' : _num.format(it.salePrice),
|
||||
amount: pending ? '待定价' : _num.format(it.saleAmount),
|
||||
cost: admin ? _num.format(it.costPrice) : null,
|
||||
profit: admin ? (pending ? '待定价' : _num.format(profit)) : null,
|
||||
pending: pending,
|
||||
);
|
||||
}).toList(),
|
||||
|
||||
@@ -5,7 +5,7 @@ import '../../core/theme/app_dims.g.dart';
|
||||
import '../../core/theme/app_fonts.dart';
|
||||
|
||||
/// 图标块 .ic 变体(软底 + 前景色)。
|
||||
enum DsKpiTone { info, ok, blue, alert }
|
||||
enum DsKpiTone { info, ok, blue, alert, warn }
|
||||
|
||||
/// 环比方向 .d.up/.down(绿/红),neutral=纯文案(muted)。
|
||||
enum DsKpiDelta { up, down, neutral }
|
||||
@@ -41,6 +41,8 @@ class DsKpi extends StatelessWidget {
|
||||
DsKpiTone.ok => (t.okSoft, t.success),
|
||||
DsKpiTone.blue => (t.infoSoft, t.brand400),
|
||||
DsKpiTone.alert => (t.accentSoft, t.accent),
|
||||
// 暗黄(草稿卡):icon 与数字走 warn token
|
||||
DsKpiTone.warn => (t.warnBg, t.warn),
|
||||
};
|
||||
final deltaColor = switch (deltaTone) {
|
||||
DsKpiDelta.up => t.success,
|
||||
@@ -88,7 +90,11 @@ class DsKpi extends StatelessWidget {
|
||||
letterSpacing: 0.3,
|
||||
fontFamily: AppFonts.mono,
|
||||
fontFamilyFallback: AppFonts.monoFallback,
|
||||
color: tone == DsKpiTone.alert ? t.accent : t.heading)),
|
||||
color: switch (tone) {
|
||||
DsKpiTone.alert => t.accent,
|
||||
DsKpiTone.warn => t.warn,
|
||||
_ => t.heading,
|
||||
})),
|
||||
if (delta != null) ...[
|
||||
const SizedBox(height: 5),
|
||||
// 原型 .d 的箭头是文本字符 ▲/▼(非图标),gap4。
|
||||
|
||||
@@ -287,6 +287,9 @@ class _LinesTable extends StatelessWidget {
|
||||
: Text(amountLabel,
|
||||
textAlign: TextAlign.right, style: _hStyle(t)),
|
||||
c6: _withProfit
|
||||
? Text('总售价', textAlign: TextAlign.right, style: _hStyle(t))
|
||||
: null,
|
||||
c7: _withProfit
|
||||
? Text('利润', textAlign: TextAlign.right, style: _hStyle(t))
|
||||
: null,
|
||||
),
|
||||
@@ -344,6 +347,10 @@ class _LinesTable extends StatelessWidget {
|
||||
: _priceCell(context, lines[i].amount, lines[i].pending,
|
||||
accent: true),
|
||||
c6: _withProfit
|
||||
? _priceCell(context, lines[i].amount, lines[i].pending,
|
||||
accent: true)
|
||||
: null,
|
||||
c7: _withProfit
|
||||
? _profitCell(
|
||||
context, lines[i].profit ?? '—', lines[i].pending)
|
||||
: null,
|
||||
@@ -377,31 +384,38 @@ class _LinesTable extends StatelessWidget {
|
||||
color: accent ? t.text : t.text));
|
||||
}
|
||||
|
||||
// 5 列布局(对齐原型 grid 1fr 124 40 64 78);c6 非空时为出库 6 列形态
|
||||
// (数量/成本价/售价/利润,数值列等宽收窄)。
|
||||
// 5 列布局(对齐原型 grid 1fr 124 40 64 78);c6/c7 非空时为出库 7 列形态
|
||||
// (数量/成本价/售价/总售价/利润,数值列等宽收窄)。
|
||||
Widget _lineRow(BuildContext context,
|
||||
{required Widget c1,
|
||||
required Widget c2,
|
||||
required Widget c3,
|
||||
required Widget c4,
|
||||
required Widget c5,
|
||||
Widget? c6}) {
|
||||
final six = c6 != null;
|
||||
Widget? c6,
|
||||
Widget? c7}) {
|
||||
final wide = c6 != null;
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: c1),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(width: six ? 84 : 96, child: c2),
|
||||
// 5 列(入库)时中间列加宽左移:商品列不再吃掉全部余宽,
|
||||
// 「进价(单瓶)」表头一行放得下(2026-07-03 用户反馈)。
|
||||
SizedBox(width: wide ? 100 : 124, child: c2),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(width: 34, child: c3),
|
||||
SizedBox(width: wide ? 32 : 40, child: c3),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(width: six ? 56 : 60, child: c4),
|
||||
SizedBox(width: wide ? 62 : 88, child: c4),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(width: six ? 56 : 72, child: c5),
|
||||
if (six) ...[
|
||||
SizedBox(width: wide ? 62 : 88, child: c5),
|
||||
if (c6 != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(width: 56, child: c6),
|
||||
SizedBox(width: 62, child: c6),
|
||||
],
|
||||
if (c7 != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(width: 62, child: c7),
|
||||
],
|
||||
],
|
||||
);
|
||||
@@ -421,7 +435,8 @@ class _LinesTable extends StatelessWidget {
|
||||
return Text(text,
|
||||
textAlign: TextAlign.right,
|
||||
style: TextStyle(
|
||||
fontSize: AppDims.fsBody,
|
||||
// 明细数值列缩小一号(2026-07-03 用户反馈:列多时拥挤)
|
||||
fontSize: AppDims.fsSm,
|
||||
fontFamily: AppFonts.mono,
|
||||
fontFamilyFallback: AppFonts.monoFallback,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
@@ -326,9 +326,9 @@ class _ProductEditorDrawerState extends ConsumerState<_ProductEditorDrawer> {
|
||||
));
|
||||
}
|
||||
final cost = widget.cost ?? p.purchasePrice;
|
||||
if (cost != null && cost > 0) rows.add(('成本价', b(_fmtMoney(cost))));
|
||||
if (cost != null && cost > 0) rows.add(('成本价(单瓶)', b(_fmtMoney(cost))));
|
||||
if (widget.qty != null && cost != null && cost > 0) {
|
||||
rows.add(('库存货值', b(_fmtMoney(widget.qty! * cost))));
|
||||
rows.add(('总成本价', b(_fmtMoney(widget.qty! * cost))));
|
||||
}
|
||||
if ((widget.status ?? '').isNotEmpty) {
|
||||
rows.add((
|
||||
|
||||
|
Before Width: | Height: | Size: 423 KiB After Width: | Height: | Size: 420 KiB |
|
Before Width: | Height: | Size: 416 KiB After Width: | Height: | Size: 414 KiB |
|
Before Width: | Height: | Size: 424 KiB After Width: | Height: | Size: 422 KiB |
|
Before Width: | Height: | Size: 301 KiB After Width: | Height: | Size: 301 KiB |
|
Before Width: | Height: | Size: 296 KiB After Width: | Height: | Size: 296 KiB |
|
Before Width: | Height: | Size: 302 KiB After Width: | Height: | Size: 302 KiB |
|
Before Width: | Height: | Size: 291 KiB After Width: | Height: | Size: 294 KiB |
|
Before Width: | Height: | Size: 287 KiB After Width: | Height: | Size: 289 KiB |
|
Before Width: | Height: | Size: 292 KiB After Width: | Height: | Size: 295 KiB |
|
Before Width: | Height: | Size: 434 KiB After Width: | Height: | Size: 438 KiB |
|
Before Width: | Height: | Size: 423 KiB After Width: | Height: | Size: 426 KiB |
|
Before Width: | Height: | Size: 435 KiB After Width: | Height: | Size: 439 KiB |
|
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 402 KiB |
|
Before Width: | Height: | Size: 388 KiB After Width: | Height: | Size: 392 KiB |
|
Before Width: | Height: | Size: 401 KiB After Width: | Height: | Size: 404 KiB |
|
Before Width: | Height: | Size: 398 KiB After Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 388 KiB After Width: | Height: | Size: 388 KiB |
|
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 401 KiB |
@@ -19,6 +19,7 @@ void main() {
|
||||
spec: '500ml*6/件',
|
||||
qty: '2',
|
||||
price: '¥400.00',
|
||||
amount: '¥800.00',
|
||||
cost: '¥355.00',
|
||||
profit: '¥90.00',
|
||||
);
|
||||
@@ -47,6 +48,8 @@ void main() {
|
||||
)));
|
||||
expect(find.text('成本价'), findsOneWidget);
|
||||
expect(find.text('售价'), findsOneWidget);
|
||||
expect(find.text('总售价'), findsOneWidget);
|
||||
expect(find.text('¥800.00'), findsNWidgets(2)); // 行总售价 + 合计金额
|
||||
expect(find.text('利润'), findsOneWidget);
|
||||
expect(find.text('¥355.00'), findsOneWidget);
|
||||
expect(find.text('¥90.00'), findsNWidgets(2)); // 行利润 + 合计利润
|
||||
|
||||