feat: 支付

This commit is contained in:
黄泽群
2026-07-23 14:00:22 +08:00
committed by charles
parent 15dd3d7b5b
commit 3629555911
8 changed files with 1098 additions and 1018 deletions
@@ -25,7 +25,8 @@
<view class="form_item">
<view class="form_item_title">目标账户</view>
<view class="recharge_way_warp">
<up-radio-group v-model="form.toCategory" placement="column" v-if="wayOption && wayOption.length !== 0">
<up-radio-group v-model="form.toCategory" placement="column"
v-if="wayOption && wayOption.length !== 0">
<view :class="index + 1 < wayOption.length ? 'way_item way_item_but' : 'way_item'"
v-for="(item, index) in wayOption" :key="item.id">
<view class="way_item_">
@@ -53,87 +54,95 @@
</template>
<script>
import Header from '@/components/header.vue';
import { getExchangeRule, exchange } from '@/api/finance.js';
import { ACCOUNT_CATEGORY, getValue } from '@/utils/enumUtils.js';
import Header from '@/components/header.vue';
import {
getExchangeRule,
exchange
} from '@/api/finance.js';
import {
ACCOUNT_CATEGORY,
getValue
} from '@/utils/enumUtils.js';
export default {
computed: {
ACCOUNT_CATEGORY() {
return ACCOUNT_CATEGORY;
},
},
components: { Header },
data() {
return {
form: {
amount: null,//充值金额
fromCategory: null,
toCategory: null,
export default {
computed: {
ACCOUNT_CATEGORY() {
return ACCOUNT_CATEGORY;
},
wayOption: [],
proAmount: 0,// 可兑换的金额
}
},
onLoad(option) {
const category = option.category;
if (category && category !== 'null') {
this.form.fromCategory = category;
}
const amount = option.amount;
if (amount && amount !== 'null') {
this.proAmount = amount;
}
},
mounted() {
this.getWayOption();
},
methods: {
getValue,
async getWayOption() {
const params = {
category: this.form.fromCategory,
}
const result = await getExchangeRule(params);
if (result && result.bizcode === 100) {
this.wayOption = result.data;
},
components: {
Header
},
data() {
return {
form: {
amount: null, //充值金额
fromCategory: null,
toCategory: null,
},
wayOption: [],
proAmount: 0, // 可兑换的金额
}
},
// 立即提现
async rechargeOk() {
const params = this.form;
if (!params.amount) {
this.$refs.uToastRef.show({
type: 'error',
message: "请输入需要兑换金额",
});
return;
onLoad(option) {
const category = option.category;
if (category && category !== 'null') {
this.form.fromCategory = category;
}
if (!params.toCategory) {
this.$refs.uToastRef.show({
type: 'error',
message: "请选择目标账户",
});
return;
const amount = option.amount;
if (amount && amount !== 'null') {
this.proAmount = amount;
}
console.log("params", params);
const result = await exchange(params);
console.log("result", result);
if (result && result.bizcode === 100) {
this.$refs.uToastRef.show({
type: 'success',
message: "已成功申请兑换",
});
setTimeout(() => {
uni.navigateTo({
url: '/pages/mine_package/mine_purse/mine_purse'
},
mounted() {
this.getWayOption();
},
methods: {
getValue,
async getWayOption() {
const params = {
category: this.form.fromCategory,
}
const result = await getExchangeRule(params);
if (result && result.bizcode === 100) {
this.wayOption = result.data;
}
},
// 立即提现
async rechargeOk() {
const params = this.form;
if (!params.amount) {
this.$refs.uToastRef.show({
type: 'error',
message: "请输入需要兑换金额",
});
}, 1500)
return;
}
if (!params.toCategory) {
this.$refs.uToastRef.show({
type: 'error',
message: "请选择目标账户",
});
return;
}
console.log("params", params);
const result = await exchange(params);
console.log("result", result);
if (result && result.bizcode === 100) {
this.$refs.uToastRef.show({
type: 'success',
message: "已成功申请兑换",
});
setTimeout(() => {
uni.navigateTo({
url: '/pages/mine_package/mine_purse/mine_purse'
});
}, 1500)
}
}
}
}
}
}
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped></style>