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