uploadReceptPopop.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const pagesOne_winner_utils_source = require("../utils/source.js");
  4. const hooks_useDraw = require("../../../hooks/useDraw.js");
  5. const services_ams = require("../../../services/ams.js");
  6. if (!Array) {
  7. const _easycom_wd_gap2 = common_vendor.resolveComponent("wd-gap");
  8. const _easycom_wd_popup2 = common_vendor.resolveComponent("wd-popup");
  9. (_easycom_wd_gap2 + _easycom_wd_popup2)();
  10. }
  11. const _easycom_wd_gap = () => "../../../node-modules/wot-design-uni/components/wd-gap/wd-gap.js";
  12. const _easycom_wd_popup = () => "../../../node-modules/wot-design-uni/components/wd-popup/wd-popup.js";
  13. if (!Math) {
  14. (_easycom_wd_gap + _easycom_wd_popup)();
  15. }
  16. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  17. __name: "uploadReceptPopop",
  18. props: {
  19. show: {
  20. type: Boolean,
  21. default: false
  22. },
  23. id: {
  24. type: String,
  25. defalut: ""
  26. },
  27. list: Array
  28. },
  29. emits: ["update:show"],
  30. setup(__props, { emit: __emit }) {
  31. const props = __props;
  32. const openid = common_vendor.index.getStorageSync("openid");
  33. const emit = __emit;
  34. common_vendor.ref("1");
  35. const toUploadImage = (type) => {
  36. if (!discountId.value)
  37. return common_vendor.index.showToast({
  38. title: "请先选择优惠力度",
  39. icon: "none"
  40. });
  41. const params = {
  42. openid,
  43. marketingActivityId: props.id,
  44. discountId: discountId.value
  45. };
  46. services_ams.validate(params).then((res) => {
  47. if (res.valid) {
  48. common_vendor.index.navigateTo({
  49. url: `/pagesOne/winner/uploadImage?discountId=${discountId.value}&discountLevel=${discountLevel.value}`
  50. });
  51. return;
  52. }
  53. common_vendor.index.showToast({
  54. title: "该活动力度次数您已经用完啦,换一个活动力度参与吧",
  55. icon: "none"
  56. });
  57. return;
  58. }).catch((err) => {
  59. common_vendor.index.showToast({
  60. title: err.msg,
  61. icon: "none"
  62. });
  63. });
  64. emit("update:show", false);
  65. };
  66. const discountId = common_vendor.ref("");
  67. const discountLevel = common_vendor.ref("");
  68. const radioChange = (e) => {
  69. discountId.value = e.detail.value;
  70. const obj = props.list.filter((item) => item.id === e.detail.value)[0];
  71. discountLevel.value = `满${obj.thresholdAmount}返${obj.cashbackAmount}`;
  72. };
  73. const { handleClose } = hooks_useDraw.useDraw(props, emit);
  74. return (_ctx, _cache) => {
  75. return {
  76. a: common_vendor.f(props.list, (item, k0, i0) => {
  77. return {
  78. a: common_vendor.t(item.thresholdAmount),
  79. b: common_vendor.t(item.cashbackAmount),
  80. c: item.id,
  81. d: item.checked,
  82. e: item.id,
  83. f: common_vendor.n(item.checked ? "active" : "static")
  84. };
  85. }),
  86. b: common_vendor.unref(pagesOne_winner_utils_source.imgObj).icon1,
  87. c: common_vendor.o(radioChange),
  88. d: common_vendor.o(toUploadImage),
  89. e: common_vendor.p({
  90. height: "16rpx",
  91. ["bg-color"]: "#F7F8F9"
  92. }),
  93. f: common_vendor.o(
  94. //@ts-ignore
  95. (...args) => common_vendor.unref(handleClose) && common_vendor.unref(handleClose)(...args)
  96. ),
  97. g: common_vendor.o(common_vendor.unref(handleClose)),
  98. h: common_vendor.o(($event) => props.show = $event),
  99. i: common_vendor.p({
  100. position: "bottom",
  101. ["safe-area-inset-bottom"]: true,
  102. ["custom-style"]: "max-height: 922rpx;border-radius: 40rpx 40rpx 0 0;",
  103. modelValue: props.show
  104. })
  105. };
  106. };
  107. }
  108. });
  109. wx.createComponent(_sfc_main);