import{C as e,c as s,p as r,x as t,a1 as a,bm as o,o as d,e as l,w as c,s as u,b as n,i,u as p,k as f,y,z as _,m as g,l as m,B as b,d as k}from"./index-520dfaee.js";import{a as I}from"./s-layout.5146c957.js";import{_ as x}from"./_plugin-vue_export-helper.1b428a4d.js";const h=x({__name:"result",setup(x){const h=e({orderId:0,orderType:"goods",result:"unpaid",orderInfo:{},counter:0}),$=s((()=>"unpaid"===h.result?"waiting":"paid"===h.result?"success":"failed"===h.result?"failed":"closed"===h.result?"closed":void 0));async function v(e){let s;h.counter++,s="recharge"===h.orderType?u.$api.trade.order:u.$api.order.detail;const{data:r,code:t}=await s(e);if(1===t){if(h.orderInfo=r,"closed"===h.orderInfo.status)return void(h.result="closed");if("unpaid"!==h.orderInfo.status)return void(h.result="paid")}h.counter<3&&"unpaid"===h.result&&setTimeout((()=>{v(e)}),1500),h.counter>=3&&(h.result="failed")}function w(){"recharge"===h.orderType?u.$router.redirect("/pages/pay/recharge-log"):u.$router.redirect("/pages/order/list")}return r((async e=>{let s="";e.orderSN&&(s=e.orderSN),e.id&&(s=e.id),h.orderId=s,"recharge"===e.orderType&&(h.orderType="recharge"),"fail"===e.payState?h.result="failed":v(h.orderId)})),t((()=>{a.isEmpty(h.orderInfo)||v(h.orderId)})),o((()=>{h.result="unpaid",h.counter=0})),(e,s)=>{const r=g,t=m,a=b,o=n(k("s-layout"),I);return d(),l(o,{title:"支付结果",bgStyle:{color:"#FFF"}},{default:c((()=>[i(r,{class:"pay-result-box ss-flex-col ss-row-center ss-col-center"},{default:c((()=>["waiting"===p($)?(d(),l(r,{key:0,class:"pay-waiting ss-m-b-30"})):f("",!0),"success"===p($)?(d(),l(t,{key:1,class:"pay-img ss-m-b-30",src:p(u).$url.static("/assets/addons/shopro/uniapp/order/order_pay_success.gif")},null,8,["src"])):f("",!0),["failed","closed"].includes(p($))?(d(),l(t,{key:2,class:"pay-img ss-m-b-30",src:p(u).$url.static("/assets/addons/shopro/uniapp/order/order_paty_fail.gif")},null,8,["src"])):f("",!0),"success"==p($)?(d(),l(r,{key:3,class:"tip-text ss-m-b-30"},{default:c((()=>[y(_("offline"===h.orderInfo.pay_mode?"下单成功":"支付成功"),1)])),_:1})):f("",!0),"failed"==p($)?(d(),l(r,{key:4,class:"tip-text ss-m-b-30"},{default:c((()=>[y("支付失败")])),_:1})):f("",!0),"closed"==p($)?(d(),l(r,{key:5,class:"tip-text ss-m-b-30"},{default:c((()=>[y("该订单已关闭")])),_:1})):f("",!0),"waiting"==p($)?(d(),l(r,{key:6,class:"tip-text ss-m-b-30"},{default:c((()=>[y("检测支付结果...")])),_:1})):f("",!0),"success"===p($)?(d(),l(r,{key:7,class:"pay-total-num ss-flex"},{default:c((()=>[Number(h.orderInfo.pay_fee)>0?(d(),l(r,{key:0},{default:c((()=>[y("￥"+_(h.orderInfo.pay_fee),1)])),_:1})):f("",!0),h.orderInfo.score_amount&&Number(h.orderInfo.pay_fee)>0?(d(),l(r,{key:1},{default:c((()=>[y("+")])),_:1})):f("",!0),h.orderInfo.score_amount?(d(),l(r,{key:2,class:"price-text ss-flex ss-col-center"},{default:c((()=>[i(t,{src:p(u).$url.static("/assets/addons/shopro/uniapp/goods/score1.svg"),class:"score-img"},null,8,["src"]),i(r,null,{default:c((()=>[y(_(h.orderInfo.score_amount),1)])),_:1})])),_:1})):f("",!0)])),_:1})):f("",!0),i(r,{class:"btn-box ss-flex ss-row-center ss-m-t-50"},{default:c((()=>[i(a,{class:"back-btn ss-reset-button",onClick:s[0]||(s[0]=e=>p(u).$router.go("/pages/index/index"))},{default:c((()=>[y(" 返回首页 ")])),_:1}),"failed"===p($)?(d(),l(a,{key:0,class:"check-btn ss-reset-button",onClick:s[1]||(s[1]=e=>p(u).$router.redirect("/pages/pay/index",{orderSN:h.orderId}))},{default:c((()=>[y(" 重新支付 ")])),_:1})):f("",!0),"success"===p($)?(d(),l(a,{key:1,class:"check-btn ss-reset-button",onClick:w},{default:c((()=>[y(" 查看订单 ")])),_:1})):f("",!0),"success"===p($)&&["groupon","groupon_ladder"].includes(h.orderInfo.activity_type)?(d(),l(a,{key:2,class:"check-btn ss-reset-button",onClick:s[2]||(s[2]=e=>p(u).$router.redirect("/pages/activity/groupon/order"))},{default:c((()=>[y(" 我的拼团 ")])),_:1})):f("",!0)])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-6527785b"]]);export{h as default};
