@zhangcf233/pay 1.0.17 → 1.1.0
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 +15 -0
- package/dist/pay.es.js +247 -91
- package/dist/pay.umd.js +2 -2
- package/dist/types/api/getEnabledChannel.d.ts +1 -0
- package/dist/types/api/pay/paypal.d.ts +5 -0
- package/dist/types/components/channels/channel-container.vue.d.ts +2 -2
- package/dist/types/components/price/price-container.vue.d.ts +2 -2
- package/dist/types/components/price/price.vue.d.ts +4 -2
- package/dist/types/config/agent.d.ts +2 -0
- package/dist/types/config/currency.d.ts +2 -0
- package/dist/types/config/default.d.ts +7 -0
- package/dist/types/config/index.d.ts +6 -0
- package/dist/types/config/kr-lotto.d.ts +2 -0
- package/dist/types/config/price.d.ts +12 -0
- package/dist/types/config/user.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/locales/index.d.ts +6 -0
- package/dist/types/locales/messages.d.ts +36 -0
- package/dist/types/plugin.d.ts +4 -1
- package/dist/types/types/channel.d.ts +2 -1
- package/dist/types/types/config.d.ts +9 -1
- package/dist/types/types/price.d.ts +4 -0
- package/package.json +5 -2
- package/dist/types/config.d.ts +0 -9
package/README.md
CHANGED
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-
|
|
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-5632b646]{font-family:WeChat-Bold}.pay-popup[data-v-5632b646]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-5632b646]{text-align:center;margin:.16rem 0}.pay-button[data-v-5632b646]{margin:.16rem 0 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) => {
|
|
@@ -62,8 +62,8 @@ const success = (data) => {
|
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
64
|
const alipay = async (options) => {
|
|
65
|
-
const { id, key, value, prefix } = options;
|
|
66
|
-
let url = location.origin + `/Payment/${
|
|
65
|
+
const { id, key, value, prefix: prefix2 } = options;
|
|
66
|
+
let url = location.origin + `/Payment/${prefix2 || ""}Alipay`;
|
|
67
67
|
url += `?id=${id}`;
|
|
68
68
|
if (!(key && value)) {
|
|
69
69
|
return fail("支付参数异常", `支付时缺少 key value 参数:${JSON.stringify(options)}`);
|
|
@@ -72,10 +72,15 @@ const alipay = async (options) => {
|
|
|
72
72
|
location.href = url;
|
|
73
73
|
return success();
|
|
74
74
|
};
|
|
75
|
+
const paypal = async (options) => {
|
|
76
|
+
const { id, key, value, prefix: prefix2 } = options;
|
|
77
|
+
let url = location.origin + `/Payment/${prefix2 || ""}Paypal?${key}=${value}&id=${id}`;
|
|
78
|
+
location.href = url;
|
|
79
|
+
};
|
|
75
80
|
const isMpWeixin = /miniProgram/i.test(navigator.userAgent) && /micromessenger/i.test(navigator.userAgent);
|
|
76
81
|
const wechat = (params) => {
|
|
77
82
|
var _a;
|
|
78
|
-
const { id, appid, key, value, prefix = "" } = params;
|
|
83
|
+
const { id, appid, key, value, prefix: prefix2 = "" } = params;
|
|
79
84
|
if (!appid) {
|
|
80
85
|
Dialog({
|
|
81
86
|
title: "小程序 id 不存在"
|
|
@@ -101,7 +106,7 @@ const wechat = (params) => {
|
|
|
101
106
|
/** 支付渠道id*/
|
|
102
107
|
paymentId: id,
|
|
103
108
|
/** 支付渠道接口*/
|
|
104
|
-
payApi: `${location.origin}/Payment/${
|
|
109
|
+
payApi: `${location.origin}/Payment/${prefix2}Weixin`,
|
|
105
110
|
/** tokenkey*/
|
|
106
111
|
tokenKey: "AppToken",
|
|
107
112
|
/** token 值*/
|
|
@@ -131,7 +136,8 @@ const wechat = (params) => {
|
|
|
131
136
|
};
|
|
132
137
|
const EnableChannel = {
|
|
133
138
|
alipay,
|
|
134
|
-
wechat
|
|
139
|
+
wechat,
|
|
140
|
+
paypal
|
|
135
141
|
};
|
|
136
142
|
function getEnabledChannel(list, ignoers) {
|
|
137
143
|
return list.filter(({ type }) => {
|
|
@@ -143,14 +149,15 @@ function getEnabledChannel(list, ignoers) {
|
|
|
143
149
|
}
|
|
144
150
|
});
|
|
145
151
|
}
|
|
146
|
-
const sendPay = async ({ channel, key, value, prefix }) => {
|
|
152
|
+
const sendPay = async ({ channel, key, value, prefix: prefix2 }) => {
|
|
147
153
|
const { type, id, appid } = channel;
|
|
148
154
|
if (!(type in EnableChannel)) {
|
|
155
|
+
console.log("channel—info", channel);
|
|
149
156
|
Toast(`暂不支持此渠道`);
|
|
150
157
|
}
|
|
151
158
|
switch (type) {
|
|
152
159
|
case "alipay":
|
|
153
|
-
return await alipay({ id, key, value, prefix });
|
|
160
|
+
return await alipay({ id, key, value, prefix: prefix2 });
|
|
154
161
|
case "wechat":
|
|
155
162
|
if (!appid) {
|
|
156
163
|
return Dialog({
|
|
@@ -160,19 +167,21 @@ const sendPay = async ({ channel, key, value, prefix }) => {
|
|
|
160
167
|
}
|
|
161
168
|
return await wechat({
|
|
162
169
|
appid,
|
|
163
|
-
prefix,
|
|
170
|
+
prefix: prefix2,
|
|
164
171
|
key,
|
|
165
172
|
value,
|
|
166
173
|
id
|
|
167
174
|
});
|
|
175
|
+
case "paypal":
|
|
176
|
+
return await paypal({ id, key, value, prefix: prefix2 });
|
|
168
177
|
default:
|
|
169
178
|
Toast(`暂不支持此渠道`);
|
|
170
179
|
}
|
|
171
180
|
};
|
|
172
|
-
const
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
const
|
|
181
|
+
const DefaultIgnorePlatform = ["platform"];
|
|
182
|
+
const DefaultAgreement = "https://czyxzs.xuelm.cn/agreement.html";
|
|
183
|
+
const DefaultTheme = "orange";
|
|
184
|
+
const agent = {
|
|
176
185
|
needId: false,
|
|
177
186
|
name: "店铺余额",
|
|
178
187
|
theme: "#4089ff",
|
|
@@ -208,68 +217,20 @@ const AgentConfig = {
|
|
|
208
217
|
},
|
|
209
218
|
channel: {
|
|
210
219
|
api: "/SystemPayment/GetList",
|
|
211
|
-
ignores:
|
|
220
|
+
ignores: DefaultIgnorePlatform
|
|
212
221
|
},
|
|
213
222
|
pay: {
|
|
214
223
|
key: "Money"
|
|
215
224
|
},
|
|
216
225
|
identity: {
|
|
217
|
-
disable:
|
|
226
|
+
disable: true,
|
|
218
227
|
api: "/AgentUser/GetUserInfo",
|
|
219
228
|
auth: "/AgentUser/Authentication"
|
|
220
229
|
},
|
|
221
|
-
agreement:
|
|
222
|
-
};
|
|
223
|
-
const UserConfig = {
|
|
224
|
-
theme: "#ff4f4f",
|
|
225
|
-
name: "幸运币余额",
|
|
226
|
-
needId: false,
|
|
227
|
-
balance: {
|
|
228
|
-
disabled: false,
|
|
229
|
-
key: "PlaMoney",
|
|
230
|
-
api: "/PlayerUser/GetMoney"
|
|
231
|
-
},
|
|
232
|
-
price: {
|
|
233
|
-
disabled: false,
|
|
234
|
-
custom: true,
|
|
235
|
-
prices: [
|
|
236
|
-
{
|
|
237
|
-
price: 200
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
price: 500
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
price: 1e3
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
price: 5e3
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
price: 1e4
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
price: 2e4
|
|
253
|
-
}
|
|
254
|
-
]
|
|
255
|
-
},
|
|
256
|
-
channel: {
|
|
257
|
-
api: "/SystemPayment/GetList",
|
|
258
|
-
ignores: ignorePlatform
|
|
259
|
-
},
|
|
260
|
-
pay: {
|
|
261
|
-
key: "Money"
|
|
262
|
-
},
|
|
263
|
-
identity: {
|
|
230
|
+
agreement: {
|
|
264
231
|
disable: false,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
},
|
|
268
|
-
agreement: BaseAgreement
|
|
269
|
-
};
|
|
270
|
-
const PayAllConfig = {
|
|
271
|
-
agent: AgentConfig,
|
|
272
|
-
user: UserConfig
|
|
232
|
+
url: DefaultAgreement
|
|
233
|
+
}
|
|
273
234
|
};
|
|
274
235
|
var __defProp$a = Object.defineProperty;
|
|
275
236
|
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
@@ -340,11 +301,11 @@ var render$a = function() {
|
|
|
340
301
|
}
|
|
341
302
|
}, [_c("div", {
|
|
342
303
|
staticClass: "protocol"
|
|
343
|
-
}, [_c("iframe", {
|
|
304
|
+
}, [!_vm.config.agreement.disable ? [_c("iframe", {
|
|
344
305
|
attrs: {
|
|
345
|
-
"src": _vm.config.agreement
|
|
306
|
+
"src": _vm.config.agreement.url
|
|
346
307
|
}
|
|
347
|
-
}), _c("div", {
|
|
308
|
+
})] : _vm._e(), _c("div", {
|
|
348
309
|
staticClass: "btn-box"
|
|
349
310
|
}, [_c("van-button", {
|
|
350
311
|
attrs: {
|
|
@@ -362,7 +323,7 @@ var render$a = function() {
|
|
|
362
323
|
on: {
|
|
363
324
|
"click": _vm.agreeProtocolAndPay
|
|
364
325
|
}
|
|
365
|
-
}, [_vm._v("同意并支付")])], 1)])]);
|
|
326
|
+
}, [_vm._v("同意并支付")])], 1)], 2)]);
|
|
366
327
|
};
|
|
367
328
|
var staticRenderFns$a = [];
|
|
368
329
|
const popup_vue_vue_type_style_index_0_scoped_true_lang$2 = "";
|
|
@@ -429,7 +390,7 @@ var __component__$a = /* @__PURE__ */ normalizeComponent(
|
|
|
429
390
|
staticRenderFns$a,
|
|
430
391
|
false,
|
|
431
392
|
__vue2_injectStyles$a,
|
|
432
|
-
"
|
|
393
|
+
"16cd68bd",
|
|
433
394
|
null,
|
|
434
395
|
null
|
|
435
396
|
);
|
|
@@ -572,7 +533,7 @@ var __component__$9 = /* @__PURE__ */ normalizeComponent(
|
|
|
572
533
|
staticRenderFns$9,
|
|
573
534
|
false,
|
|
574
535
|
__vue2_injectStyles$9,
|
|
575
|
-
"
|
|
536
|
+
"27f1af06",
|
|
576
537
|
null,
|
|
577
538
|
null
|
|
578
539
|
);
|
|
@@ -798,6 +759,12 @@ function getChannelType(name) {
|
|
|
798
759
|
if (name.includes("苹果")) {
|
|
799
760
|
return "apple";
|
|
800
761
|
}
|
|
762
|
+
if (name.includes("PayPal")) {
|
|
763
|
+
return "paypal";
|
|
764
|
+
}
|
|
765
|
+
if (name.includes("Google")) {
|
|
766
|
+
return "google";
|
|
767
|
+
}
|
|
801
768
|
return "unknow";
|
|
802
769
|
}
|
|
803
770
|
function sortChannel(list) {
|
|
@@ -895,7 +862,7 @@ var render$6 = function() {
|
|
|
895
862
|
fn: function() {
|
|
896
863
|
return [_c("div", {
|
|
897
864
|
staticClass: "cell"
|
|
898
|
-
}, [_c("h5", [_vm._v("
|
|
865
|
+
}, [_c("h5", [_vm._v(_vm._s(_vm.$t(_vm.$getI18nKeyInPay("payment"))))]), _c("PayError", {
|
|
899
866
|
staticClass: "name",
|
|
900
867
|
attrs: {
|
|
901
868
|
"load": _vm.load
|
|
@@ -929,7 +896,7 @@ var __component__$6 = /* @__PURE__ */ normalizeComponent(
|
|
|
929
896
|
staticRenderFns$6,
|
|
930
897
|
false,
|
|
931
898
|
__vue2_injectStyles$6,
|
|
932
|
-
"
|
|
899
|
+
"4dcfe5ca",
|
|
933
900
|
null,
|
|
934
901
|
null
|
|
935
902
|
);
|
|
@@ -1292,6 +1259,7 @@ var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
|
1292
1259
|
let PriceItem$1 = class PriceItem extends Vue {
|
|
1293
1260
|
constructor() {
|
|
1294
1261
|
super(...arguments);
|
|
1262
|
+
__publicField(this, "symbol");
|
|
1295
1263
|
__publicField(this, "price");
|
|
1296
1264
|
}
|
|
1297
1265
|
get realPrice() {
|
|
@@ -1302,6 +1270,9 @@ let PriceItem$1 = class PriceItem extends Vue {
|
|
|
1302
1270
|
return !this.price.count;
|
|
1303
1271
|
}
|
|
1304
1272
|
};
|
|
1273
|
+
__decorateClass$2([
|
|
1274
|
+
Prop({ default: "¥" })
|
|
1275
|
+
], PriceItem$1.prototype, "symbol", 2);
|
|
1305
1276
|
__decorateClass$2([
|
|
1306
1277
|
Prop({ default: {} })
|
|
1307
1278
|
], PriceItem$1.prototype, "price", 2);
|
|
@@ -1327,7 +1298,7 @@ var render$2 = function() {
|
|
|
1327
1298
|
}
|
|
1328
1299
|
}), _vm._v(" " + _vm._s(_vm.price.count) + " ")]) : _vm._e(), _c("span", {
|
|
1329
1300
|
staticClass: "price"
|
|
1330
|
-
}, [_vm._v(
|
|
1301
|
+
}, [_vm._v(_vm._s(_vm.symbol) + _vm._s(_vm.realPrice))])]);
|
|
1331
1302
|
};
|
|
1332
1303
|
var staticRenderFns$2 = [];
|
|
1333
1304
|
const price_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
@@ -1338,7 +1309,7 @@ var __component__$2 = /* @__PURE__ */ normalizeComponent(
|
|
|
1338
1309
|
staticRenderFns$2,
|
|
1339
1310
|
false,
|
|
1340
1311
|
__vue2_injectStyles$2,
|
|
1341
|
-
"
|
|
1312
|
+
"5e65f97e",
|
|
1342
1313
|
null,
|
|
1343
1314
|
null
|
|
1344
1315
|
);
|
|
@@ -1422,7 +1393,7 @@ var render$1 = function() {
|
|
|
1422
1393
|
var _c = _vm._self._c || _h;
|
|
1423
1394
|
return !_vm.config.price.disabled ? _c("div", {
|
|
1424
1395
|
staticClass: "price-container"
|
|
1425
|
-
}, [_c("h5", [_vm._v("
|
|
1396
|
+
}, [_c("h5", [_vm._v(_vm._s(_vm.$t(_vm.$getI18nKeyInPay("select"))))]), _c("PayError", {
|
|
1426
1397
|
attrs: {
|
|
1427
1398
|
"load": _vm.load
|
|
1428
1399
|
},
|
|
@@ -1442,7 +1413,8 @@ var render$1 = function() {
|
|
|
1442
1413
|
backgroundColor: index == _vm.value ? _vm.config.theme || "orange" : ""
|
|
1443
1414
|
},
|
|
1444
1415
|
attrs: {
|
|
1445
|
-
"price": p
|
|
1416
|
+
"price": p,
|
|
1417
|
+
"symbol": _vm.config.price.currencySymbol || "¥"
|
|
1446
1418
|
},
|
|
1447
1419
|
nativeOn: {
|
|
1448
1420
|
"click": function($event) {
|
|
@@ -1469,7 +1441,7 @@ var __component__$1 = /* @__PURE__ */ normalizeComponent(
|
|
|
1469
1441
|
staticRenderFns$1,
|
|
1470
1442
|
false,
|
|
1471
1443
|
__vue2_injectStyles$1,
|
|
1472
|
-
"
|
|
1444
|
+
"72566f6d",
|
|
1473
1445
|
null,
|
|
1474
1446
|
null
|
|
1475
1447
|
);
|
|
@@ -1500,7 +1472,7 @@ let PayPopup$1 = class PayPopup extends Vue {
|
|
|
1500
1472
|
// 是否同意支付协议
|
|
1501
1473
|
__publicField(this, "isAgreeProtocol", false);
|
|
1502
1474
|
// 默认主题
|
|
1503
|
-
__publicField(this, "baseTheme",
|
|
1475
|
+
__publicField(this, "baseTheme", DefaultTheme);
|
|
1504
1476
|
// 弹出层是否显示
|
|
1505
1477
|
__publicField(this, "visible", false);
|
|
1506
1478
|
// 余额
|
|
@@ -1534,6 +1506,7 @@ let PayPopup$1 = class PayPopup extends Vue {
|
|
|
1534
1506
|
this.loading.balance = this.config.balance.disabled;
|
|
1535
1507
|
this.loading.price = this.config.price.disabled;
|
|
1536
1508
|
this.loading.identity = this.config.identity.disable;
|
|
1509
|
+
this.isAgreeProtocol = this.config.agreement.disable;
|
|
1537
1510
|
}
|
|
1538
1511
|
// 关闭弹出层
|
|
1539
1512
|
onClose() {
|
|
@@ -1553,8 +1526,8 @@ let PayPopup$1 = class PayPopup extends Vue {
|
|
|
1553
1526
|
this.agreementRef.openProtocol();
|
|
1554
1527
|
return;
|
|
1555
1528
|
}
|
|
1556
|
-
const { key, prefix } = this.config.pay;
|
|
1557
|
-
const value = String(this.id || this.price.price / 100);
|
|
1529
|
+
const { key, prefix: prefix2 } = this.config.pay;
|
|
1530
|
+
const value = String(this.id || this.price.id || this.price.price / 100);
|
|
1558
1531
|
if (!this.channel) {
|
|
1559
1532
|
fail("渠道不存在");
|
|
1560
1533
|
return;
|
|
@@ -1563,7 +1536,7 @@ let PayPopup$1 = class PayPopup extends Vue {
|
|
|
1563
1536
|
channel: this.channel,
|
|
1564
1537
|
key,
|
|
1565
1538
|
value,
|
|
1566
|
-
prefix
|
|
1539
|
+
prefix: prefix2
|
|
1567
1540
|
});
|
|
1568
1541
|
}
|
|
1569
1542
|
/** 余额变动*/
|
|
@@ -1596,7 +1569,7 @@ let PayPopup$1 = class PayPopup extends Vue {
|
|
|
1596
1569
|
};
|
|
1597
1570
|
__decorateClass([
|
|
1598
1571
|
Provide("config"),
|
|
1599
|
-
Prop({ default:
|
|
1572
|
+
Prop({ default: agent })
|
|
1600
1573
|
], PayPopup$1.prototype, "config", 2);
|
|
1601
1574
|
__decorateClass([
|
|
1602
1575
|
Prop({ default: void 0 })
|
|
@@ -1639,7 +1612,7 @@ var render = function() {
|
|
|
1639
1612
|
}
|
|
1640
1613
|
}, [_c("h4", {
|
|
1641
1614
|
staticClass: "title"
|
|
1642
|
-
}, [_vm._v(" " + _vm._s(_vm.title) + " ")]), !_vm.config.balance.disabled ? [_c("Balance", {
|
|
1615
|
+
}, [_vm._v(" " + _vm._s(_vm.$t(_vm.title)) + " ")]), !_vm.config.balance.disabled ? [_c("Balance", {
|
|
1643
1616
|
on: {
|
|
1644
1617
|
"change": _vm.onBanlanceChange
|
|
1645
1618
|
}
|
|
@@ -1655,7 +1628,7 @@ var render = function() {
|
|
|
1655
1628
|
on: {
|
|
1656
1629
|
"onIdentity": _vm.onIdentityChange
|
|
1657
1630
|
}
|
|
1658
|
-
})] : _vm._e(), _c("Agreement", {
|
|
1631
|
+
})] : _vm._e(), !_vm.config.agreement.disable ? [_c("Agreement", {
|
|
1659
1632
|
ref: "agreementRef",
|
|
1660
1633
|
on: {
|
|
1661
1634
|
"pay": _vm.onTopup
|
|
@@ -1667,7 +1640,8 @@ var render = function() {
|
|
|
1667
1640
|
},
|
|
1668
1641
|
expression: "isAgreeProtocol"
|
|
1669
1642
|
}
|
|
1670
|
-
}), _c("Button", {
|
|
1643
|
+
})] : _vm._e(), _c("Button", {
|
|
1644
|
+
staticClass: "pay-button",
|
|
1671
1645
|
attrs: {
|
|
1672
1646
|
"disabled": _vm.disable,
|
|
1673
1647
|
"color": _vm.config.theme || _vm.baseTheme,
|
|
@@ -1676,7 +1650,7 @@ var render = function() {
|
|
|
1676
1650
|
on: {
|
|
1677
1651
|
"click": _vm.onTopup
|
|
1678
1652
|
}
|
|
1679
|
-
}, [_vm._v("
|
|
1653
|
+
}, [_vm._v(" " + _vm._s(_vm.$t(_vm.$getI18nKeyInPay("pay"))) + " " + _vm._s(_vm.config.price.currencySymbol) + _vm._s(_vm.finalPrice) + " ")])], 2);
|
|
1680
1654
|
};
|
|
1681
1655
|
var staticRenderFns = [];
|
|
1682
1656
|
const popup_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
@@ -1687,7 +1661,7 @@ var __component__ = /* @__PURE__ */ normalizeComponent(
|
|
|
1687
1661
|
staticRenderFns,
|
|
1688
1662
|
false,
|
|
1689
1663
|
__vue2_injectStyles,
|
|
1690
|
-
"
|
|
1664
|
+
"5632b646",
|
|
1691
1665
|
null,
|
|
1692
1666
|
null
|
|
1693
1667
|
);
|
|
@@ -1699,8 +1673,187 @@ function __vue2_injectStyles(context) {
|
|
|
1699
1673
|
const PayPopup2 = /* @__PURE__ */ function() {
|
|
1700
1674
|
return __component__.exports;
|
|
1701
1675
|
}();
|
|
1676
|
+
const ko = {
|
|
1677
|
+
"plugin-pay": {
|
|
1678
|
+
balance: "균형",
|
|
1679
|
+
select: "충전 금액을 선택하세요",
|
|
1680
|
+
payment: "결제 방법",
|
|
1681
|
+
pay: "지금 결제하세요"
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
const zh = {
|
|
1685
|
+
"plugin-pay": {
|
|
1686
|
+
balance: "余额",
|
|
1687
|
+
select: "选择充值金额",
|
|
1688
|
+
payment: "付款方式",
|
|
1689
|
+
pay: "立即支付"
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
zh["plugin-pay"];
|
|
1693
|
+
const languageConfig = {
|
|
1694
|
+
zh: {
|
|
1695
|
+
name: "简体中文",
|
|
1696
|
+
icon: "🇨🇳",
|
|
1697
|
+
messages: zh
|
|
1698
|
+
},
|
|
1699
|
+
ko: {
|
|
1700
|
+
name: "한국어",
|
|
1701
|
+
icon: "🇰🇷",
|
|
1702
|
+
messages: ko
|
|
1703
|
+
}
|
|
1704
|
+
};
|
|
1705
|
+
const messages = Object.keys(languageConfig).reduce((acc, key) => {
|
|
1706
|
+
acc[key] = languageConfig[key].messages;
|
|
1707
|
+
return acc;
|
|
1708
|
+
}, {});
|
|
1709
|
+
const prefix = "plugin-pay";
|
|
1710
|
+
const getI18nKey = (key) => `${prefix}.${key}`;
|
|
1711
|
+
const USDPrices = [
|
|
1712
|
+
{
|
|
1713
|
+
price: 99,
|
|
1714
|
+
count: 4.2,
|
|
1715
|
+
id: 1
|
|
1716
|
+
},
|
|
1717
|
+
{
|
|
1718
|
+
price: 199,
|
|
1719
|
+
count: 8.4,
|
|
1720
|
+
id: 2
|
|
1721
|
+
},
|
|
1722
|
+
{
|
|
1723
|
+
price: 399,
|
|
1724
|
+
count: 21,
|
|
1725
|
+
id: 3
|
|
1726
|
+
},
|
|
1727
|
+
{
|
|
1728
|
+
price: 699,
|
|
1729
|
+
count: 35,
|
|
1730
|
+
id: 4
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
price: 1499,
|
|
1734
|
+
count: 68.6,
|
|
1735
|
+
id: 5
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
price: 2999,
|
|
1739
|
+
count: 138.6,
|
|
1740
|
+
id: 6
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
price: 3999,
|
|
1744
|
+
count: 208.6,
|
|
1745
|
+
id: 7
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
price: 6999,
|
|
1749
|
+
count: 341.6,
|
|
1750
|
+
id: 8
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
price: 9999,
|
|
1754
|
+
count: 453.6,
|
|
1755
|
+
id: 9
|
|
1756
|
+
}
|
|
1757
|
+
];
|
|
1758
|
+
const krlotto = {
|
|
1759
|
+
theme: "#ff5757",
|
|
1760
|
+
name: getI18nKey("balance"),
|
|
1761
|
+
needId: false,
|
|
1762
|
+
balance: {
|
|
1763
|
+
disabled: false,
|
|
1764
|
+
key: "PlaMoney",
|
|
1765
|
+
api: "/PlayerUser/GetMoney"
|
|
1766
|
+
},
|
|
1767
|
+
price: {
|
|
1768
|
+
currencySymbol: "US$",
|
|
1769
|
+
disabled: false,
|
|
1770
|
+
prices: USDPrices
|
|
1771
|
+
},
|
|
1772
|
+
channel: {
|
|
1773
|
+
api: "/SystemPayment/GetList",
|
|
1774
|
+
ignores: [
|
|
1775
|
+
"alipay",
|
|
1776
|
+
"apple",
|
|
1777
|
+
"platform",
|
|
1778
|
+
"wechat",
|
|
1779
|
+
"google"
|
|
1780
|
+
]
|
|
1781
|
+
},
|
|
1782
|
+
pay: {
|
|
1783
|
+
key: "type"
|
|
1784
|
+
},
|
|
1785
|
+
identity: {
|
|
1786
|
+
disable: true,
|
|
1787
|
+
api: "/PlayerUser/GetUserInfo",
|
|
1788
|
+
auth: "/PlayerUser/Authentication"
|
|
1789
|
+
},
|
|
1790
|
+
agreement: {
|
|
1791
|
+
disable: true
|
|
1792
|
+
}
|
|
1793
|
+
};
|
|
1794
|
+
const user = {
|
|
1795
|
+
theme: "#ff4f4f",
|
|
1796
|
+
name: "幸运币余额",
|
|
1797
|
+
needId: false,
|
|
1798
|
+
balance: {
|
|
1799
|
+
disabled: false,
|
|
1800
|
+
key: "PlaMoney",
|
|
1801
|
+
api: "/PlayerUser/GetMoney"
|
|
1802
|
+
},
|
|
1803
|
+
price: {
|
|
1804
|
+
disabled: false,
|
|
1805
|
+
custom: true,
|
|
1806
|
+
prices: [
|
|
1807
|
+
{
|
|
1808
|
+
price: 200
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
price: 500
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
price: 1e3
|
|
1815
|
+
},
|
|
1816
|
+
{
|
|
1817
|
+
price: 5e3
|
|
1818
|
+
},
|
|
1819
|
+
{
|
|
1820
|
+
price: 1e4
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
price: 2e4
|
|
1824
|
+
}
|
|
1825
|
+
]
|
|
1826
|
+
},
|
|
1827
|
+
channel: {
|
|
1828
|
+
api: "/SystemPayment/GetList",
|
|
1829
|
+
ignores: DefaultIgnorePlatform
|
|
1830
|
+
},
|
|
1831
|
+
pay: {
|
|
1832
|
+
key: "Money"
|
|
1833
|
+
},
|
|
1834
|
+
identity: {
|
|
1835
|
+
disable: true,
|
|
1836
|
+
api: "/PlayerUser/GetUserInfo",
|
|
1837
|
+
auth: "/PlayerUser/Authentication"
|
|
1838
|
+
},
|
|
1839
|
+
agreement: {
|
|
1840
|
+
disable: false,
|
|
1841
|
+
url: DefaultAgreement
|
|
1842
|
+
}
|
|
1843
|
+
};
|
|
1844
|
+
const PayAllConfig = {
|
|
1845
|
+
agent,
|
|
1846
|
+
user,
|
|
1847
|
+
krlotto
|
|
1848
|
+
};
|
|
1702
1849
|
const plugin = {
|
|
1703
|
-
install(vue) {
|
|
1850
|
+
install(vue, options = {}) {
|
|
1851
|
+
let i18n = options.i18n;
|
|
1852
|
+
if (i18n) {
|
|
1853
|
+
Object.keys(messages).forEach((lang) => {
|
|
1854
|
+
i18n.mergeLocaleMessage(lang, messages[lang]);
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1704
1857
|
const create = (type, ...args) => {
|
|
1705
1858
|
return new Promise((res, rej) => {
|
|
1706
1859
|
const config = PayAllConfig[type];
|
|
@@ -1719,7 +1872,9 @@ const plugin = {
|
|
|
1719
1872
|
propsData: {
|
|
1720
1873
|
config,
|
|
1721
1874
|
id
|
|
1722
|
-
}
|
|
1875
|
+
},
|
|
1876
|
+
// 注入国际化实例
|
|
1877
|
+
i18n
|
|
1723
1878
|
});
|
|
1724
1879
|
instance.$on("onClosed", () => {
|
|
1725
1880
|
res();
|
|
@@ -1734,6 +1889,7 @@ const plugin = {
|
|
|
1734
1889
|
});
|
|
1735
1890
|
};
|
|
1736
1891
|
vue.prototype.$pay = { create };
|
|
1892
|
+
vue.prototype.$getI18nKeyInPay = getI18nKey;
|
|
1737
1893
|
}
|
|
1738
1894
|
};
|
|
1739
1895
|
export {
|
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-
|
|
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"})});
|
|
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-5632b646]{font-family:WeChat-Bold}.pay-popup[data-v-5632b646]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-5632b646]{text-align:center;margin:.16rem 0}.pay-button[data-v-5632b646]{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:t,key:n,value:o,prefix:i}=e;let r=location.origin+`/Payment/${i||""}Paypal?${n}=${o}&id=${t}`;location.href=r},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 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 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 Le=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,Re,"5e65f97e",null,null);function Re(e){for(let t in Ue)this[t]=Ue[t]}const Ne=function(){return Le.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,"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({channel:e,key:n,value:o,prefix:i})=>{const{type:r,id:a,appid:s}=e;switch(r in h||t.Toast("暂不支持此渠道"),r){case"alipay":return await l({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 请先使用其他渠道!"});case"paypal":return await p({id:a,key:n,value:o,prefix:i});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: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,"5632b646",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:99,count:4.2,id:1},{price:199,count:8.4,id:2},{price:399,count:21,id:3},{price:699,count:35,id:4},{price:1499,count:68.6,id:5},{price:2999,count:138.6,id:6},{price:3999,count:208.6,id:7},{price:6999,count:341.6,id:8},{price:9999,count:453.6,id:9}]},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=rt[e],{needId:c}=s,l=o[0];if(c&&!l)return void t.Dialog({title:"参数异常",message:`${e} 类型需要传入订单号 当前未传入!`});const p=new(n.extend(et))({propsData:{config:s,id:l},i18n:i});p.$on("onClosed",()=>{r(),setTimeout(()=>{var e;p.$destroy(),null==(e=p.$el.parentNode)||e.removeChild(p.$el)},300)}),p.$mount(),document.body.appendChild(p.$el)})},e.prototype.$getI18nKeyInPay=it}};e.PayPlugin=at,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -6,6 +6,7 @@ export declare const EnableChannel: {
|
|
|
6
6
|
message: string;
|
|
7
7
|
}>;
|
|
8
8
|
wechat: import("./pay/wechat").Wechat;
|
|
9
|
+
paypal: (options: import("./pay").BasePayOptions) => Promise<void>;
|
|
9
10
|
};
|
|
10
11
|
/** 过滤当前支持的渠道*/
|
|
11
12
|
export default function (list: Channel[], ignoers: ChannelType[]): Channel[];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import Vue from
|
|
2
|
-
import {
|
|
1
|
+
import Vue from "vue";
|
|
2
|
+
import { CurrencySymbol } from "../../config/currency";
|
|
3
|
+
import { Price } from "../../types";
|
|
3
4
|
export default class PriceItem extends Vue {
|
|
5
|
+
symbol: CurrencySymbol;
|
|
4
6
|
price: Price;
|
|
5
7
|
get realPrice(): number;
|
|
6
8
|
/** 是否仅有售价*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChannelType } from "../types";
|
|
2
|
+
/** 默认的禁用平台币策略渠道 默认在充值平台币时禁止使用平台币支付*/
|
|
3
|
+
export declare const DefaultIgnorePlatform: Array<ChannelType>;
|
|
4
|
+
/** 默认的充值协议*/
|
|
5
|
+
export declare const DefaultAgreement = "https://czyxzs.xuelm.cn/agreement.html";
|
|
6
|
+
/** 默认主题色*/
|
|
7
|
+
export declare const DefaultTheme = "orange";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { i18nKey } from './locales/messages';
|
|
1
2
|
import { PayCreate } from './types/create';
|
|
2
3
|
export { default as PayPlugin } from './plugin';
|
|
3
4
|
declare module 'vue/types/vue' {
|
|
@@ -5,5 +6,6 @@ declare module 'vue/types/vue' {
|
|
|
5
6
|
$pay: {
|
|
6
7
|
create: PayCreate;
|
|
7
8
|
};
|
|
9
|
+
$getI18nKeyInPay: (key: i18nKey) => string;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare const data: {
|
|
2
|
+
balance: string;
|
|
3
|
+
select: string;
|
|
4
|
+
payment: string;
|
|
5
|
+
pay: string;
|
|
6
|
+
};
|
|
7
|
+
/** 翻译 key*/
|
|
8
|
+
export type i18nKey = keyof typeof data;
|
|
9
|
+
/**语言包配置 */
|
|
10
|
+
export declare const languageConfig: {
|
|
11
|
+
zh: {
|
|
12
|
+
name: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
messages: {
|
|
15
|
+
"plugin-pay": {
|
|
16
|
+
balance: string;
|
|
17
|
+
select: string;
|
|
18
|
+
payment: string;
|
|
19
|
+
pay: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
ko: {
|
|
24
|
+
name: string;
|
|
25
|
+
icon: string;
|
|
26
|
+
messages: {
|
|
27
|
+
"plugin-pay": {
|
|
28
|
+
balance: string;
|
|
29
|
+
select: string;
|
|
30
|
+
payment: string;
|
|
31
|
+
pay: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {};
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -16,8 +16,9 @@ export interface ApiChannel {
|
|
|
16
16
|
* - wechat 微信 目前只有小程序这一种支付方法
|
|
17
17
|
* - platform 平台币
|
|
18
18
|
* - apple 苹果
|
|
19
|
+
* - paypal 贝宝
|
|
19
20
|
*/
|
|
20
|
-
export type ChannelType = "alipay" | "wechat" | "platform" | "apple" | "unknow";
|
|
21
|
+
export type ChannelType = "alipay" | "wechat" | "platform" | "apple" | "paypal" | "google" | "unknow";
|
|
21
22
|
/** 支付渠道*/
|
|
22
23
|
export interface Channel {
|
|
23
24
|
/** id*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CurrencySymbol } from "../config/currency";
|
|
1
2
|
import { ChannelType } from "./channel";
|
|
2
3
|
import { Price } from "./price";
|
|
3
4
|
export type PayCreateType = "agent" | "user";
|
|
@@ -9,6 +10,8 @@ export type Config = {
|
|
|
9
10
|
name: string;
|
|
10
11
|
/** 是否需要传入id*/
|
|
11
12
|
needId: boolean;
|
|
13
|
+
/** 货币信息*/
|
|
14
|
+
currency?: string;
|
|
12
15
|
/** 钱包信息*/
|
|
13
16
|
balance: {
|
|
14
17
|
/** 是否关闭*/
|
|
@@ -30,6 +33,8 @@ export type Config = {
|
|
|
30
33
|
prices?: Array<Price>;
|
|
31
34
|
/** 远程加载方法*/
|
|
32
35
|
load?: () => Promise<Array<Price>>;
|
|
36
|
+
/** 货币符号*/
|
|
37
|
+
currencySymbol?: CurrencySymbol;
|
|
33
38
|
};
|
|
34
39
|
/** 渠道*/
|
|
35
40
|
channel: {
|
|
@@ -54,7 +59,10 @@ export type Config = {
|
|
|
54
59
|
auth: string;
|
|
55
60
|
};
|
|
56
61
|
/** 协议地址*/
|
|
57
|
-
agreement:
|
|
62
|
+
agreement: {
|
|
63
|
+
disable: boolean;
|
|
64
|
+
url?: string;
|
|
65
|
+
};
|
|
58
66
|
/** 主体色*/
|
|
59
67
|
theme?: string;
|
|
60
68
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhangcf233/pay",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"main": "dist/pay.umd.js",
|
|
5
5
|
"module": "dist/pay.es.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -37,5 +37,8 @@
|
|
|
37
37
|
"require": "./dist/pay.umd.js",
|
|
38
38
|
"types": "./dist/types/index.d.ts"
|
|
39
39
|
}
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"vue-i18n": "^8.28.2"
|
|
40
43
|
}
|
|
41
|
-
}
|
|
44
|
+
}
|
package/dist/types/config.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Config } from "./types";
|
|
2
|
-
export declare const BaseTheme = "orange";
|
|
3
|
-
export declare const AgentConfig: Config;
|
|
4
|
-
export declare const UserConfig: Config;
|
|
5
|
-
/** 完整支付配置*/
|
|
6
|
-
export declare const PayAllConfig: {
|
|
7
|
-
readonly agent: Config;
|
|
8
|
-
readonly user: Config;
|
|
9
|
-
};
|