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 f,i as m}from"./index-Dl2paGRZ.js";import{_ as v}from"./cshaptx4869-scancode.BpIQd1Cm.js";import{r as d}from"./uni-app.es.Cu9bI3cZ.js";import{a as x}from"./index.BU3LPdeb.js";import{s as h}from"./function-call.BYfep2P6.js";import"./_plugin-vue_export-helper.BCo6x5W8.js";const g=e({__name:"w-scanCode",setup(e){t((()=>{}));const g=()=>{window.history.back()},w=()=>{T()},y=a(!1);function T(){y.value=!0}const b=a(),C=a();function j(e){y.value=!1,C.value?(b.value=e,x("/rawFabric/sign",{barcode:b.value,location:C.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

面料编号为${b.value}${t.category}已放置在${t.location},是否将面料移动到${C.value}

\n\t\t\t `;h({message:a,allowHtml:!0,confirmButtonText:"确认"}).then((()=>{x("/rawFabric/sign",{barcode:b.value,location:C.value,force:!0},{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}).then((e=>{200===e.code?u("入货架成功!"):u(e.msg)}))})).catch((()=>{C.value="",b.value=""}))}else if(7777===e.code){let t=JSON.parse(e.msg),a=`\n\t\t\t\t\t

面料编号为${b.value}${t.category}被暂存在检验室,是否确认移动到${C.value}

\n\t\t\t `;h({message:a,allowHtml:!0,confirmButtonText:"确认"}).then((()=>{x("/rawFabric/sign",{barcode:b.value,location:C.value,force:!0},{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}).then((e=>{200===e.code?u("入货架成功!"):u(e.msg)}))})).catch((()=>{C.value="",b.value=""}))}else 200===e.code?h({title:"扫码成功,请扫描面料编号",message:"货架号:"+C.value,confirmButtonText:"扫一扫"}).then((()=>{T()})).catch((()=>{C.value="",b.value=""})):u(e.msg)}))):(C.value=e,h({title:"扫码成功,请扫描面料编号",message:"货架号:"+C.value,confirmButtonText:"扫一扫"}).then((()=>{T()})).catch((()=>{C.value="",b.value=""})))}function z(e){f({title:e.errName,content:e.errMsg,complete:()=>{y.value=!1}})}function F(){y.value=!1}return(e,t)=>{const a=o("van-nav-bar"),u=m,f=d(n("cshaptx4869-scancode"),v);return s(),l(u,null,{default:c((()=>[r(a,{title:"扫码入库","left-text":"返回","left-arrow":"","right-text":"扫一扫",onClickLeft:g,onClickRight:w}),r(u,{style:{"text-align":"center","margin-top":"20px"}},{default:c((()=>[i("请扫描库位码")])),_:1}),y.value?(s(),l(f,{key:0,onSuccess:j,onFail:z,onClose:F})):p("",!0)])),_:1})}}});export{g as default};