452424
This commit is contained in:
@@ -17,8 +17,25 @@
|
||||
<div class="common">
|
||||
数量:{{ count }}
|
||||
</div>
|
||||
<div class="common" v-if="data.code == 'Drug'">
|
||||
<Abutton @click="ShowDrugBar">添加药品栏</Abutton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<GamePopup v-model:show="showDrugView" title="【添加药品栏】">
|
||||
<!-- 自定义内容 -->
|
||||
<div class="common" style="margin-top: 10px;">
|
||||
药品名称:{{ data.goodsName }}<br>
|
||||
说明:{{ data.tips }}<br>
|
||||
</div>
|
||||
<div class="common" style="text-align: left;">
|
||||
添加数量:<input type="number" class="search-ipt" v-model="AddDrugCount"><br>
|
||||
</div>
|
||||
<div class="common" style="text-align: center;">
|
||||
<button class="ipt-btn" name="serch" @click="AddDrugBar" style="margin-top: 15px;">确认</button>
|
||||
</div>
|
||||
</GamePopup>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
@@ -28,7 +45,7 @@ definePageMeta({
|
||||
})
|
||||
const data = ref<any>({});
|
||||
const count = ref(0);
|
||||
|
||||
let goodsId = PageExtend.QueryString("id");
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
@@ -41,7 +58,6 @@ onMounted(async () => {
|
||||
|
||||
|
||||
const BindData = async (): Promise<void> => {
|
||||
let goodsId = PageExtend.QueryString("id");
|
||||
let result = await GoodsService.GetGoodsInfo(Number(goodsId));
|
||||
if (result.code == 0) {
|
||||
data.value = result.data.goods;
|
||||
@@ -53,4 +69,29 @@ const BindData = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
/**添加到药品栏 */
|
||||
const showDrugView = ref(false);
|
||||
const AddDrugCount = ref(1);
|
||||
const ShowDrugBar = async () => {
|
||||
showDrugView.value = true;
|
||||
}
|
||||
|
||||
const AddDrugBar = async () => {
|
||||
if (AddDrugCount.value < 1 || AddDrugCount.value > 999) {
|
||||
MessageExtend.ShowToast("每次添加数量在1~999哦.");
|
||||
return;
|
||||
}
|
||||
MessageExtend.LoadingToast("添加中...");
|
||||
let result = await UserService.AddUserDrug(Number(goodsId), AddDrugCount.value)
|
||||
MessageExtend.LoadingClose();
|
||||
if (result.code == 0) {
|
||||
showDrugView.value = false;
|
||||
await BindData();
|
||||
MessageExtend.Notify(`成功添加${data.value.goodsName}×${AddDrugCount.value}到药品栏!`, "success");
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("提示", result.msg);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user