Index-53d8e859.js 9.9 KB

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