recharge.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const sheep_index = require("../../sheep/index.js");
  4. const sheep_hooks_useGoods = require("../../sheep/hooks/useGoods.js");
  5. const sheep_api_pay_wallet = require("../../sheep/api/pay/wallet.js");
  6. require("../../sheep/api/index.js");
  7. require("../../sheep/api/distri/score.js");
  8. require("../../sheep/request/index.js");
  9. require("../../sheep/config/index.js");
  10. require("../../sheep/store/index.js");
  11. require("../../sheep/store/app.js");
  12. require("../../sheep/api/promotion/diy.js");
  13. require("../../sheep/platform/index.js");
  14. require("../../sheep/platform/provider/wechat/index.js");
  15. require("../../sheep/platform/provider/wechat/miniProgram.js");
  16. require("../../sheep/api/member/auth.js");
  17. require("../../sheep/api/member/social.js");
  18. require("../../sheep/api/member/user.js");
  19. require("../../sheep/platform/provider/apple/index.js");
  20. require("../../sheep/platform/share.js");
  21. require("../../sheep/router/index.js");
  22. require("../../sheep/hooks/useModal.js");
  23. require("../../sheep/helper/index.js");
  24. require("../../sheep/helper/test.js");
  25. require("../../sheep/helper/digit.js");
  26. require("../../sheep/api/member/signin.js");
  27. require("../../sheep/helper/throttle.js");
  28. require("../../sheep/url/index.js");
  29. require("../../sheep/platform/pay.js");
  30. require("../../sheep/api/pay/order.js");
  31. require("../../sheep/store/user.js");
  32. require("../../sheep/store/cart.js");
  33. require("../../sheep/api/trade/cart.js");
  34. require("../../sheep/api/trade/order.js");
  35. require("../../sheep/api/promotion/coupon.js");
  36. require("../../sheep/store/sys.js");
  37. require("../../sheep/store/modal.js");
  38. require("../../sheep/api/distri/share.js");
  39. require("../../sheep/api/distri/team.js");
  40. require("../../sheep/api/infra/file.js");
  41. require("../../sheep/api/member/address.js");
  42. require("../../sheep/api/member/point.js");
  43. require("../../sheep/api/migration/app.js");
  44. require("../../sheep/api/migration/chat.js");
  45. require("../../sheep/api/migration/index.js");
  46. require("../../sheep/api/migration/third.js");
  47. require("../../sheep/api/pay/channel.js");
  48. require("../../sheep/api/product/category.js");
  49. require("../../sheep/api/product/comment.js");
  50. require("../../sheep/api/product/favorite.js");
  51. require("../../sheep/api/product/history.js");
  52. require("../../sheep/api/product/spu.js");
  53. require("../../sheep/api/promotion/activity.js");
  54. require("../../sheep/api/promotion/article.js");
  55. require("../../sheep/api/promotion/bargain.js");
  56. require("../../sheep/api/promotion/combination.js");
  57. require("../../sheep/api/promotion/rewardActivity.js");
  58. require("../../sheep/api/promotion/seckill.js");
  59. require("../../sheep/api/system/area.js");
  60. require("../../sheep/api/system/voice.js");
  61. require("../../sheep/api/trade/afterSale.js");
  62. require("../../sheep/api/trade/brokerage.js");
  63. require("../../sheep/api/trade/config.js");
  64. require("../../sheep/api/trade/delivery.js");
  65. require("../../sheep/config/zIndex.js");
  66. require("../../sheep/util/index.js");
  67. if (!Array) {
  68. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  69. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  70. (_easycom_uni_easyinput2 + _easycom_s_layout2)();
  71. }
  72. const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
  73. const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";
  74. if (!Math) {
  75. (_easycom_uni_easyinput + _easycom_s_layout)();
  76. }
  77. const _sfc_main = {
  78. __name: "recharge",
  79. setup(__props) {
  80. common_vendor.useCssVars((_ctx) => ({
  81. "dd851cb6": common_vendor.unref(headerBg)
  82. }));
  83. const userWallet = common_vendor.computed(() => sheep_index.sheep.$store("user").userWallet);
  84. const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2;
  85. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/user/withdraw_bg.png");
  86. const state = common_vendor.reactive({
  87. recharge_money: "",
  88. // 输入的充值金额
  89. packageList: []
  90. });
  91. function onCard(e) {
  92. state.recharge_money = sheep_hooks_useGoods.fen2yuan(e);
  93. }
  94. async function getRechargeTabs() {
  95. const { code, data } = await sheep_api_pay_wallet.PayWalletApi.getWalletRechargePackageList();
  96. if (code !== 0) {
  97. return;
  98. }
  99. state.packageList = data;
  100. }
  101. async function onConfirm() {
  102. var _a;
  103. const { code, data } = await sheep_api_pay_wallet.PayWalletApi.createWalletRecharge({
  104. packageId: (_a = state.packageList.find((item) => sheep_hooks_useGoods.fen2yuan(item.payPrice) === state.recharge_money)) == null ? void 0 : _a.id,
  105. payPrice: state.recharge_money * 100
  106. });
  107. if (code !== 0) {
  108. return;
  109. }
  110. sheep_index.sheep.$platform.useProvider("wechat").subscribeMessage("money_change");
  111. sheep_index.sheep.$router.go("/pages/pay/index", {
  112. id: data.payOrderId,
  113. orderType: "recharge"
  114. });
  115. }
  116. common_vendor.onLoad(() => {
  117. getRechargeTabs();
  118. });
  119. return (_ctx, _cache) => {
  120. return {
  121. a: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(userWallet.value.balance)),
  122. b: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/pay/recharge-log")),
  123. c: common_vendor.s({
  124. marginTop: "-" + Number(statusBarHeight + 88) + "rpx",
  125. paddingTop: Number(statusBarHeight + 108) + "rpx"
  126. }),
  127. d: common_vendor.o(($event) => state.recharge_money = $event),
  128. e: common_vendor.p({
  129. type: "digit",
  130. placeholder: "请输入充值金额",
  131. inputBorder: false,
  132. modelValue: state.recharge_money
  133. }),
  134. f: common_vendor.f(state.packageList, (item, k0, i0) => {
  135. return common_vendor.e({
  136. a: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.payPrice)),
  137. b: item.bonusPrice
  138. }, item.bonusPrice ? {
  139. c: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.bonusPrice))
  140. } : {}, {
  141. d: item.money,
  142. e: common_vendor.n({
  143. "btn-active": state.recharge_money === common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.payPrice)
  144. }),
  145. f: common_vendor.o(($event) => onCard(item.payPrice), item.money)
  146. });
  147. }),
  148. g: common_vendor.o(onConfirm),
  149. h: common_vendor.s(_ctx.__cssVars()),
  150. i: common_vendor.p({
  151. title: "充值",
  152. navbar: "inner"
  153. })
  154. };
  155. };
  156. }
  157. };
  158. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b0187d83"], ["__file", "D:/zx/mall-front-app/pages/pay/recharge.vue"]]);
  159. wx.createPage(MiniProgramPage);