pay.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. (global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/money/pay" ], {
  2. 225: function(e, n, t) {
  3. (function(e) {
  4. function n(e) {
  5. return e && e.__esModule ? e : {
  6. default: e
  7. };
  8. }
  9. t(4), n(t(2)), e(n(t(226)).default);
  10. }).call(this, t(1).createPage);
  11. },
  12. 226: function(e, n, t) {
  13. t.r(n);
  14. var r = t(227), o = t(229);
  15. for (var a in o) "default" !== a && function(e) {
  16. t.d(n, e, function() {
  17. return o[e];
  18. });
  19. }(a);
  20. t(231);
  21. var i = t(13), c = Object(i.default)(o.default, r.render, r.staticRenderFns, !1, null, null, null, !1, r.components, void 0);
  22. c.options.__file = "pages/money/pay.vue", n.default = c.exports;
  23. },
  24. 227: function(e, n, t) {
  25. t.r(n);
  26. var r = t(228);
  27. t.d(n, "render", function() {
  28. return r.render;
  29. }), t.d(n, "staticRenderFns", function() {
  30. return r.staticRenderFns;
  31. }), t.d(n, "recyclableRender", function() {
  32. return r.recyclableRender;
  33. }), t.d(n, "components", function() {
  34. return r.components;
  35. });
  36. },
  37. 228: function(e, n, t) {
  38. t.r(n), t.d(n, "render", function() {
  39. return r;
  40. }), t.d(n, "staticRenderFns", function() {
  41. return a;
  42. }), t.d(n, "recyclableRender", function() {
  43. return o;
  44. }), t.d(n, "components", function() {});
  45. var r = function() {
  46. var e = this;
  47. e.$createElement;
  48. e._self._c, e._isMounted || (e.e0 = function(n) {
  49. !e.payLoding && e.confirm();
  50. });
  51. }, o = !1, a = [];
  52. r._withStripped = !0;
  53. },
  54. 229: function(e, n, t) {
  55. t.r(n);
  56. var r = t(230), o = t.n(r);
  57. for (var a in r) "default" !== a && function(e) {
  58. t.d(n, e, function() {
  59. return r[e];
  60. });
  61. }(a);
  62. n.default = o.a;
  63. },
  64. 230: function(e, n, t) {
  65. (function(e) {
  66. function r(e, n, t, r, o, a, i) {
  67. try {
  68. var c = e[a](i), s = c.value;
  69. } catch (e) {
  70. return void t(e);
  71. }
  72. c.done ? n(s) : Promise.resolve(s).then(r, o);
  73. }
  74. function o(e) {
  75. return function() {
  76. var n = this, t = arguments;
  77. return new Promise(function(o, a) {
  78. function i(e) {
  79. r(s, o, a, i, c, "next", e);
  80. }
  81. function c(e) {
  82. r(s, o, a, i, c, "throw", e);
  83. }
  84. var s = e.apply(n, t);
  85. i(void 0);
  86. });
  87. };
  88. }
  89. function a(e, n) {
  90. var t = Object.keys(e);
  91. if (Object.getOwnPropertySymbols) {
  92. var r = Object.getOwnPropertySymbols(e);
  93. n && (r = r.filter(function(n) {
  94. return Object.getOwnPropertyDescriptor(e, n).enumerable;
  95. })), t.push.apply(t, r);
  96. }
  97. return t;
  98. }
  99. function i(e, n, t) {
  100. return n in e ? Object.defineProperty(e, n, {
  101. value: t,
  102. enumerable: !0,
  103. configurable: !0,
  104. writable: !0
  105. }) : e[n] = t, e;
  106. }
  107. Object.defineProperty(n, "__esModule", {
  108. value: !0
  109. }), n.default = void 0;
  110. var c = function(e) {
  111. return e && e.__esModule ? e : {
  112. default: e
  113. };
  114. }(t(23)), s = t(197), u = {
  115. data: function() {
  116. return {
  117. payType: 1,
  118. payName: "weixin",
  119. orderInfo: {},
  120. money: 0,
  121. now_money: 0,
  122. consumer: 0,
  123. orderKey: "",
  124. orderId: "",
  125. payLoding: !1,
  126. type: "",
  127. pinkid: "",
  128. checkedPoints: "",
  129. goodsType: 0
  130. };
  131. },
  132. computed: function(e) {
  133. for (var n = 1; n < arguments.length; n++) {
  134. var t = null != arguments[n] ? arguments[n] : {};
  135. n % 2 ? a(Object(t), !0).forEach(function(n) {
  136. i(e, n, t[n]);
  137. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : a(Object(t)).forEach(function(n) {
  138. Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n));
  139. });
  140. }
  141. return e;
  142. }({}, (0, t(6).mapState)("user", [ "userInfo" ])),
  143. onLoad: function(n) {
  144. var t = this;
  145. if (console.log(e.getStorageSync("token")), this.goodsType = +n.goodsType || 0,
  146. 1 == n.type) this.type = 1, this.orderId = n.ordid, this.money = n.money, 1 == n.payType && (this.checkedPoints = !0); else {
  147. this.orderKey = n.key;
  148. var r = this.$api.prePage();
  149. this.checkedPoints = r.checkedPoints, (0, s.computedOrderkey)({
  150. orderkey: this.orderKey,
  151. addressId: r.addressData.id,
  152. useIntegral: r.checkedPoints ? 1 : 0,
  153. is_change: r.is_change ? 1 : 0,
  154. shipping_type: r.tabCurrentIndex + 1
  155. }).then(function(e) {
  156. var n = e.data;
  157. t.money = n.result.pay_price;
  158. }), n.pinkid && (this.pinkid = n.pinkid);
  159. }
  160. (0, s.balance)({}).then(function(e) {
  161. var n = e.data;
  162. t.now_money = n.now_money, t.consumer = n.consumer;
  163. });
  164. },
  165. methods: {
  166. changePayType: function(e) {
  167. this.payType = e, 1 == this.payType && (this.payName = "weixin"), 2 == this.payType && (this.payName = "ali"),
  168. 3 == this.payType && (this.payName = "yue"), 4 == this.payType && (this.payName = "offline");
  169. },
  170. orderMoneyPay: function() {
  171. var e = this, n = {
  172. uni: e.orderId,
  173. from: "routine",
  174. paytype: e.payName
  175. };
  176. console.log(n), (0, s.orderPay)(n).then(function(n) {
  177. if (console.log(n), "yue" == e.payName && (200 == n.status && "SUCCESS" == n.data.status ? e.paySuccessTo() : e.$api.msg(msg)),
  178. "weixin" == e.payName) {
  179. var t = n.data.result.jsConfig;
  180. wx.requestPayment({
  181. timeStamp: t.timestamp,
  182. nonceStr: t.nonceStr,
  183. package: t.package,
  184. signType: t.signType,
  185. paySign: t.paySign,
  186. success: function(n) {
  187. e.paySuccessTo();
  188. }
  189. });
  190. }
  191. "offline" == e.payName && (200 == n.status && "SUCCESS" == n.data.status ? e.paySuccessTo() : e.$api.msg(msg)),
  192. e.payLoding = !1;
  193. }).catch(function(n) {
  194. e.payLoding = !1, console.log(n);
  195. });
  196. },
  197. paySuccessTo: function() {
  198. e.redirectTo({
  199. url: "/pages/money/paySuccess?orderid=" + this.orderId
  200. });
  201. },
  202. confirm: function() {
  203. var n = o(c.default.mark(function n() {
  204. var t;
  205. return c.default.wrap(function(n) {
  206. for (;;) switch (n.prev = n.next) {
  207. case 0:
  208. if (!("yue" == (t = this).payName && +t.now_money < t.money)) {
  209. n.next = 4;
  210. break;
  211. }
  212. return e.showModal({
  213. title: "提示",
  214. content: "账户余额不足!",
  215. showCancel: !1,
  216. success: function(e) {},
  217. fail: function() {},
  218. complete: function() {}
  219. }), n.abrupt("return");
  220. case 4:
  221. if (!("consumer" == t.payName && +t.consumer < t.money)) {
  222. n.next = 7;
  223. break;
  224. }
  225. return e.showModal({
  226. title: "提示",
  227. content: "账户消费券不足!",
  228. showCancel: !1,
  229. success: function(e) {},
  230. fail: function() {},
  231. complete: function() {}
  232. }), n.abrupt("return");
  233. case 7:
  234. t.payLoding = !0, 1 != t.type ? t.firstCreateOrder() : t.orderMoneyPay();
  235. case 9:
  236. case "end":
  237. return n.stop();
  238. }
  239. }, n, this);
  240. }));
  241. return function() {
  242. return n.apply(this, arguments);
  243. };
  244. }(),
  245. firstCreateOrder: function() {
  246. var n = this, t = n.$api.prePage(),
  247. r = {
  248. real_name: t.addressData.real_name,
  249. phone: t.addressData.phone,
  250. addressId: t.addressData.id,
  251. useIntegral: t.checkedPoints ? 1 : 0,
  252. payType: n.payName,
  253. mark: t.desc,
  254. from: "routine",
  255. store_id:t.shopAddress.id,
  256. shipping_type: t.tabCurrentIndex + 1,
  257. is_change: t.is_change ? 1 : 0,
  258. code: this.userInfo.code
  259. };
  260. console.log(t.shopAddress), console.log(n.payName), n.pinkid && (r.pinkId = n.pinkid), (0, s.createOrderkey)(r, n.orderKey).then(function(t) {
  261. var r = t.data, o = t.status, a = t.msg;
  262. if ("ORDER_EXIST" == r.status) return e.showModal({
  263. title: "提示",
  264. content: a,
  265. showCancel: !1
  266. }), void (n.payLoding = !1);
  267. 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,
  268. n.$api.msg(a)) : n.orderMoneyPay() : n.paySuccessTo();
  269. }).catch(function(e) {
  270. n.payLoding = !1, console.log(e);
  271. });
  272. }
  273. }
  274. };
  275. n.default = u;
  276. }).call(this, t(1).default);
  277. },
  278. 231: function(e, n, t) {
  279. t.r(n);
  280. var r = t(232), o = t.n(r);
  281. for (var a in r) "default" !== a && function(e) {
  282. t.d(n, e, function() {
  283. return r[e];
  284. });
  285. }(a);
  286. n.default = o.a;
  287. },
  288. 232: function(e, n, t) {}
  289. }, [ [ 225, "common/runtime", "common/vendor" ] ] ]);