12121
This commit is contained in:
23
Web/src/components/Business/GameProp.vue
Normal file
23
Web/src/components/Business/GameProp.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div class="common" v-for="item in data">
|
||||
<div v-if="item.code == 'Goods'">
|
||||
▸<Abar :href='"/prop/goods?id=" + item.parameter'>{{ item.name }}</Abar>+{{ item.count * props.count }}
|
||||
</div>
|
||||
<div v-else-if="item.code == 'Equ'">
|
||||
▸<Abar :href='"/prop/equ?id=" + item.parameter'>{{ item.name }}</Abar>+{{ item.count * props.count }}
|
||||
</div>
|
||||
<div v-else>
|
||||
▸{{ item.name }}+{{ item.count * props.count }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
const props = defineProps({
|
||||
// 字段名、类型、默认值
|
||||
data: Array<any>,
|
||||
count: {
|
||||
type: Number,
|
||||
default: () => (1)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
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>
|
||||
@@ -14,9 +14,9 @@
|
||||
<div class="common">名称|价格</div>
|
||||
<div class="item" v-for="(item, index) in data" :key="index">
|
||||
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}.
|
||||
<Abar :href='"/prop/equ?id=" + item.parameter' v-if="item.type == 'Equ'">
|
||||
<Abar :href='"/prop/equ?id=" + item.goodsId' v-if="item.type == 'Equ'">
|
||||
{{ item.name }}({{ GameTool.GetCurrencyNameAll(item.price, item.payType) }})</Abar>
|
||||
<Abar :href='"/prop/goods?id=" + item.parameter' v-else>
|
||||
<Abar :href='"/prop/goods?id=" + item.goodsId' v-else>
|
||||
{{ item.name }}({{ GameTool.GetCurrencyNameAll(item.price, item.payType) }})</Abar>
|
||||
[<Abutton @click="ShopView(item)">购买</Abutton>]
|
||||
</div>
|
||||
|
||||
@@ -124,9 +124,9 @@
|
||||
<span v-if="equData.isAppr == 1">
|
||||
◈<Abutton @click="btnOpenAwaken">觉醒</Abutton><br>
|
||||
</span>
|
||||
<span v-if="equData.isAppr == 1">
|
||||
<!-- <span v-if="equData.isAppr == 1">
|
||||
◈<Abar :href='"/user/equ/quality?ue=" + equData.ueId'>洗练</Abar><br>
|
||||
</span>
|
||||
</span> -->
|
||||
<span v-if="equData.isAppr == 0">
|
||||
◈<Abutton @click="ApprEqu">鉴定</Abutton><br>
|
||||
</span>
|
||||
|
||||
@@ -56,8 +56,7 @@ const BindData = async (): Promise<void> => {
|
||||
if (result.code == 0) {
|
||||
monster.value = result.data;
|
||||
if (monster.value.award != '') {
|
||||
AwardTips.value = awardTipsStr(JSON.parse(monster.value.award))
|
||||
console.log(result);
|
||||
AwardTips.value = awardTipsStr(JSON.parse(monster.value.award))
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
17
Web/src/services/Index/ExchangeService.ts
Normal file
17
Web/src/services/Index/ExchangeService.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export class ExchangeService {
|
||||
/**
|
||||
* 获取兑换信息
|
||||
* GET /Exchange/GetExchangeData
|
||||
*/
|
||||
static async GetExchangeData(npcId: number) {
|
||||
return await ApiService.Request("get", "/Exchange/GetExchangeData", { npcId });
|
||||
}
|
||||
|
||||
/**
|
||||
* 兑换物品
|
||||
* GET /Exchange/ExchangeOk
|
||||
*/
|
||||
static async ExchangeOk(npcId: number, exId: number, count: number) {
|
||||
return await ApiService.Request("get", "/Exchange/ExchangeOk", { npcId, exId, count });
|
||||
}
|
||||
}
|
||||
@@ -128,6 +128,24 @@ export class GameTool {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public static GetTimeCountTips(code: string, count: number) {
|
||||
let result = "";
|
||||
switch (code) {
|
||||
case "Long":
|
||||
result = `永久${count}次`;
|
||||
break;
|
||||
case "Day":
|
||||
result = `每天${count}次`;
|
||||
break;
|
||||
case "Week":
|
||||
result = `每周${count}次`;
|
||||
break;
|
||||
case "Month":
|
||||
result = `每月${count}次`;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user