// ZSB-AIMATCHUI-20261128 AI识别本店商品→收银加商品
(function(){
function zsbAiMatchUI(){
try{
var row=document.getElementById('aiCamShot'); if(!row) return;
if(document.getElementById('aiMatchBtn')) return;
var b=document.createElement('button'); b.id='aiMatchBtn'; b.className='btn btn-p'; b.style.cssText='margin-left:8px;padding:9px 16px';
b.innerHTML='🛒 识别本店商品';
b.onclick=function(){ shot(function(dataUrl){ zsbAiMatchStore(dataUrl); }); };
row.parentNode.insertBefore(b,row.nextSibling);
var box=document.createElement('div'); box.id='aiMatchResult'; box.style.cssText='margin-top:12px';
row.parentNode.insertBefore(box,b.nextSibling);
}catch(e){}
}
window.zsbAiMatchStore=function(dataUrl){
var box=document.getElementById('aiMatchResult'); if(box) box.innerHTML='
🔍 AI 正在识别本店商品…
';
call('/ai/match-store-product','POST',{store_id:(window.user&&user.store_id)||0,image:dataUrl}).then(function(r){
var d=(r&&r.data)||{}; var matched=d.matched||[];
if(!box) return;
if(!matched.length){ box.innerHTML='