|
|
@@ -4,7 +4,7 @@
|
|
|
<li class="gradient flex-center-between" v-for="(item, index) in 2" :key="index">
|
|
|
<div class="wallet-list-li-left">
|
|
|
<div class="">{{ index == 0 ? $t('common.mibi') : $t('common.baomibi') }}{{ $t('personalCenter.yue') }}</div>
|
|
|
- <div class="">{{ index == 0 ? 12 || 0 : userInfo.baoMiBalance || 0 }}</div>
|
|
|
+ <div class="">{{ index == 0 ? userInfo.pointsBalance || 0 || 0 : userInfo.baoMiBalance || 0 }}</div>
|
|
|
</div>
|
|
|
<div class="wallet-list-li-right flex-align-center">
|
|
|
<div class="flex-align-center btn" v-if="index == 1">
|
|
|
@@ -42,37 +42,48 @@
|
|
|
</template>
|
|
|
<el-empty v-else :description="$t('common.empty')" />
|
|
|
|
|
|
- <el-dialog v-model="dialogVisible" title="Tips" width="784" :before-close="handleClose">
|
|
|
+ <el-dialog v-model="dialogVisible"
|
|
|
+ :title="`${transformationIndex == 0 ? $t('personalCenter.zhuanhuanbaomibi') : $t('personalCenter.zhuanghuanmibi')}`"
|
|
|
+ width="784" :before-close="handleClose">
|
|
|
<el-form :model="walletForm" label-width="auto" label-position="top">
|
|
|
- <el-row :gutter="16">
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="Activity name">
|
|
|
- <el-input v-model="walletForm.name" />
|
|
|
+ <el-row :gutter="16" v-if="transformationIndex">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item :label="$t('common.baomibi')">
|
|
|
+
|
|
|
+ <el-input-number v-model="walletForm.orderAmt" :min="1" controls-position="right" size="large"
|
|
|
+ @change="handleChange" style="width: 100%;" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="Activity name">
|
|
|
- <el-input v-model="walletForm.name" />
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item :label="$t('common.mibi')">
|
|
|
+ <el-input v-model="walletForm.targetAmount" placeholder="请输入" readonly disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="手续费率">
|
|
|
+ <el-input v-model="walletForm.feeRate" placeholder="请输入" readonly disabled />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row :gutter="16">
|
|
|
+ <el-row :gutter="16" v-else>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="Activity name">
|
|
|
- <el-input v-model="walletForm.name" />
|
|
|
+ <el-form-item :label="$t('common.mibi')">
|
|
|
+ <el-input-number v-model="walletForm.orderAmt" :min="configTxt.configValue" :step="configTxt.configValue" controls-position="right" size="large"
|
|
|
+ @change="handleChange" style="width: 100%;" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="Activity name">
|
|
|
- <el-input v-model="walletForm.name" />
|
|
|
+ <el-form-item :label="$t('common.baomibi')">
|
|
|
+ <el-input v-model="walletForm.targetAmount" placeholder="请输入" readonly disabled />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <div class="">{{ configTxt.configName }}{{ configTxt.configValue }}</div>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false">Cancel</el-button>
|
|
|
- <el-button type="primary" @click="dialogVisible = false">
|
|
|
+ <el-button type="primary" @click="confirmTransformation">
|
|
|
Confirm
|
|
|
</el-button>
|
|
|
</div>
|
|
|
@@ -88,9 +99,14 @@ import type { TabsPaneContext } from 'element-plus'
|
|
|
import Pagination from '@/components/Pagination.vue'
|
|
|
import { getUserInfo } from '@/api/auth'
|
|
|
|
|
|
-import { payConfigDearch,calRate } from '@/api/order'
|
|
|
+import { payConfigDearch, calRate } from '@/api/order'
|
|
|
+import { createOrder } from '@/api/order.js'
|
|
|
+
|
|
|
+import DGTMessage from '@/utils/message'
|
|
|
+
|
|
|
+import { useI18n } from 'vue-i18n'
|
|
|
+const { t } = useI18n()
|
|
|
|
|
|
-const activeName = ref('first')
|
|
|
const tabs = ref([
|
|
|
{ label: 'personalCenter.incomeDetails', name: 0 },
|
|
|
{ label: 'personalCenter.usageRecord', name: 1 }
|
|
|
@@ -104,22 +120,66 @@ const form = ref({
|
|
|
})
|
|
|
|
|
|
const walletForm = ref({
|
|
|
-
|
|
|
+ payMethod: '',
|
|
|
+ orderType: '',
|
|
|
+ productId: '',
|
|
|
+ orderNum: null,
|
|
|
+ orderAmt: 1,
|
|
|
+ feeRate: 0,
|
|
|
+ targetAmount:0
|
|
|
})
|
|
|
+const configTxt = ref({})
|
|
|
|
|
|
const userInfo = ref({})//用户信息
|
|
|
|
|
|
const dialogVisible = ref(false);
|
|
|
+const transformationIndex = ref(0)
|
|
|
|
|
|
-// 米币暴米币转换
|
|
|
-const changeTransformation = () => {
|
|
|
- calRate({
|
|
|
- orderType:'exchange_mi',
|
|
|
- orderNum:100
|
|
|
+// 确认转换
|
|
|
+const confirmTransformation = async () =>{
|
|
|
+ let res = await createOrder({
|
|
|
+ payMethod: walletForm.value.payMethod,
|
|
|
+ orderType: walletForm.value.orderType,
|
|
|
+ productId: '',
|
|
|
+ orderNum: walletForm.value.targetAmount,
|
|
|
+ orderAmt: walletForm.value.orderAmt
|
|
|
})
|
|
|
+ console.log(res);
|
|
|
+ if (res.code === 200) {
|
|
|
+ if (res.data.paySuccess) {
|
|
|
+ dialogVisible.value = false;
|
|
|
+ getInfo()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 米币暴米币转换
|
|
|
+const changeTransformation = async (index:any) => {
|
|
|
+ transformationIndex.value = index;
|
|
|
+ walletForm.value.payMethod = index ? 'BMI' : 'MI';
|
|
|
+ walletForm.value.orderType = index ? 'exchange_mi' : 'exchange_bmi';
|
|
|
+ let { data } = await payConfigDearch({ id: '03' });
|
|
|
+
|
|
|
+ let result = data.filter((item:any) => item.configCode == 'bmb_to_mb_rate')
|
|
|
+ if (result.length) {
|
|
|
+ configTxt.value = result[0]
|
|
|
+ }
|
|
|
+ walletForm.value.orderAmt = index == 0 ? configTxt.value.configValue : 1
|
|
|
+ handleChange()
|
|
|
dialogVisible.value = true;
|
|
|
}
|
|
|
|
|
|
+const handleChange = async () => {
|
|
|
+ let res = await calRate({
|
|
|
+ orderType:walletForm.value.orderType,
|
|
|
+ orderNum:walletForm.value.orderAmt
|
|
|
+ });
|
|
|
+ walletForm.value.feeRate = res.data.feeRate
|
|
|
+ walletForm.value.targetAmount = res.data.targetAmount
|
|
|
+
|
|
|
+ console.log(res);
|
|
|
+}
|
|
|
+
|
|
|
const handleClick = (tab: TabsPaneContext) => {
|
|
|
list.value = []
|
|
|
form.value.pageNum = 1;
|
|
|
@@ -139,7 +199,7 @@ const handlePageChange = (newPage: number) => {
|
|
|
const getInfo = async () => {
|
|
|
let res = await getUserInfo();
|
|
|
userInfo.value = res.user;
|
|
|
- let result = await payConfigDearch({id:'03'})
|
|
|
+
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|