You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
3.8 KiB
2 lines
3.8 KiB
"use strict";const r=require("../../common/vendor.js"),u=require("../../sheep/index.js"),f=require("../../sheep/api/pay/order.js"),_=require("../../sheep/hooks/useGoods.js"),y=require("../../sheep/api/trade/order.js");require("../../sheep/url/index.js");require("../../sheep/store/index.js");require("../../sheep/store/app.js");require("../../sheep/platform/index.js");require("../../sheep/platform/provider/wechat/index.js");require("../../sheep/platform/provider/wechat/miniProgram.js");require("../../sheep/api/member/auth.js");require("../../sheep/request/index.js");require("../../sheep/config/index.js");require("../../sheep/helper/index.js");require("../../sheep/helper/test.js");require("../../sheep/helper/digit.js");require("../../sheep/api/member/social.js");require("../../sheep/api/member/user.js");require("../../sheep/platform/provider/apple/index.js");require("../../sheep/platform/share.js");require("../../sheep/router/index.js");require("../../sheep/hooks/useModal.js");require("../../sheep/helper/throttle.js");require("../../sheep/platform/pay.js");require("../../sheep/store/user.js");require("../../sheep/store/cart.js");require("../../sheep/api/trade/cart.js");require("../../sheep/api/pay/wallet.js");require("../../sheep/store/sys.js");require("../../sheep/store/modal.js");require("../../sheep/config/zIndex.js");Array||r.resolveComponent("s-layout")();const g=()=>"../../sheep/components/s-layout/s-layout.js";Math||g();const q={__name:"result",setup(d){const e=r.reactive({id:0,orderType:"goods",result:"unpaid",orderInfo:{},tradeOrder:{},counter:0}),i=r.computed(()=>{if(e.result==="unpaid")return"waiting";if(e.result==="paid")return"success";if(e.result==="failed")return"failed";if(e.result==="closed")return"closed"});async function s(a){e.counter++;const{data:t,code:o}=await f.PayOrderApi.getOrder(a);if(o===0){if(e.orderInfo=t,!e.orderInfo||e.orderInfo.status===30){e.result="closed";return}if(e.orderInfo.status!==0){if(e.result="paid",n(),e.orderType==="goods"){const{data:l,code:p}=await y.OrderApi.getOrder(e.orderInfo.merchantOrderId);p===0&&(e.tradeOrder=l)}return}}e.counter<3&&e.result==="unpaid"&&setTimeout(()=>{s(a)},1500),e.counter>=3&&(e.result="failed")}function n(){let a=["order_dispatched"];e.tradeOrder.type===3&&(a.push("groupon_finish"),a.push("groupon_fail")),u.sheep.$platform.useProvider("wechat").subscribeMessage(a)}function c(){let a=r.index.getStorageSync("pay_type");a=="vip"?r.index.navigateBack({delta:2}):a=="套餐支付"?r.index.reLaunch({url:"/pages/subpackages/mapnvue"}):a=="结束行程"?r.index.navigateBack({delta:2}):r.index.navigateBack({delta:2})}return r.onLoad(async a=>{a.id&&(e.id=a.id),a.orderType&&(e.orderType=a.orderType),a.payState==="fail"?e.result="failed":await s(e.id)}),r.onShow(()=>{r.lodashExports.isEmpty(e.orderInfo)||s(e.id)}),r.onHide(()=>{e.result="unpaid",e.counter=0}),(a,t)=>r.e({a:i.value==="waiting"},i.value==="waiting"?{}:{},{b:i.value==="success"},i.value==="success"?{c:r.unref(u.sheep).$url.static("/static/img/shop/order/order_pay_success.gif")}:{},{d:["failed","closed"].includes(i.value)},["failed","closed"].includes(i.value)?{e:r.unref(u.sheep).$url.static("/static/img/shop/order/order_paty_fail.gif")}:{},{f:i.value==="success"},i.value==="success"?{}:{},{g:i.value==="failed"},i.value==="failed"?{}:{},{h:i.value==="closed"},i.value==="closed"?{}:{},{i:i.value==="waiting"},i.value==="waiting"?{}:{},{j:i.value==="success"},i.value==="success"?{k:r.t(r.unref(_.fen2yuan)(e.orderInfo.price))}:{},{l:r.o(c),m:i.value==="failed"},i.value==="failed"?{n:r.o(o=>r.unref(u.sheep).$router.redirect("/pages/pay/index",{id:e.id,orderType:e.orderType}))}:{},{o:r.p({title:"支付结果",bgStyle:{color:"#FFF"}})})}},v=r._export_sfc(q,[["__scopeId","data-v-42b1ec48"],["__file","D:/xiangmu/佰安出行/app/s-applet/pages/pay/result.vue"]]);wx.createPage(v);
|