新增编辑奖励
This commit is contained in:
@@ -240,6 +240,9 @@
|
||||
<el-table-column prop="awardStock" align="center" label="奖品库存" />
|
||||
<el-table-column prop="x" align="center" label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button @click="editFun(scope.row)" type="text" size="default"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button @click="delFun(scope.row)" type="text" size="default"
|
||||
>删除</el-button
|
||||
>
|
||||
@@ -260,7 +263,7 @@
|
||||
<!-- 增加一条弹窗 -->
|
||||
<el-dialog
|
||||
v-model="addDialog"
|
||||
title="等级奖励配置(编辑)"
|
||||
title="等级奖励配置(新增)"
|
||||
class="addBox"
|
||||
center
|
||||
width="26%"
|
||||
@@ -353,6 +356,101 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 编辑弹窗 -->
|
||||
<el-dialog
|
||||
v-model="editDialog"
|
||||
title="等级奖励配置(编辑)"
|
||||
class="addBox"
|
||||
center
|
||||
width="26%"
|
||||
>
|
||||
<div class="inquire">
|
||||
<span>奖品类型:</span>
|
||||
<el-select filterable v-model="editObj.giftVal" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in editObj.giftType"
|
||||
:key="item.id"
|
||||
:label="item.desc"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>用户身份:</span>
|
||||
<el-select filterable v-model="editObj.type" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in editObj.typeArr"
|
||||
:key="item.id"
|
||||
:label="item.desc"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>奖品ID/VIP等级:</span>
|
||||
<el-input
|
||||
v-model="editObj.giftId"
|
||||
placeholder=""
|
||||
class="input"
|
||||
></el-input>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>奖励数量/天数:</span>
|
||||
<el-input
|
||||
v-model="editObj.giftNum"
|
||||
placeholder=""
|
||||
class="input"
|
||||
></el-input>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>库存:</span>
|
||||
<el-input
|
||||
v-model="editObj.awardStock"
|
||||
placeholder=""
|
||||
class="input"
|
||||
></el-input>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>顺序:</span>
|
||||
<el-input v-model="editObj.sNo" placeholder="" class="input"></el-input>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>是否展示:</span>
|
||||
<el-select filterable v-model="editObj.showVal" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in editObj.show"
|
||||
:key="item.id"
|
||||
:label="item.desc"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>奖励图片:</span>
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
action="/admin/tencent/cos/upload/file"
|
||||
:show-file-list="false"
|
||||
:on-success="handleAvatarSuccess5"
|
||||
:before-upload="beforeAvatarUpload"
|
||||
:on-error="handleAvatarError"
|
||||
>
|
||||
<img v-if="editObj.imageUrl" :src="editObj.imageUrl" class="avatar" />
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="editSaveFun()"> 保存 </el-button>
|
||||
<el-button type="primary" @click="editDialog = false">
|
||||
取消
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 编辑弹窗 -->
|
||||
<el-dialog
|
||||
v-model="eidDialogBox"
|
||||
title="编辑"
|
||||
@@ -490,6 +588,37 @@ export default {
|
||||
eid: {
|
||||
tableData: [],
|
||||
},
|
||||
// 编辑弹窗
|
||||
editDialog: false,
|
||||
editObj: {
|
||||
imageUrl: "",
|
||||
giftVal: 8,
|
||||
giftType: [
|
||||
{ desc: "金币", value: 8 },
|
||||
{ desc: "礼物", value: 6 },
|
||||
{ desc: "座驾", value: 5 },
|
||||
{ desc: "头饰", value: 1 },
|
||||
{ desc: "气泡", value: 3 },
|
||||
{ desc: "VIP", value: 10 },
|
||||
{ desc: "勋章", value: 11 },
|
||||
{ desc: "铭牌", value: 2 },
|
||||
],
|
||||
type: "",
|
||||
typeArr: [
|
||||
{ desc: "固定身份", value: 1 },
|
||||
{ desc: "随机身份", value: 2 },
|
||||
],
|
||||
giftId: "",
|
||||
giftNum: "",
|
||||
awardStock: "",
|
||||
sNo: "",
|
||||
showVal: "",
|
||||
id: "",
|
||||
show: [
|
||||
{ desc: "是", value: 1 },
|
||||
{ desc: "否", value: 0 },
|
||||
],
|
||||
},
|
||||
// 新增弹窗
|
||||
addDialog: false,
|
||||
addObj: {
|
||||
@@ -563,6 +692,58 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 编辑弹窗
|
||||
editFun(val) {
|
||||
this.editObj.giftVal = val.awardType;
|
||||
this.editObj.giftNum = val.awardNum;
|
||||
this.editObj.giftId = val.awardId;
|
||||
this.editObj.awardStock = val.awardStock;
|
||||
this.editObj.sNo = val.seq;
|
||||
this.editObj.showVal = val.isShow;
|
||||
this.editObj.type = val.type;
|
||||
this.editObj.imageUrl = val.awardPic;
|
||||
this.editObj.id = val.id;
|
||||
this.editDialog = true;
|
||||
},
|
||||
// 确认编辑弹窗
|
||||
editSaveFun() {
|
||||
var level = this.id;
|
||||
var obj = {
|
||||
awardType: this.editObj.giftVal,
|
||||
awardNum: this.editObj.giftNum,
|
||||
awardId: this.editObj.giftId,
|
||||
awardStock: this.editObj.awardStock,
|
||||
seq: this.editObj.sNo,
|
||||
isShow: this.editObj.showVal,
|
||||
type: this.editObj.type,
|
||||
awardPic: this.editObj.imageUrl,
|
||||
id: this.editObj.id,
|
||||
partitionId: this.inquire.partitionId,
|
||||
level,
|
||||
};
|
||||
awardUpdate(obj).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.editDialog = false;
|
||||
awardList({
|
||||
level,
|
||||
partitionId: this.inquire.partitionId,
|
||||
}).then((res) => {
|
||||
this.eid.tableData = res.data;
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "成功",
|
||||
type: "success",
|
||||
});
|
||||
});
|
||||
} else {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 新增
|
||||
addFun() {
|
||||
var level = this.id;
|
||||
@@ -730,6 +911,16 @@ export default {
|
||||
type: "success",
|
||||
});
|
||||
},
|
||||
handleAvatarSuccess5(res, file) {
|
||||
console.log(file);
|
||||
// this.ediObj.imageUrl = URL.createObjectURL();
|
||||
this.editObj.imageUrl = res.data;
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传成功!",
|
||||
type: "success",
|
||||
});
|
||||
},
|
||||
// 分页导航
|
||||
handleSizeChange() {
|
||||
this.getData();
|
||||
|
Reference in New Issue
Block a user