import{B as e,c as s,an as t,o as a,v as r,a8 as o,c1 as l,f as u,g as c,w as i,b_ as d,q as n,n as p,i as f,z as y,s as _,m as g,t as m,a as b,l as k,A as v,L as x,u as I}from"./index-007bf156.js";import{_ as w}from"./s-layout.19bedb43.js";import{f as h}from"./useGoods.ac3bf93e.js";import{_ as j}from"./_plugin-vue_export-helper.1b428a4d.js";import"./phone-international-input.3617e4e0.js";const T=j({__name:"resultYuan",setup(j){const T=e({id:0,orderType:"goods",result:"unpaid",orderInfo:{},tradeOrder:{},counter:0}),$=s((()=>"unpaid"===T.result?"waiting":"paid"===T.result?"success":"failed"===T.result?"failed":"closed"===T.result?"closed":void 0));async function S(e){T.counter++;const{data:s,code:t}=await d.getByStatus2(e);if(0===t){if(T.orderInfo=s,!T.orderInfo||30===T.orderInfo.status)return void(T.result="closed");if(0!==T.orderInfo.status)return void(T.result="paid")}T.counter<3&&"unpaid"===T.result&&setTimeout((()=>{S(e)}),1500),T.counter>=3&&(T.result="failed")}function C(){"recharge"===T.orderType?_.$router.redirect("/pages/pay/recharge-log"):_.$router.redirect("/pages/order/list",{type:2})}t((()=>{"success"==$.value&&b({points:T.orderInfo.jf,socialStatus:T.orderInfo.sj})}));const F=s((()=>T.orderInfo.no.includes("top-up")));return a((async e=>{e.id&&(T.id=e.id),e.orderType&&(T.orderType=e.orderType),e.payRes?(T.payState="success",T.orderInfo=JSON.parse(e.payRes),T.result="paid"):await S(T.id)})),r((()=>{o.isEmpty(T.orderInfo)||"success"===T.payState||S(T.id)})),l((()=>{T.result="unpaid",T.counter=0})),(e,s)=>{const t=k,a=v,r=x,o=n(I("s-layout"),w);return u(),c(o,{title:"支付结果",bgStyle:{color:"#FFF"}},{default:i((()=>[p(t,{class:"pay-result-box ss-flex-col ss-row-center ss-col-center"},{default:i((()=>["waiting"===$.value?(u(),c(t,{key:0,class:"pay-waiting ss-m-b-30"})):f("",!0),"success"===$.value?(u(),c(a,{key:1,class:"pay-img ss-m-b-30",src:y(_).$url.static("/static/images/order_pay_success.gif")},null,8,["src"])):f("",!0),["failed","closed"].includes($.value)?(u(),c(a,{key:2,class:"pay-img ss-m-b-30",src:y(_).$url.static("/static/images/order_paty_fail.gif")},null,8,["src"])):f("",!0),"success"===$.value?(u(),c(t,{key:3,class:"tip-text ss-m-b-30"},{default:i((()=>[g("支付成功")])),_:1})):f("",!0),"failed"===$.value?(u(),c(t,{key:4,class:"tip-text ss-m-b-30"},{default:i((()=>[g("支付失败")])),_:1})):f("",!0),"closed"===$.value?(u(),c(t,{key:5,class:"tip-text ss-m-b-30"},{default:i((()=>[g("该订单已关闭")])),_:1})):f("",!0),"waiting"===$.value?(u(),c(t,{key:6,class:"tip-text ss-m-b-30"},{default:i((()=>[g("检测支付结果...")])),_:1})):f("",!0),"success"===$.value?(u(),c(t,{key:7,class:"pay-total-num ss-flex"},{default:i((()=>[p(t,null,{default:i((()=>[g("￥"+m(y(h)(T.orderInfo.price)),1)])),_:1})])),_:1})):f("",!0),p(t,{class:"btn-box ss-flex ss-row-center ss-m-t-50"},{default:i((()=>[p(r,{class:"back-btn ss-reset-button",onClick:s[0]||(s[0]=e=>y(_).$router.go("/pages/index/index"))},{default:i((()=>[g(" 返回首页 ")])),_:1}),"failed"===$.value?(u(),c(r,{key:0,class:"check-btn ss-reset-button",onClick:s[1]||(s[1]=e=>y(_).$router.redirect("/pages/pay/index",{id:T.id,orderType:T.orderType}))},{default:i((()=>[g(" 重新支付 ")])),_:1})):f("",!0),"success"!==$.value||F.value?f("",!0):(u(),c(r,{key:1,class:"check-btn ss-reset-button",onClick:C},{default:i((()=>[g(" 查看订单 ")])),_:1})),"success"===$.value&&F.value?(u(),c(r,{key:2,class:"check-btn ss-reset-button",onClick:s[2]||(s[2]=e=>y(_).$router.redirect("/pages/user/wallet/score"))},{default:i((()=>[g(" 查看钱包 ")])),_:1})):f("",!0),"success"===$.value&&3===T.tradeOrder.type?(u(),c(r,{key:3,class:"check-btn ss-reset-button",onClick:s[3]||(s[3]=e=>y(_).$router.redirect("/pages/activity/groupon/order"))},{default:i((()=>[g(" 我的拼团 ")])),_:1})):f("",!0)])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-da5a5652"]]);export{T as default};
