cashier-mer/dist/assets/pay-p0l28gLY.js

2 lines
9.5 KiB
JavaScript
Raw Normal View History

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