Index-c70026fe.js 9.5 KB

1
  1. import{w as z,I as M}from"./index-c1f44820.js";import{s as U,a as w,O as H}from"./index-e6307542.js";import{s as J,a as C,Q as K,S as W}from"./index-09713ec8.js";import{B as X,L as Y}from"./index-8c362873.js";import{S as Z}from"./index-1f15f5f3.js";import{C as ee}from"./index-9c8f373e.js";import{C as te}from"./index-b8adef18.js";import{d as oe,r as y,n as S,o as se,a as ne,b as r,e as _,f as e,c,t as a,F as j,k as le,q as ie,h,w as ae,v as de,u as ce,s as re,l as v,p as pe,j as _e,_ as ue}from"./index-ebd06049.js";import{p as I}from"./request-90084a8d.js";import"./use-expose-cd5a8a20.js";import"./use-placeholder-efd5789a.js";import"./interceptor-77f719a0.js";z(U);z(J);const s=f=>(pe("data-v-1d96855a"),f=f(),_e(),f),he={style:{display:"flex","flex-direction":"column",height:"100vh"}},ge={style:{"border-bottom":"1px solid #eee",padding:"20px 16px 10px 16px"}},ye={style:{opacity:"0.5"}},fe=s(()=>e("span",{style:{"margin-left":"6px"}},"姓 名: ",-1)),me={key:0,style:{color:"red"}},ve={key:1},xe=s(()=>e("span",{style:{"margin-left":"6px"}},"手机号: ",-1)),be={key:0,style:{color:"red"}},we={key:1},ke=s(()=>e("div",{style:{height:"10px"}},null,-1)),Ce={style:{"flex-grow":"1","overflow-y":"auto"}},Se={key:0},je={style:{color:"#aaa",display:"flex","align-items":"center","justify-content":"center",padding:"40px 0px 0px 0px"}},Ie=s(()=>e("span",{style:{"margin-left":"6px"}},"暂无扫码结果",-1)),ze={key:1,class:"scanlist"},Re={style:{"text-align":"left"}},Ne={style:{display:"flex","flex-direction":"column","justify-content":"space-between","flex-grow":"1","overflow-x":"hidden","word-break":"break-all"}},Ae={style:{width:"100%"}},Ve={style:{display:"flex","justify-content":"space-between"}},Be={style:{"font-size":"16px",color:"#000","font-weight":"bold"}},De={style:{"font-size":"16px"}},Te={style:{display:"flex","justify-content":"space-between"}},Oe={style:{color:"blue"}},qe={style:{"margin-left":"3px","font-weight":"bold"}},Le=["onClick"],Qe=s(()=>e("div",null,"删除",-1)),Fe=[Qe],Pe=s(()=>e("div",{style:{height:"0px"}},null,-1)),$e={key:0,style:{"border-top":"1px solid #eee",padding:"10px 16px"}},Ee={style:{padding:"0px 16px",display:"flex","justify-content":"flex-end","align-items":"center"}},Ge=s(()=>e("div",null,[e("span",{style:{"margin-left":"3px"}},"总计:")],-1)),Me={style:{display:"inline-block","text-align":"right","margin-left":"6px",color:"red","font-size":"24px","font-weight":"bold"}},Ue=s(()=>e("div",{style:{height:"0px"}},null,-1)),He={style:{padding:"0px 16px"}},Je=s(()=>e("div",{style:{height:"10px"}},null,-1)),Ke=s(()=>e("div",{style:{height:"10px"}},null,-1)),We={style:{position:"absolute",width:"100vw",height:"100vh",top:"0",left:"0","z-index":"99","background-color":"#ccc"}},Xe={style:{height:"100%",width:"100%",display:"flex","align-items":"center","justify-content":"center"}},Ye={style:{height:"60%",width:"80%","background-color":"#ffffff",display:"flex","flex-direction":"column"}},Ze=s(()=>e("div",{style:{height:"16px"}},null,-1)),et={style:{"flex-grow":"1","overflow-y":"auto","word-break":"break-all",padding:"10px 16px 16px 16px"}},tt={style:{"padding-right":"16px"}},ot=s(()=>e("span",{style:{"font-weight":"bold"}},"扫描结果: ",-1)),st={key:0,style:{display:"flex","align-items":"center","justify-content":"center","margin-top":"30px"}},nt=s(()=>e("div",{style:{"margin-right":"6px"}},[e("span",{style:{}},"农药信息加载中")],-1)),lt={key:1},it={style:{"margin-top":"10px"}},at=s(()=>e("span",{style:{"font-weight":"bold"}},"单元识别码: ",-1)),dt={style:{"margin-top":"10px"}},ct=s(()=>e("span",{style:{"font-weight":"bold"}},"登记证号: ",-1)),rt={style:{"margin-top":"10px"}},pt=s(()=>e("span",{style:{"font-weight":"bold"}},"农药名称: ",-1)),_t={style:{"margin-top":"10px"}},ut=s(()=>e("span",{style:{"font-weight":"bold"}},"农药类别: ",-1)),ht={style:{"margin-top":"10px"}},gt=s(()=>e("span",{style:{"font-weight":"bold"}},"剂型: ",-1)),yt={style:{"margin-top":"10px"}},ft=s(()=>e("span",{style:{"font-weight":"bold"}},"总含量: ",-1)),mt={style:{"margin-top":"10px"}},vt=s(()=>e("span",{style:{"font-weight":"bold"}},"有效期至: ",-1)),xt={style:{"margin-top":"10px"}},bt=s(()=>e("span",{style:{"font-weight":"bold"}},"登记证持有人: ",-1)),wt=s(()=>e("div",{style:{height:"10px"}},null,-1)),kt={style:{"border-top":"1px solid #eee","border-bottom":"1px solid #eee",padding:"8px 0px 6px 0px"}},Ct={style:{display:"flex","align-items":"center","justify-content":"flex-end"}},St=s(()=>e("div",{style:{margin:"0px 10px 0px 16px"}},[e("span",{style:{color:"red"}},"*"),e("span",null,"  数量:")],-1)),jt={style:{"padding-right":"16px"}},It=s(()=>e("div",{style:{height:"20px"}},null,-1)),zt={style:{padding:"0px 16px"}},Rt=s(()=>e("div",{style:{height:"10px"}},null,-1)),Nt=s(()=>e("div",{style:{height:"10px"}},null,-1)),At=oe({__name:"Index",setup(f){const x=ce(),b=y(!1),k=y(),p=S({isAnonymous:!0,name:"",mobile:""}),i=y([]),g=y(!1),R=y(!1),l=S({scan_result:"",registCode:"",register:"",id:"",physicType:"",name:"",typeName:"",validDate:"",concent:"",amount:1});se(()=>{const o=x.currentRoute.value.query;p.isAnonymous=o.isAnonymous=="true",p.name=o.name,p.mobile=o.mobile,console.log(x.currentRoute.value.query)});const N=o=>{console.log("clickCell",o.id);let t=-1;for(let n=0;n<i.value.length;n++)if(i.value[n].id==o.id){t=n;break}console.log(t),t>=0&&(Object.assign(l,i.value[t]),g.value=!0)},A=o=>{console.log("deleteCell",o.id),C({message:"确定删除吗?"}).then(()=>{console.log(o.id);let t=-1;for(let n=0;n<i.value.length;n++)if(i.value[n].id==o.id){t=n;break}console.log(t),t>=0&&i.value.splice(t,1)},()=>{console.log("取消")})},V=()=>{console.log("clickScan"),b.value=!0,k.value.open()},B=()=>{console.log("submit"),console.log("提交");const o=[];for(let t=0;t<i.value.length;t++){const n=i.value[t],d={};d.info=n.scan_result,d.num=n.amount,d.pesticideName=n.name,d.pesticideRegistCode=n.registCode,d.clientName=p.name,d.clientPhone=p.mobile,d.realnameFlag=p.isAnonymous?0:1,o[t]=d}if(console.log(o),o.length==0){w("列表不能为空");return}C({message:"确定提交吗?"}).then(()=>{I("/saleRecord/batchAddRecord",o).then(({data:t})=>{console.log(t),t.code==0?(w("提交成功"),setTimeout(()=>{x.push("/")},500)):w(t.msg)})},()=>{console.log("取消")})},D=ne(()=>{let o=0;for(let t=0;t<i.value.length;t++)o+=i.value[t].amount;return o}),T=o=>{b.value=!1,console.log(o),l.scan_result=o.decodedText,O(l.scan_result)},O=o=>{I("/pesticide/getPesticideInfo",{scanResult:o}).then(({data:t})=>{if(console.log(t),t.code==0){const n=t.data;Object.assign(l,n),g.value=!0,l.amount=1;return}})},q=()=>{console.log("取消"),g.value=!1},L=o=>{console.log("添加",l),console.log(o);let t=-1;for(let d=0;d<i.value.length;d++)if(i.value[d].id==l.id){t=d;break}const n=Object.assign({},l);t>=0?i.value[t]=n:i.value.push(n),console.log(i.value),g.value=!1};return(o,t)=>{const n=M,d=te,Q=ee,F=Z,m=X,P=Y,$=W,E=H;return r(),_(j,null,[e("div",he,[e("div",ge,[e("div",ye,[e("div",null,[c(n,{name:"user-o"}),fe,p.isAnonymous?(r(),_("span",me,"匿名")):(r(),_("span",ve,a(p.name),1))]),e("div",null,[c(n,{name:"phone-o"}),xe,p.isAnonymous?(r(),_("span",be,"匿名")):(r(),_("span",we,a(p.mobile),1))])])]),ke,e("div",Ce,[i.value.length==0?(r(),_("div",Se,[e("div",je,[c(n,{name:"warning-o",size:"20"}),Ie])])):(r(),_("div",ze,[(r(!0),_(j,null,le(i.value,u=>(r(),re(F,{name:u.id,"right-width":"65"},{right:h(()=>[e("div",{style:{"background-color":"red",height:"100%",width:"65px",color:"#ffffff",display:"flex","align-items":"center","justify-content":"center"},onClick:G=>A(u)},Fe,8,Le)]),default:h(()=>[c(Q,{border:!1},{default:h(()=>[c(d,{onClick:G=>N(u)},{default:h(()=>[e("div",Re,[e("div",Ne,[e("div",Ae,[e("div",Ve,[e("div",Be,a(u.name),1),e("div",De,a(u.typeName),1)]),e("div",null,a(u.register),1)]),e("div",Te,[e("div",null,a(u.registCode),1),e("div",Oe,[c(n,{name:"cross",size:"10"}),e("span",qe,a(u.amount),1)])])])])]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1032,["name"]))),256))]))]),Pe,i.value.length>0?(r(),_("div",$e,[e("div",Ee,[Ge,e("span",Me,a(D.value),1)])])):ie("",!0),Ue,e("div",He,[c(m,{color:"#4fc08d",type:"primary",round:"",block:"",size:"large",icon:"scan",onClick:V},{default:h(()=>[v("扫描二维码")]),_:1}),Je,c(m,{type:"primary",round:"",block:"",size:"large",icon:"guide-o",onClick:B},{default:h(()=>[v("提交结果")]),_:1}),Ke])]),ae(e("div",We,[c(K,{ref_key:"scanQR",ref:k,onSuccess:T},null,512)],512),[[de,b.value]]),c(E,{"lock-scroll":!1,show:g.value},{default:h(()=>[e("div",Xe,[e("div",Ye,[Ze,e("div",et,[e("div",tt,[e("div",null,[ot,e("span",null,a(l.scan_result),1)]),R.value?(r(),_("div",st,[nt,e("div",null,[c(P,{type:"spinner",color:"#1989fa"})])])):(r(),_("div",lt,[e("div",it,[at,e("span",null,a(l.id),1)]),e("div",dt,[ct,e("span",null,a(l.registCode),1)]),e("div",rt,[pt,e("span",null,a(l.name),1)]),e("div",_t,[ut,e("span",null,a(l.typeName),1)]),e("div",ht,[gt,e("span",null,a(l.physicType),1)]),e("div",yt,[ft,e("span",null,a(l.concent),1)]),e("div",mt,[vt,e("span",null,a(l.validDate),1)]),e("div",xt,[bt,e("span",null,a(l.register),1)])]))])]),wt,e("div",kt,[e("div",Ct,[St,e("div",jt,[c($,{integer:"",modelValue:l.amount,"onUpdate:modelValue":t[0]||(t[0]=u=>l.amount=u),"input-width":"60px",theme:"round",disabled:p.isAnonymous},null,8,["modelValue","disabled"])])])]),It,e("div",zt,[c(m,{color:"#e87f5e",type:"danger",round:"",block:"",size:"normal",icon:"close",onClick:q},{default:h(()=>[v("取消")]),_:1}),Rt,c(m,{color:"#4fc08d",type:"primary",round:"",block:"",size:"normal",icon:"passed",onClick:L},{default:h(()=>[v("添加")]),_:1}),Nt])])])]),_:1},8,["show"])],64)}}});const Gt=ue(At,[["__scopeId","data-v-1d96855a"]]);export{Gt as default};