"use strict"; const common_vendor = require("../../common/vendor.js"); const _sfc_main = { __name: "index", setup(__props) { const amount = common_vendor.ref(""); const loading = common_vendor.ref(false); const statusMessage = common_vendor.ref(""); common_vendor.ref({ timeStamp: "1747983532", package: "prepay_id=wx23145806465232c82870c59d2d41cf0000", paySign: "0pUqj2JZ77BYchyJuthQyP4yRfqhjvwag78Q4IMnIyQ3/OQP6OyJreZfmj0GFSEMrRsKAHIdBBM7tVnot0aaRhI5qwSOWpzyvJCkYa4eqPgqlV4XYVMqE3zeB/Cx4C9bv4poMXnaGlfFPdkhMYbUcdtsw4gBXXhqUx//9x7eu9cOERRzLquM8Z8rewRpar/kkVKSCV6h8pX19kRj+KEkK5LZB8IUIG995g1lsVFOqdO4mVFBJ1wZCkwJczgVI+jdNGgnR2lpdjwIpJFm+5Hm0y9SwR0UFvgkm95NrmY+Sruty/Zf8ekQwF4+atubW8CE6i8wm2zZpMEnnfS4WFwAwg==", appId: "wx8fc3e4305d2fbf0b", signType: "RSA", nonceStr: "DxpF2uIMl0VM7vPOG7pWnPHk2Dvi3V7K" }); function callWeixinPay(data) { const invokePay = () => { window.WeixinJSBridge.invoke( "getBrandWCPayRequest", { appId: data.appId, timeStamp: data.timeStamp, nonceStr: data.nonceStr, package: data.package, signType: data.signType, paySign: data.paySign }, function(res) { loading.value = false; if (res.err_msg === "get_brand_wcpay_request:ok") { statusMessage.value = "支付成功"; } else { statusMessage.value = "支付失败或取消"; } } ); }; if (typeof window.WeixinJSBridge === "undefined") { document.addEventListener("WeixinJSBridgeReady", invokePay, false); } else { invokePay(); } } const diaoqu = () => { const urlpost = `${saveurl.value}/weiXinPay/native`; const payload = { title: "测试", openId: openid.value, amountPrice: amount.value }; common_vendor.index.__f__("log", "at pages/pay/index.vue:69", "???/", payload); fetch(urlpost, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then((res) => res.json()).then((data) => { callWeixinPay(data); }).catch((err) => { common_vendor.index.__f__("error", "at pages/pay/index.vue:84", "请求失败:", err); }); }; const saveurl = common_vendor.ref(""); const openid = common_vendor.ref(""); function initiatePayment() { if (!amount.value) return; loading.value = true; statusMessage.value = "拉起微信支付..."; common_vendor.index.getStorage({ key: "serverUrl", success: function(res) { common_vendor.index.__f__("log", "at pages/pay/index.vue:96", "读取缓存:", res.data.url); saveurl.value = res.data.url; } }); common_vendor.index.getStorage({ key: "openid", success: function(res) { common_vendor.index.__f__("log", "at pages/pay/index.vue:104", "读取缓存:", res.data.openid); openid.value = res.data.openid; } }); diaoqu(); } return (_ctx, _cache) => { return common_vendor.e({ a: amount.value, b: common_vendor.o(($event) => amount.value = $event.detail.value), c: common_vendor.o(initiatePayment), d: loading.value || !amount.value, e: statusMessage.value }, statusMessage.value ? { f: common_vendor.t(statusMessage.value) } : {}); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d7fd7b38"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/pay/index.js.map