acdr-ui/dist/dev/mp-weixin/modules/mall/pay/recharge.js.map

1 line
8.5 KiB
Plaintext
Raw Normal View History

2024-09-19 07:20:14 +08:00
{"version":3,"file":"recharge.js","sources":["../../../../../../src/modules/mall/pay/recharge.vue","../../../../../../uniPage:/bW9kdWxlc1xtYWxsXHBheVxyZWNoYXJnZS52dWU"],"sourcesContent":["<!-- 充值界面 -->\r\n<template>\r\n <s-layout title=\"充值\" class=\"withdraw-wrap\" navbar=\"inner\">\r\n <view\r\n class=\"wallet-num-box ss-flex ss-col-center ss-row-between\"\r\n :style=\"[\r\n {\r\n marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',\r\n paddingTop: Number(statusBarHeight + 108) + 'rpx',\r\n },\r\n ]\"\r\n >\r\n <view class=\"\">\r\n <view class=\"num-title\">当前余额(元)</view>\r\n <view class=\"wallet-num\">{{ fen2yuan(userWallet.balance) }}</view>\r\n </view>\r\n <button\r\n class=\"ss-reset-button log-btn\"\r\n @tap=\"sheep.$router.go('/modules/mall/pay/recharge-log')\"\r\n >\r\n 充值记录\r\n </button>\r\n </view>\r\n <view class=\"recharge-box\">\r\n <view class=\"recharge-card-box\">\r\n <view class=\"input-label ss-m-b-50\">充值金额</view>\r\n <view class=\"input-box ss-flex border-bottom ss-p-b-20\">\r\n <view class=\"unit\">¥</view>\r\n <uni-easyinput\r\n v-model=\"state.recharge_money\"\r\n type=\"digit\"\r\n placeholder=\"请输入充值金额\"\r\n :inputBorder=\"false\"\r\n />\r\n </view>\r\n <view class=\"face-value-box ss-flex ss-flex-wrap ss-m-y-40\">\r\n <button\r\n class=\"ss-reset-button face-value-btn\"\r\n v-for=\"item in state.packageList\"\r\n :key=\"item.money\"\r\n :class=\"[{ 'btn-active': state.recharge_money === fen2yuan(item.payPrice) }]\"\r\n @tap=\"onCard(item.payPrice)\"\r\n >\r\n <text class=\"face-value-title\">{{ fen2yuan(item.payPrice) }}</text>\r\n <view v-if=\"item.bonusPrice\" class=\"face-value-tag\">\r\n 送 {{ fen2yuan(item.bonusPrice) }} 元\r\n </view>\r\n </button>\r\n </view>\r\n <button\r\n class=\"ss-reset-button save-btn ui-BG-Main-Gradient ss-m-t-60 ui-Shadow-Main\"\r\n @tap=\"onConfirm\"\r\n >\r\n 确认充值\r\n </button>\r\n </view>\r\n </view>\r\n </s-layout>\r\n</template>\r\n\r\n<script setup>\r\nimport { computed, reactive } from 'vue'\r\nimport sheep from '@/sheep'\r\nimport { onLoad } from '@dcloudio/uni-app'\r\nimport { fen2yuan } from '@/sheep/hooks/useGoods'\r\nimport PayWalletApi from '@/sheep/api/pay/wallet'\r\nimport { WxaSubscribeTemplate } from '@/sheep/util/const'\r\n\r\nconst userWallet = computed(() => sheep.$store('user').userWallet)\r\nconst statusBarHeight = sheep.$platform.device.statusBarHeight * 2\r\nconst headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png')\r\n\r\nconst state = reactive({\r\n recharge_money: '', // 输入的充值金额\r\n packageList: [],\r\n})\r\n\r\n// 点击卡片,选择充值金额\r\nfunction onCard(e) {\r\n state.recharge_money = fen2yuan(e)\r\n}\r\n\r\n// 获得钱包充值套餐列表\r\nasync function getRechargeTabs() {\r\n const { code, data } = await PayWalletApi.getWalletRechargePackageList()\r\n if (code !== 0) {\r\n return\r\n }\r\n state.packageList = data\r\n}\r\n\r\n// 发起支付\r\nasync function onConfirm() {\r\n const { code, data } = await PayWalletApi.createWalletRecharge({\r\n packageId: state.packageList.find((item) => fen2yuan(item.payPrice) === state.recharge_money)\r\n ?.id,\r\n payPrice: state.recharge_money * 100,\r\n })\r\n if (code !== 0) {\r\n return\r\n }\r\n // #ifdef MP\r\n sheep.$platform\r\n .useProvider('wechat')\r\n .subscribeMessage(WxaSubscribeTemplate.PAY_WALLET_RECHARGER_SUCCESS)\r\n // #endif\r\n sheep.$router.go('/modules/mall/pay/index', {\r\n id: data.payOrderId,\r\n orderType: 'recharge',\r\n })\r\n}\r\n\r\nonLoad(() => {\r\n getRechargeTabs()\r\n})\r\n</script>\r\n\r\n<st