完善充值流程
This commit is contained in:
parent
bc3a0af938
commit
ac4b287bdd
@ -9,10 +9,10 @@
|
|||||||
<div class="assets-user-name">
|
<div class="assets-user-name">
|
||||||
<div class="adderss">{{ localWalletStore.showAddress ? localWalletStore.showAddress : 'User Address' }}</div>
|
<div class="adderss">{{ localWalletStore.showAddress ? localWalletStore.showAddress : 'User Address' }}</div>
|
||||||
<div class="email">
|
<div class="email">
|
||||||
<p>Email: {{ userInfoData.email }}</p>
|
<p>Email: {{ userInfoData.email ? userInfoData.email : '-' }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<p>Player name: <span>{{ userInfoData.nickname }}</span></p>
|
<p>Player name: <span>{{ userInfoData.nickname ? userInfoData.nickname : '-' }}</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="recharge">
|
<div class="recharge">
|
||||||
<div class="recharge-left">
|
<div class="recharge-left">
|
||||||
@ -591,7 +591,7 @@ const selectItem = (data, index) => {
|
|||||||
if(data.goods_id == 1006) {
|
if(data.goods_id == 1006) {
|
||||||
confirmRecharge.value = {
|
confirmRecharge.value = {
|
||||||
currency: data.currency,
|
currency: data.currency,
|
||||||
diamond: '',
|
diamond: brickworkAmount.value,
|
||||||
goods_id: data.goods_id,
|
goods_id: data.goods_id,
|
||||||
price: priceAmount.value
|
price: priceAmount.value
|
||||||
}
|
}
|
||||||
@ -605,8 +605,10 @@ const handleInput = (e) => {
|
|||||||
if(Number(brickworkAmount.value) >9999) {
|
if(Number(brickworkAmount.value) >9999) {
|
||||||
brickworkAmount.value = 9999
|
brickworkAmount.value = 9999
|
||||||
toRaw(confirmRecharge.value).price = 9999
|
toRaw(confirmRecharge.value).price = 9999
|
||||||
|
toRaw(confirmRecharge.value).diamond = brickworkAmount.value
|
||||||
} else {
|
} else {
|
||||||
toRaw(confirmRecharge.value).price = brickworkAmount.value
|
toRaw(confirmRecharge.value).price = brickworkAmount.value
|
||||||
|
toRaw(confirmRecharge.value).diamond = brickworkAmount.value
|
||||||
priceAmount.value = brickworkAmount.value
|
priceAmount.value = brickworkAmount.value
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,6 +620,7 @@ const rechargeDecrease = async () => {
|
|||||||
priceAmount.value--
|
priceAmount.value--
|
||||||
if(confirmRecharge.value.goods_id == 1006) {
|
if(confirmRecharge.value.goods_id == 1006) {
|
||||||
toRaw(confirmRecharge.value).price = priceAmount.value
|
toRaw(confirmRecharge.value).price = priceAmount.value
|
||||||
|
toRaw(confirmRecharge.value).diamond = brickworkAmount.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const rechargeIncrease = async () => {
|
const rechargeIncrease = async () => {
|
||||||
@ -625,12 +628,13 @@ const rechargeIncrease = async () => {
|
|||||||
priceAmount.value++
|
priceAmount.value++
|
||||||
if(confirmRecharge.value.goods_id == 1006) {
|
if(confirmRecharge.value.goods_id == 1006) {
|
||||||
toRaw(confirmRecharge.value).price = priceAmount.value
|
toRaw(confirmRecharge.value).price = priceAmount.value
|
||||||
|
toRaw(confirmRecharge.value).diamond = brickworkAmount.value
|
||||||
}
|
}
|
||||||
|
console.log(brickworkAmount.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 充值
|
// 充值
|
||||||
const conformBtn = async () => {
|
const conformBtn = async () => {
|
||||||
// debugger
|
|
||||||
// if(localWalletStore.walletType == 3) {
|
// if(localWalletStore.walletType == 3) {
|
||||||
let address = localWalletStore.address
|
let address = localWalletStore.address
|
||||||
if(toRaw(confirmRecharge.value).price == 0) {
|
if(toRaw(confirmRecharge.value).price == 0) {
|
||||||
@ -641,9 +645,12 @@ const conformBtn = async () => {
|
|||||||
// return
|
// return
|
||||||
try {
|
try {
|
||||||
const bc = new BlockChain()
|
const bc = new BlockChain()
|
||||||
let res = await bc.mall.execBuyItem(Number(toRaw(confirmRecharge.value).goods_id))
|
let res = await bc.mall.execBuyItem(Number(toRaw(confirmRecharge.value).goods_id), Number(toRaw(confirmRecharge.value).goods_id) == 1006 ? brickworkAmount.value : 0)
|
||||||
// console.log(res)
|
// console.log(res)
|
||||||
if(res) {
|
if(res) {
|
||||||
|
activeIndex.value = 0
|
||||||
|
brickworkAmount.value = 0
|
||||||
|
priceAmount.value = 0
|
||||||
await dataInfo()
|
await dataInfo()
|
||||||
loadingDialogVisible.value = false
|
loadingDialogVisible.value = false
|
||||||
message.success('Top-Up Successful')
|
message.success('Top-Up Successful')
|
||||||
@ -1649,6 +1656,7 @@ onMounted(() => {
|
|||||||
padding: 0 99px;
|
padding: 0 99px;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
background: #1A1821;
|
background: #1A1821;
|
||||||
|
box-shadow: none;
|
||||||
border-radius: 100px;
|
border-radius: 100px;
|
||||||
.ant-modal-body {
|
.ant-modal-body {
|
||||||
.log-title {
|
.log-title {
|
||||||
@ -1696,6 +1704,8 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
.log-body {
|
.log-body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 540px;
|
||||||
|
overflow-y: auto;
|
||||||
.pages {
|
.pages {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -1742,6 +1752,21 @@ onMounted(() => {
|
|||||||
color: #8587B2;
|
color: #8587B2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 5px;
|
||||||
|
}
|
||||||
|
&::-webkit-scrollbar-track {
|
||||||
|
background: #171220;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
&::-webkit-scrollbar-corner {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
&::-webkit-scrollbar-thumb {
|
||||||
|
height: 15px;
|
||||||
|
background: #9950fd;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.pagination {
|
.pagination {
|
||||||
|
@ -22,7 +22,7 @@ export class GameItemMall {
|
|||||||
return txHash
|
return txHash
|
||||||
}
|
}
|
||||||
|
|
||||||
async execBuyItem(itemId) {
|
async execBuyItem(itemId, itemNum) {
|
||||||
// await this.bc.checkPassportLogin();
|
// await this.bc.checkPassportLogin();
|
||||||
// const chainId = parseInt(import.meta.env.VUE_APP_NET_ID);
|
// const chainId = parseInt(import.meta.env.VUE_APP_NET_ID);
|
||||||
// const provider = this.bc.passportProvider
|
// const provider = this.bc.passportProvider
|
||||||
@ -30,16 +30,17 @@ export class GameItemMall {
|
|||||||
// return
|
// return
|
||||||
|
|
||||||
await this.bc.checkPassportLogin();
|
await this.bc.checkPassportLogin();
|
||||||
|
const token = await this.bc.passportToken()
|
||||||
const chainId = parseInt(import.meta.env.VUE_APP_NET_ID);
|
const chainId = parseInt(import.meta.env.VUE_APP_NET_ID);
|
||||||
const { provider, address } = await this.bc.selectAddress({targetChainId: chainId})
|
const { provider, address } = await this.bc.selectAddress({targetChainId: chainId})
|
||||||
const preDatas = {
|
const preDatas = {
|
||||||
net_id: chainId,
|
net_id: chainId,
|
||||||
goods_id: itemId,
|
goods_id: itemId,
|
||||||
account_address: address,
|
account_address: address,
|
||||||
// passport: '',
|
goods_num: itemNum,
|
||||||
|
|
||||||
}
|
}
|
||||||
const { errocode, errmsg, calls } = await apiPreRecharge(preDatas)
|
// const token = this.bc.store.refreshToken
|
||||||
|
const { errocode, errmsg, calls } = await apiPreRecharge(preDatas, token)
|
||||||
if (errocode) {
|
if (errocode) {
|
||||||
throw new Error(errmsg)
|
throw new Error(errmsg)
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, computed, onUnmounted, watchEffect, getCurrentInstance, watch, inject } from "vue";
|
import { ref, toRaw, reactive, onMounted, computed, onUnmounted, watchEffect, getCurrentInstance, watch, inject } from "vue";
|
||||||
const message = inject('$message')
|
const message = inject('$message')
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
import { useAppStore } from "@/store/app";
|
import { useAppStore } from "@/store/app";
|
||||||
@ -320,7 +320,9 @@ const closeCartBox = () => {
|
|||||||
|
|
||||||
watch(() => route.path,(newPath, oldPath) => {
|
watch(() => route.path,(newPath, oldPath) => {
|
||||||
let routerPath = newPath.split('/')
|
let routerPath = newPath.split('/')
|
||||||
if(routerPath[1] == 'marketplace') {
|
if(routerPath[1] == 'marketplace' || routerPath[1] == 'detail') {
|
||||||
|
// if(routerPath[1] == 'marketplace') {
|
||||||
|
console.log(toRaw(marketplaceStore.detailData))
|
||||||
isCart.value = true
|
isCart.value = true
|
||||||
} else {
|
} else {
|
||||||
isCart.value = false
|
isCart.value = false
|
||||||
|
@ -185,9 +185,9 @@ export const apiDiamondHistory = async (account_address) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 充值-购买
|
// 充值-购买
|
||||||
export const apiPreRecharge = async (data) => {
|
export const apiPreRecharge = async (data, token) => {
|
||||||
const url = `${API_BASE}/api/recharge/buy`
|
const url = `${API_BASE}/api/recharge/buy`
|
||||||
return httpPost(url, data)
|
return httpPost(url, data, token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user