This commit is contained in:
Putoo
2026-06-27 16:32:11 +08:00
parent aefd94ccd6
commit 438027de21
9 changed files with 144 additions and 19 deletions

View File

@@ -20,8 +20,8 @@
<div class="common" v-if="data.code == 'Drug'">
<Abutton @click="ShowDrugBar">添加药品栏</Abutton>
</div>
<div class="common" v-if="useState==1">
<Abutton>使用物品</Abutton>
<div class="common" v-if="useState == 1">
<Abutton @click="showUseNumView = true">使用物品</Abutton>
</div>
</div>
@@ -39,6 +39,17 @@
<button class="ipt-btn" name="serch" @click="AddDrugBar" style="margin-top: 15px;">确认</button>
</div>
</GamePopup>
<GamePopup v-model:show="showUseNumView" title="使用物品">
<!-- 自定义内容 -->
<div class="common">
物品名称{{ data.goodsName }}<br>
物品数量{{ count }}<br>
</div>
<div class="common" style="text-align: center;">
使用数量<input type="number" class="search-ipt" v-model="useCount"><br>
<button class="ipt-btn" name="serch" @click="UseGoods" style="margin-top: 15px;">确认</button>
</div>
</GamePopup>
</template>
<script setup lang="ts">
@@ -49,6 +60,7 @@ definePageMeta({
const data = ref<any>({});
const count = ref(0);
const useState = ref(0);
const useCount = ref(1);
let goodsId = PageExtend.QueryString("id");
onMounted(async () => {
try {
@@ -99,4 +111,20 @@ const AddDrugBar = async () => {
}
}
const showUseNumView = ref(false);
const UseGoods = async () => {
MessageExtend.LoadingToast("使用中...");
let result = await GoodsService.UseGoods(Number(goodsId),useCount.value);
MessageExtend.LoadingClose();
if (result.code == 0) {
showUseNumView.value = false;
await BindData();
MessageExtend.Notify(result.msg, "success",5000);
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
}
</script>