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