import{_ as U}from"./scan_code_tip.ab579f00.js";import{a as F,g as q}from"./tangshi.fa0a913a.js";import{d as z,r as l,s as T,K as $,p as H,b as K,dx as M,c as k,e as i,k as j,i as E,g as u,H as r,t as S,f as p,h as G,A as v,u as J,q as O,R as W,S as X,_ as Y}from"./index.0308b213.js";const w=d=>(W("data-v-36a5ba91"),d=d(),X(),d),Z={class:"my-header"},ee=["id"],te={class:"my-amount"},ue={class:"my-tabs"},oe={class:"my-content"},ae={key:0},ne=w(()=>u("img",{src:U,alt:""},null,-1)),se={key:1},le={key:0,src:"",alt:""},de=w(()=>u("p",null,"\u6CA1\u6709\u53EF\u7528\u7684\u6536\u6B3E\u4E8C\u7EF4\u7801",-1)),ie={key:2},ce=z({props:{show:{type:Boolean,default:!1},amount:{type:String,default:""},order_id:{type:[String,Number],default:0},unpaid_amount:{type:[String,Number],default:0}},emits:["update:show","payResult"],setup(d,{emit:_}){const s=d,m=l(null),a=l(0),t=l(""),I=l(""),g=l("");window.setScanQrCode=e=>{g.value=e,F({order_id:s.order_id,authCode:e}).then(o=>{console.log(o),c.value=!1,t.value="",C()})};const b=()=>{uni.postMessage({data:{type:"scan"}}),a.value=3},B=()=>{m.value&&(console.log(22222222),setTimeout(()=>{m.value.focus()},0))},y=T({get(){return B(),s.show},set(e){B(),_("update:show",e)}});let c=l(!1);const V=()=>{console.log("\u5F00\u59CB\u652F\u4ED8"),F({order_id:s.order_id,authCode:t.value}).then(e=>{console.log(e),c.value=!1,t.value="",C()})},P=$(()=>{c.value||(c.value=!0,V())},500);H(()=>t.value,e=>{e.length>=16&&P()});let f=K(null);const A=()=>{q({order_id:s.order_id,finish:s.unpaid_amount>0}).then(e=>{console.log(e),e.data&&(console.log("\u652F\u4ED8\u6210\u529F"),clearInterval(f),_("payResult",!0))})},C=()=>{let e=0;f=setInterval(()=>{A(),e++,e>=10&&(clearInterval(f),_("payResult",!1))},1e3)},x=e=>{t.value="",document.addEventListener("keydown",h)},R=()=>{document.removeEventListener("keydown",h)},h=e=>{if(!(e.key==="Shift"||e.key==="Control"||e.key==="Alt")){if(e.key==="Enter"){D();return}t.value+=e.key}},D=()=>{t.value.length>0&&(console.log("\u626B\u7801\u5B8C\u6210:",t.value),emit("scan-complete",t.value))};return M(()=>{window.setScanQrCode=null,document.removeEventListener("keydown",h)}),(e,o)=>{const N=k("el-input"),L=k("el-dialog");return i(),j(L,{modelValue:J(y),"onUpdate:modelValue":o[3]||(o[3]=n=>O(y)?y.value=n:null),width:"400px",class:"my-dialog"},{header:E(({titleId:n,titleClass:Q})=>[u("div",Z,[u("h4",{id:n,class:r(Q)},"\u8BF7\u9009\u62E9\u626B\u7801\u65B9\u5F0F\uFF08\u6D4B\u8BD5\u539F\u751F\u626B\u7801\uFF09",10,ee)])]),default:E(()=>[u("div",te,"\u626B\u7801\u6536\u6B3E\uFFE5"+S(s.amount),1),u("div",ue,[u("div",{class:r({active:a.value===0}),onClick:o[0]||(o[0]=n=>a.value=0)},"\u626B\u7801\u67AA",2),u("div",{class:r({active:a.value===1}),onClick:o[1]||(o[1]=n=>a.value=1)},"\u4E8C\u7EF4\u7801",2),u("div",{class:r({active:a.value===3}),onClick:b},"\u626B\u7801",2)]),u("div",oe,[a.value===0?(i(),p("div",ae,[G(N,{ref_key:"inputRef",ref:m,autofocus:"",modelValue:t.value,"onUpdate:modelValue":o[2]||(o[2]=n=>t.value=n),placeholder:"\u8BF7\u70B9\u51FB\u8F93\u5165\u6846\u805A\u7126\u626B\u7801\u6216\u8F93\u5165\u4ED8\u6B3E\u7801",size:"large",readonly:"",onFocus:x,onBlur:R},null,8,["modelValue"]),ne])):v("",!0),a.value===1?(i(),p("div",se,[I.value?(i(),p("img",le)):v("",!0),de])):v("",!0),a.value===3?(i(),p("div",ie,[u("p",null,S(g.value),1)])):v("",!0)])]),_:1},8,["modelValue"])}}});const _e=Y(ce,[["__scopeId","data-v-36a5ba91"]]);export{_e as default};
