feat:小程序支付

This commit is contained in:
dzc committed 2026-03-14 18:24:08 +08:00
1 parent a50228ff08
commit d87d1b5f8d
2 files changed
+22 -34

No files matched your search

+4 -4
View File
@@ -148,13 +148,13 @@ const doTransferMoney = (v: any) => {
:key="i" @tap="router.jump('/pages/wallet/detail', { id: v.id })">
<view class="flex-col">
<view class="flex-row items-center justify-between">
<view class="flex-row-center">
<text v-if="v.cardNumber" class="second-text-28">卡号: {{ v.cardNumber }}</text>
<view v-if="v.cardNumber" class="flex-row-center">
<text class="second-text-28">卡号: {{ v.cardNumber }}</text>
</view>
<view class="second-text-50">
<text v-if="v.cardNumber" class="iconfont icon-fuzhi"
@tap.stop="hooks.useCopy(v.cardNumber)" />
<text v-if="v.walletTypeUniqueCode != '2'" class="m-l-20rpx iconfont icon-erweima"
<text v-if="v.walletTypeUniqueCode == '1'" class="m-l-20rpx iconfont icon-erweima"
@tap.stop="doPreviewQrCode(v)" />
</view>
</view>
@@ -182,7 +182,7 @@ const doTransferMoney = (v: any) => {
@tap.stop="openFreezeDialog(v)">
申请冻结
</view>
<view v-if="false && v.walletTypeUniqueCode == 2" class="botder_btn"
<view v-if="v.walletTypeUniqueCode == 3" class="botder_btn"
@tap.stop="router.jump('/pages/wallet/recharge', { id: v.id })">
去充值
</view>
+18 -30
View File
@@ -9,14 +9,14 @@ import { walletApi, payApi } from "@@/api"
const data = {
payType: [
// { text: "模拟支付", disabled: false, type: "0", value: "mock" },
{ text: "微信支付", disabled: true, type: "1", value: "wx_pub" },
{ text: "支付宝支付", disabled: true, type: "2", value: "alipay_wap" },
{ text: "微信支付", disabled: false, type: "1", value: "wx_pub" },
// { text: "支付宝支付", disabled: false, type: "2", value: "alipay_wap" },
],
}
const state = reactive<any>({
walletId: null,
currentPayType: null,
currentPayType: "1",
currentRecharge: 0,
userInfo: {},
detail: {},
@@ -65,21 +65,15 @@ const doPay = async () => {
const targetRecharge = state.rechargeList[state.currentRecharge]
const targetPayType = data.payType[state.currentPayType]
if (isEmpty(targetRecharge)) throw new Error()
const _pa = {
payPrice: targetRecharge.payPrice,
walletId: state.walletId,
packageId: targetRecharge.id,
}
const { data: createData, code: createCode }: any = await walletApi.recharge(_pa)
console.log(createCode, "createCode")
if (createCode != 0) throw new Error()
const _payPa = {
id: createData.payOrderId,
walletId: state.walletId,
channelCode: targetPayType.value,
channelExtras: {},
}
// const _pa = {
// payPrice: targetRecharge.payPrice,
// walletId: state.walletId,
// packageId: targetRecharge.id,
// }
// const { data: createData, code: createCode }: any = await walletApi.recharge(_pa)
// if (createCode != 0) throw new Error()
getDetail()
uni.hideLoading()
uni.showToast({ title: "充值成功", icon: "none" })
@@ -110,26 +104,20 @@ const doPay = async () => {
<view class="prefix_title m-t-35rpx">充值</view>
<view class="recharge p-30rpx bg-white rounded-20rpx m-t-20rpx shadow-main">
<view
:class="[state.currentRecharge == i ? 'recharge_item_active' : '']"
class="recharge_item"
v-for="(v, i) in state.rechargeList"
:key="i"
@tap="state.currentRecharge = i"
>
<view :class="[state.currentRecharge == i ? 'recharge_item_active' : '']" class="recharge_item"
v-for="(v, i) in state.rechargeList" :key="i" @tap="state.currentRecharge = i">
<text class="sub-text-30 text-center">¥{{ hooks.useMoney(v.payPrice) }}</text>
</view>
</view>
<view class="prefix_title m-t-35rpx">支付</view>
<view class="p-30rpx p-b-40rpx bg-white rounded-20rpx m-t-20rpx shadow-main">
<tm-radio-group direction="column" gap="40" v-model="state.currentPayType">
<tm-radio :disabled="v.disabled" v-for="(v, i) in data.payType" :key="i" :value="v.type" :label="v.text" />
<tm-radio :disabled="v.disabled" v-for="(v, i) in data.payType" :key="i" :value="v.type"
:label="v.text" />
</tm-radio-group>
</view>
<view
class="bg-#0094ff p-y-20rpx text-center rounded-40rpx m-x-30rpx m-t-60rpx sub-text-30 color-white!"
@tap="doPay"
>
<view class="bg-#0094ff p-y-20rpx text-center rounded-40rpx m-x-30rpx m-t-60rpx sub-text-30 color-white!"
@tap="doPay">
确认充值
</view>
</crud-layout>
@@ -140,7 +128,7 @@ const doPay = async () => {
background: #e9f5fe;
border: 1px solid #e9f5fe !important;
& > text {
&>text {
color: #0094ff !important;
}
}