@zhangcf233/pay 1.1.7 → 1.1.9

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/README.md CHANGED
@@ -13,3 +13,6 @@ npm run link
13
13
  ```sh
14
14
  npm link @zhangcf233/pay
15
15
  ```
16
+
17
+ ## 发行流程
18
+
package/dist/pay.es.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('@charset "UTF-8";.protocol-popup[data-v-16cd68bd]{height:70vh;width:100vw;overflow-x:hidden}.protocol-popup .protocol[data-v-16cd68bd]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%}.protocol-popup .protocol .btn-box[data-v-16cd68bd]{height:10%;width:100%;display:flex;justify-content:space-around;padding:.1rem;box-sizing:content-box}.protocol-popup .protocol .btn-box>*[data-v-16cd68bd]{width:45%}.protocol-popup .protocol iframe[data-v-16cd68bd]{display:block;width:100%;height:90%;margin:0;border:0;padding:.16rem;box-sizing:border-box}.agreement[data-v-27f1af06]{display:flex;justify-content:center;align-items:center;font-size:.12rem;margin:.16rem 0 0}.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-20b4bf5f]{font-family:WeChat-Bold}.root[data-v-20b4bf5f]{text-align:center}.cell[data-v-4dcfe5ca]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-4dcfe5ca]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}.identity[data-v-5f9eb7e3]{margin-top:.16rem}@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-05e06290]{font-family:WeChat-Bold}.custom-price .input[data-v-05e06290]{font-size:.2rem;padding:0;margin-top:.16rem}@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-5e65f97e]{font-family:WeChat-Bold}.price-root[data-v-5e65f97e]{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-5e65f97e]{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-5e65f97e]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-5e65f97e]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-5e65f97e]{font-size:.12rem}.only-price[data-v-5e65f97e]{align-items:center;justify-content:center}.only-price .price[data-v-5e65f97e]{font-size:.2rem}.content[data-v-72566f6d]{width:100%;margin:.16rem 0;display:grid;grid-template-columns:repeat(3,1fr);gap:.1rem;box-sizing:border-box;font-weight:500}.loading[data-v-72566f6d]{display:flex;justify-content:center;align-items:center}.select[data-v-72566f6d]{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-176a6a6d]{font-family:WeChat-Bold}.pay-popup[data-v-176a6a6d]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-176a6a6d]{text-align:center;margin:.16rem 0}.pay-button[data-v-176a6a6d]{margin:.16rem 0 0}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
1
+ !function(){"use strict";try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('@charset "UTF-8";.protocol-popup[data-v-16cd68bd]{height:70vh;width:100vw;overflow-x:hidden}.protocol-popup .protocol[data-v-16cd68bd]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%}.protocol-popup .protocol .btn-box[data-v-16cd68bd]{height:10%;width:100%;display:flex;justify-content:space-around;padding:.1rem;box-sizing:content-box}.protocol-popup .protocol .btn-box>*[data-v-16cd68bd]{width:45%}.protocol-popup .protocol iframe[data-v-16cd68bd]{display:block;width:100%;height:90%;margin:0;border:0;padding:.16rem;box-sizing:border-box}.agreement[data-v-27f1af06]{display:flex;justify-content:center;align-items:center;font-size:.12rem;margin:.16rem 0 0}.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-20b4bf5f]{font-family:WeChat-Bold}.root[data-v-20b4bf5f]{text-align:center}.cell[data-v-4dcfe5ca]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-4dcfe5ca]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}.identity[data-v-5f9eb7e3]{margin-top:.16rem}@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-05e06290]{font-family:WeChat-Bold}.custom-price .input[data-v-05e06290]{font-size:.2rem;padding:0;margin-top:.16rem}@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-599f1980]{font-family:WeChat-Bold}.price-root[data-v-599f1980]{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-599f1980]{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-599f1980]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-599f1980]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-599f1980]{font-size:.12rem}.only-price[data-v-599f1980]{align-items:center;justify-content:center}.only-price .price[data-v-599f1980]{font-size:.2rem}.content[data-v-01a7ad83]{width:100%;margin:.16rem 0;display:grid;grid-template-columns:repeat(3,1fr);gap:.1rem;box-sizing:border-box;font-weight:500}.loading[data-v-01a7ad83]{display:flex;justify-content:center;align-items:center}.select[data-v-01a7ad83]{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-bdbfe540]{font-family:WeChat-Bold}.pay-popup[data-v-bdbfe540]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s;text-align:center}.title[data-v-bdbfe540]{text-align:center;margin:.16rem 0}.pay-button[data-v-bdbfe540]{margin:.16rem 0 0}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}}();
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => {
@@ -1262,7 +1262,6 @@ var __decorateClass$2 = (decorators, target, key, kind) => {
1262
1262
  let PriceItem$1 = class PriceItem extends Vue {
1263
1263
  constructor() {
1264
1264
  super(...arguments);
1265
- __publicField(this, "symbol");
1266
1265
  __publicField(this, "price");
1267
1266
  }
1268
1267
  get realPrice() {
@@ -1273,9 +1272,6 @@ let PriceItem$1 = class PriceItem extends Vue {
1273
1272
  return !this.price.count;
1274
1273
  }
1275
1274
  };
1276
- __decorateClass$2([
1277
- Prop({ default: "¥" })
1278
- ], PriceItem$1.prototype, "symbol", 2);
1279
1275
  __decorateClass$2([
1280
1276
  Prop({ default: {} })
1281
1277
  ], PriceItem$1.prototype, "price", 2);
@@ -1291,17 +1287,17 @@ var render$2 = function() {
1291
1287
  class: {
1292
1288
  "only-price": _vm.onlyPrice
1293
1289
  }
1294
- }, [_vm.price.giftCount ? _c("span", {
1290
+ }, [_vm.price.gift ? _c("span", {
1295
1291
  staticClass: "gift"
1296
- }, [_vm._v(" 赠" + _vm._s(_vm.price.giftCount) + " ")]) : _vm._e(), _vm.price.count ? _c("span", {
1292
+ }, [_vm._v(" 赠" + _vm._s(_vm.price.gift) + " ")]) : _vm._e(), _vm.price.count ? _c("span", {
1297
1293
  staticClass: "token-count"
1298
1294
  }, [_c("img", {
1299
1295
  attrs: {
1300
1296
  "src": "https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/npdd/user/my-v3/imgs/niu-coin-top-up-icon.png"
1301
1297
  }
1302
- }), _vm._v(" " + _vm._s(_vm.price.count) + " ")]) : _vm._e(), _c("span", {
1298
+ }), _vm._v(" " + _vm._s(_vm.price.count / 100) + " ")]) : _vm._e(), _c("span", {
1303
1299
  staticClass: "price"
1304
- }, [_vm._v(_vm._s(_vm.symbol) + _vm._s(_vm.realPrice))])]);
1300
+ }, [_vm._v(_vm._s(_vm.price.symbol || "¥") + _vm._s(_vm.realPrice))])]);
1305
1301
  };
1306
1302
  var staticRenderFns$2 = [];
1307
1303
  const price_vue_vue_type_style_index_0_scoped_true_lang = "";
@@ -1312,7 +1308,7 @@ var __component__$2 = /* @__PURE__ */ normalizeComponent(
1312
1308
  staticRenderFns$2,
1313
1309
  false,
1314
1310
  __vue2_injectStyles$2,
1315
- "5e65f97e",
1311
+ "599f1980",
1316
1312
  null,
1317
1313
  null
1318
1314
  );
@@ -1351,7 +1347,7 @@ let PriceContainer$1 = class PriceContainer extends Vue {
1351
1347
  load() {
1352
1348
  const { load, prices } = this.config.price;
1353
1349
  if (load) {
1354
- return load;
1350
+ return new Promise(async (res) => await res(load()));
1355
1351
  }
1356
1352
  if (prices) {
1357
1353
  return new Promise((res) => res(prices));
@@ -1416,8 +1412,7 @@ var render$1 = function() {
1416
1412
  backgroundColor: index == _vm.value ? _vm.config.theme || "orange" : ""
1417
1413
  },
1418
1414
  attrs: {
1419
- "price": p,
1420
- "symbol": _vm.config.price.currencySymbol || "¥"
1415
+ "price": p
1421
1416
  },
1422
1417
  nativeOn: {
1423
1418
  "click": function($event) {
@@ -1444,7 +1439,7 @@ var __component__$1 = /* @__PURE__ */ normalizeComponent(
1444
1439
  staticRenderFns$1,
1445
1440
  false,
1446
1441
  __vue2_injectStyles$1,
1447
- "72566f6d",
1442
+ "01a7ad83",
1448
1443
  null,
1449
1444
  null
1450
1445
  );
@@ -1473,6 +1468,7 @@ let PayPopup$1 = class PayPopup extends Vue {
1473
1468
  __publicField(this, "config");
1474
1469
  __publicField(this, "id");
1475
1470
  __publicField(this, "url");
1471
+ __publicField(this, "incomePrice");
1476
1472
  // 是否同意支付协议
1477
1473
  __publicField(this, "isAgreeProtocol", false);
1478
1474
  // 默认主题
@@ -1508,7 +1504,11 @@ let PayPopup$1 = class PayPopup extends Vue {
1508
1504
  // 初始化加载状态
1509
1505
  initLoad() {
1510
1506
  this.loading.balance = this.config.balance.disabled;
1511
- this.loading.price = this.config.price.disabled;
1507
+ if (this.incomePrice) {
1508
+ this.loading.price = true;
1509
+ } else {
1510
+ this.loading.price = this.config.price.disabled;
1511
+ }
1512
1512
  this.loading.identity = this.config.identity.disable;
1513
1513
  this.isAgreeProtocol = this.config.agreement.disable;
1514
1514
  }
@@ -1561,6 +1561,9 @@ let PayPopup$1 = class PayPopup extends Vue {
1561
1561
  }
1562
1562
  // 计算最终金额
1563
1563
  get finalPrice() {
1564
+ if (this.incomePrice) {
1565
+ return this.incomePrice / 100;
1566
+ }
1564
1567
  return this.price.price / 100;
1565
1568
  }
1566
1569
  // 计算是否允许充值
@@ -1582,6 +1585,9 @@ __decorateClass([
1582
1585
  __decorateClass([
1583
1586
  Prop({ default: void 0 })
1584
1587
  ], PayPopup$1.prototype, "url", 2);
1588
+ __decorateClass([
1589
+ Prop({ default: void 0 })
1590
+ ], PayPopup$1.prototype, "incomePrice", 2);
1585
1591
  PayPopup$1 = __decorateClass([
1586
1592
  Component({
1587
1593
  components: {
@@ -1624,7 +1630,7 @@ var render = function() {
1624
1630
  on: {
1625
1631
  "change": _vm.onBanlanceChange
1626
1632
  }
1627
- }), _c("Divider")] : _vm._e(), !_vm.config.price.disabled ? [_c("PriceContainer", {
1633
+ }), _c("Divider")] : _vm._e(), !_vm.config.price.disabled ? [_vm.config.price.incoming ? [_c("h1", [_vm._v("¥" + _vm._s(_vm.finalPrice))])] : _c("PriceContainer", {
1628
1634
  on: {
1629
1635
  "change": _vm.onPriceChange
1630
1636
  }
@@ -1658,7 +1664,7 @@ var render = function() {
1658
1664
  on: {
1659
1665
  "click": _vm.onTopup
1660
1666
  }
1661
- }, [_vm._v(" " + _vm._s(_vm.$t(_vm.$getI18nKeyInPay("pay"))) + " " + _vm._s(_vm.config.price.currencySymbol) + _vm._s(_vm.finalPrice) + " ")])], 2);
1667
+ }, [_vm._v(" " + _vm._s(_vm.$t(_vm.$getI18nKeyInPay("pay"))) + " " + _vm._s(_vm.price.symbol || "¥") + _vm._s(_vm.finalPrice) + " ")])], 2);
1662
1668
  };
1663
1669
  var staticRenderFns = [];
1664
1670
  const popup_vue_vue_type_style_index_0_scoped_true_lang = "";
@@ -1669,7 +1675,7 @@ var __component__ = /* @__PURE__ */ normalizeComponent(
1669
1675
  staticRenderFns,
1670
1676
  false,
1671
1677
  __vue2_injectStyles,
1672
- "176a6a6d",
1678
+ "bdbfe540",
1673
1679
  null,
1674
1680
  null
1675
1681
  );
@@ -1681,6 +1687,10 @@ function __vue2_injectStyles(context) {
1681
1687
  const PayPopup2 = /* @__PURE__ */ function() {
1682
1688
  return __component__.exports;
1683
1689
  }();
1690
+ const getPrice = async (url) => {
1691
+ const prices = await request(url);
1692
+ return prices;
1693
+ };
1684
1694
  const ko = {
1685
1695
  "plugin-pay": {
1686
1696
  balance: "균형",
@@ -1716,18 +1726,6 @@ const messages = Object.keys(languageConfig).reduce((acc, key) => {
1716
1726
  }, {});
1717
1727
  const prefix = "plugin-pay";
1718
1728
  const getI18nKey = (key) => `${prefix}.${key}`;
1719
- const USDPrices = [
1720
- {
1721
- price: 1800,
1722
- count: 18,
1723
- id: 1
1724
- },
1725
- {
1726
- price: 5800,
1727
- count: 58,
1728
- id: 2
1729
- }
1730
- ];
1731
1729
  const krlotto = {
1732
1730
  theme: "#ff5757",
1733
1731
  name: getI18nKey("balance"),
@@ -1738,19 +1736,15 @@ const krlotto = {
1738
1736
  api: "/PlayerUser/GetMoney"
1739
1737
  },
1740
1738
  price: {
1741
- currencySymbol: "US$",
1742
1739
  disabled: false,
1743
- prices: USDPrices
1740
+ online: true,
1741
+ load: async () => {
1742
+ return await getPrice("/Payment/GetPayPal");
1743
+ }
1744
1744
  },
1745
1745
  channel: {
1746
1746
  api: "/SystemPayment/GetList",
1747
- ignores: [
1748
- "alipay",
1749
- "apple",
1750
- "platform",
1751
- "wechat",
1752
- "google"
1753
- ]
1747
+ ignores: ["alipay", "apple", "platform", "wechat", "google"]
1754
1748
  },
1755
1749
  pay: {
1756
1750
  key: "type"
@@ -1764,6 +1758,34 @@ const krlotto = {
1764
1758
  disable: true
1765
1759
  }
1766
1760
  };
1761
+ const answerer = {
1762
+ theme: "#5486f7",
1763
+ name: "购买套餐",
1764
+ needId: true,
1765
+ balance: {
1766
+ disabled: true
1767
+ },
1768
+ price: {
1769
+ disabled: false,
1770
+ incoming: true
1771
+ },
1772
+ channel: {
1773
+ api: "/SystemPayment/GetList",
1774
+ ignores: []
1775
+ },
1776
+ pay: {
1777
+ key: "goodsId",
1778
+ prefix: "Answerer"
1779
+ },
1780
+ identity: {
1781
+ disable: true,
1782
+ api: "/PlayerUser/GetUserInfo",
1783
+ auth: "/PlayerUser/Authentication"
1784
+ },
1785
+ agreement: {
1786
+ disable: true
1787
+ }
1788
+ };
1767
1789
  const user = {
1768
1790
  theme: "#ff4f4f",
1769
1791
  name: "幸运币余额",
@@ -1817,7 +1839,8 @@ const user = {
1817
1839
  const PayAllConfig = {
1818
1840
  agent,
1819
1841
  user,
1820
- krlotto
1842
+ krlotto,
1843
+ answerer
1821
1844
  };
1822
1845
  const plugin = {
1823
1846
  install(vue, options = {}) {
@@ -1831,8 +1854,11 @@ const plugin = {
1831
1854
  return new Promise((res, rej) => {
1832
1855
  const options2 = { ..._options };
1833
1856
  const config = PayAllConfig[type];
1834
- const { needId } = config;
1835
- const { id, url = "/" } = options2;
1857
+ const {
1858
+ needId,
1859
+ price: { incoming }
1860
+ } = config;
1861
+ const { id, url = "/", price: incomePrice } = options2;
1836
1862
  if (needId && !id) {
1837
1863
  Dialog({
1838
1864
  title: "参数异常",
@@ -1840,6 +1866,13 @@ const plugin = {
1840
1866
  });
1841
1867
  return;
1842
1868
  }
1869
+ if (incoming && !incomePrice) {
1870
+ Dialog({
1871
+ title: "参数异常",
1872
+ message: `需要传入价格 当前未传入!`
1873
+ });
1874
+ return;
1875
+ }
1843
1876
  const Constructor = Vue.extend(PayPopup2);
1844
1877
  const instance = new Constructor({
1845
1878
  // 注入配置
@@ -1847,7 +1880,9 @@ const plugin = {
1847
1880
  config,
1848
1881
  id,
1849
1882
  // 对 url 进行编码 /my?a=1 -> #/my?a=1 -> %23%2Fmy%3Fa%3D1%20
1850
- url: encodeURIComponent(`#${url}`)
1883
+ url: encodeURIComponent(`#${url}`),
1884
+ // 外部传入的价格
1885
+ incomePrice
1851
1886
  },
1852
1887
  // 注入国际化实例
1853
1888
  i18n
package/dist/pay.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('@charset "UTF-8";.protocol-popup[data-v-16cd68bd]{height:70vh;width:100vw;overflow-x:hidden}.protocol-popup .protocol[data-v-16cd68bd]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%}.protocol-popup .protocol .btn-box[data-v-16cd68bd]{height:10%;width:100%;display:flex;justify-content:space-around;padding:.1rem;box-sizing:content-box}.protocol-popup .protocol .btn-box>*[data-v-16cd68bd]{width:45%}.protocol-popup .protocol iframe[data-v-16cd68bd]{display:block;width:100%;height:90%;margin:0;border:0;padding:.16rem;box-sizing:border-box}.agreement[data-v-27f1af06]{display:flex;justify-content:center;align-items:center;font-size:.12rem;margin:.16rem 0 0}.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-20b4bf5f]{font-family:WeChat-Bold}.root[data-v-20b4bf5f]{text-align:center}.cell[data-v-4dcfe5ca]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-4dcfe5ca]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}.identity[data-v-5f9eb7e3]{margin-top:.16rem}@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-05e06290]{font-family:WeChat-Bold}.custom-price .input[data-v-05e06290]{font-size:.2rem;padding:0;margin-top:.16rem}@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-5e65f97e]{font-family:WeChat-Bold}.price-root[data-v-5e65f97e]{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-5e65f97e]{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-5e65f97e]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-5e65f97e]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-5e65f97e]{font-size:.12rem}.only-price[data-v-5e65f97e]{align-items:center;justify-content:center}.only-price .price[data-v-5e65f97e]{font-size:.2rem}.content[data-v-72566f6d]{width:100%;margin:.16rem 0;display:grid;grid-template-columns:repeat(3,1fr);gap:.1rem;box-sizing:border-box;font-weight:500}.loading[data-v-72566f6d]{display:flex;justify-content:center;align-items:center}.select[data-v-72566f6d]{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-176a6a6d]{font-family:WeChat-Bold}.pay-popup[data-v-176a6a6d]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-176a6a6d]{text-align:center;margin:.16rem 0}.pay-button[data-v-176a6a6d]{margin:.16rem 0 0}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
2
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vant"),require("vue"),require("vue-class-component"),require("vue-property-decorator")):"function"==typeof define&&define.amd?define(["exports","vant","vue","vue-class-component","vue-property-decorator"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).PayPlugin={},e.vant,e.Vue,e.Component,e.vuePropertyDecorator)}(this,function(e,t,n,o,i){"use strict";var r=Object.defineProperty,a=(e,t,n)=>(((e,t,n)=>{t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);async function s(e,t,n="POST"){return new Promise((o,i)=>{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 e=>{if(!e.ok){const t=await e.text();throw new Error(`HTTP ${e.status} ${e.statusText}: ${t}`)}try{return await e.json()}catch(t){i("解析 JSON 异常")}}).then(e=>{o(e)}).catch(e=>{let t=(null==e?void 0:e.message)||"未知异常";e.message.includes("404")?t="资源未找到":e.message.includes("500")?t="服务器错误":e instanceof TypeError&&"Failed to fetch"===e.message&&(t="网络连接失败"),i(t)})})}const c=(e,n="请求失败")=>(t.Dialog({title:n,message:e}),{status:!1,message:e}),l=async e=>{const{id:t,key:n,value:o,prefix:i}=e;let r=location.origin+`/Payment/${i||""}Alipay`;return r+=`?id=${t}`,n&&o?(r+=`&${n}=${o}&t=${Date.now()}`,location.href=r,{status:!0,message:"成功",data:a}):c("支付参数异常",`支付时缺少 key value 参数:${JSON.stringify(e)}`);var a},p=async e=>{const{id:n,key:o,value:i,prefix:r,url:a}=e;let s=location.origin+`/Payment/${r||""}Paypal?${o}=${i}&id=${n}`;a&&(s+=`&url=${a}`),t.Toast({type:"loading",duration:0,mask:!0}),location.href=s},u=/miniProgram/i.test(navigator.userAgent)&&/micromessenger/i.test(navigator.userAgent),d=e=>{var n;const{id:o,appid:i,key:r,value:a,prefix:s=""}=e;if(!i)return void t.Dialog({title:"小程序 id 不存在"});if(!localStorage.getItem("AppToken"))return void t.Dialog({title:"环境异常",message:"本地 AppToken 不存在! 请重新登录",showCancelButton:!1,confirmButtonText:"确定"});const c={appid:i,payKey:r,payValue:a,paymentId:o,payApi:`${location.origin}/Payment/${s}Weixin`,tokenKey:"AppToken",tokenValue:localStorage.getItem("AppToken")},l=`weixin://dl/business/?appid=${i}&path=pages/home/index&query=${encodeURIComponent(Object.entries(c).map(([e,t])=>`${e}=${String(t)}`).join("&"))}`;if(window.ReactNativeWebView)null==(n=window.ReactNativeWebView)||n.postMessage(JSON.stringify({type:"openUrl",data:{url:l},code:200}));else if(u){const e=Object.entries(c).map(([e,t])=>`${e}=${String(t)}`).join("&");uni.navigateTo({url:`/pages/home/pay?${e}`})}else location.href=l},h={alipay:l,wechat:d,paypal:p};function g(e,t){return e.filter(({type:e})=>!t.includes(e)&&(e in h||void 0))}const f=["platform"],y="https://czyxzs.xuelm.cn/agreement.html",m={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",ignores:f},pay:{key:"Money"},identity:{disable:!0,api:"/AgentUser/GetUserInfo",auth:"/AgentUser/Authentication"},agreement:{disable:!1,url:y}};var v=Object.defineProperty,P=Object.getOwnPropertyDescriptor,b=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?P(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&v(t,n,r),r};let _=class extends n{constructor(){super(...arguments),a(this,"value"),a(this,"config"),a(this,"open",!1)}mounted(){this.open=this.value}onValue(e){this.open=e}onOpen(e){this.$emit("input",e)}disagree(){this.$emit("disagree")}agreeProtocolAndPay(){this.$emit("agreeProtocolAndPay")}};b([i.Prop({default:!1})],_.prototype,"value",2),b([i.Inject()],_.prototype,"config",2),b([i.Watch("value")],_.prototype,"onValue",1),b([i.Watch("open")],_.prototype,"onOpen",1),_=b([o],_);function w(e,t,n,o,i,r,a,s){var c,l="function"==typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),o&&(l.functional=!0),r&&(l._scopeId="data-v-"+r),a?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},l._ssrRegister=c):i&&(c=s?function(){i.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:i),c)if(l.functional){l._injectStyles=c;var p=l.render;l.render=function(e,t){return c.call(t),p(e,t)}}else{var u=l.beforeCreate;l.beforeCreate=u?[].concat(u,c):[c]}return{exports:e,options:l}}const $={};var C=w(_,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("van-popup",{staticClass:"protocol-popup",attrs:{position:"bottom",overlay:!0,round:""},model:{value:e.open,callback:function(t){e.open=t},expression:"open"}},[n("div",{staticClass:"protocol"},[e.config.agreement.disable?e._e():[n("iframe",{attrs:{src:e.config.agreement.url}})],n("div",{staticClass:"btn-box"},[n("van-button",{attrs:{block:""},on:{click:e.disagree}},[e._v("不同意")]),n("van-button",{attrs:{color:e.config.theme,block:"",type:"primary"},on:{click:e.agreeProtocolAndPay}},[e._v("同意并支付")])],1)],2)])},[],!1,x,"16cd68bd",null,null);function x(e){for(let t in $)this[t]=$[t]}const k=function(){return C.exports}();var O=Object.defineProperty,I=Object.getOwnPropertyDescriptor,j=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?I(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&O(t,n,r),r};let S=class extends n{constructor(){super(...arguments),a(this,"value"),a(this,"config"),a(this,"agreeProtocolFlag","__isAgreeProtocol__"),a(this,"agree",!1),a(this,"show",!1)}mounted(){this.agree=Boolean(localStorage.getItem(this.agreeProtocolFlag)||!1)}onOpen(e){this.$emit("input",e),e?localStorage.setItem(this.agreeProtocolFlag,"true"):localStorage.removeItem(this.agreeProtocolFlag)}onValue(e){this.agree=e}openProtocol(){this.show=!0}disagree(){this.agree=!1,this.show=!1}agreeProtocol(){this.agree=!0,this.show=!1}agreeProtocolAndPay(){this.agreeProtocol(),this.$nextTick(()=>{this.$emit("pay")})}};j([i.Prop({default:!1})],S.prototype,"value",2),j([i.Inject()],S.prototype,"config",2),j([i.Watch("agree")],S.prototype,"onOpen",1),j([i.Watch("value")],S.prototype,"onValue",1),S=j([o({components:{AgreementPopup:k}})],S);var A=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"agreement"},[n("van-checkbox",{attrs:{"checked-color":e.config.theme,"icon-size":"12"},model:{value:e.agree,callback:function(t){e.agree=t},expression:"agree"}},[e._v(" 阅读并同意 "),n("span",{style:{color:e.config.theme},on:{click:function(t){return t.stopPropagation(),e.openProtocol.apply(null,arguments)}}},[e._v("充值协议")])]),n("AgreementPopup",{on:{disagree:e.disagree,agreeProtocolAndPay:e.agreeProtocolAndPay},model:{value:e.show,callback:function(t){e.show=t},expression:"show"}})],1)};const T={};var E=w(S,A,[],!1,D,"27f1af06",null,null);function D(e){for(let t in T)this[t]=T[t]}const U=function(){return E.exports}();var R=Object.defineProperty,L=Object.getOwnPropertyDescriptor,N=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?L(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&R(t,n,r),r};let V=class extends i.Vue{constructor(){super(...arguments),a(this,"load"),a(this,"loading",!0),a(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 e=await this.load().finally(()=>{this.loading=!1}).catch(e=>{this.message=e});null!=e&&this.$emit("done",e)}};N([i.Prop()],V.prototype,"load",2),V=N([i.Component],V);const B={};var M=w(V,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)},[],!1,G,"0817c014",null,null);function G(e){for(let t in B)this[t]=B[t]}const q=function(){return M.exports}();var W=Object.defineProperty,z=Object.getOwnPropertyDescriptor,F=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?z(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&W(t,n,r),r};let K=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"value",0)}load(){const{key:e,api:t}=this.config.balance;if(!t||!e)throw new Error("不存在 key 或 api");return(async(e,t)=>{const n=await s(e);return t in n?n[t]:(c(JSON.stringify(n)||"解析数据异常",`余额数据中不存在 ${t}`),0)})(t,e)}onBalanceLoad(e){this.value=e/100,this.$emit("change",e)}};F([i.Inject()],K.prototype,"config",2),K=F([i.Component({components:{PayError:q}})],K);const J={};var X=w(K,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)},[],!1,H,"20b4bf5f",null,null);function H(e){for(let t in J)this[t]=J[t]}const Q=function(){return X.exports}();const Y=async(e,t)=>function(e){return navigator.userAgent.toLowerCase().includes("micromessenger")?e.sort((e,t)=>"wechat"==e.type?-1:1):e}(g((await s(e)).map(({Id:e,PaymentValue:t,PaymentName:n,PaymentIcon:o,AgentDescribe:i})=>{const r=function(e){if(e.includes("支付宝"))return"alipay";if(e.includes("微信"))return"wechat";if(e.includes("平台币"))return"platform";if(e.includes("苹果"))return"apple";if(e.includes("PayPal"))return"paypal";if(e.includes("Google"))return"google";return"unknow"}(t);return{id:e,name:t,icon:o,type:r,appid:i}}),t));var Z=Object.defineProperty,ee=Object.getOwnPropertyDescriptor,te=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?ee(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Z(t,n,r),r};let ne=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"channels",[]),a(this,"select",0),a(this,"showPopover",!1)}get actions(){return this.channels.length?this.channels.map(({name:e,id:t,icon:n},o)=>({text:e,id:t,disabled:o==this.select})):[]}onSelect(e,t){this.select=t,this.$emit("change",this.channels[t])}get name(){let e=this.channels[this.select];return e?e.name:""}get ignores(){return this.config.channel.ignores||[]}load(){return Y(this.config.channel.api,this.ignores)}onLoadChannels(e){this.channels=g(e,this.ignores),this.$emit("change",this.channels[0])}};te([i.Inject()],ne.prototype,"config",2),ne=te([o({components:{PayError:q}})],ne);const oe={};var ie=w(ne,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(e._s(e.$t(e.$getI18nKeyInPay("payment"))))]),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(t){e.showPopover=t},expression:"showPopover"}})},[],!1,re,"4dcfe5ca",null,null);function re(e){for(let t in oe)this[t]=oe[t]}const ae=function(){return ie.exports}();var se=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,le=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?ce(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&se(t,n,r),r};let pe=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"name",""),a(this,"id",""),a(this,"status",!1)}get params(){return{RealName:this.name,IdCard:this.id}}async onSubmit(){await(async(e,t)=>{const{Message:n,Status:o}=await s(e,t);if(!o)throw new Error(n);return!0})(this.config.identity.auth,this.params).catch(e=>{t.Dialog({title:"认证失败",message:e})})&&this.$emit("done",this.params)}};le([i.Inject()],pe.prototype,"config",2),pe=le([o],pe);const ue={};var de=w(pe,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("van-form",{on:{submit:e.onSubmit}},[n("van-field",{attrs:{name:"姓名",label:"姓名",placeholder:"姓名",rules:[{required:!0,message:"请填写姓名"}]},model:{value:e.name,callback:function(t){e.name=t},expression:"name"}}),n("van-field",{attrs:{name:"身份证号码",label:"身份证号码",placeholder:"身份证号码",rules:[{required:!0,message:"请填写身份证号码"}]},model:{value:e.id,callback:function(t){e.id=t},expression:"id"}}),n("div",{staticStyle:{margin:"16px"}},[n("van-button",{attrs:{block:"",color:e.config.theme,"native-type":"submit"}},[e._v("认证")])],1)],1)},[],!1,he,null,null,null);function he(e){for(let t in ue)this[t]=ue[t]}const ge=function(){return de.exports}();var fe=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,me=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?ye(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&fe(t,n,r),r};let ve=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"showPopup",!1),a(this,"info",{status:!1,name:""})}get text(){return this.info.status?`已实名 ${this.info.name}`:"未实名 点击进行实名认证"}load(){return(async e=>{const t={status:!1,name:""},{RealName:n}=await s(e);if(null==n)throw new Error("不存在实名信息");return""==n||(t.name=n,t.status=!0),t})(this.config.identity.api)}done(e){Object.assign(this.info,e),this.$emit("onIdentity",e)}openPopup(){this.info.status||(this.showPopup=!0)}authDone(e){this.showPopup=!1,this.done({status:!0,name:e.RealName})}};me([i.Inject()],ve.prototype,"config",2),ve=me([o({components:{PayError:q,Identity:ge}})],ve);const Pe={};var be=w(ve,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("PayError",{attrs:{load:e.load},on:{done:e.done}},[n("van-notice-bar",{staticClass:"identity",attrs:{"left-icon":"user-circle-o",text:e.text},on:{click:e.openPopup}}),n("van-popup",{attrs:{position:"bottom",overlay:"",round:""},model:{value:e.showPopup,callback:function(t){e.showPopup=t},expression:"showPopup"}},[n("Identity",{on:{done:e.authDone}})],1)],1)},[],!1,_e,"5f9eb7e3",null,null);function _e(e){for(let t in Pe)this[t]=Pe[t]}const we=function(){return be.exports}();var $e=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,xe=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Ce(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&$e(t,n,r),r};let ke=class extends n{constructor(){super(...arguments),a(this,"customPrice"),a(this,"value",null)}onChange(e){this.$emit("input",Number(e))}};xe([i.Prop({default:null})],ke.prototype,"customPrice",2),ke=xe([o],ke);const Oe={};var Ie=w(ke,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(t){e.value=t},expression:"value"}})],1)},[],!1,je,"05e06290",null,null);function je(e){for(let t in Oe)this[t]=Oe[t]}const Se=function(){return Ie.exports}();var Ae=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,Ee=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Te(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Ae(t,n,r),r};let De=class extends n{constructor(){super(...arguments),a(this,"symbol"),a(this,"price")}get realPrice(){return this.price.price/100}get onlyPrice(){return!this.price.count}};Ee([i.Prop({default:"¥"})],De.prototype,"symbol",2),Ee([i.Prop({default:{}})],De.prototype,"price",2),De=Ee([o],De);const Ue={};var Re=w(De,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.symbol)+e._s(e.realPrice))])])},[],!1,Le,"5e65f97e",null,null);function Le(e){for(let t in Ue)this[t]=Ue[t]}const Ne=function(){return Re.exports}();var Ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Me=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Be(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Ve(t,n,r),r};let Ge=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"value",0),a(this,"prices",[]),a(this,"customPrice",0),a(this,"loading",!0),a(this,"message","")}async mounted(){}load(){const{load:e,prices:t}=this.config.price;return e||(t?new Promise(e=>e(t)):void 0)}onLoadPrices(e){this.prices=e,this.changePrice(0)}changePrice(e){this.value=e,this.$emit("change",this.prices[e])}onCustomPriceChange(e){e?this.$emit("change",{price:100*e}):this.$emit("change",this.prices[this.value])}};Me([i.Inject()],Ge.prototype,"config",2),Me([i.Watch("customPrice")],Ge.prototype,"onCustomPriceChange",1),Ge=Me([o({components:{PriceItem:Ne,PayError:q,PriceCustom:Se}})],Ge);const qe={};var We=w(Ge,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(e._s(e.$t(e.$getI18nKeyInPay("select"))))]),n("PayError",{attrs:{load:e.load},on:{done:e.onLoadPrices}},[n("div",{staticClass:"content"},e._l(e.prices,function(t,o){return n("price-item",{key:o,staticClass:"price-item",class:{select:o==e.value},style:{backgroundColor:o==e.value?e.config.theme||"orange":""},attrs:{price:t,symbol:e.config.price.currencySymbol||"¥"},nativeOn:{click:function(t){return e.changePrice(o)}}})}),1)]),e.config.price.custom?[n("PriceCustom",{model:{value:e.customPrice,callback:function(t){e.customPrice=t},expression:"customPrice"}})]:e._e()],2)},[],!1,ze,"72566f6d",null,null);function ze(e){for(let t in qe)this[t]=qe[t]}const Fe=function(){return We.exports}();var Ke=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Xe=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Je(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Ke(t,n,r),r};let He=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"id"),a(this,"url"),a(this,"isAgreeProtocol",!1),a(this,"baseTheme","orange"),a(this,"visible",!1),a(this,"balance",0),a(this,"price",{price:0}),a(this,"channel",null),a(this,"loading",{balance:!1,price:!1,channel:!1,identity:!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,this.loading.identity=this.config.identity.disable,this.isAgreeProtocol=this.config.agreement.disable}onClose(){this.$emit("onClose")}onClosed(){this.$emit("onClosed")}get agreementRef(){return this.$refs.agreementRef}async onTopup(){if(!this.isAgreeProtocol)return void this.agreementRef.openProtocol();const{key:e,prefix:n}=this.config.pay,o=String(this.id||this.price.id||this.price.price/100);this.channel?await(async e=>{const{type:n}=e;switch(n in h||t.Toast("暂不支持此渠道"),n){case"alipay":return await l(e);case"wechat":const{appid:n}=e;return n?await d(e):t.Dialog({title:"参数异常",message:"此渠道未配置小程序 appid 请先使用其他渠道!"});case"paypal":return await p(e);default:t.Toast("暂不支持此渠道")}})({...this.channel,key:e,value:o,prefix:n,url:this.url}):c("渠道不存在")}onBanlanceChange(e){this.loading.balance=!0}onChannelChange(e){this.channel=e,this.loading.channel=!0}onPriceChange(e){this.price=e,this.loading.price=!0}onIdentityChange(e){this.loading.identity=e.status}get finalPrice(){return this.price.price/100}get disable(){return!Object.values(this.loading).every(e=>!0===e)}get title(){return this.config.name}};Xe([i.Provide("config"),i.Prop({default:m})],He.prototype,"config",2),Xe([i.Prop({default:void 0})],He.prototype,"id",2),Xe([i.Prop({default:void 0})],He.prototype,"url",2),He=Xe([o({components:{Balance:Q,Divider:t.Divider,PriceContainer:Fe,Button:t.Button,PriceCustom:Se,Channels:ae,Agreement:U,Identity:we}})],He);const Qe={};var Ye=w(He,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("van-popup",{staticClass:"pay-popup",attrs:{position:"bottom",overlay:"",round:""},on:{closed:e.onClosed,close:e.onClose},model:{value:e.visible,callback:function(t){e.visible=t},expression:"visible"}},[n("h4",{staticClass:"title"},[e._v(" "+e._s(e.$t(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}}),e.config.identity.disable?e._e():[n("Identity",{on:{onIdentity:e.onIdentityChange}})],e.config.agreement.disable?e._e():[n("Agreement",{ref:"agreementRef",on:{pay:e.onTopup},model:{value:e.isAgreeProtocol,callback:function(t){e.isAgreeProtocol=t},expression:"isAgreeProtocol"}})],n("Button",{staticClass:"pay-button",attrs:{disabled:e.disable,color:e.config.theme||e.baseTheme,block:""},on:{click:e.onTopup}},[e._v(" "+e._s(e.$t(e.$getI18nKeyInPay("pay")))+" "+e._s(e.config.price.currencySymbol)+e._s(e.finalPrice)+" ")])],2)},[],!1,Ze,"176a6a6d",null,null);function Ze(e){for(let t in Qe)this[t]=Qe[t]}const et=function(){return Ye.exports}(),tt={"plugin-pay":{balance:"余额",select:"选择充值金额",payment:"付款方式",pay:"立即支付"}},nt={zh:{name:"简体中文",icon:"🇨🇳",messages:tt},ko:{name:"한국어",icon:"🇰🇷",messages:{"plugin-pay":{balance:"균형",select:"충전 금액을 선택하세요",payment:"결제 방법",pay:"지금 결제하세요"}}}},ot=Object.keys(nt).reduce((e,t)=>(e[t]=nt[t].messages,e),{}),it=e=>`plugin-pay.${e}`,rt={agent:m,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",ignores:f},pay:{key:"Money"},identity:{disable:!0,api:"/PlayerUser/GetUserInfo",auth:"/PlayerUser/Authentication"},agreement:{disable:!1,url:y}},krlotto:{theme:"#ff5757",name:it("balance"),needId:!1,balance:{disabled:!1,key:"PlaMoney",api:"/PlayerUser/GetMoney"},price:{currencySymbol:"US$",disabled:!1,prices:[{price:1800,count:18,id:1},{price:5800,count:58,id:2}]},channel:{api:"/SystemPayment/GetList",ignores:["alipay","apple","platform","wechat","google"]},pay:{key:"type"},identity:{disable:!0,api:"/PlayerUser/GetUserInfo",auth:"/PlayerUser/Authentication"},agreement:{disable:!0}}},at={install(e,o={}){let i=o.i18n;i&&Object.keys(ot).forEach(e=>{i.mergeLocaleMessage(e,ot[e])});e.prototype.$pay={create:(e,o)=>new Promise((r,a)=>{const s={...o},c=rt[e],{needId:l}=c,{id:p,url:u="/"}=s;if(l&&!p)return void t.Dialog({title:"参数异常",message:`${e} 类型需要传入订单号 当前未传入!`});const d=new(n.extend(et))({propsData:{config:c,id:p,url:encodeURIComponent(`#${u}`)},i18n:i});d.$on("onClosed",()=>{r(),setTimeout(()=>{var e;d.$destroy(),null==(e=d.$el.parentNode)||e.removeChild(d.$el)},300)}),d.$mount(),document.body.appendChild(d.$el)})},e.prototype.$getI18nKeyInPay=it}};e.PayPlugin=at,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ !function(){"use strict";try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('@charset "UTF-8";.protocol-popup[data-v-16cd68bd]{height:70vh;width:100vw;overflow-x:hidden}.protocol-popup .protocol[data-v-16cd68bd]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%}.protocol-popup .protocol .btn-box[data-v-16cd68bd]{height:10%;width:100%;display:flex;justify-content:space-around;padding:.1rem;box-sizing:content-box}.protocol-popup .protocol .btn-box>*[data-v-16cd68bd]{width:45%}.protocol-popup .protocol iframe[data-v-16cd68bd]{display:block;width:100%;height:90%;margin:0;border:0;padding:.16rem;box-sizing:border-box}.agreement[data-v-27f1af06]{display:flex;justify-content:center;align-items:center;font-size:.12rem;margin:.16rem 0 0}.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-20b4bf5f]{font-family:WeChat-Bold}.root[data-v-20b4bf5f]{text-align:center}.cell[data-v-4dcfe5ca]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-4dcfe5ca]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}.identity[data-v-5f9eb7e3]{margin-top:.16rem}@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-05e06290]{font-family:WeChat-Bold}.custom-price .input[data-v-05e06290]{font-size:.2rem;padding:0;margin-top:.16rem}@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-599f1980]{font-family:WeChat-Bold}.price-root[data-v-599f1980]{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-599f1980]{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-599f1980]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-599f1980]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-599f1980]{font-size:.12rem}.only-price[data-v-599f1980]{align-items:center;justify-content:center}.only-price .price[data-v-599f1980]{font-size:.2rem}.content[data-v-01a7ad83]{width:100%;margin:.16rem 0;display:grid;grid-template-columns:repeat(3,1fr);gap:.1rem;box-sizing:border-box;font-weight:500}.loading[data-v-01a7ad83]{display:flex;justify-content:center;align-items:center}.select[data-v-01a7ad83]{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-bdbfe540]{font-family:WeChat-Bold}.pay-popup[data-v-bdbfe540]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s;text-align:center}.title[data-v-bdbfe540]{text-align:center;margin:.16rem 0}.pay-button[data-v-bdbfe540]{margin:.16rem 0 0}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}}();
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vant"),require("vue"),require("vue-class-component"),require("vue-property-decorator")):"function"==typeof define&&define.amd?define(["exports","vant","vue","vue-class-component","vue-property-decorator"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).PayPlugin={},e.vant,e.Vue,e.Component,e.vuePropertyDecorator)}(this,function(e,t,n,o,i){"use strict";var r=Object.defineProperty,a=(e,t,n)=>(((e,t,n)=>{t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);async function s(e,t,n="POST"){return new Promise((o,i)=>{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 e=>{if(!e.ok){const t=await e.text();throw new Error(`HTTP ${e.status} ${e.statusText}: ${t}`)}try{return await e.json()}catch(t){i("解析 JSON 异常")}}).then(e=>{o(e)}).catch(e=>{let t=(null==e?void 0:e.message)||"未知异常";e.message.includes("404")?t="资源未找到":e.message.includes("500")?t="服务器错误":e instanceof TypeError&&"Failed to fetch"===e.message&&(t="网络连接失败"),i(t)})})}const c=(e,n="请求失败")=>(t.Dialog({title:n,message:e}),{status:!1,message:e}),l=async e=>{const{id:t,key:n,value:o,prefix:i}=e;let r=location.origin+`/Payment/${i||""}Alipay`;return r+=`?id=${t}`,n&&o?(r+=`&${n}=${o}&t=${Date.now()}`,location.href=r,{status:!0,message:"成功",data:a}):c("支付参数异常",`支付时缺少 key value 参数:${JSON.stringify(e)}`);var a},p=async e=>{const{id:n,key:o,value:i,prefix:r,url:a}=e;let s=location.origin+`/Payment/${r||""}Paypal?${o}=${i}&id=${n}`;a&&(s+=`&url=${a}`),t.Toast({type:"loading",duration:0,mask:!0}),location.href=s},u=/miniProgram/i.test(navigator.userAgent)&&/micromessenger/i.test(navigator.userAgent),d=e=>{var n;const{id:o,appid:i,key:r,value:a,prefix:s=""}=e;if(!i)return void t.Dialog({title:"小程序 id 不存在"});if(!localStorage.getItem("AppToken"))return void t.Dialog({title:"环境异常",message:"本地 AppToken 不存在! 请重新登录",showCancelButton:!1,confirmButtonText:"确定"});const c={appid:i,payKey:r,payValue:a,paymentId:o,payApi:`${location.origin}/Payment/${s}Weixin`,tokenKey:"AppToken",tokenValue:localStorage.getItem("AppToken")},l=`weixin://dl/business/?appid=${i}&path=pages/home/index&query=${encodeURIComponent(Object.entries(c).map(([e,t])=>`${e}=${String(t)}`).join("&"))}`;if(window.ReactNativeWebView)null==(n=window.ReactNativeWebView)||n.postMessage(JSON.stringify({type:"openUrl",data:{url:l},code:200}));else if(u){const e=Object.entries(c).map(([e,t])=>`${e}=${String(t)}`).join("&");uni.navigateTo({url:`/pages/home/pay?${e}`})}else location.href=l},h={alipay:l,wechat:d,paypal:p};function g(e,t){return e.filter(({type:e})=>!t.includes(e)&&(e in h||void 0))}const f=["platform"],m="https://czyxzs.xuelm.cn/agreement.html",y={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",ignores:f},pay:{key:"Money"},identity:{disable:!0,api:"/AgentUser/GetUserInfo",auth:"/AgentUser/Authentication"},agreement:{disable:!1,url:m}};var v=Object.defineProperty,P=Object.getOwnPropertyDescriptor,b=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?P(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&v(t,n,r),r};let w=class extends n{constructor(){super(...arguments),a(this,"value"),a(this,"config"),a(this,"open",!1)}mounted(){this.open=this.value}onValue(e){this.open=e}onOpen(e){this.$emit("input",e)}disagree(){this.$emit("disagree")}agreeProtocolAndPay(){this.$emit("agreeProtocolAndPay")}};b([i.Prop({default:!1})],w.prototype,"value",2),b([i.Inject()],w.prototype,"config",2),b([i.Watch("value")],w.prototype,"onValue",1),b([i.Watch("open")],w.prototype,"onOpen",1),w=b([o],w);function _(e,t,n,o,i,r,a,s){var c,l="function"==typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),o&&(l.functional=!0),r&&(l._scopeId="data-v-"+r),a?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},l._ssrRegister=c):i&&(c=s?function(){i.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:i),c)if(l.functional){l._injectStyles=c;var p=l.render;l.render=function(e,t){return c.call(t),p(e,t)}}else{var u=l.beforeCreate;l.beforeCreate=u?[].concat(u,c):[c]}return{exports:e,options:l}}const $={};var C=_(w,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("van-popup",{staticClass:"protocol-popup",attrs:{position:"bottom",overlay:!0,round:""},model:{value:e.open,callback:function(t){e.open=t},expression:"open"}},[n("div",{staticClass:"protocol"},[e.config.agreement.disable?e._e():[n("iframe",{attrs:{src:e.config.agreement.url}})],n("div",{staticClass:"btn-box"},[n("van-button",{attrs:{block:""},on:{click:e.disagree}},[e._v("不同意")]),n("van-button",{attrs:{color:e.config.theme,block:"",type:"primary"},on:{click:e.agreeProtocolAndPay}},[e._v("同意并支付")])],1)],2)])},[],!1,x,"16cd68bd",null,null);function x(e){for(let t in $)this[t]=$[t]}const k=function(){return C.exports}();var O=Object.defineProperty,I=Object.getOwnPropertyDescriptor,j=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?I(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&O(t,n,r),r};let A=class extends n{constructor(){super(...arguments),a(this,"value"),a(this,"config"),a(this,"agreeProtocolFlag","__isAgreeProtocol__"),a(this,"agree",!1),a(this,"show",!1)}mounted(){this.agree=Boolean(localStorage.getItem(this.agreeProtocolFlag)||!1)}onOpen(e){this.$emit("input",e),e?localStorage.setItem(this.agreeProtocolFlag,"true"):localStorage.removeItem(this.agreeProtocolFlag)}onValue(e){this.agree=e}openProtocol(){this.show=!0}disagree(){this.agree=!1,this.show=!1}agreeProtocol(){this.agree=!0,this.show=!1}agreeProtocolAndPay(){this.agreeProtocol(),this.$nextTick(()=>{this.$emit("pay")})}};j([i.Prop({default:!1})],A.prototype,"value",2),j([i.Inject()],A.prototype,"config",2),j([i.Watch("agree")],A.prototype,"onOpen",1),j([i.Watch("value")],A.prototype,"onValue",1),A=j([o({components:{AgreementPopup:k}})],A);var S=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"agreement"},[n("van-checkbox",{attrs:{"checked-color":e.config.theme,"icon-size":"12"},model:{value:e.agree,callback:function(t){e.agree=t},expression:"agree"}},[e._v(" 阅读并同意 "),n("span",{style:{color:e.config.theme},on:{click:function(t){return t.stopPropagation(),e.openProtocol.apply(null,arguments)}}},[e._v("充值协议")])]),n("AgreementPopup",{on:{disagree:e.disagree,agreeProtocolAndPay:e.agreeProtocolAndPay},model:{value:e.show,callback:function(t){e.show=t},expression:"show"}})],1)};const T={};var E=_(A,S,[],!1,D,"27f1af06",null,null);function D(e){for(let t in T)this[t]=T[t]}const U=function(){return E.exports}();var L=Object.defineProperty,R=Object.getOwnPropertyDescriptor,N=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?R(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&L(t,n,r),r};let G=class extends i.Vue{constructor(){super(...arguments),a(this,"load"),a(this,"loading",!0),a(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 e=await this.load().finally(()=>{this.loading=!1}).catch(e=>{this.message=e});null!=e&&this.$emit("done",e)}};N([i.Prop()],G.prototype,"load",2),G=N([i.Component],G);const V={};var B=_(G,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)},[],!1,M,"0817c014",null,null);function M(e){for(let t in V)this[t]=V[t]}const q=function(){return B.exports}();var W=Object.defineProperty,z=Object.getOwnPropertyDescriptor,F=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?z(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&W(t,n,r),r};let K=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"value",0)}load(){const{key:e,api:t}=this.config.balance;if(!t||!e)throw new Error("不存在 key 或 api");return(async(e,t)=>{const n=await s(e);return t in n?n[t]:(c(JSON.stringify(n)||"解析数据异常",`余额数据中不存在 ${t}`),0)})(t,e)}onBalanceLoad(e){this.value=e/100,this.$emit("change",e)}};F([i.Inject()],K.prototype,"config",2),K=F([i.Component({components:{PayError:q}})],K);const J={};var X=_(K,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)},[],!1,H,"20b4bf5f",null,null);function H(e){for(let t in J)this[t]=J[t]}const Q=function(){return X.exports}();const Y=async(e,t)=>function(e){return navigator.userAgent.toLowerCase().includes("micromessenger")?e.sort((e,t)=>"wechat"==e.type?-1:1):e}(g((await s(e)).map(({Id:e,PaymentValue:t,PaymentName:n,PaymentIcon:o,AgentDescribe:i})=>{const r=function(e){if(e.includes("支付宝"))return"alipay";if(e.includes("微信"))return"wechat";if(e.includes("平台币"))return"platform";if(e.includes("苹果"))return"apple";if(e.includes("PayPal"))return"paypal";if(e.includes("Google"))return"google";return"unknow"}(t);return{id:e,name:t,icon:o,type:r,appid:i}}),t));var Z=Object.defineProperty,ee=Object.getOwnPropertyDescriptor,te=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?ee(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Z(t,n,r),r};let ne=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"channels",[]),a(this,"select",0),a(this,"showPopover",!1)}get actions(){return this.channels.length?this.channels.map(({name:e,id:t,icon:n},o)=>({text:e,id:t,disabled:o==this.select})):[]}onSelect(e,t){this.select=t,this.$emit("change",this.channels[t])}get name(){let e=this.channels[this.select];return e?e.name:""}get ignores(){return this.config.channel.ignores||[]}load(){return Y(this.config.channel.api,this.ignores)}onLoadChannels(e){this.channels=g(e,this.ignores),this.$emit("change",this.channels[0])}};te([i.Inject()],ne.prototype,"config",2),ne=te([o({components:{PayError:q}})],ne);const oe={};var ie=_(ne,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(e._s(e.$t(e.$getI18nKeyInPay("payment"))))]),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(t){e.showPopover=t},expression:"showPopover"}})},[],!1,re,"4dcfe5ca",null,null);function re(e){for(let t in oe)this[t]=oe[t]}const ae=function(){return ie.exports}();var se=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,le=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?ce(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&se(t,n,r),r};let pe=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"name",""),a(this,"id",""),a(this,"status",!1)}get params(){return{RealName:this.name,IdCard:this.id}}async onSubmit(){await(async(e,t)=>{const{Message:n,Status:o}=await s(e,t);if(!o)throw new Error(n);return!0})(this.config.identity.auth,this.params).catch(e=>{t.Dialog({title:"认证失败",message:e})})&&this.$emit("done",this.params)}};le([i.Inject()],pe.prototype,"config",2),pe=le([o],pe);const ue={};var de=_(pe,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("van-form",{on:{submit:e.onSubmit}},[n("van-field",{attrs:{name:"姓名",label:"姓名",placeholder:"姓名",rules:[{required:!0,message:"请填写姓名"}]},model:{value:e.name,callback:function(t){e.name=t},expression:"name"}}),n("van-field",{attrs:{name:"身份证号码",label:"身份证号码",placeholder:"身份证号码",rules:[{required:!0,message:"请填写身份证号码"}]},model:{value:e.id,callback:function(t){e.id=t},expression:"id"}}),n("div",{staticStyle:{margin:"16px"}},[n("van-button",{attrs:{block:"",color:e.config.theme,"native-type":"submit"}},[e._v("认证")])],1)],1)},[],!1,he,null,null,null);function he(e){for(let t in ue)this[t]=ue[t]}const ge=function(){return de.exports}();var fe=Object.defineProperty,me=Object.getOwnPropertyDescriptor,ye=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?me(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&fe(t,n,r),r};let ve=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"showPopup",!1),a(this,"info",{status:!1,name:""})}get text(){return this.info.status?`已实名 ${this.info.name}`:"未实名 点击进行实名认证"}load(){return(async e=>{const t={status:!1,name:""},{RealName:n}=await s(e);if(null==n)throw new Error("不存在实名信息");return""==n||(t.name=n,t.status=!0),t})(this.config.identity.api)}done(e){Object.assign(this.info,e),this.$emit("onIdentity",e)}openPopup(){this.info.status||(this.showPopup=!0)}authDone(e){this.showPopup=!1,this.done({status:!0,name:e.RealName})}};ye([i.Inject()],ve.prototype,"config",2),ve=ye([o({components:{PayError:q,Identity:ge}})],ve);const Pe={};var be=_(ve,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("PayError",{attrs:{load:e.load},on:{done:e.done}},[n("van-notice-bar",{staticClass:"identity",attrs:{"left-icon":"user-circle-o",text:e.text},on:{click:e.openPopup}}),n("van-popup",{attrs:{position:"bottom",overlay:"",round:""},model:{value:e.showPopup,callback:function(t){e.showPopup=t},expression:"showPopup"}},[n("Identity",{on:{done:e.authDone}})],1)],1)},[],!1,we,"5f9eb7e3",null,null);function we(e){for(let t in Pe)this[t]=Pe[t]}const _e=function(){return be.exports}();var $e=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,xe=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Ce(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&$e(t,n,r),r};let ke=class extends n{constructor(){super(...arguments),a(this,"customPrice"),a(this,"value",null)}onChange(e){this.$emit("input",Number(e))}};xe([i.Prop({default:null})],ke.prototype,"customPrice",2),ke=xe([o],ke);const Oe={};var Ie=_(ke,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(t){e.value=t},expression:"value"}})],1)},[],!1,je,"05e06290",null,null);function je(e){for(let t in Oe)this[t]=Oe[t]}const Ae=function(){return Ie.exports}();var Se=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,Ee=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Te(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Se(t,n,r),r};let De=class extends n{constructor(){super(...arguments),a(this,"price")}get realPrice(){return this.price.price/100}get onlyPrice(){return!this.price.count}};Ee([i.Prop({default:{}})],De.prototype,"price",2),De=Ee([o],De);const Ue={};var Le=_(De,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.gift?n("span",{staticClass:"gift"},[e._v(" 赠"+e._s(e.price.gift)+" ")]):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/100)+" ")]):e._e(),n("span",{staticClass:"price"},[e._v(e._s(e.price.symbol||"¥")+e._s(e.realPrice))])])},[],!1,Re,"599f1980",null,null);function Re(e){for(let t in Ue)this[t]=Ue[t]}const Ne=function(){return Le.exports}();var Ge=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,Be=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Ve(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Ge(t,n,r),r};let Me=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"value",0),a(this,"prices",[]),a(this,"customPrice",0),a(this,"loading",!0),a(this,"message","")}async mounted(){}load(){const{load:e,prices:t}=this.config.price;return e?new Promise(async t=>await t(e())):t?new Promise(e=>e(t)):void 0}onLoadPrices(e){this.prices=e,this.changePrice(0)}changePrice(e){this.value=e,this.$emit("change",this.prices[e])}onCustomPriceChange(e){e?this.$emit("change",{price:100*e}):this.$emit("change",this.prices[this.value])}};Be([i.Inject()],Me.prototype,"config",2),Be([i.Watch("customPrice")],Me.prototype,"onCustomPriceChange",1),Me=Be([o({components:{PriceItem:Ne,PayError:q,PriceCustom:Ae}})],Me);const qe={};var We=_(Me,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(e._s(e.$t(e.$getI18nKeyInPay("select"))))]),n("PayError",{attrs:{load:e.load},on:{done:e.onLoadPrices}},[n("div",{staticClass:"content"},e._l(e.prices,function(t,o){return n("price-item",{key:o,staticClass:"price-item",class:{select:o==e.value},style:{backgroundColor:o==e.value?e.config.theme||"orange":""},attrs:{price:t},nativeOn:{click:function(t){return e.changePrice(o)}}})}),1)]),e.config.price.custom?[n("PriceCustom",{model:{value:e.customPrice,callback:function(t){e.customPrice=t},expression:"customPrice"}})]:e._e()],2)},[],!1,ze,"01a7ad83",null,null);function ze(e){for(let t in qe)this[t]=qe[t]}const Fe=function(){return We.exports}();var Ke=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Xe=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Je(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Ke(t,n,r),r};let He=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"id"),a(this,"url"),a(this,"incomePrice"),a(this,"isAgreeProtocol",!1),a(this,"baseTheme","orange"),a(this,"visible",!1),a(this,"balance",0),a(this,"price",{price:0}),a(this,"channel",null),a(this,"loading",{balance:!1,price:!1,channel:!1,identity:!1})}async mounted(){this.$nextTick(()=>{this.visible=!0,this.initLoad()})}initLoad(){this.loading.balance=this.config.balance.disabled,this.incomePrice?this.loading.price=!0:this.loading.price=this.config.price.disabled,this.loading.identity=this.config.identity.disable,this.isAgreeProtocol=this.config.agreement.disable}onClose(){this.$emit("onClose")}onClosed(){this.$emit("onClosed")}get agreementRef(){return this.$refs.agreementRef}async onTopup(){if(!this.isAgreeProtocol)return void this.agreementRef.openProtocol();const{key:e,prefix:n}=this.config.pay,o=String(this.id||this.price.id||this.price.price/100);this.channel?await(async e=>{const{type:n}=e;switch(n in h||t.Toast("暂不支持此渠道"),n){case"alipay":return await l(e);case"wechat":const{appid:n}=e;return n?await d(e):t.Dialog({title:"参数异常",message:"此渠道未配置小程序 appid 请先使用其他渠道!"});case"paypal":return await p(e);default:t.Toast("暂不支持此渠道")}})({...this.channel,key:e,value:o,prefix:n,url:this.url}):c("渠道不存在")}onBanlanceChange(e){this.loading.balance=!0}onChannelChange(e){this.channel=e,this.loading.channel=!0}onPriceChange(e){this.price=e,this.loading.price=!0}onIdentityChange(e){this.loading.identity=e.status}get finalPrice(){return this.incomePrice?this.incomePrice/100:this.price.price/100}get disable(){return!Object.values(this.loading).every(e=>!0===e)}get title(){return this.config.name}};Xe([i.Provide("config"),i.Prop({default:y})],He.prototype,"config",2),Xe([i.Prop({default:void 0})],He.prototype,"id",2),Xe([i.Prop({default:void 0})],He.prototype,"url",2),Xe([i.Prop({default:void 0})],He.prototype,"incomePrice",2),He=Xe([o({components:{Balance:Q,Divider:t.Divider,PriceContainer:Fe,Button:t.Button,PriceCustom:Ae,Channels:ae,Agreement:U,Identity:_e}})],He);const Qe={};var Ye=_(He,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("van-popup",{staticClass:"pay-popup",attrs:{position:"bottom",overlay:"",round:""},on:{closed:e.onClosed,close:e.onClose},model:{value:e.visible,callback:function(t){e.visible=t},expression:"visible"}},[n("h4",{staticClass:"title"},[e._v(" "+e._s(e.$t(e.title))+" ")]),e.config.balance.disabled?e._e():[n("Balance",{on:{change:e.onBanlanceChange}}),n("Divider")],e.config.price.disabled?e._e():[e.config.price.incoming?[n("h1",[e._v("¥"+e._s(e.finalPrice))])]:n("PriceContainer",{on:{change:e.onPriceChange}}),n("Divider")],n("Channels",{on:{change:e.onChannelChange}}),e.config.identity.disable?e._e():[n("Identity",{on:{onIdentity:e.onIdentityChange}})],e.config.agreement.disable?e._e():[n("Agreement",{ref:"agreementRef",on:{pay:e.onTopup},model:{value:e.isAgreeProtocol,callback:function(t){e.isAgreeProtocol=t},expression:"isAgreeProtocol"}})],n("Button",{staticClass:"pay-button",attrs:{disabled:e.disable,color:e.config.theme||e.baseTheme,block:""},on:{click:e.onTopup}},[e._v(" "+e._s(e.$t(e.$getI18nKeyInPay("pay")))+" "+e._s(e.price.symbol||"¥")+e._s(e.finalPrice)+" ")])],2)},[],!1,Ze,"bdbfe540",null,null);function Ze(e){for(let t in Qe)this[t]=Qe[t]}const et=function(){return Ye.exports}(),tt={"plugin-pay":{balance:"余额",select:"选择充值金额",payment:"付款方式",pay:"立即支付"}},nt={zh:{name:"简体中文",icon:"🇨🇳",messages:tt},ko:{name:"한국어",icon:"🇰🇷",messages:{"plugin-pay":{balance:"균형",select:"충전 금액을 선택하세요",payment:"결제 방법",pay:"지금 결제하세요"}}}},ot=Object.keys(nt).reduce((e,t)=>(e[t]=nt[t].messages,e),{}),it=e=>`plugin-pay.${e}`,rt={agent:y,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",ignores:f},pay:{key:"Money"},identity:{disable:!0,api:"/PlayerUser/GetUserInfo",auth:"/PlayerUser/Authentication"},agreement:{disable:!1,url:m}},krlotto:{theme:"#ff5757",name:it("balance"),needId:!1,balance:{disabled:!1,key:"PlaMoney",api:"/PlayerUser/GetMoney"},price:{disabled:!1,online:!0,load:async()=>await(async e=>await s(e))("/Payment/GetPayPal")},channel:{api:"/SystemPayment/GetList",ignores:["alipay","apple","platform","wechat","google"]},pay:{key:"type"},identity:{disable:!0,api:"/PlayerUser/GetUserInfo",auth:"/PlayerUser/Authentication"},agreement:{disable:!0}},answerer:{theme:"#5486f7",name:"购买套餐",needId:!0,balance:{disabled:!0},price:{disabled:!1,incoming:!0},channel:{api:"/SystemPayment/GetList",ignores:[]},pay:{key:"goodsId",prefix:"Answerer"},identity:{disable:!0,api:"/PlayerUser/GetUserInfo",auth:"/PlayerUser/Authentication"},agreement:{disable:!0}}},at={install(e,o={}){let i=o.i18n;i&&Object.keys(ot).forEach(e=>{i.mergeLocaleMessage(e,ot[e])});e.prototype.$pay={create:(e,o)=>new Promise((r,a)=>{const s={...o},c=rt[e],{needId:l,price:{incoming:p}}=c,{id:u,url:d="/",price:h}=s;if(l&&!u)return void t.Dialog({title:"参数异常",message:`${e} 类型需要传入订单号 当前未传入!`});if(p&&!h)return void t.Dialog({title:"参数异常",message:"需要传入价格 当前未传入!"});const g=new(n.extend(et))({propsData:{config:c,id:u,url:encodeURIComponent(`#${d}`),incomePrice:h},i18n:i});g.$on("onClosed",()=>{r(),setTimeout(()=>{var e;g.$destroy(),null==(e=g.$el.parentNode)||e.removeChild(g.$el)},300)}),g.$mount(),document.body.appendChild(g.$el)})},e.prototype.$getI18nKeyInPay=it}};e.PayPlugin=at,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,2 @@
1
+ import { Price } from "../types";
2
+ export declare const getPrice: (url: string) => Promise<Price[]>;
@@ -8,6 +8,8 @@ export default class PayPopup extends Vue {
8
8
  id?: string;
9
9
  /** 支付成功跳转的地址*/
10
10
  url?: string;
11
+ /** 外部传入的价格*/
12
+ incomePrice?: number;
11
13
  isAgreeProtocol: boolean;
12
14
  baseTheme: string;
13
15
  visible: boolean;
@@ -9,7 +9,7 @@ export default class PriceContainer extends Vue {
9
9
  message: string;
10
10
  mounted(): Promise<void>;
11
11
  /** 载入价目表*/
12
- load(): (() => Promise<Array<Price>>) | Promise<unknown> | undefined;
12
+ load(): Promise<unknown> | undefined;
13
13
  /** 价目表加载成功*/
14
14
  onLoadPrices(prices: Price[]): void;
15
15
  /** 切换价格*/
@@ -1,8 +1,6 @@
1
1
  import Vue from "vue";
2
- import { CurrencySymbol } from "../../config/currency";
3
2
  import { Price } from "../../types";
4
3
  export default class PriceItem extends Vue {
5
- symbol: CurrencySymbol;
6
4
  price: Price;
7
5
  get realPrice(): number;
8
6
  /** 是否仅有售价*/
@@ -0,0 +1,2 @@
1
+ import { Config } from "../types";
2
+ export declare const answerer: Config;
@@ -3,4 +3,5 @@ export declare const PayAllConfig: {
3
3
  readonly agent: import("../types").Config;
4
4
  readonly user: import("../types").Config;
5
5
  readonly krlotto: import("../types").Config;
6
+ readonly answerer: import("../types").Config;
6
7
  };
@@ -5,8 +5,23 @@ export declare const RMBPrices: {
5
5
  id: number;
6
6
  }[];
7
7
  /** 美元价格*/
8
- export declare const USDPrices: {
8
+ export declare const USDPrices: ({
9
+ /** 售价 (分)*/
9
10
  price: number;
11
+ /** 购买得到的平台币(分)*/
10
12
  count: number;
13
+ /** 商品编号*/
11
14
  id: number;
12
- }[];
15
+ /** 赠送数量(分)*/
16
+ gift: number;
17
+ /** 货币符号*/
18
+ symbol: string;
19
+ } | {
20
+ price: number;
21
+ count: number;
22
+ id: number;
23
+ /** 赠送数量(分)*/
24
+ gift?: undefined;
25
+ /** 货币符号*/
26
+ symbol?: undefined;
27
+ })[];
@@ -1,7 +1,6 @@
1
- import { CurrencySymbol } from "../config/currency";
2
1
  import { ChannelType } from "./channel";
3
2
  import { Price } from "./price";
4
- export type PayCreateType = "agent" | "user" | "krlotto";
3
+ export type PayCreateType = "agent" | "user" | "krlotto" | "answerer";
5
4
  export type PayAllConfigType = {
6
5
  [key in PayCreateType]: Config;
7
6
  };
@@ -33,8 +32,8 @@ export type Config = {
33
32
  prices?: Array<Price>;
34
33
  /** 远程加载方法*/
35
34
  load?: () => Promise<Array<Price>>;
36
- /** 货币符号*/
37
- currencySymbol?: CurrencySymbol;
35
+ /** 外部传入价格*/
36
+ incoming?: true;
38
37
  };
39
38
  /** 渠道*/
40
39
  channel: {
@@ -5,10 +5,14 @@ export type PayCreate = (type: PayCreateType, options?: PayCreateOptions) => Pro
5
5
  export interface PayCreateOptions {
6
6
  /** 订单编号
7
7
  * 某些场景下需要传入 比如解锁方案
8
- */
8
+ */
9
9
  id?: string;
10
10
  /** 支付成功后跳转的地址 注意格式为 `/my?a=1` 不要传 `/#/my?a=1`
11
11
  * - 目前仅支持 Paypal
12
- */
12
+ */
13
13
  url?: string;
14
+ /**
15
+ * 外部传入的价格 分级
16
+ */
17
+ price?: number;
14
18
  }
@@ -5,11 +5,11 @@ export interface Price {
5
5
  /** 代币数量(例如 60) */
6
6
  count?: number;
7
7
  /** 赠送代币数量(例如 10) */
8
- giftCount?: number;
9
- /** 附加赠品描述(例如“首充赠送”) */
10
- giftExten?: string;
8
+ gift?: number;
11
9
  /** 编号
12
10
  * @zhangcf 25.10.13 Paypal 的商品编号
13
- */
11
+ */
14
12
  id?: number | string;
13
+ /** 货币符号*/
14
+ symbol?: string;
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhangcf233/pay",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "main": "dist/pay.umd.js",
5
5
  "module": "dist/pay.es.js",
6
6
  "types": "dist/types/index.d.ts",