import{aa as s,c as e,v as a,o as t,s as l,r as o,e as r,f as d,w as n,cP as c,cQ as u,j as i,k as p,p as f,t as y,u as m,l as b,m as _,F as x,z as h,M as v,cR as I,C as S,i as g,au as $,D as k,g as w,q as T,E as j,G as M}from"./index-CWyPMHxb.js";import{S as C}from"./s-layout.CUgh1tQ8.js";import{f as G,u as F}from"./useGoods.BQLkjza8.js";import{_ as W}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./index.gxKvznCa.js";const E=e=>s({url:"/pay/channel/get-enable-code-list",method:"GET",params:{appId:e}}),O=W({__name:"index",setup(s){const W=e((()=>l.$store("user").userWallet)),O=a({orderType:"goods",orderInfo:{},payStatus:0,payMethods:[],payment:""}),P=()=>{""!==O.payment?"wallet"===O.payment?v({title:"提示",content:"确定要支付吗?",success:function(s){s.confirm&&l.$platform.pay(O.payment,O.orderType,O.orderInfo.id)}}):l.$platform.pay(O.payment,O.orderType,O.orderInfo.id):l.$helper.toast("请选择支付方式")},q=e((()=>{if(2===O.payStatus)return"该订单已支付";if(1===O.payStatus){const s=F(O.orderInfo.expireTime);return s.ms<=0?(O.payStatus=-1,""):`剩余支付时间 ${s.h}:${s.m}:${s.s} `}return-2===O.payStatus?"未查询到支付单信息":""}));function z(s){O.payment=s.detail.value}async function A(s){const{data:e,code:a}=await c.getOrder(s,!0);0===a&&e?(O.orderInfo=e,function(){if(10===O.orderInfo.status||20===O.orderInfo.status)return O.payStatus=2,void v({title:"提示",content:"订单已支付",showCancel:!1,success:function(){I(O.orderInfo.id,O.orderType)}});30!==O.orderInfo.status?O.payStatus=1:O.payStatus=-1}(),await async function(){const{data:s,code:e}=await E(O.orderInfo.appId);if(0!==e)return;O.payMethods=u(s),O.payMethods.find((s=>{if(s.value&&!s.disabled)return O.payment=s.value,!0}))}()):O.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 e=s.id;s.orderType&&(O.orderType=s.orderType),A(e),l.$store("user").getWallet()})),(s,e)=>{const a=S,t=g,c=T,u=j,v=M,I=$,F=k,E=o(r("s-layout"),C);return i(),d(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(a,{class:"money-text"},{default:n((()=>[f(y(m(G)(O.orderInfo.price)),1)])),_:1})])),_:1}),p(t,{class:"time-text"},{default:n((()=>[p(a,null,{default:n((()=>[f(y(q.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((()=>[f("选择支付方式")])),_:1}),p(I,{onChange:z},{default:n((()=>[(i(!0),b(x,null,_(O.payMethods,(s=>(i(),d(v,{class:"pay-type-item",key:s.title},{default:n((()=>[p(t,{class:h(["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?(i(),d(c,{key:0,class:"pay-icon",src:m(l).$url.static("/static/img/shop/pay/cod_disabled.png"),mode:"aspectFit"},null,8,["src"])):(i(),d(c,{key:1,class:"pay-icon",src:m(l).$url.static(s.icon),mode:"aspectFit"},null,8,["src"])),p(a,{class:"pay-title"},{default:n((()=>[f(y(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?(i(),d(t,{key:0,class:"userInfo-money ss-m-r-10"},{default:n((()=>[f(" 余额: "+y(m(G)(W.value.balance))+"元 ",1)])),_:1})):w("",!0),p(u,{value:s.value,color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},disabled:s.disabled,checked:O.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===O.payStatus?(i(),d(F,{key:0,class:"ss-reset-button past-due-btn"},{default:n((()=>[f(" 检测支付环境中 ")])),_:1})):-1===O.payStatus?(i(),d(F,{key:1,class:"ss-reset-button past-due-btn",disabled:""},{default:n((()=>[f(" 支付已过期 ")])),_:1})):(i(),d(F,{key:2,class:h(["ss-reset-button save-btn",{"disabled-btn":1!==O.payStatus}]),onClick:P,disabled:1!==O.payStatus},{default:n((()=>[f(" 立即支付 ")])),_:1},8,["disabled","class"]))])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-b280537f"]]);export{O as default};
