sign.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const sheep_index = require("../../sheep/index.js");
  4. const sheep_api_member_signin = require("../../sheep/api/member/signin.js");
  5. require("../../sheep/url/index.js");
  6. require("../../sheep/store/index.js");
  7. require("../../sheep/store/app.js");
  8. require("../../sheep/api/promotion/diy.js");
  9. require("../../sheep/request/index.js");
  10. require("../../sheep/config/index.js");
  11. require("../../sheep/platform/index.js");
  12. require("../../sheep/platform/provider/wechat/index.js");
  13. require("../../sheep/platform/provider/wechat/miniProgram.js");
  14. require("../../sheep/api/member/auth.js");
  15. require("../../sheep/api/member/social.js");
  16. require("../../sheep/api/member/user.js");
  17. require("../../sheep/platform/provider/apple/index.js");
  18. require("../../sheep/platform/share.js");
  19. require("../../sheep/router/index.js");
  20. require("../../sheep/hooks/useModal.js");
  21. require("../../sheep/helper/index.js");
  22. require("../../sheep/helper/test.js");
  23. require("../../sheep/helper/digit.js");
  24. require("../../sheep/helper/throttle.js");
  25. require("../../sheep/platform/pay.js");
  26. require("../../sheep/api/pay/order.js");
  27. require("../../sheep/store/user.js");
  28. require("../../sheep/store/cart.js");
  29. require("../../sheep/api/trade/cart.js");
  30. require("../../sheep/api/pay/wallet.js");
  31. require("../../sheep/api/trade/order.js");
  32. require("../../sheep/api/promotion/coupon.js");
  33. require("../../sheep/store/sys.js");
  34. require("../../sheep/store/modal.js");
  35. require("../../sheep/config/zIndex.js");
  36. if (!Array) {
  37. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  38. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  39. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  40. (_easycom_s_empty2 + _easycom_su_popup2 + _easycom_s_layout2)();
  41. }
  42. const _easycom_s_empty = () => "../../sheep/components/s-empty/s-empty.js";
  43. const _easycom_su_popup = () => "../../sheep/ui/su-popup/su-popup.js";
  44. const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";
  45. if (!Math) {
  46. (_easycom_s_empty + _easycom_su_popup + _easycom_s_layout)();
  47. }
  48. const _sfc_main = {
  49. __name: "sign",
  50. setup(__props) {
  51. common_vendor.useCssVars((_ctx) => ({
  52. "19707c8c": common_vendor.unref(headerBg)
  53. }));
  54. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/app/sign.png");
  55. const state = common_vendor.reactive({
  56. loading: true,
  57. signInfo: {},
  58. // 签到信息
  59. signConfigList: [],
  60. // 签到配置列表
  61. maxDay: 0,
  62. // 最大的签到天数
  63. showModel: false,
  64. // 签到弹框
  65. signResult: {}
  66. // 签到结果
  67. });
  68. async function onSign() {
  69. const { code, data } = await sheep_api_member_signin.SignInApi.createSignInRecord();
  70. if (code !== 0) {
  71. return;
  72. }
  73. state.showModel = true;
  74. state.signResult = data;
  75. await getSignInfo();
  76. }
  77. function onConfirm() {
  78. state.showModel = false;
  79. }
  80. async function getSignInfo() {
  81. const { code, data } = await sheep_api_member_signin.SignInApi.getSignInRecordSummary();
  82. if (code !== 0) {
  83. return;
  84. }
  85. state.signInfo = data;
  86. state.loading = false;
  87. }
  88. async function getSignConfigList() {
  89. const { code, data } = await sheep_api_member_signin.SignInApi.getSignInConfigList();
  90. if (code !== 0) {
  91. return;
  92. }
  93. state.signConfigList = data;
  94. if (data.length > 0) {
  95. state.maxDay = data[data.length - 1].day;
  96. }
  97. }
  98. common_vendor.onReady(() => {
  99. getSignInfo();
  100. getSignConfigList();
  101. });
  102. return (_ctx, _cache) => {
  103. return common_vendor.e({
  104. a: state.loading
  105. }, state.loading ? {
  106. b: common_vendor.p({
  107. icon: "/static/data-empty.png",
  108. text: "签到活动还未开始"
  109. })
  110. } : {}, {
  111. c: state.loading
  112. }, state.loading ? {} : !state.loading ? common_vendor.e({
  113. e: common_vendor.t(state.signInfo.continuousDay),
  114. f: common_vendor.f(state.signConfigList, (item, index, i0) => {
  115. return {
  116. a: common_vendor.t(item.day),
  117. b: common_vendor.n((index === state.signConfigList.length ? "reward" : "") + " " + (state.signInfo.continuousDay >= item.day ? "rewardTxt" : "")),
  118. c: common_vendor.n((index + 1 === state.signConfigList.length ? "reward" : "") + " " + (state.signInfo.continuousDay >= item.day ? "venusSelect" : "")),
  119. d: common_vendor.t(item.point),
  120. e: common_vendor.n(state.signInfo.continuousDay >= item.day ? "on" : ""),
  121. f: index
  122. };
  123. }),
  124. g: !state.signInfo.todaySignIn
  125. }, !state.signInfo.todaySignIn ? {
  126. h: common_vendor.o(onSign)
  127. } : {}, {
  128. i: common_vendor.t(state.signInfo.totalDay),
  129. j: common_vendor.t(state.maxDay)
  130. }) : {}, {
  131. d: !state.loading,
  132. k: state.signResult.point
  133. }, state.signResult.point ? {
  134. l: common_vendor.t(state.signResult.point)
  135. } : {}, {
  136. m: state.signResult.experience
  137. }, state.signResult.experience ? {
  138. n: common_vendor.t(state.signResult.experience)
  139. } : {}, {
  140. o: common_vendor.t(state.signResult.day),
  141. p: common_vendor.o(onConfirm),
  142. q: common_vendor.p({
  143. show: state.showModel,
  144. type: "center",
  145. round: "10",
  146. isMaskClick: false
  147. }),
  148. r: common_vendor.s(_ctx.__cssVars()),
  149. s: common_vendor.p({
  150. title: "签到有礼"
  151. })
  152. });
  153. };
  154. }
  155. };
  156. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-964858d2"], ["__file", "E:/GAOHP_2023/mall/newfeifan-front/yudao-mall-uniapp/mall-newfeifan-zx-app/pages/app/sign.vue"]]);
  157. wx.createPage(MiniProgramPage);