对接完成接口-周卡

This commit is contained in:
dragon
2024-07-15 12:21:29 +08:00
parent fcefd9e09d
commit cb54148f6e
3 changed files with 248 additions and 28 deletions

View File

@@ -80,6 +80,14 @@ export const weekCardTabList = query => {
params: query params: query
}); });
}; };
// 周卡TAB-保存
export const weekCardTabSave = query => {
return request({
url: '/admin/weekCardTab/save',
method: 'post',
data: query
});
};
// 周卡激励统计-列表 // 周卡激励统计-列表
export const weekCardRecordPage = query => { export const weekCardRecordPage = query => {
return request({ return request({

View File

@@ -28,6 +28,8 @@
@click=" @click="
controlsDialog = true; controlsDialog = true;
controlsObjNew = scope.row; controlsObjNew = scope.row;
controlsObj.value = controlsObjNew.partitionId;
controlsObj.num = controlsObjNew.showAmount;
" "
class="primary" class="primary"
type="primary" type="primary"
@@ -107,6 +109,7 @@
import { import {
weekCardTabList, weekCardTabList,
listPartitionInfo, listPartitionInfo,
weekCardTabSave,
} from "@/api/weeklyCard/weeklyCard"; } from "@/api/weeklyCard/weeklyCard";
import { dateFormat } from "@/utils/system-helper"; import { dateFormat } from "@/utils/system-helper";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
@@ -170,8 +173,23 @@ export default {
}); });
}, },
// 确认编辑按钮 // 确认编辑按钮
controlsDialogOut(){ controlsDialogOut() {
console.log(this.controlsObjNew); weekCardTabSave({
showAmount: this.controlsObj.num,
partitionId: this.controlsObj.value,
id: this.controlsObjNew.id,
}).then((res) => {
if (res.code === 200) {
this.getData();
this.controlsDialog = false;
} else {
ElMessage({
showClose: true,
message: res.message,
type: "error",
});
}
});
}, },
// 分页导航 // 分页导航
handleSizeChange(size) { handleSizeChange(size) {

View File

@@ -44,8 +44,12 @@
style="width: 100%; margin-top: 25px" style="width: 100%; margin-top: 25px"
> >
<el-table-column prop="id" align="center" label="ID" /> <el-table-column prop="id" align="center" label="ID" />
<el-table-column prop="x" align="center" label="日期" /> <el-table-column prop="groupName" align="center" label="日期" />
<el-table-column prop="x" align="center" label="金币" /> <el-table-column prop="rewardType" align="center" label="金币">
<template v-slot="scope">
{{ scope.row.rewardType == 1 ? scope.row.rewardNum : "/" }}
</template>
</el-table-column>
<el-table-column prop="rewardType" align="center" label="礼物类型" /> <el-table-column prop="rewardType" align="center" label="礼物类型" />
<el-table-column prop="rewardName" align="center" label="礼物名称" /> <el-table-column prop="rewardName" align="center" label="礼物名称" />
<el-table-column prop="rewardPrice" align="center" label="礼物价值" /> <el-table-column prop="rewardPrice" align="center" label="礼物价值" />
@@ -72,7 +76,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="cardIcon" prop="rewardIcon"
label="奖励ICON" label="奖励ICON"
width="120" width="120"
> >
@@ -91,10 +95,7 @@
<el-table-column align="center" label="操作"> <el-table-column align="center" label="操作">
<template v-slot="scope"> <template v-slot="scope">
<el-button <el-button
@click=" @click="eid(scope)"
controlsDialog = true;
controlsObjNew = scope.row;
"
class="primary" class="primary"
type="primary" type="primary"
size="default" size="default"
@@ -105,10 +106,10 @@
delDialog = true; delDialog = true;
delObj = scope.row; delObj = scope.row;
" "
class="danger" :class="scope.row.isEnabled == 1 ? 'danger' : 'primary'"
type="danger" :type="scope.row.isEnabled == 1 ? 'danger' : 'primary'"
size="default" size="default"
>下线</el-button >{{ scope.row.isEnabled == 1 ? "下线" : "上线" }}</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
@@ -137,13 +138,15 @@
<!-- 输入日期 --> <!-- 输入日期 -->
<div class="selectBox"> <div class="selectBox">
<span class="left" style="margin-right: 20px">输入日期</span> <span class="left" style="margin-right: 20px">输入日期</span>
<el-input <el-select filterable v-model="operation.days" placeholder="请选择">
v-model="operation.days" <el-option
size="default" v-for="item in operation.optionsDays"
placeholder="例如:第一天、第二天..." :key="item.id"
class="right" :label="item.desc"
style="width: 70%" :value="item.id"
></el-input> >
</el-option>
</el-select>
</div> </div>
<!-- 金币数量 --> <!-- 金币数量 -->
<div class="selectBox"> <div class="selectBox">
@@ -151,7 +154,7 @@
<el-input <el-input
v-model="operation.gameName" v-model="operation.gameName"
size="default" size="default"
placeholder="请输入游戏昵称..." placeholder=""
class="right" class="right"
style="width: 70%" style="width: 70%"
></el-input> ></el-input>
@@ -207,7 +210,12 @@
class="col-sm-2 control-label" class="col-sm-2 control-label"
>奖励</span >奖励</span
> >
<el-select filterable v-model="operation.value2" placeholder="请选择"> <el-select
filterable
v-model="operation.value2"
@change="operationChange(e)"
placeholder="请选择"
>
<el-option <el-option
v-for="item in operation.options2" v-for="item in operation.options2"
:key="item.id" :key="item.id"
@@ -218,7 +226,7 @@
? JsonFunc(item.name).zh ? JsonFunc(item.name).zh
: item.name : item.name
" "
:value="item.id" :value="operation.value == 2 ? item.giftId : item.id"
> >
<!-- item.name --> <!-- item.name -->
</el-option> </el-option>
@@ -235,8 +243,8 @@
style="width: 70%" style="width: 70%"
></el-input> ></el-input>
</div> </div>
<!-- 奖励个数 --> <!-- 奖励个数v-show="!operationIsShow" -->
<div v-show="!operationIsShow" class="selectBox"> <div class="selectBox">
<span class="left" style="margin-right: 20px">奖励个数</span> <span class="left" style="margin-right: 20px">奖励个数</span>
<el-input <el-input
v-model="operation.rewardGoldNum" v-model="operation.rewardGoldNum"
@@ -308,6 +316,7 @@ export default {
value: "", value: "",
options: [], options: [],
value2: "", value2: "",
value22: "",
options2: [ options2: [
{ desc: "初级周卡", id: 1 }, { desc: "初级周卡", id: 1 },
{ desc: "中级周卡", id: 2 }, { desc: "中级周卡", id: 2 },
@@ -334,6 +343,15 @@ export default {
operatioObj: {}, operatioObj: {},
operation: { operation: {
days: "", days: "",
optionsDays: [
{ desc: "第一天", id: 1 },
{ desc: "第二天", id: 2 },
{ desc: "第三天", id: 3 },
{ desc: "第四天", id: 4 },
{ desc: "第五天", id: 5 },
{ desc: "第六天", id: 6 },
{ desc: "第七天", id: 7 },
],
gameName: "", gameName: "",
imageUrl1: "", imageUrl1: "",
value: "", value: "",
@@ -347,6 +365,7 @@ export default {
{ desc: "座驾", id: 3 }, { desc: "座驾", id: 3 },
], ],
value2: "", value2: "",
value22: "",
options2: [], options2: [],
rewardDays: "", rewardDays: "",
rewardGoldNum: "", rewardGoldNum: "",
@@ -359,12 +378,12 @@ export default {
}; };
}, },
created() { created() {
// this.getData(); this.getData();
listPartitionInfo().then((res) => { listPartitionInfo().then((res) => {
this.inquire.options = res.data; this.inquire.options = res.data;
}); });
this.loading = true;
getAll().then((res) => { getAll().then((res) => {
this.loading = true;
this.giftArr = res.data; this.giftArr = res.data;
carAll().then((res) => { carAll().then((res) => {
this.carArr = res.data; this.carArr = res.data;
@@ -385,6 +404,25 @@ export default {
}); });
}, },
methods: { methods: {
// 上线下线
delClick() {
updateEnabled({
weekCardId: this.delObj.id,
isEnabled: !this.delObj.isEnabled == true ? 1 : 2,
}).then((res) => {
if (res.code === 200) {
this.getData();
this.loading = false;
this.delDialog = false;
} else {
ElMessage({
showClose: true,
message: res.message,
type: "error",
});
}
});
},
getData() { getData() {
this.loading = true; this.loading = true;
weekCardPage({ weekCardPage({
@@ -397,6 +435,7 @@ export default {
if (res.code === 200) { if (res.code === 200) {
this.tableData = res.data.records; this.tableData = res.data.records;
this.total = res.data.total; this.total = res.data.total;
this.loading = false;
} else { } else {
ElMessage({ ElMessage({
showClose: true, showClose: true,
@@ -404,7 +443,6 @@ export default {
type: "error", type: "error",
}); });
} }
this.loading = false;
}) })
.catch((error) => { .catch((error) => {
console.error("请求出错:", error); console.error("请求出错:", error);
@@ -447,10 +485,42 @@ export default {
} }
} }
}, },
operationChange() {
this.operation.options2.forEach((res, i) => {
if (this.operation.value == 2) {
if (res.giftId == this.operation.value2) {
this.operation.value22 =
this.operation.value == 2
? this.JsonFunc(res.giftName).zh
: this.operation.value == 16 || this.operation.value == 17
? this.JsonFunc(res.name).zh
: res.name;
}
} else {
if (res.id == this.operation.value2) {
this.operation.value22 =
this.operation.value == 2
? this.JsonFunc(res.giftName).zh
: this.operation.value == 16 || this.operation.value == 17
? this.JsonFunc(res.name).zh
: res.name;
}
}
});
},
// 新增 // 新增
add() { add() {
this.operation = { this.operation = {
days: "", days: "",
optionsDays: [
{ desc: "第一天", id: 1 },
{ desc: "第二天", id: 2 },
{ desc: "第三天", id: 3 },
{ desc: "第四天", id: 4 },
{ desc: "第五天", id: 5 },
{ desc: "第六天", id: 6 },
{ desc: "第七天", id: 7 },
],
gameName: "", gameName: "",
imageUrl1: "", imageUrl1: "",
value: "", value: "",
@@ -473,14 +543,136 @@ export default {
this.operationTitle = "添加"; this.operationTitle = "添加";
this.operationDialog = true; this.operationDialog = true;
}, },
// 编辑
eid(scope) {
this.operationDialog = true;
this.operatioObj = scope.row;
this.operation = {
days: this.operatioObj.groupId,
optionsDays: [
{ desc: "第一天", id: 1 },
{ desc: "第二天", id: 2 },
{ desc: "第三天", id: 3 },
{ desc: "第四天", id: 4 },
{ desc: "第五天", id: 5 },
{ desc: "第六天", id: 6 },
{ desc: "第七天", id: 7 },
],
gameName: this.operatioObj.rewardValue,
imageUrl1: this.operatioObj.cardIcon,
value: this.operatioObj.rewardType,
options: [
{ desc: "金币", id: 1 },
{ desc: "礼物", id: 2 },
{ desc: "铭牌", id: 14 },
{ desc: "头饰", id: 4 },
{ desc: "气泡", id: 16 },
{ desc: "资料卡", id: 17 },
{ desc: "座驾", id: 3 },
],
value2: this.operatioObj.rewardId,
options2:
this.operatioObj.rewardType == 2
? this.giftArr
: this.operatioObj.rewardType == 3
? this.carArr
: this.operatioObj.rewardType == 4
? this.headArr
: this.operatioObj.rewardType == 14
? this.nameplateArr
: this.operatioObj.rewardType == 16
? this.bubbleArr
: this.operatioObj.rewardType == 17
? this.cardArr
: "",
rewardDays: this.operatioObj.rewardValue,
rewardGoldNum: this.operatioObj.rewardNum,
seqNo: this.operatioObj.seqNo,
};
this.operationType = 2;
this.operationTitle = "编辑";
this.operationDialog = true;
},
// 确认按钮 // 确认按钮
operationClick() { operationClick() {
console.log(this.operatioObj);
if (this.operationType == 1) { if (this.operationType == 1) {
// 新增 // 新增
weekCardSave({}) weekCardSave({
groupId: this.operation.days,
groupName:
this.operation.days == 1
? "第一天"
: this.operation.days == 2
? "第二天"
: this.operation.days == 3
? "第三天"
: this.operation.days == 4
? "第四天"
: this.operation.days == 5
? "第五天"
: this.operation.days == 6
? "第六天"
: "第七天",
cardIcon: this.operation.imageUrl1,
rewardType: this.operation.value,
rewardId: this.operation.value2,
rewardName: this.operation.value22,
rewardNum: this.operation.rewardGoldNum,
seqNo: this.operation.seqNo,
})
.then((res) => {
if (res.code === 200) {
this.operationDialog = false;
this.getData();
this.loading = false;
} else {
ElMessage({
showClose: true,
message: res.message || "获取数据失败",
type: "error",
});
}
})
.catch((error) => {
console.error("请求出错:", error);
ElMessage({
showClose: true,
message: "请求出错,请稍后重试",
type: "error",
});
});
} else {
// 编辑
weekCardSave({
groupId: this.operation.days,
groupName:
this.operation.days == 1
? "第一天"
: this.operation.days == 2
? "第二天"
: this.operation.days == 3
? "第三天"
: this.operation.days == 4
? "第四天"
: this.operation.days == 5
? "第五天"
: this.operation.days == 6
? "第六天"
: "第七天",
cardIcon: this.operation.imageUrl1,
rewardType: this.operation.value,
rewardId: this.operation.value2,
rewardName: this.operation.value22,
rewardNum: this.operation.rewardGoldNum,
seqNo: this.operation.seqNo,
id: this.operatioObj.id,
})
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.getData(); this.getData();
this.operationDialog = false;
this.loading = false; this.loading = false;
} else { } else {
ElMessage({ ElMessage({
@@ -528,10 +720,12 @@ export default {
handleSizeChange(size) { handleSizeChange(size) {
this.pageSize = size; this.pageSize = size;
this.getData(); this.getData();
this.loading = false;
}, },
handleCurrentChange(page) { handleCurrentChange(page) {
this.currentPage = page; this.currentPage = page;
this.getData(); this.getData();
this.loading = false;
}, },
JsonFunc(val) { JsonFunc(val) {
var res = JSON.parse(val); var res = JSON.parse(val);