@pisell/private-materials 6.3.32 → 6.3.34
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +151 -146
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +23 -8
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +23 -8
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/index.d.ts +1 -2
- package/es/components/index.js +1 -2
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/schedules/model.d.ts +1 -9
- package/es/components/wallet/Detail/model.d.ts +1 -13
- package/es/components/wallet/DiscountCard/model.d.ts +1 -14
- package/es/components/wallet/PointCard/model.d.ts +1 -13
- package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/es/components/wallet/Voucher/model.d.ts +1 -13
- package/es/components/wallet/model.d.ts +1 -9
- package/es/components/walletList/index.d.ts +0 -25
- package/es/components/walletList/index.js +98 -66
- package/es/components/walletList/serve.d.ts +4 -0
- package/es/components/walletList/serve.js +46 -13
- package/es/components/walletList/types/index.d.ts +12 -12
- package/es/components/walletList/types/index.js +2 -2
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/plus/productSelect/CategoryTabs/index.d.ts +2 -0
- package/es/plus/productSelect/CategoryTabs/index.js +6 -3
- package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
- package/es/plus/productSelect/utils.js +0 -1
- package/es/plus/walletEditor/WalletEditor.d.ts +5 -0
- package/es/plus/walletEditor/WalletEditor.js +316 -0
- package/es/plus/walletEditor/WalletEditor.less +129 -0
- package/es/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
- package/es/plus/walletEditor/components/ImageUpload/index.js +223 -0
- package/es/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
- package/es/plus/walletEditor/components/JsonEditor/index.js +68 -0
- package/es/plus/walletEditor/components/JsonEditor/index.less +4 -0
- package/es/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
- package/es/plus/walletEditor/components/ValidityPeriodSelector/index.js +222 -0
- package/es/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
- package/es/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
- package/es/plus/walletEditor/components/relationProduct/index.js +49 -0
- package/es/plus/walletEditor/components/relationProduct/index.less +15 -0
- package/es/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
- package/es/plus/walletEditor/components/sortableWalletPassTypes/index.js +193 -0
- package/es/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
- package/es/plus/walletEditor/index.d.ts +3 -0
- package/es/plus/walletEditor/index.js +3 -0
- package/es/plus/walletEditor/locales.d.ts +126 -0
- package/es/plus/walletEditor/locales.js +143 -0
- package/es/plus/walletEditor/types.d.ts +52 -0
- package/es/plus/walletEditor/types.js +1 -0
- package/es/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
- package/es/plus/walletPassGallery/components/footerButton/index.js +247 -0
- package/es/plus/walletPassGallery/components/footerButton/index.less +93 -0
- package/es/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
- package/es/plus/walletPassGallery/components/passDetail/index.js +274 -0
- package/es/plus/walletPassGallery/components/passDetail/index.less +57 -0
- package/es/plus/walletPassGallery/components/passList/index.d.ts +11 -0
- package/es/plus/walletPassGallery/components/passList/index.js +115 -0
- package/es/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
- package/es/plus/walletPassGallery/components/recharge/index.js +134 -0
- package/es/plus/walletPassGallery/components/recharge/index.less +16 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.js +176 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.less +67 -0
- package/es/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
- package/es/plus/walletPassGallery/components/usageRule/index.js +248 -0
- package/es/plus/walletPassGallery/components/usageRule/index.less +157 -0
- package/es/plus/walletPassGallery/index.d.ts +6 -0
- package/es/plus/walletPassGallery/index.js +602 -0
- package/es/plus/walletPassGallery/index.less +115 -0
- package/es/plus/walletPassGallery/locales.d.ts +270 -0
- package/es/plus/walletPassGallery/locales.js +279 -0
- package/es/plus/walletPassGallery/serve.d.ts +218 -0
- package/es/plus/walletPassGallery/serve.js +289 -0
- package/es/pro/Login2.0/AuthModal.js +14 -8
- package/es/pro/Login2.0/Login2.js +52 -28
- package/es/pro/Login2.0/Register2.js +1 -1
- package/es/pro/Login2.0/components/phoneValidation.js +1 -1
- package/es/pro/Login2.0/index.less +11 -2
- package/es/pro/Login2.0/locales.js +112 -112
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/index.d.ts +1 -2
- package/lib/components/index.js +0 -3
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/schedules/model.d.ts +1 -9
- package/lib/components/wallet/Detail/model.d.ts +1 -13
- package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
- package/lib/components/wallet/PointCard/model.d.ts +1 -13
- package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/lib/components/wallet/Voucher/model.d.ts +1 -13
- package/lib/components/wallet/model.d.ts +1 -9
- package/lib/components/walletList/index.d.ts +0 -25
- package/lib/components/walletList/index.js +90 -51
- package/lib/components/walletList/serve.d.ts +4 -0
- package/lib/components/walletList/serve.js +12 -0
- package/lib/components/walletList/types/index.d.ts +12 -12
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -3
- package/lib/plus/productSelect/CategoryTabs/index.d.ts +2 -0
- package/lib/plus/productSelect/CategoryTabs/index.js +84 -69
- package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
- package/lib/plus/productSelect/utils.js +0 -1
- package/lib/plus/walletEditor/WalletEditor.d.ts +5 -0
- package/lib/plus/walletEditor/WalletEditor.js +354 -0
- package/lib/plus/walletEditor/WalletEditor.less +129 -0
- package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
- package/lib/plus/walletEditor/components/ImageUpload/index.js +201 -0
- package/lib/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
- package/lib/plus/walletEditor/components/JsonEditor/index.js +89 -0
- package/lib/plus/walletEditor/components/JsonEditor/index.less +4 -0
- package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
- package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.js +176 -0
- package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
- package/lib/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
- package/lib/plus/walletEditor/components/relationProduct/index.js +73 -0
- package/lib/plus/walletEditor/components/relationProduct/index.less +15 -0
- package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
- package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.js +211 -0
- package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
- package/lib/plus/walletEditor/index.d.ts +3 -0
- package/lib/plus/walletEditor/index.js +42 -0
- package/lib/plus/walletEditor/locales.d.ts +126 -0
- package/lib/plus/walletEditor/locales.js +167 -0
- package/lib/plus/walletEditor/types.d.ts +52 -0
- package/lib/plus/walletEditor/types.js +17 -0
- package/lib/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
- package/lib/plus/walletPassGallery/components/footerButton/index.js +187 -0
- package/lib/plus/walletPassGallery/components/footerButton/index.less +93 -0
- package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
- package/lib/plus/walletPassGallery/components/passDetail/index.js +287 -0
- package/lib/plus/walletPassGallery/components/passDetail/index.less +57 -0
- package/lib/plus/walletPassGallery/components/passList/index.d.ts +11 -0
- package/lib/plus/walletPassGallery/components/passList/index.js +136 -0
- package/lib/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
- package/lib/plus/walletPassGallery/components/recharge/index.js +146 -0
- package/lib/plus/walletPassGallery/components/recharge/index.less +16 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.js +212 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.less +67 -0
- package/lib/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
- package/lib/plus/walletPassGallery/components/usageRule/index.js +209 -0
- package/lib/plus/walletPassGallery/components/usageRule/index.less +157 -0
- package/lib/plus/walletPassGallery/index.d.ts +6 -0
- package/lib/plus/walletPassGallery/index.js +498 -0
- package/lib/plus/walletPassGallery/index.less +115 -0
- package/lib/plus/walletPassGallery/locales.d.ts +270 -0
- package/lib/plus/walletPassGallery/locales.js +299 -0
- package/lib/plus/walletPassGallery/serve.d.ts +218 -0
- package/lib/plus/walletPassGallery/serve.js +98 -0
- package/lib/pro/Login2.0/AuthModal.js +16 -11
- package/lib/pro/Login2.0/Login2.js +14 -4
- package/lib/pro/Login2.0/Register2.js +1 -1
- package/lib/pro/Login2.0/components/phoneValidation.js +1 -1
- package/lib/pro/Login2.0/index.less +11 -2
- package/lib/pro/Login2.0/locales.js +112 -112
- package/lowcode/sortable-wallet-pass-types/meta.ts +267 -0
- package/lowcode/wallet-editor/meta.ts +57 -0
- package/lowcode/wallet-editor/snippets.ts +13 -0
- package/lowcode/wallet-pass-gallery/meta.ts +35 -0
- package/package.json +4 -4
- package/lowcode/wallet/meta.ts +0 -79
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["id", "product_name", "balance", "code", "encoded", "expire_date", "shop", "limit_status", "product_cover", "unified_messages", "par_value", "tag"];
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
7
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
8
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
16
|
+
import classNames from 'classnames';
|
|
17
|
+
import { useRequest, useInfiniteScroll } from 'ahooks';
|
|
18
|
+
import { Button, Col, Row, Typography } from 'antd';
|
|
19
|
+
import { Icon, PisellModal, PisellInformationEntry, PisellToast, Tabs, PisellWalletPassCard } from '@pisell/materials';
|
|
20
|
+
import { locales } from '@pisell/utils';
|
|
21
|
+
import { getWalletList, getUnbindList, bindCodeToCustomer, getWalletDetail } from "./serve";
|
|
22
|
+
import localeTexts from "./locales";
|
|
23
|
+
import { request } from "../../utils";
|
|
24
|
+
import useEngineContext from "../../hooks/useEngineContext";
|
|
25
|
+
import PassList from "./components/passList";
|
|
26
|
+
import PassDetail from "./components/passDetail";
|
|
27
|
+
import "./index.less";
|
|
28
|
+
var Title = Typography.Title;
|
|
29
|
+
var KEYS = {
|
|
30
|
+
available: 'available',
|
|
31
|
+
unavailable: 'unavailable'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// 解决在当前类型环境下 Row/Col 的 children 类型不兼容问题
|
|
35
|
+
var ARow = Row;
|
|
36
|
+
var ACol = Col;
|
|
37
|
+
var TAGS = ['gift_card', 'point_card', 'product_discount_card', 'good_pass', 'product_voucher'];
|
|
38
|
+
var WalletPassGallery = function WalletPassGallery(props) {
|
|
39
|
+
var _context$appHelper, _utils$getStore, _dvaStore$core, _utils$translation, _getWalletDetail$data;
|
|
40
|
+
var _useState = useState('available'),
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
+
activeKey = _useState2[0],
|
|
43
|
+
setActiveKey = _useState2[1];
|
|
44
|
+
var _useState3 = useState(undefined),
|
|
45
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
46
|
+
currentItemId = _useState4[0],
|
|
47
|
+
setCurrentItemId = _useState4[1];
|
|
48
|
+
var _useState5 = useState(false),
|
|
49
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
|
+
isOpenAddModal = _useState6[0],
|
|
51
|
+
setIsOpenAddModal = _useState6[1];
|
|
52
|
+
var _useState7 = useState(null),
|
|
53
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
54
|
+
currentUnbindItem = _useState8[0],
|
|
55
|
+
setCurrentUnbindItem = _useState8[1];
|
|
56
|
+
var context = useEngineContext();
|
|
57
|
+
var utils = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
|
|
58
|
+
var platform = useMemo(function () {
|
|
59
|
+
if (utils.isMobile) {
|
|
60
|
+
return utils.isMobile() ? 'h5' : 'pc';
|
|
61
|
+
}
|
|
62
|
+
if (typeof window !== 'undefined') {
|
|
63
|
+
return window.innerWidth <= 768 ? 'h5' : 'pc';
|
|
64
|
+
}
|
|
65
|
+
}, [utils]);
|
|
66
|
+
var dvaStore = utils === null || utils === void 0 || (_utils$getStore = utils.getStore) === null || _utils$getStore === void 0 || (_utils$getStore = _utils$getStore.call(utils)) === null || _utils$getStore === void 0 ? void 0 : _utils$getStore.getState();
|
|
67
|
+
locales.init(localeTexts, (dvaStore === null || dvaStore === void 0 || (_dvaStore$core = dvaStore.core) === null || _dvaStore$core === void 0 ? void 0 : _dvaStore$core.translateLocale) || 'en');
|
|
68
|
+
request.setRequest(utils === null || utils === void 0 ? void 0 : utils.request);
|
|
69
|
+
var _getWalletDetail = useRequest(getWalletDetail, {
|
|
70
|
+
manual: true
|
|
71
|
+
});
|
|
72
|
+
var _getAvailableList = useInfiniteScroll( /*#__PURE__*/function () {
|
|
73
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(d) {
|
|
74
|
+
var walletId, res;
|
|
75
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
76
|
+
while (1) switch (_context.prev = _context.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
walletId = new URLSearchParams(window.location.search).get('id');
|
|
79
|
+
_context.next = 3;
|
|
80
|
+
return getWalletList({
|
|
81
|
+
available: 1,
|
|
82
|
+
num: 20,
|
|
83
|
+
skip: (d === null || d === void 0 ? void 0 : d.nextId) || 1,
|
|
84
|
+
tags: TAGS,
|
|
85
|
+
filter_wallet_id: walletId || undefined
|
|
86
|
+
});
|
|
87
|
+
case 3:
|
|
88
|
+
res = _context.sent;
|
|
89
|
+
return _context.abrupt("return", {
|
|
90
|
+
list: (res === null || res === void 0 ? void 0 : res.list) || [],
|
|
91
|
+
count: (res === null || res === void 0 ? void 0 : res.count) || 0,
|
|
92
|
+
nextId: (res === null || res === void 0 ? void 0 : res.skip) || 1
|
|
93
|
+
});
|
|
94
|
+
case 5:
|
|
95
|
+
case "end":
|
|
96
|
+
return _context.stop();
|
|
97
|
+
}
|
|
98
|
+
}, _callee);
|
|
99
|
+
}));
|
|
100
|
+
return function (_x) {
|
|
101
|
+
return _ref.apply(this, arguments);
|
|
102
|
+
};
|
|
103
|
+
}(), {
|
|
104
|
+
manual: true,
|
|
105
|
+
onSuccess: function onSuccess(data) {},
|
|
106
|
+
isNoMore: function isNoMore(d) {
|
|
107
|
+
if (!(d !== null && d !== void 0 && d.list)) return false;
|
|
108
|
+
return d.list.length >= (d.count || 0);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
var _getUnavailableList = useInfiniteScroll( /*#__PURE__*/function () {
|
|
112
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(d) {
|
|
113
|
+
var walletId, res;
|
|
114
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
115
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
116
|
+
case 0:
|
|
117
|
+
walletId = new URLSearchParams(window.location.search).get('id');
|
|
118
|
+
_context2.next = 3;
|
|
119
|
+
return getWalletList({
|
|
120
|
+
available: 0,
|
|
121
|
+
num: 20,
|
|
122
|
+
skip: (d === null || d === void 0 ? void 0 : d.nextId) || 1,
|
|
123
|
+
tags: TAGS,
|
|
124
|
+
filter_wallet_id: walletId || undefined
|
|
125
|
+
});
|
|
126
|
+
case 3:
|
|
127
|
+
res = _context2.sent;
|
|
128
|
+
return _context2.abrupt("return", {
|
|
129
|
+
list: (res === null || res === void 0 ? void 0 : res.list) || [],
|
|
130
|
+
count: (res === null || res === void 0 ? void 0 : res.count) || 0,
|
|
131
|
+
nextId: (res === null || res === void 0 ? void 0 : res.skip) || 1
|
|
132
|
+
});
|
|
133
|
+
case 5:
|
|
134
|
+
case "end":
|
|
135
|
+
return _context2.stop();
|
|
136
|
+
}
|
|
137
|
+
}, _callee2);
|
|
138
|
+
}));
|
|
139
|
+
return function (_x2) {
|
|
140
|
+
return _ref2.apply(this, arguments);
|
|
141
|
+
};
|
|
142
|
+
}(), {
|
|
143
|
+
manual: true,
|
|
144
|
+
isNoMore: function isNoMore(d) {
|
|
145
|
+
if (!(d !== null && d !== void 0 && d.list)) return false;
|
|
146
|
+
return d.list.length >= (d.count || 0);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
useEffect(function () {
|
|
150
|
+
var walletId = new URLSearchParams(window.location.search).get('id');
|
|
151
|
+
if (walletId) {
|
|
152
|
+
_getWalletDetail.runAsync(walletId);
|
|
153
|
+
}
|
|
154
|
+
var req1 = _getAvailableList.loadMoreAsync();
|
|
155
|
+
var req2 = _getUnavailableList.loadMoreAsync();
|
|
156
|
+
Promise.all([req1, req2]).then(function (_ref3) {
|
|
157
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
158
|
+
data1 = _ref4[0],
|
|
159
|
+
data2 = _ref4[1];
|
|
160
|
+
if (platform === 'h5') return;
|
|
161
|
+
// 当 currentItemId 为空或不在当前列表中时,设置默认选中项
|
|
162
|
+
var list = (data1 === null || data1 === void 0 ? void 0 : data1.list) || [];
|
|
163
|
+
var firstAvailable = list[0];
|
|
164
|
+
if (firstAvailable) {
|
|
165
|
+
setCurrentItemId(firstAvailable.id);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
var list2 = (data2 === null || data2 === void 0 ? void 0 : data2.list) || [];
|
|
169
|
+
var firstUnavailable = list2[0];
|
|
170
|
+
if (firstUnavailable) {
|
|
171
|
+
setCurrentItemId(firstUnavailable.id);
|
|
172
|
+
setActiveKey('unavailable');
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}, []);
|
|
176
|
+
var _getUnbindList = useRequest(getUnbindList, {
|
|
177
|
+
manual: true,
|
|
178
|
+
onSuccess: function onSuccess(data) {
|
|
179
|
+
// 默认选中首个
|
|
180
|
+
if (data !== null && data !== void 0 && data.length) {
|
|
181
|
+
setCurrentUnbindItem(data[0]);
|
|
182
|
+
} else {
|
|
183
|
+
setCurrentUnbindItem(null);
|
|
184
|
+
PisellToast({
|
|
185
|
+
content: locales.getText('wallet-pass-gallery.searchNoFound'),
|
|
186
|
+
duration: 2
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
onError: function onError(e) {
|
|
191
|
+
console.log('get unbind list error', e);
|
|
192
|
+
setCurrentUnbindItem(null);
|
|
193
|
+
PisellToast({
|
|
194
|
+
content: locales.getText('wallet-pass-gallery.searchNoFound'),
|
|
195
|
+
duration: 2
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
useEffect(function () {
|
|
200
|
+
document.body.id = 'body';
|
|
201
|
+
}, []);
|
|
202
|
+
var _avaliable = useMemo(function () {
|
|
203
|
+
var _getAvailableList$dat;
|
|
204
|
+
return ((_getAvailableList$dat = _getAvailableList.data) === null || _getAvailableList$dat === void 0 ? void 0 : _getAvailableList$dat.list) || [];
|
|
205
|
+
}, [_getAvailableList.data]);
|
|
206
|
+
var _unavailable = useMemo(function () {
|
|
207
|
+
var _getUnavailableList$d;
|
|
208
|
+
return ((_getUnavailableList$d = _getUnavailableList.data) === null || _getUnavailableList$d === void 0 ? void 0 : _getUnavailableList$d.list) || [];
|
|
209
|
+
}, [_getUnavailableList.data]);
|
|
210
|
+
var _handleTabChange = function _handleTabChange(key) {
|
|
211
|
+
var _unavailable$, _avaliable$;
|
|
212
|
+
setActiveKey(key);
|
|
213
|
+
if (platform === 'h5') {
|
|
214
|
+
setCurrentItemId(undefined);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
var newId = key === KEYS.unavailable ? (_unavailable$ = _unavailable[0]) === null || _unavailable$ === void 0 ? void 0 : _unavailable$.id : (_avaliable$ = _avaliable[0]) === null || _avaliable$ === void 0 ? void 0 : _avaliable$.id;
|
|
218
|
+
setCurrentItemId(newId);
|
|
219
|
+
};
|
|
220
|
+
var _handleMenuChange = function _handleMenuChange(key) {
|
|
221
|
+
// H5 Menu 切换逻辑
|
|
222
|
+
setActiveKey(key);
|
|
223
|
+
setCurrentItemId(undefined);
|
|
224
|
+
};
|
|
225
|
+
var _resetSearchState = function _resetSearchState() {
|
|
226
|
+
setCurrentUnbindItem(null);
|
|
227
|
+
_getUnbindList.mutate([]);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// 卡片点击处理:同步 URL 并根据平台选择 push/replace
|
|
231
|
+
var _handleCardClick = function _handleCardClick(id) {
|
|
232
|
+
setCurrentItemId(id);
|
|
233
|
+
// 不再更新 URL 中的 card_id
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// 通过code搜索卡券
|
|
237
|
+
var _handleSearchByCode = /*#__PURE__*/function () {
|
|
238
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(code) {
|
|
239
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
240
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
241
|
+
case 0:
|
|
242
|
+
if (!(!code || !code.trim())) {
|
|
243
|
+
_context3.next = 3;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
_resetSearchState();
|
|
247
|
+
return _context3.abrupt("return");
|
|
248
|
+
case 3:
|
|
249
|
+
_context3.prev = 3;
|
|
250
|
+
_context3.next = 6;
|
|
251
|
+
return _getUnbindList.run({
|
|
252
|
+
code: code
|
|
253
|
+
});
|
|
254
|
+
case 6:
|
|
255
|
+
_context3.next = 12;
|
|
256
|
+
break;
|
|
257
|
+
case 8:
|
|
258
|
+
_context3.prev = 8;
|
|
259
|
+
_context3.t0 = _context3["catch"](3);
|
|
260
|
+
_resetSearchState();
|
|
261
|
+
PisellToast({
|
|
262
|
+
content: locales.getText('wallet-pass-gallery.searchNoFound'),
|
|
263
|
+
duration: 2
|
|
264
|
+
});
|
|
265
|
+
case 12:
|
|
266
|
+
case "end":
|
|
267
|
+
return _context3.stop();
|
|
268
|
+
}
|
|
269
|
+
}, _callee3, null, [[3, 8]]);
|
|
270
|
+
}));
|
|
271
|
+
return function _handleSearchByCode(_x3) {
|
|
272
|
+
return _ref5.apply(this, arguments);
|
|
273
|
+
};
|
|
274
|
+
}();
|
|
275
|
+
var _handleBind = /*#__PURE__*/function () {
|
|
276
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
277
|
+
var data;
|
|
278
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
279
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
280
|
+
case 0:
|
|
281
|
+
if (currentUnbindItem !== null && currentUnbindItem !== void 0 && currentUnbindItem.code) {
|
|
282
|
+
_context4.next = 2;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
return _context4.abrupt("return");
|
|
286
|
+
case 2:
|
|
287
|
+
_context4.prev = 2;
|
|
288
|
+
_context4.next = 5;
|
|
289
|
+
return bindCodeToCustomer({
|
|
290
|
+
code: currentUnbindItem.code
|
|
291
|
+
});
|
|
292
|
+
case 5:
|
|
293
|
+
data = _context4.sent;
|
|
294
|
+
console.log('bind result', data);
|
|
295
|
+
if (data) {
|
|
296
|
+
PisellToast({
|
|
297
|
+
content: locales.getText('wallet-pass-gallery.addSuccess'),
|
|
298
|
+
duration: 2
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
// 重新获取列表
|
|
302
|
+
_getAvailableList.reloadAsync();
|
|
303
|
+
_getUnavailableList.reloadAsync();
|
|
304
|
+
}
|
|
305
|
+
// 关闭弹窗 清空搜索结果
|
|
306
|
+
setIsOpenAddModal(false);
|
|
307
|
+
_resetSearchState();
|
|
308
|
+
_context4.next = 15;
|
|
309
|
+
break;
|
|
310
|
+
case 12:
|
|
311
|
+
_context4.prev = 12;
|
|
312
|
+
_context4.t0 = _context4["catch"](2);
|
|
313
|
+
PisellToast({
|
|
314
|
+
content: locales.getText('wallet-pass-gallery.addError'),
|
|
315
|
+
duration: 2
|
|
316
|
+
});
|
|
317
|
+
case 15:
|
|
318
|
+
case "end":
|
|
319
|
+
return _context4.stop();
|
|
320
|
+
}
|
|
321
|
+
}, _callee4, null, [[2, 12]]);
|
|
322
|
+
}));
|
|
323
|
+
return function _handleBind() {
|
|
324
|
+
return _ref6.apply(this, arguments);
|
|
325
|
+
};
|
|
326
|
+
}();
|
|
327
|
+
var _currentItem = useMemo(function () {
|
|
328
|
+
if (!currentItemId) return null;
|
|
329
|
+
var found1 = _avaliable.find(function (item) {
|
|
330
|
+
return item.id === currentItemId;
|
|
331
|
+
});
|
|
332
|
+
if (found1) return found1;
|
|
333
|
+
var found2 = _unavailable.find(function (item) {
|
|
334
|
+
return item.id === currentItemId;
|
|
335
|
+
});
|
|
336
|
+
return found2;
|
|
337
|
+
}, [currentItemId, _avaliable, _unavailable]);
|
|
338
|
+
var _pcTitle = /*#__PURE__*/React.createElement("div", {
|
|
339
|
+
className: "pisell-wallet-pass-gallery_title"
|
|
340
|
+
}, /*#__PURE__*/React.createElement(Title, null, (utils === null || utils === void 0 || (_utils$translation = utils.translation) === null || _utils$translation === void 0 ? void 0 : _utils$translation.call(utils, (_getWalletDetail$data = _getWalletDetail.data) === null || _getWalletDetail$data === void 0 || (_getWalletDetail$data = _getWalletDetail$data.data) === null || _getWalletDetail$data === void 0 ? void 0 : _getWalletDetail$data.name)) || locales.getText('wallet-pass-gallery.wallet')), platform === 'pc' ? /*#__PURE__*/React.createElement(Button, {
|
|
341
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
342
|
+
type: "pisell2-plus"
|
|
343
|
+
}),
|
|
344
|
+
size: "large",
|
|
345
|
+
onClick: function onClick() {
|
|
346
|
+
return setIsOpenAddModal(true);
|
|
347
|
+
}
|
|
348
|
+
}, locales.getText('wallet-pass-gallery.add')) : null);
|
|
349
|
+
var renderAvaliableList = function renderAvaliableList() {
|
|
350
|
+
if (platform === 'h5') {
|
|
351
|
+
return /*#__PURE__*/React.createElement(PassList, {
|
|
352
|
+
onLoadMore: function onLoadMore() {
|
|
353
|
+
return _getAvailableList.loadMoreAsync();
|
|
354
|
+
},
|
|
355
|
+
loading: _getAvailableList.loadingMore,
|
|
356
|
+
hasMore: !_getAvailableList.noMore,
|
|
357
|
+
dataSource: _avaliable,
|
|
358
|
+
value: currentItemId,
|
|
359
|
+
onChange: _handleCardClick
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
return /*#__PURE__*/React.createElement(ARow, {
|
|
363
|
+
gutter: 20,
|
|
364
|
+
wrap: false
|
|
365
|
+
}, /*#__PURE__*/React.createElement(ACol, {
|
|
366
|
+
flex: "367px"
|
|
367
|
+
}, /*#__PURE__*/React.createElement(PassList, {
|
|
368
|
+
onLoadMore: function onLoadMore() {
|
|
369
|
+
return _getAvailableList.loadMoreAsync();
|
|
370
|
+
},
|
|
371
|
+
loading: _getAvailableList.loadingMore,
|
|
372
|
+
hasMore: !_getAvailableList.noMore,
|
|
373
|
+
dataSource: _avaliable,
|
|
374
|
+
value: currentItemId,
|
|
375
|
+
onChange: _handleCardClick
|
|
376
|
+
})), /*#__PURE__*/React.createElement(ACol, {
|
|
377
|
+
flex: "auto"
|
|
378
|
+
}, /*#__PURE__*/React.createElement(PassDetail, {
|
|
379
|
+
dataSource: _currentItem,
|
|
380
|
+
platform: platform
|
|
381
|
+
})));
|
|
382
|
+
};
|
|
383
|
+
var renderUnavailableList = function renderUnavailableList() {
|
|
384
|
+
if (platform === 'h5') {
|
|
385
|
+
return /*#__PURE__*/React.createElement(PassList, {
|
|
386
|
+
onLoadMore: function onLoadMore() {
|
|
387
|
+
return _getUnavailableList.loadMoreAsync();
|
|
388
|
+
},
|
|
389
|
+
hasMore: !_getUnavailableList.noMore,
|
|
390
|
+
loading: _getUnavailableList.loadingMore,
|
|
391
|
+
dataSource: _unavailable,
|
|
392
|
+
value: currentItemId,
|
|
393
|
+
onChange: _handleCardClick
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
return /*#__PURE__*/React.createElement(ARow, {
|
|
397
|
+
gutter: 20,
|
|
398
|
+
wrap: false
|
|
399
|
+
}, /*#__PURE__*/React.createElement(ACol, {
|
|
400
|
+
flex: "367px"
|
|
401
|
+
}, /*#__PURE__*/React.createElement(PassList, {
|
|
402
|
+
onLoadMore: function onLoadMore() {
|
|
403
|
+
return _getUnavailableList.loadMoreAsync();
|
|
404
|
+
},
|
|
405
|
+
hasMore: !_getUnavailableList.noMore,
|
|
406
|
+
loading: _getUnavailableList.loadingMore,
|
|
407
|
+
dataSource: _unavailable,
|
|
408
|
+
value: currentItemId,
|
|
409
|
+
onChange: _handleCardClick
|
|
410
|
+
})), /*#__PURE__*/React.createElement(ACol, {
|
|
411
|
+
flex: "auto"
|
|
412
|
+
}, /*#__PURE__*/React.createElement(PassDetail, {
|
|
413
|
+
dataSource: _currentItem,
|
|
414
|
+
platform: platform
|
|
415
|
+
})));
|
|
416
|
+
};
|
|
417
|
+
var renderTabBar = function renderTabBar(props, DefaultTabBar) {
|
|
418
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
419
|
+
style: {
|
|
420
|
+
zIndex: 99,
|
|
421
|
+
position: 'sticky',
|
|
422
|
+
top: 0
|
|
423
|
+
}
|
|
424
|
+
}, /*#__PURE__*/React.createElement(DefaultTabBar, _extends({}, props, {
|
|
425
|
+
style: {
|
|
426
|
+
background: 'white'
|
|
427
|
+
}
|
|
428
|
+
})));
|
|
429
|
+
};
|
|
430
|
+
var renderContent = function renderContent() {
|
|
431
|
+
var _getAvailableList$dat2, _getUnavailableList$d2;
|
|
432
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
433
|
+
className: "pisell-wallet-pass-gallery_content"
|
|
434
|
+
}, /*#__PURE__*/React.createElement(Tabs, {
|
|
435
|
+
defaultActiveKey: "available",
|
|
436
|
+
activeKey: activeKey,
|
|
437
|
+
type: "line",
|
|
438
|
+
onChange: _handleTabChange,
|
|
439
|
+
renderTabBar: platform === 'h5' ? renderTabBar : undefined,
|
|
440
|
+
items: [{
|
|
441
|
+
key: KEYS.available,
|
|
442
|
+
label: locales.getText('wallet-pass-gallery.available'),
|
|
443
|
+
children: renderAvaliableList(),
|
|
444
|
+
badge: ((_getAvailableList$dat2 = _getAvailableList.data) === null || _getAvailableList$dat2 === void 0 ? void 0 : _getAvailableList$dat2.count) || 0
|
|
445
|
+
}, {
|
|
446
|
+
key: KEYS.unavailable,
|
|
447
|
+
label: locales.getText('wallet-pass-gallery.unavailable'),
|
|
448
|
+
children: renderUnavailableList(),
|
|
449
|
+
badge: ((_getUnavailableList$d2 = _getUnavailableList.data) === null || _getUnavailableList$d2 === void 0 ? void 0 : _getUnavailableList$d2.count) || 0
|
|
450
|
+
}]
|
|
451
|
+
}));
|
|
452
|
+
};
|
|
453
|
+
var renderPcContent = function renderPcContent() {
|
|
454
|
+
return /*#__PURE__*/React.createElement("div", null, _pcTitle, renderContent());
|
|
455
|
+
};
|
|
456
|
+
var renderSearchCard = function renderSearchCard(item, index) {
|
|
457
|
+
var id = item.id,
|
|
458
|
+
_item$product_name = item.product_name,
|
|
459
|
+
product_name = _item$product_name === void 0 ? '' : _item$product_name,
|
|
460
|
+
_item$balance = item.balance,
|
|
461
|
+
balance = _item$balance === void 0 ? 0 : _item$balance,
|
|
462
|
+
_item$code = item.code,
|
|
463
|
+
code = _item$code === void 0 ? '' : _item$code,
|
|
464
|
+
_item$encoded = item.encoded,
|
|
465
|
+
encoded = _item$encoded === void 0 ? '' : _item$encoded,
|
|
466
|
+
_item$expire_date = item.expire_date,
|
|
467
|
+
expire_date = _item$expire_date === void 0 ? '' : _item$expire_date,
|
|
468
|
+
shop = item.shop,
|
|
469
|
+
limit_status = item.limit_status,
|
|
470
|
+
_item$product_cover = item.product_cover,
|
|
471
|
+
product_cover = _item$product_cover === void 0 ? '' : _item$product_cover,
|
|
472
|
+
_item$unified_message = item.unified_messages,
|
|
473
|
+
unified_messages = _item$unified_message === void 0 ? {} : _item$unified_message,
|
|
474
|
+
_item$par_value = item.par_value,
|
|
475
|
+
par_value = _item$par_value === void 0 ? '' : _item$par_value,
|
|
476
|
+
_item$tag = item.tag,
|
|
477
|
+
tag = _item$tag === void 0 ? '' : _item$tag,
|
|
478
|
+
rest = _objectWithoutProperties(item, _excluded);
|
|
479
|
+
var _unified_messages$tit = unified_messages.title,
|
|
480
|
+
title = _unified_messages$tit === void 0 ? '' : _unified_messages$tit;
|
|
481
|
+
var _shop$name = shop.name,
|
|
482
|
+
name = _shop$name === void 0 ? '' : _shop$name;
|
|
483
|
+
var isActive = id === (currentUnbindItem === null || currentUnbindItem === void 0 ? void 0 : currentUnbindItem.id) && platform === 'pc';
|
|
484
|
+
var isEnabled = limit_status === 'enable';
|
|
485
|
+
var isDiscountCard = tag === 'product_discount_card';
|
|
486
|
+
var getBalanceTitle = function getBalanceTitle() {
|
|
487
|
+
if (tag === 'point_card') {
|
|
488
|
+
return locales.getText('wallet-pass-gallery.points');
|
|
489
|
+
} else if (tag === 'good_pass') {
|
|
490
|
+
return locales.getText('wallet-pass-gallery.goodPass');
|
|
491
|
+
}
|
|
492
|
+
return undefined;
|
|
493
|
+
};
|
|
494
|
+
return /*#__PURE__*/React.createElement(PisellWalletPassCard, _extends({}, rest, {
|
|
495
|
+
id: id,
|
|
496
|
+
type: tag,
|
|
497
|
+
key: id,
|
|
498
|
+
balanceTitle: getBalanceTitle(),
|
|
499
|
+
showDetail: false,
|
|
500
|
+
showRedeem: false,
|
|
501
|
+
showQrCode: false,
|
|
502
|
+
cover: product_cover,
|
|
503
|
+
disabled: !isEnabled,
|
|
504
|
+
showDisabledReason: !isEnabled,
|
|
505
|
+
disabledReason: title,
|
|
506
|
+
propStyle: {
|
|
507
|
+
marginBottom: 10
|
|
508
|
+
},
|
|
509
|
+
showBalanceSymbol: !['point_card', 'good_pass'].includes(tag),
|
|
510
|
+
showBalance: tag !== 'product_discount_card',
|
|
511
|
+
active: isActive,
|
|
512
|
+
name: product_name,
|
|
513
|
+
qrCode: code,
|
|
514
|
+
storeName: name,
|
|
515
|
+
balance: Number(balance),
|
|
516
|
+
code: encoded,
|
|
517
|
+
discount: Number(par_value),
|
|
518
|
+
showDiscount: isDiscountCard,
|
|
519
|
+
validDate: expire_date,
|
|
520
|
+
onClick: function onClick() {
|
|
521
|
+
return setCurrentUnbindItem(item);
|
|
522
|
+
},
|
|
523
|
+
style: {
|
|
524
|
+
cursor: 'pointer',
|
|
525
|
+
width: '100%',
|
|
526
|
+
marginTop: 8
|
|
527
|
+
}
|
|
528
|
+
}));
|
|
529
|
+
};
|
|
530
|
+
var renderH5Content = function renderH5Content() {
|
|
531
|
+
var _utils$interaction, _utils$interaction$is, _utils$translation2, _getWalletDetail$data2;
|
|
532
|
+
var _walletBar = !(utils !== null && utils !== void 0 && (_utils$interaction = utils.interaction) !== null && _utils$interaction !== void 0 && (_utils$interaction = _utils$interaction.utils) !== null && _utils$interaction !== void 0 && (_utils$interaction$is = _utils$interaction.isAppEnv) !== null && _utils$interaction$is !== void 0 && _utils$interaction$is.call(_utils$interaction)) && /*#__PURE__*/React.createElement("div", {
|
|
533
|
+
className: "pisell-wallet-pass-gallery-bar"
|
|
534
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
535
|
+
className: "pisell-wallet-pass-gallery-header-bar-arrow",
|
|
536
|
+
onClick: function onClick() {
|
|
537
|
+
history.back();
|
|
538
|
+
}
|
|
539
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
540
|
+
type: "pisell2-chevron-left"
|
|
541
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
542
|
+
className: "header-title"
|
|
543
|
+
}, (utils === null || utils === void 0 || (_utils$translation2 = utils.translation) === null || _utils$translation2 === void 0 ? void 0 : _utils$translation2.call(utils, (_getWalletDetail$data2 = _getWalletDetail.data) === null || _getWalletDetail$data2 === void 0 || (_getWalletDetail$data2 = _getWalletDetail$data2.data) === null || _getWalletDetail$data2 === void 0 ? void 0 : _getWalletDetail$data2.name)) || locales.getText('wallet-pass-gallery.wallet')));
|
|
544
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, _walletBar, renderContent(), /*#__PURE__*/React.createElement("div", {
|
|
545
|
+
style: {
|
|
546
|
+
padding: 24
|
|
547
|
+
}
|
|
548
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
549
|
+
size: "large",
|
|
550
|
+
onClick: function onClick() {
|
|
551
|
+
return setIsOpenAddModal(true);
|
|
552
|
+
},
|
|
553
|
+
block: true
|
|
554
|
+
}, locales.getText('wallet-pass-gallery.button.add'))), /*#__PURE__*/React.createElement(PisellModal, {
|
|
555
|
+
platform: 'h5',
|
|
556
|
+
visible: !!_currentItem,
|
|
557
|
+
onCancel: function onCancel() {
|
|
558
|
+
return setCurrentItemId('');
|
|
559
|
+
},
|
|
560
|
+
footer: null,
|
|
561
|
+
title: locales.getText('wallet-pass-gallery.details')
|
|
562
|
+
}, /*#__PURE__*/React.createElement(PassDetail, {
|
|
563
|
+
dataSource: _currentItem,
|
|
564
|
+
platform: platform
|
|
565
|
+
})));
|
|
566
|
+
};
|
|
567
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
568
|
+
className: classNames('pisell-wallet-pass-gallery', "pisell-wallet-pass-gallery-".concat(platform))
|
|
569
|
+
}, platform === 'pc' ? renderPcContent() : renderH5Content()), /*#__PURE__*/React.createElement(PisellModal, {
|
|
570
|
+
title: locales.getText('wallet-pass-gallery.add'),
|
|
571
|
+
platform: platform === 'pc' ? 'pc' : 'h5',
|
|
572
|
+
mobileModalHeight: "auto",
|
|
573
|
+
open: isOpenAddModal,
|
|
574
|
+
onCancel: function onCancel() {
|
|
575
|
+
return setIsOpenAddModal(false);
|
|
576
|
+
},
|
|
577
|
+
cancelVisible: false,
|
|
578
|
+
destroyOnClose: true,
|
|
579
|
+
okText: locales.getText('wallet-pass-gallery.confirm'),
|
|
580
|
+
okButtonProps: {
|
|
581
|
+
disabled: !(currentUnbindItem !== null && currentUnbindItem !== void 0 && currentUnbindItem.code)
|
|
582
|
+
},
|
|
583
|
+
onOk: _handleBind
|
|
584
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
585
|
+
style: {
|
|
586
|
+
margin: '24px 0'
|
|
587
|
+
}
|
|
588
|
+
}, /*#__PURE__*/React.createElement(PisellInformationEntry, {
|
|
589
|
+
title: locales.getText('wallet-pass-gallery.addModalTitle'),
|
|
590
|
+
entryModes: [{
|
|
591
|
+
type: 'scanCode',
|
|
592
|
+
name: locales.getText('wallet-pass-gallery.scanBarQrCode')
|
|
593
|
+
}, {
|
|
594
|
+
type: 'input',
|
|
595
|
+
name: locales.getText('wallet-pass-gallery.enterCodes')
|
|
596
|
+
}],
|
|
597
|
+
searchDescribe: locales.getText('wallet-pass-gallery.searchDescribe'),
|
|
598
|
+
onChange: _handleSearchByCode,
|
|
599
|
+
onChangeType: _resetSearchState
|
|
600
|
+
}), (_getUnbindList.data || []).map(renderSearchCard))));
|
|
601
|
+
};
|
|
602
|
+
export default WalletPassGallery;
|