@zhangcf233/pay 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pay.es.js CHANGED
@@ -1,22 +1,22 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('@charset "UTF-8";.pay-error-container[data-v-0817c014]{position:relative}.pay-error-container .loading[data-v-0817c014]{width:100%;height:100%;position:absolute;background:#fff;z-index:1;transition:all .3s;justify-content:center;align-items:center}.pay-error-container .message[data-v-0817c014]{font-size:.1rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-75290345]{font-family:WeChat-Bold}.root[data-v-75290345]{text-align:center}.cell[data-v-4e4c306e]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-4e4c306e]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-ea027830]{font-family:WeChat-Bold}.custom-price .input[data-v-ea027830]{font-size:.2rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-68d98a5c]{font-family:WeChat-Bold}.price-root[data-v-68d98a5c]{position:relative;text-align:center;background:#f3f3f3;border-radius:.08rem;padding:.1rem 0;display:flex;flex-direction:column;height:.6rem;box-sizing:border-box;justify-content:space-between;align-items:center}.price-root .gift[data-v-68d98a5c]{position:absolute;top:-.1rem;right:-.05rem;background:linear-gradient(248.45deg,#fa1e1e,#ff7752 99.44%);padding:0 .05rem;border-radius:.1rem .1rem .1rem 0;font-size:.1rem;border-width:.02rem;border-color:#fff;border-style:solid;box-sizing:border-box;color:#fff}.price-root .token-count[data-v-68d98a5c]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-68d98a5c]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-68d98a5c]{font-size:.14rem}.only-price[data-v-68d98a5c]{align-items:center;justify-content:center}.only-price .price[data-v-68d98a5c]{font-size:.2rem}.content[data-v-76333b1f]{width:100%;margin:.2rem 0;display:grid;grid-template-columns:repeat(3,1fr);gap:.1rem;box-sizing:border-box;font-weight:500}.loading[data-v-76333b1f]{display:flex;justify-content:center;align-items:center}.select[data-v-76333b1f]{color:#fff}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-74a1db46]{font-family:WeChat-Bold}.pay-popup[data-v-74a1db46]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-74a1db46]{text-align:center;margin:.16rem 0}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('@charset "UTF-8";.pay-error-container[data-v-0817c014]{position:relative}.pay-error-container .loading[data-v-0817c014]{width:100%;height:100%;position:absolute;background:#fff;z-index:1;transition:all .3s;justify-content:center;align-items:center}.pay-error-container .message[data-v-0817c014]{font-size:.1rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-75290345]{font-family:WeChat-Bold}.root[data-v-75290345]{text-align:center}.cell[data-v-4e4c306e]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-4e4c306e]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-ea027830]{font-family:WeChat-Bold}.custom-price .input[data-v-ea027830]{font-size:.2rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-68d98a5c]{font-family:WeChat-Bold}.price-root[data-v-68d98a5c]{position:relative;text-align:center;background:#f3f3f3;border-radius:.08rem;padding:.1rem 0;display:flex;flex-direction:column;height:.6rem;box-sizing:border-box;justify-content:space-between;align-items:center}.price-root .gift[data-v-68d98a5c]{position:absolute;top:-.1rem;right:-.05rem;background:linear-gradient(248.45deg,#fa1e1e,#ff7752 99.44%);padding:0 .05rem;border-radius:.1rem .1rem .1rem 0;font-size:.1rem;border-width:.02rem;border-color:#fff;border-style:solid;box-sizing:border-box;color:#fff}.price-root .token-count[data-v-68d98a5c]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-68d98a5c]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-68d98a5c]{font-size:.14rem}.only-price[data-v-68d98a5c]{align-items:center;justify-content:center}.only-price .price[data-v-68d98a5c]{font-size:.2rem}.content[data-v-76333b1f]{width:100%;margin:.2rem 0;display:grid;grid-template-columns:repeat(3,1fr);gap:.1rem;box-sizing:border-box;font-weight:500}.loading[data-v-76333b1f]{display:flex;justify-content:center;align-items:center}.select[data-v-76333b1f]{color:#fff}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-1c42b078]{font-family:WeChat-Bold}.pay-popup[data-v-1c42b078]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-1c42b078]{text-align:center;margin:.16rem 0}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
2
  var te = Object.defineProperty;
3
3
  var ne = (e, n, t) => n in e ? te(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
4
- var i = (e, n, t) => (ne(e, typeof n != "symbol" ? n + "" : n, t), t);
4
+ var o = (e, n, t) => (ne(e, typeof n != "symbol" ? n + "" : n, t), t);
5
5
  import { Dialog as q, Toast as M, Divider as se, Button as re } from "vant";
6
6
  import _ from "vue";
7
7
  import y from "vue-class-component";
8
- import { Prop as P, Component as G, Vue as ae, Inject as x, Watch as oe, Provide as ie } from "vue-property-decorator";
8
+ import { Prop as P, Component as G, Vue as ae, Inject as x, Watch as ie, Provide as oe } from "vue-property-decorator";
9
9
  const v = (e, n = "请求失败") => (q({ title: n, message: e }), {
10
10
  status: !1,
11
11
  message: e
12
12
  }), T = async (e, n, t = "POST") => new Promise((r, s) => {
13
- const o = localStorage.getItem("AppToken") || "";
14
- if (!o)
13
+ const i = localStorage.getItem("AppToken") || "";
14
+ if (!i)
15
15
  throw new Error("token 不存在");
16
16
  fetch(e, {
17
17
  method: t,
18
18
  headers: {
19
- AppToken: o,
19
+ AppToken: i,
20
20
  "Content-Type": "application/x-www-form-urlencoded"
21
21
  },
22
22
  body: new URLSearchParams(n).toString()
@@ -44,13 +44,13 @@ const v = (e, n = "请求失败") => (q({ title: n, message: e }), {
44
44
  var V, U;
45
45
  const z = (U = (V = _.prototype) == null ? void 0 : V.$jsBridge) == null ? void 0 : U.inApp, ue = !!window.ReactNativeWebView, J = async (e) => {
46
46
  const { id: n, key: t, value: r, prefix: s } = e;
47
- let o = location.origin + `/Payment/${s || ""}Alipay`;
47
+ let i = location.origin + `/Payment/${s || ""}Alipay`;
48
48
  const a = pe();
49
- if (o += `?qrcode=${a}&id=${n}`, !(t && r))
49
+ if (i += `?qrcode=${a}&id=${n}`, !(t && r))
50
50
  return v("支付参数异常", `支付时缺少 key value 参数:${JSON.stringify(e)}`);
51
- if (o += `&${t}=${r}`, !a)
52
- return location.href = o, ce();
53
- const { Data: l, Status: c, Message: u } = await T(o, {}, "GET");
51
+ if (i += `&${t}=${r}`, !a)
52
+ return location.href = i, ce();
53
+ const { Data: l, Status: c, Message: u } = await T(i, {}, "GET");
54
54
  if (!c)
55
55
  return v("支付请求失败", u || "请求支付结果异常");
56
56
  if (!l)
@@ -74,10 +74,10 @@ function _e(e) {
74
74
  });
75
75
  }
76
76
  const fe = async ({ channel: e, key: n, value: t, prefix: r }) => {
77
- const { type: s, id: o } = e, a = String(Number(t) / 100);
77
+ const { type: s, id: i } = e, a = String(Number(t) / 100);
78
78
  switch (s in W || M("暂不支持此渠道"), s) {
79
79
  case "alipay":
80
- return await J({ id: o, key: n, value: a, prefix: r });
80
+ return await J({ id: i, key: n, value: a, prefix: r });
81
81
  default:
82
82
  M("暂不支持此渠道");
83
83
  }
@@ -168,16 +168,16 @@ const fe = async ({ channel: e, key: n, value: t, prefix: r }) => {
168
168
  return n in t ? t[n] : (v(JSON.stringify(t) || "解析数据异常", `余额数据中不存在 ${n}`), 0);
169
169
  };
170
170
  var me = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, H = (e, n, t, r) => {
171
- for (var s = r > 1 ? void 0 : r ? ye(n, t) : n, o = e.length - 1, a; o >= 0; o--)
172
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
171
+ for (var s = r > 1 ? void 0 : r ? ye(n, t) : n, i = e.length - 1, a; i >= 0; i--)
172
+ (a = e[i]) && (s = (r ? a(n, t, s) : a(s)) || s);
173
173
  return r && s && me(n, t, s), s;
174
174
  };
175
175
  let $ = class extends ae {
176
176
  constructor() {
177
177
  super(...arguments);
178
- i(this, "load");
179
- i(this, "loading", !0);
180
- i(this, "message", "");
178
+ o(this, "load");
179
+ o(this, "loading", !0);
180
+ o(this, "message", "");
181
181
  }
182
182
  get showLoading() {
183
183
  return this.loading || this.message;
@@ -230,9 +230,9 @@ var Pe = function() {
230
230
  }
231
231
  })], 1), e._t("default")], 2);
232
232
  }, $e = [];
233
- function h(e, n, t, r, s, o, a, l) {
233
+ function h(e, n, t, r, s, i, a, l) {
234
234
  var c = typeof e == "function" ? e.options : e;
235
- n && (c.render = n, c.staticRenderFns = t, c._compiled = !0), r && (c.functional = !0), o && (c._scopeId = "data-v-" + o);
235
+ n && (c.render = n, c.staticRenderFns = t, c._compiled = !0), r && (c.functional = !0), i && (c._scopeId = "data-v-" + i);
236
236
  var u;
237
237
  if (a ? (u = function(p) {
238
238
  p = p || // cached call
@@ -278,15 +278,15 @@ const j = /* @__PURE__ */ function() {
278
278
  return Ce.exports;
279
279
  }();
280
280
  var we = Object.defineProperty, Oe = Object.getOwnPropertyDescriptor, Q = (e, n, t, r) => {
281
- for (var s = r > 1 ? void 0 : r ? Oe(n, t) : n, o = e.length - 1, a; o >= 0; o--)
282
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
281
+ for (var s = r > 1 ? void 0 : r ? Oe(n, t) : n, i = e.length - 1, a; i >= 0; i--)
282
+ (a = e[i]) && (s = (r ? a(n, t, s) : a(s)) || s);
283
283
  return r && s && we(n, t, s), s;
284
284
  };
285
285
  let C = class extends _ {
286
286
  constructor() {
287
287
  super(...arguments);
288
- i(this, "config");
289
- i(this, "value", 0);
288
+ o(this, "config");
289
+ o(this, "value", 0);
290
290
  }
291
291
  load() {
292
292
  const { key: t, api: r } = this.config.balance;
@@ -340,13 +340,13 @@ const Ee = /* @__PURE__ */ function() {
340
340
  Id: t,
341
341
  PaymentValue: r,
342
342
  PaymentName: s,
343
- PaymentIcon: o
343
+ PaymentIcon: i
344
344
  }) => {
345
345
  const a = Me(r);
346
346
  return {
347
347
  id: t,
348
348
  name: r,
349
- icon: o,
349
+ icon: i,
350
350
  type: a
351
351
  };
352
352
  });
@@ -354,27 +354,27 @@ function Me(e) {
354
354
  return e.includes("支付宝") ? "alipay" : e.includes("微信") ? "wechat" : "unknow";
355
355
  }
356
356
  var Le = Object.defineProperty, Re = Object.getOwnPropertyDescriptor, Y = (e, n, t, r) => {
357
- for (var s = r > 1 ? void 0 : r ? Re(n, t) : n, o = e.length - 1, a; o >= 0; o--)
358
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
357
+ for (var s = r > 1 ? void 0 : r ? Re(n, t) : n, i = e.length - 1, a; i >= 0; i--)
358
+ (a = e[i]) && (s = (r ? a(n, t, s) : a(s)) || s);
359
359
  return r && s && Le(n, t, s), s;
360
360
  };
361
361
  let b = class extends _ {
362
362
  constructor() {
363
363
  super(...arguments);
364
- i(this, "config");
364
+ o(this, "config");
365
365
  // 支付渠道
366
- i(this, "channels", []);
366
+ o(this, "channels", []);
367
367
  // 选择的支付渠道下标
368
- i(this, "select", 0);
368
+ o(this, "select", 0);
369
369
  // 是否显示气泡
370
- i(this, "showPopover", !1);
370
+ o(this, "showPopover", !1);
371
371
  }
372
372
  // 根据渠道计算选项
373
373
  get actions() {
374
- return this.channels.length ? this.channels.map(({ name: t, id: r, icon: s }, o) => ({
374
+ return this.channels.length ? this.channels.map(({ name: t, id: r, icon: s }, i) => ({
375
375
  text: t,
376
376
  id: r,
377
- disabled: o == this.select
377
+ disabled: i == this.select
378
378
  })) : [];
379
379
  }
380
380
  // 切换渠道
@@ -462,15 +462,15 @@ const Fe = /* @__PURE__ */ function() {
462
462
  return Ie.exports;
463
463
  }();
464
464
  var Ve = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, K = (e, n, t, r) => {
465
- for (var s = r > 1 ? void 0 : r ? Ue(n, t) : n, o = e.length - 1, a; o >= 0; o--)
466
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
465
+ for (var s = r > 1 ? void 0 : r ? Ue(n, t) : n, i = e.length - 1, a; i >= 0; i--)
466
+ (a = e[i]) && (s = (r ? a(n, t, s) : a(s)) || s);
467
467
  return r && s && Ve(n, t, s), s;
468
468
  };
469
469
  let w = class extends _ {
470
470
  constructor() {
471
471
  super(...arguments);
472
- i(this, "customPrice");
473
- i(this, "value", null);
472
+ o(this, "customPrice");
473
+ o(this, "value", null);
474
474
  }
475
475
  onChange(t) {
476
476
  this.$emit("input", Number(t));
@@ -524,14 +524,14 @@ const Z = /* @__PURE__ */ function() {
524
524
  return ze.exports;
525
525
  }();
526
526
  var We = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, k = (e, n, t, r) => {
527
- for (var s = r > 1 ? void 0 : r ? Xe(n, t) : n, o = e.length - 1, a; o >= 0; o--)
528
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
527
+ for (var s = r > 1 ? void 0 : r ? Xe(n, t) : n, i = e.length - 1, a; i >= 0; i--)
528
+ (a = e[i]) && (s = (r ? a(n, t, s) : a(s)) || s);
529
529
  return r && s && We(n, t, s), s;
530
530
  };
531
531
  let O = class extends _ {
532
532
  constructor() {
533
533
  super(...arguments);
534
- i(this, "price");
534
+ o(this, "price");
535
535
  }
536
536
  get realPrice() {
537
537
  return this.price.price / 100;
@@ -585,19 +585,19 @@ const Ze = /* @__PURE__ */ function() {
585
585
  return Ye.exports;
586
586
  }();
587
587
  var ke = Object.defineProperty, et = Object.getOwnPropertyDescriptor, S = (e, n, t, r) => {
588
- for (var s = r > 1 ? void 0 : r ? et(n, t) : n, o = e.length - 1, a; o >= 0; o--)
589
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
588
+ for (var s = r > 1 ? void 0 : r ? et(n, t) : n, i = e.length - 1, a; i >= 0; i--)
589
+ (a = e[i]) && (s = (r ? a(n, t, s) : a(s)) || s);
590
590
  return r && s && ke(n, t, s), s;
591
591
  };
592
592
  let g = class extends _ {
593
593
  constructor() {
594
594
  super(...arguments);
595
- i(this, "config");
596
- i(this, "value", 0);
597
- i(this, "prices", []);
598
- i(this, "customPrice", 0);
599
- i(this, "loading", !0);
600
- i(this, "message", "");
595
+ o(this, "config");
596
+ o(this, "value", 0);
597
+ o(this, "prices", []);
598
+ o(this, "customPrice", 0);
599
+ o(this, "loading", !0);
600
+ o(this, "message", "");
601
601
  }
602
602
  async mounted() {
603
603
  }
@@ -625,7 +625,7 @@ S([
625
625
  x()
626
626
  ], g.prototype, "config", 2);
627
627
  S([
628
- oe("customPrice")
628
+ ie("customPrice")
629
629
  ], g.prototype, "onCustomPriceChange", 1);
630
630
  g = S([
631
631
  y({
@@ -663,7 +663,7 @@ var tt = function() {
663
663
  price: r
664
664
  },
665
665
  nativeOn: {
666
- click: function(o) {
666
+ click: function(i) {
667
667
  return e.changePrice(s);
668
668
  }
669
669
  }
@@ -696,30 +696,30 @@ function rt(e) {
696
696
  const at = /* @__PURE__ */ function() {
697
697
  return st.exports;
698
698
  }();
699
- var ot = Object.defineProperty, it = Object.getOwnPropertyDescriptor, E = (e, n, t, r) => {
700
- for (var s = r > 1 ? void 0 : r ? it(n, t) : n, o = e.length - 1, a; o >= 0; o--)
701
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
702
- return r && s && ot(n, t, s), s;
699
+ var it = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, E = (e, n, t, r) => {
700
+ for (var s = r > 1 ? void 0 : r ? ot(n, t) : n, i = e.length - 1, a; i >= 0; i--)
701
+ (a = e[i]) && (s = (r ? a(n, t, s) : a(s)) || s);
702
+ return r && s && it(n, t, s), s;
703
703
  };
704
704
  let m = class extends _ {
705
705
  constructor() {
706
706
  super(...arguments);
707
- i(this, "config");
708
- i(this, "id");
707
+ o(this, "config");
708
+ o(this, "id");
709
709
  // 默认主题
710
- i(this, "baseTheme", he);
710
+ o(this, "baseTheme", he);
711
711
  // 弹出层是否显示
712
- i(this, "visible", !1);
712
+ o(this, "visible", !1);
713
713
  // 余额
714
- i(this, "balance", 0);
714
+ o(this, "balance", 0);
715
715
  // 价格
716
- i(this, "price", {
716
+ o(this, "price", {
717
717
  price: 0
718
718
  });
719
719
  // 选择的渠道
720
- i(this, "channel", null);
720
+ o(this, "channel", null);
721
721
  // 加载状态
722
- i(this, "loading", {
722
+ o(this, "loading", {
723
723
  // 余额
724
724
  balance: !1,
725
725
  // 价目表
@@ -743,7 +743,7 @@ let m = class extends _ {
743
743
  }
744
744
  // 弹出层动画结束
745
745
  onClosed() {
746
- this.$emit("onClosed"), console.log("触发onClosed事件");
746
+ this.$emit("onClosed");
747
747
  }
748
748
  // 点击充值
749
749
  async onTopup() {
@@ -761,7 +761,7 @@ let m = class extends _ {
761
761
  }
762
762
  /** 余额变动*/
763
763
  onBanlanceChange(t) {
764
- this.loading.balance = !0, console.log("余额变动", this.loading);
764
+ this.loading.balance = !0;
765
765
  }
766
766
  onChannelChange(t) {
767
767
  this.channel = t, this.loading.channel = !0;
@@ -783,7 +783,7 @@ let m = class extends _ {
783
783
  }
784
784
  };
785
785
  E([
786
- ie("config"),
786
+ oe("config"),
787
787
  P({ default: X })
788
788
  ], m.prototype, "config", 2);
789
789
  E([
@@ -853,7 +853,7 @@ var ut = /* @__PURE__ */ h(
853
853
  lt,
854
854
  !1,
855
855
  pt,
856
- "74a1db46",
856
+ "1c42b078",
857
857
  null,
858
858
  null
859
859
  );
@@ -865,7 +865,7 @@ const _t = /* @__PURE__ */ function() {
865
865
  return ut.exports;
866
866
  }(), Ot = {
867
867
  install(e) {
868
- const n = (t, ...r) => new Promise((s, o) => {
868
+ const n = (t, ...r) => new Promise((s, i) => {
869
869
  const a = ve[t], { needId: l } = a, c = r[0];
870
870
  if (l && !c) {
871
871
  q({
@@ -882,7 +882,7 @@ const _t = /* @__PURE__ */ function() {
882
882
  }
883
883
  });
884
884
  f.$on("onClosed", () => {
885
- console.log("接收onClosed事件 调用 promise rej"), s(), setTimeout(() => {
885
+ s(), setTimeout(() => {
886
886
  var d;
887
887
  f.$destroy(), (d = f.$el.parentNode) == null || d.removeChild(f.$el);
888
888
  }, 300);
package/dist/pay.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('@charset "UTF-8";.pay-error-container[data-v-0817c014]{position:relative}.pay-error-container .loading[data-v-0817c014]{width:100%;height:100%;position:absolute;background:#fff;z-index:1;transition:all .3s;justify-content:center;align-items:center}.pay-error-container .message[data-v-0817c014]{font-size:.1rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-75290345]{font-family:WeChat-Bold}.root[data-v-75290345]{text-align:center}.cell[data-v-4e4c306e]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-4e4c306e]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-ea027830]{font-family:WeChat-Bold}.custom-price .input[data-v-ea027830]{font-size:.2rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-68d98a5c]{font-family:WeChat-Bold}.price-root[data-v-68d98a5c]{position:relative;text-align:center;background:#f3f3f3;border-radius:.08rem;padding:.1rem 0;display:flex;flex-direction:column;height:.6rem;box-sizing:border-box;justify-content:space-between;align-items:center}.price-root .gift[data-v-68d98a5c]{position:absolute;top:-.1rem;right:-.05rem;background:linear-gradient(248.45deg,#fa1e1e,#ff7752 99.44%);padding:0 .05rem;border-radius:.1rem .1rem .1rem 0;font-size:.1rem;border-width:.02rem;border-color:#fff;border-style:solid;box-sizing:border-box;color:#fff}.price-root .token-count[data-v-68d98a5c]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-68d98a5c]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-68d98a5c]{font-size:.14rem}.only-price[data-v-68d98a5c]{align-items:center;justify-content:center}.only-price .price[data-v-68d98a5c]{font-size:.2rem}.content[data-v-76333b1f]{width:100%;margin:.2rem 0;display:grid;grid-template-columns:repeat(3,1fr);gap:.1rem;box-sizing:border-box;font-weight:500}.loading[data-v-76333b1f]{display:flex;justify-content:center;align-items:center}.select[data-v-76333b1f]{color:#fff}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-74a1db46]{font-family:WeChat-Bold}.pay-popup[data-v-74a1db46]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-74a1db46]{text-align:center;margin:.16rem 0}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- var an=Object.defineProperty;var on=(u,l,p)=>l in u?an(u,l,{enumerable:!0,configurable:!0,writable:!0,value:p}):u[l]=p;var r=(u,l,p)=>(on(u,typeof l!="symbol"?l+"":l,p),p);(function(u,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vant"),require("vue"),require("vue-class-component"),require("vue-property-decorator")):typeof define=="function"&&define.amd?define(["exports","vant","vue","vue-class-component","vue-property-decorator"],l):(u=typeof globalThis<"u"?globalThis:u||self,l(u.PayPlugin={},u.vant,u.Vue,u.Component,u.vuePropertyDecorator))})(this,function(u,l,p,m,f){var Y,K;"use strict";const y=(e,t="请求失败")=>(l.Dialog({title:t,message:e}),{status:!1,message:e}),j=async(e,t,n="POST")=>new Promise((i,s)=>{const o=localStorage.getItem("AppToken")||"";if(!o)throw new Error("token 不存在");fetch(e,{method:n,headers:{AppToken:o,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t).toString()}).then(async a=>{if(!a.ok){const _=await a.text();throw new Error(`HTTP ${a.status} ${a.statusText}: ${_}`)}try{return await a.json()}catch{s("解析 JSON 异常")}}).then(a=>{i(a)}).catch(a=>{let _=(a==null?void 0:a.message)||"未知异常";a.message.includes("404")?_="资源未找到":a.message.includes("500")?_="服务器错误":a instanceof TypeError&&a.message==="Failed to fetch"&&(_="网络连接失败"),s(_)})}),V=e=>({status:!0,message:"成功",data:e}),k=/LT-APP/.test(navigator.userAgent),B=(K=(Y=p.prototype)==null?void 0:Y.$jsBridge)==null?void 0:K.inApp,ee=!!window.ReactNativeWebView,L=async e=>{const{id:t,key:n,value:i,prefix:s}=e;let o=location.origin+`/Payment/${s||""}Alipay`;const a=ne();if(o+=`?qrcode=${a}&id=${t}`,!(n&&i))return y("支付参数异常",`支付时缺少 key value 参数:${JSON.stringify(e)}`);if(o+=`&${n}=${i}`,!a)return location.href=o,V();const{Data:_,Status:c,Message:d}=await j(o,{},"GET");if(!c)return y("支付请求失败",d||"请求支付结果异常");if(!_)return y("支付跳转地址不存在");if(B){p.prototype.$jsBridge.openLink(_);return}location.href=_};function ne(){return k||B||ee}const R={alipay:L};function te(e){return e.filter(({type:t})=>{if(t in R)return!0})}const se=async({channel:e,key:t,value:n,prefix:i})=>{const{type:s,id:o}=e,a=String(Number(n)/100);switch(s in R||l.Toast("暂不支持此渠道"),s){case"alipay":return await L({id:o,key:t,value:a,prefix:i});default:l.Toast("暂不支持此渠道")}},ie="orange",D={needId:!1,name:"店铺余额",theme:"#4089ff",balance:{disabled:!1,key:"Money",api:"/AgentUser/GetMoney"},price:{disabled:!1,custom:!0,prices:[{price:800},{price:12800},{price:38800},{price:68800},{price:128800},{price:268800}]},channel:{api:"/SystemPayment/GetList"},pay:{key:"Money"}},ae={agent:D,user:{theme:"#ff4f4f",name:"幸运币余额",needId:!1,balance:{disabled:!1,key:"PlaMoney",api:"/PlayerUser/GetMoney"},price:{disabled:!1,custom:!0,prices:[{price:200},{price:500},{price:1e3},{price:5e3},{price:1e4},{price:2e4}]},channel:{api:"/SystemPayment/GetList"},pay:{key:"Money"}}},oe=async(e,t)=>{const n=await j(e);return t in n?n[t]:(y(JSON.stringify(n)||"解析数据异常",`余额数据中不存在 ${t}`),0)};var re=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,I=(e,t,n,i)=>{for(var s=i>1?void 0:i?ce(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&re(t,n,s),s};let b=class extends f.Vue{constructor(){super(...arguments);r(this,"load");r(this,"loading",!0);r(this,"message","")}get showLoading(){return this.loading||this.message}async mounted(){await this.retry()}test(){this.loading=!0,setTimeout(()=>{this.loading=!1},100)}async retry(){this.message="",this.loading=!0;const n=await this.load().finally(()=>{this.loading=!1}).catch(i=>{this.message=i});n!=null&&this.$emit("done",n)}};I([f.Prop()],b.prototype,"load",2),b=I([f.Component],b);var le=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"pay-error-container"},[n("div",{staticClass:"loading",style:{display:e.showLoading?"flex":"none"}},[e.message?n("van-tag",{attrs:{type:"danger"},on:{click:e.retry}},[e._v(" "+e._s(e.message)+" 点击重试 ")]):n("van-loading",{staticClass:"loading-icon",attrs:{size:"20",type:"spinner"}})],1),e._t("default")],2)},ue=[];const cn="";function g(e,t,n,i,s,o,a,_){var c=typeof e=="function"?e.options:e;t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),i&&(c.functional=!0),o&&(c._scopeId="data-v-"+o);var d;if(a?(d=function(h){h=h||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!h&&typeof __VUE_SSR_CONTEXT__<"u"&&(h=__VUE_SSR_CONTEXT__),s&&s.call(this,h),h&&h._registeredComponents&&h._registeredComponents.add(a)},c._ssrRegister=d):s&&(d=_?function(){s.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:s),d)if(c.functional){c._injectStyles=d;var v=c.render;c.render=function(sn,Z){return d.call(Z),v(sn,Z)}}else{var C=c.beforeCreate;c.beforeCreate=C?[].concat(C,d):[d]}return{exports:e,options:c}}const A={};var pe=g(b,le,ue,!1,_e,"0817c014",null,null);function _e(e){for(let t in A)this[t]=A[t]}const S=function(){return pe.exports}();var fe=Object.defineProperty,de=Object.getOwnPropertyDescriptor,N=(e,t,n,i)=>{for(var s=i>1?void 0:i?de(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&fe(t,n,s),s};let w=class extends p{constructor(){super(...arguments);r(this,"config");r(this,"value",0)}load(){const{key:n,api:i}=this.config.balance;if(!i||!n)throw new Error("不存在 key 或 api");return oe(i,n)}onBalanceLoad(n){this.value=n/100,this.$emit("change",n)}};N([f.Inject()],w.prototype,"config",2),w=N([f.Component({components:{PayError:S}})],w);var he=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"root wechat-font"},[n("PayError",{attrs:{load:e.load},on:{done:e.onBalanceLoad}},[n("h1",[e._v(" "+e._s(e.value)+" ")])])],1)},ve=[];const ln="",q={};var ge=g(w,he,ve,!1,me,"75290345",null,null);function me(e){for(let t in q)this[t]=q[t]}const ye=function(){return ge.exports}(),$e=async e=>(await j(e)).map(({Id:n,PaymentValue:i,PaymentName:s,PaymentIcon:o})=>{const a=Pe(i);return{id:n,name:i,icon:o,type:a}});function Pe(e){return e.includes("支付宝")?"alipay":e.includes("微信")?"wechat":"unknow"}var Ce=Object.defineProperty,be=Object.getOwnPropertyDescriptor,F=(e,t,n,i)=>{for(var s=i>1?void 0:i?be(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Ce(t,n,s),s};let O=class extends p{constructor(){super(...arguments);r(this,"config");r(this,"channels",[]);r(this,"select",0);r(this,"showPopover",!1)}get actions(){return this.channels.length?this.channels.map(({name:n,id:i,icon:s},o)=>({text:n,id:i,disabled:o==this.select})):[]}onSelect(n,i){this.select=i,this.$emit("change",this.channels[i])}get name(){let n=this.channels[this.select];return n?n.name:""}load(){return $e(this.config.channel.api)}onLoadChannels(n){this.channels=te(n),this.$emit("change",this.channels[0])}};F([f.Inject()],O.prototype,"config",2),O=F([m({components:{PayError:S}})],O);var we=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("van-popover",{attrs:{trigger:"click",actions:e.actions,placement:"top-end"},on:{select:e.onSelect},scopedSlots:e._u([{key:"reference",fn:function(){return[n("div",{staticClass:"cell"},[n("h5",[e._v("付款方式")]),n("PayError",{staticClass:"name",attrs:{load:e.load},on:{done:e.onLoadChannels}},[n("div",[e._v(" "+e._s(e.name)+" "),n("van-icon",{attrs:{name:"arrow"}})],1)])],1)]},proxy:!0}]),model:{value:e.showPopover,callback:function(i){e.showPopover=i},expression:"showPopover"}})},Oe=[];const un="",U={};var xe=g(O,we,Oe,!1,Te,"4e4c306e",null,null);function Te(e){for(let t in U)this[t]=U[t]}const je=function(){return xe.exports}();var Se=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,G=(e,t,n,i)=>{for(var s=i>1?void 0:i?Ee(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Se(t,n,s),s};let x=class extends p{constructor(){super(...arguments);r(this,"customPrice");r(this,"value",null)}onChange(n){this.$emit("input",Number(n))}};G([f.Prop({default:null})],x.prototype,"customPrice",2),x=G([m],x);var Me=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"custom-price"},[n("h5",[e._v("自定义金额")]),n("van-field",{staticClass:"input wechat-font",attrs:{type:"digit",placeholder:"请输入金额",clearable:""},on:{input:e.onChange},model:{value:e.value,callback:function(i){e.value=i},expression:"value"}})],1)},Be=[];const pn="",z={};var Le=g(x,Me,Be,!1,Re,"ea027830",null,null);function Re(e){for(let t in z)this[t]=z[t]}const J=function(){return Le.exports}();var De=Object.defineProperty,Ie=Object.getOwnPropertyDescriptor,W=(e,t,n,i)=>{for(var s=i>1?void 0:i?Ie(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&De(t,n,s),s};let T=class extends p{constructor(){super(...arguments);r(this,"price")}get realPrice(){return this.price.price/100}get onlyPrice(){return!this.price.count}};W([f.Prop({default:{}})],T.prototype,"price",2),T=W([m],T);var Ae=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"price-root wechat-font",class:{"only-price":e.onlyPrice}},[e.price.giftCount?n("span",{staticClass:"gift"},[e._v(" 赠"+e._s(e.price.giftCount)+" ")]):e._e(),e.price.count?n("span",{staticClass:"token-count"},[n("img",{attrs:{src:"https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/npdd/user/my-v3/imgs/niu-coin-top-up-icon.png"}}),e._v(" "+e._s(e.price.count)+" ")]):e._e(),n("span",{staticClass:"price"},[e._v("¥"+e._s(e.realPrice))])])},Ne=[];const _n="",X={};var qe=g(T,Ae,Ne,!1,Fe,"68d98a5c",null,null);function Fe(e){for(let t in X)this[t]=X[t]}const Ue=function(){return qe.exports}();var Ge=Object.defineProperty,ze=Object.getOwnPropertyDescriptor,E=(e,t,n,i)=>{for(var s=i>1?void 0:i?ze(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Ge(t,n,s),s};let $=class extends p{constructor(){super(...arguments);r(this,"config");r(this,"value",0);r(this,"prices",[]);r(this,"customPrice",0);r(this,"loading",!0);r(this,"message","")}async mounted(){}load(){const{load:n,prices:i}=this.config.price;if(n)return n;if(i)return new Promise(s=>s(i))}onLoadPrices(n){this.prices=n,this.changePrice(0)}changePrice(n){this.value=n,this.$emit("change",this.prices[n])}onCustomPriceChange(n){n?this.$emit("change",{price:n*100}):this.$emit("change",this.prices[this.value])}};E([f.Inject()],$.prototype,"config",2),E([f.Watch("customPrice")],$.prototype,"onCustomPriceChange",1),$=E([m({components:{PriceItem:Ue,PayError:S,PriceCustom:J}})],$);var Je=function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.config.price.disabled?e._e():n("div",{staticClass:"price-container"},[n("h5",[e._v("选择充值金额")]),n("PayError",{attrs:{load:e.load},on:{done:e.onLoadPrices}},[n("div",{staticClass:"content"},e._l(e.prices,function(i,s){return n("price-item",{key:s,staticClass:"price-item",class:{select:s==e.value},style:{backgroundColor:s==e.value?e.config.theme||"orange":""},attrs:{price:i},nativeOn:{click:function(o){return e.changePrice(s)}}})}),1)]),e.config.price.custom?[n("PriceCustom",{model:{value:e.customPrice,callback:function(i){e.customPrice=i},expression:"customPrice"}})]:e._e()],2)},We=[];const fn="",H={};var Xe=g($,Je,We,!1,He,"76333b1f",null,null);function He(e){for(let t in H)this[t]=H[t]}const Qe=function(){return Xe.exports}();var Ye=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,M=(e,t,n,i)=>{for(var s=i>1?void 0:i?Ke(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Ye(t,n,s),s};let P=class extends p{constructor(){super(...arguments);r(this,"config");r(this,"id");r(this,"baseTheme",ie);r(this,"visible",!1);r(this,"balance",0);r(this,"price",{price:0});r(this,"channel",null);r(this,"loading",{balance:!1,price:!1,channel:!1})}async mounted(){this.$nextTick(()=>{this.visible=!0,this.initLoad()})}initLoad(){this.loading.balance=this.config.balance.disabled,this.loading.price=this.config.price.disabled}onClose(){this.$emit("onClose")}onClosed(){this.$emit("onClosed"),console.log("触发onClosed事件")}async onTopup(){const{key:n,prefix:i}=this.config.pay,s=String(this.id||this.price.price);if(!this.channel){y("渠道不存在");return}await se({channel:this.channel,key:n,value:s,prefix:i})}onBanlanceChange(n){this.loading.balance=!0,console.log("余额变动",this.loading)}onChannelChange(n){this.channel=n,this.loading.channel=!0}onPriceChange(n){this.price=n,this.loading.price=!0}get finalPrice(){return this.price.price/100}get disable(){return!Object.values(this.loading).every(n=>n===!0)}get title(){return this.config.name}};M([f.Provide("config"),f.Prop({default:D})],P.prototype,"config",2),M([f.Prop({default:void 0})],P.prototype,"id",2),P=M([m({components:{Balance:ye,Divider:l.Divider,PriceContainer:Qe,Button:l.Button,PriceCustom:J,Channels:je}})],P);var Ze=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("van-popup",{staticClass:"pay-popup",attrs:{position:"bottom",overlay:!0,round:""},on:{closed:e.onClosed,close:e.onClose},model:{value:e.visible,callback:function(i){e.visible=i},expression:"visible"}},[n("h4",{staticClass:"title"},[e._v(" "+e._s(e.title)+" ")]),e.config.balance.disabled?e._e():[n("Balance",{on:{change:e.onBanlanceChange}}),n("Divider")],e.config.price.disabled?e._e():[n("PriceContainer",{on:{change:e.onPriceChange}}),n("Divider")],n("Channels",{on:{change:e.onChannelChange}}),n("Divider"),n("Button",{attrs:{disabled:e.disable,color:e.config.theme||e.baseTheme,block:""},on:{click:e.onTopup}},[e._v(" 立即支付 "+e._s(e.finalPrice)+" 元 ")])],2)},Ve=[];const dn="",Q={};var ke=g(P,Ze,Ve,!1,en,"74a1db46",null,null);function en(e){for(let t in Q)this[t]=Q[t]}const nn=function(){return ke.exports}(),tn={install(e){const t=(n,...i)=>new Promise((s,o)=>{const a=ae[n],{needId:_}=a,c=i[0];if(_&&!c){l.Dialog({title:"参数异常",message:`${n} 类型需要传入订单号 当前未传入!`});return}const d=p.extend(nn),v=new d({propsData:{config:a,id:c}});v.$on("onClosed",()=>{console.log("接收onClosed事件 调用 promise rej"),s(),setTimeout(()=>{var C;v.$destroy(),(C=v.$el.parentNode)==null||C.removeChild(v.$el)},300)}),v.$mount(),document.body.appendChild(v.$el)});e.prototype.$pay={create:t}}};u.PayPlugin=tn,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
1
+ (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('@charset "UTF-8";.pay-error-container[data-v-0817c014]{position:relative}.pay-error-container .loading[data-v-0817c014]{width:100%;height:100%;position:absolute;background:#fff;z-index:1;transition:all .3s;justify-content:center;align-items:center}.pay-error-container .message[data-v-0817c014]{font-size:.1rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-75290345]{font-family:WeChat-Bold}.root[data-v-75290345]{text-align:center}.cell[data-v-4e4c306e]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-4e4c306e]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-ea027830]{font-family:WeChat-Bold}.custom-price .input[data-v-ea027830]{font-size:.2rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-68d98a5c]{font-family:WeChat-Bold}.price-root[data-v-68d98a5c]{position:relative;text-align:center;background:#f3f3f3;border-radius:.08rem;padding:.1rem 0;display:flex;flex-direction:column;height:.6rem;box-sizing:border-box;justify-content:space-between;align-items:center}.price-root .gift[data-v-68d98a5c]{position:absolute;top:-.1rem;right:-.05rem;background:linear-gradient(248.45deg,#fa1e1e,#ff7752 99.44%);padding:0 .05rem;border-radius:.1rem .1rem .1rem 0;font-size:.1rem;border-width:.02rem;border-color:#fff;border-style:solid;box-sizing:border-box;color:#fff}.price-root .token-count[data-v-68d98a5c]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-68d98a5c]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-68d98a5c]{font-size:.14rem}.only-price[data-v-68d98a5c]{align-items:center;justify-content:center}.only-price .price[data-v-68d98a5c]{font-size:.2rem}.content[data-v-76333b1f]{width:100%;margin:.2rem 0;display:grid;grid-template-columns:repeat(3,1fr);gap:.1rem;box-sizing:border-box;font-weight:500}.loading[data-v-76333b1f]{display:flex;justify-content:center;align-items:center}.select[data-v-76333b1f]{color:#fff}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-1c42b078]{font-family:WeChat-Bold}.pay-popup[data-v-1c42b078]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-1c42b078]{text-align:center;margin:.16rem 0}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ var an=Object.defineProperty;var rn=(u,l,p)=>l in u?an(u,l,{enumerable:!0,configurable:!0,writable:!0,value:p}):u[l]=p;var o=(u,l,p)=>(rn(u,typeof l!="symbol"?l+"":l,p),p);(function(u,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vant"),require("vue"),require("vue-class-component"),require("vue-property-decorator")):typeof define=="function"&&define.amd?define(["exports","vant","vue","vue-class-component","vue-property-decorator"],l):(u=typeof globalThis<"u"?globalThis:u||self,l(u.PayPlugin={},u.vant,u.Vue,u.Component,u.vuePropertyDecorator))})(this,function(u,l,p,m,f){var Y,K;"use strict";const y=(e,t="请求失败")=>(l.Dialog({title:t,message:e}),{status:!1,message:e}),j=async(e,t,n="POST")=>new Promise((i,s)=>{const r=localStorage.getItem("AppToken")||"";if(!r)throw new Error("token 不存在");fetch(e,{method:n,headers:{AppToken:r,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t).toString()}).then(async a=>{if(!a.ok){const _=await a.text();throw new Error(`HTTP ${a.status} ${a.statusText}: ${_}`)}try{return await a.json()}catch{s("解析 JSON 异常")}}).then(a=>{i(a)}).catch(a=>{let _=(a==null?void 0:a.message)||"未知异常";a.message.includes("404")?_="资源未找到":a.message.includes("500")?_="服务器错误":a instanceof TypeError&&a.message==="Failed to fetch"&&(_="网络连接失败"),s(_)})}),V=e=>({status:!0,message:"成功",data:e}),k=/LT-APP/.test(navigator.userAgent),B=(K=(Y=p.prototype)==null?void 0:Y.$jsBridge)==null?void 0:K.inApp,ee=!!window.ReactNativeWebView,L=async e=>{const{id:t,key:n,value:i,prefix:s}=e;let r=location.origin+`/Payment/${s||""}Alipay`;const a=ne();if(r+=`?qrcode=${a}&id=${t}`,!(n&&i))return y("支付参数异常",`支付时缺少 key value 参数:${JSON.stringify(e)}`);if(r+=`&${n}=${i}`,!a)return location.href=r,V();const{Data:_,Status:c,Message:d}=await j(r,{},"GET");if(!c)return y("支付请求失败",d||"请求支付结果异常");if(!_)return y("支付跳转地址不存在");if(B){p.prototype.$jsBridge.openLink(_);return}location.href=_};function ne(){return k||B||ee}const R={alipay:L};function te(e){return e.filter(({type:t})=>{if(t in R)return!0})}const se=async({channel:e,key:t,value:n,prefix:i})=>{const{type:s,id:r}=e,a=String(Number(n)/100);switch(s in R||l.Toast("暂不支持此渠道"),s){case"alipay":return await L({id:r,key:t,value:a,prefix:i});default:l.Toast("暂不支持此渠道")}},ie="orange",D={needId:!1,name:"店铺余额",theme:"#4089ff",balance:{disabled:!1,key:"Money",api:"/AgentUser/GetMoney"},price:{disabled:!1,custom:!0,prices:[{price:800},{price:12800},{price:38800},{price:68800},{price:128800},{price:268800}]},channel:{api:"/SystemPayment/GetList"},pay:{key:"Money"}},ae={agent:D,user:{theme:"#ff4f4f",name:"幸运币余额",needId:!1,balance:{disabled:!1,key:"PlaMoney",api:"/PlayerUser/GetMoney"},price:{disabled:!1,custom:!0,prices:[{price:200},{price:500},{price:1e3},{price:5e3},{price:1e4},{price:2e4}]},channel:{api:"/SystemPayment/GetList"},pay:{key:"Money"}}},re=async(e,t)=>{const n=await j(e);return t in n?n[t]:(y(JSON.stringify(n)||"解析数据异常",`余额数据中不存在 ${t}`),0)};var oe=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,I=(e,t,n,i)=>{for(var s=i>1?void 0:i?ce(t,n):t,r=e.length-1,a;r>=0;r--)(a=e[r])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&oe(t,n,s),s};let b=class extends f.Vue{constructor(){super(...arguments);o(this,"load");o(this,"loading",!0);o(this,"message","")}get showLoading(){return this.loading||this.message}async mounted(){await this.retry()}test(){this.loading=!0,setTimeout(()=>{this.loading=!1},100)}async retry(){this.message="",this.loading=!0;const n=await this.load().finally(()=>{this.loading=!1}).catch(i=>{this.message=i});n!=null&&this.$emit("done",n)}};I([f.Prop()],b.prototype,"load",2),b=I([f.Component],b);var le=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"pay-error-container"},[n("div",{staticClass:"loading",style:{display:e.showLoading?"flex":"none"}},[e.message?n("van-tag",{attrs:{type:"danger"},on:{click:e.retry}},[e._v(" "+e._s(e.message)+" 点击重试 ")]):n("van-loading",{staticClass:"loading-icon",attrs:{size:"20",type:"spinner"}})],1),e._t("default")],2)},ue=[];const cn="";function g(e,t,n,i,s,r,a,_){var c=typeof e=="function"?e.options:e;t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),i&&(c.functional=!0),r&&(c._scopeId="data-v-"+r);var d;if(a?(d=function(h){h=h||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!h&&typeof __VUE_SSR_CONTEXT__<"u"&&(h=__VUE_SSR_CONTEXT__),s&&s.call(this,h),h&&h._registeredComponents&&h._registeredComponents.add(a)},c._ssrRegister=d):s&&(d=_?function(){s.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:s),d)if(c.functional){c._injectStyles=d;var v=c.render;c.render=function(sn,Z){return d.call(Z),v(sn,Z)}}else{var C=c.beforeCreate;c.beforeCreate=C?[].concat(C,d):[d]}return{exports:e,options:c}}const A={};var pe=g(b,le,ue,!1,_e,"0817c014",null,null);function _e(e){for(let t in A)this[t]=A[t]}const S=function(){return pe.exports}();var fe=Object.defineProperty,de=Object.getOwnPropertyDescriptor,N=(e,t,n,i)=>{for(var s=i>1?void 0:i?de(t,n):t,r=e.length-1,a;r>=0;r--)(a=e[r])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&fe(t,n,s),s};let w=class extends p{constructor(){super(...arguments);o(this,"config");o(this,"value",0)}load(){const{key:n,api:i}=this.config.balance;if(!i||!n)throw new Error("不存在 key 或 api");return re(i,n)}onBalanceLoad(n){this.value=n/100,this.$emit("change",n)}};N([f.Inject()],w.prototype,"config",2),w=N([f.Component({components:{PayError:S}})],w);var he=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"root wechat-font"},[n("PayError",{attrs:{load:e.load},on:{done:e.onBalanceLoad}},[n("h1",[e._v(" "+e._s(e.value)+" ")])])],1)},ve=[];const ln="",q={};var ge=g(w,he,ve,!1,me,"75290345",null,null);function me(e){for(let t in q)this[t]=q[t]}const ye=function(){return ge.exports}(),$e=async e=>(await j(e)).map(({Id:n,PaymentValue:i,PaymentName:s,PaymentIcon:r})=>{const a=Pe(i);return{id:n,name:i,icon:r,type:a}});function Pe(e){return e.includes("支付宝")?"alipay":e.includes("微信")?"wechat":"unknow"}var Ce=Object.defineProperty,be=Object.getOwnPropertyDescriptor,F=(e,t,n,i)=>{for(var s=i>1?void 0:i?be(t,n):t,r=e.length-1,a;r>=0;r--)(a=e[r])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Ce(t,n,s),s};let O=class extends p{constructor(){super(...arguments);o(this,"config");o(this,"channels",[]);o(this,"select",0);o(this,"showPopover",!1)}get actions(){return this.channels.length?this.channels.map(({name:n,id:i,icon:s},r)=>({text:n,id:i,disabled:r==this.select})):[]}onSelect(n,i){this.select=i,this.$emit("change",this.channels[i])}get name(){let n=this.channels[this.select];return n?n.name:""}load(){return $e(this.config.channel.api)}onLoadChannels(n){this.channels=te(n),this.$emit("change",this.channels[0])}};F([f.Inject()],O.prototype,"config",2),O=F([m({components:{PayError:S}})],O);var we=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("van-popover",{attrs:{trigger:"click",actions:e.actions,placement:"top-end"},on:{select:e.onSelect},scopedSlots:e._u([{key:"reference",fn:function(){return[n("div",{staticClass:"cell"},[n("h5",[e._v("付款方式")]),n("PayError",{staticClass:"name",attrs:{load:e.load},on:{done:e.onLoadChannels}},[n("div",[e._v(" "+e._s(e.name)+" "),n("van-icon",{attrs:{name:"arrow"}})],1)])],1)]},proxy:!0}]),model:{value:e.showPopover,callback:function(i){e.showPopover=i},expression:"showPopover"}})},Oe=[];const un="",U={};var xe=g(O,we,Oe,!1,Te,"4e4c306e",null,null);function Te(e){for(let t in U)this[t]=U[t]}const je=function(){return xe.exports}();var Se=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,G=(e,t,n,i)=>{for(var s=i>1?void 0:i?Ee(t,n):t,r=e.length-1,a;r>=0;r--)(a=e[r])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Se(t,n,s),s};let x=class extends p{constructor(){super(...arguments);o(this,"customPrice");o(this,"value",null)}onChange(n){this.$emit("input",Number(n))}};G([f.Prop({default:null})],x.prototype,"customPrice",2),x=G([m],x);var Me=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"custom-price"},[n("h5",[e._v("自定义金额")]),n("van-field",{staticClass:"input wechat-font",attrs:{type:"digit",placeholder:"请输入金额",clearable:""},on:{input:e.onChange},model:{value:e.value,callback:function(i){e.value=i},expression:"value"}})],1)},Be=[];const pn="",z={};var Le=g(x,Me,Be,!1,Re,"ea027830",null,null);function Re(e){for(let t in z)this[t]=z[t]}const J=function(){return Le.exports}();var De=Object.defineProperty,Ie=Object.getOwnPropertyDescriptor,W=(e,t,n,i)=>{for(var s=i>1?void 0:i?Ie(t,n):t,r=e.length-1,a;r>=0;r--)(a=e[r])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&De(t,n,s),s};let T=class extends p{constructor(){super(...arguments);o(this,"price")}get realPrice(){return this.price.price/100}get onlyPrice(){return!this.price.count}};W([f.Prop({default:{}})],T.prototype,"price",2),T=W([m],T);var Ae=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"price-root wechat-font",class:{"only-price":e.onlyPrice}},[e.price.giftCount?n("span",{staticClass:"gift"},[e._v(" 赠"+e._s(e.price.giftCount)+" ")]):e._e(),e.price.count?n("span",{staticClass:"token-count"},[n("img",{attrs:{src:"https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/npdd/user/my-v3/imgs/niu-coin-top-up-icon.png"}}),e._v(" "+e._s(e.price.count)+" ")]):e._e(),n("span",{staticClass:"price"},[e._v("¥"+e._s(e.realPrice))])])},Ne=[];const _n="",X={};var qe=g(T,Ae,Ne,!1,Fe,"68d98a5c",null,null);function Fe(e){for(let t in X)this[t]=X[t]}const Ue=function(){return qe.exports}();var Ge=Object.defineProperty,ze=Object.getOwnPropertyDescriptor,E=(e,t,n,i)=>{for(var s=i>1?void 0:i?ze(t,n):t,r=e.length-1,a;r>=0;r--)(a=e[r])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Ge(t,n,s),s};let $=class extends p{constructor(){super(...arguments);o(this,"config");o(this,"value",0);o(this,"prices",[]);o(this,"customPrice",0);o(this,"loading",!0);o(this,"message","")}async mounted(){}load(){const{load:n,prices:i}=this.config.price;if(n)return n;if(i)return new Promise(s=>s(i))}onLoadPrices(n){this.prices=n,this.changePrice(0)}changePrice(n){this.value=n,this.$emit("change",this.prices[n])}onCustomPriceChange(n){n?this.$emit("change",{price:n*100}):this.$emit("change",this.prices[this.value])}};E([f.Inject()],$.prototype,"config",2),E([f.Watch("customPrice")],$.prototype,"onCustomPriceChange",1),$=E([m({components:{PriceItem:Ue,PayError:S,PriceCustom:J}})],$);var Je=function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.config.price.disabled?e._e():n("div",{staticClass:"price-container"},[n("h5",[e._v("选择充值金额")]),n("PayError",{attrs:{load:e.load},on:{done:e.onLoadPrices}},[n("div",{staticClass:"content"},e._l(e.prices,function(i,s){return n("price-item",{key:s,staticClass:"price-item",class:{select:s==e.value},style:{backgroundColor:s==e.value?e.config.theme||"orange":""},attrs:{price:i},nativeOn:{click:function(r){return e.changePrice(s)}}})}),1)]),e.config.price.custom?[n("PriceCustom",{model:{value:e.customPrice,callback:function(i){e.customPrice=i},expression:"customPrice"}})]:e._e()],2)},We=[];const fn="",H={};var Xe=g($,Je,We,!1,He,"76333b1f",null,null);function He(e){for(let t in H)this[t]=H[t]}const Qe=function(){return Xe.exports}();var Ye=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,M=(e,t,n,i)=>{for(var s=i>1?void 0:i?Ke(t,n):t,r=e.length-1,a;r>=0;r--)(a=e[r])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&Ye(t,n,s),s};let P=class extends p{constructor(){super(...arguments);o(this,"config");o(this,"id");o(this,"baseTheme",ie);o(this,"visible",!1);o(this,"balance",0);o(this,"price",{price:0});o(this,"channel",null);o(this,"loading",{balance:!1,price:!1,channel:!1})}async mounted(){this.$nextTick(()=>{this.visible=!0,this.initLoad()})}initLoad(){this.loading.balance=this.config.balance.disabled,this.loading.price=this.config.price.disabled}onClose(){this.$emit("onClose")}onClosed(){this.$emit("onClosed")}async onTopup(){const{key:n,prefix:i}=this.config.pay,s=String(this.id||this.price.price);if(!this.channel){y("渠道不存在");return}await se({channel:this.channel,key:n,value:s,prefix:i})}onBanlanceChange(n){this.loading.balance=!0}onChannelChange(n){this.channel=n,this.loading.channel=!0}onPriceChange(n){this.price=n,this.loading.price=!0}get finalPrice(){return this.price.price/100}get disable(){return!Object.values(this.loading).every(n=>n===!0)}get title(){return this.config.name}};M([f.Provide("config"),f.Prop({default:D})],P.prototype,"config",2),M([f.Prop({default:void 0})],P.prototype,"id",2),P=M([m({components:{Balance:ye,Divider:l.Divider,PriceContainer:Qe,Button:l.Button,PriceCustom:J,Channels:je}})],P);var Ze=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("van-popup",{staticClass:"pay-popup",attrs:{position:"bottom",overlay:!0,round:""},on:{closed:e.onClosed,close:e.onClose},model:{value:e.visible,callback:function(i){e.visible=i},expression:"visible"}},[n("h4",{staticClass:"title"},[e._v(" "+e._s(e.title)+" ")]),e.config.balance.disabled?e._e():[n("Balance",{on:{change:e.onBanlanceChange}}),n("Divider")],e.config.price.disabled?e._e():[n("PriceContainer",{on:{change:e.onPriceChange}}),n("Divider")],n("Channels",{on:{change:e.onChannelChange}}),n("Divider"),n("Button",{attrs:{disabled:e.disable,color:e.config.theme||e.baseTheme,block:""},on:{click:e.onTopup}},[e._v(" 立即支付 "+e._s(e.finalPrice)+" 元 ")])],2)},Ve=[];const dn="",Q={};var ke=g(P,Ze,Ve,!1,en,"1c42b078",null,null);function en(e){for(let t in Q)this[t]=Q[t]}const nn=function(){return ke.exports}(),tn={install(e){const t=(n,...i)=>new Promise((s,r)=>{const a=ae[n],{needId:_}=a,c=i[0];if(_&&!c){l.Dialog({title:"参数异常",message:`${n} 类型需要传入订单号 当前未传入!`});return}const d=p.extend(nn),v=new d({propsData:{config:a,id:c}});v.$on("onClosed",()=>{s(),setTimeout(()=>{var C;v.$destroy(),(C=v.$el.parentNode)==null||C.removeChild(v.$el)},300)}),v.$mount(),document.body.appendChild(v.$el)});e.prototype.$pay={create:t}}};u.PayPlugin=tn,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhangcf233/pay",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "main": "dist/pay.umd.js",
5
5
  "module": "dist/pay.es.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -11,7 +11,8 @@
11
11
  "scripts": {
12
12
  "build:types": "vue-tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
13
13
  "build": " vite build && npm run build:types",
14
- "link": "npm run build && npm link"
14
+ "link": "npm run build && npm link",
15
+ "publish": "npm run build && npm publish --access public"
15
16
  },
16
17
  "peerDependencies": {
17
18
  "vant": "^2.13.8",