@zhangcf233/pay 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pay.es.js CHANGED
@@ -1,99 +1,212 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('@charset "UTF-8";.pay-error-container[data-v-0817c014]{position:relative}.pay-error-container .loading[data-v-0817c014]{width:100%;height:100%;position:absolute;background:#fff;z-index:1;transition:all .3s;justify-content:center;align-items:center}.pay-error-container .message[data-v-0817c014]{font-size:.1rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-75290345]{font-family:WeChat-Bold}.root[data-v-75290345]{text-align:center}.cell[data-v-4e4c306e]{display:flex;align-items:center;justify-content:space-between;height:.3rem}.cell .name[data-v-4e4c306e]{width:30vw;color:gray;font-size:.14rem;display:flex;align-items:center;justify-content:end}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-ea027830]{font-family:WeChat-Bold}.custom-price .input[data-v-ea027830]{font-size:.2rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-68d98a5c]{font-family:WeChat-Bold}.price-root[data-v-68d98a5c]{position:relative;text-align:center;background:#f3f3f3;border-radius:.08rem;padding:.1rem 0;display:flex;flex-direction:column;height:.6rem;box-sizing:border-box;justify-content:space-between;align-items:center}.price-root .gift[data-v-68d98a5c]{position:absolute;top:-.1rem;right:-.05rem;background:linear-gradient(248.45deg,#fa1e1e,#ff7752 99.44%);padding:0 .05rem;border-radius:.1rem .1rem .1rem 0;font-size:.1rem;border-width:.02rem;border-color:#fff;border-style:solid;box-sizing:border-box;color:#fff}.price-root .token-count[data-v-68d98a5c]{display:flex;justify-content:center;align-items:center;font-size:.2rem}.price-root .token-count img[data-v-68d98a5c]{width:.16rem;height:.16rem;margin-right:.02rem}.price-root .price[data-v-68d98a5c]{font-size:.14rem}.only-price[data-v-68d98a5c]{align-items:center;justify-content:center}.only-price .price[data-v-68d98a5c]{font-size:.2rem}.content[data-v-76333b1f]{width:100%;margin:.2rem 0;display:grid;grid-template-columns:repeat(3,1fr);gap:.1rem;box-sizing:border-box;font-weight:500}.loading[data-v-76333b1f]{display:flex;justify-content:center;align-items:center}.select[data-v-76333b1f]{color:#fff}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-74a1db46]{font-family:WeChat-Bold}.pay-popup[data-v-74a1db46]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-74a1db46]{text-align:center;margin:.16rem 0}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- var te = Object.defineProperty;
3
- var ne = (e, n, t) => n in e ? te(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
4
- var i = (e, n, t) => (ne(e, typeof n != "symbol" ? n + "" : n, t), t);
5
- import { Dialog as q, Toast as M, Divider as se, Button as re } from "vant";
6
- import _ from "vue";
7
- import y from "vue-class-component";
8
- import { Prop as P, Component as G, Vue as ae, Inject as x, Watch as oe, Provide as ie } from "vue-property-decorator";
9
- const v = (e, n = "请求失败") => (q({ title: n, message: e }), {
10
- status: !1,
11
- message: e
12
- }), T = async (e, n, t = "POST") => new Promise((r, s) => {
13
- const o = localStorage.getItem("AppToken") || "";
14
- if (!o)
15
- throw new Error("token 不存在");
16
- fetch(e, {
17
- method: t,
18
- headers: {
19
- AppToken: o,
20
- "Content-Type": "application/x-www-form-urlencoded"
21
- },
22
- body: new URLSearchParams(n).toString()
23
- }).then(async (a) => {
24
- if (!a.ok) {
25
- const l = await a.text();
26
- throw new Error(`HTTP ${a.status} ${a.statusText}: ${l}`);
27
- }
28
- try {
29
- return await a.json();
30
- } catch {
31
- s("解析 JSON 异常");
1
+ !function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('@charset "UTF-8";.pay-error-container[data-v-0817c014]{position:relative}.pay-error-container .loading[data-v-0817c014]{width:100%;height:100%;position:absolute;background:#fff;z-index:1;transition:all .3s;justify-content:center;align-items:center}.pay-error-container .message[data-v-0817c014]{font-size:.1rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-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}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-ea027830]{font-family:WeChat-Bold}.custom-price .input[data-v-ea027830]{font-size:.2rem}@font-face{font-family:WeChat-Bold;src:url(https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/pay/fonts/WeChatSansStd-Bold.ttf)}.wechat-font[data-v-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-737beb57]{width:100%;margin:.2rem 0;display:grid;grid-template-columns:repeat(3,1fr);gap:.1rem;box-sizing:border-box;font-weight:500}.loading[data-v-737beb57]{display:flex;justify-content:center;align-items:center}.select[data-v-737beb57]{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-4ac1c510]{font-family:WeChat-Bold}.pay-popup[data-v-4ac1c510]{display:flex;flex-direction:column;width:100vw;box-sizing:border-box;overflow:hidden;padding:0 .15rem .2rem;transition:all .3s}.title[data-v-4ac1c510]{text-align:center;margin:.16rem 0}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => {
5
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ return value;
7
+ };
8
+ var _a, _b;
9
+ import { Dialog, Toast, Divider, Button } from "vant";
10
+ import Vue from "vue";
11
+ import Component$1 from "vue-class-component";
12
+ import { Prop, Component, Vue as Vue$1, Inject, Watch, Provide } from "vue-property-decorator";
13
+ async function request(url, data, method = "POST") {
14
+ return new Promise((res, rej) => {
15
+ const AppToken = localStorage.getItem("AppToken") || "";
16
+ if (!AppToken) {
17
+ throw new Error("token 不存在");
32
18
  }
33
- }).then((a) => {
34
- r(a);
35
- }).catch((a) => {
36
- let l = (a == null ? void 0 : a.message) || "未知异常";
37
- a.message.includes("404") ? l = "资源未找到" : a.message.includes("500") ? l = "服务器错误" : a instanceof TypeError && a.message === "Failed to fetch" && (l = "网络连接失败"), s(l);
19
+ fetch(url, {
20
+ method,
21
+ headers: {
22
+ AppToken,
23
+ "Content-Type": "application/x-www-form-urlencoded"
24
+ },
25
+ body: new URLSearchParams(data).toString()
26
+ }).then(async (response) => {
27
+ if (!response.ok) {
28
+ const errorText = await response.text();
29
+ throw new Error(`HTTP ${response.status} ${response.statusText}: ${errorText}`);
30
+ }
31
+ try {
32
+ return await response.json();
33
+ } catch (error) {
34
+ rej("解析 JSON 异常");
35
+ }
36
+ }).then((data2) => {
37
+ res(data2);
38
+ }).catch((error) => {
39
+ let message = (error == null ? void 0 : error.message) || "未知异常";
40
+ if (error.message.includes("404")) {
41
+ message = "资源未找到";
42
+ } else if (error.message.includes("500")) {
43
+ message = "服务器错误";
44
+ } else if (error instanceof TypeError && error.message === "Failed to fetch") {
45
+ message = "网络连接失败";
46
+ }
47
+ rej(message);
48
+ });
38
49
  });
39
- }), ce = (e) => ({
40
- status: !0,
41
- message: "成功",
42
- data: e
43
- }), le = /LT-APP/.test(navigator.userAgent);
44
- var V, U;
45
- const z = (U = (V = _.prototype) == null ? void 0 : V.$jsBridge) == null ? void 0 : U.inApp, ue = !!window.ReactNativeWebView, J = async (e) => {
46
- const { id: n, key: t, value: r, prefix: s } = e;
47
- let o = location.origin + `/Payment/${s || ""}Alipay`;
48
- const a = pe();
49
- if (o += `?qrcode=${a}&id=${n}`, !(t && r))
50
- return v("支付参数异常", `支付时缺少 key value 参数:${JSON.stringify(e)}`);
51
- if (o += `&${t}=${r}`, !a)
52
- return location.href = o, ce();
53
- const { Data: l, Status: c, Message: u } = await T(o, {}, "GET");
54
- if (!c)
55
- return v("支付请求失败", u || "请求支付结果异常");
56
- if (!l)
57
- return v("支付跳转地址不存在");
58
- if (z) {
59
- _.prototype.$jsBridge.openLink(l);
50
+ }
51
+ const fail = (message, title = "请求失败") => {
52
+ Dialog({ title, message });
53
+ return {
54
+ status: false,
55
+ message
56
+ };
57
+ };
58
+ const success = (data) => {
59
+ return {
60
+ status: true,
61
+ message: "成功",
62
+ data
63
+ };
64
+ };
65
+ const isYM = /LT-APP/.test(navigator.userAgent);
66
+ const inApp = (_b = (_a = Vue.prototype) == null ? void 0 : _a.$jsBridge) == null ? void 0 : _b.inApp;
67
+ const isThirdParty = Boolean(window.ReactNativeWebView);
68
+ const alipay = async (options) => {
69
+ const { id, key, value, prefix } = options;
70
+ let url = location.origin + `/Payment/${prefix || ""}Alipay`;
71
+ const qrcode = getQrcode();
72
+ url += `?qrcode=${qrcode}&id=${id}`;
73
+ if (!(key && value)) {
74
+ return fail("支付参数异常", `支付时缺少 key value 参数:${JSON.stringify(options)}`);
75
+ }
76
+ url += `&${key}=${value}`;
77
+ if (!qrcode) {
78
+ location.href = url;
79
+ return success();
80
+ }
81
+ const { Data, Status, Message } = await request(url, {}, "GET");
82
+ if (!Status) {
83
+ return fail("支付请求失败", Message || "请求支付结果异常");
84
+ }
85
+ if (!Data) {
86
+ return fail("支付跳转地址不存在");
87
+ }
88
+ if (inApp) {
89
+ Vue.prototype.$jsBridge.openLink(Data);
60
90
  return;
61
91
  }
62
- location.href = l;
92
+ location.href = Data;
63
93
  };
64
- function pe() {
65
- return le || z || ue;
94
+ function getQrcode() {
95
+ return isYM || inApp || isThirdParty;
66
96
  }
67
- const W = {
68
- alipay: J
97
+ const isMpWeixin = /miniProgram/i.test(navigator.userAgent) && /micromessenger/i.test(navigator.userAgent);
98
+ const wechat = (params) => {
99
+ var _a2;
100
+ const { id, appid, key, value, prefix } = params;
101
+ if (!appid) {
102
+ Dialog({
103
+ title: "小程序 id 不存在"
104
+ });
105
+ return;
106
+ }
107
+ if (!localStorage.getItem("AppToken")) {
108
+ Dialog({
109
+ title: "环境异常",
110
+ message: "本地 AppToken 不存在! 请重新登录",
111
+ showCancelButton: false,
112
+ confirmButtonText: "确定"
113
+ });
114
+ return;
115
+ }
116
+ const options = {
117
+ /** 小程序 id*/
118
+ appid,
119
+ /** 支付分类的 key*/
120
+ payKey: key,
121
+ /** 支付分类订单号*/
122
+ payValue: value,
123
+ /** 支付渠道id*/
124
+ paymentId: id,
125
+ /** 支付渠道接口*/
126
+ payApi: `${location.origin}}/Payment/${prefix}Weixin`,
127
+ /** tokenkey*/
128
+ tokenKey: "AppToken",
129
+ /** token 值*/
130
+ tokenValue: localStorage.getItem("AppToken")
131
+ };
132
+ const query = encodeURIComponent(Object.entries(options).map(([key2, value2]) => `${key2}=${String(value2)}`).join("&"));
133
+ const url = `weixin://dl/business/?appid=${appid}&path=pages/home/index&query=${query}`;
134
+ if (window.ReactNativeWebView) {
135
+ (_a2 = window.ReactNativeWebView) == null ? void 0 : _a2.postMessage(JSON.stringify(
136
+ {
137
+ type: "openUrl",
138
+ data: {
139
+ url
140
+ },
141
+ code: 200
142
+ }
143
+ ));
144
+ } else if (isMpWeixin) {
145
+ const params2 = Object.entries(options).map(([key2, value2]) => `${key2}=${String(value2)}`).join("&");
146
+ uni.navigateTo({
147
+ url: `/pages/home/pay?${params2}`
148
+ // url: `/pages/home/pay`
149
+ });
150
+ } else {
151
+ location.href = url;
152
+ }
153
+ };
154
+ const EnableChannel = {
155
+ alipay,
156
+ wechat
69
157
  };
70
- function _e(e) {
71
- return e.filter(({ type: n }) => {
72
- if (n in W)
73
- return !0;
158
+ function getEnabledChannel(list, ignoers) {
159
+ return list.filter(({ type }) => {
160
+ if (ignoers.includes(type)) {
161
+ return false;
162
+ }
163
+ if (type in EnableChannel) {
164
+ return true;
165
+ }
74
166
  });
75
167
  }
76
- const fe = async ({ channel: e, key: n, value: t, prefix: r }) => {
77
- const { type: s, id: o } = e, a = String(Number(t) / 100);
78
- switch (s in W || M("暂不支持此渠道"), s) {
168
+ const sendPay = async ({ channel, key, value, prefix }) => {
169
+ const { type, id, appid } = channel;
170
+ const yuanValue = String(Number(value) / 100);
171
+ if (!(type in EnableChannel)) {
172
+ Toast(`暂不支持此渠道`);
173
+ }
174
+ switch (type) {
79
175
  case "alipay":
80
- return await J({ id: o, key: n, value: a, prefix: r });
176
+ return await alipay({ id, key, value: yuanValue, prefix });
177
+ case "wechat":
178
+ if (!appid) {
179
+ return Dialog({
180
+ title: "参数异常",
181
+ message: `此渠道未配置小程序 appid 请先使用其他渠道!`
182
+ });
183
+ }
184
+ return await wechat({
185
+ appid,
186
+ prefix,
187
+ key,
188
+ value,
189
+ id
190
+ });
81
191
  default:
82
- M("暂不支持此渠道");
192
+ Toast(`暂不支持此渠道`);
83
193
  }
84
- }, he = "orange", X = {
85
- needId: !1,
194
+ };
195
+ const BaseTheme = "orange";
196
+ const ignorePlatform = ["platform"];
197
+ const AgentConfig = {
198
+ needId: false,
86
199
  name: "店铺余额",
87
200
  theme: "#4089ff",
88
201
  /** 余额*/
89
202
  balance: {
90
- disabled: !1,
203
+ disabled: false,
91
204
  key: "Money",
92
205
  api: "/AgentUser/GetMoney"
93
206
  },
94
207
  price: {
95
- disabled: !1,
96
- custom: !0,
208
+ disabled: false,
209
+ custom: true,
97
210
  prices: [
98
211
  {
99
212
  price: 800
@@ -116,23 +229,25 @@ const fe = async ({ channel: e, key: n, value: t, prefix: r }) => {
116
229
  ]
117
230
  },
118
231
  channel: {
119
- api: "/SystemPayment/GetList"
232
+ api: "/SystemPayment/GetList",
233
+ ignores: ignorePlatform
120
234
  },
121
235
  pay: {
122
236
  key: "Money"
123
237
  }
124
- }, de = {
238
+ };
239
+ const UserConfig = {
125
240
  theme: "#ff4f4f",
126
241
  name: "幸运币余额",
127
- needId: !1,
242
+ needId: false,
128
243
  balance: {
129
- disabled: !1,
244
+ disabled: false,
130
245
  key: "PlaMoney",
131
246
  api: "/PlayerUser/GetMoney"
132
247
  },
133
248
  price: {
134
- disabled: !1,
135
- custom: !0,
249
+ disabled: false,
250
+ custom: true,
136
251
  prices: [
137
252
  {
138
253
  price: 200
@@ -155,29 +270,42 @@ const fe = async ({ channel: e, key: n, value: t, prefix: r }) => {
155
270
  ]
156
271
  },
157
272
  channel: {
158
- api: "/SystemPayment/GetList"
273
+ api: "/SystemPayment/GetList",
274
+ ignores: ignorePlatform
159
275
  },
160
276
  pay: {
161
277
  key: "Money"
162
278
  }
163
- }, ve = {
164
- agent: X,
165
- user: de
166
- }, ge = async (e, n) => {
167
- const t = await T(e);
168
- return n in t ? t[n] : (v(JSON.stringify(t) || "解析数据异常", `余额数据中不存在 ${n}`), 0);
169
279
  };
170
- var me = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, H = (e, n, t, r) => {
171
- for (var s = r > 1 ? void 0 : r ? ye(n, t) : n, o = e.length - 1, a; o >= 0; o--)
172
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
173
- return r && s && me(n, t, s), s;
280
+ const PayAllConfig = {
281
+ agent: AgentConfig,
282
+ user: UserConfig
283
+ };
284
+ const getPayMoney = async (url, key) => {
285
+ const data = await request(url);
286
+ if (!(key in data)) {
287
+ fail(JSON.stringify(data) || "解析数据异常", `余额数据中不存在 ${key}`);
288
+ return 0;
289
+ }
290
+ return data[key];
291
+ };
292
+ var __defProp$6 = Object.defineProperty;
293
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
294
+ var __decorateClass$6 = (decorators, target, key, kind) => {
295
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
296
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
297
+ if (decorator = decorators[i])
298
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
299
+ if (kind && result)
300
+ __defProp$6(target, key, result);
301
+ return result;
174
302
  };
175
- let $ = class extends ae {
303
+ let PayError$1 = class PayError extends Vue$1 {
176
304
  constructor() {
177
305
  super(...arguments);
178
- i(this, "load");
179
- i(this, "loading", !0);
180
- i(this, "message", "");
306
+ __publicField(this, "load");
307
+ __publicField(this, "loading", true);
308
+ __publicField(this, "message", "");
181
309
  }
182
310
  get showLoading() {
183
311
  return this.loading || this.message;
@@ -186,352 +314,461 @@ let $ = class extends ae {
186
314
  await this.retry();
187
315
  }
188
316
  test() {
189
- this.loading = !0, setTimeout(() => {
190
- this.loading = !1;
317
+ this.loading = true;
318
+ setTimeout(() => {
319
+ this.loading = false;
191
320
  }, 100);
192
321
  }
193
322
  async retry() {
194
- this.message = "", this.loading = !0;
195
- const t = await this.load().finally(() => {
196
- this.loading = !1;
197
- }).catch((r) => {
198
- this.message = r;
323
+ this.message = "";
324
+ this.loading = true;
325
+ const res = await this.load().finally(() => {
326
+ this.loading = false;
327
+ }).catch((message) => {
328
+ this.message = message;
199
329
  });
200
- t != null && this.$emit("done", t);
201
- }
202
- };
203
- H([
204
- P()
205
- ], $.prototype, "load", 2);
206
- $ = H([
207
- G
208
- ], $);
209
- var Pe = function() {
210
- var e = this, n = e.$createElement, t = e._self._c || n;
211
- return t("div", {
330
+ if (res != void 0) {
331
+ this.$emit("done", res);
332
+ }
333
+ }
334
+ };
335
+ __decorateClass$6([
336
+ Prop()
337
+ ], PayError$1.prototype, "load", 2);
338
+ PayError$1 = __decorateClass$6([
339
+ Component
340
+ ], PayError$1);
341
+ var render$6 = function() {
342
+ var _vm = this;
343
+ var _h = _vm.$createElement;
344
+ var _c = _vm._self._c || _h;
345
+ return _c("div", {
212
346
  staticClass: "pay-error-container"
213
- }, [t("div", {
347
+ }, [_c("div", {
214
348
  staticClass: "loading",
215
349
  style: {
216
- display: e.showLoading ? "flex" : "none"
350
+ display: _vm.showLoading ? "flex" : "none"
217
351
  }
218
- }, [e.message ? t("van-tag", {
352
+ }, [_vm.message ? _c("van-tag", {
219
353
  attrs: {
220
- type: "danger"
354
+ "type": "danger"
221
355
  },
222
356
  on: {
223
- click: e.retry
357
+ "click": _vm.retry
224
358
  }
225
- }, [e._v(" " + e._s(e.message) + " 点击重试 ")]) : t("van-loading", {
359
+ }, [_vm._v(" " + _vm._s(_vm.message) + " 点击重试 ")]) : _c("van-loading", {
226
360
  staticClass: "loading-icon",
227
361
  attrs: {
228
- size: "20",
229
- type: "spinner"
362
+ "size": "20",
363
+ "type": "spinner"
230
364
  }
231
- })], 1), e._t("default")], 2);
232
- }, $e = [];
233
- function h(e, n, t, r, s, o, a, l) {
234
- var c = typeof e == "function" ? e.options : e;
235
- n && (c.render = n, c.staticRenderFns = t, c._compiled = !0), r && (c.functional = !0), o && (c._scopeId = "data-v-" + o);
236
- var u;
237
- if (a ? (u = function(p) {
238
- p = p || // cached call
239
- this.$vnode && this.$vnode.ssrContext || // stateful
240
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !p && typeof __VUE_SSR_CONTEXT__ < "u" && (p = __VUE_SSR_CONTEXT__), s && s.call(this, p), p && p._registeredComponents && p._registeredComponents.add(a);
241
- }, c._ssrRegister = u) : s && (u = l ? function() {
242
- s.call(
243
- this,
244
- (c.functional ? this.parent : this).$root.$options.shadowRoot
245
- );
246
- } : s), u)
247
- if (c.functional) {
248
- c._injectStyles = u;
249
- var f = c.render;
250
- c.render = function(ee, D) {
251
- return u.call(D), f(ee, D);
365
+ })], 1), _vm._t("default")], 2);
366
+ };
367
+ var staticRenderFns$6 = [];
368
+ const payError_vue_vue_type_style_index_0_scoped_true_lang = "";
369
+ function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
370
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
371
+ if (render2) {
372
+ options.render = render2;
373
+ options.staticRenderFns = staticRenderFns2;
374
+ options._compiled = true;
375
+ }
376
+ if (functionalTemplate) {
377
+ options.functional = true;
378
+ }
379
+ if (scopeId) {
380
+ options._scopeId = "data-v-" + scopeId;
381
+ }
382
+ var hook;
383
+ if (moduleIdentifier) {
384
+ hook = function(context) {
385
+ context = context || // cached call
386
+ this.$vnode && this.$vnode.ssrContext || // stateful
387
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
388
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
389
+ context = __VUE_SSR_CONTEXT__;
390
+ }
391
+ if (injectStyles) {
392
+ injectStyles.call(this, context);
393
+ }
394
+ if (context && context._registeredComponents) {
395
+ context._registeredComponents.add(moduleIdentifier);
396
+ }
397
+ };
398
+ options._ssrRegister = hook;
399
+ } else if (injectStyles) {
400
+ hook = shadowMode ? function() {
401
+ injectStyles.call(
402
+ this,
403
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
404
+ );
405
+ } : injectStyles;
406
+ }
407
+ if (hook) {
408
+ if (options.functional) {
409
+ options._injectStyles = hook;
410
+ var originalRender = options.render;
411
+ options.render = function renderWithStyleInjection(h, context) {
412
+ hook.call(context);
413
+ return originalRender(h, context);
252
414
  };
253
415
  } else {
254
- var d = c.beforeCreate;
255
- c.beforeCreate = d ? [].concat(d, u) : [u];
416
+ var existing = options.beforeCreate;
417
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
256
418
  }
419
+ }
257
420
  return {
258
- exports: e,
259
- options: c
421
+ exports: scriptExports,
422
+ options
260
423
  };
261
424
  }
262
- const L = {};
263
- var Ce = /* @__PURE__ */ h(
264
- $,
265
- Pe,
266
- $e,
267
- !1,
268
- be,
425
+ const __cssModules$6 = {};
426
+ var __component__$6 = /* @__PURE__ */ normalizeComponent(
427
+ PayError$1,
428
+ render$6,
429
+ staticRenderFns$6,
430
+ false,
431
+ __vue2_injectStyles$6,
269
432
  "0817c014",
270
433
  null,
271
434
  null
272
435
  );
273
- function be(e) {
274
- for (let n in L)
275
- this[n] = L[n];
436
+ function __vue2_injectStyles$6(context) {
437
+ for (let o in __cssModules$6) {
438
+ this[o] = __cssModules$6[o];
439
+ }
276
440
  }
277
- const j = /* @__PURE__ */ function() {
278
- return Ce.exports;
441
+ const PayError2 = /* @__PURE__ */ function() {
442
+ return __component__$6.exports;
279
443
  }();
280
- var we = Object.defineProperty, Oe = Object.getOwnPropertyDescriptor, Q = (e, n, t, r) => {
281
- for (var s = r > 1 ? void 0 : r ? Oe(n, t) : n, o = e.length - 1, a; o >= 0; o--)
282
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
283
- return r && s && we(n, t, s), s;
444
+ var __defProp$5 = Object.defineProperty;
445
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
446
+ var __decorateClass$5 = (decorators, target, key, kind) => {
447
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
448
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
449
+ if (decorator = decorators[i])
450
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
451
+ if (kind && result)
452
+ __defProp$5(target, key, result);
453
+ return result;
284
454
  };
285
- let C = class extends _ {
455
+ let Balance$1 = class Balance extends Vue {
286
456
  constructor() {
287
457
  super(...arguments);
288
- i(this, "config");
289
- i(this, "value", 0);
458
+ __publicField(this, "config");
459
+ __publicField(this, "value", 0);
290
460
  }
291
461
  load() {
292
- const { key: t, api: r } = this.config.balance;
293
- if (!r || !t)
294
- throw new Error("不存在 key 或 api");
295
- return ge(r, t);
462
+ const { key, api } = this.config.balance;
463
+ if (!api || !key) {
464
+ throw new Error(`不存在 key 或 api`);
465
+ }
466
+ return getPayMoney(api, key);
296
467
  }
297
- onBalanceLoad(t) {
298
- this.value = t / 100, this.$emit("change", t);
468
+ onBalanceLoad(money) {
469
+ this.value = money / 100;
470
+ this.$emit("change", money);
299
471
  }
300
472
  };
301
- Q([
302
- x()
303
- ], C.prototype, "config", 2);
304
- C = Q([
305
- G({
306
- components: { PayError: j }
473
+ __decorateClass$5([
474
+ Inject()
475
+ ], Balance$1.prototype, "config", 2);
476
+ Balance$1 = __decorateClass$5([
477
+ Component({
478
+ components: { PayError: PayError2 }
307
479
  })
308
- ], C);
309
- var xe = function() {
310
- var e = this, n = e.$createElement, t = e._self._c || n;
311
- return t("div", {
480
+ ], Balance$1);
481
+ var render$5 = function() {
482
+ var _vm = this;
483
+ var _h = _vm.$createElement;
484
+ var _c = _vm._self._c || _h;
485
+ return _c("div", {
312
486
  staticClass: "root wechat-font"
313
- }, [t("PayError", {
487
+ }, [_c("PayError", {
314
488
  attrs: {
315
- load: e.load
489
+ "load": _vm.load
316
490
  },
317
491
  on: {
318
- done: e.onBalanceLoad
492
+ "done": _vm.onBalanceLoad
319
493
  }
320
- }, [t("h1", [e._v(" " + e._s(e.value) + " ")])])], 1);
321
- }, Te = [];
322
- const R = {};
323
- var je = /* @__PURE__ */ h(
324
- C,
325
- xe,
326
- Te,
327
- !1,
328
- Se,
329
- "75290345",
494
+ }, [_c("h1", [_vm._v(" " + _vm._s(_vm.value) + " ")])])], 1);
495
+ };
496
+ var staticRenderFns$5 = [];
497
+ const balance_vue_vue_type_style_index_0_scoped_true_lang = "";
498
+ const __cssModules$5 = {};
499
+ var __component__$5 = /* @__PURE__ */ normalizeComponent(
500
+ Balance$1,
501
+ render$5,
502
+ staticRenderFns$5,
503
+ false,
504
+ __vue2_injectStyles$5,
505
+ "20b4bf5f",
330
506
  null,
331
507
  null
332
508
  );
333
- function Se(e) {
334
- for (let n in R)
335
- this[n] = R[n];
509
+ function __vue2_injectStyles$5(context) {
510
+ for (let o in __cssModules$5) {
511
+ this[o] = __cssModules$5[o];
512
+ }
336
513
  }
337
- const Ee = /* @__PURE__ */ function() {
338
- return je.exports;
339
- }(), De = async (e) => (await T(e)).map(({
340
- Id: t,
341
- PaymentValue: r,
342
- PaymentName: s,
343
- PaymentIcon: o
344
- }) => {
345
- const a = Me(r);
346
- return {
347
- id: t,
348
- name: r,
349
- icon: o,
350
- type: a
351
- };
352
- });
353
- function Me(e) {
354
- return e.includes("支付宝") ? "alipay" : e.includes("微信") ? "wechat" : "unknow";
514
+ const Balance2 = /* @__PURE__ */ function() {
515
+ return __component__$5.exports;
516
+ }();
517
+ const getPayChannels = async (url, ignores) => {
518
+ const list = await request(url);
519
+ const newParamsList = list.map(({
520
+ Id: id,
521
+ PaymentValue: name,
522
+ PaymentName: uuid,
523
+ PaymentIcon: icon,
524
+ AgentDescribe: appid
525
+ }) => {
526
+ const type = getChannelType(name);
527
+ return {
528
+ id,
529
+ name,
530
+ icon,
531
+ type,
532
+ appid
533
+ };
534
+ });
535
+ return getEnabledChannel(newParamsList, ignores);
536
+ };
537
+ function getChannelType(name) {
538
+ if (name.includes("支付宝")) {
539
+ return "alipay";
540
+ }
541
+ if (name.includes("微信")) {
542
+ return "wechat";
543
+ }
544
+ if (name.includes("平台币")) {
545
+ return "platform";
546
+ }
547
+ if (name.includes("苹果")) {
548
+ return "apple";
549
+ }
550
+ return "unknow";
355
551
  }
356
- var Le = Object.defineProperty, Re = Object.getOwnPropertyDescriptor, Y = (e, n, t, r) => {
357
- for (var s = r > 1 ? void 0 : r ? Re(n, t) : n, o = e.length - 1, a; o >= 0; o--)
358
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
359
- return r && s && Le(n, t, s), s;
552
+ var __defProp$4 = Object.defineProperty;
553
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
554
+ var __decorateClass$4 = (decorators, target, key, kind) => {
555
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
556
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
557
+ if (decorator = decorators[i])
558
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
559
+ if (kind && result)
560
+ __defProp$4(target, key, result);
561
+ return result;
360
562
  };
361
- let b = class extends _ {
563
+ let Channels$1 = class Channels extends Vue {
362
564
  constructor() {
363
565
  super(...arguments);
364
- i(this, "config");
566
+ __publicField(this, "config");
365
567
  // 支付渠道
366
- i(this, "channels", []);
568
+ __publicField(this, "channels", []);
367
569
  // 选择的支付渠道下标
368
- i(this, "select", 0);
570
+ __publicField(this, "select", 0);
369
571
  // 是否显示气泡
370
- i(this, "showPopover", !1);
572
+ __publicField(this, "showPopover", false);
371
573
  }
372
574
  // 根据渠道计算选项
373
575
  get actions() {
374
- return this.channels.length ? this.channels.map(({ name: t, id: r, icon: s }, o) => ({
375
- text: t,
376
- id: r,
377
- disabled: o == this.select
378
- })) : [];
576
+ if (this.channels.length) {
577
+ return this.channels.map(({ name: text, id, icon }, index) => ({
578
+ text,
579
+ id,
580
+ disabled: index == this.select
581
+ }));
582
+ } else {
583
+ return [];
584
+ }
379
585
  }
380
586
  // 切换渠道
381
- onSelect(t, r) {
382
- this.select = r, this.$emit("change", this.channels[r]);
587
+ onSelect(action, index) {
588
+ this.select = index;
589
+ this.$emit("change", this.channels[index]);
383
590
  }
384
591
  get name() {
385
- let t = this.channels[this.select];
386
- return t ? t.name : "";
592
+ let item = this.channels[this.select];
593
+ if (item) {
594
+ return item.name;
595
+ } else {
596
+ return "";
597
+ }
598
+ }
599
+ get ignores() {
600
+ return this.config.channel.ignores || [];
387
601
  }
388
602
  load() {
389
- return De(this.config.channel.api);
603
+ return getPayChannels(this.config.channel.api, this.ignores);
390
604
  }
391
- onLoadChannels(t) {
392
- this.channels = _e(t), this.$emit("change", this.channels[0]);
605
+ onLoadChannels(data) {
606
+ this.channels = getEnabledChannel(data, this.ignores);
607
+ this.$emit("change", this.channels[0]);
393
608
  }
394
609
  };
395
- Y([
396
- x()
397
- ], b.prototype, "config", 2);
398
- b = Y([
399
- y({
610
+ __decorateClass$4([
611
+ Inject()
612
+ ], Channels$1.prototype, "config", 2);
613
+ Channels$1 = __decorateClass$4([
614
+ Component$1({
400
615
  components: {
401
- PayError: j
616
+ PayError: PayError2
402
617
  }
403
618
  })
404
- ], b);
405
- var Be = function() {
406
- var e = this, n = e.$createElement, t = e._self._c || n;
407
- return t("van-popover", {
619
+ ], Channels$1);
620
+ var render$4 = function() {
621
+ var _vm = this;
622
+ var _h = _vm.$createElement;
623
+ var _c = _vm._self._c || _h;
624
+ return _c("van-popover", {
408
625
  attrs: {
409
- trigger: "click",
410
- actions: e.actions,
411
- placement: "top-end"
626
+ "trigger": "click",
627
+ "actions": _vm.actions,
628
+ "placement": "top-end"
412
629
  },
413
630
  on: {
414
- select: e.onSelect
631
+ "select": _vm.onSelect
415
632
  },
416
- scopedSlots: e._u([{
633
+ scopedSlots: _vm._u([{
417
634
  key: "reference",
418
635
  fn: function() {
419
- return [t("div", {
636
+ return [_c("div", {
420
637
  staticClass: "cell"
421
- }, [t("h5", [e._v("付款方式")]), t("PayError", {
638
+ }, [_c("h5", [_vm._v("付款方式")]), _c("PayError", {
422
639
  staticClass: "name",
423
640
  attrs: {
424
- load: e.load
641
+ "load": _vm.load
425
642
  },
426
643
  on: {
427
- done: e.onLoadChannels
644
+ "done": _vm.onLoadChannels
428
645
  }
429
- }, [t("div", [e._v(" " + e._s(e.name) + " "), t("van-icon", {
646
+ }, [_c("div", [_vm._v(" " + _vm._s(_vm.name) + " "), _c("van-icon", {
430
647
  attrs: {
431
- name: "arrow"
648
+ "name": "arrow"
432
649
  }
433
650
  })], 1)])], 1)];
434
651
  },
435
- proxy: !0
652
+ proxy: true
436
653
  }]),
437
654
  model: {
438
- value: e.showPopover,
439
- callback: function(r) {
440
- e.showPopover = r;
655
+ value: _vm.showPopover,
656
+ callback: function($$v) {
657
+ _vm.showPopover = $$v;
441
658
  },
442
659
  expression: "showPopover"
443
660
  }
444
661
  });
445
- }, Ae = [];
446
- const B = {};
447
- var Ie = /* @__PURE__ */ h(
448
- b,
449
- Be,
450
- Ae,
451
- !1,
452
- Ne,
453
- "4e4c306e",
662
+ };
663
+ var staticRenderFns$4 = [];
664
+ const channelContainer_vue_vue_type_style_index_0_scoped_true_lang = "";
665
+ const __cssModules$4 = {};
666
+ var __component__$4 = /* @__PURE__ */ normalizeComponent(
667
+ Channels$1,
668
+ render$4,
669
+ staticRenderFns$4,
670
+ false,
671
+ __vue2_injectStyles$4,
672
+ "70746494",
454
673
  null,
455
674
  null
456
675
  );
457
- function Ne(e) {
458
- for (let n in B)
459
- this[n] = B[n];
676
+ function __vue2_injectStyles$4(context) {
677
+ for (let o in __cssModules$4) {
678
+ this[o] = __cssModules$4[o];
679
+ }
460
680
  }
461
- const Fe = /* @__PURE__ */ function() {
462
- return Ie.exports;
681
+ const Channels2 = /* @__PURE__ */ function() {
682
+ return __component__$4.exports;
463
683
  }();
464
- var Ve = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, K = (e, n, t, r) => {
465
- for (var s = r > 1 ? void 0 : r ? Ue(n, t) : n, o = e.length - 1, a; o >= 0; o--)
466
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
467
- return r && s && Ve(n, t, s), s;
684
+ var __defProp$3 = Object.defineProperty;
685
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
686
+ var __decorateClass$3 = (decorators, target, key, kind) => {
687
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
688
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
689
+ if (decorator = decorators[i])
690
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
691
+ if (kind && result)
692
+ __defProp$3(target, key, result);
693
+ return result;
468
694
  };
469
- let w = class extends _ {
695
+ let PriceCustom$1 = class PriceCustom extends Vue {
470
696
  constructor() {
471
697
  super(...arguments);
472
- i(this, "customPrice");
473
- i(this, "value", null);
474
- }
475
- onChange(t) {
476
- this.$emit("input", Number(t));
477
- }
478
- };
479
- K([
480
- P({ default: null })
481
- ], w.prototype, "customPrice", 2);
482
- w = K([
483
- y
484
- ], w);
485
- var qe = function() {
486
- var e = this, n = e.$createElement, t = e._self._c || n;
487
- return t("div", {
698
+ __publicField(this, "customPrice");
699
+ __publicField(this, "value", null);
700
+ }
701
+ onChange(val) {
702
+ this.$emit("input", Number(val));
703
+ }
704
+ };
705
+ __decorateClass$3([
706
+ Prop({ default: null })
707
+ ], PriceCustom$1.prototype, "customPrice", 2);
708
+ PriceCustom$1 = __decorateClass$3([
709
+ Component$1
710
+ ], PriceCustom$1);
711
+ var render$3 = function() {
712
+ var _vm = this;
713
+ var _h = _vm.$createElement;
714
+ var _c = _vm._self._c || _h;
715
+ return _c("div", {
488
716
  staticClass: "custom-price"
489
- }, [t("h5", [e._v("自定义金额")]), t("van-field", {
717
+ }, [_c("h5", [_vm._v("自定义金额")]), _c("van-field", {
490
718
  staticClass: "input wechat-font",
491
719
  attrs: {
492
- type: "digit",
493
- placeholder: "请输入金额",
494
- clearable: ""
720
+ "type": "digit",
721
+ "placeholder": "请输入金额",
722
+ "clearable": ""
495
723
  },
496
724
  on: {
497
- input: e.onChange
725
+ "input": _vm.onChange
498
726
  },
499
727
  model: {
500
- value: e.value,
501
- callback: function(r) {
502
- e.value = r;
728
+ value: _vm.value,
729
+ callback: function($$v) {
730
+ _vm.value = $$v;
503
731
  },
504
732
  expression: "value"
505
733
  }
506
734
  })], 1);
507
- }, Ge = [];
508
- const A = {};
509
- var ze = /* @__PURE__ */ h(
510
- w,
511
- qe,
512
- Ge,
513
- !1,
514
- Je,
735
+ };
736
+ var staticRenderFns$3 = [];
737
+ const priceCustom_vue_vue_type_style_index_0_scoped_true_lang = "";
738
+ const __cssModules$3 = {};
739
+ var __component__$3 = /* @__PURE__ */ normalizeComponent(
740
+ PriceCustom$1,
741
+ render$3,
742
+ staticRenderFns$3,
743
+ false,
744
+ __vue2_injectStyles$3,
515
745
  "ea027830",
516
746
  null,
517
747
  null
518
748
  );
519
- function Je(e) {
520
- for (let n in A)
521
- this[n] = A[n];
749
+ function __vue2_injectStyles$3(context) {
750
+ for (let o in __cssModules$3) {
751
+ this[o] = __cssModules$3[o];
752
+ }
522
753
  }
523
- const Z = /* @__PURE__ */ function() {
524
- return ze.exports;
754
+ const PriceCustom2 = /* @__PURE__ */ function() {
755
+ return __component__$3.exports;
525
756
  }();
526
- var We = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, k = (e, n, t, r) => {
527
- for (var s = r > 1 ? void 0 : r ? Xe(n, t) : n, o = e.length - 1, a; o >= 0; o--)
528
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
529
- return r && s && We(n, t, s), s;
757
+ var __defProp$2 = Object.defineProperty;
758
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
759
+ var __decorateClass$2 = (decorators, target, key, kind) => {
760
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
761
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
762
+ if (decorator = decorators[i])
763
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
764
+ if (kind && result)
765
+ __defProp$2(target, key, result);
766
+ return result;
530
767
  };
531
- let O = class extends _ {
768
+ let PriceItem$1 = class PriceItem extends Vue {
532
769
  constructor() {
533
770
  super(...arguments);
534
- i(this, "price");
771
+ __publicField(this, "price");
535
772
  }
536
773
  get realPrice() {
537
774
  return this.price.price / 100;
@@ -541,201 +778,233 @@ let O = class extends _ {
541
778
  return !this.price.count;
542
779
  }
543
780
  };
544
- k([
545
- P({ default: {} })
546
- ], O.prototype, "price", 2);
547
- O = k([
548
- y
549
- ], O);
550
- var He = function() {
551
- var e = this, n = e.$createElement, t = e._self._c || n;
552
- return t("div", {
781
+ __decorateClass$2([
782
+ Prop({ default: {} })
783
+ ], PriceItem$1.prototype, "price", 2);
784
+ PriceItem$1 = __decorateClass$2([
785
+ Component$1
786
+ ], PriceItem$1);
787
+ var render$2 = function() {
788
+ var _vm = this;
789
+ var _h = _vm.$createElement;
790
+ var _c = _vm._self._c || _h;
791
+ return _c("div", {
553
792
  staticClass: "price-root wechat-font",
554
793
  class: {
555
- "only-price": e.onlyPrice
794
+ "only-price": _vm.onlyPrice
556
795
  }
557
- }, [e.price.giftCount ? t("span", {
796
+ }, [_vm.price.giftCount ? _c("span", {
558
797
  staticClass: "gift"
559
- }, [e._v(" 赠" + e._s(e.price.giftCount) + " ")]) : e._e(), e.price.count ? t("span", {
798
+ }, [_vm._v(" 赠" + _vm._s(_vm.price.giftCount) + " ")]) : _vm._e(), _vm.price.count ? _c("span", {
560
799
  staticClass: "token-count"
561
- }, [t("img", {
800
+ }, [_c("img", {
562
801
  attrs: {
563
- src: "https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/npdd/user/my-v3/imgs/niu-coin-top-up-icon.png"
802
+ "src": "https://shangrao-qqzh.oss-cn-hangzhou.aliyuncs.com/npdd/user/my-v3/imgs/niu-coin-top-up-icon.png"
564
803
  }
565
- }), e._v(" " + e._s(e.price.count) + " ")]) : e._e(), t("span", {
804
+ }), _vm._v(" " + _vm._s(_vm.price.count) + " ")]) : _vm._e(), _c("span", {
566
805
  staticClass: "price"
567
- }, [e._v("¥" + e._s(e.realPrice))])]);
568
- }, Qe = [];
569
- const I = {};
570
- var Ye = /* @__PURE__ */ h(
571
- O,
572
- He,
573
- Qe,
574
- !1,
575
- Ke,
576
- "68d98a5c",
806
+ }, [_vm._v("¥" + _vm._s(_vm.realPrice))])]);
807
+ };
808
+ var staticRenderFns$2 = [];
809
+ const price_vue_vue_type_style_index_0_scoped_true_lang = "";
810
+ const __cssModules$2 = {};
811
+ var __component__$2 = /* @__PURE__ */ normalizeComponent(
812
+ PriceItem$1,
813
+ render$2,
814
+ staticRenderFns$2,
815
+ false,
816
+ __vue2_injectStyles$2,
817
+ "79d1ed34",
577
818
  null,
578
819
  null
579
820
  );
580
- function Ke(e) {
581
- for (let n in I)
582
- this[n] = I[n];
821
+ function __vue2_injectStyles$2(context) {
822
+ for (let o in __cssModules$2) {
823
+ this[o] = __cssModules$2[o];
824
+ }
583
825
  }
584
- const Ze = /* @__PURE__ */ function() {
585
- return Ye.exports;
826
+ const PriceItem2 = /* @__PURE__ */ function() {
827
+ return __component__$2.exports;
586
828
  }();
587
- var ke = Object.defineProperty, et = Object.getOwnPropertyDescriptor, S = (e, n, t, r) => {
588
- for (var s = r > 1 ? void 0 : r ? et(n, t) : n, o = e.length - 1, a; o >= 0; o--)
589
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
590
- return r && s && ke(n, t, s), s;
829
+ var __defProp$1 = Object.defineProperty;
830
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
831
+ var __decorateClass$1 = (decorators, target, key, kind) => {
832
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
833
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
834
+ if (decorator = decorators[i])
835
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
836
+ if (kind && result)
837
+ __defProp$1(target, key, result);
838
+ return result;
591
839
  };
592
- let g = class extends _ {
840
+ let PriceContainer$1 = class PriceContainer extends Vue {
593
841
  constructor() {
594
842
  super(...arguments);
595
- i(this, "config");
596
- i(this, "value", 0);
597
- i(this, "prices", []);
598
- i(this, "customPrice", 0);
599
- i(this, "loading", !0);
600
- i(this, "message", "");
843
+ __publicField(this, "config");
844
+ __publicField(this, "value", 0);
845
+ __publicField(this, "prices", []);
846
+ __publicField(this, "customPrice", 0);
847
+ __publicField(this, "loading", true);
848
+ __publicField(this, "message", "");
601
849
  }
602
850
  async mounted() {
603
851
  }
604
852
  /** 载入价目表*/
605
853
  load() {
606
- const { load: t, prices: r } = this.config.price;
607
- if (t)
608
- return t;
609
- if (r)
610
- return new Promise((s) => s(r));
854
+ const { load, prices } = this.config.price;
855
+ if (load) {
856
+ return load;
857
+ }
858
+ if (prices) {
859
+ return new Promise((res) => res(prices));
860
+ }
611
861
  }
612
862
  /** 价目表加载成功*/
613
- onLoadPrices(t) {
614
- this.prices = t, this.changePrice(0);
863
+ onLoadPrices(prices) {
864
+ this.prices = prices;
865
+ this.changePrice(0);
615
866
  }
616
867
  /** 切换价格*/
617
- changePrice(t) {
618
- this.value = t, this.$emit("change", this.prices[t]);
868
+ changePrice(index) {
869
+ this.value = index;
870
+ this.$emit("change", this.prices[index]);
619
871
  }
620
- onCustomPriceChange(t) {
621
- t ? this.$emit("change", { price: t * 100 }) : this.$emit("change", this.prices[this.value]);
872
+ onCustomPriceChange(n) {
873
+ if (n) {
874
+ this.$emit("change", { price: n * 100 });
875
+ } else {
876
+ this.$emit("change", this.prices[this.value]);
877
+ }
622
878
  }
623
879
  };
624
- S([
625
- x()
626
- ], g.prototype, "config", 2);
627
- S([
628
- oe("customPrice")
629
- ], g.prototype, "onCustomPriceChange", 1);
630
- g = S([
631
- y({
880
+ __decorateClass$1([
881
+ Inject()
882
+ ], PriceContainer$1.prototype, "config", 2);
883
+ __decorateClass$1([
884
+ Watch("customPrice")
885
+ ], PriceContainer$1.prototype, "onCustomPriceChange", 1);
886
+ PriceContainer$1 = __decorateClass$1([
887
+ Component$1({
632
888
  components: {
633
- PriceItem: Ze,
634
- PayError: j,
635
- PriceCustom: Z
889
+ PriceItem: PriceItem2,
890
+ PayError: PayError2,
891
+ PriceCustom: PriceCustom2
636
892
  }
637
893
  })
638
- ], g);
639
- var tt = function() {
640
- var e = this, n = e.$createElement, t = e._self._c || n;
641
- return e.config.price.disabled ? e._e() : t("div", {
894
+ ], PriceContainer$1);
895
+ var render$1 = function() {
896
+ var _vm = this;
897
+ var _h = _vm.$createElement;
898
+ var _c = _vm._self._c || _h;
899
+ return !_vm.config.price.disabled ? _c("div", {
642
900
  staticClass: "price-container"
643
- }, [t("h5", [e._v("选择充值金额")]), t("PayError", {
901
+ }, [_c("h5", [_vm._v("选择充值金额")]), _c("PayError", {
644
902
  attrs: {
645
- load: e.load
903
+ "load": _vm.load
646
904
  },
647
905
  on: {
648
- done: e.onLoadPrices
906
+ "done": _vm.onLoadPrices
649
907
  }
650
- }, [t("div", {
908
+ }, [_c("div", {
651
909
  staticClass: "content"
652
- }, e._l(e.prices, function(r, s) {
653
- return t("price-item", {
654
- key: s,
910
+ }, _vm._l(_vm.prices, function(p, index) {
911
+ return _c("price-item", {
912
+ key: index,
655
913
  staticClass: "price-item",
656
914
  class: {
657
- select: s == e.value
915
+ select: index == _vm.value
658
916
  },
659
917
  style: {
660
- backgroundColor: s == e.value ? e.config.theme || "orange" : ""
918
+ backgroundColor: index == _vm.value ? _vm.config.theme || "orange" : ""
661
919
  },
662
920
  attrs: {
663
- price: r
921
+ "price": p
664
922
  },
665
923
  nativeOn: {
666
- click: function(o) {
667
- return e.changePrice(s);
924
+ "click": function($event) {
925
+ return _vm.changePrice(index);
668
926
  }
669
927
  }
670
928
  });
671
- }), 1)]), e.config.price.custom ? [t("PriceCustom", {
929
+ }), 1)]), _vm.config.price.custom ? [_c("PriceCustom", {
672
930
  model: {
673
- value: e.customPrice,
674
- callback: function(r) {
675
- e.customPrice = r;
931
+ value: _vm.customPrice,
932
+ callback: function($$v) {
933
+ _vm.customPrice = $$v;
676
934
  },
677
935
  expression: "customPrice"
678
936
  }
679
- })] : e._e()], 2);
680
- }, nt = [];
681
- const N = {};
682
- var st = /* @__PURE__ */ h(
683
- g,
684
- tt,
685
- nt,
686
- !1,
687
- rt,
688
- "76333b1f",
937
+ })] : _vm._e()], 2) : _vm._e();
938
+ };
939
+ var staticRenderFns$1 = [];
940
+ const priceContainer_vue_vue_type_style_index_0_scoped_true_lang = "";
941
+ const __cssModules$1 = {};
942
+ var __component__$1 = /* @__PURE__ */ normalizeComponent(
943
+ PriceContainer$1,
944
+ render$1,
945
+ staticRenderFns$1,
946
+ false,
947
+ __vue2_injectStyles$1,
948
+ "737beb57",
689
949
  null,
690
950
  null
691
951
  );
692
- function rt(e) {
693
- for (let n in N)
694
- this[n] = N[n];
952
+ function __vue2_injectStyles$1(context) {
953
+ for (let o in __cssModules$1) {
954
+ this[o] = __cssModules$1[o];
955
+ }
695
956
  }
696
- const at = /* @__PURE__ */ function() {
697
- return st.exports;
957
+ const PriceContainer2 = /* @__PURE__ */ function() {
958
+ return __component__$1.exports;
698
959
  }();
699
- var ot = Object.defineProperty, it = Object.getOwnPropertyDescriptor, E = (e, n, t, r) => {
700
- for (var s = r > 1 ? void 0 : r ? it(n, t) : n, o = e.length - 1, a; o >= 0; o--)
701
- (a = e[o]) && (s = (r ? a(n, t, s) : a(s)) || s);
702
- return r && s && ot(n, t, s), s;
960
+ var __defProp2 = Object.defineProperty;
961
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
962
+ var __decorateClass = (decorators, target, key, kind) => {
963
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
964
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
965
+ if (decorator = decorators[i])
966
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
967
+ if (kind && result)
968
+ __defProp2(target, key, result);
969
+ return result;
703
970
  };
704
- let m = class extends _ {
971
+ let PayPopup$1 = class PayPopup extends Vue {
705
972
  constructor() {
706
973
  super(...arguments);
707
- i(this, "config");
708
- i(this, "id");
974
+ __publicField(this, "config");
975
+ __publicField(this, "id");
709
976
  // 默认主题
710
- i(this, "baseTheme", he);
977
+ __publicField(this, "baseTheme", BaseTheme);
711
978
  // 弹出层是否显示
712
- i(this, "visible", !1);
979
+ __publicField(this, "visible", false);
713
980
  // 余额
714
- i(this, "balance", 0);
981
+ __publicField(this, "balance", 0);
715
982
  // 价格
716
- i(this, "price", {
983
+ __publicField(this, "price", {
717
984
  price: 0
718
985
  });
719
986
  // 选择的渠道
720
- i(this, "channel", null);
987
+ __publicField(this, "channel", null);
721
988
  // 加载状态
722
- i(this, "loading", {
989
+ __publicField(this, "loading", {
723
990
  // 余额
724
- balance: !1,
991
+ balance: false,
725
992
  // 价目表
726
- price: !1,
993
+ price: false,
727
994
  // 渠道
728
- channel: !1
995
+ channel: false
729
996
  });
730
997
  }
731
998
  async mounted() {
732
999
  this.$nextTick(() => {
733
- this.visible = !0, this.initLoad();
1000
+ this.visible = true;
1001
+ this.initLoad();
734
1002
  });
735
1003
  }
736
1004
  // 初始化加载状态
737
1005
  initLoad() {
738
- this.loading.balance = this.config.balance.disabled, this.loading.price = this.config.price.disabled;
1006
+ this.loading.balance = this.config.balance.disabled;
1007
+ this.loading.price = this.config.price.disabled;
739
1008
  }
740
1009
  // 关闭弹出层
741
1010
  onClose() {
@@ -743,31 +1012,35 @@ let m = class extends _ {
743
1012
  }
744
1013
  // 弹出层动画结束
745
1014
  onClosed() {
746
- this.$emit("onClosed"), console.log("触发onClosed事件");
1015
+ this.$emit("onClosed");
747
1016
  }
748
1017
  // 点击充值
749
1018
  async onTopup() {
750
- const { key: t, prefix: r } = this.config.pay, s = String(this.id || this.price.price);
1019
+ const { key, prefix } = this.config.pay;
1020
+ const value = String(this.id || this.price.price);
751
1021
  if (!this.channel) {
752
- v("渠道不存在");
1022
+ fail("渠道不存在");
753
1023
  return;
754
1024
  }
755
- await fe({
1025
+ await sendPay({
756
1026
  channel: this.channel,
757
- key: t,
758
- value: s,
759
- prefix: r
1027
+ key,
1028
+ value,
1029
+ prefix
760
1030
  });
1031
+ this.onClosed();
761
1032
  }
762
1033
  /** 余额变动*/
763
- onBanlanceChange(t) {
764
- this.loading.balance = !0, console.log("余额变动", this.loading);
1034
+ onBanlanceChange(money) {
1035
+ this.loading.balance = true;
765
1036
  }
766
- onChannelChange(t) {
767
- this.channel = t, this.loading.channel = !0;
1037
+ onChannelChange(channel) {
1038
+ this.channel = channel;
1039
+ this.loading.channel = true;
768
1040
  }
769
- onPriceChange(t) {
770
- this.price = t, this.loading.price = !0;
1041
+ onPriceChange(price) {
1042
+ this.price = price;
1043
+ this.loading.price = true;
771
1044
  }
772
1045
  // 计算最终金额
773
1046
  get finalPrice() {
@@ -775,122 +1048,137 @@ let m = class extends _ {
775
1048
  }
776
1049
  // 计算是否允许充值
777
1050
  get disable() {
778
- return !Object.values(this.loading).every((t) => t === !0);
1051
+ return !Object.values(this.loading).every((val) => val === true);
779
1052
  }
780
1053
  // 计算页面标题
781
1054
  get title() {
782
1055
  return this.config.name;
783
1056
  }
784
1057
  };
785
- E([
786
- ie("config"),
787
- P({ default: X })
788
- ], m.prototype, "config", 2);
789
- E([
790
- P({ default: void 0 })
791
- ], m.prototype, "id", 2);
792
- m = E([
793
- y({
1058
+ __decorateClass([
1059
+ Provide("config"),
1060
+ Prop({ default: AgentConfig })
1061
+ ], PayPopup$1.prototype, "config", 2);
1062
+ __decorateClass([
1063
+ Prop({ default: void 0 })
1064
+ ], PayPopup$1.prototype, "id", 2);
1065
+ PayPopup$1 = __decorateClass([
1066
+ Component$1({
794
1067
  components: {
795
- Balance: Ee,
796
- Divider: se,
797
- PriceContainer: at,
798
- Button: re,
799
- PriceCustom: Z,
800
- Channels: Fe
1068
+ Balance: Balance2,
1069
+ Divider,
1070
+ PriceContainer: PriceContainer2,
1071
+ Button,
1072
+ PriceCustom: PriceCustom2,
1073
+ Channels: Channels2
801
1074
  }
802
1075
  })
803
- ], m);
804
- var ct = function() {
805
- var e = this, n = e.$createElement, t = e._self._c || n;
806
- return t("van-popup", {
1076
+ ], PayPopup$1);
1077
+ var render = function() {
1078
+ var _vm = this;
1079
+ var _h = _vm.$createElement;
1080
+ var _c = _vm._self._c || _h;
1081
+ return _c("van-popup", {
807
1082
  staticClass: "pay-popup",
808
1083
  attrs: {
809
- position: "bottom",
810
- overlay: !0,
811
- round: ""
1084
+ "position": "bottom",
1085
+ "overlay": true,
1086
+ "round": ""
812
1087
  },
813
1088
  on: {
814
- closed: e.onClosed,
815
- close: e.onClose
1089
+ "closed": _vm.onClosed,
1090
+ "close": _vm.onClose
816
1091
  },
817
1092
  model: {
818
- value: e.visible,
819
- callback: function(r) {
820
- e.visible = r;
1093
+ value: _vm.visible,
1094
+ callback: function($$v) {
1095
+ _vm.visible = $$v;
821
1096
  },
822
1097
  expression: "visible"
823
1098
  }
824
- }, [t("h4", {
1099
+ }, [_c("h4", {
825
1100
  staticClass: "title"
826
- }, [e._v(" " + e._s(e.title) + " ")]), e.config.balance.disabled ? e._e() : [t("Balance", {
1101
+ }, [_vm._v(" " + _vm._s(_vm.title) + " ")]), !_vm.config.balance.disabled ? [_c("Balance", {
827
1102
  on: {
828
- change: e.onBanlanceChange
1103
+ "change": _vm.onBanlanceChange
829
1104
  }
830
- }), t("Divider")], e.config.price.disabled ? e._e() : [t("PriceContainer", {
1105
+ }), _c("Divider")] : _vm._e(), !_vm.config.price.disabled ? [_c("PriceContainer", {
831
1106
  on: {
832
- change: e.onPriceChange
1107
+ "change": _vm.onPriceChange
833
1108
  }
834
- }), t("Divider")], t("Channels", {
1109
+ }), _c("Divider")] : _vm._e(), _c("Channels", {
835
1110
  on: {
836
- change: e.onChannelChange
1111
+ "change": _vm.onChannelChange
837
1112
  }
838
- }), t("Divider"), t("Button", {
1113
+ }), _c("Divider"), _c("Button", {
839
1114
  attrs: {
840
- disabled: e.disable,
841
- color: e.config.theme || e.baseTheme,
842
- block: ""
1115
+ "disabled": _vm.disable,
1116
+ "color": _vm.config.theme || _vm.baseTheme,
1117
+ "block": ""
843
1118
  },
844
1119
  on: {
845
- click: e.onTopup
1120
+ "click": _vm.onTopup
846
1121
  }
847
- }, [e._v(" 立即支付 " + e._s(e.finalPrice) + " 元 ")])], 2);
848
- }, lt = [];
849
- const F = {};
850
- var ut = /* @__PURE__ */ h(
851
- m,
852
- ct,
853
- lt,
854
- !1,
855
- pt,
856
- "74a1db46",
1122
+ }, [_vm._v(" 立即支付 " + _vm._s(_vm.finalPrice) + " 元 ")])], 2);
1123
+ };
1124
+ var staticRenderFns = [];
1125
+ const popup_vue_vue_type_style_index_0_scoped_true_lang = "";
1126
+ const __cssModules = {};
1127
+ var __component__ = /* @__PURE__ */ normalizeComponent(
1128
+ PayPopup$1,
1129
+ render,
1130
+ staticRenderFns,
1131
+ false,
1132
+ __vue2_injectStyles,
1133
+ "4ac1c510",
857
1134
  null,
858
1135
  null
859
1136
  );
860
- function pt(e) {
861
- for (let n in F)
862
- this[n] = F[n];
1137
+ function __vue2_injectStyles(context) {
1138
+ for (let o in __cssModules) {
1139
+ this[o] = __cssModules[o];
1140
+ }
863
1141
  }
864
- const _t = /* @__PURE__ */ function() {
865
- return ut.exports;
866
- }(), Ot = {
867
- install(e) {
868
- const n = (t, ...r) => new Promise((s, o) => {
869
- const a = ve[t], { needId: l } = a, c = r[0];
870
- if (l && !c) {
871
- q({
872
- title: "参数异常",
873
- message: `${t} 类型需要传入订单号 当前未传入!`
874
- });
875
- return;
876
- }
877
- const u = _.extend(_t), f = new u({
878
- // 注入配置
879
- propsData: {
880
- config: a,
881
- id: c
1142
+ const PayPopup2 = /* @__PURE__ */ function() {
1143
+ return __component__.exports;
1144
+ }();
1145
+ const plugin = {
1146
+ install(vue) {
1147
+ const create = (type, ...args) => {
1148
+ return new Promise((res, rej) => {
1149
+ const config = PayAllConfig[type];
1150
+ const { needId } = config;
1151
+ const id = args[0];
1152
+ if (needId && !id) {
1153
+ Dialog({
1154
+ title: "参数异常",
1155
+ message: `${type} 类型需要传入订单号 当前未传入!`
1156
+ });
1157
+ return;
882
1158
  }
1159
+ const Constructor = Vue.extend(PayPopup2);
1160
+ const instance = new Constructor({
1161
+ // 注入配置
1162
+ propsData: {
1163
+ config,
1164
+ id
1165
+ }
1166
+ });
1167
+ instance.$on("onClosed", () => {
1168
+ res();
1169
+ setTimeout(() => {
1170
+ var _a2;
1171
+ instance.$destroy();
1172
+ (_a2 = instance.$el.parentNode) == null ? void 0 : _a2.removeChild(instance.$el);
1173
+ }, 300);
1174
+ });
1175
+ instance.$mount();
1176
+ document.body.appendChild(instance.$el);
883
1177
  });
884
- f.$on("onClosed", () => {
885
- console.log("接收onClosed事件 调用 promise rej"), s(), setTimeout(() => {
886
- var d;
887
- f.$destroy(), (d = f.$el.parentNode) == null || d.removeChild(f.$el);
888
- }, 300);
889
- }), f.$mount(), document.body.appendChild(f.$el);
890
- });
891
- e.prototype.$pay = { create: n };
1178
+ };
1179
+ vue.prototype.$pay = { create };
892
1180
  }
893
1181
  };
894
1182
  export {
895
- Ot as PayPlugin
1183
+ plugin as PayPlugin
896
1184
  };