| 1 |
- import{d as G,r as m,D as C,o as M,a as U,b as _,e,c,x as a,F as S,z as H,C as J,f as h,h as K,v as W,u as X,j as r,k as Y,B as v,p as Z,n as ee,_ as te}from"./index-77a68c60.js";import{s as oe,a as j,Q as se,S as ne}from"./index-c4c6dcd2.js";import{B as le}from"./index-5cdb322d.js";import{S as ie}from"./index-4f775051.js";import{C as ae}from"./index-bfd10f53.js";import{C as de}from"./index-e11de4ce.js";import{p as I}from"./request-5f6e7126.js";import{w as ce,I as re}from"./index-87dc5ea8.js";import{O as pe}from"./index-9acba25b.js";import{s as w}from"./function-call-a5c0fdd2.js";import{L as _e}from"./index-91a16a63.js";import"./mount-component-b9b13576.js";import"./use-scope-id-c03bf1c4.js";import"./use-placeholder-35f96da5.js";import"./on-popup-reopen-9aaf85c5.js";import"./use-route-4db0608a.js";import"./constant-eba5e2d8.js";import"./axios-9cbf0d09.js";ce(oe);const s=y=>(Z("data-v-1d96855a"),y=y(),ee(),y),ue={style:{display:"flex","flex-direction":"column",height:"100vh"}},he={style:{"border-bottom":"1px solid #eee",padding:"20px 16px 10px 16px"}},ge={style:{opacity:"0.5"}},me=s(()=>e("span",{style:{"margin-left":"6px"}},"姓 名: ",-1)),ye={key:0,style:{color:"red"}},fe={key:1},ve=s(()=>e("span",{style:{"margin-left":"6px"}},"手机号: ",-1)),xe={key:0,style:{color:"red"}},be={key:1},we=s(()=>e("div",{style:{height:"10px"}},null,-1)),ke={style:{"flex-grow":"1","overflow-y":"auto"}},Ce={key:0},Se={style:{color:"#aaa",display:"flex","align-items":"center","justify-content":"center",padding:"40px 0px 0px 0px"}},je=s(()=>e("span",{style:{"margin-left":"6px"}},"暂无扫码结果",-1)),Ie={key:1,class:"scanlist"},ze={style:{"text-align":"left"}},Re={style:{display:"flex","flex-direction":"column","justify-content":"space-between","flex-grow":"1","overflow-x":"hidden","word-break":"break-all"}},Ne={style:{width:"100%"}},Ae={style:{display:"flex","justify-content":"space-between"}},Be={style:{"font-size":"16px",color:"#000","font-weight":"bold"}},De={style:{"font-size":"16px"}},Ve={style:{display:"flex","justify-content":"space-between"}},Te={style:{color:"blue"}},Oe={style:{"margin-left":"3px","font-weight":"bold"}},Le=["onClick"],Qe=s(()=>e("div",null,"删除",-1)),qe=[Qe],Fe=s(()=>e("div",{style:{height:"0px"}},null,-1)),Pe={key:0,style:{"border-top":"1px solid #eee",padding:"10px 16px"}},$e={style:{padding:"0px 16px",display:"flex","justify-content":"flex-end","align-items":"center"}},Ee=s(()=>e("div",null,[e("span",{style:{"margin-left":"3px"}},"总计:")],-1)),Ge={style:{display:"inline-block","text-align":"right","margin-left":"6px",color:"red","font-size":"24px","font-weight":"bold"}},Me=s(()=>e("div",{style:{height:"0px"}},null,-1)),Ue={style:{padding:"0px 16px"}},He=s(()=>e("div",{style:{height:"10px"}},null,-1)),Je=s(()=>e("div",{style:{height:"10px"}},null,-1)),Ke={style:{position:"absolute",width:"100vw",height:"100vh",top:"0",left:"0","z-index":"99","background-color":"#ccc"}},We={style:{height:"100%",width:"100%",display:"flex","align-items":"center","justify-content":"center"}},Xe={style:{height:"60%",width:"80%","background-color":"#ffffff",display:"flex","flex-direction":"column"}},Ye=s(()=>e("div",{style:{height:"16px"}},null,-1)),Ze={style:{"flex-grow":"1","overflow-y":"auto","word-break":"break-all",padding:"10px 16px 16px 16px"}},et={style:{"padding-right":"16px"}},tt=s(()=>e("span",{style:{"font-weight":"bold"}},"扫描结果: ",-1)),ot={key:0,style:{display:"flex","align-items":"center","justify-content":"center","margin-top":"30px"}},st=s(()=>e("div",{style:{"margin-right":"6px"}},[e("span",{style:{}},"农药信息加载中")],-1)),nt={key:1},lt={style:{"margin-top":"10px"}},it=s(()=>e("span",{style:{"font-weight":"bold"}},"单元识别码: ",-1)),at={style:{"margin-top":"10px"}},dt=s(()=>e("span",{style:{"font-weight":"bold"}},"登记证号: ",-1)),ct={style:{"margin-top":"10px"}},rt=s(()=>e("span",{style:{"font-weight":"bold"}},"农药名称: ",-1)),pt={style:{"margin-top":"10px"}},_t=s(()=>e("span",{style:{"font-weight":"bold"}},"农药类别: ",-1)),ut={style:{"margin-top":"10px"}},ht=s(()=>e("span",{style:{"font-weight":"bold"}},"剂型: ",-1)),gt={style:{"margin-top":"10px"}},mt=s(()=>e("span",{style:{"font-weight":"bold"}},"总含量: ",-1)),yt={style:{"margin-top":"10px"}},ft=s(()=>e("span",{style:{"font-weight":"bold"}},"有效期至: ",-1)),vt={style:{"margin-top":"10px"}},xt=s(()=>e("span",{style:{"font-weight":"bold"}},"登记证持有人: ",-1)),bt=s(()=>e("div",{style:{height:"10px"}},null,-1)),wt={style:{"border-top":"1px solid #eee","border-bottom":"1px solid #eee",padding:"8px 0px 6px 0px"}},kt={style:{display:"flex","align-items":"center","justify-content":"flex-end"}},Ct=s(()=>e("div",{style:{margin:"0px 10px 0px 16px"}},[e("span",{style:{color:"red"}},"*"),e("span",null," 数量:")],-1)),St={style:{"padding-right":"16px"}},jt=s(()=>e("div",{style:{height:"20px"}},null,-1)),It={style:{padding:"0px 16px"}},zt=s(()=>e("div",{style:{height:"10px"}},null,-1)),Rt=s(()=>e("div",{style:{height:"10px"}},null,-1)),Nt=G({__name:"Index",setup(y){const x=X(),b=m(!1),k=m(),p=C({isAnonymous:!0,name:"",mobile:""}),i=m([]),g=m(!1),z=m(!1),l=C({scan_result:"",registCode:"",register:"",id:"",physicType:"",name:"",typeName:"",validDate:"",concent:"",amount:1});M(()=>{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 R=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)},N=o=>{console.log("deleteCell",o.id),j({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("取消")})},A=()=>{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}j({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=U(()=>{let o=0;for(let t=0;t<i.value.length;t++)o+=i.value[t].amount;return o}),V=o=>{b.value=!1,console.log(o),l.scan_result=o.decodedText,T(l.scan_result)},T=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}})},O=()=>{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=re,d=de,Q=ae,q=ie,f=le,F=_e,P=ne,$=pe;return r(),_(S,null,[e("div",ue,[e("div",he,[e("div",ge,[e("div",null,[c(n,{name:"user-o"}),me,p.isAnonymous?(r(),_("span",ye,"匿名")):(r(),_("span",fe,a(p.name),1))]),e("div",null,[c(n,{name:"phone-o"}),ve,p.isAnonymous?(r(),_("span",xe,"匿名")):(r(),_("span",be,a(p.mobile),1))])])]),we,e("div",ke,[i.value.length==0?(r(),_("div",Ce,[e("div",Se,[c(n,{name:"warning-o",size:"20"}),je])])):(r(),_("div",Ie,[(r(!0),_(S,null,H(i.value,u=>(r(),Y(q,{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:E=>N(u)},qe,8,Le)]),default:h(()=>[c(Q,{border:!1},{default:h(()=>[c(d,{onClick:E=>R(u)},{default:h(()=>[e("div",ze,[e("div",Re,[e("div",Ne,[e("div",Ae,[e("div",Be,a(u.name),1),e("div",De,a(u.typeName),1)]),e("div",null,a(u.register),1)]),e("div",Ve,[e("div",null,a(u.registCode),1),e("div",Te,[c(n,{name:"cross",size:"10"}),e("span",Oe,a(u.amount),1)])])])])]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1032,["name"]))),256))]))]),Fe,i.value.length>0?(r(),_("div",Pe,[e("div",$e,[Ee,e("span",Ge,a(D.value),1)])])):J("",!0),Me,e("div",Ue,[c(f,{color:"#4fc08d",type:"primary",round:"",block:"",size:"large",icon:"scan",onClick:A},{default:h(()=>[v("扫描二维码")]),_:1}),He,c(f,{type:"primary",round:"",block:"",size:"large",icon:"guide-o",onClick:B},{default:h(()=>[v("提交结果")]),_:1}),Je])]),K(e("div",Ke,[c(se,{ref_key:"scanQR",ref:k,onSuccess:V},null,512)],512),[[W,b.value]]),c($,{"lock-scroll":!1,show:g.value},{default:h(()=>[e("div",We,[e("div",Xe,[Ye,e("div",Ze,[e("div",et,[e("div",null,[tt,e("span",null,a(l.scan_result),1)]),z.value?(r(),_("div",ot,[st,e("div",null,[c(F,{type:"spinner",color:"#1989fa"})])])):(r(),_("div",nt,[e("div",lt,[it,e("span",null,a(l.id),1)]),e("div",at,[dt,e("span",null,a(l.registCode),1)]),e("div",ct,[rt,e("span",null,a(l.name),1)]),e("div",pt,[_t,e("span",null,a(l.typeName),1)]),e("div",ut,[ht,e("span",null,a(l.physicType),1)]),e("div",gt,[mt,e("span",null,a(l.concent),1)]),e("div",yt,[ft,e("span",null,a(l.validDate),1)]),e("div",vt,[xt,e("span",null,a(l.register),1)])]))])]),bt,e("div",wt,[e("div",kt,[Ct,e("div",St,[c(P,{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"])])])]),jt,e("div",It,[c(f,{color:"#e87f5e",type:"danger",round:"",block:"",size:"normal",icon:"close",onClick:O},{default:h(()=>[v("取消")]),_:1}),zt,c(f,{color:"#4fc08d",type:"primary",round:"",block:"",size:"normal",icon:"passed",onClick:L},{default:h(()=>[v("添加")]),_:1}),Rt])])])]),_:1},8,["show"])],64)}}});const Kt=te(Nt,[["__scopeId","data-v-1d96855a"]]);export{Kt as default};
|