import{Z as s,c as a,y as e,o as t,s as l,e as o,f as r,w as d,bz as n,bA 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,U 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-9aa72eed.js";import{_ as G}from"./s-layout.bffb18b8.js";import{f as M,u as F}from"./useGoods.ce02ada2.js";import{_ as O}from"./_plugin-vue_export-helper.1b428a4d.js";import"./form.c66b5271.js";const W=a=>s({url:"/pay/channel/get-enable-code-list",method:"GET",params:{appId:a}}),A=O({__name:"index",setup(s){const O=a((()=>l.$store("user").userWallet)),A=e({orderType:"goods",orderInfo:{},payStatus:0,payMethods:[],payment:""}),B=()=>{""!==A.payment?"wallet"===A.payment?h({title:"提示",content:"确定要支付吗?",success:function(s){s.confirm&&l.$platform.pay(A.payment,A.orderType,A.orderInfo.id)}}):l.$platform.pay(A.payment,A.orderType,A.orderInfo.id):l.$helper.toast("请选择支付方式")},C=a((()=>{if(2===A.payStatus)return"该订单已支付";if(1===A.payStatus){const s=F(A.orderInfo.expireTime);return s.ms<=0?(A.payStatus=-1,""):`剩余支付时间 ${s.h}:${s.m}:${s.s} `}return-2===A.payStatus?"未查询到支付单信息":""}));function E(){10!==A.orderInfo.status&&20!==A.orderInfo.status?30!==A.orderInfo.status?A.payStatus=1:A.payStatus=-1:A.payStatus=2}function P(s){A.payment=s.detail.value}async function z(){const{data:s,code:a}=await W(A.orderInfo.appId);0===a&&(A.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&&(A.orderType=s.orderType),2==s.openType?async function(s){const{data:a,code:e}=await n.getPayOrder(s);0===e&&a?(A.orderInfo=a,await z(),E()):A.payStatus=-2}(a):(console.log(123),async function(s){const{data:a,code:e}=await n.getOrder(s);0===e&&a?(A.orderInfo=a,await z(),E()):A.payStatus=-2}(a)),l.$store("user").getWallet()})),(s,a)=>{const e=g,t=I,n=k,c=T,h=j,F=v,W=S,E=u(w("s-layout"),G);return o(),r(E,{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(M)(A.orderInfo.price)),1)])),_:1})])),_:1}),p(t,{class:"time-text"},{default:d((()=>[p(e,null,{default:d((()=>[i(f(C.value),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(F,{onChange:P},{default:d((()=>[(o(!0),m(_,null,b(A.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(M)(O.value.balance))+"元 ",1)])),_:1})):$("",!0),p(c,{value:s.value,color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},disabled:s.disabled,checked:A.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===A.payStatus?(o(),r(W,{key:0,class:"ss-reset-button past-due-btn"},{default:d((()=>[i(" 检测支付环境中 ")])),_:1})):-1===A.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!==A.payStatus}]),onClick:B,disabled:1!==A.payStatus},{default:d((()=>[i(" 立即支付 ")])),_:1},8,["disabled","class"]))])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-7b71f260"]]);export{A as default};
