12121
This commit is contained in:
93
Web/src/pages/business/exchange.vue
Normal file
93
Web/src/pages/business/exchange.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
请选择:<br>
|
||||
<div class="content" v-for="(item, index) in data" :key="index">
|
||||
{{ index + 1 }}.<Abutton @click="btnShowView(item)">{{ item.name }}</Abutton>
|
||||
</div>
|
||||
</div>
|
||||
<GamePopup v-model:show="showView" title="【兑换】">
|
||||
<!-- 自定义内容 -->
|
||||
<div class="common">
|
||||
<strong style="font-size: 14px;">兑换标题:</strong> {{ onData.name }}<br>
|
||||
<strong style="font-size: 14px;">兑换说明:</strong>{{ onData.tips }}<br>
|
||||
<strong style="font-size: 14px;">结束时间:</strong>{{ TimeExtend.Format(onData.endTime) }}<br>
|
||||
<strong style="font-size: 14px;">兑换次数:</strong>{{ GameTool.GetTimeCountTips(onData.exType,
|
||||
onData.count)}}<br>
|
||||
<strong style="font-size: 14px;">兑换奖励:</strong><br>
|
||||
<GameProp :data="onData.getData" :count="count"></GameProp>
|
||||
<strong style="font-size: 14px;">兑换所需:</strong><br>
|
||||
<GamePropVerify :data="verifyData.needs"></GamePropVerify>
|
||||
</div>
|
||||
<div class="common" v-if="verifyData.result == true">
|
||||
<strong style="font-size: 14px;">兑换数量:</strong><input type="number" class="search-ipt" v-model="count"><br>
|
||||
<div style="text-align: center;">
|
||||
<button class="ipt-btn" name="serch" @click="ExChangeOk" style="margin-top: 15px;">兑换</button>
|
||||
</div>
|
||||
</div>
|
||||
</GamePopup>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.default,
|
||||
middleware: 'page-loading'
|
||||
})
|
||||
const data = ref<Array<any>>([]);
|
||||
const onData = ref<any>({});
|
||||
const verifyData = ref<any>({});
|
||||
const needs = ref<Array<any>>([]);
|
||||
const showView = ref(false);
|
||||
const count = ref(1);
|
||||
let npcId = LocalStorageHelper.GetOnNpc();
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
}
|
||||
finally {
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
const BindData = async (): Promise<void> => {
|
||||
let result = await ExchangeService.GetExchangeData(Number(npcId));
|
||||
if (result.code == 0) {
|
||||
data.value = result.data;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("提示", result.msg);
|
||||
}
|
||||
};
|
||||
|
||||
const btnShowView = async (exData: any) => {
|
||||
onData.value = exData;
|
||||
MessageExtend.LoadingToast("操作中...");
|
||||
let result = await BagService.CheckUserProp(0, count.value, JSON.stringify(exData.needData));
|
||||
MessageExtend.LoadingClose();
|
||||
if (result.code == 0) {
|
||||
verifyData.value = result.data;
|
||||
needs.value = verifyData.value.needs;
|
||||
showView.value = true;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("兑换", result.msg);
|
||||
}
|
||||
}
|
||||
|
||||
const ExChangeOk = async (): Promise<void> => {
|
||||
MessageExtend.LoadingToast("兑换中...");
|
||||
let result = await ExchangeService.ExchangeOk(Number(npcId), onData.value.exId, count.value)
|
||||
MessageExtend.LoadingClose();
|
||||
if (result.code == 0) {
|
||||
showView.value = false;
|
||||
MessageExtend.Notify("兑换成功!", "success");
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("提示", result.msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user