对接完成接口-周卡

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
});
};
// 周卡TAB-保存
export const weekCardTabSave = query => {
return request({
url: '/admin/weekCardTab/save',
method: 'post',
data: query
});
};
// 周卡激励统计-列表
export const weekCardRecordPage = query => {
return request({

View File

@@ -28,6 +28,8 @@
@click="
controlsDialog = true;
controlsObjNew = scope.row;
controlsObj.value = controlsObjNew.partitionId;
controlsObj.num = controlsObjNew.showAmount;
"
class="primary"
type="primary"
@@ -107,6 +109,7 @@
import {
weekCardTabList,
listPartitionInfo,
weekCardTabSave,
} from "@/api/weeklyCard/weeklyCard";
import { dateFormat } from "@/utils/system-helper";
import { ElMessage } from "element-plus";
@@ -170,8 +173,23 @@ export default {
});
},
// 确认编辑按钮
controlsDialogOut(){
console.log(this.controlsObjNew);
controlsDialogOut() {
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) {

View File

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