uploadReceptPopop.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. common_vendor.index.showToast({
  38. title: "请先选择优惠力度",
  39. icon: "error"
  40. });
  41. return;
  42. }
  43. const params = {
  44. openid,
  45. marketingActivityId: props.id,
  46. discountId: discountId.value
  47. };
  48. services_ams.validate(params).then((res) => {
  49. if (res.valid) {
  50. common_vendor.index.navigateTo({
  51. url: `/pagesOne/winner/uploadImage?discountId=${discountId.value}&discountLevel=${discountLevel.value}`
  52. });
  53. return;
  54. }
  55. common_vendor.index.showToast({
  56. title: "该活动力度次数您已经用完啦,换一个活动力度参与吧",
  57. icon: "none"
  58. });
  59. return;
  60. }).catch((err) => {
  61. common_vendor.index.showToast({
  62. title: err.msg,
  63. icon: "none"
  64. });
  65. });
  66. emit("update:show", false);
  67. };
  68. const discountId = common_vendor.ref("");
  69. const discountLevel = common_vendor.ref("");
  70. const radioChange = (e) => {
  71. discountId.value = e.detail.value;
  72. const obj = props.list.filter((item) => item.id === e.detail.value)[0];
  73. discountLevel.value = `满${obj.thresholdAmount}返${obj.cashbackAmount}`;
  74. };
  75. const { handleClose } = hooks_useDraw.useDraw(props, emit);
  76. return (_ctx, _cache) => {
  77. return {
  78. a: common_vendor.f(props.list, (item, k0, i0) => {
  79. return {
  80. a: common_vendor.t(item.thresholdAmount),
  81. b: common_vendor.t(item.cashbackAmount),
  82. c: item.id,
  83. d: item.checked,
  84. e: item.id,
  85. f: common_vendor.n(item.checked ? "active" : "static")
  86. };
  87. }),
  88. b: common_vendor.unref(pagesOne_winner_utils_source.imgObj).icon1,
  89. c: common_vendor.o(radioChange),
  90. d: common_vendor.o(toUploadImage),
  91. e: common_vendor.p({
  92. height: "16rpx",
  93. ["bg-color"]: "#F7F8F9"
  94. }),
  95. f: common_vendor.o(
  96. //@ts-ignore
  97. (...args) => common_vendor.unref(handleClose) && common_vendor.unref(handleClose)(...args)
  98. ),
  99. g: common_vendor.o(common_vendor.unref(handleClose)),
  100. h: common_vendor.o(($event) => props.show = $event),
  101. i: common_vendor.p({
  102. position: "bottom",
  103. ["safe-area-inset-bottom"]: true,
  104. ["custom-style"]: "max-height: 922rpx;border-radius: 40rpx 40rpx 0 0;",
  105. modelValue: props.show
  106. })
  107. };
  108. };
  109. }
  110. });
  111. wx.createComponent(_sfc_main);