Index-ce94539f.js 9.8 KB

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