This commit is contained in:
Putoo
2026-06-29 18:17:54 +08:00
parent e47a5a19a6
commit 93d21ba9fd
35 changed files with 1073 additions and 293 deletions

View File

@@ -23,6 +23,12 @@
<div class="common" v-if="useState == 1">
<Abutton @click="showUseNumView = true">使用物品</Abutton>
</div>
<div class="common" v-if="useState == 2">
<Abutton @click="showUse">使用物品</Abutton>
</div>
<div class="common" v-if="useState == 3">
<Abutton @click="btnChoice">使用物品</Abutton>
</div>
</div>
@@ -41,7 +47,7 @@
</GamePopup>
<GamePopup v-model:show="showUseNumView" title="使用物品">
<!-- 自定义内容 -->
<div class="common">
<div class="common" style="margin-top: 10px;">
物品名称{{ data.goodsName }}<br>
物品数量{{ count }}<br>
</div>
@@ -50,6 +56,28 @@
<button class="ipt-btn" name="serch" @click="UseGoods" style="margin-top: 15px;">确认</button>
</div>
</GamePopup>
<GamePopup v-model:show="showUseView" title="使用物品">
<!-- 自定义内容 -->
<div class="common" style="margin-top: 10px;">
物品名称{{ data.goodsName }}<br>
物品数量{{ count }}<br>
</div>
<div class="common" style="text-align: center;">
<button class="ipt-btn" name="serch" @click="UseGoods" style="margin-top: 15px;">确认</button>
</div>
</GamePopup>
<GamePopup v-model:show="showChoiceView" title="选择物品" style="min-width: 60%;">
<!-- 自定义内容 -->
<div class="common" style="margin-top: 15px;">
<div class="item border-btm" v-for="item in choiceData">
<div>
{{ item.id }}.{{ item.name }}
<Abutton @click="btnChoiceOk(item.id)">选择</Abutton>
</div>
<div v-html="GameTool.GetPropHtml(item.award, 1, 2)"></div>
</div>
</div>
</GamePopup>
</template>
<script setup lang="ts">
@@ -78,8 +106,7 @@ const BindData = async (): Promise<void> => {
if (result.code == 0) {
data.value = result.data.goods;
count.value = result.data.count;
useState.value = result.data.use;
console.log(result);
useState.value = result.data.use;
}
else {
MessageExtend.ShowDialog("提示", result.msg);
@@ -110,17 +137,46 @@ const AddDrugBar = async () => {
MessageExtend.ShowDialog("提示", result.msg);
}
}
const showUseView = ref(false);
const showUse = () => {
useCount.value = 1;
showUseView.value = true;
}
const showUseNumView = ref(false);
const UseGoods = async () => {
MessageExtend.LoadingToast("使用中...");
let result = await GoodsService.UseGoods(Number(goodsId),useCount.value);
let result = await GoodsService.UseGoods(Number(goodsId), useCount.value);
MessageExtend.LoadingClose();
if (result.code == 0) {
showUseNumView.value = false;
if (result.code == 0) {
showUseNumView.value = false;
showUseView.value = false;
await BindData();
MessageExtend.Notify(result.msg, "success",5000);
MessageExtend.Notify(result.msg, "success", 5000);
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
}
const showChoiceView = ref(false);
const choiceData = ref<Array<any>>([]);
const btnChoice = () => {
choiceData.value = JSON.parse(data.value.content);
console.log(choiceData.value);
showChoiceView.value = true;
}
const btnChoiceOk = async (id: number) => {
MessageExtend.LoadingToast("使用中...");
let result = await GoodsService.UseChoiceGoods(Number(goodsId), id);
MessageExtend.LoadingClose();
if (result.code == 0) {
showChoiceView.value = false;
await BindData();
MessageExtend.Notify(result.msg, "success", 5000);
}
else {
MessageExtend.ShowDialog("提示", result.msg);