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