2 lines
9.2 KiB
JavaScript
2 lines
9.2 KiB
JavaScript
|
import{_ as fe,r as o,u as ye,G as me,o as ge,m as y,a as he,b as j,h as ke,c as _,d as I,w as m,e as s,z as A,k as w,g as C,t as S,p as Y,j as be,f as x,i as Z,F as we,l as Ce,n as L,E as u,q as xe,s as Ve}from"./index-QWlmoZOY.js";import{e as O,f as $e,g as Se,h as Pe}from"./store-ChtKbj0U.js";import{_ as Ee}from"./authCode-DA-pJ64X.js";/* empty css */const $=D=>(xe("data-v-a76a4ead"),D=D(),Ve(),D),Fe=$(()=>s("h4",null,"选择支付方式",-1)),ze={class:"dra-body"},Be={class:"header"},je={key:0,style:{display:"inline-block","margin-right":"20px"}},Ae={style:{display:"inline-block","margin-right":"20px"}},De=$(()=>s("div",{style:{color:"#999",padding:"2rem 0 0.3rem 0"}},"原价:",-1)),Le={style:{color:"#f5222d","padding-bottom":"2rem"}},Re={style:{"font-size":"1.6rem"}},Te={style:{display:"inline-block"}},Ne=$(()=>s("div",{style:{color:"#999",padding:"2rem 0 0.3rem 0"}},"活动折扣: ",-1)),Ue={style:{color:"#f5222d","padding-bottom":"2rem"}},Ie={style:{"font-size":"1.6rem"}},Oe={style:{display:"inline-block"}},Ke=$(()=>s("div",{style:{color:"#999",padding:"2rem 0 0.3rem 0"}},"应收金额(元):",-1)),Me={style:{color:"#f5222d","padding-bottom":"2rem"}},qe={style:{"font-size":"1.6rem"}},Ge={key:0,"element-loading-text":"支付中",class:"card1"},We=$(()=>s("div",{class:"tips"},null,-1)),He={key:1,class:"card2"},Je={class:"drawer-body"},Qe={class:"counter"},Xe={class:"received"},Ye={key:0},Ze={key:1,style:{"font-size":"1rem",color:"#999"}},ea={key:0,class:"balance"},aa={class:"money"},sa=$(()=>s("div",{class:"tips"},"按回车(Enter)确认支付",-1)),ta={key:1,class:"balance"},la=$(()=>s("div",null,"不够找零, 请支付更多金额",-1)),oa=$(()=>s("div",{class:"tips"},"按下小键盘输入金额",-1)),na=[la,oa],ia={class:"keypad"},ca={class:"left"},ua={class:"right"},ra={key:2,class:"card3"},da={class:"codes"},va={style:{width:"100%",display:"flex","justify-content":"center"}},_a={__name:"pay",emits:["paySuccess"],setup(D,{expose:ee,emit:ae}){const v=o(!1),l=o(1),i=o(""),g=o("");ye(),o(0);const P=a=>{Pe({id:a}).then(e=>{y.emit("letPrintReceipt",e.data)})},se=()=>{f()},te=()=>{L(()=>{setTimeout(()=>{var a;k.value=!1,i.value="",K.value=!0,(a=g.value)==null||a.focus(),h(l.value)},300)})},h=a=>{l.value=a,l.value==2?window.addEventListener("keydown",N):(window.removeEventListener("keydown",N),L(()=>{var e;i.value="",(e=g.value)==null||e.focus()}))},c=o({}),z=o([]),p=o(""),R=o(!1);let E=0;const le=a=>{c.value=a.data,z.value=a.cart_id,p.value=a.uid,E=a.is_storage||0,console.log("选择了用户==",p.value||"游客"),R.value=a.isRePay||!1},oe=a=>{c.value.pay_price=a.price,ce.value=a.order_id,E=a.is_storage||0},ne=ae,K=o(!1),ie=o(["1","2","3","4","5","6","7","8","9","0","00","."]),M=/^(10|11|12|13|14|15)\d{16}$/,q=/^(25|26|27|28|29|30)\d{14,22}$/,ce=o(""),ue=()=>{if(k.value=!0,g.value.blur(),R.value)G();else{let a;if(M.test(i.value))a="9";else if(q.test(i.value))a="13";else return k.value=!1,i.value="",g.value.focus(),u.error("请输入正确的支付码");O({key:c.value.key,cart_id:z.value,pay_type:a,is_storage:E,auth_code:i.value,uid:p.value}).then(e=>{e.data.out_trade_no&&e.msg=="支付成功"?(v.value=!1,u({message:"支付成功",type:"success"}),f(e.data),P(e.data.id)):e.msg=="用户支付中"&&e.code==1&&(u.warning(e.msg),y.on("pay_success",t=>{u({message:"支付成功",type:"success"}),P(e.data.id),setTimeout(()=>{y.off("pay_success")},200),v.value=!1,f(t)}))}).catch(e=>{k.value=!1,L(()=>{var t;(t=g.value)==null||t.focus()})})}},G=()=>{let a=17;if(l.value==1)if(M.test(i.value))a="9";else if(q.test(i.value))a="13";else return k.value=!1,i.value="",g.value.focus(),u.error("请输入正确的支付码");$e({order_id:c.value.order_id,pay_type:a,is_storage:E,auth_code:i.value,uid:p.value}).then(e=>{var t;(t=e.msg)!=null&&t.includes("成功")?(v.value=!1,u({message:"支付成功",type:"success"}),P(e.data.id),f()):e.msg=="用户支付中"&&e.code==1&&(u.warning(e.msg),y.on("pay_success",V=>{u({message:"支付成功",type:"success"}),P(e.data.id),setTimeout(()=>
|