var yz_pay = require("../../../mycomponent/yz_pay/yz_pay"); var app = getApp(); Page({ behaviors: [yz_pay], data: { language: "", isclick: true, order_id: "", store_id: "", orderData: null, balance: 0, payParams: "", info_form: {}, order_sn: "", money: "", buttons: [], pay_sn: "订单编号", order_pay_id: "", uid: "", pid: "", status: "", //消费红包 showPacket: false, redirectData: {}, cbHref: {}, is_cps: false, senceKey: "", }, fromChild(e){ if(this.data.money=='0.00') { // 0元 this.sureBtn(); }else { let datas = e.detail.submitArr; this.confirm(datas); } }, onClickHide() { this.setData({ showPacket: false, }); this.toRedirect(); }, toPacket() { wx.redirectTo({ url: "/packageE/ConsumePacket/ConsumePacketSuccess/ConsumePacketSuccess?order_id=" + this.data.order_id.toString(), }); }, confirm(e) { console.log(e); let type = e.value; let btn = e; this.handlePay(btn, type); }, onLoad: function (options) { var that = this; let syinfo = wx.getLaunchOptionsSync(); // 获取场景值 this.setData({ senceKey: syinfo.scene, }); console.log("options:", options); if (options.iscps) { // 如果是聚合cps的话就跳转到卡密页面 this.data.is_cps = true; } if (options.name) { that.setData({ name: options.name, }); } if (options.pid) { that.setData({ pid: options.pid, }); } if (options.tag) { that.setData({ tag: options.tag, }); } that.setData({ order_id: options.order_id, }); if (options.status) { that.setData({ status: options.status, }); } if (options.store_id) { that.setData({ store_id: options.store_id, }); } var _url = null; if (options.api) { if (options.api != "order.operation.pay") { _url = app.getNetAddresss(options.api); } else { _url = app.getNetAddresss("order.merge-pay"); } } else { _url = app.getNetAddresss("order.merge-pay"); } // console.log(options) if (options.status && options.status == 2) { // 合并支付 if (typeof options.order_id == "string") { _url += "&order_ids=" + options.order_id; } else { _url += "&order_ids=" + JSON.parse(options.order_id).toString(); } } else { _url += "&order_ids=" + options.order_id; } app._getNetWork({ url: _url, success: function (res) { var _data = res.data.data; console.log("PayResult::::", _data); if (res.data.result == 1) { that.hanleIcon(_data); that.setData({ // 购物车ID order_sn: _data.order_pay.pay_sn, balance: _data.member.credit2, money: _data.order_pay.amount.toFixed(2), uid: _data.order_pay.uid, buttons: _data.buttons, min_url: _data.min_redirect_url, }); that.data.order_pay_id = _data.order_pay.id; // 支付id if(that.data.buttons && that.data.buttons.length == 0){ wx.showToast({ title: '平台未开启任何支付方式,请联系客服', icon: 'none' }); } } else { wx.showToast({ title: res.data.msg, icon: "success", duration: 2000, }); console.log("错误", res.data.msg); } }, }); }, onReady: function () { let language = wx.getStorageSync("langIndex"); this.setData({ language: language.en, }); // 页面渲染完成 }, onShow: function () { // 页面显示 }, onHide: function () { this.data.isPayClick = false; // 页面隐藏 }, onUnload: function () { // 页面关闭 if (this.data.tag == "activity") { wx.navigateBack({ delta: 1, }); } if(this.data.name == 'Myshaky'){ wx.navigateBack({ delta: 1, }); } }, });