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