"use strict";var e=require("../common/vendor.js"),r=require("../api/storeOrder.js");require("../common/request.js");const o={data:()=>({payMethod:null,orderId:null,order:null}),onLoad(e){this.orderId=e.orderId,this.payMethod=e.payMethod},onShow(){this.getStoreOrderById()},methods:{copyTest(r){e.index.setClipboardData({data:r,success:()=>{e.index.showToast({title:"内容已成功复制到剪切板",icon:"none"})}})},getStoreOrderById(){var e={orderId:this.orderId};console.log(e),r.getStoreOrderById(e).then((e=>{200==e.code&&(this.order=e.order,null!=this.payMethod&&"app"==this.payMethod&&this.payOrder())}),(e=>{}))},payOrder(){var o={orderId:this.orderId},d=this;e.index.showLoading(),r.payment(o).then((r=>{if(200==r.code)if(1==r.isPay)e.index.redirectTo({url:"/pages_order/storeOrderPaySuccess?orderId="+d.order.orderId});else if("tz"==r.type&&(e.index.setStorageSync("ztPayUrl",r.data.body.url),e.index.redirectTo({url:"/pages_order/tzPay"})),"yb"==r.type){var o=JSON.parse(r.data.pay_info);console.log(o),e.index.requestPayment({provider:"wxpay",timeStamp:o.timeStamp,nonceStr:o.nonceStr,package:o.package,signType:o.signType,paySign:o.paySign,success:function(r){console.log(d.order.orderId),e.index.hideLoading(),e.index.redirectTo({url:"./storeOrderPaySuccess?orderId="+d.order.orderId})},fail:function(r){e.index.showToast({icon:"none",title:"fail:"+JSON.stringify(r)}),e.index.hideLoading()}})}else if("hf"==r.type){o=JSON.parse(r.data.pay_info);console.log(o),e.index.requestPayment({provider:"wxpay",timeStamp:o.timeStamp,nonceStr:o.nonceStr,package:o.package,signType:o.signType,paySign:o.paySign,success:function(r){console.log(d.order.orderId),e.index.hideLoading(),e.index.redirectTo({url:"./storeOrderPaySuccess?orderId="+d.order.orderId})},fail:function(r){e.index.showToast({icon:"none",title:"fail:"+JSON.stringify(r)}),e.index.hideLoading()}})}else"wx"==r.type&&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(r){console.log(d.order.orderId),e.index.hideLoading(),e.index.redirectTo({url:"./storeOrderPaySuccess?orderId="+d.order.orderId})},fail:function(r){e.index.showToast({icon:"none",title:"fail:"+JSON.stringify(r)}),e.index.hideLoading()}});else e.index.showToast({icon:"none",title:r.msg})}),(e=>{}))}}};var d=e._export_sfc(o,[["render",function(r,o,d,n,t,i){return e.e({a:null!=t.order},null!=t.order?{b:e.t(t.order.payMoney.toFixed(2)),c:e.t(t.order.orderSn),d:e.o((e=>i.copyTest(t.order.orderSn))),e:e.t(t.order.createTime)}:{},{f:null!=t.order},null!=t.order?{g:e.o((e=>i.payOrder()))}:{})}]]);wx.createPage(d);
