@zhangcf233/pay 1.0.15 → 1.0.17

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,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-08eae995]{height:70vh;width:100vw;overflow-x:hidden}.protocol-popup .protocol[data-v-08eae995]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%}.protocol-popup .protocol .btn-box[data-v-08eae995]{height:10%;width:100%;display:flex;justify-content:space-around;padding:.1rem;box-sizing:content-box}.protocol-popup .protocol .btn-box>*[data-v-08eae995]{width:45%}.protocol-popup .protocol iframe[data-v-08eae995]{display:block;width:100%;height:90%;margin:0;border:0;padding:.16rem;box-sizing:border-box}.agreement[data-v-2b4c6ff2]{display:flex;justify-content:center;align-items:center;font-size:.12rem;margin:.16rem 0}.pay-error-container[data-v-4b35a243]{position:relative}.pay-error-container .loading[data-v-4b35a243]{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-4b35a243]{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-be121d36]{font-family:WeChat-Bold}.root[data-v-be121d36]{text-align:center}.cell[data-v-a99c839a]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-a99c839a]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}.identity[data-v-5d6a9164]{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-54949b07]{font-family:WeChat-Bold}.custom-price .input[data-v-54949b07]{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-666b19be]{font-family:WeChat-Bold}.price-root[data-v-666b19be]{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-666b19be]{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-666b19be]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-666b19be]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-666b19be]{font-size:.14rem}.only-price[data-v-666b19be]{align-items:center;justify-content:center}.only-price .price[data-v-666b19be]{font-size:.2rem}.content[data-v-d054b7c8]{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-d054b7c8]{display:flex;justify-content:center;align-items:center}.select[data-v-d054b7c8]{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-97629b88]{font-family:WeChat-Bold}.pay-popup[data-v-97629b88]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-97629b88]{text-align:center;margin:.16rem 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 e=document.createElement("style");e.appendChild(document.createTextNode('@charset "UTF-8";.protocol-popup[data-v-1e3531b1]{height:70vh;width:100vw;overflow-x:hidden}.protocol-popup .protocol[data-v-1e3531b1]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%}.protocol-popup .protocol .btn-box[data-v-1e3531b1]{height:10%;width:100%;display:flex;justify-content:space-around;padding:.1rem;box-sizing:content-box}.protocol-popup .protocol .btn-box>*[data-v-1e3531b1]{width:45%}.protocol-popup .protocol iframe[data-v-1e3531b1]{display:block;width:100%;height:90%;margin:0;border:0;padding:.16rem;box-sizing:border-box}.agreement[data-v-017a359d]{display:flex;justify-content:center;align-items:center;font-size:.12rem;margin:.16rem 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-70746494]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-70746494]{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-79d1ed34]{font-family:WeChat-Bold}.price-root[data-v-79d1ed34]{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-79d1ed34]{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-79d1ed34]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-79d1ed34]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-79d1ed34]{font-size:.14rem}.only-price[data-v-79d1ed34]{align-items:center;justify-content:center}.only-price .price[data-v-79d1ed34]{font-size:.2rem}.content[data-v-a6f45494]{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-a6f45494]{display:flex;justify-content:center;align-items:center}.select[data-v-a6f45494]{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-1d8d4c3e]{font-family:WeChat-Bold}.pay-popup[data-v-1d8d4c3e]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-1d8d4c3e]{text-align:center;margin:.16rem 0}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
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) => {
@@ -61,29 +61,16 @@ const success = (data) => {
61
61
  data
62
62
  };
63
63
  };
64
- const ua = navigator.userAgent;
65
- const isZW = /ZW-APP/.test(ua);
66
64
  const alipay = async (options) => {
67
65
  const { id, key, value, prefix } = options;
68
66
  let url = location.origin + `/Payment/${prefix || ""}Alipay`;
69
- const qrcode = isZW;
70
- url += `?qrcode=${qrcode}&id=${id}`;
67
+ url += `?id=${id}`;
71
68
  if (!(key && value)) {
72
69
  return fail("支付参数异常", `支付时缺少 key value 参数:${JSON.stringify(options)}`);
73
70
  }
74
- url += `&${key}=${value}`;
75
- if (!qrcode) {
76
- location.href = url;
77
- return success();
78
- }
79
- const { Data, Status, Message } = await request(url, {}, "GET");
80
- if (!Status) {
81
- return fail("支付请求失败", Message || "请求支付结果异常");
82
- }
83
- if (!Data) {
84
- return fail("支付跳转地址不存在");
85
- }
86
- location.href = Data;
71
+ url += `&${key}=${value}&t=${Date.now()}`;
72
+ location.href = url;
73
+ return success();
87
74
  };
88
75
  const isMpWeixin = /miniProgram/i.test(navigator.userAgent) && /micromessenger/i.test(navigator.userAgent);
89
76
  const wechat = (params) => {
@@ -442,7 +429,7 @@ var __component__$a = /* @__PURE__ */ normalizeComponent(
442
429
  staticRenderFns$a,
443
430
  false,
444
431
  __vue2_injectStyles$a,
445
- "08eae995",
432
+ "1e3531b1",
446
433
  null,
447
434
  null
448
435
  );
@@ -585,7 +572,7 @@ var __component__$9 = /* @__PURE__ */ normalizeComponent(
585
572
  staticRenderFns$9,
586
573
  false,
587
574
  __vue2_injectStyles$9,
588
- "2b4c6ff2",
575
+ "017a359d",
589
576
  null,
590
577
  null
591
578
  );
@@ -689,7 +676,7 @@ var __component__$8 = /* @__PURE__ */ normalizeComponent(
689
676
  staticRenderFns$8,
690
677
  false,
691
678
  __vue2_injectStyles$8,
692
- "4b35a243",
679
+ "0817c014",
693
680
  null,
694
681
  null
695
682
  );
@@ -762,7 +749,7 @@ var __component__$7 = /* @__PURE__ */ normalizeComponent(
762
749
  staticRenderFns$7,
763
750
  false,
764
751
  __vue2_injectStyles$7,
765
- "be121d36",
752
+ "20b4bf5f",
766
753
  null,
767
754
  null
768
755
  );
@@ -774,6 +761,9 @@ function __vue2_injectStyles$7(context) {
774
761
  const Balance2 = /* @__PURE__ */ function() {
775
762
  return __component__$7.exports;
776
763
  }();
764
+ function isWechat() {
765
+ return navigator.userAgent.toLowerCase().includes("micromessenger");
766
+ }
777
767
  const getPayChannels = async (url, ignores) => {
778
768
  const list = await request(url);
779
769
  const newParamsList = list.map(({
@@ -792,7 +782,8 @@ const getPayChannels = async (url, ignores) => {
792
782
  appid
793
783
  };
794
784
  });
795
- return getEnabledChannel(newParamsList, ignores);
785
+ const enabledList = getEnabledChannel(newParamsList, ignores);
786
+ return sortChannel(enabledList);
796
787
  };
797
788
  function getChannelType(name) {
798
789
  if (name.includes("支付宝")) {
@@ -809,6 +800,15 @@ function getChannelType(name) {
809
800
  }
810
801
  return "unknow";
811
802
  }
803
+ function sortChannel(list) {
804
+ if (isWechat()) {
805
+ return list.sort((a, b) => {
806
+ return a.type == "wechat" ? -1 : 1;
807
+ });
808
+ } else {
809
+ return list;
810
+ }
811
+ }
812
812
  var __defProp$6 = Object.defineProperty;
813
813
  var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
814
814
  var __decorateClass$6 = (decorators, target, key, kind) => {
@@ -929,7 +929,7 @@ var __component__$6 = /* @__PURE__ */ normalizeComponent(
929
929
  staticRenderFns$6,
930
930
  false,
931
931
  __vue2_injectStyles$6,
932
- "a99c839a",
932
+ "70746494",
933
933
  null,
934
934
  null
935
935
  );
@@ -1193,7 +1193,7 @@ var __component__$4 = /* @__PURE__ */ normalizeComponent(
1193
1193
  staticRenderFns$4,
1194
1194
  false,
1195
1195
  __vue2_injectStyles$4,
1196
- "5d6a9164",
1196
+ "5f9eb7e3",
1197
1197
  null,
1198
1198
  null
1199
1199
  );
@@ -1266,7 +1266,7 @@ var __component__$3 = /* @__PURE__ */ normalizeComponent(
1266
1266
  staticRenderFns$3,
1267
1267
  false,
1268
1268
  __vue2_injectStyles$3,
1269
- "54949b07",
1269
+ "05e06290",
1270
1270
  null,
1271
1271
  null
1272
1272
  );
@@ -1338,7 +1338,7 @@ var __component__$2 = /* @__PURE__ */ normalizeComponent(
1338
1338
  staticRenderFns$2,
1339
1339
  false,
1340
1340
  __vue2_injectStyles$2,
1341
- "666b19be",
1341
+ "79d1ed34",
1342
1342
  null,
1343
1343
  null
1344
1344
  );
@@ -1469,7 +1469,7 @@ var __component__$1 = /* @__PURE__ */ normalizeComponent(
1469
1469
  staticRenderFns$1,
1470
1470
  false,
1471
1471
  __vue2_injectStyles$1,
1472
- "d054b7c8",
1472
+ "a6f45494",
1473
1473
  null,
1474
1474
  null
1475
1475
  );
@@ -1687,7 +1687,7 @@ var __component__ = /* @__PURE__ */ normalizeComponent(
1687
1687
  staticRenderFns,
1688
1688
  false,
1689
1689
  __vue2_injectStyles,
1690
- "97629b88",
1690
+ "1d8d4c3e",
1691
1691
  null,
1692
1692
  null
1693
1693
  );
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-08eae995]{height:70vh;width:100vw;overflow-x:hidden}.protocol-popup .protocol[data-v-08eae995]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%}.protocol-popup .protocol .btn-box[data-v-08eae995]{height:10%;width:100%;display:flex;justify-content:space-around;padding:.1rem;box-sizing:content-box}.protocol-popup .protocol .btn-box>*[data-v-08eae995]{width:45%}.protocol-popup .protocol iframe[data-v-08eae995]{display:block;width:100%;height:90%;margin:0;border:0;padding:.16rem;box-sizing:border-box}.agreement[data-v-2b4c6ff2]{display:flex;justify-content:center;align-items:center;font-size:.12rem;margin:.16rem 0}.pay-error-container[data-v-4b35a243]{position:relative}.pay-error-container .loading[data-v-4b35a243]{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-4b35a243]{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-be121d36]{font-family:WeChat-Bold}.root[data-v-be121d36]{text-align:center}.cell[data-v-a99c839a]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-a99c839a]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}.identity[data-v-5d6a9164]{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-54949b07]{font-family:WeChat-Bold}.custom-price .input[data-v-54949b07]{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-666b19be]{font-family:WeChat-Bold}.price-root[data-v-666b19be]{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-666b19be]{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-666b19be]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-666b19be]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-666b19be]{font-size:.14rem}.only-price[data-v-666b19be]{align-items:center;justify-content:center}.only-price .price[data-v-666b19be]{font-size:.2rem}.content[data-v-d054b7c8]{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-d054b7c8]{display:flex;justify-content:center;align-items:center}.select[data-v-d054b7c8]{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-97629b88]{font-family:WeChat-Bold}.pay-popup[data-v-97629b88]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-97629b88]{text-align:center;margin:.16rem 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=navigator.userAgent,p=/ZW-APP/.test(l),u=async e=>{const{id:t,key:n,value:o,prefix:i}=e;let r=location.origin+`/Payment/${i||""}Alipay`;const a=p;if(r+=`?qrcode=${a}&id=${t}`,!n||!o)return c("支付参数异常",`支付时缺少 key value 参数:${JSON.stringify(e)}`);if(r+=`&${n}=${o}`,!a)return location.href=r,{status:!0,message:"成功",data:l};var l;const{Data:u,Status:h,Message:d}=await s(r,{},"GET");return h?u?void(location.href=u):c("支付跳转地址不存在"):c("支付请求失败",d||"请求支付结果异常")},h=/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(h){const e=Object.entries(c).map(([e,t])=>`${e}=${String(t)}`).join("&");uni.navigateTo({url:`/pages/home/pay?${e}`})}else location.href=l},g={alipay:u,wechat:d};function f(e,t){return e.filter(({type:e})=>!t.includes(e)&&(e in g||void 0))}const m=["platform"],v="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:m},pay:{key:"Money"},identity:{disable:!1,api:"/AgentUser/GetUserInfo",auth:"/AgentUser/Authentication"},agreement:v},P={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:m},pay:{key:"Money"},identity:{disable:!1,api:"/PlayerUser/GetUserInfo",auth:"/PlayerUser/Authentication"},agreement:v}};var b=Object.defineProperty,w=Object.getOwnPropertyDescriptor,_=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?w(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&&b(t,n,r),r};let C=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")}};_([i.Prop({default:!1})],C.prototype,"value",2),_([i.Inject()],C.prototype,"config",2),_([i.Watch("value")],C.prototype,"onValue",1),_([i.Watch("open")],C.prototype,"onOpen",1),C=_([o],C);function x(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 k=x(C,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"},[n("iframe",{attrs:{src:e.config.agreement}}),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)])])},[],!1,O,"08eae995",null,null);function O(e){for(let t in $)this[t]=$[t]}const j=function(){return k.exports}();var A=Object.defineProperty,I=Object.getOwnPropertyDescriptor,S=(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&&A(t,n,r),r};let T=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")})}};S([i.Prop({default:!1})],T.prototype,"value",2),S([i.Inject()],T.prototype,"config",2),S([i.Watch("agree")],T.prototype,"onOpen",1),S([i.Watch("value")],T.prototype,"onValue",1),T=S([o({components:{AgreementPopup:j}})],T);var E=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 D={};var R=x(T,E,[],!1,N,"2b4c6ff2",null,null);function N(e){for(let t in D)this[t]=D[t]}const L=function(){return R.exports}();var U=Object.defineProperty,V=Object.getOwnPropertyDescriptor,B=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?V(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&&U(t,n,r),r};let q=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)}};B([i.Prop()],q.prototype,"load",2),q=B([i.Component],q);const M={};var W=x(q,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,"4b35a243",null,null);function G(e){for(let t in M)this[t]=M[t]}const z=function(){return W.exports}();var F=Object.defineProperty,J=Object.getOwnPropertyDescriptor,K=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?J(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&&F(t,n,r),r};let X=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)}};K([i.Inject()],X.prototype,"config",2),X=K([i.Component({components:{PayError:z}})],X);const H={};var Z=x(X,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,Q,"be121d36",null,null);function Q(e){for(let t in H)this[t]=H[t]}const Y=function(){return Z.exports}();var ee=Object.defineProperty,te=Object.getOwnPropertyDescriptor,ne=(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&&ee(t,n,r),r};let oe=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(async(e,t)=>f((await s(e)).map(({Id:e,PaymentValue:t,PaymentName:n,PaymentIcon:o,AgentDescribe:i})=>{const r=function(e){return e.includes("支付宝")?"alipay":e.includes("微信")?"wechat":e.includes("平台币")?"platform":e.includes("苹果")?"apple":"unknow"}(t);return{id:e,name:t,icon:o,type:r,appid:i}}),t))(this.config.channel.api,this.ignores)}onLoadChannels(e){this.channels=f(e,this.ignores),this.$emit("change",this.channels[0])}};ne([i.Inject()],oe.prototype,"config",2),oe=ne([o({components:{PayError:z}})],oe);const ie={};var re=x(oe,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(t){e.showPopover=t},expression:"showPopover"}})},[],!1,ae,"a99c839a",null,null);function ae(e){for(let t in ie)this[t]=ie[t]}const se=function(){return re.exports}();var ce=Object.defineProperty,le=Object.getOwnPropertyDescriptor,pe=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?le(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&&ce(t,n,r),r};let ue=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)}};pe([i.Inject()],ue.prototype,"config",2),ue=pe([o],ue);const he={};var de=x(ue,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,ge,null,null,null);function ge(e){for(let t in he)this[t]=he[t]}const fe=function(){return de.exports}();var me=Object.defineProperty,ve=Object.getOwnPropertyDescriptor,ye=(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&&me(t,n,r),r};let Pe=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()],Pe.prototype,"config",2),Pe=ye([o({components:{PayError:z,Identity:fe}})],Pe);const be={};var we=x(Pe,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,"5d6a9164",null,null);function _e(e){for(let t in be)this[t]=be[t]}const Ce=function(){return we.exports}();var xe=Object.defineProperty,$e=Object.getOwnPropertyDescriptor,ke=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?$e(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&&xe(t,n,r),r};let Oe=class extends n{constructor(){super(...arguments),a(this,"customPrice"),a(this,"value",null)}onChange(e){this.$emit("input",Number(e))}};ke([i.Prop({default:null})],Oe.prototype,"customPrice",2),Oe=ke([o],Oe);const je={};var Ae=x(Oe,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,Ie,"54949b07",null,null);function Ie(e){for(let t in je)this[t]=je[t]}const Se=function(){return Ae.exports}();var Te=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,De=(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&&Te(t,n,r),r};let Re=class extends n{constructor(){super(...arguments),a(this,"price")}get realPrice(){return this.price.price/100}get onlyPrice(){return!this.price.count}};De([i.Prop({default:{}})],Re.prototype,"price",2),Re=De([o],Re);const Ne={};var Le=x(Re,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))])])},[],!1,Ue,"666b19be",null,null);function Ue(e){for(let t in Ne)this[t]=Ne[t]}const Ve=function(){return Le.exports}();var Be=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Me=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?qe(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&&Be(t,n,r),r};let We=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()],We.prototype,"config",2),Me([i.Watch("customPrice")],We.prototype,"onCustomPriceChange",1),We=Me([o({components:{PriceItem:Ve,PayError:z,PriceCustom:Se}})],We);const Ge={};var ze=x(We,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(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,Fe,"d054b7c8",null,null);function Fe(e){for(let t in Ge)this[t]=Ge[t]}const Je=function(){return ze.exports}();var Ke=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,He=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Xe(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 Ze=class extends n{constructor(){super(...arguments),a(this,"config"),a(this,"id"),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}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.price/100);this.channel?await(async({channel:e,key:n,value:o,prefix:i})=>{const{type:r,id:a,appid:s}=e;switch(r in g||t.Toast("暂不支持此渠道"),r){case"alipay":return await u({id:a,key:n,value:o,prefix:i});case"wechat":return s?await d({appid:s,prefix:i,key:n,value:o,id:a}):t.Dialog({title:"参数异常",message:"此渠道未配置小程序 appid 请先使用其他渠道!"});default:t.Toast("暂不支持此渠道")}})({channel:this.channel,key:e,value:o,prefix:n}):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}};He([i.Provide("config"),i.Prop({default:y})],Ze.prototype,"config",2),He([i.Prop({default:void 0})],Ze.prototype,"id",2),Ze=He([o({components:{Balance:Y,Divider:t.Divider,PriceContainer:Je,Button:t.Button,PriceCustom:Se,Channels:se,Agreement:L,Identity:Ce}})],Ze);const Qe={};var Ye=x(Ze,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.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}})],n("Agreement",{ref:"agreementRef",on:{pay:e.onTopup},model:{value:e.isAgreeProtocol,callback:function(t){e.isAgreeProtocol=t},expression:"isAgreeProtocol"}}),n("Button",{attrs:{disabled:e.disable,color:e.config.theme||e.baseTheme,block:""},on:{click:e.onTopup}},[e._v(" 立即支付 "+e._s(e.finalPrice)+" 元 ")])],2)},[],!1,et,"97629b88",null,null);function et(e){for(let t in Qe)this[t]=Qe[t]}const tt=function(){return Ye.exports}(),nt={install(e){e.prototype.$pay={create:(e,...o)=>new Promise((i,r)=>{const a=P[e],{needId:s}=a,c=o[0];if(s&&!c)return void t.Dialog({title:"参数异常",message:`${e} 类型需要传入订单号 当前未传入!`});const l=new(n.extend(tt))({propsData:{config:a,id:c}});l.$on("onClosed",()=>{i(),setTimeout(()=>{var e;l.$destroy(),null==(e=l.$el.parentNode)||e.removeChild(l.$el)},300)}),l.$mount(),document.body.appendChild(l.$el)})}}};e.PayPlugin=nt,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
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-1e3531b1]{height:70vh;width:100vw;overflow-x:hidden}.protocol-popup .protocol[data-v-1e3531b1]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%}.protocol-popup .protocol .btn-box[data-v-1e3531b1]{height:10%;width:100%;display:flex;justify-content:space-around;padding:.1rem;box-sizing:content-box}.protocol-popup .protocol .btn-box>*[data-v-1e3531b1]{width:45%}.protocol-popup .protocol iframe[data-v-1e3531b1]{display:block;width:100%;height:90%;margin:0;border:0;padding:.16rem;box-sizing:border-box}.agreement[data-v-017a359d]{display:flex;justify-content:center;align-items:center;font-size:.12rem;margin:.16rem 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-70746494]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-70746494]{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-79d1ed34]{font-family:WeChat-Bold}.price-root[data-v-79d1ed34]{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-79d1ed34]{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-79d1ed34]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-79d1ed34]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-79d1ed34]{font-size:.14rem}.only-price[data-v-79d1ed34]{align-items:center;justify-content:center}.only-price .price[data-v-79d1ed34]{font-size:.2rem}.content[data-v-a6f45494]{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-a6f45494]{display:flex;justify-content:center;align-items:center}.select[data-v-a6f45494]{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-1d8d4c3e]{font-family:WeChat-Bold}.pay-popup[data-v-1d8d4c3e]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-1d8d4c3e]{text-align:center;margin:.16rem 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,s=(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 a(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:s}):c("支付参数异常",`支付时缺少 key value 参数:${JSON.stringify(e)}`);var s},p=/miniProgram/i.test(navigator.userAgent)&&/micromessenger/i.test(navigator.userAgent),u=e=>{var n;const{id:o,appid:i,key:r,value:s,prefix:a=""}=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:s,paymentId:o,payApi:`${location.origin}/Payment/${a}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(p){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:u};function d(e,t){return e.filter(({type:e})=>!t.includes(e)&&(e in h||void 0))}const g=["platform"],f="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:g},pay:{key:"Money"},identity:{disable:!1,api:"/AgentUser/GetUserInfo",auth:"/AgentUser/Authentication"},agreement:f},v={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:g},pay:{key:"Money"},identity:{disable:!1,api:"/PlayerUser/GetUserInfo",auth:"/PlayerUser/Authentication"},agreement:f}};var y=Object.defineProperty,P=Object.getOwnPropertyDescriptor,b=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?P(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&y(t,n,r),r};let w=class extends n{constructor(){super(...arguments),s(this,"value"),s(this,"config"),s(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,s,a){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),s?(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(s)},l._ssrRegister=c):i&&(c=a?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 C={};var x=_(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"},[n("iframe",{attrs:{src:e.config.agreement}}),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)])])},[],!1,$,"1e3531b1",null,null);function $(e){for(let t in C)this[t]=C[t]}const k=function(){return x.exports}();var O=Object.defineProperty,j=Object.getOwnPropertyDescriptor,A=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?j(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&O(t,n,r),r};let I=class extends n{constructor(){super(...arguments),s(this,"value"),s(this,"config"),s(this,"agreeProtocolFlag","__isAgreeProtocol__"),s(this,"agree",!1),s(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")})}};A([i.Prop({default:!1})],I.prototype,"value",2),A([i.Inject()],I.prototype,"config",2),A([i.Watch("agree")],I.prototype,"onOpen",1),A([i.Watch("value")],I.prototype,"onValue",1),I=A([o({components:{AgreementPopup:k}})],I);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=_(I,S,[],!1,D,"017a359d",null,null);function D(e){for(let t in T)this[t]=T[t]}const R=function(){return E.exports}();var L=Object.defineProperty,N=Object.getOwnPropertyDescriptor,U=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?N(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&L(t,n,r),r};let V=class extends i.Vue{constructor(){super(...arguments),s(this,"load"),s(this,"loading",!0),s(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)}};U([i.Prop()],V.prototype,"load",2),V=U([i.Component],V);const B={};var q=_(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,M,"0817c014",null,null);function M(e){for(let t in B)this[t]=B[t]}const W=function(){return q.exports}();var z=Object.defineProperty,F=Object.getOwnPropertyDescriptor,G=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?F(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&z(t,n,r),r};let J=class extends n{constructor(){super(...arguments),s(this,"config"),s(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 a(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)}};G([i.Inject()],J.prototype,"config",2),J=G([i.Component({components:{PayError:W}})],J);const K={};var X=_(J,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 K)this[t]=K[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}(d((await a(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";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,s=e.length-1;s>=0;s--)(i=e[s])&&(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),s(this,"config"),s(this,"channels",[]),s(this,"select",0),s(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=d(e,this.ignores),this.$emit("change",this.channels[0])}};te([i.Inject()],ne.prototype,"config",2),ne=te([o({components:{PayError:W}})],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("付款方式")]),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,"70746494",null,null);function re(e){for(let t in oe)this[t]=oe[t]}const se=function(){return ie.exports}();var ae=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,le=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?ce(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&ae(t,n,r),r};let pe=class extends n{constructor(){super(...arguments),s(this,"config"),s(this,"name",""),s(this,"id",""),s(this,"status",!1)}get params(){return{RealName:this.name,IdCard:this.id}}async onSubmit(){await(async(e,t)=>{const{Message:n,Status:o}=await a(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 he=_(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,de,null,null,null);function de(e){for(let t in ue)this[t]=ue[t]}const ge=function(){return he.exports}();var fe=Object.defineProperty,me=Object.getOwnPropertyDescriptor,ve=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?me(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&fe(t,n,r),r};let ye=class extends n{constructor(){super(...arguments),s(this,"config"),s(this,"showPopup",!1),s(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 a(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})}};ve([i.Inject()],ye.prototype,"config",2),ye=ve([o({components:{PayError:W,Identity:ge}})],ye);const Pe={};var be=_(ye,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 Ce=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,$e=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?xe(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Ce(t,n,r),r};let ke=class extends n{constructor(){super(...arguments),s(this,"customPrice"),s(this,"value",null)}onChange(e){this.$emit("input",Number(e))}};$e([i.Prop({default:null})],ke.prototype,"customPrice",2),ke=$e([o],ke);const Oe={};var je=_(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,Ae,"05e06290",null,null);function Ae(e){for(let t in Oe)this[t]=Oe[t]}const Ie=function(){return je.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,s=e.length-1;s>=0;s--)(i=e[s])&&(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),s(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 Re={};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.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))])])},[],!1,Ne,"79d1ed34",null,null);function Ne(e){for(let t in Re)this[t]=Re[t]}const Ue=function(){return Le.exports}();var Ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,qe=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Be(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Ve(t,n,r),r};let Me=class extends n{constructor(){super(...arguments),s(this,"config"),s(this,"value",0),s(this,"prices",[]),s(this,"customPrice",0),s(this,"loading",!0),s(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])}};qe([i.Inject()],Me.prototype,"config",2),qe([i.Watch("customPrice")],Me.prototype,"onCustomPriceChange",1),Me=qe([o({components:{PriceItem:Ue,PayError:W,PriceCustom:Ie}})],Me);const We={};var ze=_(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("选择充值金额")]),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,Fe,"a6f45494",null,null);function Fe(e){for(let t in We)this[t]=We[t]}const Ge=function(){return ze.exports}();var Je=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Xe=(e,t,n,o)=>{for(var i,r=o>1?void 0:o?Ke(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=(o?i(t,n,r):i(r))||r);return o&&r&&Je(t,n,r),r};let He=class extends n{constructor(){super(...arguments),s(this,"config"),s(this,"id"),s(this,"isAgreeProtocol",!1),s(this,"baseTheme","orange"),s(this,"visible",!1),s(this,"balance",0),s(this,"price",{price:0}),s(this,"channel",null),s(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}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.price/100);this.channel?await(async({channel:e,key:n,value:o,prefix:i})=>{const{type:r,id:s,appid:a}=e;switch(r in h||t.Toast("暂不支持此渠道"),r){case"alipay":return await l({id:s,key:n,value:o,prefix:i});case"wechat":return a?await u({appid:a,prefix:i,key:n,value:o,id:s}):t.Dialog({title:"参数异常",message:"此渠道未配置小程序 appid 请先使用其他渠道!"});default:t.Toast("暂不支持此渠道")}})({channel:this.channel,key:e,value:o,prefix:n}):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),He=Xe([o({components:{Balance:Q,Divider:t.Divider,PriceContainer:Ge,Button:t.Button,PriceCustom:Ie,Channels:se,Agreement:R,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.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}})],n("Agreement",{ref:"agreementRef",on:{pay:e.onTopup},model:{value:e.isAgreeProtocol,callback:function(t){e.isAgreeProtocol=t},expression:"isAgreeProtocol"}}),n("Button",{attrs:{disabled:e.disable,color:e.config.theme||e.baseTheme,block:""},on:{click:e.onTopup}},[e._v(" 立即支付 "+e._s(e.finalPrice)+" 元 ")])],2)},[],!1,Ze,"1d8d4c3e",null,null);function Ze(e){for(let t in Qe)this[t]=Qe[t]}const et=function(){return Ye.exports}(),tt={install(e){e.prototype.$pay={create:(e,...o)=>new Promise((i,r)=>{const s=v[e],{needId:a}=s,c=o[0];if(a&&!c)return void t.Dialog({title:"参数异常",message:`${e} 类型需要传入订单号 当前未传入!`});const l=new(n.extend(et))({propsData:{config:s,id:c}});l.$on("onClosed",()=>{i(),setTimeout(()=>{var e;l.$destroy(),null==(e=l.$el.parentNode)||e.removeChild(l.$el)},300)}),l.$mount(),document.body.appendChild(l.$el)})}}};e.PayPlugin=tt,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
@@ -4,7 +4,7 @@ export declare const EnableChannel: {
4
4
  alipay: (options: import("./pay").BasePayOptions) => Promise<{
5
5
  status: boolean;
6
6
  message: string;
7
- } | undefined>;
7
+ }>;
8
8
  wechat: import("./pay/wechat").Wechat;
9
9
  };
10
10
  /** 过滤当前支持的渠道*/
@@ -6,4 +6,4 @@ import { BasePayOptions } from ".";
6
6
  export declare const alipay: (options: BasePayOptions) => Promise<{
7
7
  status: boolean;
8
8
  message: string;
9
- } | undefined>;
9
+ }>;
@@ -0,0 +1 @@
1
+ export default function (): boolean;
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "name": "@zhangcf233/pay",
3
- "version": "1.0.15",
4
- "main": "dist/pay.umd.js",
5
- "module": "dist/pay.es.js",
6
- "types": "dist/types/index.d.ts",
7
- "style": "dist/style.css",
8
- "files": [
9
- "dist"
10
- ],
11
- "scripts": {
12
- "build:types": "vue-tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
13
- "build": " vite build && npm run build:types",
14
- "link": "npm run build && npm link",
15
- "prepublishOnly": "npm run build"
16
- },
17
- "peerDependencies": {
18
- "vant": "^2.13.8",
19
- "vue": "^2.6.14",
20
- "vue-class-component": "^7.2.3",
21
- "vue-property-decorator": "^9.1.2",
22
- "vue-template-compiler": "^2.6.14"
23
- },
24
- "devDependencies": {
25
- "rollup-plugin-visualizer": "^6.0.3",
26
- "sass": "^1.89.2",
27
- "sass-loader": "^12.0.0",
28
- "typescript": "^5.9.2",
29
- "vite": "^4.0.0",
30
- "vite-plugin-css-injected-by-js": "^3.5.2",
31
- "vite-plugin-vue2": "^2.0.0",
32
- "vue-tsc": "^3.0.5"
33
- },
34
- "exports": {
35
- ".": {
36
- "import": "./dist/pay.es.js",
37
- "require": "./dist/pay.umd.js",
38
- "types": "./dist/types/index.d.ts"
39
- }
40
- }
1
+ {
2
+ "name": "@zhangcf233/pay",
3
+ "version": "1.0.17",
4
+ "main": "dist/pay.umd.js",
5
+ "module": "dist/pay.es.js",
6
+ "types": "dist/types/index.d.ts",
7
+ "style": "dist/style.css",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build:types": "vue-tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
13
+ "build": " vite build && npm run build:types",
14
+ "link": "npm run build && npm link",
15
+ "prepublishOnly": "npm run build"
16
+ },
17
+ "peerDependencies": {
18
+ "vant": "^2.13.8",
19
+ "vue": "^2.6.14",
20
+ "vue-class-component": "^7.2.3",
21
+ "vue-property-decorator": "^9.1.2",
22
+ "vue-template-compiler": "^2.6.14"
23
+ },
24
+ "devDependencies": {
25
+ "rollup-plugin-visualizer": "^6.0.3",
26
+ "sass": "^1.89.2",
27
+ "sass-loader": "^12.0.0",
28
+ "typescript": "^5.9.2",
29
+ "vite": "^4.0.0",
30
+ "vite-plugin-css-injected-by-js": "^3.5.2",
31
+ "vite-plugin-vue2": "^2.0.0",
32
+ "vue-tsc": "^3.0.5"
33
+ },
34
+ "exports": {
35
+ ".": {
36
+ "import": "./dist/pay.es.js",
37
+ "require": "./dist/pay.umd.js",
38
+ "types": "./dist/types/index.d.ts"
39
+ }
40
+ }
41
41
  }