@pisell/pisellos 0.0.372 → 0.0.374
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/model/strategy/adapter/walletPass/utils.js +7 -2
- package/dist/modules/Customer/index.js +1 -1
- package/dist/modules/Payment/index.js +2 -2
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.js +20 -17
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/model/strategy/adapter/walletPass/utils.js +3 -1
- package/lib/modules/Customer/index.js +1 -1
- package/lib/modules/Payment/index.js +1 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.js +10 -9
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +0 -6
- package/package.json +1 -1
|
@@ -688,13 +688,18 @@ export var getMainProductPrice = function getMainProductPrice(product, isDeductT
|
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
|
|
691
|
-
//
|
|
691
|
+
// 税费
|
|
692
692
|
} catch (err) {
|
|
693
693
|
_iterator3.e(err);
|
|
694
694
|
} finally {
|
|
695
695
|
_iterator3.f();
|
|
696
696
|
}
|
|
697
|
-
var
|
|
697
|
+
var taxFee = new Decimal((product === null || product === void 0 ? void 0 : product.tax_fee) || (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.main_product_attached_bundle_tax_fee) || 0);
|
|
698
|
+
// 附加费
|
|
699
|
+
var surchargeFee = new Decimal((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.main_product_attached_bundle_surcharge_fee) || 0);
|
|
700
|
+
|
|
701
|
+
// 税费附加费总额
|
|
702
|
+
var taxAndFeeTotal = taxFee.add(surchargeFee);
|
|
698
703
|
|
|
699
704
|
// 如果需要抵扣税费与附加费,则加上税费附加费总额
|
|
700
705
|
if (isDeductTaxAndFee) {
|
|
@@ -153,7 +153,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
153
153
|
skip: skip,
|
|
154
154
|
num: num,
|
|
155
155
|
sort_by: SORT_BY,
|
|
156
|
-
with: ['latestWalletDetail.wallet', 'contactsInfo'],
|
|
156
|
+
with: ['latestWalletDetail.wallet', 'contactsInfo', 'formRecord'],
|
|
157
157
|
search_wallet_flag: 1,
|
|
158
158
|
search_wallet_pass_flag: 1
|
|
159
159
|
}, search && {
|
|
@@ -21,7 +21,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
22
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
23
|
import { BaseModule } from "../BaseModule";
|
|
24
|
-
import { PaymentStatus,
|
|
24
|
+
import { PaymentStatus, PaymentMethodType, RoundingRule } from "./types";
|
|
25
25
|
import { getUniqueId } from "../Cart/utils";
|
|
26
26
|
import { CashPaymentImpl } from "./cash";
|
|
27
27
|
import { EftposPaymentImpl } from "./eftpos";
|
|
@@ -1149,7 +1149,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1149
1149
|
this.logInfo('更新订单支付项完成', {
|
|
1150
1150
|
orderUuid: orderUuid
|
|
1151
1151
|
});
|
|
1152
|
-
this.core.effects.emit(
|
|
1152
|
+
this.core.effects.emit("".concat(this.name, ":onPaymentAdded"), {
|
|
1153
1153
|
orderUuid: orderUuid,
|
|
1154
1154
|
payment: newPaymentItem
|
|
1155
1155
|
});
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -587,7 +587,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
587
587
|
|
|
588
588
|
// 找到适用于此商品的所有优惠券,仅考虑isSelected不为false的优惠券
|
|
589
589
|
var applicableDiscounts = sortedDiscountList.filter(function (discount) {
|
|
590
|
-
var _product$discount_lis3, _flatItem$parentProdu2, _flatItem$product2;
|
|
590
|
+
var _product$discount_lis3, _product$discount_lis4, _flatItem$parentProdu2, _flatItem$product2;
|
|
591
591
|
// 🔥 检查策略可用性(针对 good_pass 和折扣卡)
|
|
592
592
|
var discountType = discount.tag || discount.type;
|
|
593
593
|
if (['good_pass', 'discount_card', 'product_discount_card'].includes(discountType)) {
|
|
@@ -600,12 +600,15 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
600
600
|
|
|
601
601
|
// 如果商品价格为 0,其实不需要使用任何优惠券,直接 return true
|
|
602
602
|
// 商品券时主商品价格为0不可用
|
|
603
|
-
if ((Number(product.price) <= 0 || !product.price) &&
|
|
604
|
-
|
|
605
|
-
// 折扣卡时总价为0时不可用
|
|
606
|
-
if ((Number(product.total) <= 0 || !product.total) && !((_product$discount_lis3 = product.discount_list) !== null && _product$discount_lis3 !== void 0 && _product$discount_lis3.find(function (n) {
|
|
603
|
+
if ((Number(product.price) <= 0 || !product.price) && !((_product$discount_lis3 = product.discount_list) !== null && _product$discount_lis3 !== void 0 && _product$discount_lis3.find(function (n) {
|
|
607
604
|
var _n$discount;
|
|
608
605
|
return ((_n$discount = n.discount) === null || _n$discount === void 0 ? void 0 : _n$discount.resource_id) === discount.id;
|
|
606
|
+
})) && (discount.tag || discount.type) === 'good_pass') return false;
|
|
607
|
+
|
|
608
|
+
// 折扣卡商品价格为0时不可用
|
|
609
|
+
if ((Number(product.price) <= 0 || !product.price) && !((_product$discount_lis4 = product.discount_list) !== null && _product$discount_lis4 !== void 0 && _product$discount_lis4.find(function (n) {
|
|
610
|
+
var _n$discount2;
|
|
611
|
+
return ((_n$discount2 = n.discount) === null || _n$discount2 === void 0 ? void 0 : _n$discount2.resource_id) === discount.id;
|
|
609
612
|
})) && (discount.tag || discount.type) !== 'good_pass') return false;
|
|
610
613
|
// 如果优惠券已被使用,则跳过
|
|
611
614
|
var targetUsedDiscounts = usedDiscounts.get(discount.id);
|
|
@@ -654,12 +657,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
654
657
|
// 如果是手动折扣,则不适用优惠券
|
|
655
658
|
var isManualDiscount = false;
|
|
656
659
|
if (flatItem.type === 'main') {
|
|
657
|
-
var _product$
|
|
660
|
+
var _product$discount_lis5, _product7, _product7$every;
|
|
658
661
|
// 主商品:判断自身是否手动折扣
|
|
659
662
|
isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : product.total != product.origin_total && (product.bundle || []).every(function (item) {
|
|
660
663
|
var _ref3;
|
|
661
664
|
return !((_ref3 = item.discount_list || []) !== null && _ref3 !== void 0 && _ref3.length);
|
|
662
|
-
}) && (!((_product$
|
|
665
|
+
}) && (!((_product$discount_lis5 = product.discount_list) !== null && _product$discount_lis5 !== void 0 && _product$discount_lis5.length) || ((_product7 = product) === null || _product7 === void 0 || (_product7 = _product7.discount_list) === null || _product7 === void 0 || (_product7$every = _product7.every) === null || _product7$every === void 0 ? void 0 : _product7$every.call(_product7, function (item) {
|
|
663
666
|
return item.type === 'product';
|
|
664
667
|
})));
|
|
665
668
|
} else {
|
|
@@ -678,9 +681,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
678
681
|
|
|
679
682
|
// 勾选时覆盖手动折扣
|
|
680
683
|
if (options !== null && options !== void 0 && options.discountId) {
|
|
681
|
-
var _product$
|
|
684
|
+
var _product$discount_lis6;
|
|
682
685
|
// 主商品:检查自己的 discount_list
|
|
683
|
-
if (flatItem.type === 'main' && (_product$
|
|
686
|
+
if (flatItem.type === 'main' && (_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.some(function (item) {
|
|
684
687
|
var _item$discount;
|
|
685
688
|
return ((_item$discount = item.discount) === null || _item$discount === void 0 ? void 0 : _item$discount.resource_id) === options.discountId;
|
|
686
689
|
})) {
|
|
@@ -688,8 +691,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
688
691
|
}
|
|
689
692
|
// bundle子商品:检查自己的 discount_list 或父主商品的 discount_list
|
|
690
693
|
if (flatItem.type === 'bundle') {
|
|
691
|
-
var _product$
|
|
692
|
-
if ((_product$
|
|
694
|
+
var _product$discount_lis7, _flatItem$parentProdu3;
|
|
695
|
+
if ((_product$discount_lis7 = product.discount_list) !== null && _product$discount_lis7 !== void 0 && _product$discount_lis7.some(function (item) {
|
|
693
696
|
var _item$discount2;
|
|
694
697
|
return ((_item$discount2 = item.discount) === null || _item$discount2 === void 0 ? void 0 : _item$discount2.resource_id) === options.discountId;
|
|
695
698
|
}) || (_flatItem$parentProdu3 = flatItem.parentProduct) !== null && _flatItem$parentProdu3 !== void 0 && (_flatItem$parentProdu3 = _flatItem$parentProdu3.discount_list) !== null && _flatItem$parentProdu3 !== void 0 && _flatItem$parentProdu3.some(function (item) {
|
|
@@ -701,9 +704,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
701
704
|
}
|
|
702
705
|
}
|
|
703
706
|
if (options !== null && options !== void 0 && options.selectedList) {
|
|
704
|
-
var _product$
|
|
707
|
+
var _product$discount_lis8;
|
|
705
708
|
// 主商品:检查自己的 discount_list
|
|
706
|
-
if (flatItem.type === 'main' && (_product$
|
|
709
|
+
if (flatItem.type === 'main' && (_product$discount_lis8 = product.discount_list) !== null && _product$discount_lis8 !== void 0 && _product$discount_lis8.some(function (item) {
|
|
707
710
|
var _options$selectedList;
|
|
708
711
|
return options === null || options === void 0 || (_options$selectedList = options.selectedList) === null || _options$selectedList === void 0 ? void 0 : _options$selectedList.some(function (n) {
|
|
709
712
|
var _item$discount4;
|
|
@@ -714,8 +717,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
714
717
|
}
|
|
715
718
|
// bundle子商品:检查自己的 discount_list 或父主商品的 discount_list
|
|
716
719
|
if (flatItem.type === 'bundle') {
|
|
717
|
-
var _product$
|
|
718
|
-
if ((_product$
|
|
720
|
+
var _product$discount_lis9, _flatItem$parentProdu4;
|
|
721
|
+
if ((_product$discount_lis9 = product.discount_list) !== null && _product$discount_lis9 !== void 0 && _product$discount_lis9.some(function (item) {
|
|
719
722
|
var _options$selectedList2;
|
|
720
723
|
return options === null || options === void 0 || (_options$selectedList2 = options.selectedList) === null || _options$selectedList2 === void 0 ? void 0 : _options$selectedList2.some(function (n) {
|
|
721
724
|
var _item$discount5;
|
|
@@ -812,7 +815,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
812
815
|
}));
|
|
813
816
|
}
|
|
814
817
|
for (var i = 0; i < splitCount; i++) {
|
|
815
|
-
var _product$
|
|
818
|
+
var _product$discount_lis10, _originProduct, _selectedDiscount$met;
|
|
816
819
|
// 如果用过折扣卡,也就不存在拆分的情况了,这里直接使用上面计算出来的折扣卡
|
|
817
820
|
var _selectedDiscount = selectedDiscountCard || applicableDiscounts[i];
|
|
818
821
|
// 标记优惠券为已使用
|
|
@@ -824,7 +827,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
824
827
|
// 优先从 origin_total拿,可能会拿不到(比如用户端预约在没有配置 original_price 的情况下)
|
|
825
828
|
var productOriginTotal = product.origin_total || product.total || 0;
|
|
826
829
|
// 如果当前 product 有 discount_list,则先从 origin_total 拿
|
|
827
|
-
if ((_product$
|
|
830
|
+
if ((_product$discount_lis10 = product.discount_list) !== null && _product$discount_lis10 !== void 0 && _product$discount_lis10.length && product.origin_total) {
|
|
828
831
|
productOriginTotal = product.origin_total;
|
|
829
832
|
}
|
|
830
833
|
// 如果originProduct?._productInit?.original_price为 0,product.origin_total可能为空,此时取 product.total
|
|
@@ -308,7 +308,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
308
308
|
date: string;
|
|
309
309
|
status: string;
|
|
310
310
|
week: string;
|
|
311
|
-
weekNum: 0 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -473,7 +473,9 @@ var getMainProductPrice = (product, isDeductTaxAndFee) => {
|
|
|
473
473
|
mainProductPrice = mainProductPrice.add(bundleItemPrice.times(bundleItem.num));
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
|
|
476
|
+
const taxFee = new import_decimal.default((product == null ? void 0 : product.tax_fee) || ((_b = product == null ? void 0 : product.metadata) == null ? void 0 : _b.main_product_attached_bundle_tax_fee) || 0);
|
|
477
|
+
const surchargeFee = new import_decimal.default(((_c = product == null ? void 0 : product.metadata) == null ? void 0 : _c.main_product_attached_bundle_surcharge_fee) || 0);
|
|
478
|
+
const taxAndFeeTotal = taxFee.add(surchargeFee);
|
|
477
479
|
if (isDeductTaxAndFee) {
|
|
478
480
|
mainProductPrice = mainProductPrice.add(taxAndFeeTotal);
|
|
479
481
|
}
|
|
@@ -101,7 +101,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
101
101
|
skip,
|
|
102
102
|
num,
|
|
103
103
|
sort_by: import_constants.SORT_BY,
|
|
104
|
-
with: ["latestWalletDetail.wallet", "contactsInfo"],
|
|
104
|
+
with: ["latestWalletDetail.wallet", "contactsInfo", "formRecord"],
|
|
105
105
|
search_wallet_flag: 1,
|
|
106
106
|
search_wallet_pass_flag: 1,
|
|
107
107
|
...search && { search },
|
|
@@ -583,7 +583,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
583
583
|
this.logInfo("更新订单支付项完成", {
|
|
584
584
|
orderUuid
|
|
585
585
|
});
|
|
586
|
-
this.core.effects.emit(
|
|
586
|
+
this.core.effects.emit(`${this.name}:onPaymentAdded`, {
|
|
587
587
|
orderUuid,
|
|
588
588
|
payment: newPaymentItem
|
|
589
589
|
});
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -422,7 +422,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
422
422
|
return;
|
|
423
423
|
}
|
|
424
424
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
425
|
-
var _a2, _b2, _c2, _d2;
|
|
425
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
426
426
|
const discountType = discount.tag || discount.type;
|
|
427
427
|
if (["good_pass", "discount_card", "product_discount_card"].includes(
|
|
428
428
|
discountType
|
|
@@ -431,14 +431,15 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
431
431
|
return false;
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
if ((Number(product.price) <= 0 || !product.price) &&
|
|
434
|
+
if ((Number(product.price) <= 0 || !product.price) && !((_b2 = product.discount_list) == null ? void 0 : _b2.find((n) => {
|
|
435
|
+
var _a3;
|
|
436
|
+
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
437
|
+
})) && (discount.tag || discount.type) === "good_pass")
|
|
435
438
|
return false;
|
|
436
|
-
if ((Number(product.
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}
|
|
441
|
-
)) && (discount.tag || discount.type) !== "good_pass")
|
|
439
|
+
if ((Number(product.price) <= 0 || !product.price) && !((_c2 = product.discount_list) == null ? void 0 : _c2.find((n) => {
|
|
440
|
+
var _a3;
|
|
441
|
+
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
442
|
+
})) && (discount.tag || discount.type) !== "good_pass")
|
|
442
443
|
return false;
|
|
443
444
|
const targetUsedDiscounts = usedDiscounts.get(discount.id);
|
|
444
445
|
if (targetUsedDiscounts && (discount.tag || discount.type) === "good_pass")
|
|
@@ -452,7 +453,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
452
453
|
const isHolderMatch = this.checkHolderMatch(
|
|
453
454
|
discount,
|
|
454
455
|
{
|
|
455
|
-
holder_id: ((flatItem == null ? void 0 : flatItem.type) === "bundle" ? (
|
|
456
|
+
holder_id: ((flatItem == null ? void 0 : flatItem.type) === "bundle" ? (_d2 = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _d2.holder_id : (_e2 = flatItem == null ? void 0 : flatItem.product) == null ? void 0 : _e2.holder_id) || product.holder_id
|
|
456
457
|
},
|
|
457
458
|
holders
|
|
458
459
|
);
|
|
@@ -308,7 +308,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
308
308
|
date: string;
|
|
309
309
|
status: string;
|
|
310
310
|
week: string;
|
|
311
|
-
weekNum: 0 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -122,12 +122,6 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
122
122
|
throw error;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
/**
|
|
126
|
-
* 初始化外设扫码结果监听
|
|
127
|
-
*/
|
|
128
|
-
initPeripheralsListener() {
|
|
129
|
-
this.scan.initPeripheralsListener();
|
|
130
|
-
}
|
|
131
125
|
/**
|
|
132
126
|
* 获取商品列表(不加载到模块中)
|
|
133
127
|
* @returns 商品列表
|