s-points-pop.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  5. _easycom_su_popup2();
  6. }
  7. const _easycom_su_popup = () => "../../ui/su-popup/su-popup.js";
  8. if (!Math) {
  9. _easycom_su_popup();
  10. }
  11. const _sfc_main = {
  12. __name: "s-points-pop",
  13. props: {
  14. modelValue: {
  15. // 优惠劵列表
  16. type: Object,
  17. default() {
  18. }
  19. },
  20. show: {
  21. type: Boolean,
  22. default: false
  23. },
  24. currentMemberPoints: {
  25. type: Number,
  26. default: 0
  27. },
  28. currentTotalPrice: {
  29. type: Number,
  30. default: 0
  31. },
  32. currentDeliveryPrice: {
  33. type: Number,
  34. default: 0
  35. }
  36. },
  37. emits: ["confirm", "close"],
  38. setup(__props, { emit: __emit }) {
  39. const props = __props;
  40. const emits = __emit;
  41. const state = common_vendor.reactive({
  42. points: 0,
  43. disabled: false
  44. });
  45. const currentOrderMemberPoints = common_vendor.computed(() => {
  46. return parseFloat(props.currentMemberPoints);
  47. });
  48. const currentOrderTotalPrice = common_vendor.computed(() => {
  49. return parseFloat(props.currentTotalPrice);
  50. });
  51. const currentOrderDeliveryPrice = common_vendor.computed(() => {
  52. return parseFloat(props.currentDeliveryPrice);
  53. });
  54. const canUesPoint = common_vendor.computed(() => {
  55. if (!currentOrderTotalPrice.value)
  56. return currentOrderTotalPrice.value;
  57. return (currentOrderTotalPrice.value - 0.01 - currentOrderDeliveryPrice.value).toFixed(2);
  58. });
  59. common_vendor.watchEffect(() => {
  60. if (state.points > currentOrderMemberPoints.value) {
  61. common_vendor.nextTick$1(() => {
  62. state.points = currentOrderMemberPoints.value;
  63. });
  64. }
  65. if (state.points > canUesPoint.value) {
  66. common_vendor.nextTick$1(() => {
  67. state.points = canUesPoint.value;
  68. });
  69. }
  70. if (canUesPoint.value == 0 || canUesPoint.value < 0) {
  71. state.disabled = true;
  72. }
  73. if (canUesPoint.value > 0) {
  74. state.disabled = false;
  75. }
  76. });
  77. const onConfirm = () => {
  78. emits("confirm", state.points);
  79. };
  80. return (_ctx, _cache) => {
  81. return {
  82. a: state.disabled,
  83. b: state.points,
  84. c: common_vendor.o(common_vendor.m(($event) => state.points = $event.detail.value, {
  85. number: true
  86. })),
  87. d: common_vendor.t(__props.currentMemberPoints),
  88. e: common_vendor.t(currentOrderTotalPrice.value),
  89. f: common_vendor.t(canUesPoint.value),
  90. g: common_vendor.o(($event) => {
  91. state.points = 0;
  92. emits("confirm", state.points);
  93. }),
  94. h: common_vendor.o(onConfirm),
  95. i: common_vendor.o(($event) => emits("close")),
  96. j: common_vendor.p({
  97. show: __props.show,
  98. type: "bottom",
  99. round: "10",
  100. showClose: true,
  101. backgroundColor: "#ffffff"
  102. })
  103. };
  104. };
  105. }
  106. };
  107. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-8dbeaa2a"], ["__file", "D:/zx/mall-front-app/sheep/components/s-points-pop/s-points-pop.vue"]]);
  108. wx.createComponent(Component);