From 6b239515055fb3489dc041324f2dc9a622771a63 Mon Sep 17 00:00:00 2001 From: liaozetao <1107136310@qq.com> Date: Wed, 31 Jan 2024 19:06:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/users/GiftManageView.vue | 49 ++++++++++++++++++------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/src/views/users/GiftManageView.vue b/src/views/users/GiftManageView.vue index 2d89f69..0aac426 100644 --- a/src/views/users/GiftManageView.vue +++ b/src/views/users/GiftManageView.vue @@ -212,7 +212,7 @@
@@ -692,6 +692,7 @@ export default { name: "GiftManageView", data() { return { + unlockList: [], giftLevel: [], gift: { giftId: null, @@ -866,6 +867,7 @@ export default { }, giftUnlockList() { getGiftUnlockList().then(res => { + this.unlockList = []; let data = res.data; let options = data.map(e => { return { @@ -873,6 +875,7 @@ export default { value: e.giftId, }; }); + this.unlockList = options; setTimeout(() => { ComboboxHelper.build([{text:'无', value: ''}].concat(options), '#baseGiftId', this.gift.baseGiftId); }, 500); @@ -1621,7 +1624,6 @@ export default { $('#unlockNum').removeAttr('disabled'); } }, 1000); - $this.giftUnlockList(); // 打开编辑弹窗 $("#giftModal").modal('show'); } else { @@ -1631,29 +1633,35 @@ export default { } }); }); - $("#save").click(function () { + $("#save").click(async function () { let giftId = $('#giftId').val(); let giftName = $('#giftName').val(); - let giftStatus = $('#giftStatus').val(); + let giftStatus = $("input:radio[name='giftStatus']:checked").val(); let giftType = $('#giftType').val(); + $('#giftType').removeAttr('disabled'); + $('#subGiftType').removeAttr('disabled'); + $('#baseGiftId').removeAttr('disabled'); + $('#unlockNum').removeAttr('disabled'); + console.log(giftType); if (giftType == 16) { let subGiftType = $this.gift.subGiftType; if (subGiftType == 0) { if (!giftId && !confirm('基础解锁礼物保存后礼物类型无法更改,确认保存吗?')) { return; } + console.log(giftStatus); if (giftStatus == 2) { - getLockGiftList(giftId).then(res => { - let data = res.data; - if (data) { - let targetGiftName = data.map(e => { - return e.giftName; - }).join(','); - if (!confirm('该礼物为' + giftName + ',' + giftName + '的基础解锁礼物,设置该礼物为无效会导致[' + targetGiftName + ']一并设置为无效,确认设置无效')) { - return; - } - } - }); + let res = await getLockGiftList(giftId); + let data = res.data; + let targetGiftName = ''; + if (data && data.length > 0) { + targetGiftName = data.map(e => { + return e.giftName; + }).join(','); + } + if (!confirm('该礼物为' + giftName + ',' + giftName + '的基础解锁礼物,设置该礼物为无效会导致[' + targetGiftName + ']一并设置为无效,确认设置无效')) { + return; + } } } else if (subGiftType == 1) { let baseGiftId = ComboboxHelper.getSelected('#baseGiftId'); @@ -1681,19 +1689,20 @@ export default { let receiveDressId = ComboboxHelper.getSelected('#receiveDressId'); $this.gift.sendDressId = sendDressId; $this.gift.receiveDressId = receiveDressId; + if ((!sendDressId && !receiveDressId) || (!sendDressTime && !receiveDressTime)) { + $("#tipMsg").text("送礼者和收礼者装扮内容不能同时为空"); + $("#tipModal").modal('show'); + return; + } $('#sendDressId').val(sendDressId); $('#receiveDressid').val(receiveDressId); - if ((sendDressTime && sendDressTime < 5) || (receiveDressTime && receiveDressTime < 5)) { + if ((sendDressTime && sendDressTime <= 5) || (receiveDressTime && receiveDressTime <= 5)) { $("#tipMsg").text("装扮时长不能小于5分钟"); $("#tipModal").modal('show'); return; } } if ($("#giftForm").validationEngine('validate')) { - $('#giftType').removeAttr('disabled'); - $('#subGiftType').removeAttr('disabled'); - $('#baseGiftId').removeAttr('disabled'); - $('#unlockNum').removeAttr('disabled'); $("#consumeType").removeAttr("disabled"); $.ajax({ type: "post",