import{d as t,o as e,r as a,j as n,x as o,b as s,c as l,w as c,k as r,m as i,t as p,h as u,q as d,B as f,i as v}from"./index-D2NElrYl.js";import{_ as m}from"./cshaptx4869-scancode.C5bz-F02.js";import{r as x}from"./uni-app.es.CyjALRV_.js";import{a as h,g as w}from"./index.Cv2D9Hyi.js";import{s as g}from"./function-call.DSHj1ZhI.js";import{_ as y}from"./_plugin-vue_export-helper.BCo6x5W8.js";const b=y(t({__name:"w-scanCode",setup(t){e((()=>{}));const y=()=>{window.history.back()},b=()=>{T()},_=a(!1);function T(){_.value=!0}const $=a(),z=a();function C(t){_.value=!1,z.value?($.value=t,h("/rawFabric/sign",{barcode:$.value,location:z.value},{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}).then((t=>{if(7778===t.code){let e=JSON.parse(t.msg);if(e.location==z.value)g({message:"该面料已放置在"+e.location+",请勿重复扫码",allowHtml:!0,confirmButtonText:"扫一扫"}).then((()=>{T()})).catch((()=>{z.value="",$.value=""}));else{let t=`\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t

面料编号:${$.value}

\n\t\t\t\t\t\t\t\t\t\t\t

面料名称:${e.category}

\n\t\t\t\t\t\t\t\t\t\t\t

面料位置:${e.location}

\n\t\t\t\t\t\t\t\t\t\t\t

是否将面料移动到${z.value}

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

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

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

面料编号:${$.value}

\n\t\t\t\t\t

面料名称:${t.data}

\n\t\t\t\t\t`;g({title:"扫码成功!",message:e,allowHtml:!0,confirmButtonText:"扫一扫"}).then((()=>{T()})).catch((()=>{z.value="",$.value=""}))}else d(t.msg)}))):w("/shelves/isActive?code="+t).then((e=>{if(200===e.code)if(e.data.active){z.value=t;let a="";e.data.recommend.forEach((t=>{a+=`\n\t\t\t\t\t\t\t
${t.fabricName}
\n\t\t\t\t\t\t\t`})),a+=`\n\t\t\t\t\t\t\t
货架号:${z.value}
\n\t\t\t\t\t\t`,g({title:"扫码成功,推荐放置面料",message:a,allowHtml:!0,confirmButtonText:"扫一扫"}).then((()=>{T()})).catch((()=>{z.value="",$.value=""}))}else d("该库位码已被禁用,请联系管理员")}))}function F(t){f({title:t.errName,content:t.errMsg,complete:()=>{_.value=!1}})}function j(){_.value=!1}return(t,e)=>{const a=n("van-nav-bar"),d=v,f=x(o("cshaptx4869-scancode"),m);return s(),l(d,{class:"flex"},{default:c((()=>[r(a,{title:"扫码入库","left-text":"返回","left-arrow":"",onClickLeft:y}),r(d,{class:"btn",onClick:b},{default:c((()=>[i("扫描库位码")])),_:1}),r(d,{style:{margin:"20rpx 50rpx"}},{default:c((()=>[i("当前库位码:"+p(z.value),1)])),_:1}),z.value?(s(),l(d,{key:0,class:"btn",onClick:T},{default:c((()=>[i("扫描面料编号")])),_:1})):u("",!0),_.value?(s(),l(f,{key:1,onSuccess:C,onFail:F,onClose:j})):u("",!0)])),_:1})}}}),[["__scopeId","data-v-f9422053"]]);export{b as default};