index.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const utils_system = require("../../utils/system.js");
  4. const pagesOne_winner_utils_source = require("./utils/source.js");
  5. const services_ams = require("../../services/ams.js");
  6. if (!Array) {
  7. const _easycom_wd_icon2 = common_vendor.resolveComponent("wd-icon");
  8. const _easycom_wd_gap2 = common_vendor.resolveComponent("wd-gap");
  9. (_easycom_wd_icon2 + _easycom_wd_gap2)();
  10. }
  11. const _easycom_wd_icon = () => "../../node-modules/wot-design-uni/components/wd-icon/wd-icon.js";
  12. const _easycom_wd_gap = () => "../../node-modules/wot-design-uni/components/wd-gap/wd-gap.js";
  13. if (!Math) {
  14. (_easycom_wd_icon + _easycom_wd_gap + PhotoExamplePopup + UploadReceptPopop + WinRecordPopup + UploadRecordPopup + ActivityDescPopup)();
  15. }
  16. const PhotoExamplePopup = () => "./components/photoExamplePopup.js";
  17. const UploadReceptPopop = () => "./components/uploadReceptPopop.js";
  18. const WinRecordPopup = () => "./components/winRecordPopup.js";
  19. const UploadRecordPopup = () => "./components/uploadRecordPopup.js";
  20. const ActivityDescPopup = () => "./components/activityDescPopup.js";
  21. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  22. __name: "index",
  23. setup(__props) {
  24. let showExample = common_vendor.ref(false);
  25. let showUpload = common_vendor.ref(false);
  26. let showWiner = common_vendor.ref(false);
  27. let showRecord = common_vendor.ref(false);
  28. let showDesc = common_vendor.ref(false);
  29. const appid = common_vendor.index.getStorageSync("appid");
  30. const backImage = common_vendor.ref("");
  31. let aData = common_vendor.reactive({ discounts: [] });
  32. let list = common_vendor.ref([]);
  33. const openid = common_vendor.index.getStorageSync("openid");
  34. common_vendor.computed(() => {
  35. return aData.authCheck.includes("2") ? true : false;
  36. });
  37. const getList = () => {
  38. services_ams.getActivity(appid).then((res) => {
  39. aData = res.data[0] || {};
  40. aData.authCheck = aData.authCheck.split(",");
  41. list.value = aData.discounts.map((item) => {
  42. return {
  43. ...item,
  44. checked: false
  45. };
  46. });
  47. common_vendor.index.setStorageSync("activityData", JSON.stringify(aData));
  48. backImage.value = res.data[0].activityImage;
  49. aData.description = aData.description.split("\n");
  50. }).catch((err) => {
  51. console.log(err);
  52. });
  53. };
  54. const rewardData = common_vendor.ref([]);
  55. const getRewardList = () => {
  56. console.log("openid", openid);
  57. services_ams.rewardList({ openid, marketingActivityId: aData.id }).then((res) => {
  58. rewardData.value = res.rows;
  59. });
  60. };
  61. const showUploadRecord = () => {
  62. getRewardList();
  63. showRecord.value = true;
  64. };
  65. const winnerData = common_vendor.ref([]);
  66. const getWinnerList = () => {
  67. services_ams.auditSuccessList({ openid, marketingActivityId: aData.id }).then(
  68. (res) => {
  69. winnerData.value = res.rows;
  70. }
  71. );
  72. };
  73. const showWinerRecord = () => {
  74. getWinnerList();
  75. showWiner.value = true;
  76. };
  77. const onBack = () => {
  78. common_vendor.index.navigateBack({ delta: 1 });
  79. };
  80. const handledUpload = () => {
  81. showUpload.value = true;
  82. };
  83. common_vendor.onShow(() => {
  84. getList();
  85. });
  86. common_vendor.ref(0);
  87. common_vendor.onLoad(() => {
  88. });
  89. return (_ctx, _cache) => {
  90. return {
  91. a: common_vendor.unref(utils_system.getStatusBarHeight)() + "px",
  92. b: common_vendor.o(onBack),
  93. c: common_vendor.p({
  94. name: "thin-arrow-left",
  95. size: "44rpx",
  96. color: "#000"
  97. }),
  98. d: common_vendor.unref(utils_system.getNavBarPaddingTop)() + "px",
  99. e: backImage.value,
  100. f: common_vendor.o(($event) => common_vendor.isRef(showDesc) ? showDesc.value = true : showDesc = true),
  101. g: common_vendor.unref(pagesOne_winner_utils_source.imgObj).rule,
  102. h: common_vendor.unref(pagesOne_winner_utils_source.imgObj).record,
  103. i: common_vendor.o(showWinerRecord),
  104. j: common_vendor.unref(pagesOne_winner_utils_source.imgObj).photo,
  105. k: common_vendor.o(($event) => common_vendor.isRef(showExample) ? showExample.value = true : showExample = true),
  106. l: common_vendor.unref(pagesOne_winner_utils_source.imgObj).book,
  107. m: common_vendor.o(showUploadRecord),
  108. n: common_vendor.unref(pagesOne_winner_utils_source.gifObj).pointer,
  109. o: common_vendor.o(handledUpload),
  110. p: common_vendor.t(common_vendor.unref(aData).startTime),
  111. q: common_vendor.t(common_vendor.unref(aData).endTime),
  112. r: common_vendor.f(common_vendor.unref(list), (item, k0, i0) => {
  113. return {
  114. a: common_vendor.t(item.cashbackAmount),
  115. b: common_vendor.t(item.thresholdAmount),
  116. c: common_vendor.t(item.cashbackAmount),
  117. d: item.id
  118. };
  119. }),
  120. s: common_vendor.p({
  121. ["bg-color"]: "transparent"
  122. }),
  123. t: common_vendor.o(($event) => common_vendor.isRef(showExample) ? showExample.value = $event : showExample = $event),
  124. v: common_vendor.p({
  125. show: common_vendor.unref(showExample)
  126. }),
  127. w: common_vendor.unref(aData).id,
  128. x: common_vendor.o(($event) => common_vendor.isRef(showUpload) ? showUpload.value = $event : showUpload = $event),
  129. y: common_vendor.p({
  130. list: common_vendor.unref(list),
  131. id: common_vendor.unref(aData).id,
  132. show: common_vendor.unref(showUpload)
  133. }),
  134. z: common_vendor.o(($event) => common_vendor.isRef(showWiner) ? showWiner.value = $event : showWiner = $event),
  135. A: common_vendor.p({
  136. list: winnerData.value,
  137. show: common_vendor.unref(showWiner)
  138. }),
  139. B: common_vendor.o(($event) => common_vendor.isRef(showRecord) ? showRecord.value = $event : showRecord = $event),
  140. C: common_vendor.p({
  141. list: rewardData.value,
  142. show: common_vendor.unref(showRecord)
  143. }),
  144. D: common_vendor.o(($event) => common_vendor.isRef(showDesc) ? showDesc.value = $event : showDesc = $event),
  145. E: common_vendor.p({
  146. description: common_vendor.unref(aData).description,
  147. show: common_vendor.unref(showDesc)
  148. })
  149. };
  150. };
  151. }
  152. });
  153. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3457e999"]]);
  154. wx.createPage(MiniProgramPage);