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