import{d as e,o as t,r as a,j as o,v as n,b as s,c as l,w as c,k as r,m as i,h as p,q as u,A as d,i as f}from"./index-BmnJ93Po.js";import{_ as m}from"./cshaptx4869-scancode.B3yK47M6.js";import{r as v}from"./uni-app.es.C4qf4Coy.js";import{a as x,g as h}from"./index.BXTZ2GXu.js";import{s as g}from"./function-call.BxuSyXbr.js";import"./_plugin-vue_export-helper.BCo6x5W8.js";const w=e({__name:"w-scanCode",setup(e){t((()=>{}));const w=()=>{window.history.back()},y=()=>{b()},T=a(!1);function b(){T.value=!0}const F=a(),j=a();function z(e){T.value=!1,j.value?(F.value=e,x("/rawFabric/sign",{barcode:F.value,location:j.value},{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}).then((e=>{if(7778===e.code){let t=JSON.parse(e.msg),a=`\n\t\t\t\t\t<p>面料编号为<span style="color:red;font-size:18px">${F.value}</span>的<span style="color:red;font-size:18px">${t.category}</span>已放置在<span style="color:red;font-size:18px">${t.location}</span>，是否将面料移动到<span style="color:red;font-size:18px">${j.value}</span>？</p>\n\t\t\t  `;g({message:a,allowHtml:!0,confirmButtonText:"确认"}).then((()=>{x("/rawFabric/sign",{barcode:F.value,location:j.value,force:!0},{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}).then((e=>{200===e.code?u("入货架成功！"):u(e.msg)}))})).catch((()=>{j.value="",F.value=""}))}else if(7777===e.code){let t=JSON.parse(e.msg),a=`\n\t\t\t\t\t<p>面料编号为<span style="color:red;font-size:18px">${F.value}</span>的<span style="color:red;font-size:18px">${t.category}</span>被暂存在检验室，是否确认移动到<span style="color:red;font-size:18px">${j.value}</span>？</p>\n\t\t\t  `;g({message:a,allowHtml:!0,confirmButtonText:"确认"}).then((()=>{x("/rawFabric/sign",{barcode:F.value,location:j.value,force:!0},{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}).then((e=>{200===e.code?u("入货架成功！"):u(e.msg)}))})).catch((()=>{j.value="",F.value=""}))}else 200===e.code?g({title:"扫码成功，请扫描面料编号",message:"货架号："+j.value,confirmButtonText:"扫一扫"}).then((()=>{b()})).catch((()=>{j.value="",F.value=""})):u(e.msg)}))):h("/shelves/isActive?code="+e).then((t=>{200===t.code&&(t.data?(j.value=e,g({title:"扫码成功，请扫描面料编号",message:"货架号："+j.value,confirmButtonText:"扫一扫"}).then((()=>{b()})).catch((()=>{j.value="",F.value=""}))):u("该库位码已被禁用，请联系管理员"))}))}function C(e){d({title:e.errName,content:e.errMsg,complete:()=>{T.value=!1}})}function $(){T.value=!1}return(e,t)=>{const a=o("van-nav-bar"),u=f,d=v(n("cshaptx4869-scancode"),m);return s(),l(u,null,{default:c((()=>[r(a,{title:"扫码入库","left-text":"返回","left-arrow":"","right-text":"扫一扫",onClickLeft:w,onClickRight:y}),r(u,{style:{"text-align":"center","margin-top":"20px"}},{default:c((()=>[i("请扫描库位码")])),_:1}),T.value?(s(),l(d,{key:0,onSuccess:z,onFail:C,onClose:$})):p("",!0)])),_:1})}}});export{w as default};
