import{P as s,B as e,c as t,a2 as a,f as o,g as l,w as r,b_ as u,l as n,i as c,z as i,s as d,m as p,n as f,t as g,A as m,L as y}from"./index-007bf156.js";import"https://wx.gtimg.com/pay_h5/goldplan/js/jgoldplan-1.0.0.js";import{f as _}from"./useGoods.ac3bf93e.js";import{_ as v}from"./_plugin-vue_export-helper.1b428a4d.js";const b=v({__name:"result",setup(v){s({});const b=s({}),j=s("https://payapp.weixin.qq.com"),w=e({id:0,orderType:"goods",result:"unpaid",orderInfo:{},tradeOrder:{},counter:0}),k=t((()=>"unpaid"===w.result?"waiting":"paid"===w.result?"success":"failed"===w.result?"failed":"closed"===w.result?"closed":void 0)),x=t((()=>b.value.out_trade_no.includes("top-up")));async function O(s){w.counter++;const{data:e,code:t}=await u.getFuYouPayOrderByStatus(s);if(0===t){if(w.orderInfo=e,!w.orderInfo||30===w.orderInfo.status)return void(w.result="closed");if(0!==w.orderInfo.status)return void(w.result="paid")}w.counter<3&&"unpaid"===w.result&&setTimeout((()=>{O(s)}),1500),w.counter>=3&&(w.result="failed")}a((async()=>{await(()=>{console.log("showCustomPage");const s=JSON.stringify({action:"onIframeReady",displayStyle:"SHOW_CUSTOM_PAGE"});parent.postMessage(s,j.value)})(),await(()=>{const s=window.location.href.split("?")[1].split("&");s.length&&s.forEach((s=>{const e=s.split("=");b.value[e[0]]=e[1]}))})(),await O(b.value.out_trade_no)}));const I=()=>{const s={action:"jumpOut",jumpOutUrl:`${location.origin}/#/pages/index/index?points=${w.orderInfo.jf}&socialStatus=${w.orderInfo.sj}`};console.log(s.jumpOutUrl);const e=JSON.stringify(s);parent.postMessage(e,j.value)},h=()=>{console.log(w.orderInfo);const s={action:"jumpOut",jumpOutUrl:`${location.origin}/#/pages/order/list?type=2&points=${w.orderInfo.jf}&socialStatus=${w.orderInfo.sj}`};console.log(s.jumpOutUrl);const e=JSON.stringify(s);parent.postMessage(e,j.value)},S=()=>{const s={action:"jumpOut",jumpOutUrl:`${location.origin}/#/pages/user/wallet/score`},e=JSON.stringify(s);parent.postMessage(e,j.value)};return(s,e)=>{const t=n,a=m,u=y;return o(),l(t,{class:"pay-result-box ss-flex-col ss-row-center ss-col-center"},{default:r((()=>["waiting"===k.value?(o(),l(t,{key:0,class:"pay-waiting ss-m-b-30"})):c("",!0),"success"===k.value?(o(),l(a,{key:1,class:"pay-img ss-m-b-30",src:i(d).$url.static("/static/images/order_pay_success.gif")},null,8,["src"])):c("",!0),["failed","closed"].includes(k.value)?(o(),l(a,{key:2,class:"pay-img ss-m-b-30",src:i(d).$url.static("/static/images/order_paty_fail.gif")},null,8,["src"])):c("",!0),"success"===k.value?(o(),l(t,{key:3,class:"tip-text ss-m-b-30"},{default:r((()=>[p("支付成功")])),_:1})):c("",!0),"failed"===k.value?(o(),l(t,{key:4,class:"tip-text ss-m-b-30"},{default:r((()=>[p("支付失败")])),_:1})):c("",!0),"closed"===k.value?(o(),l(t,{key:5,class:"tip-text ss-m-b-30"},{default:r((()=>[p("该订单已关闭")])),_:1})):c("",!0),"waiting"===k.value?(o(),l(t,{key:6,class:"tip-text ss-m-b-30"},{default:r((()=>[p("检测支付结果...")])),_:1})):c("",!0),"success"===k.value?(o(),l(t,{key:7,class:"pay-total-num ss-flex"},{default:r((()=>[f(t,null,{default:r((()=>[p("￥"+g(i(_)(w.orderInfo.price)),1)])),_:1})])),_:1})):c("",!0),f(t,{class:"btn-box ss-flex ss-row-center ss-m-t-50"},{default:r((()=>[f(u,{class:"back-btn ss-reset-button",onClick:I},{default:r((()=>[p(" 返回首页 ")])),_:1}),"success"!==k.value||x.value?c("",!0):(o(),l(u,{key:0,class:"check-btn ss-reset-button",onClick:h},{default:r((()=>[p(" 查看订单 ")])),_:1})),"success"===k.value&&x.value?(o(),l(u,{key:1,class:"check-btn ss-reset-button",onClick:S},{default:r((()=>[p(" 查看钱包 ")])),_:1})):c("",!0)])),_:1})])),_:1})}}},[["__scopeId","data-v-f01ecc8f"]]);export{b as default};
