import{a7 as s,c as a,v as e,o as t,s as l,e as o,f as r,w as d,bx as n,by as c,l as u,j as p,p as i,t as f,u as y,k as m,r as b,F as _,z as x,M as h,C as I,i as g,al as S,D as $,m as k,g as v,q as w,E as T,G as j}from"./index-9880b451.js";import{_ as M}from"./s-layout.dfc5b0b5.js";import{f as G,u as C}from"./useGoods.bdd1c2ea.js";import{_ as F}from"./_plugin-vue_export-helper.1b428a4d.js";import"./index.df38848e.js";const W=a=>s({url:"/pay/channel/get-enable-code-list",method:"GET",params:{appId:a}}),E=F({__name:"index",setup(s){const F=a((()=>l.$store("user").userWallet)),E=e({orderType:"goods",orderInfo:{},payStatus:0,payMethods:[],payment:""}),O=()=>{""!==E.payment?"wallet"===E.payment?h({title:"提示",content:"确定要支付吗?",success:function(s){s.confirm&&l.$platform.pay(E.payment,E.orderType,E.orderInfo.id)}}):l.$platform.pay(E.payment,E.orderType,E.orderInfo.id):l.$helper.toast("请选择支付方式")},q=a((()=>{if(2===E.payStatus)return"该订单已支付";if(1===E.payStatus){const s=C(E.orderInfo.expireTime);return s.ms<=0?(E.payStatus=-1,""):`剩余支付时间 ${s.h}:${s.m}:${s.s} `}return-2===E.payStatus?"未查询到支付单信息":""}));function z(s){E.payment=s.detail.value}async function A(s){const{data:a,code:e}=await n.getOrder(s);0===e&&a?(E.orderInfo=a,await async function(){const{data:s,code:a}=await W(E.orderInfo.appId);if(0!==a)return;E.payMethods=c(s)}(),10!==E.orderInfo.status&&20!==E.orderInfo.status?30!==E.orderInfo.status?E.payStatus=1:E.payStatus=-1:E.payStatus=2):E.payStatus=-2}return t((s=>{if("WechatOfficialAccount"===l.$platform.name&&"ios"===l.$platform.os&&!l.$platform.landingPage.includes("pages/pay/index"))return void location.reload();let a=s.id;s.orderType&&(E.orderType=s.orderType),A(a),l.$store("user").getWallet()})),(s,a)=>{const e=I,t=g,n=w,c=T,h=j,C=S,W=$,A=u(k("s-layout"),M);return o(),r(A,{title:"收银台"},{default:d((()=>[p(t,{class:"bg-white ss-modal-box ss-flex-col"},{default:d((()=>[p(t,{class:"modal-header ss-flex-col ss-col-center ss-row-center"},{default:d((()=>[p(t,{class:"money-box ss-m-b-20"},{default:d((()=>[p(e,{class:"money-text"},{default:d((()=>[i(f(y(G)(E.orderInfo.price)),1)])),_:1})])),_:1}),p(t,{class:"time-text"},{default:d((()=>[p(e,null,{default:d((()=>[i(f(y(q)),1)])),_:1})])),_:1})])),_:1}),p(t,{class:"modal-content ss-flex-1"},{default:d((()=>[p(t,{class:"pay-title ss-p-l-30 ss-m-y-30"},{default:d((()=>[i("选择支付方式")])),_:1}),p(C,{onChange:z},{default:d((()=>[(o(!0),m(_,null,b(E.payMethods,(s=>(o(),r(h,{class:"pay-type-item",key:s.title},{default:d((()=>[p(t,{class:x(["pay-item ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom",{"disabled-pay-item":s.disabled}])},{default:d((()=>[p(t,{class:"ss-flex ss-col-center"},{default:d((()=>[s.disabled?(o(),r(n,{key:0,class:"pay-icon",src:y(l).$url.static("/static/img/shop/pay/cod_disabled.png"),mode:"aspectFit"},null,8,["src"])):(o(),r(n,{key:1,class:"pay-icon",src:y(l).$url.static(s.icon),mode:"aspectFit"},null,8,["src"])),p(e,{class:"pay-title"},{default:d((()=>[i(f(s.title),1)])),_:2},1024)])),_:2},1024),p(t,{class:"check-box ss-flex ss-col-center ss-p-l-10"},{default:d((()=>["wallet"===s.value?(o(),r(t,{key:0,class:"userInfo-money ss-m-r-10"},{default:d((()=>[i(" 余额: "+f(y(G)(y(F).balance))+"元 ",1)])),_:1})):v("",!0),p(c,{value:s.value,color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},disabled:s.disabled,checked:E.payment===s.value},null,8,["value","disabled","checked"])])),_:2},1024)])),_:2},1032,["class"])])),_:2},1024)))),128))])),_:1})])),_:1}),p(t,{class:"modal-footer ss-flex ss-row-center ss-col-center ss-m-t-80 ss-m-b-40"},{default:d((()=>[0===E.payStatus?(o(),r(W,{key:0,class:"ss-reset-button past-due-btn"},{default:d((()=>[i(" 检测支付环境中 ")])),_:1})):-1===E.payStatus?(o(),r(W,{key:1,class:"ss-reset-button past-due-btn",disabled:""},{default:d((()=>[i(" 支付已过期 ")])),_:1})):(o(),r(W,{key:2,class:x(["ss-reset-button save-btn",{"disabled-btn":1!==E.payStatus}]),onClick:O,disabled:1!==E.payStatus},{default:d((()=>[i(" 立即支付 ")])),_:1},8,["disabled","class"]))])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-18cb65d6"]]);export{E as default};
