pages-pay-result.598ac9f9.js 3.3 KB

1
  1. import{N as s,z as e,c as t,a0 as a,f as o,g as l,w as r,bT as u,j as n,i,x as c,s as d,u as p,k as f,v as g,y as m,J as y}from"./index-ba48620e.js";import"https://wx.gtimg.com/pay_h5/goldplan/js/jgoldplan-1.0.0.js";import{f as _}from"./useGoods.edb8879f.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"),x=e({id:0,orderType:"goods",result:"unpaid",orderInfo:{},tradeOrder:{},counter:0}),w=t((()=>"unpaid"===x.result?"waiting":"paid"===x.result?"success":"failed"===x.result?"failed":"closed"===x.result?"closed":void 0));async function k(s){x.counter++;const{data:e,code:t}=await u.getFuYouPayOrderByStatus(s);if(0===t){if(x.orderInfo=e,!x.orderInfo||30===x.orderInfo.status)return void(x.result="closed");if(0!==x.orderInfo.status)return void(x.result="paid")}x.counter<3&&"unpaid"===x.result&&setTimeout((()=>{k(s)}),1500),x.counter>=3&&(x.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 k(j.value.out_trade_no)}));const I=()=>{const s={action:"jumpOut",jumpOutUrl:`${location.origin}/#/pages/index/index?points=${x.orderInfo.jf}&socialStatus=${x.orderInfo.sj}`};console.log(s.jumpOutUrl);const e=JSON.stringify(s);parent.postMessage(e,b.value)},O=()=>{console.log(x.orderInfo);const s={action:"jumpOut",jumpOutUrl:`${location.origin}/#/pages/order/list?type=2&points=${x.orderInfo.jf}&socialStatus=${x.orderInfo.sj}`};console.log(s.jumpOutUrl);const 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"})):i("",!0),"success"===w.value?(o(),l(a,{key:1,class:"pay-img ss-m-b-30",src:c(d).$url.static("/static/images/order_pay_success.gif")},null,8,["src"])):i("",!0),["failed","closed"].includes(w.value)?(o(),l(a,{key:2,class:"pay-img ss-m-b-30",src:c(d).$url.static("/static/images/order_paty_fail.gif")},null,8,["src"])):i("",!0),"success"===w.value?(o(),l(t,{key:3,class:"tip-text ss-m-b-30"},{default:r((()=>[p("支付成功")])),_:1})):i("",!0),"failed"===w.value?(o(),l(t,{key:4,class:"tip-text ss-m-b-30"},{default:r((()=>[p("支付失败")])),_:1})):i("",!0),"closed"===w.value?(o(),l(t,{key:5,class:"tip-text ss-m-b-30"},{default:r((()=>[p("该订单已关闭")])),_:1})):i("",!0),"waiting"===w.value?(o(),l(t,{key:6,class:"tip-text ss-m-b-30"},{default:r((()=>[p("检测支付结果...")])),_:1})):i("",!0),"success"===w.value?(o(),l(t,{key:7,class:"pay-total-num ss-flex"},{default:r((()=>[f(t,null,{default:r((()=>[p("¥"+g(c(_)(x.orderInfo.price)),1)])),_:1})])),_:1})):i("",!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?(o(),l(u,{key:0,class:"check-btn ss-reset-button",onClick:O},{default:r((()=>[p(" 查看订单 ")])),_:1})):i("",!0)])),_:1})])),_:1})}}},[["__scopeId","data-v-b4276d70"]]);export{j as default};