"use strict";var e=require("../common/vendor.js"),t=require("../api/packageOrder.js");require("../common/request.js");const s={data(){return{payMethod:null,orderId:null,order:null}},onLoad(i){this.orderId=i.orderId,this.payMethod=i.payMethod},onShow(){this.getPackageOrderById()},methods:{copyTest(i){e.index.setClipboardData({data:i,success:()=>{e.index.showToast({title:"\u5185\u5BB9\u5DF2\u6210\u529F\u590D\u5236\u5230\u526A\u5207\u677F",icon:"none"})}})},getPackageOrderById(){var i={orderId:this.orderId};console.log(i),t.getPackageOrderById(i).then(n=>{n.code==200&&(this.order=n.order,this.payMethod!=null&&this.payMethod=="app"&&this.payOrder())},n=>{})},payOrder(){var i={orderId:this.orderId},n=this;e.index.showLoading(),t.payment(i).then(r=>{if(r.code==200)if(r.isPay==0)if(r.type=="tz"&&(e.index.setStorageSync("ztPayUrl",r.data.body.url),e.index.navigateTo({url:"/pages_order/tzPay"})),r.type=="yb"){var d=JSON.parse(r.data.pay_info);console.log(d),e.index.requestPayment({provider:"wxpay",timeStamp:d.timeStamp,nonceStr:d.nonceStr,package:d.package,signType:d.signType,paySign:d.paySign,success:function(o){console.log(n.order.orderId),e.index.hideLoading(),e.index.redirectTo({url:"./packageOrderPaySuccess?orderId="+n.order.orderId})},fail:function(o){e.index.showToast({icon:"none",title:"fail:"+JSON.stringify(o)}),e.index.hideLoading()}})}else if(r.type=="hf"){var d=JSON.parse(r.data.pay_info);console.log(d),e.index.requestPayment({provider:"wxpay",timeStamp:d.timeStamp,nonceStr:d.nonceStr,package:d.package,signType:d.signType,paySign:d.paySign,success:function(a){console.log(n.order.orderId),e.index.hideLoading(),e.index.redirectTo({url:"./packageOrderPaySuccess?orderId="+n.order.orderId})},fail:function(a){e.index.showToast({icon:"none",title:"fail:"+JSON.stringify(a)}),e.index.hideLoading()}})}else r.type=="wx"&&e.index.requestPayment({provider:"wxpay",timeStamp:r.data.timeStamp,nonceStr:r.data.nonceStr,package:r.data.packageValue,signType:r.data.signType,paySign:r.data.paySign,success:function(o){console.log(n.order.orderId),e.index.hideLoading(),e.index.redirectTo({url:"./packageOrderPaySuccess?orderId="+n.order.orderId})},fail:function(o){e.index.showToast({icon:"none",title:"fail:"+JSON.stringify(o)}),e.index.hideLoading()}});else e.index.hideLoading(),e.index.redirectTo({url:"./packageOrderPaySuccess?orderId="+n.order.orderId});else e.index.showToast({icon:"none",title:r.msg})},r=>{})}}};function p(i,n,r,d,o,a){return e.e({a:o.order!=null},o.order!=null?{b:e.t(o.order.payMoney.toFixed(2)),c:e.t(o.order.orderSn),d:e.o(c=>a.copyTest(o.order.orderSn)),e:e.t(o.order.createTime)}:{},{f:o.order!=null},o.order!=null?{g:e.o(c=>a.payOrder())}:{})}var g=e._export_sfc(s,[["render",p],["__file","E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_order/packagePayment.vue"]]);wx.createPage(g);
