提交 acc9bb5d 作者: 毛细亚

更新侧边栏

上级 dad94f7a
......@@ -12,7 +12,7 @@
<el-select v-model="ruleForm.role_id" placeholder="请选择角色" style="width:90%;margin-bottom:10px;" @change="selectRole">
<el-option
v-for="(item,index) in roleList"
:key="index+1"
:key="item.value"
:label="item.label"
:value="item.value"
>
......@@ -23,7 +23,7 @@
<el-select v-model="ruleForm.gift_type" placeholder="请选择" style="width:90%;margin-bottom:10px;" @change="giftTypeResult">
<el-option
v-for="(item,index) in giftTypeList"
:key="index+1"
:key="item.value"
:label="item.label"
:value="item.value"
>
......@@ -35,7 +35,7 @@
<el-select v-model="ruleForm.rule_id" :disabled="activeList.length==0" placeholder="请选择" style="width:90%;margin-bottom:10px;" :multiple="ruleForm.gift_type==1 || ruleForm.gift_type == 4 || ruleForm.gift_type== 5 " clearable @change="activeListResult">
<el-option
v-for="(item,index) in activeList"
:key="index+1"
:key="item.id"
:label="item.title_name"
:value="item.id"
>
......@@ -58,14 +58,14 @@
<!-- 角色累充 -->
<roleRecharge v-if="showGiftDetails && (ruleForm.gift_type==1 || ruleForm.gift_type==4 || ruleForm.gift_type==5) && roleActiveInfo.length>0" :show.sync="showGiftDetails" :request-loading="requestLoading" :active-info="roleActiveInfo" :task_id="task_id" :gift-info="giftDetailsInfo" title="礼包详情" />
<!-- 时间段累充 和 单日累充 积分关的情况 -->
<roleTimeRecharge v-if="showGiftDetails && (ruleForm.gift_type==2 || (ruleForm.gift_type==3 && activeInfo.exchange_score_status==2 ) ) && activeInfo.id " :change-date="changeDate" :request-loading="requestLoading" :task_id="task_id" :show.sync="showGiftDetails" :active-info="activeInfo" :gift-info="giftDetailsInfo" title="礼包详情" @changeDateResult="changeDateResult" @giftDetailsInfo="requestDetailsInfo" />
<!-- 单日累充 积分开的情况 -->
<oneDayCharge v-if="showGiftDetails && ruleForm.gift_type==3 && activeInfo.exchange_score_status==1 && activeInfo.id" :show.sync="showGiftDetails" :task_id="task_id" :request-loading="requestLoading" :active-info="activeInfo" :change-date="changeDate" :gift-info="giftDetailsInfo" title="礼包详情" @changeDateResult="changeDateResult" @giftDetailsInfo="requestDetailsInfo" />
<roleTimeRecharge v-if="showGiftDetails && (ruleForm.gift_type==2 || ruleForm.gift_type == 7 || (ruleForm.gift_type==3 && activeInfo.exchange_score_status==2 ) ) && activeInfo.id " :change-date="changeDate" :request-loading="requestLoading" :task_id="task_id" :show.sync="showGiftDetails" :active-info="activeInfo" :gift-info="giftDetailsInfo" title="礼包详情" @changeDateResult="changeDateResult" @giftDetailsInfo="requestDetailsInfo" />
<!-- 单日累充 积分开的情况 显示 svip 权益 并且可以选择 svip权益-->
<oneDayCharge v-if="showGiftDetails && (ruleForm.gift_type==3 || ruleForm.gift_type == 7) && activeInfo.exchange_score_status==1 && activeInfo.id" :show.sync="showGiftDetails" :task_id="task_id" :request-loading="requestLoading" :active-info="activeInfo" :change-date="changeDate" :gift-info="giftDetailsInfo" title="礼包详情" @changeDateResult="changeDateResult" @giftDetailsSVIPInfo="giftDetailsSVIPInfo" @giftDetailsInfo="requestDetailsInfo" />
</div>
</el-drawer>
</template>
<script type="text/javascript">
import { roleList, activeList, giftBagApply, giftTypeList, giftDetailsData } from '@/api/game'
import { getRoleHoLo, activeList, giftBagApply, giftTypeList, giftDetailsData } from '@/api/game'
import { mapState, mapMutations, mapActions } from 'vuex'
// import giftDetails from './giftDetails.vue'
import roleRecharge from './giftDetails/roleRecharge.vue'
......@@ -124,6 +124,15 @@
this.requestRoleList()
this.giftTypeListData()
},
beforeDestroy() {
// 清理组件销毁时的状态,防止内存泄漏
this.roleList = []
this.activeList = []
this.giftTypeList = []
this.roleActiveInfo = []
this.activeInfo = {}
this.giftDetailsInfo = {}
},
methods: {
requestActiveList() {
if (this.ruleForm.role_id !== '' && this.ruleForm.gift_type !== '') {
......@@ -162,9 +171,12 @@
}
const data = {
api_search_name: '',
member_id: this.member_id || this.accountSelect // 先取任务详情的member_id,没有的话取账号的member_id
member_id:this.member_id || this.accountSelect, // 先取任务详情的member_id,没有的话取账号的member_id
search_type: 'list',
page_size:100,
page:1
}
roleList(data).then(res => {
getRoleHoLo(data).then(res => {
if (res.status_code == 1) {
if (res.data.data.length > 0) {
const list = res.data.data.sort((a, b) => { return Number(b.recharge_total) - Number(a.recharge_total) })
......@@ -197,7 +209,7 @@
this.activeList = []
const gift_type = this.giftTypeList.find(item => item.value == data)
console.log(gift_type, 'gift_type')
this.gift_type_text = gift_type.label
this.gift_type_text = gift_type.label || ''
this.requestActiveList()
this.activeInfo = {}
this.giftInfo = {}
......@@ -246,7 +258,7 @@
this.showGiftDetails = true
} else {
this.ruleForm.recharge_date = ''
if (this.ruleForm.gift_type == 2) {
if (this.ruleForm.gift_type == 2 || this.ruleForm.gift_type == 7) {
this.requestGiftDetails()
this.showGiftDetails = true
}
......@@ -274,6 +286,21 @@
this.$message.warning('请选择充值日期')
}
},
// 积分开的情况 显示 svip 权益 并且可以选择 svip权益
giftDetailsSVIPInfo(params){
console.log(params, 'params')
const data = {
role_id: this.ruleForm.role_id,
rule_id: this.ruleForm.rule_id.toString(),
recharge_date: params.recharge_date || '',
right_type: params.right_type || '',
select_type: params.select_type || ''
}
giftDetailsData(data).then(res => {
this.giftDetailsInfo = res.data
this.showGiftDetails = true
})
},
requestGiftDetails(value) {
const data = {
role_id: this.ruleForm.role_id,
......
......@@ -55,7 +55,7 @@
</div>
</div>
<!-- 活动列表 -->
<span class="dialog-footer rowFlex">
<span class="rowFlex">
<el-button class="btn" type="primary" :loading="loading" @click="submit">确 定</el-button>
<el-button class="btn" @click="close">取 消</el-button>
</span>
......@@ -68,7 +68,7 @@
export default {
name: 'confirmLayer',
// type 3:image 4:video
props: ['show', 'width', 'title', 'activeInfo', 'remark','task_id'],
props: ['show', 'width', 'title', 'activeInfo', 'remark','task_id','svipObj'],
data() {
return {
loading: false
......@@ -106,7 +106,9 @@
recharge_date: this.activeInfo[0].recharge_date || '',
task_id: this.task_id || null,
create_user: this.cser_name,
rule: rule
rule: rule,
right_type: this.svipObj.right_type || '',
select_type: this.svipObj.select_type || ''
}
giftBagApply(data).then(res => {
this.loading = false
......
......@@ -28,6 +28,13 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="svip权益">
<el-select v-model.trim="form.right_type" filterable style="width:100%;"
placeholder="请选择svip权益" @change="searchInput">
<el-option v-for="item in benefitOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="角色名称">
<el-input v-model="form.role_name_or_cp_id" placeholder="请输入角色名称" style="width:100%;"
@change="searchInput"></el-input>
......@@ -59,6 +66,7 @@
</div>
<el-collapse-transition>
<div v-if="item.showDetails">
<p class="text hidden"><label>svip权益:</label> {{ item.right_type_name || '-'}}</p>
<p v-if="item.status == '待提交'" class="text"><label>状态:</label> <span class="noSend">{{ item.status
}}</span> </p>
<p v-else-if="item.status == '已提交'" class="text"><label>状态:</label> <span class="sended">{{
......@@ -165,8 +173,10 @@ export default {
role_name_or_cp_id: '',
member_id: '',
active_title: '',
gift_type: ''
gift_type: '',
right_type: '',
},
benefitOptions: [],
inputValue: '',
pageInfo: {
page: 0,
......@@ -198,6 +208,7 @@ export default {
mounted() {
this.requestGameList()
this.requestGiftType()
this.getBenefitOptions()
},
methods: {
// 重新拉去数据
......@@ -286,6 +297,27 @@ export default {
this.emailGiftList = []
this.requestemailGiftList()
},
async getBenefitOptions() {
try {
const data = {
type: 'svip_right',
}
const res = await selectSearch(data)
if (res.status_code === 1 && res.data && res.data.data && res.data.data.length > 0) {
const showList = ['转生石福利','月核心玩家礼包','超R生日福利礼包','超R行会专属礼包']
this.benefitOptions = res.data.data.filter((item, index) => {
return showList.includes(item.label)
}).map(item => ({
...item,
value: item.value || item.id // 确保每个选项都有value属性,优先使用value,不存在则使用id
}));
console.log(this.benefitOptions)
}
} catch (error) {
console.error('获取权益选项失败:', error)
}
},
requestemailGiftList() {
this.listLoading = true
if (this.accountSelect == '') {
......
......@@ -24,9 +24,23 @@
<div class="activeValue">{{ activeInfo.recharge_start_date + '至' + activeInfo.recharge_end_date }}</div>
</div>
<!-- 选择的时候重新请求活动详情接口 -->
<div class="activeItem rowFlex">
<div class="activeLabel">充值日期</div>
<div style="display: flex; align-items: center;width: 100%;">
<el-select v-model="select_type" :clearable="false" style="width: 120px" @change="onSelectTypeChange">
<el-option label="充值日期" :value="1"></el-option>
<el-option label="SVIP权益" :value="2"></el-option>
</el-select>
<template v-if="select_type === 1">
<el-date-picker v-model="recharge_date_time" :default-value="activeInfo.recharge_date" style="width: 210px" type="date" value-format="yyyy-MM-dd" :picker-options="activeInfo.pickerOptions " @change="dateChange"> </el-date-picker>
</template>
<template v-else-if="select_type === 2">
<el-select v-model="right_type" :clearable="false" style="width: 210px" placeholder="请选择权益" @change="onRightTypeChange">
<el-option v-for="item in benefitOptions" :key="item.id || item.value" :label="item.label" :value="item.value || item.id"></el-option>
</el-select>
</template>
</div>
</div>
<div class="activeItem rowFlex">
<div class="activeLabel">申请角色</div>
......@@ -127,13 +141,13 @@
<el-button class="btn" size="small" @click="close">取 消</el-button>
</span>
<!-- 确认弹窗 -->
<confirmLayer v-if="showConfirmLayer" :remark="remark" :task_id="task_id" :active-info="[activeInfo]" :show.sync="showConfirmLayer" title="请核对申请奖品信息" @close="close" />
<confirmLayer v-if="showConfirmLayer" :remark="remark" :task_id="task_id" :active-info="[activeInfo]" :show.sync="showConfirmLayer" :svipObj="svipObj" title="请核对申请奖品信息" @close="close" />
</div>
</el-drawer>
</template>
<script type="text/javascript">
import { giftBagApply } from '@/api/game'
import { giftBagApply,selectSearch } from '@/api/game'
import { mapState, mapMutations, mapActions } from 'vuex'
import confirmLayer from '../confirmLayer'
export default {
......@@ -155,7 +169,16 @@ export default {
num: '',
allpoints: 0,
showContent: true,
showConfirmLayer: false
benefitOptions:[],
showConfirmLayer: false,
svipObj: {
right_type: '',
select_type: ''
},
// 新增:1 充值日期 2 svip权益
select_type: 1,
// 权益类型选中的值
right_type: ''
}
},
......@@ -175,7 +198,18 @@ export default {
},
mounted() {
this.recharge_date_time = this.activeInfo.recharge_date
this.getBenefitOptions()
},
computed: {
// 根据选择类型显示对应的内容
showDatePicker() {
return this.select_type === 1
},
showBenefitSelect() {
return this.select_type === 2
}
},
methods: {
close() {
this.$emit('update:show', false)
......@@ -187,6 +221,50 @@ export default {
this.$emit('giftDetailsInfo', value)
}
},
async getBenefitOptions() {
try {
const data = {
type: 'svip_right',
}
const res = await selectSearch(data)
if (res.status_code === 1 && res.data && res.data.data && res.data.data.length > 0) {
const showList = ['月核心玩家礼包','超R生日福利礼包']
this.benefitOptions = res.data.data.filter((item, index) => {
return showList.includes(item.label)
}).map(item => ({
...item,
value: item.value || item.id // 确保每个选项都有value属性,优先使用value,不存在则使用id
}));
console.log(this.benefitOptions)
}
} catch (error) {
console.error('获取权益选项失败:', error)
}
},
// 选择类型改变时触发
onSelectTypeChange() {
// 重置选择的值
if (this.select_type === 1) {
this.recharge_date_time = this.activeInfo.recharge_date
// 触发日期变化的接口
this.dateChange(this.recharge_date_time)
} else {
this.right_type = ''
}
},
// 权益类型改变时触发
onRightTypeChange() {
if (this.right_type) {
const data = {
right_type: this.right_type,
select_type: this.select_type
}
// 复用日期变化的接口
this.$emit('giftDetailsSVIPInfo', data)
}
},
openPrizeItem(item, index, value) {
console.log(item, index, value)
this.$set(this.giftInfo.rule.level_attribute[index], 'showContent', value)
......@@ -242,6 +320,8 @@ export default {
}
this.showConfirmLayer = true
this.activeInfo.type_details = this.giftInfo
this.svipObj.right_type = this.right_type
this.svipObj.select_type = this.select_type
}
}
}
......@@ -360,6 +440,7 @@ export default {
left: 50%;
transform: translateX(-50%);
bottom: 100px;
z-index: 100;
}
.consumption-point{
font-size: 14px;
......
......@@ -64,8 +64,30 @@
class="activeValue"
>{{ activeInfo.role_info.label }}</div>
</div>
<div class="activeItem rowFlex">
<div class="activeLabel">SVIP权益</div>
<div
v-if="giftInfo.rule?.right_type_name"
class="activeValue"
>{{ giftInfo.rule?.right_type_name || '-' }}</div>
</div>
<div class="rowFlex">
<div class="activeItem rowFlex">
<div class="activeLabel" style="width: 70px">可领取次数</div>
<div
v-if="giftInfo.total_recharge"
class="activeValue"
>{{ giftInfo.total_recharge || '-' }}</div>
</div>
<div class="activeItem rowFlex">
<div class="activeLabel" style="width: 90px">剩余领取次数</div>
<div
v-if="giftInfo.real_score"
class="activeValue"
>{{ giftInfo.real_score || '-' }}</div>
</div>
</div>
<!-- 积分关的情况 -->
<div
v-if="activeInfo.gift_type == 2"
class="activeItem rowFlex"
......@@ -234,7 +256,7 @@
type="primary"
size="small"
:disabled="requestLoading"
@click="submit"
@click="submitBtn"
:loading="btnLoading"
>确 定</el-button>
<el-button
......@@ -386,7 +408,59 @@ export default {
handleChange() {
},
async submit() {
submitBtn(){
// svip 权益礼包
if(this.activeInfo.gift_type==7){
this.submitSvipGfit()
} else{
this.submitGift()
}
},
submitSvipGfit(){
this.loading = true
const role_id = this.activeInfo.role_info.value
// 直接处理activeInfo对象,避免不必要的数组包装和map操作
const activeInfo = this.activeInfo
let level_attribute = []
try {
// 安全地访问嵌套属性
if (this.giftInfo?.rule?.gift_type === 1) {
level_attribute = this.giftInfo.rule.level_attribute || []
} else if (this.giftInfo?.rule?.level_attribute) {
// 过滤出可申请的等级属性
level_attribute = this.giftInfo.rule.level_attribute.filter(item => item.apply_num > 0)
}
} catch (error) {
console.error('处理礼包等级属性时出错:', error)
// 出错时保持level_attribute为空数组
}
// 构建规则数据
const rule = [{ level_attribute, id: activeInfo.id }]
const data = {
role_id:role_id,
recharge_date:'',
remark: this.remark,
create_user: this.name,
task_id: this.task_id || null,
right_type: this.activeInfo.right_type || '',
select_type:this.activeInfo.gift_type==7?2:'',
rule: rule
}
giftBagApply(data).then(res => {
this.loading = false
if (res.status_code === 1) {
this.$message.success(res.msg)
this.close()
this.$emit('close')
} else {
this.close()
}
}, err => {
this.loading = false
})
},
async submitGift() {
this.btnLoading = true
const data = {
role_id: this.giftInfo.role_id,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论