import{y as e,c as s,o as r,n as t,a4 as a,bz as o,e as l,f as d,w as c,bx as u,ad as i,l as n,j as p,g as f,v as y,s as m,t as g,u as _,i as b,x as k,G as v,m as x}from"./index-147ae61b.js";import{_ as w}from"./s-layout.21a11bc7.js";import{f as I}from"./useGoods.eea9c479.js";import{_ as h}from"./_plugin-vue_export-helper.1b428a4d.js";import"./form.c6b6ef18.js";const T=h({__name:"result",setup(h){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 j(e){T.counter++;const{data:s,code:r}=await u.getOrder(e);if(0===r){if(T.orderInfo=s,!T.orderInfo||30===T.orderInfo.status)return void(T.result="closed");if(0!==T.orderInfo.status){if(T.result="paid","goods"===T.orderType){const{data:e,code:s}=await i.getOrder(T.orderInfo.merchantOrderId);0===s&&(T.tradeOrder=e)}return}}T.counter<3&&"unpaid"===T.result&&setTimeout((()=>{j(e)}),1500),T.counter>=3&&(T.result="failed")}function O(){"recharge"===T.orderType?m.$router.redirect("/pages/pay/recharge-log"):m.$router.redirect("/pages/order/list")}return r((async e=>{e.id&&(T.id=e.id),e.orderType&&(T.orderType=e.orderType),"fail"===e.payState?T.result="failed":await j(T.id)})),t((()=>{a.isEmpty(T.orderInfo)||j(T.id)})),o((()=>{T.result="unpaid",T.counter=0})),(e,s)=>{const r=b,t=k,a=v,o=n(x("s-layout"),w);return l(),d(o,{title:"支付结果",bgStyle:{color:"#FFF"}},{default:c((()=>[p(r,{class:"pay-result-box ss-flex-col ss-row-center ss-col-center"},{default:c((()=>["waiting"===$.value?(l(),d(r,{key:0,class:"pay-waiting ss-m-b-30"})):f("",!0),"success"===$.value?(l(),d(t,{key:1,class:"pay-img ss-m-b-30",src:y(m).$url.static("/static/img/shop/order/order_pay_success.gif")},null,8,["src"])):f("",!0),["failed","closed"].includes($.value)?(l(),d(t,{key:2,class:"pay-img ss-m-b-30",src:y(m).$url.static("/static/img/shop/order/order_paty_fail.gif")},null,8,["src"])):f("",!0),"success"===$.value?(l(),d(r,{key:3,class:"tip-text ss-m-b-30"},{default:c((()=>[g("支付成功")])),_:1})):f("",!0),"failed"===$.value?(l(),d(r,{key:4,class:"tip-text ss-m-b-30"},{default:c((()=>[g("支付失败")])),_:1})):f("",!0),"closed"===$.value?(l(),d(r,{key:5,class:"tip-text ss-m-b-30"},{default:c((()=>[g("该订单已关闭")])),_:1})):f("",!0),"waiting"===$.value?(l(),d(r,{key:6,class:"tip-text ss-m-b-30"},{default:c((()=>[g("检测支付结果...")])),_:1})):f("",!0),"success"===$.value?(l(),d(r,{key:7,class:"pay-total-num ss-flex"},{default:c((()=>[p(r,null,{default:c((()=>[g("￥"+_(y(I)(T.orderInfo.price)),1)])),_:1})])),_:1})):f("",!0),p(r,{class:"btn-box ss-flex ss-row-center ss-m-t-50"},{default:c((()=>[p(a,{class:"back-btn ss-reset-button",onClick:s[0]||(s[0]=e=>y(m).$router.go("/pages/index/index"))},{default:c((()=>[g(" 返回首页 ")])),_:1}),"failed"===$.value?(l(),d(a,{key:0,class:"check-btn ss-reset-button",onClick:s[1]||(s[1]=e=>y(m).$router.redirect("/pages/pay/index",{id:T.id,orderType:T.orderType}))},{default:c((()=>[g(" 重新支付 ")])),_:1})):f("",!0),"success"===$.value?(l(),d(a,{key:1,class:"check-btn ss-reset-button",onClick:O},{default:c((()=>[g(" 查看订单 ")])),_:1})):f("",!0),"success"===$.value&&3===T.tradeOrder.type?(l(),d(a,{key:2,class:"check-btn ss-reset-button",onClick:s[2]||(s[2]=e=>y(m).$router.redirect("/pages/activity/groupon/order"))},{default:c((()=>[g(" 我的拼团 ")])),_:1})):f("",!0)])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-0dcaec25"]]);export{T as default};
