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