增加物品兑换数量还原
This commit is contained in:
parent
8b95feb172
commit
6c3d720d9e
@ -57,6 +57,14 @@ export function updateGiftList(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resetGiftList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/games/gift/list',
|
||||||
|
method: 'patch',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function delGiftList(data) {
|
export function delGiftList(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/games/gift/list',
|
url: '/games/gift/list',
|
||||||
|
@ -133,6 +133,17 @@
|
|||||||
></el-input>
|
></el-input>
|
||||||
<span class="ipt-tip">格式:物品id-数量, 使用回车分隔</span>
|
<span class="ipt-tip">格式:物品id-数量, 使用回车分隔</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="显示已使用量"
|
||||||
|
prop="numList"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
:value="JSON.stringify(item.usedList) || '暂无'"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="1001-99"
|
||||||
|
disabled
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item v-if="platform_id">
|
<el-form-item v-if="platform_id">
|
||||||
<el-button
|
<el-button
|
||||||
@ -143,6 +154,14 @@
|
|||||||
type="danger"
|
type="danger"
|
||||||
@click="delGiftList(index)"
|
@click="delGiftList(index)"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
|
<el-tooltip
|
||||||
|
effect="dark"
|
||||||
|
content="物品使用量清零"
|
||||||
|
placement="top"
|
||||||
|
v-if="item._id"
|
||||||
|
>
|
||||||
|
<el-button @click="resetGiftList(index)">还原</el-button>
|
||||||
|
</el-tooltip>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
@ -243,6 +262,7 @@ import {
|
|||||||
getGiftList,
|
getGiftList,
|
||||||
addGiftList,
|
addGiftList,
|
||||||
updateGiftList,
|
updateGiftList,
|
||||||
|
resetGiftList,
|
||||||
delGiftList,
|
delGiftList,
|
||||||
getGifts,
|
getGifts,
|
||||||
} from '@/api/gift'
|
} from '@/api/gift'
|
||||||
@ -429,8 +449,6 @@ export default {
|
|||||||
giftList.numList[arr[0]] = arr[1]
|
giftList.numList[arr[0]] = arr[1]
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(giftList)
|
|
||||||
|
|
||||||
if (giftList._id) {
|
if (giftList._id) {
|
||||||
// 更新
|
// 更新
|
||||||
const self = this
|
const self = this
|
||||||
@ -444,13 +462,14 @@ export default {
|
|||||||
condition: giftList.condition,
|
condition: giftList.condition,
|
||||||
list: giftList.itemsId,
|
list: giftList.itemsId,
|
||||||
numList: giftList.numList,
|
numList: giftList.numList,
|
||||||
|
usedList: giftList.usedList,
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
if (data.errcode === 0) {
|
if (data.errcode === 0) {
|
||||||
this.$message.success('物品兑换列表修改成功!')
|
this.$message.success('物品兑换列表修改成功!')
|
||||||
this.$refs[`giftList${index}`][0].clearValidate()
|
this.$refs[`giftList${index}`][0].clearValidate()
|
||||||
// this.getGiftList()
|
this.getGiftList()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@ -469,13 +488,14 @@ export default {
|
|||||||
condition: giftList.condition,
|
condition: giftList.condition,
|
||||||
list: giftList.itemsId,
|
list: giftList.itemsId,
|
||||||
numList: giftList.numList,
|
numList: giftList.numList,
|
||||||
|
usedList: giftList.usedList,
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
if (data.errcode === 0) {
|
if (data.errcode === 0) {
|
||||||
this.$message.success('兑换物品列表新增成功!')
|
this.$message.success('兑换物品列表新增成功!')
|
||||||
this.$refs[`giftList${index}`][0].clearValidate()
|
this.$refs[`giftList${index}`][0].clearValidate()
|
||||||
// this.getGiftList()
|
this.getGiftList()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@ -486,6 +506,35 @@ export default {
|
|||||||
this.$message.error('请按要求填写表单!')
|
this.$message.error('请按要求填写表单!')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async resetGiftList(index) {
|
||||||
|
this.$confirm('是否要还原兑换物品的使用量?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
const giftList = JSON.parse(JSON.stringify(this.allGiftList[index]))
|
||||||
|
resetGiftList({
|
||||||
|
uid: this.uid,
|
||||||
|
_id: giftList._id,
|
||||||
|
usedList: {},
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
const data = res.data
|
||||||
|
if (data.errcode === 0) {
|
||||||
|
this.$message.success('物品使用数量已还原!')
|
||||||
|
this.getGiftList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$message.info('已取消还原!')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
validForm(formName) {
|
validForm(formName) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.$refs[formName][0].validate(valid => {
|
this.$refs[formName][0].validate(valid => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user