1
This commit is contained in:
1 parent
72e58a58d6
commit
d1127ab5f8
5 files changed
+73
-16
No files matched your search
@@ -158,6 +158,13 @@
|
||||
"navigationBarTitleText": "",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "recharge-record",
|
||||
"style": {
|
||||
"navigationBarTitleText": "充值记录",
|
||||
"disableScroll": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -3,23 +3,23 @@
|
||||
<view class="h-20rpx"></view>
|
||||
<view class="p-32rpx card flex items-center justify-between">
|
||||
<view class="flex items-center">
|
||||
<image class="w-64 h-64 mr-16rpx" :src="filePath(payStore.sourceWalletData.walletTypeIcon)" />
|
||||
<image class="w-64rpx h-64rpx mr-16rpx" :src="filePath(payStore.sourceWalletData.walletTypeIcon)" />
|
||||
<view>{{ payStore.sourceWalletData.walletTypeName }}</view>
|
||||
</view>
|
||||
<view class="flex items-center c-#0094ff! font-bold">
|
||||
<view class="text-30">余额:</view>
|
||||
<view class="text-30 mr-8rpx">{{ hooks.useMoney(payStore.sourceWalletData.balance) + "元" }}</view>
|
||||
<view class="text-30rpx">余额:</view>
|
||||
<view class="text-30rpx mr-8rpx">{{ hooks.useMoney(payStore.sourceWalletData.balance) + "元" }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="p-32rpx card mt-16rpx flex items-center justify-between active:bg-[#f0f0f0]" @click="show = true">
|
||||
<view class="flex items-center">
|
||||
<image class="w-64 h-64 rounded-full mr-16rpx" src="@/static/page/money-cny-circle-fill.svg" />
|
||||
<image class="w-64rpx h-64rpx rounded-full mr-16rpx" src="@/static/page/money-cny-circle-fill.svg" />
|
||||
<view>转入到</view>
|
||||
</view>
|
||||
<view class="flex items-center">
|
||||
<view class="second-text-28 mr-8rpx">{{ targetWalletType.name }}</view>
|
||||
<image class="w-38 h-38 rounded-full c-blueGray" src="@/static/page/arrow-right.svg" />
|
||||
<image class="w-38rpx h-38rpx rounded-full c-blueGray" src="@/static/page/arrow-right.svg" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -51,13 +51,13 @@
|
||||
:class="{ 'border-4 border-solid border-blue!': targetWalletType.id == v.walletTypeId }"
|
||||
@click="selectTargetWalletType(v)">
|
||||
<view class="flex items-center">
|
||||
<image class="w-70 h-70 mr-16rpx" :src="filePath(v.walletTypeIcon)" />
|
||||
<image class="w-70rpx h-70rpx mr-16rpx" :src="filePath(v.walletTypeIcon)" />
|
||||
<view class="flex flex-col">
|
||||
<view class="main-text-32">{{ v.walletTypeName }}</view>
|
||||
<view class="text-gray-500 text-sm">{{ v.cardNumber }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-32 c-#0094ff font-bold">余额:{{ hooks.useMoney(v.balance) + "元" }}</view>
|
||||
<view class="text-32rpx c-#0094ff font-bold">余额:{{ hooks.useMoney(v.balance) + "元" }}</view>
|
||||
</view>
|
||||
</tm-drawer>
|
||||
</template>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<template #main-top>
|
||||
<view class="flex items-center py-24rpx px-40rpx" @tap="doUserArea">
|
||||
<view class="flex items-center" v-if="state.userInfo?.sysUser?.userId">
|
||||
<image v-if="state.userInfo?.sysUser?.avatar" class="size-100rpx rounded-full"
|
||||
<image v-if="state.userInfo?.sysUser?.userId" class="size-100rpx rounded-full"
|
||||
:src="filePath(state.userInfo.sysUser.avatar)" mode="aspectFill" />
|
||||
<image v-else class="w-100rpx h-100rpx rounded-full" src="/static/icon/default-avatar.png"
|
||||
mode="aspectFill" />
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -3,7 +3,7 @@ import { ref, reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
|
||||
import { hooks, constant } from "@@/index"
|
||||
import { hooks, constant, router } from "@@/index"
|
||||
import { walletApi, payApi, miniPlatformApi, type MiniPayDto } from "@@/api"
|
||||
import { SERVICE_IMAGE, storageConstant } from "@@/constant/index"
|
||||
import { filePath } from "@@/utils/file"
|
||||
@@ -53,6 +53,7 @@ const getRechargeList = async () => {
|
||||
const { data } = await walletApi.rechargeList(_pa)
|
||||
state.rechargeList = data
|
||||
}
|
||||
// 执行微信支付
|
||||
const doPay = async () => {
|
||||
if (state.currentRecharge == -1) {
|
||||
uni.showToast({ title: "请选择充值金额", icon: "none" })
|
||||
@@ -68,7 +69,6 @@ const doPay = async () => {
|
||||
const targetPayType = data.payType[state.currentPayType]
|
||||
if (isEmpty(targetRecharge)) throw new Error()
|
||||
const uniqueCode = await getMiniUniqueCode(false)
|
||||
console.log("uniqueCode:", uniqueCode);
|
||||
const payParams: MiniPayDto = {
|
||||
bizType: "MINI_APP_WALLET_RECHARGE",
|
||||
bizId: targetRecharge.id,
|
||||
@@ -81,22 +81,38 @@ const doPay = async () => {
|
||||
provider: 'wxpay',
|
||||
...createData?.miniAppPayParams ?? {},
|
||||
});
|
||||
console.log("paymentResult:", paymentResult);
|
||||
console.log("执行微信支付success:", paymentResult);
|
||||
getDetail()
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: "充值成功", icon: "none" })
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
// 支付成功
|
||||
if (paymentResult.errMsg?.includes("requestPayment:ok")) {
|
||||
uni.showToast({ title: "充值成功", icon: "none" })
|
||||
}
|
||||
// 未知支付状态
|
||||
else { }
|
||||
} catch (error: any) {
|
||||
console.error("执行微信支付,error:", error)
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: "充值失败", icon: "none" })
|
||||
if (error?.errMsg && error?.errMsg.includes("fail cancel")) {
|
||||
uni.showToast({ title: "用户取消支付", icon: "none" })
|
||||
} else {
|
||||
uni.showToast({ title: "充值失败", icon: "none" })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const toRechargeRecord = () => {
|
||||
return
|
||||
router.jump("/pages/wallet/recharge-record", { walletId: state.walletId })
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<crud-layout title="充值" :bg="filePath(SERVICE_IMAGE.blueBg)">
|
||||
<view class="h-30rpx" />
|
||||
<view class="flex-row items-center justify-between h-120rpx p-x-30rpx bg-#222222 rounded-20rpx">
|
||||
<view @tap="toRechargeRecord"
|
||||
class="relative flex-row items-center justify-between h-120rpx p-x-30rpx bg-#222222 rounded-20rpx">
|
||||
<view class="flex-row items-center">
|
||||
<view class="flex-row-center size-60rpx bg-white rounded-full">
|
||||
<image class="size-50rpx rounded-full" :src="state.detail.walletIcon" mode="aspectFill" />
|
||||
@@ -108,6 +124,9 @@ const doPay = async () => {
|
||||
</view>
|
||||
</view>
|
||||
<view class="main-text-30 color-#fbddb0!"> ¥{{ hooks.useMoney(state.detail.balance) }} </view>
|
||||
<view v-if="false" class="recharge-record-tag">
|
||||
<text class="recharge-record-tag__text">充值记录</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="prefix_title m-t-35rpx">充值</view>
|
||||
@@ -132,6 +151,28 @@ const doPay = async () => {
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.recharge-record-tag {
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
right: -20rpx;
|
||||
height: 36rpx;
|
||||
padding: 0 18rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #0094ff;
|
||||
border-radius: 0 0 16rpx 16rpx;
|
||||
transform: skewX(-18deg) translateY(10rpx);
|
||||
transform-origin: right top;
|
||||
}
|
||||
|
||||
.recharge-record-tag__text {
|
||||
display: block;
|
||||
transform: skewX(18deg);
|
||||
font-size: 20rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.recharge_item_active {
|
||||
background: #e9f5fe;
|
||||
border: 1px solid #e9f5fe !important;
|
||||
|
||||
Reference in new issue
Block a user