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