修改提示语
This commit is contained in:
@@ -21,16 +21,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<button class="btn btn-default" @click="btnAdd">
|
||||
<button id="btnAdd" class="btn btn-default">
|
||||
<i class="glyphicon glyphicon-plus-sign"></i>新增
|
||||
</button>
|
||||
<button class="btn btn-default" @click="btnDeploy">
|
||||
<button id="btnDeploy" class="btn btn-default">
|
||||
<i class="glyphicon glyphicon-plus-sign"></i>发布
|
||||
</button>
|
||||
<button class="btn btn-default" @click="btnDeployed">
|
||||
<button id="btnDeployed" class="btn btn-default">
|
||||
<i class="glyphicon glyphicon-plus-sign"></i>已发布奖池
|
||||
</button>
|
||||
<button class="btn btn-default" @click="btnSearch">
|
||||
<button id="btnSearch" class="btn btn-default">
|
||||
<i class="glyphicon glyphicon-search"></i>查询
|
||||
</button>
|
||||
</div>
|
||||
@@ -165,233 +165,204 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(function () {
|
||||
this.initTable();
|
||||
this.showPoolItemCount();
|
||||
this.initData();
|
||||
showPoolCount();
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.optEdit();
|
||||
},
|
||||
methods: {
|
||||
initTable() {
|
||||
$(function () {
|
||||
$('#table').bootstrapTable('destroy');
|
||||
$('#table').bootstrapTable({
|
||||
columns: [
|
||||
{
|
||||
field: 'poolType',
|
||||
title: '奖池类型',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
var value = '';
|
||||
if (val == '1') {
|
||||
value = '密藏奖池';
|
||||
} else if (val == '2') {
|
||||
value = '幸运值奖池';
|
||||
} else if (val == '3') {
|
||||
value = '森林奖池';
|
||||
} else if (val == '4') {
|
||||
value = '合成奖池';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'poolGroup',
|
||||
title: '奖池分组',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
var value = '';
|
||||
if (val == '1') {
|
||||
value = '基础奖池';
|
||||
} else if (val == '2') {
|
||||
value = '高级奖池';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'poolLevel',
|
||||
title: '奖池等级',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
var value = '';
|
||||
if (val == '1') {
|
||||
value = '基础奖池';
|
||||
} else if (val == '2') {
|
||||
value = '中级奖池';
|
||||
} else if (val == '3') {
|
||||
value = '高级奖池';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{ field: 'rewardName', title: '奖品名称', align: 'center', width: '5%' },
|
||||
{ field: 'rewardValue', title: '平台价值', align: 'center', width: '5%' },
|
||||
{ field: 'rewardShowValue', title: '平台展示价值', align: 'center', width: '5%' },
|
||||
{ field: 'poolNum', title: '个数', align: 'center', width: '5%' },
|
||||
{
|
||||
field: 'totalRewardValue',
|
||||
title: '总价值',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
return row.rewardValue * row.poolNum;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'ratio',
|
||||
title: '概率',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
let value = 0;
|
||||
if (val) {
|
||||
value = (val / 1000000 * 100).toFixed(4);
|
||||
}
|
||||
return value + '%';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'showRatio',
|
||||
title: '展示概率',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
let value = 0;
|
||||
if (val) {
|
||||
value = (val / 1000).toFixed(4);
|
||||
}
|
||||
return value + '%';
|
||||
}
|
||||
},
|
||||
{ field: 'itemIndex', title: '显示位置', align: 'center', width: '5%' },
|
||||
{ field: 'itemOrder', title: '排序', align: 'center', width: '5%' },
|
||||
{
|
||||
field: 'handle',
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
valign: 'middle',
|
||||
formatter: function (val, row, index) {
|
||||
return '<button class="btn btn-sm btn-success opt-edit" data-index="' + index + '">编辑</button>';
|
||||
initData() {
|
||||
$('#table').bootstrapTable('destroy');
|
||||
$('#table').bootstrapTable({
|
||||
columns: [
|
||||
{
|
||||
field: 'poolType',
|
||||
title: '奖池类型',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
var value = '';
|
||||
if (val == '1') {
|
||||
value = '密藏奖池';
|
||||
} else if (val == '2') {
|
||||
value = '幸运值奖池';
|
||||
} else if (val == '3') {
|
||||
value = '森林奖池';
|
||||
} else if (val == '4') {
|
||||
value = '合成奖池';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
],
|
||||
cache: false,
|
||||
striped: true,
|
||||
showRefresh: false,
|
||||
pageSize: 20,
|
||||
pagination: true,
|
||||
pageList: [20, 50, 100],
|
||||
search: false,
|
||||
sidePagination: "server",
|
||||
queryParamsType: "undefined",
|
||||
queryParams: function queryParams(params) {
|
||||
var param = {
|
||||
page: params.pageNumber,
|
||||
pageSize: params.pageSize,
|
||||
poolType: 1,
|
||||
poolGroup: $('#searchPoolGroup').val(),
|
||||
};
|
||||
return param;
|
||||
},
|
||||
toolbar: '#toolbar',
|
||||
url: '/admin/seize-treasure/pool/item/page',
|
||||
onLoadSuccess: function () {
|
||||
console.log("load success");
|
||||
{
|
||||
field: 'poolGroup',
|
||||
title: '奖池分组',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
var value = '';
|
||||
if (val == '1') {
|
||||
value = '基础奖池';
|
||||
} else if (val == '2') {
|
||||
value = '高级奖池';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
onLoadError: function () {
|
||||
console.log("load fail");
|
||||
{
|
||||
field: 'poolLevel',
|
||||
title: '奖池等级',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
var value = '';
|
||||
if (val == '1') {
|
||||
value = '基础奖池';
|
||||
} else if (val == '2') {
|
||||
value = '中级奖池';
|
||||
} else if (val == '3') {
|
||||
value = '高级奖池';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{ field: 'rewardName', title: '奖品名称', align: 'center', width: '5%' },
|
||||
{ field: 'rewardValue', title: '平台价值', align: 'center', width: '5%' },
|
||||
{ field: 'rewardShowValue', title: '平台展示价值', align: 'center', width: '5%' },
|
||||
{ field: 'poolNum', title: '个数', align: 'center', width: '5%' },
|
||||
{
|
||||
field: 'totalRewardValue',
|
||||
title: '总价值',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
return row.rewardValue * row.poolNum;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'ratio',
|
||||
title: '概率',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
let value = 0;
|
||||
if (val) {
|
||||
value = (val / 1000000 * 100).toFixed(4);
|
||||
}
|
||||
return value + '%';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'showRatio',
|
||||
title: '展示概率',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
let value = 0;
|
||||
if (val) {
|
||||
value = (val / 1000).toFixed(4);
|
||||
}
|
||||
return value + '%';
|
||||
}
|
||||
},
|
||||
{ field: 'itemIndex', title: '显示位置', align: 'center', width: '5%' },
|
||||
{ field: 'itemOrder', title: '排序', align: 'center', width: '5%' },
|
||||
{
|
||||
field: 'handle',
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
valign: 'middle',
|
||||
formatter: function (val, row, index) {
|
||||
return '<button class="btn btn-sm btn-success opt-edit" data-index="' + index + '">编辑</button>';
|
||||
}
|
||||
}
|
||||
],
|
||||
cache: false,
|
||||
striped: true,
|
||||
showRefresh: false,
|
||||
pageSize: 20,
|
||||
pagination: true,
|
||||
pageList: [20, 50, 100],
|
||||
search: false,
|
||||
sidePagination: "server",
|
||||
queryParamsType: "undefined",
|
||||
queryParams: function queryParams(params) {
|
||||
var param = {
|
||||
page: params.pageNumber,
|
||||
pageSize: params.pageSize,
|
||||
poolType: 1,
|
||||
poolGroup: $('#searchPoolGroup').val(),
|
||||
};
|
||||
return param;
|
||||
},
|
||||
toolbar: '#toolbar',
|
||||
url: '/admin/seize-treasure/pool/item/page',
|
||||
onLoadSuccess: function () {
|
||||
console.log("load success");
|
||||
},
|
||||
onLoadError: function () {
|
||||
console.log("load fail");
|
||||
}
|
||||
});
|
||||
|
||||
$("#btnSearch").click(function () {
|
||||
TableHelper.doRefresh('#table');
|
||||
showPoolCount();
|
||||
});
|
||||
|
||||
$("#btnAdd").click(function () {
|
||||
$("#id").val('');
|
||||
$("#rewardId").val('');
|
||||
$("#poolType").val('');
|
||||
$('#poolGroup').val('');
|
||||
$('#poolLevel').val('');
|
||||
$("#poolNum").val('');
|
||||
$("#ratio").val('');
|
||||
$("#showRatio").val('');
|
||||
$("#itemIndex").val('');
|
||||
$("#itemOrder").val('');
|
||||
showReward();
|
||||
$("#editModal").modal('show');
|
||||
});
|
||||
|
||||
$("#btnDeploy").click(function () {
|
||||
deployPoolItem({
|
||||
poolType: 1
|
||||
}).then(res => {
|
||||
if(apiResult(res)) {
|
||||
$("#tipMsg").text("发布成功");
|
||||
$("#tipModal").modal('show');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
btnSearch() {
|
||||
TableHelper.doRefresh('#table');
|
||||
this.showPoolItemCount();
|
||||
},
|
||||
showPoolItemCount() {
|
||||
showPoolItemCount({
|
||||
poolType: 1,
|
||||
poolGroup: $('#poolGroup').val()
|
||||
}).then(res => {
|
||||
let data = res.data;
|
||||
$('#giftCount').html(data.giftCount);
|
||||
$('#giftValue').html(data.giftValue);
|
||||
$('#rewardLineCount').html(data.rewardLineCount);
|
||||
$('#rewardLineNum').html(data.rewardLineNum);
|
||||
$('#totalGiftValue').html(data.totalGiftValue);
|
||||
$('#singleLineRatio').html(data.singleLineRatio.toFixed(6) + '%');
|
||||
});
|
||||
},
|
||||
showReward(rewardId) {
|
||||
getRewardList().then(res => {
|
||||
const data = res.data;
|
||||
if (data && data.length > 0) {
|
||||
let $select = $('#rewardId');
|
||||
for (let i = 0, len = data.length; i < len; i++) {
|
||||
let reward = data[i];
|
||||
let $option = $('<option/>');
|
||||
$option.attr('value', reward.id);
|
||||
$option.data('name', reward.rewardName);
|
||||
$option.html(reward.rewardName);
|
||||
if (rewardId && rewardId == reward.id) {
|
||||
$option.attr('selected', true);
|
||||
}
|
||||
$select.append($option);
|
||||
$("#btnDeployed").click(function () {
|
||||
deployedPoolItem({
|
||||
poolType: 1
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
const data = res.data;
|
||||
const seniorSize = data.seniorPoolItems.map(i => i.num).reduce((prev, cur) => prev + cur);
|
||||
const normalSize = data.normalPoolItems.map(i => i.num).reduce((prev, cur) => prev + cur);
|
||||
$('#deployedSeniorSize').html(seniorSize);
|
||||
$('#deployedNormalSize').html(normalSize);
|
||||
$('#deployedTotalSize').html(seniorSize + seniorSize * normalSize);
|
||||
const seniorItems = data.seniorPoolItems.sort((a, b) => b.num - a.num).map(i => {
|
||||
return `${i.rewardRefId}-${i.rewardName} x ${i.poolNum}`
|
||||
}).join(",");
|
||||
const normalItems = data.normalPoolItems.sort((a, b) => b.num - a.num).map(i => {
|
||||
return `${i.rewardRefId}-${i.rewardName} x ${i.poolNum}`
|
||||
}).join(",");
|
||||
$('#deployedSeniorItems').html(seniorItems);
|
||||
$('#deployedNormalItems').html(normalItems);
|
||||
}
|
||||
}
|
||||
});
|
||||
$("#deployedModal").modal('show');
|
||||
});
|
||||
},
|
||||
btnAdd() {
|
||||
$("#id").val('');
|
||||
$("#rewardId").val('');
|
||||
$("#poolType").val('');
|
||||
$('#poolGroup').val('');
|
||||
$('#poolLevel').val('');
|
||||
$("#poolNum").val('');
|
||||
$("#ratio").val('');
|
||||
$("#showRatio").val('');
|
||||
$("#itemIndex").val('');
|
||||
$("#itemOrder").val('');
|
||||
this.showReward();
|
||||
$("#editModal").modal('show');
|
||||
},
|
||||
btnDeploy() {
|
||||
deployPoolItem({
|
||||
poolType: 1
|
||||
}).then(res => {
|
||||
apiResult(res);
|
||||
});
|
||||
},
|
||||
btnDeployed() {
|
||||
deployedPoolItem({
|
||||
poolType: 1
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
const data = res.data;
|
||||
const seniorSize = data.seniorPoolItems.map(i => i.num).reduce((prev, cur) => prev + cur);
|
||||
const normalSize = data.normalPoolItems.map(i => i.num).reduce((prev, cur) => prev + cur);
|
||||
$('#deployedSeniorSize').html(seniorSize);
|
||||
$('#deployedNormalSize').html(normalSize);
|
||||
$('#deployedTotalSize').html(seniorSize + seniorSize * normalSize);
|
||||
const seniorItems = data.seniorPoolItems.sort((a, b) => b.num - a.num).map(i => {
|
||||
return `${i.rewardRefId}-${i.rewardName} x ${i.poolNum}`
|
||||
}).join(",");
|
||||
const normalItems = data.normalPoolItems.sort((a, b) => b.num - a.num).map(i => {
|
||||
return `${i.rewardRefId}-${i.rewardName} x ${i.poolNum}`
|
||||
}).join(",");
|
||||
$('#deployedSeniorItems').html(seniorItems);
|
||||
$('#deployedNormalItems').html(normalItems);
|
||||
}
|
||||
});
|
||||
$("#deployedModal").modal('show');
|
||||
},
|
||||
optEdit() {
|
||||
$('#table').on('click', '.opt-edit', function () {
|
||||
const currentData = $('#table').bootstrapTable('getData')[$(this).data('index')];
|
||||
@@ -417,7 +388,7 @@ export default {
|
||||
$("#itemOrder").val(itemOrder);
|
||||
$("#editModal").modal('show');
|
||||
});
|
||||
this.showReward($('#rewardId').val());
|
||||
showReward($('#rewardId').val());
|
||||
},
|
||||
save() {
|
||||
let data = {
|
||||
@@ -436,17 +407,55 @@ export default {
|
||||
data.id = id;
|
||||
}
|
||||
savePoolItem(data).then(res => {
|
||||
apiResult(res);
|
||||
if(apiResult(res)) {
|
||||
$("#tipMsg").text("保存成功");
|
||||
$("#tipModal").modal('show');
|
||||
}
|
||||
TableHelper.doRefresh('#table');
|
||||
$("#editModal").modal('hide');
|
||||
});
|
||||
this.showPoolItemCount();
|
||||
showPoolCount();
|
||||
}
|
||||
},
|
||||
unmounted() {
|
||||
$('#table').bootstrapTable('destroy');
|
||||
}
|
||||
};
|
||||
|
||||
function showPoolCount() {
|
||||
showPoolItemCount({
|
||||
poolType: 1,
|
||||
poolGroup: $('#poolGroup').val()
|
||||
}).then(res => {
|
||||
let data = res.data;
|
||||
$('#giftCount').html(data.giftCount);
|
||||
$('#giftValue').html(data.giftValue);
|
||||
$('#rewardLineCount').html(data.rewardLineCount);
|
||||
$('#rewardLineNum').html(data.rewardLineNum);
|
||||
$('#totalGiftValue').html(data.totalGiftValue);
|
||||
$('#singleLineRatio').html(data.singleLineRatio.toFixed(6) + '%');
|
||||
});
|
||||
}
|
||||
|
||||
function showReward(rewardId) {
|
||||
getRewardList().then(res => {
|
||||
const data = res.data;
|
||||
if (data && data.length > 0) {
|
||||
let $select = $('#rewardId');
|
||||
for (let i = 0, len = data.length; i < len; i++) {
|
||||
let reward = data[i];
|
||||
let $option = $('<option/>');
|
||||
$option.attr('value', reward.id);
|
||||
$option.data('name', reward.rewardName);
|
||||
$option.html(reward.rewardName);
|
||||
if (rewardId && rewardId == reward.id) {
|
||||
$option.attr('selected', true);
|
||||
}
|
||||
$select.append($option);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
Reference in New Issue
Block a user