新增兑奖记录

This commit is contained in:
gyq
2024-12-25 14:39:57 +08:00
parent e0b70d8f65
commit bc03876a7e
6 changed files with 409 additions and 152 deletions

View File

@@ -1,97 +1,86 @@
<template>
<div class="">
<el-button type="primary" @click="openAddZhuanpan">添加任务</el-button>
<div class="zhanwei"></div>
<el-table :border="true" :data="tableData">
<el-table-column
prop="sort"
label="排序"
sortable
width="50">
</el-table-column>
<el-table-column label="标题" prop="title"></el-table-column>
<el-tabs v-model="tabActive">
<el-tab-pane label="任务" name="renwu"></el-tab-pane>
<el-tab-pane label="兑换" name="exchang"></el-tab-pane>
</el-tabs>
<div v-if="tabActive == 'renwu'">
<el-button type="primary" @click="openAddZhuanpan">添加任务</el-button>
<div class="zhanwei"></div>
<el-table :border="true" :data="tableData">
<el-table-column prop="sort" label="排序" sortable width="50">
</el-table-column>
<el-table-column label="标题" prop="title"></el-table-column>
<el-table-column label="任务类型">
<template slot-scope="scope">
<span>{{ returnTypeName(scope.row.type) }}</span>
</template>
</el-table-column>
<el-table-column label="详情描述">
<template slot-scope="scope">
<span>{{ scope.row.detail }}</span>
</template>
</el-table-column>
<el-table-column label="奖励设置">
<template slot-scope="scope">
<div class="flex flex-center">
<el-button type="text" size="mini" @click="opengiftList(scope.row)"
>编辑</el-button
>
</div>
<!-- <span>{{ scope.row.rewardDetail }}</span> -->
</template>
</el-table-column>
<el-table-column label="奖励描述">
<template slot-scope="scope">
<span>{{ scope.row.rewardDetail }}</span>
</template>
</el-table-column>
<el-table-column label="奖励图片">
<template slot-scope="scope">
<img
style="width: 50px; height: 50px"
v-if="scope.row.rewardImg"
:src="scope.row.rewardImg"
/>
</template>
</el-table-column>
<el-table-column label="达标次数">
<template slot-scope="scope">
<span v-if="scope.row.type == 2">{{ scope.row.number }}</span>
</template>
</el-table-column>
<el-table-column label="跳转类型">
<template slot-scope="scope">
<span>{{ returnJumpTypeName(scope.row.jumpType) }}</span>
</template>
</el-table-column>
<el-table-column label="跳转路径">
<template slot-scope="scope">
<span>{{ scope.row.buttonUrl }}</span>
</template>
</el-table-column>
<el-table-column label="是否展示">
<template slot-scope="scope">
<el-switch @change="showsChange($event,scope.row)" v-model="scope.row.shows" :inactive-value="0" :active-value="1"></el-switch>
</template>
</el-table-column>
<el-table-column label="编辑">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="openAddZhuanpan(scope.row)"
>编辑</el-button
>
<el-button type="text" size="mini" @click="del(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:page-sizes="[10, 20, 30, 40]"
:page-size="limit"
:current-page="page"
layout="total,sizes, prev, pager, next,jumper"
:total="total"
>
</el-pagination>
<el-table-column label="任务类型">
<template slot-scope="scope">
<span>{{ returnTypeName(scope.row.type) }}</span>
</template>
</el-table-column>
<el-table-column label="详情描述">
<template slot-scope="scope">
<span>{{ scope.row.detail }}</span>
</template>
</el-table-column>
<el-table-column label="奖励设置">
<template slot-scope="scope">
<div class="flex flex-center">
<el-button type="text" size="mini" @click="opengiftList(scope.row)">编辑</el-button>
</div>
<!-- <span>{{ scope.row.rewardDetail }}</span> -->
</template>
</el-table-column>
<el-table-column label="奖励描述">
<template slot-scope="scope">
<span>{{ scope.row.rewardDetail }}</span>
</template>
</el-table-column>
<el-table-column label="奖励图片">
<template slot-scope="scope">
<img style="width: 50px; height: 50px" v-if="scope.row.rewardImg" :src="scope.row.rewardImg" />
</template>
</el-table-column>
<el-table-column label="达标次数">
<template slot-scope="scope">
<span v-if="scope.row.type == 2">{{ scope.row.number }}</span>
</template>
</el-table-column>
<el-table-column label="跳转类型">
<template slot-scope="scope">
<span>{{ returnJumpTypeName(scope.row.jumpType) }}</span>
</template>
</el-table-column>
<el-table-column label="跳转路径">
<template slot-scope="scope">
<span>{{ scope.row.buttonUrl }}</span>
</template>
</el-table-column>
<el-table-column label="是否展示">
<template slot-scope="scope">
<el-switch @change="showsChange($event, scope.row)" v-model="scope.row.shows" :inactive-value="0"
:active-value="1"></el-switch>
</template>
</el-table-column>
<el-table-column label="编辑">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="openAddZhuanpan(scope.row)">编辑</el-button>
<el-button type="text" size="mini" @click="del(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:page-sizes="[10, 20, 30, 40]" :page-size="limit" :current-page="page"
layout="total,sizes, prev, pager, next,jumper" :total="total">
</el-pagination>
</div>
<add-renwu ref="refRenwu" @refresh="init"></add-renwu>
<gift-list ref="giftList" @refresh="init"></gift-list>
</div>
<div v-if="tabActive == 'exchang'">
<record ref="record" />
</div>
<add-renwu ref="refRenwu" @refresh="init"></add-renwu>
<gift-list ref="giftList" @refresh="init"></gift-list>
</div>
</template>
@@ -99,12 +88,14 @@
import $api from "@/api/renwu.js";
import addRenwu from "./components/pop-add-renwu.vue";
import giftList from "./components/pop-gift-list.vue";
import {$renwuType,$jumpType} from './data.js'
import record from "./components/record.vue";
import { $renwuType, $jumpType } from './data.js'
export default {
components: { addRenwu,giftList },
components: { addRenwu, giftList, record },
data() {
return {
tabActive: 'renwu',
total: 0,
tableData: [],
page: 1,
@@ -114,16 +105,16 @@ export default {
};
},
methods: {
opengiftList(item){
opengiftList(item) {
this.$refs.giftList.open(item)
},
async showsChange(e,item){
async showsChange(e, item) {
console.log(e)
const res=await $api.update({...item,shows:e})
if(res.data.code==0){
const res = await $api.update({ ...item, shows: e })
if (res.data.code == 0) {
this.$message.success('修改成功')
this.init()
}else{
} else {
this.$message.error(res.data.msg || '修改失败')
}
},
@@ -169,7 +160,7 @@ export default {
}
});
})
.catch(() => {});
.catch(() => { });
},
openAddZhuanpan(item) {
this.$refs.refRenwu.open(item);
@@ -180,19 +171,14 @@ export default {
},
};
</script>
<style scoped lang="scss">
.zhanwei {
height: 20px;
}
.pagination {
margin-top: 20px;
display: flex;
}
// .flex{
// display: flex;
// }
// .flex-center{
// justify-content: center;
// }
</style>