You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
619 lines
27 KiB
619 lines
27 KiB
|
3 weeks ago
|
<template>
|
||
|
|
<div class="luckey">
|
||
|
|
<Card>
|
||
|
|
<Row class="region-bar">
|
||
|
|
<span class="region-tip">当前校区:<b>{{ regionId || '未识别(请确认账号已绑定校区)' }}</b></span>
|
||
|
|
<Button type="primary" icon="ios-refresh" @click="reloadActive" :disabled="!regionId">刷新</Button>
|
||
|
|
</Row>
|
||
|
|
|
||
|
|
<Tabs v-model="activeTab" @on-click="onTabChange">
|
||
|
|
<!-- 奖池 -->
|
||
|
|
<TabPane label="奖池/开奖" name="pool">
|
||
|
|
<Button type="primary" icon="md-add" @click="openPool()" style="margin-bottom:12px">新建奖池</Button>
|
||
|
|
<Table border :loading="pool.loading" :columns="poolColumns" :data="pool.data"></Table>
|
||
|
|
<Row type="flex" justify="end" class="page">
|
||
|
|
<Page :current="pool.pageNumber" :total="pool.total" :page-size="pool.pageSize"
|
||
|
|
@on-change="p => changePage('pool', p)" size="small" show-total></Page>
|
||
|
|
</Row>
|
||
|
|
</TabPane>
|
||
|
|
|
||
|
|
<!-- 任务 -->
|
||
|
|
<TabPane label="券任务规则" name="task">
|
||
|
|
<Button type="primary" icon="md-add" @click="openTask()" style="margin-bottom:12px">新增任务</Button>
|
||
|
|
<Table border :loading="task.loading" :columns="taskColumns" :data="task.data"></Table>
|
||
|
|
<Row type="flex" justify="end" class="page">
|
||
|
|
<Page :current="task.pageNumber" :total="task.total" :page-size="task.pageSize"
|
||
|
|
@on-change="p => changePage('task', p)" size="small" show-total></Page>
|
||
|
|
</Row>
|
||
|
|
</TabPane>
|
||
|
|
|
||
|
|
<!-- BUFF -->
|
||
|
|
<TabPane label="BUFF配置" name="buff">
|
||
|
|
<Button type="primary" icon="md-add" @click="openBuff()" style="margin-bottom:12px">新增BUFF</Button>
|
||
|
|
<Table border :loading="buff.loading" :columns="buffColumns" :data="buff.data"></Table>
|
||
|
|
<Row type="flex" justify="end" class="page">
|
||
|
|
<Page :current="buff.pageNumber" :total="buff.total" :page-size="buff.pageSize"
|
||
|
|
@on-change="p => changePage('buff', p)" size="small" show-total></Page>
|
||
|
|
</Row>
|
||
|
|
</TabPane>
|
||
|
|
|
||
|
|
<!-- 快讯 -->
|
||
|
|
<TabPane label="星球快讯" name="news">
|
||
|
|
<Button type="primary" icon="md-add" @click="openNews()" style="margin-bottom:12px">新增快讯</Button>
|
||
|
|
<Table border :loading="news.loading" :columns="newsColumns" :data="news.data"></Table>
|
||
|
|
<Row type="flex" justify="end" class="page">
|
||
|
|
<Page :current="news.pageNumber" :total="news.total" :page-size="news.pageSize"
|
||
|
|
@on-change="p => changePage('news', p)" size="small" show-total></Page>
|
||
|
|
</Row>
|
||
|
|
</TabPane>
|
||
|
|
|
||
|
|
<!-- 排行榜 -->
|
||
|
|
<TabPane label="通缉榜" name="rank">
|
||
|
|
<Table border :loading="rank.loading" :columns="rankColumns" :data="rank.data"></Table>
|
||
|
|
<Row type="flex" justify="end" class="page">
|
||
|
|
<Page :current="rank.pageNumber" :total="rank.total" :page-size="rank.pageSize"
|
||
|
|
@on-change="p => changePage('rank', p)" size="small" show-total></Page>
|
||
|
|
</Row>
|
||
|
|
</TabPane>
|
||
|
|
|
||
|
|
<!-- 追捕记录 -->
|
||
|
|
<TabPane label="追捕记录" name="hunt">
|
||
|
|
<Table border :loading="hunt.loading" :columns="huntColumns" :data="hunt.data"></Table>
|
||
|
|
<Row type="flex" justify="end" class="page">
|
||
|
|
<Page :current="hunt.pageNumber" :total="hunt.total" :page-size="hunt.pageSize"
|
||
|
|
@on-change="p => changePage('hunt', p)" size="small" show-total></Page>
|
||
|
|
</Row>
|
||
|
|
</TabPane>
|
||
|
|
|
||
|
|
<!-- 开奖记录 -->
|
||
|
|
<TabPane label="开奖记录" name="draw">
|
||
|
|
<Table border :loading="draw.loading" :columns="drawColumns" :data="draw.data"></Table>
|
||
|
|
<Row type="flex" justify="end" class="page">
|
||
|
|
<Page :current="draw.pageNumber" :total="draw.total" :page-size="draw.pageSize"
|
||
|
|
@on-change="p => changePage('draw', p)" size="small" show-total></Page>
|
||
|
|
</Row>
|
||
|
|
</TabPane>
|
||
|
|
|
||
|
|
<!-- 中奖记录 -->
|
||
|
|
<TabPane label="中奖记录" name="winner">
|
||
|
|
<Table border :loading="winner.loading" :columns="winnerColumns" :data="winner.data"></Table>
|
||
|
|
<Row type="flex" justify="end" class="page">
|
||
|
|
<Page :current="winner.pageNumber" :total="winner.total" :page-size="winner.pageSize"
|
||
|
|
@on-change="p => changePage('winner', p)" size="small" show-total></Page>
|
||
|
|
</Row>
|
||
|
|
</TabPane>
|
||
|
|
</Tabs>
|
||
|
|
</Card>
|
||
|
|
|
||
|
|
<!-- 奖池编辑 -->
|
||
|
|
<Modal v-model="poolModal" :title="poolForm.id ? '编辑奖池' : '新建奖池'" :mask-closable="false">
|
||
|
|
<Form :label-width="90">
|
||
|
|
<FormItem label="所属校区"><Input v-model="poolForm.regionId" disabled placeholder="自动取自登录校区" /></FormItem>
|
||
|
|
<FormItem label="期号"><Input v-model="poolForm.periodNo" /></FormItem>
|
||
|
|
<FormItem label="标题"><Input v-model="poolForm.title" /></FormItem>
|
||
|
|
<FormItem label="奖池金额"><InputNumber v-model="poolForm.poolAmount" :min="0" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="开奖时间"><DatePicker type="datetime" v-model="poolForm.drawTime" format="yyyy-MM-dd HH:mm:ss" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="状态">
|
||
|
|
<Select v-model="poolForm.status">
|
||
|
|
<Option :value="0">进行中</Option>
|
||
|
|
<Option :value="1">已开奖</Option>
|
||
|
|
</Select>
|
||
|
|
</FormItem>
|
||
|
|
<FormItem label="备注"><Input v-model="poolForm.remark" type="textarea" /></FormItem>
|
||
|
|
</Form>
|
||
|
|
<div slot="footer">
|
||
|
|
<Button @click="poolModal=false">取消</Button>
|
||
|
|
<Button type="primary" @click="savePool">保存</Button>
|
||
|
|
</div>
|
||
|
|
</Modal>
|
||
|
|
|
||
|
|
<!-- 奖项管理 -->
|
||
|
|
<Modal v-model="rewardModal" title="奖项配置" width="720" :mask-closable="false">
|
||
|
|
<Button type="primary" icon="md-add" @click="addRewardRow" style="margin-bottom:12px">新增奖项</Button>
|
||
|
|
<Table border :columns="rewardColumns" :data="rewardList"></Table>
|
||
|
|
<div slot="footer">
|
||
|
|
<Button @click="rewardModal=false">关闭</Button>
|
||
|
|
</div>
|
||
|
|
</Modal>
|
||
|
|
|
||
|
|
<!-- 奖项编辑 -->
|
||
|
|
<Modal v-model="rewardEditModal" :title="rewardForm.id ? '编辑奖项' : '新增奖项'" :mask-closable="false">
|
||
|
|
<Form :label-width="90">
|
||
|
|
<FormItem label="层级">
|
||
|
|
<Select v-model="rewardForm.level">
|
||
|
|
<Option :value="1">一等奖</Option>
|
||
|
|
<Option :value="2">二等奖</Option>
|
||
|
|
<Option :value="3">三等奖</Option>
|
||
|
|
<Option :value="4">幸运奖</Option>
|
||
|
|
</Select>
|
||
|
|
</FormItem>
|
||
|
|
<FormItem label="奖项名称"><Input v-model="rewardForm.levelName" /></FormItem>
|
||
|
|
<FormItem label="奖励类型">
|
||
|
|
<Select v-model="rewardForm.rewardType">
|
||
|
|
<Option :value="0">现金</Option>
|
||
|
|
<Option :value="1">优惠券</Option>
|
||
|
|
</Select>
|
||
|
|
</FormItem>
|
||
|
|
<FormItem label="单份金额"><InputNumber v-model="rewardForm.amount" :min="0" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="优惠券id" v-if="rewardForm.rewardType===1"><Input v-model="rewardForm.couponId" /></FormItem>
|
||
|
|
<FormItem label="名额数量"><InputNumber v-model="rewardForm.quota" :min="0" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="排序"><InputNumber v-model="rewardForm.sort" style="width:100%" /></FormItem>
|
||
|
|
</Form>
|
||
|
|
<div slot="footer">
|
||
|
|
<Button @click="rewardEditModal=false">取消</Button>
|
||
|
|
<Button type="primary" @click="saveReward">保存</Button>
|
||
|
|
</div>
|
||
|
|
</Modal>
|
||
|
|
|
||
|
|
<!-- 任务编辑 -->
|
||
|
|
<Modal v-model="taskModal" :title="taskForm.id ? '编辑任务' : '新增任务'" :mask-closable="false">
|
||
|
|
<Form :label-width="90">
|
||
|
|
<FormItem label="所属校区"><Input v-model="taskForm.regionId" disabled placeholder="自动取自登录校区" /></FormItem>
|
||
|
|
<FormItem label="任务编码">
|
||
|
|
<Select v-model="taskForm.code">
|
||
|
|
<Option value="waimai">外卖订单</Option>
|
||
|
|
<Option value="group">团购订单</Option>
|
||
|
|
<Option value="invite">邀请注册</Option>
|
||
|
|
<Option value="sign">每日签到</Option>
|
||
|
|
</Select>
|
||
|
|
</FormItem>
|
||
|
|
<FormItem label="任务名称"><Input v-model="taskForm.name" /></FormItem>
|
||
|
|
<FormItem label="描述"><Input v-model="taskForm.description" /></FormItem>
|
||
|
|
<FormItem label="奖励券数"><InputNumber v-model="taskForm.rewardTickets" :min="0" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="每日上限"><InputNumber v-model="taskForm.dailyLimit" :min="0" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="排序"><InputNumber v-model="taskForm.sort" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="是否启用">
|
||
|
|
<i-switch v-model="taskForm.enabled" :true-value="1" :false-value="0" />
|
||
|
|
</FormItem>
|
||
|
|
</Form>
|
||
|
|
<div slot="footer">
|
||
|
|
<Button @click="taskModal=false">取消</Button>
|
||
|
|
<Button type="primary" @click="saveTask">保存</Button>
|
||
|
|
</div>
|
||
|
|
</Modal>
|
||
|
|
|
||
|
|
<!-- BUFF编辑 -->
|
||
|
|
<Modal v-model="buffModal" :title="buffForm.id ? '编辑BUFF' : '新增BUFF'" :mask-closable="false">
|
||
|
|
<Form :label-width="90">
|
||
|
|
<FormItem label="所属校区"><Input v-model="buffForm.regionId" disabled placeholder="自动取自登录校区" /></FormItem>
|
||
|
|
<FormItem label="类型">
|
||
|
|
<Select v-model="buffForm.type">
|
||
|
|
<Option value="double">双倍能量</Option>
|
||
|
|
<Option value="shield">星际防护罩</Option>
|
||
|
|
<Option value="lucky">幸运星辰</Option>
|
||
|
|
<Option value="hunt">追猎雷达</Option>
|
||
|
|
<Option value="stealth">隐身斗篷</Option>
|
||
|
|
</Select>
|
||
|
|
</FormItem>
|
||
|
|
<FormItem label="名称"><Input v-model="buffForm.name" /></FormItem>
|
||
|
|
<FormItem label="描述"><Input v-model="buffForm.description" /></FormItem>
|
||
|
|
<FormItem label="消耗券"><InputNumber v-model="buffForm.costTickets" :min="0" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="持续小时"><InputNumber v-model="buffForm.durationHours" :min="0" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="效果值"><InputNumber v-model="buffForm.effectValue" :min="0" :step="0.1" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="排序"><InputNumber v-model="buffForm.sort" style="width:100%" /></FormItem>
|
||
|
|
<FormItem label="是否启用">
|
||
|
|
<i-switch v-model="buffForm.enabled" :true-value="1" :false-value="0" />
|
||
|
|
</FormItem>
|
||
|
|
</Form>
|
||
|
|
<div slot="footer">
|
||
|
|
<Button @click="buffModal=false">取消</Button>
|
||
|
|
<Button type="primary" @click="saveBuff">保存</Button>
|
||
|
|
</div>
|
||
|
|
</Modal>
|
||
|
|
|
||
|
|
<!-- 快讯编辑 -->
|
||
|
|
<Modal v-model="newsModal" :title="newsForm.id ? '编辑快讯' : '新增快讯'" :mask-closable="false">
|
||
|
|
<Form :label-width="90">
|
||
|
|
<FormItem label="所属校区"><Input v-model="newsForm.regionId" disabled placeholder="自动取自登录校区" /></FormItem>
|
||
|
|
<FormItem label="类型">
|
||
|
|
<Select v-model="newsForm.type">
|
||
|
|
<Option value="sys">系统</Option>
|
||
|
|
<Option value="rank">榜单</Option>
|
||
|
|
<Option value="hunt">追捕</Option>
|
||
|
|
<Option value="box">宝箱</Option>
|
||
|
|
<Option value="draw">开奖</Option>
|
||
|
|
</Select>
|
||
|
|
</FormItem>
|
||
|
|
<FormItem label="内容"><Input v-model="newsForm.content" type="textarea" /></FormItem>
|
||
|
|
<FormItem label="置顶">
|
||
|
|
<i-switch v-model="newsForm.isTop" :true-value="1" :false-value="0" />
|
||
|
|
</FormItem>
|
||
|
|
<FormItem label="是否展示">
|
||
|
|
<i-switch v-model="newsForm.enabled" :true-value="1" :false-value="0" />
|
||
|
|
</FormItem>
|
||
|
|
</Form>
|
||
|
|
<div slot="footer">
|
||
|
|
<Button @click="newsModal=false">取消</Button>
|
||
|
|
<Button type="primary" @click="saveNews">保存</Button>
|
||
|
|
</div>
|
||
|
|
</Modal>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import {
|
||
|
|
planetPoolPage, planetPoolSave, planetPoolDelete,
|
||
|
|
planetRewardList, planetRewardSave, planetRewardDelete,
|
||
|
|
planetTaskPage, planetTaskSave, planetTaskDelete,
|
||
|
|
planetBuffPage, planetBuffSave, planetBuffDelete,
|
||
|
|
planetNewsPage, planetNewsSave, planetNewsDelete,
|
||
|
|
planetRankPage, planetHuntPage, planetDrawPage, planetWinnerPage,
|
||
|
|
planetManualDraw
|
||
|
|
} from '@/api/planet';
|
||
|
|
|
||
|
|
export default {
|
||
|
|
name: 'luckey',
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
activeTab: 'pool',
|
||
|
|
regionId: '',
|
||
|
|
pool: { loading: false, data: [], total: 0, pageNumber: 1, pageSize: 10 },
|
||
|
|
task: { loading: false, data: [], total: 0, pageNumber: 1, pageSize: 10 },
|
||
|
|
buff: { loading: false, data: [], total: 0, pageNumber: 1, pageSize: 10 },
|
||
|
|
news: { loading: false, data: [], total: 0, pageNumber: 1, pageSize: 10 },
|
||
|
|
rank: { loading: false, data: [], total: 0, pageNumber: 1, pageSize: 10 },
|
||
|
|
hunt: { loading: false, data: [], total: 0, pageNumber: 1, pageSize: 10 },
|
||
|
|
draw: { loading: false, data: [], total: 0, pageNumber: 1, pageSize: 10 },
|
||
|
|
winner: { loading: false, data: [], total: 0, pageNumber: 1, pageSize: 10 },
|
||
|
|
// 弹窗
|
||
|
|
poolModal: false,
|
||
|
|
poolForm: {},
|
||
|
|
rewardModal: false,
|
||
|
|
rewardList: [],
|
||
|
|
currentPoolId: '',
|
||
|
|
rewardEditModal: false,
|
||
|
|
rewardForm: {},
|
||
|
|
taskModal: false,
|
||
|
|
taskForm: {},
|
||
|
|
buffModal: false,
|
||
|
|
buffForm: {},
|
||
|
|
newsModal: false,
|
||
|
|
newsForm: {}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
computed: {
|
||
|
|
poolColumns() {
|
||
|
|
return [
|
||
|
|
{ title: '期号', key: 'periodNo', minWidth: 120 },
|
||
|
|
{ title: '标题', key: 'title', minWidth: 120 },
|
||
|
|
{ title: '商圈', key: 'regionId', width: 100 },
|
||
|
|
{ title: '奖池金额', key: 'poolAmount', width: 100 },
|
||
|
|
{ title: '开奖时间', key: 'drawTime', minWidth: 160 },
|
||
|
|
{ title: '参与', key: 'joinCount', width: 70 },
|
||
|
|
{ title: '中奖', key: 'winnerCount', width: 70 },
|
||
|
|
{
|
||
|
|
title: '状态', width: 90, render: (h, p) => h('Tag', {
|
||
|
|
props: { color: p.row.status === 1 ? 'green' : 'blue' }
|
||
|
|
}, p.row.status === 1 ? '已开奖' : '进行中')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '操作', width: 280, align: 'center', render: (h, params) => {
|
||
|
|
return h('div', [
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, on: { click: () => this.openPool(params.row) } }, '编辑'),
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, on: { click: () => this.openReward(params.row) } }, '奖项'),
|
||
|
|
h('Button', {
|
||
|
|
props: { type: 'text', size: 'small', disabled: params.row.status === 1 },
|
||
|
|
on: { click: () => this.doManualDraw(params.row) }
|
||
|
|
}, '手动开奖'),
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, style: { color: '#ed4014' }, on: { click: () => this.delPool(params.row) } }, '删除')
|
||
|
|
])
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
rewardColumns() {
|
||
|
|
return [
|
||
|
|
{ title: '层级', key: 'level', width: 70 },
|
||
|
|
{ title: '名称', key: 'levelName', minWidth: 100 },
|
||
|
|
{ title: '类型', width: 80, render: (h, p) => h('span', p.row.rewardType === 1 ? '优惠券' : '现金') },
|
||
|
|
{ title: '金额', key: 'amount', width: 90 },
|
||
|
|
{ title: '名额', key: 'quota', width: 70 },
|
||
|
|
{
|
||
|
|
title: '操作', width: 130, align: 'center', render: (h, params) => {
|
||
|
|
return h('div', [
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, on: { click: () => this.editReward(params.row) } }, '编辑'),
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, style: { color: '#ed4014' }, on: { click: () => this.delReward(params.row) } }, '删除')
|
||
|
|
])
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
taskColumns() {
|
||
|
|
return [
|
||
|
|
{ title: '编码', key: 'code', width: 100 },
|
||
|
|
{ title: '名称', key: 'name', minWidth: 120 },
|
||
|
|
{ title: '描述', key: 'description', minWidth: 180 },
|
||
|
|
{ title: '奖励券', key: 'rewardTickets', width: 80 },
|
||
|
|
{ title: '每日上限', key: 'dailyLimit', width: 90 },
|
||
|
|
{ title: '商圈', key: 'regionId', width: 90 },
|
||
|
|
{ title: '启用', width: 70, render: (h, p) => h('Tag', { props: { color: p.row.enabled === 1 ? 'green' : 'default' } }, p.row.enabled === 1 ? '是' : '否') },
|
||
|
|
{
|
||
|
|
title: '操作', width: 150, align: 'center', render: (h, params) => {
|
||
|
|
return h('div', [
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, on: { click: () => this.openTask(params.row) } }, '编辑'),
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, style: { color: '#ed4014' }, on: { click: () => this.delTask(params.row) } }, '删除')
|
||
|
|
])
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
buffColumns() {
|
||
|
|
return [
|
||
|
|
{ title: '类型', key: 'type', width: 100 },
|
||
|
|
{ title: '名称', key: 'name', minWidth: 120 },
|
||
|
|
{ title: '描述', key: 'description', minWidth: 180 },
|
||
|
|
{ title: '消耗券', key: 'costTickets', width: 80 },
|
||
|
|
{ title: '时长(h)', key: 'durationHours', width: 80 },
|
||
|
|
{ title: '效果值', key: 'effectValue', width: 80 },
|
||
|
|
{ title: '启用', width: 70, render: (h, p) => h('Tag', { props: { color: p.row.enabled === 1 ? 'green' : 'default' } }, p.row.enabled === 1 ? '是' : '否') },
|
||
|
|
{
|
||
|
|
title: '操作', width: 150, align: 'center', render: (h, params) => {
|
||
|
|
return h('div', [
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, on: { click: () => this.openBuff(params.row) } }, '编辑'),
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, style: { color: '#ed4014' }, on: { click: () => this.delBuff(params.row) } }, '删除')
|
||
|
|
])
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
newsColumns() {
|
||
|
|
return [
|
||
|
|
{ title: '类型', key: 'type', width: 90 },
|
||
|
|
{ title: '内容', key: 'content', minWidth: 260 },
|
||
|
|
{ title: '商圈', key: 'regionId', width: 90 },
|
||
|
|
{ title: '置顶', width: 70, render: (h, p) => h('span', p.row.isTop === 1 ? '是' : '否') },
|
||
|
|
{ title: '展示', width: 70, render: (h, p) => h('span', p.row.enabled === 1 ? '是' : '否') },
|
||
|
|
{ title: '时间', key: 'createTime', minWidth: 160 },
|
||
|
|
{
|
||
|
|
title: '操作', width: 150, align: 'center', render: (h, params) => {
|
||
|
|
return h('div', [
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, on: { click: () => this.openNews(params.row) } }, '编辑'),
|
||
|
|
h('Button', { props: { type: 'text', size: 'small' }, style: { color: '#ed4014' }, on: { click: () => this.delNews(params.row) } }, '删除')
|
||
|
|
])
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
rankColumns() {
|
||
|
|
return [
|
||
|
|
{ title: '用户id', key: 'userId', minWidth: 120 },
|
||
|
|
{ title: '昵称', key: 'nickname', minWidth: 120 },
|
||
|
|
{ title: '商圈', key: 'regionId', width: 100 },
|
||
|
|
{ title: '当前券', key: 'ticketCount', width: 90 },
|
||
|
|
{ title: '累计券', key: 'totalTicket', width: 90 },
|
||
|
|
{ title: '连续签到', key: 'consecutiveSignDays', width: 90 },
|
||
|
|
{ title: '霸榜天数', key: 'rankKeepDays', width: 90 }
|
||
|
|
]
|
||
|
|
},
|
||
|
|
huntColumns() {
|
||
|
|
return [
|
||
|
|
{ title: '发起人', key: 'fromUserName', minWidth: 110 },
|
||
|
|
{ title: '目标', key: 'toUserName', minWidth: 110 },
|
||
|
|
{ title: '结果', width: 90, render: (h, p) => h('span', this.huntResultText(p.row.result)) },
|
||
|
|
{ title: '缴获', key: 'gainTickets', width: 70 },
|
||
|
|
{ title: '悬赏', key: 'bountyTickets', width: 70 },
|
||
|
|
{ title: '日期', key: 'huntDate', width: 120 },
|
||
|
|
{ title: '时间', key: 'createTime', minWidth: 160 }
|
||
|
|
]
|
||
|
|
},
|
||
|
|
drawColumns() {
|
||
|
|
return [
|
||
|
|
{ title: '期号', key: 'periodNo', minWidth: 130 },
|
||
|
|
{ title: '商圈', key: 'regionId', width: 100 },
|
||
|
|
{ title: '奖池金额', key: 'poolAmount', width: 100 },
|
||
|
|
{ title: '参与人数', key: 'joinCount', width: 90 },
|
||
|
|
{ title: '券总数', key: 'ticketTotal', width: 90 },
|
||
|
|
{ title: '中奖人数', key: 'winnerCount', width: 90 },
|
||
|
|
{ title: '开奖时间', key: 'drawTime', minWidth: 160 }
|
||
|
|
]
|
||
|
|
},
|
||
|
|
winnerColumns() {
|
||
|
|
return [
|
||
|
|
{ title: '期号', key: 'periodNo', minWidth: 130 },
|
||
|
|
{ title: '中奖人', key: 'userName', minWidth: 110 },
|
||
|
|
{ title: '奖项', key: 'levelName', width: 100 },
|
||
|
|
{ title: '金额', key: 'amount', width: 90 },
|
||
|
|
{ title: '已领取', width: 80, render: (h, p) => h('Tag', { props: { color: p.row.isReceived === 1 ? 'green' : 'orange' } }, p.row.isReceived === 1 ? '已领' : '未领') },
|
||
|
|
{ title: '时间', key: 'createTime', minWidth: 160 }
|
||
|
|
]
|
||
|
|
}
|
||
|
|
},
|
||
|
|
mounted() {
|
||
|
|
// 后台按登录代理商所属校区隔离:regionId 取自登录用户的 departmentId,不允许手动输入
|
||
|
|
this.regionId = this.resolveRegionId()
|
||
|
|
if (this.regionId) {
|
||
|
|
this.loadPool()
|
||
|
|
} else {
|
||
|
|
this.$Message.warning('当前账号未绑定校区,无法管理白嫖星球')
|
||
|
|
}
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
huntResultText(r) {
|
||
|
|
return { success: '缴获成功', shield: '对方防护', fail: '扑空' }[r] || r
|
||
|
|
},
|
||
|
|
onTabChange(name) {
|
||
|
|
const map = {
|
||
|
|
pool: this.loadPool, task: this.loadTask, buff: this.loadBuff,
|
||
|
|
news: this.loadNews, rank: this.loadRank, hunt: this.loadHunt,
|
||
|
|
draw: this.loadDraw, winner: this.loadWinner
|
||
|
|
}
|
||
|
|
map[name] && map[name]()
|
||
|
|
},
|
||
|
|
reloadActive() {
|
||
|
|
this.onTabChange(this.activeTab)
|
||
|
|
},
|
||
|
|
changePage(type, p) {
|
||
|
|
this[type].pageNumber = p
|
||
|
|
this.onTabChange(type)
|
||
|
|
},
|
||
|
|
baseParams(type) {
|
||
|
|
return {
|
||
|
|
pageNumber: this[type].pageNumber,
|
||
|
|
pageSize: this[type].pageSize,
|
||
|
|
regionId: this.regionId || undefined
|
||
|
|
}
|
||
|
|
},
|
||
|
|
fill(type, res) {
|
||
|
|
this[type].loading = false
|
||
|
|
if (res && res.success && res.result) {
|
||
|
|
this[type].data = res.result.records || []
|
||
|
|
this[type].total = res.result.total || 0
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 从登录用户信息中解析所属校区(departmentId)
|
||
|
|
resolveRegionId() {
|
||
|
|
try {
|
||
|
|
const user = this.getStore('user')
|
||
|
|
return user ? (JSON.parse(user).departmentId || '') : ''
|
||
|
|
} catch (e) {
|
||
|
|
return ''
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 抽奖子系统(奖池/开奖/中奖)必须归属校区,仅限本区域内进行
|
||
|
|
guardRegion(type) {
|
||
|
|
if (!this.regionId) {
|
||
|
|
this[type].data = []
|
||
|
|
this[type].total = 0
|
||
|
|
this[type].loading = false
|
||
|
|
this.$Message.warning('当前账号未绑定校区,无法管理白嫖星球')
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
return true
|
||
|
|
},
|
||
|
|
// ---- 列表加载(白嫖星球全部功能均限定商圈,未选商圈不查询) ----
|
||
|
|
loadPool() { if (!this.guardRegion('pool')) return; this.pool.loading = true; planetPoolPage(this.baseParams('pool')).then(r => this.fill('pool', r)) },
|
||
|
|
loadTask() { if (!this.guardRegion('task')) return; this.task.loading = true; planetTaskPage(this.baseParams('task')).then(r => this.fill('task', r)) },
|
||
|
|
loadBuff() { if (!this.guardRegion('buff')) return; this.buff.loading = true; planetBuffPage(this.baseParams('buff')).then(r => this.fill('buff', r)) },
|
||
|
|
loadNews() { if (!this.guardRegion('news')) return; this.news.loading = true; planetNewsPage(this.baseParams('news')).then(r => this.fill('news', r)) },
|
||
|
|
loadRank() { if (!this.guardRegion('rank')) return; this.rank.loading = true; planetRankPage(this.baseParams('rank')).then(r => this.fill('rank', r)) },
|
||
|
|
loadHunt() { if (!this.guardRegion('hunt')) return; this.hunt.loading = true; planetHuntPage(this.baseParams('hunt')).then(r => this.fill('hunt', r)) },
|
||
|
|
loadDraw() { if (!this.guardRegion('draw')) return; this.draw.loading = true; planetDrawPage(this.baseParams('draw')).then(r => this.fill('draw', r)) },
|
||
|
|
loadWinner() { if (!this.guardRegion('winner')) return; this.winner.loading = true; planetWinnerPage(this.baseParams('winner')).then(r => this.fill('winner', r)) },
|
||
|
|
// ---- 奖池 ----
|
||
|
|
openPool(row) {
|
||
|
|
this.poolForm = row ? Object.assign({}, row) : { regionId: this.regionId || '', poolAmount: 88.88, status: 0 }
|
||
|
|
this.poolModal = true
|
||
|
|
},
|
||
|
|
savePool() {
|
||
|
|
const form = Object.assign({}, this.poolForm)
|
||
|
|
if (form.drawTime instanceof Date) {
|
||
|
|
form.drawTime = this.fmt(form.drawTime)
|
||
|
|
}
|
||
|
|
planetPoolSave(form).then(r => {
|
||
|
|
if (r && r.success) {
|
||
|
|
this.$Message.success('保存成功')
|
||
|
|
this.poolModal = false
|
||
|
|
this.loadPool()
|
||
|
|
} else { this.$Message.error((r && r.message) || '保存失败') }
|
||
|
|
})
|
||
|
|
},
|
||
|
|
delPool(row) {
|
||
|
|
this.$Modal.confirm({
|
||
|
|
title: '确认删除', content: '删除奖池将同时删除其奖项配置',
|
||
|
|
onOk: () => planetPoolDelete(row.id).then(() => { this.$Message.success('删除成功'); this.loadPool() })
|
||
|
|
})
|
||
|
|
},
|
||
|
|
doManualDraw(row) {
|
||
|
|
const region = row.regionId || this.regionId
|
||
|
|
if (!region) {
|
||
|
|
this.$Message.warning('该奖池缺少商圈,无法开奖')
|
||
|
|
return
|
||
|
|
}
|
||
|
|
this.$Modal.confirm({
|
||
|
|
title: '确认开奖', content: `立即对期号 ${row.periodNo} 执行加权开奖(商圈 ${region})?`,
|
||
|
|
onOk: () => planetManualDraw(row.id, region).then(r => {
|
||
|
|
if (r && r.success) { this.$Message.success('开奖完成'); this.loadPool() }
|
||
|
|
else { this.$Message.error((r && r.message) || '开奖失败') }
|
||
|
|
})
|
||
|
|
})
|
||
|
|
},
|
||
|
|
// ---- 奖项 ----
|
||
|
|
openReward(row) {
|
||
|
|
this.currentPoolId = row.id
|
||
|
|
this.rewardModal = true
|
||
|
|
this.loadReward()
|
||
|
|
},
|
||
|
|
loadReward() {
|
||
|
|
planetRewardList(this.currentPoolId).then(r => {
|
||
|
|
if (r && r.success) this.rewardList = r.result || []
|
||
|
|
})
|
||
|
|
},
|
||
|
|
addRewardRow() {
|
||
|
|
this.rewardForm = { poolId: this.currentPoolId, regionId: this.regionId || '', level: 1, rewardType: 0, amount: 0, quota: 1, sort: 0 }
|
||
|
|
this.rewardEditModal = true
|
||
|
|
},
|
||
|
|
editReward(row) {
|
||
|
|
this.rewardForm = Object.assign({}, row)
|
||
|
|
this.rewardEditModal = true
|
||
|
|
},
|
||
|
|
saveReward() {
|
||
|
|
planetRewardSave(this.rewardForm).then(r => {
|
||
|
|
if (r && r.success) { this.$Message.success('保存成功'); this.rewardEditModal = false; this.loadReward() }
|
||
|
|
else { this.$Message.error((r && r.message) || '保存失败') }
|
||
|
|
})
|
||
|
|
},
|
||
|
|
delReward(row) {
|
||
|
|
planetRewardDelete(row.id).then(() => { this.$Message.success('删除成功'); this.loadReward() })
|
||
|
|
},
|
||
|
|
// ---- 任务 ----
|
||
|
|
openTask(row) {
|
||
|
|
this.taskForm = row ? Object.assign({}, row) : { regionId: this.regionId || '', code: 'waimai', rewardTickets: 1, dailyLimit: 0, sort: 0, enabled: 1 }
|
||
|
|
this.taskModal = true
|
||
|
|
},
|
||
|
|
saveTask() {
|
||
|
|
planetTaskSave(this.taskForm).then(r => {
|
||
|
|
if (r && r.success) { this.$Message.success('保存成功'); this.taskModal = false; this.loadTask() }
|
||
|
|
else { this.$Message.error((r && r.message) || '保存失败') }
|
||
|
|
})
|
||
|
|
},
|
||
|
|
delTask(row) {
|
||
|
|
planetTaskDelete(row.id).then(() => { this.$Message.success('删除成功'); this.loadTask() })
|
||
|
|
},
|
||
|
|
// ---- BUFF ----
|
||
|
|
openBuff(row) {
|
||
|
|
this.buffForm = row ? Object.assign({}, row) : { regionId: this.regionId || '', type: 'double', costTickets: 5, durationHours: 24, effectValue: 0, sort: 0, enabled: 1 }
|
||
|
|
this.buffModal = true
|
||
|
|
},
|
||
|
|
saveBuff() {
|
||
|
|
planetBuffSave(this.buffForm).then(r => {
|
||
|
|
if (r && r.success) { this.$Message.success('保存成功'); this.buffModal = false; this.loadBuff() }
|
||
|
|
else { this.$Message.error((r && r.message) || '保存失败') }
|
||
|
|
})
|
||
|
|
},
|
||
|
|
delBuff(row) {
|
||
|
|
planetBuffDelete(row.id).then(() => { this.$Message.success('删除成功'); this.loadBuff() })
|
||
|
|
},
|
||
|
|
// ---- 快讯 ----
|
||
|
|
openNews(row) {
|
||
|
|
this.newsForm = row ? Object.assign({}, row) : { regionId: this.regionId || '', type: 'sys', isTop: 0, enabled: 1 }
|
||
|
|
this.newsModal = true
|
||
|
|
},
|
||
|
|
saveNews() {
|
||
|
|
planetNewsSave(this.newsForm).then(r => {
|
||
|
|
if (r && r.success) { this.$Message.success('保存成功'); this.newsModal = false; this.loadNews() }
|
||
|
|
else { this.$Message.error((r && r.message) || '保存失败') }
|
||
|
|
})
|
||
|
|
},
|
||
|
|
delNews(row) {
|
||
|
|
planetNewsDelete(row.id).then(() => { this.$Message.success('删除成功'); this.loadNews() })
|
||
|
|
},
|
||
|
|
fmt(d) {
|
||
|
|
const p = n => (n < 10 ? '0' + n : n)
|
||
|
|
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style scoped>
|
||
|
|
.region-bar {
|
||
|
|
margin-bottom: 16px;
|
||
|
|
}
|
||
|
|
.region-bar .ivu-input-wrapper {
|
||
|
|
margin-right: 12px;
|
||
|
|
}
|
||
|
|
.page {
|
||
|
|
margin-top: 16px;
|
||
|
|
}
|
||
|
|
</style>
|