Index-f9613e47.js 9.8 KB

1
  1. import{d as $,r as y,n as w,o as E,a as G,b as u,e as t,c as a,t as i,F as k,x as M,C as U,f as g,h as H,v as J,u as K,j as r,k as W,s as v,_ as X}from"./index-ddf66cb5.js";import{Q as Y,S as Z}from"./Index-507c84bd.js";import{B as ee}from"./index-f37a4c38.js";import{S as te}from"./index-14ec4a94.js";import{C as oe}from"./index-75ca044f.js";import{C as se}from"./index-e270b3af.js";import{p as C}from"./request-cc2f9a2f.js";import{s as ne,a as j}from"./index-46890bc6.js";import{w as le,I as ie}from"./index-e9453d64.js";import{O as de}from"./index-c1d3cef3.js";import{s as h}from"./function-call-0875a39e.js";import{L as ae}from"./index-856231c7.js";import"./on-popup-reopen-8ab517b6.js";import"./use-route-0a2b7081.js";import"./use-scope-id-7611483c.js";import"./axios-1779699b.js";import"./mount-component-8daea98e.js";import"./use-placeholder-1196d982.js";le(ne);const re={style:{display:"flex","flex-direction":"column",height:"100vh"}},pe={style:{"border-bottom":"1px solid #eee",padding:"20px 16px 10px 16px"}},ue={style:{opacity:"0.5"}},ce={key:0,style:{color:"red"}},ge={key:1},me={key:0,style:{color:"red"}},ye={key:1},fe={style:{"flex-grow":"1","overflow-y":"auto"}},ve={key:0},xe={style:{color:"#aaa",display:"flex","align-items":"center","justify-content":"center",padding:"40px 0px 0px 0px"}},_e={key:1,class:"scanlist"},he={style:{"text-align":"left"}},be={style:{display:"flex","flex-direction":"column","justify-content":"space-between","flex-grow":"1","overflow-x":"hidden","word-break":"break-all"}},we={style:{width:"100%"}},ke={style:{display:"flex","justify-content":"space-between"}},Ce={style:{"font-size":"16px",color:"#000","font-weight":"bold"}},je={style:{"font-size":"16px"}},Se={style:{display:"flex","justify-content":"space-between"}},ze={style:{color:"blue"}},Ie={style:{"margin-left":"3px","font-weight":"bold"}},Re=["onClick"],Ne={key:0,style:{"border-top":"1px solid #eee",padding:"10px 16px"}},Ae={style:{padding:"0px 16px",display:"flex","justify-content":"flex-end","align-items":"center"}},Ve={style:{display:"inline-block","text-align":"right","margin-left":"6px",color:"red","font-size":"24px","font-weight":"bold"}},Be={style:{padding:"0px 16px"}},De={style:{position:"absolute",width:"100vw",height:"100vh",top:"0",left:"0","z-index":"99","background-color":"#ccc"}},Te={style:{height:"100%",width:"100%",display:"flex","align-items":"center","justify-content":"center"}},Oe={style:{height:"60%",width:"80%","background-color":"#ffffff",display:"flex","flex-direction":"column"}},Le={style:{"flex-grow":"1","overflow-y":"auto","word-break":"break-all",padding:"10px 16px 16px 16px"}},Qe={style:{"padding-right":"16px"}},qe={key:0,style:{display:"flex","align-items":"center","justify-content":"center","margin-top":"30px"}},Fe={key:1},Pe={style:{"margin-top":"10px"}},$e={style:{"margin-top":"10px"}},Ee={style:{"margin-top":"10px"}},Ge={style:{"margin-top":"10px"}},Me={style:{"margin-top":"10px"}},Ue={style:{"margin-top":"10px"}},He={style:{"margin-top":"10px"}},Je={style:{"margin-top":"10px"}},Ke={style:{"border-top":"1px solid #eee","border-bottom":"1px solid #eee",padding:"8px 0px 6px 0px"}},We={style:{display:"flex","align-items":"center","justify-content":"flex-end"}},Xe={style:{"padding-right":"16px"}},Ye={style:{padding:"0px 16px"}},Ze=$({__name:"Index",setup(et){const x=K(),_=y(!1),b=y(),p=w({isAnonymous:!0,name:"",mobile:""}),l=y([]),m=y(!1),S=y(!1),n=w({scan_result:"",registCode:"",register:"",id:"",physicType:"",name:"",typeName:"",validDate:"",concent:"",amount:1});E(()=>{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 z=o=>{console.log("clickCell",o.id);let e=-1;for(let s=0;s<l.value.length;s++)if(l.value[s].id==o.id){e=s;break}console.log(e),e>=0&&(Object.assign(n,l.value[e]),m.value=!0)},I=o=>{console.log("deleteCell",o.id),j({message:"确定删除吗?"}).then(()=>{console.log(o.id);let e=-1;for(let s=0;s<l.value.length;s++)if(l.value[s].id==o.id){e=s;break}console.log(e),e>=0&&l.value.splice(e,1)},()=>{console.log("取消")})},R=()=>{console.log("clickScan"),_.value=!0,b.value.open()},N=()=>{console.log("submit"),console.log("提交");const o=[];for(let e=0;e<l.value.length;e++){const s=l.value[e],d={};d.info=s.scan_result,d.num=s.amount,d.pesticideName=s.name,d.pesticideRegistCode=s.registCode,d.clientName=p.name,d.clientPhone=p.mobile,d.realnameFlag=p.isAnonymous?0:1,o[e]=d}if(console.log(o),o.length==0){h("列表不能为空");return}j({message:"确定提交吗?"}).then(()=>{C("/saleRecord/batchAddRecord",o).then(({data:e})=>{console.log(e),e.code==0?(h("提交成功"),setTimeout(()=>{x.push("/")},500)):h(e.msg)})},()=>{console.log("取消")})},A=G(()=>{let o=0;for(let e=0;e<l.value.length;e++)o+=l.value[e].amount;return o}),V=o=>{_.value=!1,console.log(o),n.scan_result=o.decodedText,B(n.scan_result)},B=o=>{C("/pesticide/getPesticideInfo",{scanResult:o}).then(({data:e})=>{if(console.log(e),e.code==0){const s=e.data;Object.assign(n,s),m.value=!0,n.amount=1;return}})},D=()=>{console.log("取消"),m.value=!1},T=o=>{console.log("添加",n),console.log(o);let e=-1;for(let d=0;d<l.value.length;d++)if(l.value[d].id==n.id){e=d;break}const s=Object.assign({},n);e>=0?l.value[e]=s:l.value.push(s),console.log(l.value),m.value=!1};return(o,e)=>{const s=ie,d=se,O=oe,L=te,f=ee,Q=ae,q=Z,F=de;return r(),u(k,null,[t("div",re,[t("div",pe,[t("div",ue,[t("div",null,[a(s,{name:"user-o"}),e[1]||(e[1]=t("span",{style:{"margin-left":"6px"}},"姓 名: ",-1)),p.isAnonymous?(r(),u("span",ce,"匿名")):(r(),u("span",ge,i(p.name),1))]),t("div",null,[a(s,{name:"phone-o"}),e[2]||(e[2]=t("span",{style:{"margin-left":"6px"}},"手机号: ",-1)),p.isAnonymous?(r(),u("span",me,"匿名")):(r(),u("span",ye,i(p.mobile),1))])])]),e[10]||(e[10]=t("div",{style:{height:"10px"}},null,-1)),t("div",fe,[l.value.length==0?(r(),u("div",ve,[t("div",xe,[a(s,{name:"warning-o",size:"20"}),e[3]||(e[3]=t("span",{style:{"margin-left":"6px"}},"暂无扫码结果",-1))])])):(r(),u("div",_e,[(r(!0),u(k,null,M(l.value,c=>(r(),W(L,{name:c.id,"right-width":"65"},{right:g(()=>[t("div",{style:{"background-color":"red",height:"100%",width:"65px",color:"#ffffff",display:"flex","align-items":"center","justify-content":"center"},onClick:P=>I(c)},e[4]||(e[4]=[t("div",null,"删除",-1)]),8,Re)]),default:g(()=>[a(O,{border:!1},{default:g(()=>[a(d,{onClick:P=>z(c)},{default:g(()=>[t("div",he,[t("div",be,[t("div",we,[t("div",ke,[t("div",Ce,i(c.name),1),t("div",je,i(c.typeName),1)]),t("div",null,i(c.register),1)]),t("div",Se,[t("div",null,i(c.registCode),1),t("div",ze,[a(s,{name:"cross",size:"10"}),t("span",Ie,i(c.amount),1)])])])])]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1032,["name"]))),256))]))]),e[11]||(e[11]=t("div",{style:{height:"0px"}},null,-1)),l.value.length>0?(r(),u("div",Ne,[t("div",Ae,[e[5]||(e[5]=t("div",null,[t("span",{style:{"margin-left":"3px"}},"总计:")],-1)),t("span",Ve,i(A.value),1)])])):U("",!0),e[12]||(e[12]=t("div",{style:{height:"0px"}},null,-1)),t("div",Be,[a(f,{color:"#4fc08d",type:"primary",round:"",block:"",size:"large",icon:"scan",onClick:R},{default:g(()=>e[6]||(e[6]=[v("扫描二维码")])),_:1}),e[8]||(e[8]=t("div",{style:{height:"10px"}},null,-1)),a(f,{type:"primary",round:"",block:"",size:"large",icon:"guide-o",onClick:N},{default:g(()=>e[7]||(e[7]=[v("提交结果")])),_:1}),e[9]||(e[9]=t("div",{style:{height:"10px"}},null,-1))])]),H(t("div",De,[a(Y,{ref_key:"scanQR",ref:b,onSuccess:V},null,512)],512),[[J,_.value]]),a(F,{"lock-scroll":!1,show:m.value},{default:g(()=>[t("div",Te,[t("div",Oe,[e[28]||(e[28]=t("div",{style:{height:"16px"}},null,-1)),t("div",Le,[t("div",Qe,[t("div",null,[e[13]||(e[13]=t("span",{style:{"font-weight":"bold"}},"扫描结果: ",-1)),t("span",null,i(n.scan_result),1)]),S.value?(r(),u("div",qe,[e[14]||(e[14]=t("div",{style:{"margin-right":"6px"}},[t("span",{style:{}},"农药信息加载中")],-1)),t("div",null,[a(Q,{type:"spinner",color:"#1989fa"})])])):(r(),u("div",Fe,[t("div",Pe,[e[15]||(e[15]=t("span",{style:{"font-weight":"bold"}},"单元识别码: ",-1)),t("span",null,i(n.id),1)]),t("div",$e,[e[16]||(e[16]=t("span",{style:{"font-weight":"bold"}},"登记证号: ",-1)),t("span",null,i(n.registCode),1)]),t("div",Ee,[e[17]||(e[17]=t("span",{style:{"font-weight":"bold"}},"农药名称: ",-1)),t("span",null,i(n.name),1)]),t("div",Ge,[e[18]||(e[18]=t("span",{style:{"font-weight":"bold"}},"农药类别: ",-1)),t("span",null,i(n.typeName),1)]),t("div",Me,[e[19]||(e[19]=t("span",{style:{"font-weight":"bold"}},"剂型: ",-1)),t("span",null,i(n.physicType),1)]),t("div",Ue,[e[20]||(e[20]=t("span",{style:{"font-weight":"bold"}},"总含量: ",-1)),t("span",null,i(n.concent),1)]),t("div",He,[e[21]||(e[21]=t("span",{style:{"font-weight":"bold"}},"有效期至: ",-1)),t("span",null,i(n.validDate),1)]),t("div",Je,[e[22]||(e[22]=t("span",{style:{"font-weight":"bold"}},"登记证持有人: ",-1)),t("span",null,i(n.register),1)])]))])]),e[29]||(e[29]=t("div",{style:{height:"10px"}},null,-1)),t("div",Ke,[t("div",We,[e[23]||(e[23]=t("div",{style:{margin:"0px 10px 0px 16px"}},[t("span",{style:{color:"red"}},"*"),t("span",null,"  数量:")],-1)),t("div",Xe,[a(q,{integer:"",modelValue:n.amount,"onUpdate:modelValue":e[0]||(e[0]=c=>n.amount=c),"input-width":"60px",theme:"round",disabled:p.isAnonymous},null,8,["modelValue","disabled"])])])]),e[30]||(e[30]=t("div",{style:{height:"20px"}},null,-1)),t("div",Ye,[a(f,{color:"#e87f5e",type:"danger",round:"",block:"",size:"normal",icon:"close",onClick:D},{default:g(()=>e[24]||(e[24]=[v("取消")])),_:1}),e[26]||(e[26]=t("div",{style:{height:"10px"}},null,-1)),a(f,{color:"#4fc08d",type:"primary",round:"",block:"",size:"normal",icon:"passed",onClick:T},{default:g(()=>e[25]||(e[25]=[v("添加")])),_:1}),e[27]||(e[27]=t("div",{style:{height:"10px"}},null,-1))])])])]),_:1},8,["show"])],64)}}});const _t=X(Ze,[["__scopeId","data-v-1d96855a"]]);export{_t as default};