(global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/money/pay" ], { 225: function(e, n, t) { (function(e) { function n(e) { return e && e.__esModule ? e : { default: e }; } t(4), n(t(2)), e(n(t(226)).default); }).call(this, t(1).createPage); }, 226: function(e, n, t) { t.r(n); var r = t(227), o = t(229); for (var a in o) "default" !== a && function(e) { t.d(n, e, function() { return o[e]; }); }(a); t(231); var i = t(13), c = Object(i.default)(o.default, r.render, r.staticRenderFns, !1, null, null, null, !1, r.components, void 0); c.options.__file = "pages/money/pay.vue", n.default = c.exports; }, 227: function(e, n, t) { t.r(n); var r = t(228); t.d(n, "render", function() { return r.render; }), t.d(n, "staticRenderFns", function() { return r.staticRenderFns; }), t.d(n, "recyclableRender", function() { return r.recyclableRender; }), t.d(n, "components", function() { return r.components; }); }, 228: function(e, n, t) { t.r(n), t.d(n, "render", function() { return r; }), t.d(n, "staticRenderFns", function() { return a; }), t.d(n, "recyclableRender", function() { return o; }), t.d(n, "components", function() {}); var r = function() { var e = this; e.$createElement; e._self._c, e._isMounted || (e.e0 = function(n) { !e.payLoding && e.confirm(); }); }, o = !1, a = []; r._withStripped = !0; }, 229: function(e, n, t) { t.r(n); var r = t(230), o = t.n(r); for (var a in r) "default" !== a && function(e) { t.d(n, e, function() { return r[e]; }); }(a); n.default = o.a; }, 230: function(e, n, t) { (function(e) { function r(e, n, t, r, o, a, i) { try { var c = e[a](i), s = c.value; } catch (e) { return void t(e); } c.done ? n(s) : Promise.resolve(s).then(r, o); } function o(e) { return function() { var n = this, t = arguments; return new Promise(function(o, a) { function i(e) { r(s, o, a, i, c, "next", e); } function c(e) { r(s, o, a, i, c, "throw", e); } var s = e.apply(n, t); i(void 0); }); }; } function a(e, n) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var r = Object.getOwnPropertySymbols(e); n && (r = r.filter(function(n) { return Object.getOwnPropertyDescriptor(e, n).enumerable; })), t.push.apply(t, r); } return t; } function i(e, n, t) { return n in e ? Object.defineProperty(e, n, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = t, e; } Object.defineProperty(n, "__esModule", { value: !0 }), n.default = void 0; var c = function(e) { return e && e.__esModule ? e : { default: e }; }(t(23)), s = t(197), u = { data: function() { return { payType: 1, payName: "weixin", orderInfo: {}, money: 0, now_money: 0, consumer: 0, orderKey: "", orderId: "", payLoding: !1, type: "", pinkid: "", checkedPoints: "", goodsType: 0 }; }, computed: function(e) { for (var n = 1; n < arguments.length; n++) { var t = null != arguments[n] ? arguments[n] : {}; n % 2 ? a(Object(t), !0).forEach(function(n) { i(e, n, t[n]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : a(Object(t)).forEach(function(n) { Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n)); }); } return e; }({}, (0, t(6).mapState)("user", [ "userInfo" ])), onLoad: function(n) { var t = this; if (console.log(e.getStorageSync("token")), this.goodsType = +n.goodsType || 0, 1 == n.type) this.type = 1, this.orderId = n.ordid, this.money = n.money, 1 == n.payType && (this.checkedPoints = !0); else { this.orderKey = n.key; var r = this.$api.prePage(); this.checkedPoints = r.checkedPoints, (0, s.computedOrderkey)({ orderkey: this.orderKey, addressId: r.addressData.id, useIntegral: r.checkedPoints ? 1 : 0, is_change: r.is_change ? 1 : 0, shipping_type: r.tabCurrentIndex + 1 }).then(function(e) { var n = e.data; t.money = n.result.pay_price; }), n.pinkid && (this.pinkid = n.pinkid); } (0, s.balance)({}).then(function(e) { var n = e.data; t.now_money = n.now_money, t.consumer = n.consumer; }); }, methods: { changePayType: function(e) { this.payType = e, 1 == this.payType && (this.payName = "weixin"), 2 == this.payType && (this.payName = "ali"), 3 == this.payType && (this.payName = "yue"), 4 == this.payType && (this.payName = "offline"); }, orderMoneyPay: function() { var e = this, n = { uni: e.orderId, from: "routine", paytype: e.payName }; console.log(n), (0, s.orderPay)(n).then(function(n) { if (console.log(n), "yue" == e.payName && (200 == n.status && "SUCCESS" == n.data.status ? e.paySuccessTo() : e.$api.msg(msg)), "weixin" == e.payName) { var t = n.data.result.jsConfig; wx.requestPayment({ timeStamp: t.timestamp, nonceStr: t.nonceStr, package: t.package, signType: t.signType, paySign: t.paySign, success: function(n) { e.paySuccessTo(); } }); } "offline" == e.payName && (200 == n.status && "SUCCESS" == n.data.status ? e.paySuccessTo() : e.$api.msg(msg)), e.payLoding = !1; }).catch(function(n) { e.payLoding = !1, console.log(n); }); }, paySuccessTo: function() { e.redirectTo({ url: "/pages/money/paySuccess?orderid=" + this.orderId }); }, confirm: function() { var n = o(c.default.mark(function n() { var t; return c.default.wrap(function(n) { for (;;) switch (n.prev = n.next) { case 0: if (!("yue" == (t = this).payName && +t.now_money < t.money)) { n.next = 4; break; } return e.showModal({ title: "提示", content: "账户余额不足!", showCancel: !1, success: function(e) {}, fail: function() {}, complete: function() {} }), n.abrupt("return"); case 4: if (!("consumer" == t.payName && +t.consumer < t.money)) { n.next = 7; break; } return e.showModal({ title: "提示", content: "账户消费券不足!", showCancel: !1, success: function(e) {}, fail: function() {}, complete: function() {} }), n.abrupt("return"); case 7: t.payLoding = !0, 1 != t.type ? t.firstCreateOrder() : t.orderMoneyPay(); case 9: case "end": return n.stop(); } }, n, this); })); return function() { return n.apply(this, arguments); }; }(), firstCreateOrder: function() { var n = this, t = n.$api.prePage(), r = { real_name: t.addressData.real_name, phone: t.addressData.phone, addressId: t.addressData.id, useIntegral: t.checkedPoints ? 1 : 0, payType: n.payName, mark: t.desc, from: "routine", store_id:t.shopAddress.id, shipping_type: t.tabCurrentIndex + 1, is_change: t.is_change ? 1 : 0, code: this.userInfo.code }; console.log(t.shopAddress), console.log(n.payName), n.pinkid && (r.pinkId = n.pinkid), (0, s.createOrderkey)(r, n.orderKey).then(function(t) { var r = t.data, o = t.status, a = t.msg; if ("ORDER_EXIST" == r.status) return e.showModal({ title: "提示", content: a, showCancel: !1 }), void (n.payLoding = !1); n.orderId = r.result.orderId, "SUCCESS" != r.status || "weixin" != n.payName || "微信支付成功" != a ? "yue" == n.payName || "consumer" == n.payName ? 200 == o ? n.paySuccessTo() : (n.payLoding = !1, n.$api.msg(a)) : n.orderMoneyPay() : n.paySuccessTo(); }).catch(function(e) { n.payLoding = !1, console.log(e); }); } } }; n.default = u; }).call(this, t(1).default); }, 231: function(e, n, t) { t.r(n); var r = t(232), o = t.n(r); for (var a in r) "default" !== a && function(e) { t.d(n, e, function() { return r[e]; }); }(a); n.default = o.a; }, 232: function(e, n, t) {} }, [ [ 225, "common/runtime", "common/vendor" ] ] ]);