import{_ as e}from"./el-navbar.DVIyjZEN.js";import{a2 as a,a3 as l,Y as s,a4 as t,r as o,o as u,b as c,d as n,e as d,f as i,w as r,g as p,v as f,A as m,h as y,i as v,F as _,j as h,p as g,y as k,z as b,B as j}from"./index-DVkgSHpn.js";import{_ as w,b as x,a as C}from"./el-layout._U-vZTft.js";import{_ as P}from"./el-loading.BSG4bmSC.js";import"./el-loading-icon.Bh3RKCou.js";const $={pay(e){if("wechat"==e.type)if(a.isWechat){wx.config(e.config);let a=e.options;a.success=function(){l({title:"您已支付成功!",success:function(a){s(e.jump)}})},wx.chooseWXPay(a)}else location.href=e.url+"&redirect_url="+location.origin+"/mobile/"+e.jump;else{utils.showLoading();let a=document.createElement("div");a.innerHTML=e.result,document.body.appendChild(a),document.forms.alipaysubmit.submit()}},async requestPayment(e,a){e?uni.requestPayment({provider:a,orderInfo:e.params,success:a=>{l({title:"您已支付成功!",success:function(a){s(e.jump)}})},fail:e=>{t({content:"支付失败,原因为: "+e.errMsg,showCancel:!1})}}):t({content:"获取支付信息失败",showCancel:!1})}},V=w({__name:"cashier",setup(a){const l=o("0"),t=o({}),w=o(!1),V=o({}),E=o([]);u((e=>{t.value=e,w.value=!0,uni.$http.get("cashier/index",e).then((e=>{w.value=!1,e.code&&(E.value=e.data.payment,l.value=e.data.orderAmount,E.value.forEach(((e,a)=>{e.checked&&(V.value=e)})))}))}));const T=()=>{t.value.pay_id=V.value.id,uni.$http.post("cashier/payment",t.value).then((e=>{e.code?1==e.data.isPay?s(`/pages/order/detail?id=${t.value.order_id}`):(e.data.order_id=t.value.order_id,e.data.jump="recharge"==t.value.pay_type?"pages/ucenter/wallet/log":`pages/order/detail?id=${t.value.order_id}`,$.pay(e.data)):uni.$layer.showToast(e.msg)}))};return(a,s)=>{const t=c(n("el-navbar"),e),o=g,u=k,$=j,q=c(n("uni-icons"),x),z=c(n("el-loading"),P),A=c(n("el-layout"),C);return d(),i(A,null,{default:r((()=>[p(t,{placeholder:!0,fixed:!0,border:!1,title:"收银台"}),p(o,{class:"wrapper"},{default:r((()=>[p(o,{class:"title"},{default:r((()=>[f("收银台")])),_:1}),p(o,{class:"price"},{default:r((()=>[f("￥"),p(u,null,{default:r((()=>[f(m(l.value),1)])),_:1})])),_:1}),E.value.length>0?(d(),i(o,{key:0,class:"payment"},{default:r((()=>[p(o,{class:"pay-type"},{default:r((()=>[f("请选择支付方式")])),_:1}),p(o,{class:"list"},{default:r((()=>[(d(!0),y(_,null,v(E.value,((e,a)=>(d(),i(o,{class:"list-box",key:a,onClick:l=>((e,a)=>{E.value.forEach(((e,a)=>{e.checked=!1})),V.value=e,E.value[a].checked=!0})(e,a)},{default:r((()=>[p(o,{class:"icon"},{default:r((()=>[p($,{src:e.icon},null,8,["src"])])),_:2},1024),p(o,{class:"payname"},{default:r((()=>[p(u,null,{default:r((()=>[f(m(e.name),1)])),_:2},1024),e.money>0?(d(),i(u,{key:0},{default:r((()=>[f("余额 "+m(e.money)+" 元",1)])),_:2},1024)):h("",!0)])),_:2},1024),p(o,{class:"operate"},{default:r((()=>[p(o,{class:b({active:e.checked})},{default:r((()=>[p(q,{class:"check",type:"checkmarkempty",color:"#fff",size:"12"})])),_:2},1032,["class"])])),_:2},1024)])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1})):h("",!0),E.value.length>0?(d(),i(o,{key:1,onClick:T,class:"btn"},{default:r((()=>[f("立即支付")])),_:1})):h("",!0)])),_:1}),p(z,{modelValue:w.value,"onUpdate:modelValue":s[0]||(s[0]=e=>w.value=e)},null,8,["modelValue"])])),_:1})}}},[["__scopeId","data-v-47cad50f"]]);export{V as default};
//# sourceMappingURL=pages-cart-cashier.XfHqwFZa.js.map
